From adc6234f3d8cac79b2d21f3fa8c436877fbd3ac1 Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 23 Jun 2021 23:08:56 +0300 Subject: [PATCH 01/52] remove es query dependency on format.convert --- .../common/es_query/filters/meta_filter.ts | 4 +- .../common/es_query/filters/phrases_filter.ts | 7 +-- .../common/es_query/filters/range_filter.ts | 5 +-- .../data/common/es_query/filters/types.ts | 2 + .../lib/get_display_value.test.ts | 44 +++++++++++++++++++ .../filter_manager/lib/get_display_value.ts | 9 ++-- .../filter_manager/lib/mappers/map_phrases.ts | 21 +++++++-- 7 files changed, 74 insertions(+), 18 deletions(-) create mode 100644 src/plugins/data/public/query/filter_manager/lib/get_display_value.test.ts diff --git a/src/plugins/data/common/es_query/filters/meta_filter.ts b/src/plugins/data/common/es_query/filters/meta_filter.ts index 87455cf1cb7639..b6714b5b8d02ac 100644 --- a/src/plugins/data/common/es_query/filters/meta_filter.ts +++ b/src/plugins/data/common/es_query/filters/meta_filter.ts @@ -6,6 +6,8 @@ * Side Public License, v 1. */ +import { ConvertFn } from './types'; + export enum FilterStateStore { APP_STATE = 'appState', GLOBAL_STATE = 'globalState', @@ -35,7 +37,7 @@ export type FilterMeta = { type?: string; key?: string; params?: any; - value?: string; + value?: string | ConvertFn; }; // eslint-disable-next-line diff --git a/src/plugins/data/common/es_query/filters/phrases_filter.ts b/src/plugins/data/common/es_query/filters/phrases_filter.ts index 8a794721544937..2694461fc19300 100644 --- a/src/plugins/data/common/es_query/filters/phrases_filter.ts +++ b/src/plugins/data/common/es_query/filters/phrases_filter.ts @@ -41,11 +41,6 @@ export const buildPhrasesFilter = ( const type = FILTERS.PHRASES; const key = field.name; - const format = (f: IFieldType, value: any) => - f && f.format && f.format.convert ? f.format.convert(value) : value; - - const value = params.map((v: any) => format(field, v)).join(', '); - let should; if (field.scripted) { should = params.map((v: any) => ({ @@ -60,7 +55,7 @@ export const buildPhrasesFilter = ( } return { - meta: { index, type, key, value, params }, + meta: { index, type, key, params }, query: { bool: { should, diff --git a/src/plugins/data/common/es_query/filters/range_filter.ts b/src/plugins/data/common/es_query/filters/range_filter.ts index 7bc7a8cff7487b..9f1d9a5d089264 100644 --- a/src/plugins/data/common/es_query/filters/range_filter.ts +++ b/src/plugins/data/common/es_query/filters/range_filter.ts @@ -84,10 +84,7 @@ export const getRangeFilterField = (filter: RangeFilter) => { }; const formatValue = (field: IFieldType, params: any[]) => - map(params, (val: any, key: string) => get(operators, key) + format(field, val)).join(' '); - -const format = (field: IFieldType, value: any) => - field && field.format && field.format.convert ? field.format.convert(value) : value; + map(params, (val: any, key: string) => get(operators, key) + val).join(' '); // 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` diff --git a/src/plugins/data/common/es_query/filters/types.ts b/src/plugins/data/common/es_query/filters/types.ts index a007189d81a035..364400e6a2009a 100644 --- a/src/plugins/data/common/es_query/filters/types.ts +++ b/src/plugins/data/common/es_query/filters/types.ts @@ -40,3 +40,5 @@ export enum FILTERS { GEO_POLYGON = 'geo_polygon', SPATIAL_FILTER = 'spatial_filter', } + +export type ConvertFn = (value: any) => string; diff --git a/src/plugins/data/public/query/filter_manager/lib/get_display_value.test.ts b/src/plugins/data/public/query/filter_manager/lib/get_display_value.test.ts new file mode 100644 index 00000000000000..d0211e13532576 --- /dev/null +++ b/src/plugins/data/public/query/filter_manager/lib/get_display_value.test.ts @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { stubIndexPattern, phraseFilter } from 'src/plugins/data/common/stubs'; +import { getDisplayValueFromFilter } from './get_display_value'; + +describe('getDisplayValueFromFilter', () => { + it('returns the value if string', () => { + phraseFilter.meta.value = 'abc'; + const displayValue = getDisplayValueFromFilter(phraseFilter, [stubIndexPattern]); + expect(displayValue).toBe('abc'); + }); + + it('returns the value if undefined', () => { + phraseFilter.meta.value = undefined; + const displayValue = getDisplayValueFromFilter(phraseFilter, [stubIndexPattern]); + expect(displayValue).toBe(''); + }); + + it('calls the value function if proivided', () => { + phraseFilter.meta.value = jest.fn((x) => { + return 'abc'; + }); + const displayValue = getDisplayValueFromFilter(phraseFilter, [stubIndexPattern]); + expect(displayValue).toBe('abc'); + expect(phraseFilter.meta.value).toHaveBeenCalledWith(undefined); + }); + + it('calls the value function if proivided, with formatter', () => { + stubIndexPattern.getFormatterForField = jest.fn().mockReturnValue('banana'); + phraseFilter.meta.value = jest.fn((x) => { + return x + 'abc'; + }); + const displayValue = getDisplayValueFromFilter(phraseFilter, [stubIndexPattern]); + expect(stubIndexPattern.getFormatterForField).toHaveBeenCalledTimes(1); + expect(phraseFilter.meta.value).toHaveBeenCalledWith('banana'); + expect(displayValue).toBe('bananaabc'); + }); +}); diff --git a/src/plugins/data/public/query/filter_manager/lib/get_display_value.ts b/src/plugins/data/public/query/filter_manager/lib/get_display_value.ts index 45c6167f600bca..17853d1e93cda3 100644 --- a/src/plugins/data/public/query/filter_manager/lib/get_display_value.ts +++ b/src/plugins/data/public/query/filter_manager/lib/get_display_value.ts @@ -28,11 +28,12 @@ function getValueFormatter(indexPattern?: IIndexPattern, key?: string) { } export function getDisplayValueFromFilter(filter: Filter, indexPatterns: IIndexPattern[]): string { - if (typeof filter.meta.value === 'function') { + const { key, value } = filter.meta; + if (typeof value === 'function') { const indexPattern = getIndexPatternFromFilter(filter, indexPatterns); - const valueFormatter: any = getValueFormatter(indexPattern, filter.meta.key); - return (filter.meta.value as any)(valueFormatter); + const valueFormatter = getValueFormatter(indexPattern, key); + return value(valueFormatter); } else { - return filter.meta.value || ''; + return value || ''; } } diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrases.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrases.ts index bfd528264b00fd..5601dd66e52066 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrases.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrases.ts @@ -6,14 +6,29 @@ * Side Public License, v 1. */ -import { Filter, isPhrasesFilter } from '../../../../../common'; +import { Filter, FilterValueFormatter, isPhrasesFilter } from '../../../../../common'; + +const getFormattedValueFn = (params: any) => { + return (formatter?: FilterValueFormatter) => { + return params + .map((v: any) => { + return formatter ? formatter.convert(v) : v; + }) + .join(', '); + }; +}; export const mapPhrases = (filter: Filter) => { if (!isPhrasesFilter(filter)) { throw filter; } - const { type, key, value, params } = filter.meta; + const { type, key, params } = filter.meta; - return { type, key, value, params }; + return { + type, + key, + value: getFormattedValueFn(params), + params, + }; }; From f8e7e158be43c90d78ddc158236bc4ded7ad0bf5 Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 23 Jun 2021 23:29:35 +0300 Subject: [PATCH 02/52] FieldBase --- .../es_query/es_query/filter_matches_index.ts | 5 ++-- .../es_query/handle_nested_filter.test.ts | 5 ++-- .../data/common/es_query/es_query/index.ts | 2 +- .../data/common/es_query/es_query/types.ts | 24 +++++++++++++++++-- .../common/es_query/filters/build_filters.ts | 7 +++--- .../common/es_query/filters/exists_filter.ts | 4 ++-- .../common/es_query/filters/phrase_filter.ts | 8 +++---- .../common/es_query/filters/phrases_filter.ts | 5 ++-- .../es_query/filters/range_filter.test.ts | 14 +++++------ .../common/es_query/filters/range_filter.ts | 9 ++++--- .../common/es_query/kuery/functions/exists.ts | 6 ++--- .../kuery/functions/geo_bounding_box.ts | 6 ++--- .../es_query/kuery/functions/geo_polygon.ts | 6 ++--- .../common/es_query/kuery/functions/is.ts | 4 ++-- .../common/es_query/kuery/functions/range.ts | 4 ++-- .../kuery/functions/utils/get_fields.test.ts | 14 +++++------ .../utils/get_full_field_name_node.ts | 4 ++-- .../common/index_patterns/fields/types.ts | 11 ++------- .../data/common/index_patterns/types.ts | 23 ++---------------- 19 files changed, 76 insertions(+), 85 deletions(-) diff --git a/src/plugins/data/common/es_query/es_query/filter_matches_index.ts b/src/plugins/data/common/es_query/es_query/filter_matches_index.ts index b376436756092d..f77a029b6bdd5d 100644 --- a/src/plugins/data/common/es_query/es_query/filter_matches_index.ts +++ b/src/plugins/data/common/es_query/es_query/filter_matches_index.ts @@ -6,9 +6,8 @@ * Side Public License, v 1. */ -import { IFieldType } from '../../index_patterns'; import { Filter } from '../filters'; -import { IndexPatternBase } from './types'; +import { FieldBase, IndexPatternBase } from './types'; /* * TODO: We should base this on something better than `filter.meta.key`. We should probably modify @@ -26,5 +25,5 @@ export function filterMatchesIndex(filter: Filter, indexPattern?: IndexPatternBa return filter.meta.index === indexPattern.id; } - return indexPattern.fields.some((field: IFieldType) => field.name === filter.meta.key); + return indexPattern.fields.some((field) => field.name === filter.meta.key); } diff --git a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts b/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts index d312d034df5641..bc0df315340fee 100644 --- a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts +++ b/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts @@ -9,8 +9,7 @@ import { handleNestedFilter } from './handle_nested_filter'; import { fields } from '../../index_patterns/mocks'; import { buildPhraseFilter, buildQueryFilter } from '../filters'; -import { IndexPatternBase } from './types'; -import { IFieldType } from '../../index_patterns'; +import { IndexPatternBase, FieldBase } from './types'; describe('handleNestedFilter', function () { const indexPattern: IndexPatternBase = { @@ -46,7 +45,7 @@ describe('handleNestedFilter', function () { it('should return filter untouched if it does not target a field from the given index pattern', () => { const field = { ...getField('extension'), name: 'notarealfield' }; - const filter = buildPhraseFilter(field as IFieldType, 'jpg', indexPattern); + const filter = buildPhraseFilter(field, 'jpg', indexPattern); const result = handleNestedFilter(filter, indexPattern); expect(result).toBe(filter); }); diff --git a/src/plugins/data/common/es_query/es_query/index.ts b/src/plugins/data/common/es_query/es_query/index.ts index c10ea5846ae3fd..efe645f111b6af 100644 --- a/src/plugins/data/common/es_query/es_query/index.ts +++ b/src/plugins/data/common/es_query/es_query/index.ts @@ -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 } from './types'; +export { IndexPatternBase, FieldBase, IFieldSubType } from './types'; diff --git a/src/plugins/data/common/es_query/es_query/types.ts b/src/plugins/data/common/es_query/es_query/types.ts index 21337365160491..29d5b4dad6a617 100644 --- a/src/plugins/data/common/es_query/es_query/types.ts +++ b/src/plugins/data/common/es_query/es_query/types.ts @@ -6,9 +6,29 @@ * Side Public License, v 1. */ -import { IFieldType } from '../../index_patterns'; +import type { estypes } from '@elastic/elasticsearch'; + +export interface IFieldSubType { + multi?: { parent: string }; + nested?: { path: string }; +} +export interface FieldBase { + name: string; + type: string; + subType?: IFieldSubType; + /** + * Scripted field painless script + */ + script?: string; + /** + * Scripted field langauge + * Painless is the only valid scripted field language + */ + lang?: estypes.ScriptLanguage; + scripted?: boolean; +} export interface IndexPatternBase { - fields: IFieldType[]; + fields: FieldBase[]; id?: string; } diff --git a/src/plugins/data/common/es_query/filters/build_filters.ts b/src/plugins/data/common/es_query/filters/build_filters.ts index 369f9530fb92b2..333bca779af44a 100644 --- a/src/plugins/data/common/es_query/filters/build_filters.ts +++ b/src/plugins/data/common/es_query/filters/build_filters.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import { IFieldType, IndexPatternBase } from '../..'; +import { FieldBase, IndexPatternBase } from '../..'; + import { Filter, FILTERS, @@ -20,7 +21,7 @@ import { export function buildFilter( indexPattern: IndexPatternBase, - field: IFieldType, + field: FieldBase, type: FILTERS, negate: boolean, disabled: boolean, @@ -60,7 +61,7 @@ export function buildCustomFilter( function buildBaseFilter( indexPattern: IndexPatternBase, - field: IFieldType, + field: FieldBase, type: FILTERS, params: any ): Filter { diff --git a/src/plugins/data/common/es_query/filters/exists_filter.ts b/src/plugins/data/common/es_query/filters/exists_filter.ts index 4836950c3bb277..f5ffb85490bc27 100644 --- a/src/plugins/data/common/es_query/filters/exists_filter.ts +++ b/src/plugins/data/common/es_query/filters/exists_filter.ts @@ -7,7 +7,7 @@ */ import { Filter, FilterMeta } from './meta_filter'; -import { IFieldType } from '../../index_patterns'; +import { FieldBase } from '../../index_patterns'; import { IndexPatternBase } from '..'; export type ExistsFilterMeta = FilterMeta; @@ -27,7 +27,7 @@ export const getExistsFilterField = (filter: ExistsFilter) => { return filter.exists && filter.exists.field; }; -export const buildExistsFilter = (field: IFieldType, indexPattern: IndexPatternBase) => { +export const buildExistsFilter = (field: FieldBase, indexPattern: IndexPatternBase) => { return { meta: { index: indexPattern.id, diff --git a/src/plugins/data/common/es_query/filters/phrase_filter.ts b/src/plugins/data/common/es_query/filters/phrase_filter.ts index 27c1e85562097c..7433d1eb7a2cf6 100644 --- a/src/plugins/data/common/es_query/filters/phrase_filter.ts +++ b/src/plugins/data/common/es_query/filters/phrase_filter.ts @@ -8,7 +8,7 @@ import type { estypes } from '@elastic/elasticsearch'; import { get, isPlainObject } from 'lodash'; import { Filter, FilterMeta } from './meta_filter'; -import { IFieldType } from '../../index_patterns'; +import { FieldBase } from '../../index_patterns'; import { IndexPatternBase } from '..'; export type PhraseFilterMeta = FilterMeta & { @@ -59,7 +59,7 @@ export const getPhraseFilterValue = (filter: PhraseFilter): PhraseFilterValue => }; export const buildPhraseFilter = ( - field: IFieldType, + field: FieldBase, value: any, indexPattern: IndexPatternBase ): PhraseFilter => { @@ -82,7 +82,7 @@ export const buildPhraseFilter = ( } }; -export const getPhraseScript = (field: IFieldType, value: string) => { +export const getPhraseScript = (field: FieldBase, value: string) => { const convertedValue = getConvertedValueForField(field, value); const script = buildInlineScriptForPhraseFilter(field); @@ -106,7 +106,7 @@ export const getPhraseScript = (field: IFieldType, value: string) => { * https://github.com/elastic/elasticsearch/issues/20941 * https://github.com/elastic/elasticsearch/pull/22201 **/ -export const getConvertedValueForField = (field: IFieldType, value: any) => { +export const getConvertedValueForField = (field: FieldBase, value: any) => { if (typeof value !== 'boolean' && field.type === 'boolean') { if ([1, 'true'].includes(value)) { return true; diff --git a/src/plugins/data/common/es_query/filters/phrases_filter.ts b/src/plugins/data/common/es_query/filters/phrases_filter.ts index 2694461fc19300..e73f0f4e6a810a 100644 --- a/src/plugins/data/common/es_query/filters/phrases_filter.ts +++ b/src/plugins/data/common/es_query/filters/phrases_filter.ts @@ -9,8 +9,7 @@ import { Filter, FilterMeta } from './meta_filter'; import { getPhraseScript } from './phrase_filter'; import { FILTERS } from './index'; -import { IFieldType } from '../../index_patterns'; -import { IndexPatternBase } from '../es_query'; +import { FieldBase, IndexPatternBase } from '../es_query'; export type PhrasesFilterMeta = FilterMeta & { params: string[]; // The unformatted values @@ -33,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: IFieldType, + field: FieldBase, params: any[], indexPattern: IndexPatternBase ) => { diff --git a/src/plugins/data/common/es_query/filters/range_filter.test.ts b/src/plugins/data/common/es_query/filters/range_filter.test.ts index bb7ecc09ebc349..613f987a768008 100644 --- a/src/plugins/data/common/es_query/filters/range_filter.test.ts +++ b/src/plugins/data/common/es_query/filters/range_filter.test.ts @@ -9,15 +9,15 @@ import { each } from 'lodash'; import { buildRangeFilter, getRangeFilterField, RangeFilter } from './range_filter'; import { fields, getField } from '../../index_patterns/mocks'; -import { IIndexPattern, IFieldType } from '../../index_patterns'; +import { IndexPatternBase, FieldBase } from '../es_query'; describe('Range filter builder', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { indexPattern = { id: 'id', - } as IIndexPattern; + } as IndexPatternBase; }); it('should be a function', () => { @@ -130,7 +130,7 @@ describe('Range filter builder', () => { }); describe('when given params where one side is infinite', () => { - let field: IFieldType; + let field: FieldBase; let filter: RangeFilter; beforeEach(() => { @@ -160,7 +160,7 @@ describe('Range filter builder', () => { }); describe('when given params where both sides are infinite', () => { - let field: IFieldType; + let field: FieldBase; let filter: RangeFilter; beforeEach(() => { @@ -186,9 +186,9 @@ describe('Range filter builder', () => { }); describe('getRangeFilterField', function () { - const indexPattern: IIndexPattern = ({ + const indexPattern: IndexPatternBase = ({ fields, - } as unknown) as IIndexPattern; + } as unknown) as IndexPatternBase; test('should return the name of the field a range query is targeting', () => { const field = indexPattern.fields.find((patternField) => patternField.name === 'bytes'); diff --git a/src/plugins/data/common/es_query/filters/range_filter.ts b/src/plugins/data/common/es_query/filters/range_filter.ts index 9f1d9a5d089264..4b0fc10d90ff62 100644 --- a/src/plugins/data/common/es_query/filters/range_filter.ts +++ b/src/plugins/data/common/es_query/filters/range_filter.ts @@ -8,8 +8,7 @@ import type { estypes } from '@elastic/elasticsearch'; import { map, reduce, mapValues, get, keys, pickBy } from 'lodash'; import { Filter, FilterMeta } from './meta_filter'; -import { IFieldType } from '../../index_patterns'; -import { IndexPatternBase } from '..'; +import { IndexPatternBase, FieldBase } from '..'; const OPERANDS_IN_RANGE = 2; @@ -83,13 +82,13 @@ export const getRangeFilterField = (filter: RangeFilter) => { return filter.range && Object.keys(filter.range)[0]; }; -const formatValue = (field: IFieldType, params: any[]) => +const formatValue = (field: FieldBase, params: any[]) => map(params, (val: any, key: string) => get(operators, key) + val).join(' '); // 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: IFieldType, + field: FieldBase, params: RangeFilterParams, indexPattern: IndexPatternBase, formattedValue?: string @@ -135,7 +134,7 @@ export const buildRangeFilter = ( return filter as RangeFilter; }; -export const getRangeScript = (field: IFieldType, params: RangeFilterParams) => { +export const getRangeScript = (field: FieldBase, params: RangeFilterParams) => { const knownParams = mapValues( pickBy(params, (val, key: any) => key in operators), (value) => (field.type === 'number' && typeof value === 'string' ? parseFloat(value) : value) diff --git a/src/plugins/data/common/es_query/kuery/functions/exists.ts b/src/plugins/data/common/es_query/kuery/functions/exists.ts index fa6c37e6ba18f7..17db93ae68d261 100644 --- a/src/plugins/data/common/es_query/kuery/functions/exists.ts +++ b/src/plugins/data/common/es_query/kuery/functions/exists.ts @@ -8,7 +8,7 @@ import { get } from 'lodash'; import * as literal from '../node_types/literal'; -import { KueryNode, IFieldType, IndexPatternBase } from '../../..'; +import { KueryNode, FieldBase, IndexPatternBase } from '../../..'; export function buildNodeParams(fieldName: string) { return { @@ -30,9 +30,9 @@ export function toElasticsearchQuery( value: context?.nested ? `${context.nested.path}.${fieldNameArg.value}` : fieldNameArg.value, }; const fieldName = literal.toElasticsearchQuery(fullFieldNameArg); - const field = get(indexPattern, 'fields', []).find((fld: IFieldType) => fld.name === fieldName); + const field = indexPattern?.fields?.find((fld: FieldBase) => fld.name === fieldName); - if (field && (field as IFieldType).scripted) { + if (field?.scripted) { throw new Error(`Exists query does not support scripted fields`); } return { diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts b/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts index 38a433b1b80ab0..60211f3f67863e 100644 --- a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts +++ b/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts @@ -9,7 +9,7 @@ import _ from 'lodash'; import { nodeTypes } from '../node_types'; import * as ast from '../ast'; -import { IndexPatternBase, KueryNode, IFieldType, LatLon } from '../../..'; +import { IndexPatternBase, KueryNode, FieldBase, LatLon } from '../../..'; export function buildNodeParams(fieldName: string, params: any) { params = _.pick(params, 'topLeft', 'bottomRight'); @@ -36,8 +36,8 @@ export function toElasticsearchQuery( value: context?.nested ? `${context.nested.path}.${fieldNameArg.value}` : fieldNameArg.value, }; const fieldName = nodeTypes.literal.toElasticsearchQuery(fullFieldNameArg) as string; - const fieldList: IFieldType[] = indexPattern?.fields ?? []; - const field = fieldList.find((fld: IFieldType) => fld.name === fieldName); + const fieldList = indexPattern?.fields ?? []; + const field = fieldList.find((fld) => fld.name === fieldName); const queryParams = args.reduce((acc: any, arg: any) => { const snakeArgName = _.snakeCase(arg.name); diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts b/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts index 69de7248a7b380..b437baf37988e2 100644 --- a/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts +++ b/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts @@ -8,7 +8,7 @@ import { nodeTypes } from '../node_types'; import * as ast from '../ast'; -import { IndexPatternBase, KueryNode, IFieldType, LatLon } from '../../..'; +import { IndexPatternBase, KueryNode, FieldBase, LatLon } from '../../..'; import { LiteralTypeBuildNode } from '../node_types/types'; export function buildNodeParams(fieldName: string, points: LatLon[]) { @@ -35,8 +35,8 @@ export function toElasticsearchQuery( value: context?.nested ? `${context.nested.path}.${fieldNameArg.value}` : fieldNameArg.value, }; const fieldName = nodeTypes.literal.toElasticsearchQuery(fullFieldNameArg) as string; - const fieldList: IFieldType[] = indexPattern?.fields ?? []; - const field = fieldList.find((fld: IFieldType) => fld.name === fieldName); + const fieldList = indexPattern?.fields ?? []; + const field = fieldList.find((fld) => fld.name === fieldName); const queryParams = { points: points.map((point: LiteralTypeBuildNode) => { return ast.toElasticsearchQuery(point, indexPattern, config, context); diff --git a/src/plugins/data/common/es_query/kuery/functions/is.ts b/src/plugins/data/common/es_query/kuery/functions/is.ts index 55d036c2156f9b..47ae5bb4af0d94 100644 --- a/src/plugins/data/common/es_query/kuery/functions/is.ts +++ b/src/plugins/data/common/es_query/kuery/functions/is.ts @@ -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, IFieldType } from '../../..'; +import { IndexPatternBase, KueryNode, FieldBase } from '../../..'; import * as ast from '../ast'; @@ -100,7 +100,7 @@ export function toElasticsearchQuery( return { match_all: {} }; } - const queries = fields!.reduce((accumulator: any, field: IFieldType) => { + const queries = fields!.reduce((accumulator: any, field: FieldBase) => { 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. diff --git a/src/plugins/data/common/es_query/kuery/functions/range.ts b/src/plugins/data/common/es_query/kuery/functions/range.ts index caefa7e5373cac..13919759f4dbb2 100644 --- a/src/plugins/data/common/es_query/kuery/functions/range.ts +++ b/src/plugins/data/common/es_query/kuery/functions/range.ts @@ -13,7 +13,7 @@ import { getRangeScript, RangeFilterParams } from '../../filters'; import { getFields } from './utils/get_fields'; import { getTimeZoneFromSettings } from '../../utils'; import { getFullFieldNameNode } from './utils/get_full_field_name_node'; -import { IndexPatternBase, KueryNode, IFieldType } from '../../..'; +import { IndexPatternBase, KueryNode, FieldBase } from '../../..'; export function buildNodeParams(fieldName: string, params: RangeFilterParams) { const paramsToMap = _.pick(params, 'gt', 'lt', 'gte', 'lte', 'format'); @@ -62,7 +62,7 @@ export function toElasticsearchQuery( }); } - const queries = fields!.map((field: IFieldType) => { + const queries = fields!.map((field) => { 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. diff --git a/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.test.ts b/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.test.ts index 47fe677454cbfc..949f94d0435539 100644 --- a/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.test.ts +++ b/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.test.ts @@ -6,21 +6,21 @@ * Side Public License, v 1. */ +import { IndexPatternBase } from '../../..'; import { fields } from '../../../../index_patterns/mocks'; import { nodeTypes } from '../../index'; -import { IIndexPattern, IFieldType } from '../../../../index_patterns'; // @ts-ignore import { getFields } from './get_fields'; describe('getFields', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { indexPattern = ({ fields, - } as unknown) as IIndexPattern; + } as unknown) as IndexPatternBase; }); describe('field names without a wildcard', () => { @@ -41,14 +41,14 @@ describe('getFields', () => { }); test('should not match a wildcard in a literal node', () => { - const indexPatternWithWildField = { + const indexPatternWithWildField: IndexPatternBase = ({ title: 'wildIndex', fields: [ { name: 'foo*', }, ], - } as IIndexPattern; + } as unknown) as IndexPatternBase; const fieldNameNode = nodeTypes.literal.buildNode('foo*'); const results = getFields(fieldNameNode, indexPatternWithWildField); @@ -76,8 +76,8 @@ describe('getFields', () => { expect(Array.isArray(results)).toBeTruthy(); expect(results).toHaveLength(2); - expect(results!.find((field: IFieldType) => field.name === 'machine.os')).toBeDefined(); - expect(results!.find((field: IFieldType) => field.name === 'machine.os.raw')).toBeDefined(); + expect(results!.find((field) => field.name === 'machine.os')).toBeDefined(); + expect(results!.find((field) => field.name === 'machine.os.raw')).toBeDefined(); }); }); }); diff --git a/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts b/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts index 644791637aa709..cfea79696122c6 100644 --- a/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts +++ b/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts @@ -7,7 +7,7 @@ */ import { getFields } from './get_fields'; -import { IndexPatternBase, IFieldType, KueryNode } from '../../../..'; +import { IndexPatternBase, FieldBase, KueryNode } from '../../../..'; export function getFullFieldNameNode( rootNameNode: any, @@ -27,7 +27,7 @@ export function getFullFieldNameNode( } const fields = getFields(fullFieldNameNode, indexPattern); - const errors = fields!.reduce((acc: any, field: IFieldType) => { + const errors = fields!.reduce((acc: any, field: FieldBase) => { const nestedPathFromField = field.subType && field.subType.nested ? field.subType.nested.path : undefined; diff --git a/src/plugins/data/common/index_patterns/fields/types.ts b/src/plugins/data/common/index_patterns/fields/types.ts index 0fb7a46c2cf73d..608294b04dc910 100644 --- a/src/plugins/data/common/index_patterns/fields/types.ts +++ b/src/plugins/data/common/index_patterns/fields/types.ts @@ -5,18 +5,13 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import type { estypes } from '@elastic/elasticsearch'; -import { FieldSpec, IFieldSubType, IndexPattern } from '../..'; +import { FieldBase, FieldSpec, IndexPattern } from '../..'; /** * @deprecated * Use IndexPatternField or FieldSpec instead */ -export interface IFieldType { - name: string; - type: string; - script?: string; - lang?: estypes.ScriptLanguage; +export interface IFieldType extends FieldBase { 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. @@ -27,8 +22,6 @@ export interface IFieldType { sortable?: boolean; visualizable?: boolean; readFromDocValues?: boolean; - scripted?: boolean; - subType?: IFieldSubType; displayName?: string; customLabel?: string; format?: any; diff --git a/src/plugins/data/common/index_patterns/types.ts b/src/plugins/data/common/index_patterns/types.ts index a88f029c0c7cd9..4fa7531efcb744 100644 --- a/src/plugins/data/common/index_patterns/types.ts +++ b/src/plugins/data/common/index_patterns/types.ts @@ -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 { IndexPatternBase } from '../es_query'; +import type { FieldBase, IFieldSubType, IndexPatternBase } from '../es_query'; import { IFieldType } from './fields'; import { RUNTIME_FIELD_TYPES } from './constants'; import { SerializedFieldFormat } from '../../../expressions/common'; @@ -149,12 +149,6 @@ export type AggregationRestrictions = Record< time_zone?: string; } >; - -export interface IFieldSubType { - multi?: { parent: string }; - nested?: { path: string }; -} - export interface TypeMeta { aggs?: Record; [key: string]: any; @@ -183,30 +177,17 @@ export interface FieldSpecExportFmt { /** * Serialized version of IndexPatternField */ -export interface FieldSpec { +export interface FieldSpec extends FieldBase { /** * Popularity count is used by discover */ count?: number; - /** - * Scripted field painless script - */ - script?: string; - /** - * Scripted field langauge - * Painless is the only valid scripted field language - */ - lang?: estypes.ScriptLanguage; conflictDescriptions?: Record; format?: SerializedFieldFormat; - name: string; - type: string; esTypes?: string[]; - scripted?: boolean; searchable: boolean; aggregatable: boolean; readFromDocValues?: boolean; - subType?: IFieldSubType; indexed?: boolean; customLabel?: string; runtimeField?: RuntimeField; From 1a2284fad68b69c8d9e703326e5e9ac9d454959b Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 23 Jun 2021 23:47:39 +0300 Subject: [PATCH 03/52] fix types --- src/plugins/data/common/es_query/filters/meta_filter.ts | 4 +--- src/plugins/data/common/es_query/filters/types.ts | 2 -- .../data/public/query/filter_manager/lib/get_display_value.ts | 4 +++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins/data/common/es_query/filters/meta_filter.ts b/src/plugins/data/common/es_query/filters/meta_filter.ts index b6714b5b8d02ac..87455cf1cb7639 100644 --- a/src/plugins/data/common/es_query/filters/meta_filter.ts +++ b/src/plugins/data/common/es_query/filters/meta_filter.ts @@ -6,8 +6,6 @@ * Side Public License, v 1. */ -import { ConvertFn } from './types'; - export enum FilterStateStore { APP_STATE = 'appState', GLOBAL_STATE = 'globalState', @@ -37,7 +35,7 @@ export type FilterMeta = { type?: string; key?: string; params?: any; - value?: string | ConvertFn; + value?: string; }; // eslint-disable-next-line diff --git a/src/plugins/data/common/es_query/filters/types.ts b/src/plugins/data/common/es_query/filters/types.ts index 364400e6a2009a..a007189d81a035 100644 --- a/src/plugins/data/common/es_query/filters/types.ts +++ b/src/plugins/data/common/es_query/filters/types.ts @@ -40,5 +40,3 @@ export enum FILTERS { GEO_POLYGON = 'geo_polygon', SPATIAL_FILTER = 'spatial_filter', } - -export type ConvertFn = (value: any) => string; diff --git a/src/plugins/data/public/query/filter_manager/lib/get_display_value.ts b/src/plugins/data/public/query/filter_manager/lib/get_display_value.ts index 17853d1e93cda3..1ccfaacb24e4bd 100644 --- a/src/plugins/data/public/query/filter_manager/lib/get_display_value.ts +++ b/src/plugins/data/public/query/filter_manager/lib/get_display_value.ts @@ -32,7 +32,9 @@ export function getDisplayValueFromFilter(filter: Filter, indexPatterns: IIndexP if (typeof value === 'function') { const indexPattern = getIndexPatternFromFilter(filter, indexPatterns); const valueFormatter = getValueFormatter(indexPattern, key); - return value(valueFormatter); + // TODO: distinguish between FilterMeta which is serializable to mapped FilterMeta + // Where value can be a function. + return (value as any)(valueFormatter); } else { return value || ''; } From 5b40ebced194077d3042dfa96f810e9cd50bd8c0 Mon Sep 17 00:00:00 2001 From: Liza K Date: Sun, 27 Jun 2021 15:00:11 +0300 Subject: [PATCH 04/52] types --- .../data/common/search/expressions/phrase_filter.test.ts | 1 - .../query/filter_manager/lib/get_display_value.test.ts | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/data/common/search/expressions/phrase_filter.test.ts b/src/plugins/data/common/search/expressions/phrase_filter.test.ts index 39bd907513a0df..a61cc0bfd68ab0 100644 --- a/src/plugins/data/common/search/expressions/phrase_filter.test.ts +++ b/src/plugins/data/common/search/expressions/phrase_filter.test.ts @@ -32,7 +32,6 @@ describe('interpreter/functions#phraseFilter', () => { "something", ], "type": "phrases", - "value": "test, something", }, "query": Object { "bool": Object { diff --git a/src/plugins/data/public/query/filter_manager/lib/get_display_value.test.ts b/src/plugins/data/public/query/filter_manager/lib/get_display_value.test.ts index d0211e13532576..48e1007534769f 100644 --- a/src/plugins/data/public/query/filter_manager/lib/get_display_value.test.ts +++ b/src/plugins/data/public/query/filter_manager/lib/get_display_value.test.ts @@ -23,9 +23,10 @@ describe('getDisplayValueFromFilter', () => { }); it('calls the value function if proivided', () => { + // The type of value currently doesn't match how it's used. Refactor needed. phraseFilter.meta.value = jest.fn((x) => { return 'abc'; - }); + }) as any; const displayValue = getDisplayValueFromFilter(phraseFilter, [stubIndexPattern]); expect(displayValue).toBe('abc'); expect(phraseFilter.meta.value).toHaveBeenCalledWith(undefined); @@ -35,7 +36,7 @@ describe('getDisplayValueFromFilter', () => { stubIndexPattern.getFormatterForField = jest.fn().mockReturnValue('banana'); phraseFilter.meta.value = jest.fn((x) => { return x + 'abc'; - }); + }) as any; const displayValue = getDisplayValueFromFilter(phraseFilter, [stubIndexPattern]); expect(stubIndexPattern.getFormatterForField).toHaveBeenCalledTimes(1); expect(phraseFilter.meta.value).toHaveBeenCalledWith('banana'); From 08a5c854a43ed3187f4c34655b984931582c185b Mon Sep 17 00:00:00 2001 From: Liza K Date: Sun, 27 Jun 2021 16:25:39 +0300 Subject: [PATCH 05/52] Fix type imports --- ...na-plugin-plugins-data-public.esfilters.md | 8 ++-- ...bana-plugin-plugins-data-public.eskuery.md | 2 +- ...bana-plugin-plugins-data-public.esquery.md | 2 +- ...gin-plugins-data-public.ifieldtype.lang.md | 11 ------ ...a-plugin-plugins-data-public.ifieldtype.md | 8 +--- ...gin-plugins-data-public.ifieldtype.name.md | 11 ------ ...n-plugins-data-public.ifieldtype.script.md | 11 ------ ...plugins-data-public.ifieldtype.scripted.md | 11 ------ ...-plugins-data-public.ifieldtype.subtype.md | 11 ------ ...gin-plugins-data-public.ifieldtype.type.md | 11 ------ ...lugins-data-public.iindexpattern.fields.md | 11 ++++++ ...lugin-plugins-data-public.iindexpattern.md | 3 +- ...n-plugins-data-public.indexpatternfield.md | 2 +- ...s-data-public.indexpatternfield.subtype.md | 2 +- ...ns-data-public.indexpatternfield.tojson.md | 4 +- ...na-plugin-plugins-data-server.esfilters.md | 8 ++-- ...bana-plugin-plugins-data-server.eskuery.md | 2 +- ...bana-plugin-plugins-data-server.esquery.md | 2 +- ...gin-plugins-data-server.ifieldtype.lang.md | 11 ------ ...a-plugin-plugins-data-server.ifieldtype.md | 8 +--- ...gin-plugins-data-server.ifieldtype.name.md | 11 ------ ...n-plugins-data-server.ifieldtype.script.md | 11 ------ ...plugins-data-server.ifieldtype.scripted.md | 11 ------ ...-plugins-data-server.ifieldtype.subtype.md | 11 ------ ...gin-plugins-data-server.ifieldtype.type.md | 11 ------ .../es_query/es_query/filter_matches_index.ts | 2 +- .../es_query/handle_nested_filter.test.ts | 2 +- .../common/es_query/filters/exists_filter.ts | 3 +- .../common/es_query/filters/phrase_filter.ts | 3 +- .../common/es_query/kuery/functions/exists.ts | 1 - .../kuery/functions/geo_bounding_box.ts | 2 +- .../es_query/kuery/functions/geo_polygon.ts | 2 +- .../common/es_query/kuery/functions/range.ts | 2 +- .../data/common/index_patterns/types.ts | 1 + src/plugins/data/public/public.api.md | 37 +++++++------------ src/plugins/data/server/server.api.md | 23 +++--------- 36 files changed, 59 insertions(+), 213 deletions(-) delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md index 2ca4847d6dc398..0cdc1e5c8bcbf0 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md @@ -13,11 +13,11 @@ esFilters: { FILTERS: typeof FILTERS; FilterStateStore: typeof FilterStateStore; buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; - buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").MinimalIndexPattern) => import("../common").PhrasesFilter; - buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").MinimalIndexPattern) => import("../common").ExistsFilter; - buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").MinimalIndexPattern) => import("../common").PhraseFilter; + 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; buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter; - buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").MinimalIndexPattern, formattedValue?: string | undefined) => import("../common").RangeFilter; + buildRangeFilter: (field: import("../common").FieldBase, 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; diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md index 881a1fa803ca65..332114e6375863 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md @@ -10,6 +10,6 @@ esKuery: { nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; - toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").MinimalIndexPattern | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; } ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md index 70805aaaaee8ca..0bc9c0c12fc3a4 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md @@ -10,7 +10,7 @@ esQuery: { buildEsQuery: typeof buildEsQuery; getEsQueryConfig: typeof getEsQueryConfig; - buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").MinimalIndexPattern | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { + buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { must: never[]; filter: import("../common").Filter[]; should: never[]; diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md deleted file mode 100644 index f99e7ba8b967ec..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [lang](./kibana-plugin-plugins-data-public.ifieldtype.lang.md) - -## IFieldType.lang property - -Signature: - -```typescript -lang?: estypes.ScriptLanguage; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md index 29377ff8fd392a..55df5c3367748d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md @@ -12,7 +12,7 @@ Signature: ```typescript -export interface IFieldType +export interface IFieldType extends FieldBase ``` ## Properties @@ -26,15 +26,9 @@ export interface IFieldType | [esTypes](./kibana-plugin-plugins-data-public.ifieldtype.estypes.md) | string[] | | | [filterable](./kibana-plugin-plugins-data-public.ifieldtype.filterable.md) | boolean | | | [format](./kibana-plugin-plugins-data-public.ifieldtype.format.md) | any | | -| [lang](./kibana-plugin-plugins-data-public.ifieldtype.lang.md) | estypes.ScriptLanguage | | -| [name](./kibana-plugin-plugins-data-public.ifieldtype.name.md) | string | | | [readFromDocValues](./kibana-plugin-plugins-data-public.ifieldtype.readfromdocvalues.md) | boolean | | -| [script](./kibana-plugin-plugins-data-public.ifieldtype.script.md) | string | | -| [scripted](./kibana-plugin-plugins-data-public.ifieldtype.scripted.md) | boolean | | | [searchable](./kibana-plugin-plugins-data-public.ifieldtype.searchable.md) | boolean | | | [sortable](./kibana-plugin-plugins-data-public.ifieldtype.sortable.md) | boolean | | -| [subType](./kibana-plugin-plugins-data-public.ifieldtype.subtype.md) | IFieldSubType | | | [toSpec](./kibana-plugin-plugins-data-public.ifieldtype.tospec.md) | (options?: {
getFormatterForField?: IndexPattern['getFormatterForField'];
}) => FieldSpec | | -| [type](./kibana-plugin-plugins-data-public.ifieldtype.type.md) | string | | | [visualizable](./kibana-plugin-plugins-data-public.ifieldtype.visualizable.md) | boolean | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md deleted file mode 100644 index 1c01484372fd37..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [name](./kibana-plugin-plugins-data-public.ifieldtype.name.md) - -## IFieldType.name property - -Signature: - -```typescript -name: string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md deleted file mode 100644 index 252c2c38220465..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [script](./kibana-plugin-plugins-data-public.ifieldtype.script.md) - -## IFieldType.script property - -Signature: - -```typescript -script?: string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md deleted file mode 100644 index 33bbd0c2c20cb8..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [scripted](./kibana-plugin-plugins-data-public.ifieldtype.scripted.md) - -## IFieldType.scripted property - -Signature: - -```typescript -scripted?: boolean; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md deleted file mode 100644 index d0c26186da0857..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [subType](./kibana-plugin-plugins-data-public.ifieldtype.subtype.md) - -## IFieldType.subType property - -Signature: - -```typescript -subType?: IFieldSubType; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md deleted file mode 100644 index 26228cbe4bfdb1..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [type](./kibana-plugin-plugins-data-public.ifieldtype.type.md) - -## IFieldType.type property - -Signature: - -```typescript -type: string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md new file mode 100644 index 00000000000000..792bee44f96a85 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) > [fields](./kibana-plugin-plugins-data-public.iindexpattern.fields.md) + +## IIndexPattern.fields property + +Signature: + +```typescript +fields: IFieldType[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md index 88d8520a373c69..c4410737811697 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md @@ -12,7 +12,7 @@ Signature: ```typescript -export interface IIndexPattern extends MinimalIndexPattern +export interface IIndexPattern extends IndexPatternBase ``` ## Properties @@ -20,6 +20,7 @@ export interface IIndexPattern extends MinimalIndexPattern | Property | Type | Description | | --- | --- | --- | | [fieldFormatMap](./kibana-plugin-plugins-data-public.iindexpattern.fieldformatmap.md) | Record<string, SerializedFieldFormat<unknown> | undefined> | | +| [fields](./kibana-plugin-plugins-data-public.iindexpattern.fields.md) | IFieldType[] | | | [getFormatterForField](./kibana-plugin-plugins-data-public.iindexpattern.getformatterforfield.md) | (field: IndexPatternField | IndexPatternField['spec'] | IFieldType) => FieldFormat | Look up a formatter for a given field | | [timeFieldName](./kibana-plugin-plugins-data-public.iindexpattern.timefieldname.md) | string | | | [title](./kibana-plugin-plugins-data-public.iindexpattern.title.md) | string | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md index 8cd1a476cf32f8..16546ceca958d7 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md @@ -37,7 +37,7 @@ export declare class IndexPatternField implements IFieldType | [searchable](./kibana-plugin-plugins-data-public.indexpatternfield.searchable.md) | | boolean | | | [sortable](./kibana-plugin-plugins-data-public.indexpatternfield.sortable.md) | | boolean | | | [spec](./kibana-plugin-plugins-data-public.indexpatternfield.spec.md) | | FieldSpec | | -| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("../types").IFieldSubType | undefined | | +| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("../..").IFieldSubType | undefined | | | [type](./kibana-plugin-plugins-data-public.indexpatternfield.type.md) | | string | | | [visualizable](./kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md) | | boolean | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md index 5c3c4d54ad0997..6cd5247291602d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md @@ -7,5 +7,5 @@ Signature: ```typescript -get subType(): import("../types").IFieldSubType | undefined; +get subType(): import("../..").IFieldSubType | undefined; ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md index 8882fa05ce0c25..b77f3d1f374fbf 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md @@ -19,7 +19,7 @@ toJSON(): { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../types").IFieldSubType | undefined; + subType: import("../..").IFieldSubType | undefined; customLabel: string | undefined; }; ``` @@ -37,7 +37,7 @@ toJSON(): { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../types").IFieldSubType | undefined; + subType: import("../..").IFieldSubType | undefined; customLabel: string | undefined; }` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md index d951cb24269435..202c9e4588f8ac 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md @@ -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").IFieldType, indexPattern: import("../common").MinimalIndexPattern) => import("../common").ExistsFilter; + buildExistsFilter: (field: import("../common").FieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter; buildFilter: typeof buildFilter; - buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").MinimalIndexPattern) => import("../common").PhraseFilter; - buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").MinimalIndexPattern) => import("../common").PhrasesFilter; - buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").MinimalIndexPattern, formattedValue?: string | undefined) => import("../common").RangeFilter; + 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; isFilterDisabled: (filter: import("../common").Filter) => boolean; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md index 6274eb5f4f4a5f..fce25a899de8e8 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md @@ -10,6 +10,6 @@ esKuery: { nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; - toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").MinimalIndexPattern | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md index 0d1baecb014f58..68507f3fb9b81d 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md @@ -8,7 +8,7 @@ ```typescript esQuery: { - buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").MinimalIndexPattern | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { + buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { must: never[]; filter: import("../common").Filter[]; should: never[]; diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md deleted file mode 100644 index 3d5a757cb8f187..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [lang](./kibana-plugin-plugins-data-server.ifieldtype.lang.md) - -## IFieldType.lang property - -Signature: - -```typescript -lang?: estypes.ScriptLanguage; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md index bbc4cc2135d406..98fde569b575d7 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md @@ -12,7 +12,7 @@ Signature: ```typescript -export interface IFieldType +export interface IFieldType extends FieldBase ``` ## Properties @@ -26,15 +26,9 @@ export interface IFieldType | [esTypes](./kibana-plugin-plugins-data-server.ifieldtype.estypes.md) | string[] | | | [filterable](./kibana-plugin-plugins-data-server.ifieldtype.filterable.md) | boolean | | | [format](./kibana-plugin-plugins-data-server.ifieldtype.format.md) | any | | -| [lang](./kibana-plugin-plugins-data-server.ifieldtype.lang.md) | estypes.ScriptLanguage | | -| [name](./kibana-plugin-plugins-data-server.ifieldtype.name.md) | string | | | [readFromDocValues](./kibana-plugin-plugins-data-server.ifieldtype.readfromdocvalues.md) | boolean | | -| [script](./kibana-plugin-plugins-data-server.ifieldtype.script.md) | string | | -| [scripted](./kibana-plugin-plugins-data-server.ifieldtype.scripted.md) | boolean | | | [searchable](./kibana-plugin-plugins-data-server.ifieldtype.searchable.md) | boolean | | | [sortable](./kibana-plugin-plugins-data-server.ifieldtype.sortable.md) | boolean | | -| [subType](./kibana-plugin-plugins-data-server.ifieldtype.subtype.md) | IFieldSubType | | | [toSpec](./kibana-plugin-plugins-data-server.ifieldtype.tospec.md) | (options?: {
getFormatterForField?: IndexPattern['getFormatterForField'];
}) => FieldSpec | | -| [type](./kibana-plugin-plugins-data-server.ifieldtype.type.md) | string | | | [visualizable](./kibana-plugin-plugins-data-server.ifieldtype.visualizable.md) | boolean | | diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md deleted file mode 100644 index 8be33a3f56d976..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [name](./kibana-plugin-plugins-data-server.ifieldtype.name.md) - -## IFieldType.name property - -Signature: - -```typescript -name: string; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md deleted file mode 100644 index b54a952a112531..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [script](./kibana-plugin-plugins-data-server.ifieldtype.script.md) - -## IFieldType.script property - -Signature: - -```typescript -script?: string; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md deleted file mode 100644 index f7a8ed9aee0df4..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [scripted](./kibana-plugin-plugins-data-server.ifieldtype.scripted.md) - -## IFieldType.scripted property - -Signature: - -```typescript -scripted?: boolean; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md deleted file mode 100644 index fa78b23a2b558c..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [subType](./kibana-plugin-plugins-data-server.ifieldtype.subtype.md) - -## IFieldType.subType property - -Signature: - -```typescript -subType?: IFieldSubType; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md deleted file mode 100644 index ef6a4dcc167c53..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [type](./kibana-plugin-plugins-data-server.ifieldtype.type.md) - -## IFieldType.type property - -Signature: - -```typescript -type: string; -``` diff --git a/src/plugins/data/common/es_query/es_query/filter_matches_index.ts b/src/plugins/data/common/es_query/es_query/filter_matches_index.ts index f77a029b6bdd5d..714ae5f7b274bb 100644 --- a/src/plugins/data/common/es_query/es_query/filter_matches_index.ts +++ b/src/plugins/data/common/es_query/es_query/filter_matches_index.ts @@ -7,7 +7,7 @@ */ import { Filter } from '../filters'; -import { FieldBase, IndexPatternBase } from './types'; +import { IndexPatternBase } from './types'; /* * TODO: We should base this on something better than `filter.meta.key`. We should probably modify diff --git a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts b/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts index bc0df315340fee..c33d0eb4e1a188 100644 --- a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts +++ b/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts @@ -9,7 +9,7 @@ import { handleNestedFilter } from './handle_nested_filter'; import { fields } from '../../index_patterns/mocks'; import { buildPhraseFilter, buildQueryFilter } from '../filters'; -import { IndexPatternBase, FieldBase } from './types'; +import { IndexPatternBase } from './types'; describe('handleNestedFilter', function () { const indexPattern: IndexPatternBase = { diff --git a/src/plugins/data/common/es_query/filters/exists_filter.ts b/src/plugins/data/common/es_query/filters/exists_filter.ts index f5ffb85490bc27..ed499e8ead0dbb 100644 --- a/src/plugins/data/common/es_query/filters/exists_filter.ts +++ b/src/plugins/data/common/es_query/filters/exists_filter.ts @@ -7,8 +7,7 @@ */ import { Filter, FilterMeta } from './meta_filter'; -import { FieldBase } from '../../index_patterns'; -import { IndexPatternBase } from '..'; +import { FieldBase, IndexPatternBase } from '..'; export type ExistsFilterMeta = FilterMeta; diff --git a/src/plugins/data/common/es_query/filters/phrase_filter.ts b/src/plugins/data/common/es_query/filters/phrase_filter.ts index 7433d1eb7a2cf6..628ae684ff2b90 100644 --- a/src/plugins/data/common/es_query/filters/phrase_filter.ts +++ b/src/plugins/data/common/es_query/filters/phrase_filter.ts @@ -8,8 +8,7 @@ import type { estypes } from '@elastic/elasticsearch'; import { get, isPlainObject } from 'lodash'; import { Filter, FilterMeta } from './meta_filter'; -import { FieldBase } from '../../index_patterns'; -import { IndexPatternBase } from '..'; +import { FieldBase, IndexPatternBase } from '..'; export type PhraseFilterMeta = FilterMeta & { params?: { diff --git a/src/plugins/data/common/es_query/kuery/functions/exists.ts b/src/plugins/data/common/es_query/kuery/functions/exists.ts index 17db93ae68d261..b6a9a55d8218dc 100644 --- a/src/plugins/data/common/es_query/kuery/functions/exists.ts +++ b/src/plugins/data/common/es_query/kuery/functions/exists.ts @@ -6,7 +6,6 @@ * Side Public License, v 1. */ -import { get } from 'lodash'; import * as literal from '../node_types/literal'; import { KueryNode, FieldBase, IndexPatternBase } from '../../..'; diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts b/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts index 60211f3f67863e..79bef10b14f71f 100644 --- a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts +++ b/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts @@ -9,7 +9,7 @@ import _ from 'lodash'; import { nodeTypes } from '../node_types'; import * as ast from '../ast'; -import { IndexPatternBase, KueryNode, FieldBase, LatLon } from '../../..'; +import { IndexPatternBase, KueryNode, LatLon } from '../../..'; export function buildNodeParams(fieldName: string, params: any) { params = _.pick(params, 'topLeft', 'bottomRight'); diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts b/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts index b437baf37988e2..2e3280138502a7 100644 --- a/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts +++ b/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts @@ -8,7 +8,7 @@ import { nodeTypes } from '../node_types'; import * as ast from '../ast'; -import { IndexPatternBase, KueryNode, FieldBase, LatLon } from '../../..'; +import { IndexPatternBase, KueryNode, LatLon } from '../../..'; import { LiteralTypeBuildNode } from '../node_types/types'; export function buildNodeParams(fieldName: string, points: LatLon[]) { diff --git a/src/plugins/data/common/es_query/kuery/functions/range.ts b/src/plugins/data/common/es_query/kuery/functions/range.ts index 13919759f4dbb2..b134434dc182b6 100644 --- a/src/plugins/data/common/es_query/kuery/functions/range.ts +++ b/src/plugins/data/common/es_query/kuery/functions/range.ts @@ -13,7 +13,7 @@ import { getRangeScript, RangeFilterParams } 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 } from '../../..'; export function buildNodeParams(fieldName: string, params: RangeFilterParams) { const paramsToMap = _.pick(params, 'gt', 'lt', 'gte', 'lte', 'format'); diff --git a/src/plugins/data/common/index_patterns/types.ts b/src/plugins/data/common/index_patterns/types.ts index 4fa7531efcb744..6a9decdaa9375a 100644 --- a/src/plugins/data/common/index_patterns/types.ts +++ b/src/plugins/data/common/index_patterns/types.ts @@ -32,6 +32,7 @@ export interface RuntimeField { */ export interface IIndexPattern extends IndexPatternBase { title: string; + fields: IFieldType[]; /** * Type is used for identifying rollup indices, otherwise left undefined */ diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index 2849b93b144835..54009a76b1a65d 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -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").IFieldType, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter; - buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter; - buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter; + 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; buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter; - buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter; + buildRangeFilter: (field: import("../common").FieldBase, 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; @@ -1242,10 +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-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 { +export interface IFieldType extends FieldBase { // (undocumented) aggregatable?: boolean; // (undocumented) @@ -1261,28 +1262,16 @@ export interface IFieldType { // (undocumented) format?: any; // (undocumented) - lang?: estypes.ScriptLanguage; - // (undocumented) - name: string; - // (undocumented) readFromDocValues?: boolean; // (undocumented) - script?: string; - // (undocumented) - scripted?: boolean; - // (undocumented) searchable?: boolean; // (undocumented) sortable?: boolean; // (undocumented) - subType?: IFieldSubType; - // (undocumented) toSpec?: (options?: { getFormatterForField?: IndexPattern['getFormatterForField']; }) => FieldSpec; // (undocumented) - type: string; - // (undocumented) visualizable?: boolean; } @@ -1295,6 +1284,8 @@ export interface IIndexPattern extends IndexPatternBase { // // (undocumented) fieldFormatMap?: Record | undefined>; + // (undocumented) + fields: IFieldType[]; getFormatterForField?: (field: IndexPatternField | IndexPatternField['spec'] | IFieldType) => FieldFormat; // (undocumented) getTimeField?(): IFieldType | undefined; @@ -1557,7 +1548,7 @@ export class IndexPatternField implements IFieldType { // (undocumented) readonly spec: FieldSpec; // (undocumented) - get subType(): import("../types").IFieldSubType | undefined; + get subType(): import("../..").IFieldSubType | undefined; // (undocumented) toJSON(): { count: number; @@ -1571,7 +1562,7 @@ export class IndexPatternField implements IFieldType { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../types").IFieldSubType | undefined; + subType: import("../..").IFieldSubType | undefined; customLabel: string | undefined; }; // (undocumented) @@ -2728,13 +2719,13 @@ export interface WaitUntilNextSessionCompletesOptions { // Warnings were encountered during analysis: // -// src/plugins/data/common/es_query/filters/exists_filter.ts:20:3 - (ae-forgotten-export) The symbol "ExistsFilterMeta" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/es_query/filters/exists_filter.ts:21:3 - (ae-forgotten-export) The symbol "FilterExistsProperty" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/es_query/filters/exists_filter.ts:19:3 - (ae-forgotten-export) The symbol "ExistsFilterMeta" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/es_query/filters/exists_filter.ts:20:3 - (ae-forgotten-export) The symbol "FilterExistsProperty" needs to be exported by the entry point index.d.ts // src/plugins/data/common/es_query/filters/match_all_filter.ts:17:3 - (ae-forgotten-export) The symbol "MatchAllFilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/es_query/filters/meta_filter.ts:43:3 - (ae-forgotten-export) The symbol "FilterState" needs to be exported by the entry point index.d.ts // src/plugins/data/common/es_query/filters/meta_filter.ts:44:3 - (ae-forgotten-export) The symbol "FilterMeta" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/es_query/filters/phrase_filter.ts:23:3 - (ae-forgotten-export) The symbol "PhraseFilterMeta" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/es_query/filters/phrases_filter.ts:21:3 - (ae-forgotten-export) The symbol "PhrasesFilterMeta" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/es_query/filters/phrase_filter.ts:22:3 - (ae-forgotten-export) The symbol "PhraseFilterMeta" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/es_query/filters/phrases_filter.ts:20:3 - (ae-forgotten-export) The symbol "PhrasesFilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:65:5 - (ae-forgotten-export) The symbol "FormatFieldFn" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:138:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:169:7 - (ae-forgotten-export) The symbol "RuntimeField" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 5ca19f9e1e5098..16988607b8ab45 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -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").IFieldType, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter; + buildExistsFilter: (field: import("../common").FieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter; buildFilter: typeof buildFilter; - buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter; - buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter; - buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter; + 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; isFilterDisabled: (filter: import("../common").Filter) => boolean; }; @@ -693,10 +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-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 { +export interface IFieldType extends FieldBase { // (undocumented) aggregatable?: boolean; // (undocumented) @@ -712,21 +713,11 @@ export interface IFieldType { // (undocumented) format?: any; // (undocumented) - lang?: estypes.ScriptLanguage; - // (undocumented) - name: string; - // (undocumented) readFromDocValues?: boolean; // (undocumented) - script?: string; - // (undocumented) - scripted?: boolean; - // (undocumented) searchable?: boolean; // (undocumented) sortable?: boolean; - // (undocumented) - subType?: IFieldSubType; // Warning: (ae-forgotten-export) The symbol "FieldSpec" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -734,8 +725,6 @@ export interface IFieldType { getFormatterForField?: IndexPattern['getFormatterForField']; }) => FieldSpec; // (undocumented) - type: string; - // (undocumented) visualizable?: boolean; } From a0696b5bf6cf891ff54ea084e4552e9b867ade82 Mon Sep 17 00:00:00 2001 From: Liza K Date: Sun, 27 Jun 2021 16:44:16 +0300 Subject: [PATCH 06/52] test types --- .../common/es_query/es_query/handle_nested_filter.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts b/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts index c33d0eb4e1a188..cf5d68eff65d17 100644 --- a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts +++ b/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts @@ -44,8 +44,9 @@ describe('handleNestedFilter', function () { }); it('should return filter untouched if it does not target a field from the given index pattern', () => { - const field = { ...getField('extension'), name: 'notarealfield' }; - const filter = buildPhraseFilter(field, 'jpg', indexPattern); + const field = getField('extension'); + field!.name = 'notarealfield'; + const filter = buildPhraseFilter(field!, 'jpg', indexPattern); const result = handleNestedFilter(filter, indexPattern); expect(result).toBe(filter); }); From 7984b50875c94d65d28aa0f008260e460b969d59 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 28 Jun 2021 12:17:49 +0300 Subject: [PATCH 07/52] fix jest --- .../common/es_query/es_query/handle_nested_filter.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts b/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts index cf5d68eff65d17..24852ebf33bda3 100644 --- a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts +++ b/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts @@ -45,8 +45,11 @@ describe('handleNestedFilter', function () { it('should return filter untouched if it does not target a field from the given index pattern', () => { const field = getField('extension'); - field!.name = 'notarealfield'; - const filter = buildPhraseFilter(field!, 'jpg', indexPattern); + const unrealField = { + ...field!, + name: 'notarealfield', + }; + const filter = buildPhraseFilter(unrealField, 'jpg', indexPattern); const result = handleNestedFilter(filter, indexPattern); expect(result).toBe(filter); }); From 7e82c836e3846ac60b0c3cb7e5f933ee5ba87902 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 28 Jun 2021 19:27:07 +0100 Subject: [PATCH 08/52] move --- package.json | 1 + packages/BUILD.bazel | 1 + packages/kbn-es-query/.babelrc | 3 + packages/kbn-es-query/BUILD.bazel | 88 ++ packages/kbn-es-query/README.md | 3 + packages/kbn-es-query/jest.config.js | 13 + packages/kbn-es-query/package.json | 9 + .../__fixtures__/index_pattern_response.ts | 0 .../src}/es_query/build_es_query.test.ts | 0 .../src}/es_query/build_es_query.ts | 3 +- .../src}/es_query/decorate_query.test.ts | 0 .../src}/es_query/decorate_query.ts | 0 .../src}/es_query/es_query_dsl.ts | 0 .../es_query/filter_matches_index.test.ts | 0 .../src}/es_query/filter_matches_index.ts | 0 .../src}/es_query/from_filters.test.ts | 0 .../src}/es_query/from_filters.ts | 0 .../src}/es_query/from_kuery.test.ts | 0 .../kbn-es-query/src}/es_query/from_kuery.ts | 2 +- .../src}/es_query/from_lucene.test.ts | 0 .../kbn-es-query/src}/es_query/from_lucene.ts | 2 +- .../es_query/handle_nested_filter.test.ts | 0 .../src}/es_query/handle_nested_filter.ts | 0 .../kbn-es-query/src}/es_query/index.ts | 1 - .../es_query/lucene_string_to_dsl.test.ts | 0 .../src}/es_query/lucene_string_to_dsl.ts | 0 .../src}/es_query/migrate_filter.test.ts | 0 .../src}/es_query/migrate_filter.ts | 0 .../kbn-es-query/src}/es_query/types.ts | 0 .../src}/filters/build_filter.test.ts | 0 .../src}/filters/build_filters.ts | 6 +- .../src}/filters/custom_filter.ts | 2 +- .../src}/filters/exists_filter.test.ts | 0 .../src}/filters/exists_filter.ts | 2 +- .../filters/geo_bounding_box_filter.test.ts | 0 .../src}/filters/geo_bounding_box_filter.ts | 2 +- .../src}/filters/geo_polygon_filter.test.ts | 0 .../src}/filters/geo_polygon_filter.ts | 2 +- .../src}/filters/get_filter_field.test.ts | 0 .../src}/filters/get_filter_field.ts | 2 +- .../src}/filters/get_filter_params.test.ts | 0 .../src}/filters/get_filter_params.ts | 0 .../kbn-es-query/src}/filters/index.ts | 4 +- .../src}/filters/match_all_filter.ts | 2 +- .../kbn-es-query/src}/filters/meta_filter.ts | 44 +- .../src}/filters/missing_filter.test.ts | 0 .../src}/filters/missing_filter.ts | 2 +- .../src}/filters/phrase_filter.test.ts | 0 .../src}/filters/phrase_filter.ts | 2 +- .../src}/filters/phrases_filter.test.ts | 0 .../src}/filters/phrases_filter.ts | 2 +- .../src}/filters/query_string_filter.test.ts | 0 .../src}/filters/query_string_filter.ts | 2 +- .../src}/filters/range_filter.test.ts | 0 .../kbn-es-query/src}/filters/range_filter.ts | 2 +- .../src}/filters/stubs/exists_filter.ts | 0 .../kbn-es-query/src}/filters/stubs/index.ts | 0 .../src}/filters/stubs/phrase_filter.ts | 0 .../src}/filters/stubs/phrases_filter.ts | 0 .../src}/filters/stubs/range_filter.ts | 0 .../kbn-es-query/src}/filters/types.ts | 50 + packages/kbn-es-query/src/index.ts | 11 + .../src}/kuery/ast/_generated_/kuery.js | 1219 ++++++++++------- .../kbn-es-query/src}/kuery/ast/ast.test.ts | 0 .../kbn-es-query/src}/kuery/ast/ast.ts | 0 .../kbn-es-query/src}/kuery/ast/index.ts | 0 .../kbn-es-query/src}/kuery/ast/kuery.peg | 0 .../src}/kuery/functions/and.test.ts | 0 .../kbn-es-query/src}/kuery/functions/and.ts | 2 +- .../src}/kuery/functions/exists.test.ts | 0 .../src}/kuery/functions/exists.ts | 2 +- .../kuery/functions/geo_bounding_box.test.ts | 0 .../src}/kuery/functions/geo_bounding_box.ts | 2 +- .../src}/kuery/functions/geo_polygon.test.ts | 0 .../src}/kuery/functions/geo_polygon.ts | 2 +- .../src}/kuery/functions/index.ts | 0 .../src}/kuery/functions/is.test.ts | 0 .../kbn-es-query/src}/kuery/functions/is.ts | 2 +- .../src}/kuery/functions/nested.test.ts | 0 .../src}/kuery/functions/nested.ts | 2 +- .../src}/kuery/functions/not.test.ts | 0 .../kbn-es-query/src}/kuery/functions/not.ts | 2 +- .../src}/kuery/functions/or.test.ts | 0 .../kbn-es-query/src}/kuery/functions/or.ts | 2 +- .../src}/kuery/functions/range.test.ts | 0 .../src}/kuery/functions/range.ts | 2 +- .../kuery/functions/utils/get_fields.test.ts | 0 .../src}/kuery/functions/utils/get_fields.ts | 2 +- .../utils/get_full_field_name_node.test.ts | 0 .../utils/get_full_field_name_node.ts | 2 +- .../kbn-es-query/src}/kuery/index.ts | 0 .../src}/kuery/kuery_syntax_error.test.ts | 0 .../src}/kuery/kuery_syntax_error.ts | 0 .../src}/kuery/node_types/function.test.ts | 0 .../src}/kuery/node_types/function.ts | 2 +- .../src}/kuery/node_types/index.ts | 0 .../src}/kuery/node_types/literal.test.ts | 0 .../src}/kuery/node_types/literal.ts | 0 .../src}/kuery/node_types/named_arg.test.ts | 0 .../src}/kuery/node_types/named_arg.ts | 0 .../kuery/node_types/node_builder.test.ts | 0 .../src}/kuery/node_types/node_builder.ts | 0 .../src}/kuery/node_types/types.ts | 0 .../src}/kuery/node_types/wildcard.test.ts | 0 .../src}/kuery/node_types/wildcard.ts | 0 .../kbn-es-query/src}/kuery/types.ts | 0 .../kbn-es-query/src}/utils.ts | 0 packages/kbn-es-query/tsconfig.json | 18 + .../get_es_query_config.test.ts | 0 .../{es_query => }/get_es_query_config.ts | 4 +- src/plugins/data/common/es_query/index.ts | 5 +- src/plugins/data/common/query/types.ts | 6 +- .../data/common/search/expressions/esdsl.ts | 3 +- .../search/expressions/exists_filter.ts | 2 +- .../search/expressions/filters_to_ast.ts | 2 +- .../search/expressions/kibana_context.ts | 2 +- .../search/expressions/phrase_filter.ts | 2 +- .../common/search/expressions/range_filter.ts | 2 +- .../search_source/extract_references.ts | 2 +- .../query/state_sync/sync_state_with_url.ts | 2 +- .../filter_editor/lib/filter_operators.ts | 2 +- yarn.lock | 4 + 122 files changed, 995 insertions(+), 567 deletions(-) create mode 100644 packages/kbn-es-query/.babelrc create mode 100644 packages/kbn-es-query/BUILD.bazel create mode 100644 packages/kbn-es-query/README.md create mode 100644 packages/kbn-es-query/jest.config.js create mode 100644 packages/kbn-es-query/package.json rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/__fixtures__/index_pattern_response.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/build_es_query.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/build_es_query.ts (97%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/decorate_query.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/decorate_query.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/es_query_dsl.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/filter_matches_index.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/filter_matches_index.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/from_filters.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/from_filters.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/from_kuery.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/from_kuery.ts (96%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/from_lucene.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/from_lucene.ts (95%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/handle_nested_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/handle_nested_filter.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/index.ts (91%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/lucene_string_to_dsl.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/lucene_string_to_dsl.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/migrate_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/migrate_filter.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/es_query/types.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/build_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/build_filters.ts (95%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/custom_filter.ts (91%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/exists_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/exists_filter.ts (95%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/geo_bounding_box_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/geo_bounding_box_filter.ts (93%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/geo_polygon_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/geo_polygon_filter.ts (93%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/get_filter_field.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/get_filter_field.ts (97%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/get_filter_params.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/get_filter_params.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/index.ts (91%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/match_all_filter.ts (92%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/meta_filter.ts (69%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/missing_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/missing_filter.ts (93%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/phrase_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/phrase_filter.ts (98%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/phrases_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/phrases_filter.ts (97%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/query_string_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/query_string_filter.ts (94%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/range_filter.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/range_filter.ts (99%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/stubs/exists_filter.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/stubs/index.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/stubs/phrase_filter.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/stubs/phrases_filter.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/stubs/range_filter.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/types.ts (55%) create mode 100644 packages/kbn-es-query/src/index.ts rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/ast/_generated_/kuery.js (69%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/ast/ast.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/ast/ast.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/ast/index.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/ast/kuery.peg (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/and.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/and.ts (93%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/exists.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/exists.ts (94%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/geo_bounding_box.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/geo_bounding_box.ts (96%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/geo_polygon.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/geo_polygon.ts (96%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/index.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/is.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/is.ts (98%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/nested.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/nested.ts (95%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/not.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/not.ts (93%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/or.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/or.ts (94%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/range.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/range.ts (98%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/utils/get_fields.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/utils/get_fields.ts (94%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/utils/get_full_field_name_node.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/utils/get_full_field_name_node.ts (99%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/index.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/kuery_syntax_error.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/kuery_syntax_error.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/function.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/function.ts (96%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/index.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/literal.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/literal.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/named_arg.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/named_arg.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/node_builder.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/node_builder.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/types.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/wildcard.test.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/wildcard.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/types.ts (100%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/utils.ts (100%) create mode 100644 packages/kbn-es-query/tsconfig.json rename src/plugins/data/common/es_query/{es_query => }/get_es_query_config.test.ts (100%) rename src/plugins/data/common/es_query/{es_query => }/get_es_query_config.ts (90%) diff --git a/package.json b/package.json index ceb178d0685196..c6d9eed8206ff6 100644 --- a/package.json +++ b/package.json @@ -129,6 +129,7 @@ "@kbn/apm-config-loader": "link:bazel-bin/packages/kbn-apm-config-loader", "@kbn/apm-utils": "link:bazel-bin/packages/kbn-apm-utils", "@kbn/common-utils": "link:bazel-bin/packages/kbn-common-utils", + "@kbn/es-query": "link:bazel-bin/packages/kbn-es-query", "@kbn/config": "link:bazel-bin/packages/kbn-config", "@kbn/config-schema": "link:bazel-bin/packages/kbn-config-schema", "@kbn/crypto": "link:bazel-bin/packages/kbn-crypto", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 1094a2def3e70d..89444f6d1f5369 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -22,6 +22,7 @@ filegroup( "//packages/kbn-es:build", "//packages/kbn-eslint-import-resolver-kibana:build", "//packages/kbn-eslint-plugin-eslint:build", + "//packages/kbn-es-query:build", "//packages/kbn-expect:build", "//packages/kbn-i18n:build", "//packages/kbn-interpreter:build", diff --git a/packages/kbn-es-query/.babelrc b/packages/kbn-es-query/.babelrc new file mode 100644 index 00000000000000..7da72d17791281 --- /dev/null +++ b/packages/kbn-es-query/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"] +} diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel new file mode 100644 index 00000000000000..94793e946f7b6f --- /dev/null +++ b/packages/kbn-es-query/BUILD.bazel @@ -0,0 +1,88 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") + +PKG_BASE_NAME = "kbn-es-query" +PKG_REQUIRE_NAME = "@kbn/es-query" + +SOURCE_FILES = glob( + [ + "src/**/*.ts", + ], + exclude = ["**/*.test.*"], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", + "README.md", + "src/kuery/ast/_generated_/kuery.js", +] + +SRC_DEPS = [ + "//packages/kbn-config-schema", + "@npm//load-json-file", + "@npm//tslib", + "@npm//moment-timezone", +] + +TYPES_DEPS = [ + "@npm//@types/moment-timezone", + "@npm//@elastic/elasticsearch", + "//packages/kbn-common-utils", + "//packages/kbn-i18n", + "@npm//@types/jest", + "@npm//@types/node", +] + +DEPS = SRC_DEPS + TYPES_DEPS + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + ], +) + +ts_project( + name = "tsc", + args = ['--pretty'], + srcs = SRCS, + deps = DEPS, + declaration = True, + declaration_map = True, + incremental = True, + out_dir = "target", + source_map = True, + root_dir = "src", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_BASE_NAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = DEPS + [":tsc"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [ + ":%s" % PKG_BASE_NAME, + ] +) + +filegroup( + name = "build", + srcs = [ + ":npm_module", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-es-query/README.md b/packages/kbn-es-query/README.md new file mode 100644 index 00000000000000..644fc4d559eb61 --- /dev/null +++ b/packages/kbn-es-query/README.md @@ -0,0 +1,3 @@ +# @kbn/es-query + +Shared common (client and server sie) utilities shared across packages and plugins. \ No newline at end of file diff --git a/packages/kbn-es-query/jest.config.js b/packages/kbn-es-query/jest.config.js new file mode 100644 index 00000000000000..306e12f34f698c --- /dev/null +++ b/packages/kbn-es-query/jest.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-es-query'], +}; diff --git a/packages/kbn-es-query/package.json b/packages/kbn-es-query/package.json new file mode 100644 index 00000000000000..36bf5ee4cb1e3a --- /dev/null +++ b/packages/kbn-es-query/package.json @@ -0,0 +1,9 @@ +{ + "name": "@kbn/es-query", + "main": "./target/index.js", + "browser": "./target/index.js", + "types": "./target/index.d.ts", + "version": "1.0.0", + "license": "SSPL-1.0 OR Elastic License 2.0", + "private": true +} \ No newline at end of file diff --git a/src/plugins/data/common/es_query/__fixtures__/index_pattern_response.ts b/packages/kbn-es-query/src/__fixtures__/index_pattern_response.ts similarity index 100% rename from src/plugins/data/common/es_query/__fixtures__/index_pattern_response.ts rename to packages/kbn-es-query/src/__fixtures__/index_pattern_response.ts diff --git a/src/plugins/data/common/es_query/es_query/build_es_query.test.ts b/packages/kbn-es-query/src/es_query/build_es_query.test.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/build_es_query.test.ts rename to packages/kbn-es-query/src/es_query/build_es_query.test.ts diff --git a/src/plugins/data/common/es_query/es_query/build_es_query.ts b/packages/kbn-es-query/src/es_query/build_es_query.ts similarity index 97% rename from src/plugins/data/common/es_query/es_query/build_es_query.ts rename to packages/kbn-es-query/src/es_query/build_es_query.ts index d7b3c630d1a6ed..e8a494ec1b8e4e 100644 --- a/src/plugins/data/common/es_query/es_query/build_es_query.ts +++ b/packages/kbn-es-query/src/es_query/build_es_query.ts @@ -10,8 +10,7 @@ import { groupBy, has, isEqual } from 'lodash'; import { buildQueryFromKuery } from './from_kuery'; import { buildQueryFromFilters } from './from_filters'; import { buildQueryFromLucene } from './from_lucene'; -import { Filter } from '../filters'; -import { Query } from '../../query/types'; +import { Filter, Query } from '../filters'; import { IndexPatternBase } from './types'; export interface EsQueryConfig { diff --git a/src/plugins/data/common/es_query/es_query/decorate_query.test.ts b/packages/kbn-es-query/src/es_query/decorate_query.test.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/decorate_query.test.ts rename to packages/kbn-es-query/src/es_query/decorate_query.test.ts diff --git a/src/plugins/data/common/es_query/es_query/decorate_query.ts b/packages/kbn-es-query/src/es_query/decorate_query.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/decorate_query.ts rename to packages/kbn-es-query/src/es_query/decorate_query.ts diff --git a/src/plugins/data/common/es_query/es_query/es_query_dsl.ts b/packages/kbn-es-query/src/es_query/es_query_dsl.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/es_query_dsl.ts rename to packages/kbn-es-query/src/es_query/es_query_dsl.ts diff --git a/src/plugins/data/common/es_query/es_query/filter_matches_index.test.ts b/packages/kbn-es-query/src/es_query/filter_matches_index.test.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/filter_matches_index.test.ts rename to packages/kbn-es-query/src/es_query/filter_matches_index.test.ts diff --git a/src/plugins/data/common/es_query/es_query/filter_matches_index.ts b/packages/kbn-es-query/src/es_query/filter_matches_index.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/filter_matches_index.ts rename to packages/kbn-es-query/src/es_query/filter_matches_index.ts diff --git a/src/plugins/data/common/es_query/es_query/from_filters.test.ts b/packages/kbn-es-query/src/es_query/from_filters.test.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/from_filters.test.ts rename to packages/kbn-es-query/src/es_query/from_filters.test.ts diff --git a/src/plugins/data/common/es_query/es_query/from_filters.ts b/packages/kbn-es-query/src/es_query/from_filters.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/from_filters.ts rename to packages/kbn-es-query/src/es_query/from_filters.ts diff --git a/src/plugins/data/common/es_query/es_query/from_kuery.test.ts b/packages/kbn-es-query/src/es_query/from_kuery.test.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/from_kuery.test.ts rename to packages/kbn-es-query/src/es_query/from_kuery.test.ts diff --git a/src/plugins/data/common/es_query/es_query/from_kuery.ts b/packages/kbn-es-query/src/es_query/from_kuery.ts similarity index 96% rename from src/plugins/data/common/es_query/es_query/from_kuery.ts rename to packages/kbn-es-query/src/es_query/from_kuery.ts index 3eccfd87761133..efe8b26a814125 100644 --- a/src/plugins/data/common/es_query/es_query/from_kuery.ts +++ b/packages/kbn-es-query/src/es_query/from_kuery.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ +import { Query } from '../filters'; import { fromKueryExpression, toElasticsearchQuery, nodeTypes, KueryNode } from '../kuery'; import { IndexPatternBase } from './types'; -import { Query } from '../../query/types'; export function buildQueryFromKuery( indexPattern: IndexPatternBase | undefined, diff --git a/src/plugins/data/common/es_query/es_query/from_lucene.test.ts b/packages/kbn-es-query/src/es_query/from_lucene.test.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/from_lucene.test.ts rename to packages/kbn-es-query/src/es_query/from_lucene.test.ts diff --git a/src/plugins/data/common/es_query/es_query/from_lucene.ts b/packages/kbn-es-query/src/es_query/from_lucene.ts similarity index 95% rename from src/plugins/data/common/es_query/es_query/from_lucene.ts rename to packages/kbn-es-query/src/es_query/from_lucene.ts index 6485281cc0fb35..cba789513c983e 100644 --- a/src/plugins/data/common/es_query/es_query/from_lucene.ts +++ b/packages/kbn-es-query/src/es_query/from_lucene.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ +import { Query } from '..'; import { decorateQuery } from './decorate_query'; import { luceneStringToDsl } from './lucene_string_to_dsl'; -import { Query } from '../../query/types'; export function buildQueryFromLucene( queries: Query[], diff --git a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts b/packages/kbn-es-query/src/es_query/handle_nested_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts rename to packages/kbn-es-query/src/es_query/handle_nested_filter.test.ts diff --git a/src/plugins/data/common/es_query/es_query/handle_nested_filter.ts b/packages/kbn-es-query/src/es_query/handle_nested_filter.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/handle_nested_filter.ts rename to packages/kbn-es-query/src/es_query/handle_nested_filter.ts diff --git a/src/plugins/data/common/es_query/es_query/index.ts b/packages/kbn-es-query/src/es_query/index.ts similarity index 91% rename from src/plugins/data/common/es_query/es_query/index.ts rename to packages/kbn-es-query/src/es_query/index.ts index efe645f111b6af..3e8ac98661ed52 100644 --- a/src/plugins/data/common/es_query/es_query/index.ts +++ b/packages/kbn-es-query/src/es_query/index.ts @@ -10,5 +10,4 @@ export { buildEsQuery, EsQueryConfig } from './build_es_query'; 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'; diff --git a/src/plugins/data/common/es_query/es_query/lucene_string_to_dsl.test.ts b/packages/kbn-es-query/src/es_query/lucene_string_to_dsl.test.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/lucene_string_to_dsl.test.ts rename to packages/kbn-es-query/src/es_query/lucene_string_to_dsl.test.ts diff --git a/src/plugins/data/common/es_query/es_query/lucene_string_to_dsl.ts b/packages/kbn-es-query/src/es_query/lucene_string_to_dsl.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/lucene_string_to_dsl.ts rename to packages/kbn-es-query/src/es_query/lucene_string_to_dsl.ts diff --git a/src/plugins/data/common/es_query/es_query/migrate_filter.test.ts b/packages/kbn-es-query/src/es_query/migrate_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/migrate_filter.test.ts rename to packages/kbn-es-query/src/es_query/migrate_filter.test.ts diff --git a/src/plugins/data/common/es_query/es_query/migrate_filter.ts b/packages/kbn-es-query/src/es_query/migrate_filter.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/migrate_filter.ts rename to packages/kbn-es-query/src/es_query/migrate_filter.ts diff --git a/src/plugins/data/common/es_query/es_query/types.ts b/packages/kbn-es-query/src/es_query/types.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/types.ts rename to packages/kbn-es-query/src/es_query/types.ts diff --git a/src/plugins/data/common/es_query/filters/build_filter.test.ts b/packages/kbn-es-query/src/filters/build_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/build_filter.test.ts rename to packages/kbn-es-query/src/filters/build_filter.test.ts diff --git a/src/plugins/data/common/es_query/filters/build_filters.ts b/packages/kbn-es-query/src/filters/build_filters.ts similarity index 95% rename from src/plugins/data/common/es_query/filters/build_filters.ts rename to packages/kbn-es-query/src/filters/build_filters.ts index 333bca779af44a..e98b8611f4f6b5 100644 --- a/src/plugins/data/common/es_query/filters/build_filters.ts +++ b/packages/kbn-es-query/src/filters/build_filters.ts @@ -6,18 +6,16 @@ * Side Public License, v 1. */ -import { FieldBase, IndexPatternBase } from '../..'; - import { Filter, FILTERS, - FilterStateStore, - FilterMeta, buildPhraseFilter, buildPhrasesFilter, buildRangeFilter, buildExistsFilter, } from '.'; +import { FieldBase, IndexPatternBase } from '..'; +import { FilterMeta, FilterStateStore } from './types'; export function buildFilter( indexPattern: IndexPatternBase, diff --git a/src/plugins/data/common/es_query/filters/custom_filter.ts b/packages/kbn-es-query/src/filters/custom_filter.ts similarity index 91% rename from src/plugins/data/common/es_query/filters/custom_filter.ts rename to packages/kbn-es-query/src/filters/custom_filter.ts index bab226157ddd11..aa9e798a5b1acf 100644 --- a/src/plugins/data/common/es_query/filters/custom_filter.ts +++ b/packages/kbn-es-query/src/filters/custom_filter.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter } from './meta_filter'; +import { Filter } from './types'; export type CustomFilter = Filter & { query: any; diff --git a/src/plugins/data/common/es_query/filters/exists_filter.test.ts b/packages/kbn-es-query/src/filters/exists_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/exists_filter.test.ts rename to packages/kbn-es-query/src/filters/exists_filter.test.ts diff --git a/src/plugins/data/common/es_query/filters/exists_filter.ts b/packages/kbn-es-query/src/filters/exists_filter.ts similarity index 95% rename from src/plugins/data/common/es_query/filters/exists_filter.ts rename to packages/kbn-es-query/src/filters/exists_filter.ts index ed499e8ead0dbb..351b75ebb36f8f 100644 --- a/src/plugins/data/common/es_query/filters/exists_filter.ts +++ b/packages/kbn-es-query/src/filters/exists_filter.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { Filter, FilterMeta } from './meta_filter'; import { FieldBase, IndexPatternBase } from '..'; +import { Filter, FilterMeta } from './types'; export type ExistsFilterMeta = FilterMeta; diff --git a/src/plugins/data/common/es_query/filters/geo_bounding_box_filter.test.ts b/packages/kbn-es-query/src/filters/geo_bounding_box_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/geo_bounding_box_filter.test.ts rename to packages/kbn-es-query/src/filters/geo_bounding_box_filter.test.ts diff --git a/src/plugins/data/common/es_query/filters/geo_bounding_box_filter.ts b/packages/kbn-es-query/src/filters/geo_bounding_box_filter.ts similarity index 93% rename from src/plugins/data/common/es_query/filters/geo_bounding_box_filter.ts rename to packages/kbn-es-query/src/filters/geo_bounding_box_filter.ts index 987055405886c2..b309515109d480 100644 --- a/src/plugins/data/common/es_query/filters/geo_bounding_box_filter.ts +++ b/packages/kbn-es-query/src/filters/geo_bounding_box_filter.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter, FilterMeta, LatLon } from './meta_filter'; +import { Filter, FilterMeta, LatLon } from './types'; export type GeoBoundingBoxFilterMeta = FilterMeta & { params: { diff --git a/src/plugins/data/common/es_query/filters/geo_polygon_filter.test.ts b/packages/kbn-es-query/src/filters/geo_polygon_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/geo_polygon_filter.test.ts rename to packages/kbn-es-query/src/filters/geo_polygon_filter.test.ts diff --git a/src/plugins/data/common/es_query/filters/geo_polygon_filter.ts b/packages/kbn-es-query/src/filters/geo_polygon_filter.ts similarity index 93% rename from src/plugins/data/common/es_query/filters/geo_polygon_filter.ts rename to packages/kbn-es-query/src/filters/geo_polygon_filter.ts index 5b284f1b6e3a11..42e417f2c88a4b 100644 --- a/src/plugins/data/common/es_query/filters/geo_polygon_filter.ts +++ b/packages/kbn-es-query/src/filters/geo_polygon_filter.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter, FilterMeta, LatLon } from './meta_filter'; +import { Filter, FilterMeta, LatLon } from './types'; export type GeoPolygonFilterMeta = FilterMeta & { params: { diff --git a/src/plugins/data/common/es_query/filters/get_filter_field.test.ts b/packages/kbn-es-query/src/filters/get_filter_field.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/get_filter_field.test.ts rename to packages/kbn-es-query/src/filters/get_filter_field.test.ts diff --git a/src/plugins/data/common/es_query/filters/get_filter_field.ts b/packages/kbn-es-query/src/filters/get_filter_field.ts similarity index 97% rename from src/plugins/data/common/es_query/filters/get_filter_field.ts rename to packages/kbn-es-query/src/filters/get_filter_field.ts index 0782e46bac7842..4b540beb03754d 100644 --- a/src/plugins/data/common/es_query/filters/get_filter_field.ts +++ b/packages/kbn-es-query/src/filters/get_filter_field.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter } from './meta_filter'; +import { Filter } from './types'; import { getExistsFilterField, isExistsFilter } from './exists_filter'; import { getGeoBoundingBoxFilterField, isGeoBoundingBoxFilter } from './geo_bounding_box_filter'; import { getGeoPolygonFilterField, isGeoPolygonFilter } from './geo_polygon_filter'; diff --git a/src/plugins/data/common/es_query/filters/get_filter_params.test.ts b/packages/kbn-es-query/src/filters/get_filter_params.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/get_filter_params.test.ts rename to packages/kbn-es-query/src/filters/get_filter_params.test.ts diff --git a/src/plugins/data/common/es_query/filters/get_filter_params.ts b/packages/kbn-es-query/src/filters/get_filter_params.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/get_filter_params.ts rename to packages/kbn-es-query/src/filters/get_filter_params.ts diff --git a/src/plugins/data/common/es_query/filters/index.ts b/packages/kbn-es-query/src/filters/index.ts similarity index 91% rename from src/plugins/data/common/es_query/filters/index.ts rename to packages/kbn-es-query/src/filters/index.ts index fe7cdadabaee3e..9fcb226f0ffb2b 100644 --- a/src/plugins/data/common/es_query/filters/index.ts +++ b/packages/kbn-es-query/src/filters/index.ts @@ -7,7 +7,7 @@ */ import { omit, get } from 'lodash'; -import { Filter } from './meta_filter'; +import { Filter } from './types'; export * from './build_filters'; export * from './custom_filter'; @@ -24,7 +24,7 @@ export * from './phrases_filter'; export * from './query_string_filter'; export * from './range_filter'; -export * from './types'; +export { Query, Filter, FILTERS, LatLon, FilterStateStore } from './types'; /** * Clean out any invalid attributes from the filters diff --git a/src/plugins/data/common/es_query/filters/match_all_filter.ts b/packages/kbn-es-query/src/filters/match_all_filter.ts similarity index 92% rename from src/plugins/data/common/es_query/filters/match_all_filter.ts rename to packages/kbn-es-query/src/filters/match_all_filter.ts index 36eb5ee1fce186..a3fdd740986d49 100644 --- a/src/plugins/data/common/es_query/filters/match_all_filter.ts +++ b/packages/kbn-es-query/src/filters/match_all_filter.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter, FilterMeta } from './meta_filter'; +import { Filter, FilterMeta } from './types'; export interface MatchAllFilterMeta extends FilterMeta { field: any; diff --git a/src/plugins/data/common/es_query/filters/meta_filter.ts b/packages/kbn-es-query/src/filters/meta_filter.ts similarity index 69% rename from src/plugins/data/common/es_query/filters/meta_filter.ts rename to packages/kbn-es-query/src/filters/meta_filter.ts index 87455cf1cb7639..25fd26c410826c 100644 --- a/src/plugins/data/common/es_query/filters/meta_filter.ts +++ b/packages/kbn-es-query/src/filters/meta_filter.ts @@ -6,49 +6,7 @@ * Side Public License, v 1. */ -export enum FilterStateStore { - APP_STATE = 'appState', - GLOBAL_STATE = 'globalState', -} - -// eslint-disable-next-line -export type FilterState = { - store: FilterStateStore; -}; - -type FilterFormatterFunction = (value: any) => string; -export interface FilterValueFormatter { - convert: FilterFormatterFunction; - getConverterFor: (type: string) => FilterFormatterFunction; -} - -// eslint-disable-next-line -export type FilterMeta = { - alias: string | null; - disabled: boolean; - negate: boolean; - // controlledBy is there to identify who owns the filter - controlledBy?: string; - // index and type are optional only because when you create a new filter, there are no defaults - index?: string; - isMultiIndex?: boolean; - type?: string; - key?: string; - params?: any; - value?: string; -}; - -// eslint-disable-next-line -export type Filter = { - $state?: FilterState; - meta: FilterMeta; - query?: any; -}; - -export interface LatLon { - lat: number; - lon: number; -} +import { Filter, FilterMeta, FilterState, FilterStateStore } from './types'; export const buildEmptyFilter = (isPinned: boolean, index?: string): Filter => { const meta: FilterMeta = { diff --git a/src/plugins/data/common/es_query/filters/missing_filter.test.ts b/packages/kbn-es-query/src/filters/missing_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/missing_filter.test.ts rename to packages/kbn-es-query/src/filters/missing_filter.test.ts diff --git a/src/plugins/data/common/es_query/filters/missing_filter.ts b/packages/kbn-es-query/src/filters/missing_filter.ts similarity index 93% rename from src/plugins/data/common/es_query/filters/missing_filter.ts rename to packages/kbn-es-query/src/filters/missing_filter.ts index d0d337283ca60e..0e10cb18d3c21a 100644 --- a/src/plugins/data/common/es_query/filters/missing_filter.ts +++ b/packages/kbn-es-query/src/filters/missing_filter.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter, FilterMeta } from './meta_filter'; +import { Filter, FilterMeta } from './types'; export type MissingFilterMeta = FilterMeta; diff --git a/src/plugins/data/common/es_query/filters/phrase_filter.test.ts b/packages/kbn-es-query/src/filters/phrase_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/phrase_filter.test.ts rename to packages/kbn-es-query/src/filters/phrase_filter.test.ts diff --git a/src/plugins/data/common/es_query/filters/phrase_filter.ts b/packages/kbn-es-query/src/filters/phrase_filter.ts similarity index 98% rename from src/plugins/data/common/es_query/filters/phrase_filter.ts rename to packages/kbn-es-query/src/filters/phrase_filter.ts index 628ae684ff2b90..754ee006c97bc8 100644 --- a/src/plugins/data/common/es_query/filters/phrase_filter.ts +++ b/packages/kbn-es-query/src/filters/phrase_filter.ts @@ -7,7 +7,7 @@ */ import type { estypes } from '@elastic/elasticsearch'; import { get, isPlainObject } from 'lodash'; -import { Filter, FilterMeta } from './meta_filter'; +import { Filter, FilterMeta } from './types'; import { FieldBase, IndexPatternBase } from '..'; export type PhraseFilterMeta = FilterMeta & { diff --git a/src/plugins/data/common/es_query/filters/phrases_filter.test.ts b/packages/kbn-es-query/src/filters/phrases_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/phrases_filter.test.ts rename to packages/kbn-es-query/src/filters/phrases_filter.test.ts diff --git a/src/plugins/data/common/es_query/filters/phrases_filter.ts b/packages/kbn-es-query/src/filters/phrases_filter.ts similarity index 97% rename from src/plugins/data/common/es_query/filters/phrases_filter.ts rename to packages/kbn-es-query/src/filters/phrases_filter.ts index e73f0f4e6a810a..835d21323228de 100644 --- a/src/plugins/data/common/es_query/filters/phrases_filter.ts +++ b/packages/kbn-es-query/src/filters/phrases_filter.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter, FilterMeta } from './meta_filter'; +import { Filter, FilterMeta } from './types'; import { getPhraseScript } from './phrase_filter'; import { FILTERS } from './index'; import { FieldBase, IndexPatternBase } from '../es_query'; diff --git a/src/plugins/data/common/es_query/filters/query_string_filter.test.ts b/packages/kbn-es-query/src/filters/query_string_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/query_string_filter.test.ts rename to packages/kbn-es-query/src/filters/query_string_filter.test.ts diff --git a/src/plugins/data/common/es_query/filters/query_string_filter.ts b/packages/kbn-es-query/src/filters/query_string_filter.ts similarity index 94% rename from src/plugins/data/common/es_query/filters/query_string_filter.ts rename to packages/kbn-es-query/src/filters/query_string_filter.ts index bf960f0ac04b36..b4774d5e65a672 100644 --- a/src/plugins/data/common/es_query/filters/query_string_filter.ts +++ b/packages/kbn-es-query/src/filters/query_string_filter.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter, FilterMeta } from './meta_filter'; +import { Filter, FilterMeta } from './types'; export type QueryStringFilterMeta = FilterMeta; diff --git a/src/plugins/data/common/es_query/filters/range_filter.test.ts b/packages/kbn-es-query/src/filters/range_filter.test.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/range_filter.test.ts rename to packages/kbn-es-query/src/filters/range_filter.test.ts diff --git a/src/plugins/data/common/es_query/filters/range_filter.ts b/packages/kbn-es-query/src/filters/range_filter.ts similarity index 99% rename from src/plugins/data/common/es_query/filters/range_filter.ts rename to packages/kbn-es-query/src/filters/range_filter.ts index f87f9d0f846f26..4e9f019d521469 100644 --- a/src/plugins/data/common/es_query/filters/range_filter.ts +++ b/packages/kbn-es-query/src/filters/range_filter.ts @@ -7,7 +7,7 @@ */ import type { estypes } from '@elastic/elasticsearch'; import { map, reduce, mapValues, get, keys, pickBy } from 'lodash'; -import { Filter, FilterMeta } from './meta_filter'; +import { Filter, FilterMeta } from './types'; import { IndexPatternBase, FieldBase } from '..'; const OPERANDS_IN_RANGE = 2; diff --git a/src/plugins/data/common/es_query/filters/stubs/exists_filter.ts b/packages/kbn-es-query/src/filters/stubs/exists_filter.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/stubs/exists_filter.ts rename to packages/kbn-es-query/src/filters/stubs/exists_filter.ts diff --git a/src/plugins/data/common/es_query/filters/stubs/index.ts b/packages/kbn-es-query/src/filters/stubs/index.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/stubs/index.ts rename to packages/kbn-es-query/src/filters/stubs/index.ts diff --git a/src/plugins/data/common/es_query/filters/stubs/phrase_filter.ts b/packages/kbn-es-query/src/filters/stubs/phrase_filter.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/stubs/phrase_filter.ts rename to packages/kbn-es-query/src/filters/stubs/phrase_filter.ts diff --git a/src/plugins/data/common/es_query/filters/stubs/phrases_filter.ts b/packages/kbn-es-query/src/filters/stubs/phrases_filter.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/stubs/phrases_filter.ts rename to packages/kbn-es-query/src/filters/stubs/phrases_filter.ts diff --git a/src/plugins/data/common/es_query/filters/stubs/range_filter.ts b/packages/kbn-es-query/src/filters/stubs/range_filter.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/stubs/range_filter.ts rename to packages/kbn-es-query/src/filters/stubs/range_filter.ts diff --git a/src/plugins/data/common/es_query/filters/types.ts b/packages/kbn-es-query/src/filters/types.ts similarity index 55% rename from src/plugins/data/common/es_query/filters/types.ts rename to packages/kbn-es-query/src/filters/types.ts index a007189d81a035..2a6ae940adf6c1 100644 --- a/src/plugins/data/common/es_query/filters/types.ts +++ b/packages/kbn-es-query/src/filters/types.ts @@ -40,3 +40,53 @@ export enum FILTERS { GEO_POLYGON = 'geo_polygon', SPATIAL_FILTER = 'spatial_filter', } + +export enum FilterStateStore { + APP_STATE = 'appState', + GLOBAL_STATE = 'globalState', +} + +// eslint-disable-next-line +export type FilterState = { + store: FilterStateStore; +}; + +type FilterFormatterFunction = (value: any) => string; +export interface FilterValueFormatter { + convert: FilterFormatterFunction; + getConverterFor: (type: string) => FilterFormatterFunction; +} + +// eslint-disable-next-line +export type FilterMeta = { + alias: string | null; + disabled: boolean; + negate: boolean; + // controlledBy is there to identify who owns the filter + controlledBy?: string; + // index and type are optional only because when you create a new filter, there are no defaults + index?: string; + isMultiIndex?: boolean; + type?: string; + key?: string; + params?: any; + value?: string; +}; + +// eslint-disable-next-line +export type Filter = { + $state?: FilterState; + meta: FilterMeta; + query?: any; // TODO: can we use the Query type her? +}; + +// eslint-disable-next-line +export type Query = { + query: string | { [key: string]: any }; + language: string; +}; + +export interface LatLon { + lat: number; + lon: number; +} diff --git a/packages/kbn-es-query/src/index.ts b/packages/kbn-es-query/src/index.ts new file mode 100644 index 00000000000000..bbba52871d4c8e --- /dev/null +++ b/packages/kbn-es-query/src/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './es_query'; +export * from './filters'; +export * from './kuery'; diff --git a/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js b/packages/kbn-es-query/src/kuery/ast/_generated_/kuery.js similarity index 69% rename from src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js rename to packages/kbn-es-query/src/kuery/ast/_generated_/kuery.js index 7ee744ad5f4c82..05897685a3b66c 100644 --- a/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js +++ b/packages/kbn-es-query/src/kuery/ast/_generated_/kuery.js @@ -1,6 +1,12 @@ -module.exports = (function() { - "use strict"; - +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = (function () { /* * Generated by PEG.js 0.9.0. * @@ -8,19 +14,21 @@ module.exports = (function() { */ function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } + function ctor() { + this.constructor = child; + } ctor.prototype = parent.prototype; child.prototype = new ctor(); } function peg$SyntaxError(message, expected, found, location) { - this.message = message; + this.message = message; this.expected = expected; - this.found = found; + this.found = found; this.location = location; - this.name = "SyntaxError"; + this.name = 'SyntaxError'; - if (typeof Error.captureStackTrace === "function") { + if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, peg$SyntaxError); } } @@ -28,265 +36,313 @@ module.exports = (function() { peg$subclass(peg$SyntaxError, Error); function peg$parse(input) { - var options = arguments.length > 1 ? arguments[1] : {}, - parser = this, - - peg$FAILED = {}, + const options = arguments.length > 1 ? arguments[1] : {}; + const parser = this; - peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral }, - peg$startRuleFunction = peg$parsestart, + const peg$FAILED = {}; - peg$c0 = function(query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - if (query !== null) return query; - return nodeTypes.function.buildNode('is', '*', '*'); - }, - peg$c1 = function(head, query) { return query; }, - peg$c2 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('or', nodes); - }, - peg$c3 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('and', nodes); - }, - peg$c4 = function(query) { - if (query.type === 'cursor') return query; - return buildFunctionNode('not', [query]); - }, - peg$c5 = "(", - peg$c6 = { type: "literal", value: "(", description: "\"(\"" }, - peg$c7 = ")", - peg$c8 = { type: "literal", value: ")", description: "\")\"" }, - peg$c9 = function(query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return query; - }, - peg$c10 = ":", - peg$c11 = { type: "literal", value: ":", description: "\":\"" }, - peg$c12 = "{", - peg$c13 = { type: "literal", value: "{", description: "\"{\"" }, - peg$c14 = "}", - peg$c15 = { type: "literal", value: "}", description: "\"}\"" }, - peg$c16 = function(field, query, trailing) { - if (query.type === 'cursor') { - return { - ...query, - nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, - } - }; + const peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral }; + let peg$startRuleFunction = peg$parsestart; - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return buildFunctionNode('nested', [field, query]); - }, - peg$c17 = { type: "other", description: "fieldName" }, - peg$c18 = function(field, operator, value) { - if (value.type === 'cursor') { - return { - ...value, - suggestionTypes: ['conjunction'] - }; - } - const range = buildNamedArgNode(operator, value); - return buildFunctionNode('range', [field, range]); - }, - peg$c19 = function(field, partial) { - if (partial.type === 'cursor') { - return { - ...partial, - fieldName: field.value, - suggestionTypes: ['value', 'conjunction'] - }; - } - return partial(field); - }, - peg$c20 = function(partial) { - if (partial.type === 'cursor') { - const fieldName = `${partial.prefix}${partial.suffix}`.trim(); - return { - ...partial, - fieldName, - suggestionTypes: ['field', 'operator', 'conjunction'] - }; - } - const field = buildLiteralNode(null); - return partial(field); - }, - peg$c21 = function(partial, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return partial; - }, - peg$c22 = function(head, partial) { return partial; }, - peg$c23 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('or', nodes.map(partial => partial(field))); - }, - peg$c24 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('and', nodes.map(partial => partial(field))); - }, - peg$c25 = function(partial) { - if (partial.type === 'cursor') { - return { - ...list, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('not', [partial(field)]); - }, - peg$c26 = { type: "other", description: "value" }, - peg$c27 = function(value) { - if (value.type === 'cursor') return value; - const isPhrase = buildLiteralNode(true); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }, - peg$c28 = function(value) { - if (value.type === 'cursor') return value; - - if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) { - error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.'); - } + const peg$c0 = function (query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + if (query !== null) return query; + return nodeTypes.function.buildNode('is', '*', '*'); + }; + const peg$c1 = function (head, query) { + return query; + }; + const peg$c2 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('or', nodes); + }; + const peg$c3 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('and', nodes); + }; + const peg$c4 = function (query) { + if (query.type === 'cursor') return query; + return buildFunctionNode('not', [query]); + }; + const peg$c5 = '('; + const peg$c6 = { type: 'literal', value: '(', description: '"("' }; + const peg$c7 = ')'; + const peg$c8 = { type: 'literal', value: ')', description: '")"' }; + const peg$c9 = function (query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + return query; + }; + const peg$c10 = ':'; + const peg$c11 = { type: 'literal', value: ':', description: '":"' }; + const peg$c12 = '{'; + const peg$c13 = { type: 'literal', value: '{', description: '"{"' }; + const peg$c14 = '}'; + const peg$c15 = { type: 'literal', value: '}', description: '"}"' }; + const peg$c16 = function (field, query, trailing) { + if (query.type === 'cursor') { + return { + ...query, + nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, + }; + } - const isPhrase = buildLiteralNode(false); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }, - peg$c29 = { type: "other", description: "OR" }, - peg$c30 = "or", - peg$c31 = { type: "literal", value: "or", description: "\"or\"" }, - peg$c32 = { type: "other", description: "AND" }, - peg$c33 = "and", - peg$c34 = { type: "literal", value: "and", description: "\"and\"" }, - peg$c35 = { type: "other", description: "NOT" }, - peg$c36 = "not", - peg$c37 = { type: "literal", value: "not", description: "\"not\"" }, - peg$c38 = { type: "other", description: "literal" }, - peg$c39 = function() { return parseCursor; }, - peg$c40 = "\"", - peg$c41 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c42 = function(prefix, cursor, suffix) { - const { start, end } = location(); - return { - type: 'cursor', - start: start.offset, - end: end.offset - cursor.length, - prefix: prefix.join(''), - suffix: suffix.join(''), - text: text().replace(cursor, '') - }; - }, - peg$c43 = function(chars) { - return buildLiteralNode(chars.join('')); - }, - peg$c44 = "\\", - peg$c45 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c46 = /^[\\"]/, - peg$c47 = { type: "class", value: "[\\\\\"]", description: "[\\\\\"]" }, - peg$c48 = function(char) { return char; }, - peg$c49 = /^[^"]/, - peg$c50 = { type: "class", value: "[^\"]", description: "[^\"]" }, - peg$c51 = function(chars) { - const sequence = chars.join('').trim(); - if (sequence === 'null') return buildLiteralNode(null); - if (sequence === 'true') return buildLiteralNode(true); - if (sequence === 'false') return buildLiteralNode(false); - if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); - return buildLiteralNode(sequence); - }, - peg$c52 = { type: "any", description: "any character" }, - peg$c53 = "*", - peg$c54 = { type: "literal", value: "*", description: "\"*\"" }, - peg$c55 = function() { return wildcardSymbol; }, - peg$c56 = "\\t", - peg$c57 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, - peg$c58 = function() { return '\t'; }, - peg$c59 = "\\r", - peg$c60 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, - peg$c61 = function() { return '\r'; }, - peg$c62 = "\\n", - peg$c63 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, - peg$c64 = function() { return '\n'; }, - peg$c65 = function(keyword) { return keyword; }, - peg$c66 = /^[\\():<>"*{}]/, - peg$c67 = { type: "class", value: "[\\\\():<>\"*{}]", description: "[\\\\():<>\"*{}]" }, - peg$c68 = function(sequence) { return sequence; }, - peg$c69 = "u", - peg$c70 = { type: "literal", value: "u", description: "\"u\"" }, - peg$c71 = function(digits) { - return String.fromCharCode(parseInt(digits, 16)); - }, - peg$c72 = /^[0-9a-f]/i, - peg$c73 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, - peg$c74 = "<=", - peg$c75 = { type: "literal", value: "<=", description: "\"<=\"" }, - peg$c76 = function() { return 'lte'; }, - peg$c77 = ">=", - peg$c78 = { type: "literal", value: ">=", description: "\">=\"" }, - peg$c79 = function() { return 'gte'; }, - peg$c80 = "<", - peg$c81 = { type: "literal", value: "<", description: "\"<\"" }, - peg$c82 = function() { return 'lt'; }, - peg$c83 = ">", - peg$c84 = { type: "literal", value: ">", description: "\">\"" }, - peg$c85 = function() { return 'gt'; }, - peg$c86 = { type: "other", description: "whitespace" }, - peg$c87 = /^[ \t\r\n\xA0]/, - peg$c88 = { type: "class", value: "[\\ \\t\\r\\n\\u00A0]", description: "[\\ \\t\\r\\n\\u00A0]" }, - peg$c89 = "@kuery-cursor@", - peg$c90 = { type: "literal", value: "@kuery-cursor@", description: "\"@kuery-cursor@\"" }, - peg$c91 = function() { return cursorSymbol; }, - - peg$currPos = 0, - peg$savedPos = 0, - peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }], - peg$maxFailPos = 0, - peg$maxFailExpected = [], - peg$silentFails = 0, - - peg$resultsCache = {}, - - peg$result; - - if ("startRule" in options) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + return buildFunctionNode('nested', [field, query]); + }; + const peg$c17 = { type: 'other', description: 'fieldName' }; + const peg$c18 = function (field, operator, value) { + if (value.type === 'cursor') { + return { + ...value, + suggestionTypes: ['conjunction'], + }; + } + const range = buildNamedArgNode(operator, value); + return buildFunctionNode('range', [field, range]); + }; + const peg$c19 = function (field, partial) { + if (partial.type === 'cursor') { + return { + ...partial, + fieldName: field.value, + suggestionTypes: ['value', 'conjunction'], + }; + } + return partial(field); + }; + const peg$c20 = function (partial) { + if (partial.type === 'cursor') { + const fieldName = `${partial.prefix}${partial.suffix}`.trim(); + return { + ...partial, + fieldName, + suggestionTypes: ['field', 'operator', 'conjunction'], + }; + } + const field = buildLiteralNode(null); + return partial(field); + }; + const peg$c21 = function (partial, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + return partial; + }; + const peg$c22 = function (head, partial) { + return partial; + }; + const peg$c23 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'], + }; + } + return (field) => + buildFunctionNode( + 'or', + nodes.map((partial) => partial(field)) + ); + }; + const peg$c24 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'], + }; + } + return (field) => + buildFunctionNode( + 'and', + nodes.map((partial) => partial(field)) + ); + }; + const peg$c25 = function (partial) { + if (partial.type === 'cursor') { + return { + ...list, + suggestionTypes: ['value'], + }; + } + return (field) => buildFunctionNode('not', [partial(field)]); + }; + const peg$c26 = { type: 'other', description: 'value' }; + const peg$c27 = function (value) { + if (value.type === 'cursor') return value; + const isPhrase = buildLiteralNode(true); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + const peg$c28 = function (value) { + if (value.type === 'cursor') return value; + + if ( + !allowLeadingWildcards && + value.type === 'wildcard' && + nodeTypes.wildcard.hasLeadingWildcard(value) + ) { + error( + 'Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.' + ); + } + + const isPhrase = buildLiteralNode(false); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + const peg$c29 = { type: 'other', description: 'OR' }; + const peg$c30 = 'or'; + const peg$c31 = { type: 'literal', value: 'or', description: '"or"' }; + const peg$c32 = { type: 'other', description: 'AND' }; + const peg$c33 = 'and'; + const peg$c34 = { type: 'literal', value: 'and', description: '"and"' }; + const peg$c35 = { type: 'other', description: 'NOT' }; + const peg$c36 = 'not'; + const peg$c37 = { type: 'literal', value: 'not', description: '"not"' }; + const peg$c38 = { type: 'other', description: 'literal' }; + const peg$c39 = function () { + return parseCursor; + }; + const peg$c40 = '"'; + const peg$c41 = { type: 'literal', value: '"', description: '"\\""' }; + const peg$c42 = function (prefix, cursor, suffix) { + const { start, end } = location(); + return { + type: 'cursor', + start: start.offset, + end: end.offset - cursor.length, + prefix: prefix.join(''), + suffix: suffix.join(''), + text: text().replace(cursor, ''), + }; + }; + const peg$c43 = function (chars) { + return buildLiteralNode(chars.join('')); + }; + const peg$c44 = '\\'; + const peg$c45 = { type: 'literal', value: '\\', description: '"\\\\"' }; + const peg$c46 = /^[\\"]/; + const peg$c47 = { type: 'class', value: '[\\\\"]', description: '[\\\\"]' }; + const peg$c48 = function (char) { + return char; + }; + const peg$c49 = /^[^"]/; + const peg$c50 = { type: 'class', value: '[^"]', description: '[^"]' }; + const peg$c51 = function (chars) { + const sequence = chars.join('').trim(); + if (sequence === 'null') return buildLiteralNode(null); + if (sequence === 'true') return buildLiteralNode(true); + if (sequence === 'false') return buildLiteralNode(false); + if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); + return buildLiteralNode(sequence); + }; + const peg$c52 = { type: 'any', description: 'any character' }; + const peg$c53 = '*'; + const peg$c54 = { type: 'literal', value: '*', description: '"*"' }; + const peg$c55 = function () { + return wildcardSymbol; + }; + const peg$c56 = '\\t'; + const peg$c57 = { type: 'literal', value: '\\t', description: '"\\\\t"' }; + const peg$c58 = function () { + return '\t'; + }; + const peg$c59 = '\\r'; + const peg$c60 = { type: 'literal', value: '\\r', description: '"\\\\r"' }; + const peg$c61 = function () { + return '\r'; + }; + const peg$c62 = '\\n'; + const peg$c63 = { type: 'literal', value: '\\n', description: '"\\\\n"' }; + const peg$c64 = function () { + return '\n'; + }; + const peg$c65 = function (keyword) { + return keyword; + }; + const peg$c66 = /^[\\():<>"*{}]/; + const peg$c67 = { type: 'class', value: '[\\\\():<>"*{}]', description: '[\\\\():<>"*{}]' }; + const peg$c68 = function (sequence) { + return sequence; + }; + const peg$c69 = 'u'; + const peg$c70 = { type: 'literal', value: 'u', description: '"u"' }; + const peg$c71 = function (digits) { + return String.fromCharCode(parseInt(digits, 16)); + }; + const peg$c72 = /^[0-9a-f]/i; + const peg$c73 = { type: 'class', value: '[0-9a-f]i', description: '[0-9a-f]i' }; + const peg$c74 = '<='; + const peg$c75 = { type: 'literal', value: '<=', description: '"<="' }; + const peg$c76 = function () { + return 'lte'; + }; + const peg$c77 = '>='; + const peg$c78 = { type: 'literal', value: '>=', description: '">="' }; + const peg$c79 = function () { + return 'gte'; + }; + const peg$c80 = '<'; + const peg$c81 = { type: 'literal', value: '<', description: '"<"' }; + const peg$c82 = function () { + return 'lt'; + }; + const peg$c83 = '>'; + const peg$c84 = { type: 'literal', value: '>', description: '">"' }; + const peg$c85 = function () { + return 'gt'; + }; + const peg$c86 = { type: 'other', description: 'whitespace' }; + const peg$c87 = /^[ \t\r\n\xA0]/; + const peg$c88 = { + type: 'class', + value: '[\\ \\t\\r\\n\\u00A0]', + description: '[\\ \\t\\r\\n\\u00A0]', + }; + const peg$c89 = '@kuery-cursor@'; + const peg$c90 = { type: 'literal', value: '@kuery-cursor@', description: '"@kuery-cursor@"' }; + const peg$c91 = function () { + return cursorSymbol; + }; + + let peg$currPos = 0; + let peg$savedPos = 0; + const peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }]; + let peg$maxFailPos = 0; + let peg$maxFailExpected = []; + let peg$silentFails = 0; + + const peg$resultsCache = {}; + + let peg$result; + + if ('startRule' in options) { if (!(options.startRule in peg$startRuleFunctions)) { - throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + throw new Error('Can\'t start parsing from rule "' + options.startRule + '".'); } peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; @@ -303,7 +359,7 @@ module.exports = (function() { function expected(description) { throw peg$buildException( null, - [{ type: "other", description: description }], + [{ type: 'other', description: description }], input.substring(peg$savedPos, peg$currPos), peg$computeLocation(peg$savedPos, peg$currPos) ); @@ -319,8 +375,9 @@ module.exports = (function() { } function peg$computePosDetails(pos) { - var details = peg$posDetailsCache[pos], - p, ch; + let details = peg$posDetailsCache[pos]; + let p; + let ch; if (details) { return details; @@ -332,18 +389,20 @@ module.exports = (function() { details = peg$posDetailsCache[p]; details = { - line: details.line, + line: details.line, column: details.column, - seenCR: details.seenCR + seenCR: details.seenCR, }; while (p < pos) { ch = input.charAt(p); - if (ch === "\n") { - if (!details.seenCR) { details.line++; } + if (ch === '\n') { + if (!details.seenCR) { + details.line++; + } details.column = 1; details.seenCR = false; - } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { + } else if (ch === '\r' || ch === '\u2028' || ch === '\u2029') { details.line++; details.column = 1; details.seenCR = true; @@ -361,25 +420,27 @@ module.exports = (function() { } function peg$computeLocation(startPos, endPos) { - var startPosDetails = peg$computePosDetails(startPos), - endPosDetails = peg$computePosDetails(endPos); + const startPosDetails = peg$computePosDetails(startPos); + const endPosDetails = peg$computePosDetails(endPos); return { start: { offset: startPos, - line: startPosDetails.line, - column: startPosDetails.column + line: startPosDetails.line, + column: startPosDetails.column, }, end: { offset: endPos, - line: endPosDetails.line, - column: endPosDetails.column - } + line: endPosDetails.line, + column: endPosDetails.column, + }, }; } function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { return; } + if (peg$currPos < peg$maxFailPos) { + return; + } if (peg$currPos > peg$maxFailPos) { peg$maxFailPos = peg$currPos; @@ -391,9 +452,9 @@ module.exports = (function() { function peg$buildException(message, expected, found, location) { function cleanupExpected(expected) { - var i = 1; + let i = 1; - expected.sort(function(a, b) { + expected.sort(function (a, b) { if (a.description < b.description) { return -1; } else if (a.description > b.description) { @@ -414,38 +475,49 @@ module.exports = (function() { function buildMessage(expected, found) { function stringEscape(s) { - function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') .replace(/\x08/g, '\\b') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\f/g, '\\f') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) - .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) - .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) - .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); - } - - var expectedDescs = new Array(expected.length), - expectedDesc, foundDesc, i; + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\f/g, '\\f') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }) + .replace(/[\x10-\x1F\x80-\xFF]/g, function (ch) { + return '\\x' + hex(ch); + }) + .replace(/[\u0100-\u0FFF]/g, function (ch) { + return '\\u0' + hex(ch); + }) + .replace(/[\u1000-\uFFFF]/g, function (ch) { + return '\\u' + hex(ch); + }); + } + + const expectedDescs = new Array(expected.length); + let expectedDesc; + let foundDesc; + let i; for (i = 0; i < expected.length; i++) { expectedDescs[i] = expected[i].description; } - expectedDesc = expected.length > 1 - ? expectedDescs.slice(0, -1).join(", ") - + " or " - + expectedDescs[expected.length - 1] - : expectedDescs[0]; + expectedDesc = + expected.length > 1 + ? expectedDescs.slice(0, -1).join(', ') + ' or ' + expectedDescs[expected.length - 1] + : expectedDescs[0]; - foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; + foundDesc = found ? '"' + stringEscape(found) + '"' : 'end of input'; - return "Expected " + expectedDesc + " but " + foundDesc + " found."; + return 'Expected ' + expectedDesc + ' but ' + foundDesc + ' found.'; } if (expected !== null) { @@ -461,10 +533,13 @@ module.exports = (function() { } function peg$parsestart() { - var s0, s1, s2, s3; + let s0; + let s1; + let s2; + let s3; - var key = peg$currPos * 37 + 0, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 0; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -509,10 +584,15 @@ module.exports = (function() { } function peg$parseOrQuery() { - var s0, s1, s2, s3, s4, s5; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; - var key = peg$currPos * 37 + 1, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 1; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -585,10 +665,15 @@ module.exports = (function() { } function peg$parseAndQuery() { - var s0, s1, s2, s3, s4, s5; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; - var key = peg$currPos * 37 + 2, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 2; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -661,10 +746,12 @@ module.exports = (function() { } function peg$parseNotQuery() { - var s0, s1, s2; + let s0; + let s1; + let s2; - var key = peg$currPos * 37 + 3, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 3; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -698,10 +785,15 @@ module.exports = (function() { } function peg$parseSubQuery() { - var s0, s1, s2, s3, s4, s5; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; - var key = peg$currPos * 37 + 4, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 4; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -715,7 +807,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + if (peg$silentFails === 0) { + peg$fail(peg$c6); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -734,7 +828,9 @@ module.exports = (function() { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } + if (peg$silentFails === 0) { + peg$fail(peg$c8); + } } if (s5 !== peg$FAILED) { peg$savedPos = s0; @@ -770,10 +866,19 @@ module.exports = (function() { } function peg$parseNestedQuery() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; - - var key = peg$currPos * 37 + 5, - cached = peg$resultsCache[key]; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + let s6; + let s7; + let s8; + let s9; + + const key = peg$currPos * 37 + 5; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -796,7 +901,9 @@ module.exports = (function() { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } + if (peg$silentFails === 0) { + peg$fail(peg$c11); + } } if (s3 !== peg$FAILED) { s4 = []; @@ -811,7 +918,9 @@ module.exports = (function() { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } + if (peg$silentFails === 0) { + peg$fail(peg$c13); + } } if (s5 !== peg$FAILED) { s6 = []; @@ -830,7 +939,9 @@ module.exports = (function() { peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c15); } + if (peg$silentFails === 0) { + peg$fail(peg$c15); + } } if (s9 !== peg$FAILED) { peg$savedPos = s0; @@ -882,10 +993,10 @@ module.exports = (function() { } function peg$parseExpression() { - var s0; + let s0; - var key = peg$currPos * 37 + 6, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 6; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -907,10 +1018,11 @@ module.exports = (function() { } function peg$parseField() { - var s0, s1; + let s0; + let s1; - var key = peg$currPos * 37 + 7, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 7; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -923,7 +1035,9 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } + if (peg$silentFails === 0) { + peg$fail(peg$c17); + } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -932,10 +1046,15 @@ module.exports = (function() { } function peg$parseFieldRangeExpression() { - var s0, s1, s2, s3, s4, s5; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; - var key = peg$currPos * 37 + 8, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 8; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -994,10 +1113,15 @@ module.exports = (function() { } function peg$parseFieldValueExpression() { - var s0, s1, s2, s3, s4, s5; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; - var key = peg$currPos * 37 + 9, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 9; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1020,7 +1144,9 @@ module.exports = (function() { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } + if (peg$silentFails === 0) { + peg$fail(peg$c11); + } } if (s3 !== peg$FAILED) { s4 = []; @@ -1062,10 +1188,11 @@ module.exports = (function() { } function peg$parseValueExpression() { - var s0, s1; + let s0; + let s1; - var key = peg$currPos * 37 + 10, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 10; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1087,10 +1214,15 @@ module.exports = (function() { } function peg$parseListOfValues() { - var s0, s1, s2, s3, s4, s5; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; - var key = peg$currPos * 37 + 11, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 11; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1104,7 +1236,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + if (peg$silentFails === 0) { + peg$fail(peg$c6); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -1123,7 +1257,9 @@ module.exports = (function() { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } + if (peg$silentFails === 0) { + peg$fail(peg$c8); + } } if (s5 !== peg$FAILED) { peg$savedPos = s0; @@ -1159,10 +1295,15 @@ module.exports = (function() { } function peg$parseOrListOfValues() { - var s0, s1, s2, s3, s4, s5; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; - var key = peg$currPos * 37 + 12, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 12; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1235,10 +1376,15 @@ module.exports = (function() { } function peg$parseAndListOfValues() { - var s0, s1, s2, s3, s4, s5; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; - var key = peg$currPos * 37 + 13, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 13; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1311,10 +1457,12 @@ module.exports = (function() { } function peg$parseNotListOfValues() { - var s0, s1, s2; + let s0; + let s1; + let s2; - var key = peg$currPos * 37 + 14, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 14; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1348,10 +1496,11 @@ module.exports = (function() { } function peg$parseValue() { - var s0, s1; + let s0; + let s1; - var key = peg$currPos * 37 + 15, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 15; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1379,7 +1528,9 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } + if (peg$silentFails === 0) { + peg$fail(peg$c26); + } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1388,10 +1539,14 @@ module.exports = (function() { } function peg$parseOr() { - var s0, s1, s2, s3, s4; + let s0; + let s1; + let s2; + let s3; + let s4; - var key = peg$currPos * 37 + 16, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 16; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1417,7 +1572,9 @@ module.exports = (function() { peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } + if (peg$silentFails === 0) { + peg$fail(peg$c31); + } } if (s2 !== peg$FAILED) { s3 = []; @@ -1448,7 +1605,9 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } + if (peg$silentFails === 0) { + peg$fail(peg$c29); + } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1457,10 +1616,14 @@ module.exports = (function() { } function peg$parseAnd() { - var s0, s1, s2, s3, s4; + let s0; + let s1; + let s2; + let s3; + let s4; - var key = peg$currPos * 37 + 17, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 17; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1486,7 +1649,9 @@ module.exports = (function() { peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } + if (peg$silentFails === 0) { + peg$fail(peg$c34); + } } if (s2 !== peg$FAILED) { s3 = []; @@ -1517,7 +1682,9 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } + if (peg$silentFails === 0) { + peg$fail(peg$c32); + } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1526,10 +1693,13 @@ module.exports = (function() { } function peg$parseNot() { - var s0, s1, s2, s3; + let s0; + let s1; + let s2; + let s3; - var key = peg$currPos * 37 + 18, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 18; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1544,7 +1714,9 @@ module.exports = (function() { peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c37); } + if (peg$silentFails === 0) { + peg$fail(peg$c37); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -1571,7 +1743,9 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c35); } + if (peg$silentFails === 0) { + peg$fail(peg$c35); + } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1580,10 +1754,11 @@ module.exports = (function() { } function peg$parseLiteral() { - var s0, s1; + let s0; + let s1; - var key = peg$currPos * 37 + 19, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 19; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1599,7 +1774,9 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { + peg$fail(peg$c38); + } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1608,10 +1785,16 @@ module.exports = (function() { } function peg$parseQuotedString() { - var s0, s1, s2, s3, s4, s5, s6; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + let s6; - var key = peg$currPos * 37 + 20, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 20; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1633,7 +1816,9 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } } if (s2 !== peg$FAILED) { s3 = []; @@ -1657,7 +1842,9 @@ module.exports = (function() { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } } if (s6 !== peg$FAILED) { peg$savedPos = s0; @@ -1694,7 +1881,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -1709,7 +1898,9 @@ module.exports = (function() { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } } if (s3 !== peg$FAILED) { peg$savedPos = s0; @@ -1735,10 +1926,12 @@ module.exports = (function() { } function peg$parseQuotedCharacter() { - var s0, s1, s2; + let s0; + let s1; + let s2; - var key = peg$currPos * 37 + 21, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 21; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1756,7 +1949,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { + peg$fail(peg$c45); + } } if (s1 !== peg$FAILED) { if (peg$c46.test(input.charAt(peg$currPos))) { @@ -1764,7 +1959,9 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c47); } + if (peg$silentFails === 0) { + peg$fail(peg$c47); + } } if (s2 !== peg$FAILED) { peg$savedPos = s0; @@ -1796,7 +1993,9 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c50); } + if (peg$silentFails === 0) { + peg$fail(peg$c50); + } } if (s2 !== peg$FAILED) { peg$savedPos = s0; @@ -1820,10 +2019,15 @@ module.exports = (function() { } function peg$parseUnquotedLiteral() { - var s0, s1, s2, s3, s4, s5; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; - var key = peg$currPos * 37 + 22, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 22; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1900,10 +2104,14 @@ module.exports = (function() { } function peg$parseUnquotedCharacter() { - var s0, s1, s2, s3, s4; + let s0; + let s1; + let s2; + let s3; + let s4; - var key = peg$currPos * 37 + 23, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 23; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -1960,7 +2168,9 @@ module.exports = (function() { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } + if (peg$silentFails === 0) { + peg$fail(peg$c52); + } } if (s4 !== peg$FAILED) { peg$savedPos = s0; @@ -1994,10 +2204,11 @@ module.exports = (function() { } function peg$parseWildcard() { - var s0, s1; + let s0; + let s1; - var key = peg$currPos * 37 + 24, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 24; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2011,7 +2222,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c54); } + if (peg$silentFails === 0) { + peg$fail(peg$c54); + } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2025,10 +2238,15 @@ module.exports = (function() { } function peg$parseOptionalSpace() { - var s0, s1, s2, s3, s4, s5; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; - var key = peg$currPos * 37 + 25, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 25; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2095,10 +2313,11 @@ module.exports = (function() { } function peg$parseEscapedWhitespace() { - var s0, s1; + let s0; + let s1; - var key = peg$currPos * 37 + 26, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 26; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2112,7 +2331,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c57); } + if (peg$silentFails === 0) { + peg$fail(peg$c57); + } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2126,7 +2347,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c60); } + if (peg$silentFails === 0) { + peg$fail(peg$c60); + } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2140,7 +2363,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c63); } + if (peg$silentFails === 0) { + peg$fail(peg$c63); + } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2156,10 +2381,12 @@ module.exports = (function() { } function peg$parseEscapedSpecialCharacter() { - var s0, s1, s2; + let s0; + let s1; + let s2; - var key = peg$currPos * 37 + 27, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 27; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2173,7 +2400,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { + peg$fail(peg$c45); + } } if (s1 !== peg$FAILED) { s2 = peg$parseSpecialCharacter(); @@ -2196,10 +2425,12 @@ module.exports = (function() { } function peg$parseEscapedKeyword() { - var s0, s1, s2; + let s0; + let s1; + let s2; - var key = peg$currPos * 37 + 28, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 28; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2213,7 +2444,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { + peg$fail(peg$c45); + } } if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { @@ -2221,7 +2454,9 @@ module.exports = (function() { peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } + if (peg$silentFails === 0) { + peg$fail(peg$c31); + } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { @@ -2229,7 +2464,9 @@ module.exports = (function() { peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } + if (peg$silentFails === 0) { + peg$fail(peg$c34); + } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { @@ -2237,7 +2474,9 @@ module.exports = (function() { peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c37); } + if (peg$silentFails === 0) { + peg$fail(peg$c37); + } } } } @@ -2260,10 +2499,10 @@ module.exports = (function() { } function peg$parseKeyword() { - var s0; + let s0; - var key = peg$currPos * 37 + 29, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 29; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2285,10 +2524,10 @@ module.exports = (function() { } function peg$parseSpecialCharacter() { - var s0; + let s0; - var key = peg$currPos * 37 + 30, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 30; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2301,7 +2540,9 @@ module.exports = (function() { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } + if (peg$silentFails === 0) { + peg$fail(peg$c67); + } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -2310,10 +2551,12 @@ module.exports = (function() { } function peg$parseEscapedUnicodeSequence() { - var s0, s1, s2; + let s0; + let s1; + let s2; - var key = peg$currPos * 37 + 31, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 31; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2327,7 +2570,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { + peg$fail(peg$c45); + } } if (s1 !== peg$FAILED) { s2 = peg$parseUnicodeSequence(); @@ -2350,10 +2595,17 @@ module.exports = (function() { } function peg$parseUnicodeSequence() { - var s0, s1, s2, s3, s4, s5, s6, s7; - - var key = peg$currPos * 37 + 32, - cached = peg$resultsCache[key]; + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + let s6; + let s7; + + const key = peg$currPos * 37 + 32; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2367,7 +2619,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } + if (peg$silentFails === 0) { + peg$fail(peg$c70); + } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2422,10 +2676,10 @@ module.exports = (function() { } function peg$parseHexDigit() { - var s0; + let s0; - var key = peg$currPos * 37 + 33, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 33; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2438,7 +2692,9 @@ module.exports = (function() { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { + peg$fail(peg$c73); + } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -2447,10 +2703,11 @@ module.exports = (function() { } function peg$parseRangeOperator() { - var s0, s1; + let s0; + let s1; - var key = peg$currPos * 37 + 34, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 34; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2464,7 +2721,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { + peg$fail(peg$c75); + } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2478,7 +2737,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c78); } + if (peg$silentFails === 0) { + peg$fail(peg$c78); + } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2492,7 +2753,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { + peg$fail(peg$c81); + } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2506,7 +2769,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } + if (peg$silentFails === 0) { + peg$fail(peg$c84); + } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2523,10 +2788,11 @@ module.exports = (function() { } function peg$parseSpace() { - var s0, s1; + let s0; + let s1; - var key = peg$currPos * 37 + 35, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 35; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2540,12 +2806,16 @@ module.exports = (function() { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c88); } + if (peg$silentFails === 0) { + peg$fail(peg$c88); + } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c86); } + if (peg$silentFails === 0) { + peg$fail(peg$c86); + } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -2554,10 +2824,12 @@ module.exports = (function() { } function peg$parseCursor() { - var s0, s1, s2; + let s0; + let s1; + let s2; - var key = peg$currPos * 37 + 36, - cached = peg$resultsCache[key]; + const key = peg$currPos * 37 + 36; + const cached = peg$resultsCache[key]; if (cached) { peg$currPos = cached.nextPos; @@ -2579,7 +2851,9 @@ module.exports = (function() { peg$currPos += 14; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } + if (peg$silentFails === 0) { + peg$fail(peg$c90); + } } if (s2 !== peg$FAILED) { peg$savedPos = s0; @@ -2599,14 +2873,17 @@ module.exports = (function() { return s0; } - - const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; - const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; - const buildLiteralNode = nodeTypes.literal.buildNode; - const buildWildcardNode = nodeTypes.wildcard.buildNode; - const buildNamedArgNode = nodeTypes.namedArg.buildNode; - const { wildcardSymbol } = nodeTypes.wildcard; - + const { + parseCursor, + cursorSymbol, + allowLeadingWildcards = true, + helpers: { nodeTypes }, + } = options; + const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; + const buildLiteralNode = nodeTypes.literal.buildNode; + const buildWildcardNode = nodeTypes.wildcard.buildNode; + const buildNamedArgNode = nodeTypes.namedArg.buildNode; + const { wildcardSymbol } = nodeTypes.wildcard; peg$result = peg$startRuleFunction(); @@ -2614,7 +2891,7 @@ module.exports = (function() { return peg$result; } else { if (peg$result !== peg$FAILED && peg$currPos < input.length) { - peg$fail({ type: "end", description: "end of input" }); + peg$fail({ type: 'end', description: 'end of input' }); } throw peg$buildException( @@ -2630,6 +2907,6 @@ module.exports = (function() { return { SyntaxError: peg$SyntaxError, - parse: peg$parse + parse: peg$parse, }; -})(); \ No newline at end of file +})(); diff --git a/src/plugins/data/common/es_query/kuery/ast/ast.test.ts b/packages/kbn-es-query/src/kuery/ast/ast.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/ast/ast.test.ts rename to packages/kbn-es-query/src/kuery/ast/ast.test.ts diff --git a/src/plugins/data/common/es_query/kuery/ast/ast.ts b/packages/kbn-es-query/src/kuery/ast/ast.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/ast/ast.ts rename to packages/kbn-es-query/src/kuery/ast/ast.ts diff --git a/src/plugins/data/common/es_query/kuery/ast/index.ts b/packages/kbn-es-query/src/kuery/ast/index.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/ast/index.ts rename to packages/kbn-es-query/src/kuery/ast/index.ts diff --git a/src/plugins/data/common/es_query/kuery/ast/kuery.peg b/packages/kbn-es-query/src/kuery/ast/kuery.peg similarity index 100% rename from src/plugins/data/common/es_query/kuery/ast/kuery.peg rename to packages/kbn-es-query/src/kuery/ast/kuery.peg diff --git a/src/plugins/data/common/es_query/kuery/functions/and.test.ts b/packages/kbn-es-query/src/kuery/functions/and.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/and.test.ts rename to packages/kbn-es-query/src/kuery/functions/and.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/and.ts b/packages/kbn-es-query/src/kuery/functions/and.ts similarity index 93% rename from src/plugins/data/common/es_query/kuery/functions/and.ts rename to packages/kbn-es-query/src/kuery/functions/and.ts index ba7d5d1f6645b9..239dd67e73d107 100644 --- a/src/plugins/data/common/es_query/kuery/functions/and.ts +++ b/packages/kbn-es-query/src/kuery/functions/and.ts @@ -7,7 +7,7 @@ */ import * as ast from '../ast'; -import { IndexPatternBase, KueryNode } from '../../..'; +import { IndexPatternBase, KueryNode } from '../..'; export function buildNodeParams(children: KueryNode[]) { return { diff --git a/src/plugins/data/common/es_query/kuery/functions/exists.test.ts b/packages/kbn-es-query/src/kuery/functions/exists.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/exists.test.ts rename to packages/kbn-es-query/src/kuery/functions/exists.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/exists.ts b/packages/kbn-es-query/src/kuery/functions/exists.ts similarity index 94% rename from src/plugins/data/common/es_query/kuery/functions/exists.ts rename to packages/kbn-es-query/src/kuery/functions/exists.ts index b6a9a55d8218dc..7c93b1821abc49 100644 --- a/src/plugins/data/common/es_query/kuery/functions/exists.ts +++ b/packages/kbn-es-query/src/kuery/functions/exists.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ +import { FieldBase, IndexPatternBase, KueryNode } from '../..'; import * as literal from '../node_types/literal'; -import { KueryNode, FieldBase, IndexPatternBase } from '../../..'; export function buildNodeParams(fieldName: string) { return { diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.test.ts b/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.test.ts rename to packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts b/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.ts similarity index 96% rename from src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts rename to packages/kbn-es-query/src/kuery/functions/geo_bounding_box.ts index 79bef10b14f71f..b1fd8680af604e 100644 --- a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts +++ b/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.ts @@ -9,7 +9,7 @@ import _ from 'lodash'; import { nodeTypes } from '../node_types'; import * as ast from '../ast'; -import { IndexPatternBase, KueryNode, LatLon } from '../../..'; +import { IndexPatternBase, KueryNode, LatLon } from '../..'; export function buildNodeParams(fieldName: string, params: any) { params = _.pick(params, 'topLeft', 'bottomRight'); diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_polygon.test.ts b/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/geo_polygon.test.ts rename to packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts b/packages/kbn-es-query/src/kuery/functions/geo_polygon.ts similarity index 96% rename from src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts rename to packages/kbn-es-query/src/kuery/functions/geo_polygon.ts index 2e3280138502a7..d02ba84237c7f5 100644 --- a/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts +++ b/packages/kbn-es-query/src/kuery/functions/geo_polygon.ts @@ -8,7 +8,7 @@ import { nodeTypes } from '../node_types'; import * as ast from '../ast'; -import { IndexPatternBase, KueryNode, LatLon } from '../../..'; +import { IndexPatternBase, KueryNode, LatLon } from '../..'; import { LiteralTypeBuildNode } from '../node_types/types'; export function buildNodeParams(fieldName: string, points: LatLon[]) { diff --git a/src/plugins/data/common/es_query/kuery/functions/index.ts b/packages/kbn-es-query/src/kuery/functions/index.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/index.ts rename to packages/kbn-es-query/src/kuery/functions/index.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/is.test.ts b/packages/kbn-es-query/src/kuery/functions/is.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/is.test.ts rename to packages/kbn-es-query/src/kuery/functions/is.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/is.ts b/packages/kbn-es-query/src/kuery/functions/is.ts similarity index 98% rename from src/plugins/data/common/es_query/kuery/functions/is.ts rename to packages/kbn-es-query/src/kuery/functions/is.ts index 47ae5bb4af0d94..2ed124dc6b9d8f 100644 --- a/src/plugins/data/common/es_query/kuery/functions/is.ts +++ b/packages/kbn-es-query/src/kuery/functions/is.ts @@ -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, FieldBase } from '../..'; import * as ast from '../ast'; diff --git a/src/plugins/data/common/es_query/kuery/functions/nested.test.ts b/packages/kbn-es-query/src/kuery/functions/nested.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/nested.test.ts rename to packages/kbn-es-query/src/kuery/functions/nested.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/nested.ts b/packages/kbn-es-query/src/kuery/functions/nested.ts similarity index 95% rename from src/plugins/data/common/es_query/kuery/functions/nested.ts rename to packages/kbn-es-query/src/kuery/functions/nested.ts index 46ceeaf3e5de66..248de1c40d62a3 100644 --- a/src/plugins/data/common/es_query/kuery/functions/nested.ts +++ b/packages/kbn-es-query/src/kuery/functions/nested.ts @@ -8,7 +8,7 @@ import * as ast from '../ast'; import * as literal from '../node_types/literal'; -import { IndexPatternBase, KueryNode } from '../../..'; +import { IndexPatternBase, KueryNode } from '../..'; export function buildNodeParams(path: any, child: any) { const pathNode = diff --git a/src/plugins/data/common/es_query/kuery/functions/not.test.ts b/packages/kbn-es-query/src/kuery/functions/not.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/not.test.ts rename to packages/kbn-es-query/src/kuery/functions/not.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/not.ts b/packages/kbn-es-query/src/kuery/functions/not.ts similarity index 93% rename from src/plugins/data/common/es_query/kuery/functions/not.ts rename to packages/kbn-es-query/src/kuery/functions/not.ts index f837cd261c8145..96404ee800010c 100644 --- a/src/plugins/data/common/es_query/kuery/functions/not.ts +++ b/packages/kbn-es-query/src/kuery/functions/not.ts @@ -7,7 +7,7 @@ */ import * as ast from '../ast'; -import { IndexPatternBase, KueryNode } from '../../..'; +import { IndexPatternBase, KueryNode } from '../..'; export function buildNodeParams(child: KueryNode) { return { diff --git a/src/plugins/data/common/es_query/kuery/functions/or.test.ts b/packages/kbn-es-query/src/kuery/functions/or.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/or.test.ts rename to packages/kbn-es-query/src/kuery/functions/or.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/or.ts b/packages/kbn-es-query/src/kuery/functions/or.ts similarity index 94% rename from src/plugins/data/common/es_query/kuery/functions/or.ts rename to packages/kbn-es-query/src/kuery/functions/or.ts index 7365cc39595e6b..b94814e1f7c052 100644 --- a/src/plugins/data/common/es_query/kuery/functions/or.ts +++ b/packages/kbn-es-query/src/kuery/functions/or.ts @@ -7,7 +7,7 @@ */ import * as ast from '../ast'; -import { IndexPatternBase, KueryNode } from '../../..'; +import { IndexPatternBase, KueryNode } from '../..'; export function buildNodeParams(children: KueryNode[]) { return { diff --git a/src/plugins/data/common/es_query/kuery/functions/range.test.ts b/packages/kbn-es-query/src/kuery/functions/range.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/range.test.ts rename to packages/kbn-es-query/src/kuery/functions/range.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/range.ts b/packages/kbn-es-query/src/kuery/functions/range.ts similarity index 98% rename from src/plugins/data/common/es_query/kuery/functions/range.ts rename to packages/kbn-es-query/src/kuery/functions/range.ts index b134434dc182b6..e80a365441c43e 100644 --- a/src/plugins/data/common/es_query/kuery/functions/range.ts +++ b/packages/kbn-es-query/src/kuery/functions/range.ts @@ -13,7 +13,7 @@ import { getRangeScript, RangeFilterParams } from '../../filters'; import { getFields } from './utils/get_fields'; import { getTimeZoneFromSettings } from '../../utils'; import { getFullFieldNameNode } from './utils/get_full_field_name_node'; -import { IndexPatternBase, KueryNode } from '../../..'; +import { IndexPatternBase, KueryNode } from '../..'; export function buildNodeParams(fieldName: string, params: RangeFilterParams) { const paramsToMap = _.pick(params, 'gt', 'lt', 'gte', 'lte', 'format'); diff --git a/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.test.ts b/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/utils/get_fields.test.ts rename to packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.ts b/packages/kbn-es-query/src/kuery/functions/utils/get_fields.ts similarity index 94% rename from src/plugins/data/common/es_query/kuery/functions/utils/get_fields.ts rename to packages/kbn-es-query/src/kuery/functions/utils/get_fields.ts index 7dac1262d5062c..db3826d4ef8c42 100644 --- a/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.ts +++ b/packages/kbn-es-query/src/kuery/functions/utils/get_fields.ts @@ -8,7 +8,7 @@ import * as literal from '../../node_types/literal'; import * as wildcard from '../../node_types/wildcard'; -import { KueryNode, IndexPatternBase } from '../../../..'; +import { KueryNode, IndexPatternBase } from '../../..'; import { LiteralTypeBuildNode } from '../../node_types/types'; export function getFields(node: KueryNode, indexPattern?: IndexPatternBase) { diff --git a/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.test.ts b/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.test.ts rename to packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts diff --git a/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts b/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.ts similarity index 99% rename from src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts rename to packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.ts index cfea79696122c6..e509757c646382 100644 --- a/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts +++ b/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.ts @@ -7,7 +7,7 @@ */ import { getFields } from './get_fields'; -import { IndexPatternBase, FieldBase, KueryNode } from '../../../..'; +import { IndexPatternBase, FieldBase, KueryNode } from '../../..'; export function getFullFieldNameNode( rootNameNode: any, diff --git a/src/plugins/data/common/es_query/kuery/index.ts b/packages/kbn-es-query/src/kuery/index.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/index.ts rename to packages/kbn-es-query/src/kuery/index.ts diff --git a/src/plugins/data/common/es_query/kuery/kuery_syntax_error.test.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/kuery_syntax_error.test.ts rename to packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts diff --git a/src/plugins/data/common/es_query/kuery/kuery_syntax_error.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/kuery_syntax_error.ts rename to packages/kbn-es-query/src/kuery/kuery_syntax_error.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/function.test.ts b/packages/kbn-es-query/src/kuery/node_types/function.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/function.test.ts rename to packages/kbn-es-query/src/kuery/node_types/function.test.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/function.ts b/packages/kbn-es-query/src/kuery/node_types/function.ts similarity index 96% rename from src/plugins/data/common/es_query/kuery/node_types/function.ts rename to packages/kbn-es-query/src/kuery/node_types/function.ts index 642089a101f31c..e72f8a6b1e77a1 100644 --- a/src/plugins/data/common/es_query/kuery/node_types/function.ts +++ b/packages/kbn-es-query/src/kuery/node_types/function.ts @@ -9,7 +9,7 @@ import _ from 'lodash'; import { functions } from '../functions'; -import { IndexPatternBase, KueryNode } from '../../..'; +import { IndexPatternBase, KueryNode } from '../..'; import { FunctionName, FunctionTypeBuildNode } from './types'; export function buildNode(functionName: FunctionName, ...args: any[]) { diff --git a/src/plugins/data/common/es_query/kuery/node_types/index.ts b/packages/kbn-es-query/src/kuery/node_types/index.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/index.ts rename to packages/kbn-es-query/src/kuery/node_types/index.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/literal.test.ts b/packages/kbn-es-query/src/kuery/node_types/literal.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/literal.test.ts rename to packages/kbn-es-query/src/kuery/node_types/literal.test.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/literal.ts b/packages/kbn-es-query/src/kuery/node_types/literal.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/literal.ts rename to packages/kbn-es-query/src/kuery/node_types/literal.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/named_arg.test.ts b/packages/kbn-es-query/src/kuery/node_types/named_arg.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/named_arg.test.ts rename to packages/kbn-es-query/src/kuery/node_types/named_arg.test.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/named_arg.ts b/packages/kbn-es-query/src/kuery/node_types/named_arg.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/named_arg.ts rename to packages/kbn-es-query/src/kuery/node_types/named_arg.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/node_builder.test.ts b/packages/kbn-es-query/src/kuery/node_types/node_builder.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/node_builder.test.ts rename to packages/kbn-es-query/src/kuery/node_types/node_builder.test.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/node_builder.ts b/packages/kbn-es-query/src/kuery/node_types/node_builder.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/node_builder.ts rename to packages/kbn-es-query/src/kuery/node_types/node_builder.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/types.ts b/packages/kbn-es-query/src/kuery/node_types/types.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/types.ts rename to packages/kbn-es-query/src/kuery/node_types/types.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/wildcard.test.ts b/packages/kbn-es-query/src/kuery/node_types/wildcard.test.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/wildcard.test.ts rename to packages/kbn-es-query/src/kuery/node_types/wildcard.test.ts diff --git a/src/plugins/data/common/es_query/kuery/node_types/wildcard.ts b/packages/kbn-es-query/src/kuery/node_types/wildcard.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/node_types/wildcard.ts rename to packages/kbn-es-query/src/kuery/node_types/wildcard.ts diff --git a/src/plugins/data/common/es_query/kuery/types.ts b/packages/kbn-es-query/src/kuery/types.ts similarity index 100% rename from src/plugins/data/common/es_query/kuery/types.ts rename to packages/kbn-es-query/src/kuery/types.ts diff --git a/src/plugins/data/common/es_query/utils.ts b/packages/kbn-es-query/src/utils.ts similarity index 100% rename from src/plugins/data/common/es_query/utils.ts rename to packages/kbn-es-query/src/utils.ts diff --git a/packages/kbn-es-query/tsconfig.json b/packages/kbn-es-query/tsconfig.json new file mode 100644 index 00000000000000..72e9767a7b7702 --- /dev/null +++ b/packages/kbn-es-query/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "incremental": true, + "outDir": "target", + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "sourceRoot": "../../../../packages/kbn-es-query/src", + "types": [ + "jest", + "node" + ] + }, + "include": [ + "src/**/*" + ] +} diff --git a/src/plugins/data/common/es_query/es_query/get_es_query_config.test.ts b/src/plugins/data/common/es_query/get_es_query_config.test.ts similarity index 100% rename from src/plugins/data/common/es_query/es_query/get_es_query_config.test.ts rename to src/plugins/data/common/es_query/get_es_query_config.test.ts diff --git a/src/plugins/data/common/es_query/es_query/get_es_query_config.ts b/src/plugins/data/common/es_query/get_es_query_config.ts similarity index 90% rename from src/plugins/data/common/es_query/es_query/get_es_query_config.ts rename to src/plugins/data/common/es_query/get_es_query_config.ts index a074bb2ddc0e34..806aaec89103fe 100644 --- a/src/plugins/data/common/es_query/es_query/get_es_query_config.ts +++ b/src/plugins/data/common/es_query/get_es_query_config.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { EsQueryConfig } from './build_es_query'; -import { GetConfigFn, UI_SETTINGS } from '../../'; +import { EsQueryConfig } from '@kbn/es-query'; +import { GetConfigFn, UI_SETTINGS } from '..'; interface KibanaConfig { get: GetConfigFn; diff --git a/src/plugins/data/common/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index bbba52871d4c8e..1d660f606ecd39 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -6,6 +6,5 @@ * Side Public License, v 1. */ -export * from './es_query'; -export * from './filters'; -export * from './kuery'; +export { getEsQueryConfig } from './get_es_query_config'; +export { Filter, FilterStateStore, FILTERS } from '@kbn/es-query'; diff --git a/src/plugins/data/common/query/types.ts b/src/plugins/data/common/query/types.ts index e4e386afdec778..c1861beb1ed90e 100644 --- a/src/plugins/data/common/query/types.ts +++ b/src/plugins/data/common/query/types.ts @@ -8,8 +8,4 @@ export * from './timefilter/types'; -// eslint-disable-next-line -export type Query = { - query: string | { [key: string]: any }; - language: string; -}; +export { Query } from '@kbn/es-query'; diff --git a/src/plugins/data/common/search/expressions/esdsl.ts b/src/plugins/data/common/search/expressions/esdsl.ts index dee1b19eb33609..a5834001143e48 100644 --- a/src/plugins/data/common/search/expressions/esdsl.ts +++ b/src/plugins/data/common/search/expressions/esdsl.ts @@ -7,12 +7,13 @@ */ import { i18n } from '@kbn/i18n'; +import { buildEsQuery } from '@kbn/es-query'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { EsRawResponse } from './es_raw_response'; import { RequestStatistics, RequestAdapter } from '../../../../inspector/common'; import { ISearchGeneric, KibanaContext } from '..'; -import { buildEsQuery, getEsQueryConfig } from '../../es_query/es_query'; +import { getEsQueryConfig } from '../../es_query'; import { UiSettingsCommon } from '../../index_patterns'; const name = 'esdsl'; diff --git a/src/plugins/data/common/search/expressions/exists_filter.ts b/src/plugins/data/common/search/expressions/exists_filter.ts index 0979328860b4c9..75d83ca7f25926 100644 --- a/src/plugins/data/common/search/expressions/exists_filter.ts +++ b/src/plugins/data/common/search/expressions/exists_filter.ts @@ -8,8 +8,8 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; +import { buildFilter, FILTERS } from '@kbn/es-query'; import { KibanaField, KibanaFilter } from './kibana_context_type'; -import { buildFilter, FILTERS } from '../../es_query/filters'; import { IndexPattern } from '../../index_patterns/index_patterns'; interface Arguments { diff --git a/src/plugins/data/common/search/expressions/filters_to_ast.ts b/src/plugins/data/common/search/expressions/filters_to_ast.ts index edcf884b3ed312..3eb3a11b098572 100644 --- a/src/plugins/data/common/search/expressions/filters_to_ast.ts +++ b/src/plugins/data/common/search/expressions/filters_to_ast.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ +import { Filter } from '@kbn/es-query'; import { buildExpression, buildExpressionFunction } from '../../../../expressions/common'; -import { Filter } from '../../es_query/filters'; import { ExpressionFunctionKibanaFilter } from './kibana_filter'; export const filtersToAst = (filters: Filter[] | Filter) => { diff --git a/src/plugins/data/common/search/expressions/kibana_context.ts b/src/plugins/data/common/search/expressions/kibana_context.ts index 22a7150d4a64e1..9c1c78604ea834 100644 --- a/src/plugins/data/common/search/expressions/kibana_context.ts +++ b/src/plugins/data/common/search/expressions/kibana_context.ts @@ -10,6 +10,7 @@ import { uniqBy } from 'lodash'; import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition, ExecutionContext } from 'src/plugins/expressions/common'; import { Adapters } from 'src/plugins/inspector/common'; +import { Filter } from '@kbn/es-query'; import { unboxExpressionValue } from '../../../../expressions/common'; import { Query, uniqFilters } from '../../query'; import { ExecutionContextSearch, KibanaContext, KibanaFilter } from './kibana_context_type'; @@ -17,7 +18,6 @@ import { KibanaQueryOutput } from './kibana_context_type'; import { KibanaTimerangeOutput } from './timerange'; import { SavedObjectReference } from '../../../../../core/types'; import { SavedObjectsClientCommon } from '../../index_patterns'; -import { Filter } from '../../es_query/filters'; /** @internal */ export interface KibanaContextStartDependencies { diff --git a/src/plugins/data/common/search/expressions/phrase_filter.ts b/src/plugins/data/common/search/expressions/phrase_filter.ts index 0b19e8a1e416d8..837d4be4d52eaa 100644 --- a/src/plugins/data/common/search/expressions/phrase_filter.ts +++ b/src/plugins/data/common/search/expressions/phrase_filter.ts @@ -8,8 +8,8 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; +import { buildFilter, FILTERS } from '@kbn/es-query'; import { KibanaField, KibanaFilter } from './kibana_context_type'; -import { buildFilter, FILTERS } from '../../es_query/filters'; import { IndexPattern } from '../../index_patterns/index_patterns'; interface Arguments { diff --git a/src/plugins/data/common/search/expressions/range_filter.ts b/src/plugins/data/common/search/expressions/range_filter.ts index ed71f5362fe858..ed65475a9d2859 100644 --- a/src/plugins/data/common/search/expressions/range_filter.ts +++ b/src/plugins/data/common/search/expressions/range_filter.ts @@ -8,8 +8,8 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; +import { buildFilter, FILTERS } from '@kbn/es-query'; import { KibanaField, KibanaFilter } from './kibana_context_type'; -import { buildFilter, FILTERS } from '../../es_query/filters'; import { IndexPattern } from '../../index_patterns/index_patterns'; import { KibanaRange } from './range'; diff --git a/src/plugins/data/common/search/search_source/extract_references.ts b/src/plugins/data/common/search/search_source/extract_references.ts index 1b4d1732a5e377..02114a60362a8b 100644 --- a/src/plugins/data/common/search/search_source/extract_references.ts +++ b/src/plugins/data/common/search/search_source/extract_references.ts @@ -7,7 +7,7 @@ */ import { SavedObjectReference } from 'src/core/types'; -import { Filter } from '../../es_query/filters'; +import { Filter } from '@kbn/es-query'; import { SearchSourceFields } from './types'; export const extractReferences = ( diff --git a/src/plugins/data/public/query/state_sync/sync_state_with_url.ts b/src/plugins/data/public/query/state_sync/sync_state_with_url.ts index abb9953b844da4..2f068ccdfab4f5 100644 --- a/src/plugins/data/public/query/state_sync/sync_state_with_url.ts +++ b/src/plugins/data/public/query/state_sync/sync_state_with_url.ts @@ -14,7 +14,7 @@ import { import { QuerySetup, QueryStart } from '../query_service'; import { connectToQueryState } from './connect_to_query_state'; import { QueryState } from './types'; -import { FilterStateStore } from '../../../common/es_query/filters'; +import { FilterStateStore } from '../../../common'; const GLOBAL_STATE_STORAGE_KEY = '_g'; diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts index 218f8f5790e44b..bc3f01aeb3c8f4 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts @@ -7,7 +7,7 @@ */ import { i18n } from '@kbn/i18n'; -import { FILTERS } from '../../../../../common/es_query/filters'; +import { FILTERS } from '@kbn/es-query'; export interface Operator { message: string; diff --git a/yarn.lock b/yarn.lock index 9d7569b6ab4f29..ebf66451c8f93c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2648,6 +2648,10 @@ version "0.0.0" uid "" +"@kbn/es-query@link:bazel-bin/packages/kbn-es-query": + version "0.0.0" + uid "" + "@kbn/es@link:bazel-bin/packages/kbn-es": version "0.0.0" uid "" From 028d7da8d1bd894667616f5300f4a4db231616cc Mon Sep 17 00:00:00 2001 From: Liza K Date: Tue, 29 Jun 2021 10:02:03 +0100 Subject: [PATCH 09/52] rename --- .../kibana-plugin-plugins-data-public.esfilters.md | 8 ++++---- .../kibana-plugin-plugins-data-server.esfilters.md | 8 ++++---- src/plugins/data/common/es_query/es_query/index.ts | 2 +- src/plugins/data/common/es_query/es_query/types.ts | 4 ++-- .../data/common/es_query/filters/build_filters.ts | 6 +++--- .../data/common/es_query/filters/exists_filter.ts | 4 ++-- .../data/common/es_query/filters/phrase_filter.ts | 8 ++++---- .../data/common/es_query/filters/phrases_filter.ts | 4 ++-- .../common/es_query/filters/range_filter.test.ts | 6 +++--- .../data/common/es_query/filters/range_filter.ts | 6 +++--- .../data/common/es_query/kuery/functions/exists.ts | 4 ++-- .../data/common/es_query/kuery/functions/is.ts | 4 ++-- .../functions/utils/get_full_field_name_node.ts | 4 ++-- .../data/common/index_patterns/fields/types.ts | 4 ++-- src/plugins/data/common/index_patterns/types.ts | 4 ++-- src/plugins/data/public/public.api.md | 12 ++++++------ src/plugins/data/server/server.api.md | 12 ++++++------ 17 files changed, 50 insertions(+), 50 deletions(-) diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md index 0cdc1e5c8bcbf0..d06ce1b2ef2bc0 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md @@ -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; diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md index 202c9e4588f8ac..594afcf9ee0ddd 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md @@ -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; } ``` diff --git a/src/plugins/data/common/es_query/es_query/index.ts b/src/plugins/data/common/es_query/es_query/index.ts index efe645f111b6af..ecc7c8ba5a9f5a 100644 --- a/src/plugins/data/common/es_query/es_query/index.ts +++ b/src/plugins/data/common/es_query/es_query/index.ts @@ -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'; diff --git a/src/plugins/data/common/es_query/es_query/types.ts b/src/plugins/data/common/es_query/es_query/types.ts index 29d5b4dad6a617..ef028e1aa9d4a2 100644 --- a/src/plugins/data/common/es_query/es_query/types.ts +++ b/src/plugins/data/common/es_query/es_query/types.ts @@ -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; @@ -29,6 +29,6 @@ export interface FieldBase { } export interface IndexPatternBase { - fields: FieldBase[]; + fields: IndexPatternFieldBase[]; id?: string; } diff --git a/src/plugins/data/common/es_query/filters/build_filters.ts b/src/plugins/data/common/es_query/filters/build_filters.ts index 333bca779af44a..1d8d67b6e937fa 100644 --- a/src/plugins/data/common/es_query/filters/build_filters.ts +++ b/src/plugins/data/common/es_query/filters/build_filters.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { FieldBase, IndexPatternBase } from '../..'; +import { IndexPatternFieldBase, IndexPatternBase } from '../..'; import { Filter, @@ -21,7 +21,7 @@ import { export function buildFilter( indexPattern: IndexPatternBase, - field: FieldBase, + field: IndexPatternFieldBase, type: FILTERS, negate: boolean, disabled: boolean, @@ -61,7 +61,7 @@ export function buildCustomFilter( function buildBaseFilter( indexPattern: IndexPatternBase, - field: FieldBase, + field: IndexPatternFieldBase, type: FILTERS, params: any ): Filter { diff --git a/src/plugins/data/common/es_query/filters/exists_filter.ts b/src/plugins/data/common/es_query/filters/exists_filter.ts index ed499e8ead0dbb..7a09adb7d9ed6f 100644 --- a/src/plugins/data/common/es_query/filters/exists_filter.ts +++ b/src/plugins/data/common/es_query/filters/exists_filter.ts @@ -7,7 +7,7 @@ */ import { Filter, FilterMeta } from './meta_filter'; -import { FieldBase, IndexPatternBase } from '..'; +import { IndexPatternFieldBase, IndexPatternBase } from '..'; export type ExistsFilterMeta = FilterMeta; @@ -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, diff --git a/src/plugins/data/common/es_query/filters/phrase_filter.ts b/src/plugins/data/common/es_query/filters/phrase_filter.ts index 628ae684ff2b90..68ad16cb31d429 100644 --- a/src/plugins/data/common/es_query/filters/phrase_filter.ts +++ b/src/plugins/data/common/es_query/filters/phrase_filter.ts @@ -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?: { @@ -58,7 +58,7 @@ export const getPhraseFilterValue = (filter: PhraseFilter): PhraseFilterValue => }; export const buildPhraseFilter = ( - field: FieldBase, + field: IndexPatternFieldBase, value: any, indexPattern: IndexPatternBase ): PhraseFilter => { @@ -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); @@ -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; diff --git a/src/plugins/data/common/es_query/filters/phrases_filter.ts b/src/plugins/data/common/es_query/filters/phrases_filter.ts index e73f0f4e6a810a..7f7831e1c7978e 100644 --- a/src/plugins/data/common/es_query/filters/phrases_filter.ts +++ b/src/plugins/data/common/es_query/filters/phrases_filter.ts @@ -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 @@ -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 ) => { diff --git a/src/plugins/data/common/es_query/filters/range_filter.test.ts b/src/plugins/data/common/es_query/filters/range_filter.test.ts index 613f987a768008..30e52b21d52b75 100644 --- a/src/plugins/data/common/es_query/filters/range_filter.test.ts +++ b/src/plugins/data/common/es_query/filters/range_filter.test.ts @@ -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; @@ -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(() => { @@ -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(() => { diff --git a/src/plugins/data/common/es_query/filters/range_filter.ts b/src/plugins/data/common/es_query/filters/range_filter.ts index f87f9d0f846f26..e44e23f64936e1 100644 --- a/src/plugins/data/common/es_query/filters/range_filter.ts +++ b/src/plugins/data/common/es_query/filters/range_filter.ts @@ -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; @@ -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 @@ -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) diff --git a/src/plugins/data/common/es_query/kuery/functions/exists.ts b/src/plugins/data/common/es_query/kuery/functions/exists.ts index b6a9a55d8218dc..4df566d874d8b5 100644 --- a/src/plugins/data/common/es_query/kuery/functions/exists.ts +++ b/src/plugins/data/common/es_query/kuery/functions/exists.ts @@ -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 { @@ -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`); diff --git a/src/plugins/data/common/es_query/kuery/functions/is.ts b/src/plugins/data/common/es_query/kuery/functions/is.ts index 47ae5bb4af0d94..381913670c26aa 100644 --- a/src/plugins/data/common/es_query/kuery/functions/is.ts +++ b/src/plugins/data/common/es_query/kuery/functions/is.ts @@ -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'; @@ -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. diff --git a/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts b/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts index cfea79696122c6..2a31ebeee2fab7 100644 --- a/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts +++ b/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts @@ -7,7 +7,7 @@ */ import { getFields } from './get_fields'; -import { IndexPatternBase, FieldBase, KueryNode } from '../../../..'; +import { IndexPatternBase, IndexPatternFieldBase, KueryNode } from '../../../..'; export function getFullFieldNameNode( rootNameNode: any, @@ -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; diff --git a/src/plugins/data/common/index_patterns/fields/types.ts b/src/plugins/data/common/index_patterns/fields/types.ts index 608294b04dc910..3b2e25d3d80a6c 100644 --- a/src/plugins/data/common/index_patterns/fields/types.ts +++ b/src/plugins/data/common/index_patterns/fields/types.ts @@ -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. diff --git a/src/plugins/data/common/index_patterns/types.ts b/src/plugins/data/common/index_patterns/types.ts index 6a9decdaa9375a..b03e745df74a6a 100644 --- a/src/plugins/data/common/index_patterns/types.ts +++ b/src/plugins/data/common/index_patterns/types.ts @@ -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'; @@ -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 */ diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index dc04854168bee6..33561e68f335dd 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -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; @@ -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) diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index c38dbdab17f902..52c127eb65003e 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -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; }; @@ -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) From d210ddb7f5ecd407fe60837bd8994869da54d78b Mon Sep 17 00:00:00 2001 From: Liza K Date: Tue, 29 Jun 2021 14:10:43 +0100 Subject: [PATCH 10/52] docs --- .../kibana-plugin-plugins-data-public.ifieldtype.md | 2 +- ...data-public.indexpattern.getaggregationrestrictions.md | 8 ++++++-- .../kibana-plugin-plugins-data-server.ifieldtype.md | 2 +- ...data-server.indexpattern.getaggregationrestrictions.md | 8 ++++++-- src/plugins/data/public/public.api.md | 4 +++- src/plugins/data/server/server.api.md | 4 +++- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md index 55df5c3367748d..e1acea53ea5e01 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md @@ -12,7 +12,7 @@ Signature: ```typescript -export interface IFieldType extends FieldBase +export interface IFieldType extends IndexPatternFieldBase ``` ## Properties diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md index e42980bb53af48..1bbe0b594ecf01 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md @@ -9,7 +9,9 @@ ```typescript getAggregationRestrictions(): RecordSignature: ```typescript -export interface IFieldType extends FieldBase +export interface IFieldType extends IndexPatternFieldBase ``` ## Properties diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getaggregationrestrictions.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getaggregationrestrictions.md index b655e779e4fa4d..70a3da86e9fbd3 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getaggregationrestrictions.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getaggregationrestrictions.md @@ -9,7 +9,9 @@ ```typescript getAggregationRestrictions(): Record Date: Wed, 30 Jun 2021 10:00:02 +0100 Subject: [PATCH 11/52] bunch of imports --- packages/kbn-es-query/src/filters/index.ts | 2 +- packages/kbn-es-query/src/filters/types.ts | 6 -- .../common/es_query/get_es_query_config.ts | 4 +- .../common/index_patterns/fields/types.ts | 3 +- .../data/common/index_patterns/types.ts | 2 +- .../query/filter_manager/compare_filters.ts | 2 +- .../data/common/query/timefilter/get_time.ts | 3 +- .../data/common/search/aggs/agg_configs.ts | 3 +- .../buckets/_terms_other_bucket_helper.ts | 2 +- .../buckets/create_filter/date_histogram.ts | 2 +- .../aggs/buckets/create_filter/date_range.ts | 2 +- .../aggs/buckets/create_filter/filters.ts | 2 +- .../aggs/buckets/create_filter/histogram.ts | 2 +- .../aggs/buckets/create_filter/ip_range.ts | 2 +- .../aggs/buckets/create_filter/range.ts | 2 +- .../aggs/buckets/create_filter/terms.ts | 7 +- .../data/common/search/aggs/buckets/filter.ts | 4 +- .../common/search/aggs/buckets/filters.ts | 3 +- .../search/search_source/search_source.ts | 3 +- .../data/common/search/tabify/types.ts | 2 +- src/plugins/data/common/types.ts | 6 ++ .../data/public/actions/value_click_action.ts | 2 +- .../providers/kql_query_suggestion/types.ts | 2 +- .../providers/value_suggestion_provider.ts | 3 +- src/plugins/data/public/index.ts | 69 +++++++++---------- .../query/filter_manager/filter_manager.ts | 3 +- .../filter_manager/lib/generate_filters.ts | 6 +- .../filter_manager/lib/mappers/map_default.ts | 2 +- .../filter_manager/lib/mappers/map_exists.ts | 2 +- .../lib/mappers/map_geo_bounding_box.ts | 10 +-- .../lib/mappers/map_geo_polygon.ts | 10 +-- .../lib/mappers/map_match_all.ts | 2 +- .../filter_manager/lib/mappers/map_missing.ts | 2 +- .../filter_manager/lib/mappers/map_phrase.ts | 5 +- .../filter_manager/lib/mappers/map_phrases.ts | 4 +- .../lib/mappers/map_query_string.ts | 2 +- .../filter_manager/lib/mappers/map_range.ts | 11 +-- .../lib/mappers/map_spatial_filter.ts | 2 +- .../data/public/query/query_service.ts | 3 +- .../create_global_query_observable.ts | 3 +- .../timefilter/lib/change_time_filter.ts | 3 +- .../timefilter/lib/extract_time_filter.ts | 3 +- .../data/public/ui/filter_bar/filter_bar.tsx | 23 ++++--- .../ui/filter_bar/filter_editor/index.tsx | 16 ++--- .../filter_editor/lib/filter_editor_utils.ts | 10 +-- .../data/public/ui/filter_bar/filter_item.tsx | 14 ++-- .../ui/filter_bar/filter_view/index.tsx | 2 +- src/plugins/data/server/index.ts | 26 +++---- .../annotations/build_request_body.ts | 2 +- .../vis_type_timeseries/server/types.ts | 7 +- .../alerting_authorization_kuery.ts | 3 +- .../indexpattern_datasource/datapanel.tsx | 3 +- .../server/services/utils/get_query_filter.ts | 2 +- .../spatial_filter_utils.ts | 2 +- .../detection_engine/get_query_filter.ts | 10 +-- .../timelines/components/timeline/helpers.tsx | 8 +-- .../public/components/t_grid/helpers.tsx | 8 +-- .../public/components/utils/keury/index.ts | 10 +-- 58 files changed, 157 insertions(+), 202 deletions(-) diff --git a/packages/kbn-es-query/src/filters/index.ts b/packages/kbn-es-query/src/filters/index.ts index 9fcb226f0ffb2b..90c1675e8a3cfc 100644 --- a/packages/kbn-es-query/src/filters/index.ts +++ b/packages/kbn-es-query/src/filters/index.ts @@ -24,7 +24,7 @@ export * from './phrases_filter'; export * from './query_string_filter'; export * from './range_filter'; -export { Query, Filter, FILTERS, LatLon, FilterStateStore } from './types'; +export { Query, Filter, FILTERS, LatLon, FilterStateStore, FieldFilter, FilterMeta } from './types'; /** * Clean out any invalid attributes from the filters diff --git a/packages/kbn-es-query/src/filters/types.ts b/packages/kbn-es-query/src/filters/types.ts index 2a6ae940adf6c1..13e4a941b9166a 100644 --- a/packages/kbn-es-query/src/filters/types.ts +++ b/packages/kbn-es-query/src/filters/types.ts @@ -51,12 +51,6 @@ export type FilterState = { store: FilterStateStore; }; -type FilterFormatterFunction = (value: any) => string; -export interface FilterValueFormatter { - convert: FilterFormatterFunction; - getConverterFor: (type: string) => FilterFormatterFunction; -} - // eslint-disable-next-line export type FilterMeta = { alias: string | null; diff --git a/src/plugins/data/common/es_query/get_es_query_config.ts b/src/plugins/data/common/es_query/get_es_query_config.ts index 806aaec89103fe..e3d39df75255cd 100644 --- a/src/plugins/data/common/es_query/get_es_query_config.ts +++ b/src/plugins/data/common/es_query/get_es_query_config.ts @@ -13,7 +13,7 @@ interface KibanaConfig { get: GetConfigFn; } -export function getEsQueryConfig(config: KibanaConfig) { +export function getEsQueryConfig(config: KibanaConfig): EsQueryConfig { const allowLeadingWildcards = config.get(UI_SETTINGS.QUERY_ALLOW_LEADING_WILDCARDS); const queryStringOptions = config.get(UI_SETTINGS.QUERY_STRING_OPTIONS); const ignoreFilterIfFieldNotInIndex = config.get( @@ -26,5 +26,5 @@ export function getEsQueryConfig(config: KibanaConfig) { queryStringOptions, ignoreFilterIfFieldNotInIndex, dateFormatTZ, - } as EsQueryConfig; + }; } diff --git a/src/plugins/data/common/index_patterns/fields/types.ts b/src/plugins/data/common/index_patterns/fields/types.ts index 3b2e25d3d80a6c..38258dd4f53f40 100644 --- a/src/plugins/data/common/index_patterns/fields/types.ts +++ b/src/plugins/data/common/index_patterns/fields/types.ts @@ -5,7 +5,8 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import { IndexPatternFieldBase, FieldSpec, IndexPattern } from '../..'; +import { IndexPatternFieldBase } from '@kbn/es-query'; +import { FieldSpec, IndexPattern } from '../..'; /** * @deprecated diff --git a/src/plugins/data/common/index_patterns/types.ts b/src/plugins/data/common/index_patterns/types.ts index b03e745df74a6a..5ed1048a691e57 100644 --- a/src/plugins/data/common/index_patterns/types.ts +++ b/src/plugins/data/common/index_patterns/types.ts @@ -6,10 +6,10 @@ * Side Public License, v 1. */ import type { estypes } from '@elastic/elasticsearch'; +import type { IndexPatternFieldBase, IFieldSubType, IndexPatternBase } from '@kbn/es-query'; import { ToastInputFields, ErrorToastOptions } from 'src/core/public/notifications'; // eslint-disable-next-line import type { SavedObject } from 'src/core/server'; -import type { IndexPatternFieldBase, IFieldSubType, IndexPatternBase } from '../es_query'; import { IFieldType } from './fields'; import { RUNTIME_FIELD_TYPES } from './constants'; import { SerializedFieldFormat } from '../../../expressions/common'; diff --git a/src/plugins/data/common/query/filter_manager/compare_filters.ts b/src/plugins/data/common/query/filter_manager/compare_filters.ts index a6190adc1ba655..fc820779b24614 100644 --- a/src/plugins/data/common/query/filter_manager/compare_filters.ts +++ b/src/plugins/data/common/query/filter_manager/compare_filters.ts @@ -7,7 +7,7 @@ */ import { defaults, isEqual, omit, map } from 'lodash'; -import { FilterMeta, Filter } from '../../es_query'; +import { FilterMeta, Filter } from '@kbn/es-query'; export interface FilterCompareOptions { index?: boolean; diff --git a/src/plugins/data/common/query/timefilter/get_time.ts b/src/plugins/data/common/query/timefilter/get_time.ts index 58194fc72dfcf0..64842be20fbad8 100644 --- a/src/plugins/data/common/query/timefilter/get_time.ts +++ b/src/plugins/data/common/query/timefilter/get_time.ts @@ -7,7 +7,8 @@ */ import dateMath from '@elastic/datemath'; -import { buildRangeFilter, IIndexPattern, TimeRange, TimeRangeBounds } from '../..'; +import { buildRangeFilter } from '@kbn/es-query'; +import { IIndexPattern, TimeRange, TimeRangeBounds } from '../..'; interface CalculateBoundsOptions { forceNow?: Date; diff --git a/src/plugins/data/common/search/aggs/agg_configs.ts b/src/plugins/data/common/search/aggs/agg_configs.ts index c205b46e077f03..c80becd271bba9 100644 --- a/src/plugins/data/common/search/aggs/agg_configs.ts +++ b/src/plugins/data/common/search/aggs/agg_configs.ts @@ -10,6 +10,7 @@ import moment from 'moment'; import _, { cloneDeep } from 'lodash'; import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; +import { isRangeFilter } from '@kbn/es-query'; import type { estypes } from '@elastic/elasticsearch'; import { @@ -23,7 +24,7 @@ import { IAggType } from './agg_type'; import { AggTypesRegistryStart } from './agg_types_registry'; import { AggGroupNames } from './agg_groups'; import { IndexPattern } from '../../index_patterns/index_patterns/index_pattern'; -import { TimeRange, getTime, isRangeFilter, calculateBounds } from '../../../common'; +import { TimeRange, getTime, calculateBounds } from '../../../common'; import { IBucketAggConfig } from './buckets'; import { insertTimeShiftSplit, mergeTimeShifts } from './utils/time_splits'; diff --git a/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.ts b/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.ts index 2a1cd873f62822..39fba23a42210e 100644 --- a/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.ts +++ b/src/plugins/data/common/search/aggs/buckets/_terms_other_bucket_helper.ts @@ -8,7 +8,7 @@ import { isNumber, keys, values, find, each, cloneDeep, flatten } from 'lodash'; import { estypes } from '@elastic/elasticsearch'; -import { buildExistsFilter, buildPhrasesFilter, buildQueryFromFilters } from '../../../../common'; +import { buildExistsFilter, buildPhrasesFilter, buildQueryFromFilters } from '@kbn/es-query'; import { AggGroupNames } from '../agg_groups'; import { IAggConfigs } from '../agg_configs'; import { IBucketAggConfig } from './bucket_agg_type'; diff --git a/src/plugins/data/common/search/aggs/buckets/create_filter/date_histogram.ts b/src/plugins/data/common/search/aggs/buckets/create_filter/date_histogram.ts index 2c0f35d28e989a..1fd2250ec9e8b6 100644 --- a/src/plugins/data/common/search/aggs/buckets/create_filter/date_histogram.ts +++ b/src/plugins/data/common/search/aggs/buckets/create_filter/date_histogram.ts @@ -7,8 +7,8 @@ */ import moment from 'moment'; +import { buildRangeFilter } from '@kbn/es-query'; import { IBucketDateHistogramAggConfig } from '../date_histogram'; -import { buildRangeFilter } from '../../../../../common'; export const createFilterDateHistogram = ( agg: IBucketDateHistogramAggConfig, diff --git a/src/plugins/data/common/search/aggs/buckets/create_filter/date_range.ts b/src/plugins/data/common/search/aggs/buckets/create_filter/date_range.ts index 5ba80d35e2cb37..1231637771e32a 100644 --- a/src/plugins/data/common/search/aggs/buckets/create_filter/date_range.ts +++ b/src/plugins/data/common/search/aggs/buckets/create_filter/date_range.ts @@ -7,9 +7,9 @@ */ import moment from 'moment'; +import { buildRangeFilter, RangeFilterParams } from '@kbn/es-query'; import { IBucketAggConfig } from '../bucket_agg_type'; import { DateRangeKey } from '../lib/date_range'; -import { buildRangeFilter, RangeFilterParams } from '../../../../../common'; export const createFilterDateRange = (agg: IBucketAggConfig, { from, to }: DateRangeKey) => { const filter: RangeFilterParams = {}; diff --git a/src/plugins/data/common/search/aggs/buckets/create_filter/filters.ts b/src/plugins/data/common/search/aggs/buckets/create_filter/filters.ts index 948dac1d23b5b8..a265584cf3765f 100644 --- a/src/plugins/data/common/search/aggs/buckets/create_filter/filters.ts +++ b/src/plugins/data/common/search/aggs/buckets/create_filter/filters.ts @@ -7,8 +7,8 @@ */ import { get } from 'lodash'; +import { buildQueryFilter } from '@kbn/es-query'; import { IBucketAggConfig } from '../bucket_agg_type'; -import { buildQueryFilter } from '../../../../../common'; export const createFilterFilters = (aggConfig: IBucketAggConfig, key: string) => { // have the aggConfig write agg dsl params diff --git a/src/plugins/data/common/search/aggs/buckets/create_filter/histogram.ts b/src/plugins/data/common/search/aggs/buckets/create_filter/histogram.ts index d104c8f5c57f55..d5c98dc51562c8 100644 --- a/src/plugins/data/common/search/aggs/buckets/create_filter/histogram.ts +++ b/src/plugins/data/common/search/aggs/buckets/create_filter/histogram.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { buildRangeFilter, RangeFilterParams } from '../../../../../common'; +import { buildRangeFilter, RangeFilterParams } from '@kbn/es-query'; import { AggTypesDependencies } from '../../agg_types'; import { IBucketAggConfig } from '../bucket_agg_type'; diff --git a/src/plugins/data/common/search/aggs/buckets/create_filter/ip_range.ts b/src/plugins/data/common/search/aggs/buckets/create_filter/ip_range.ts index 374c2fdbcf705b..bd16b0210a856c 100644 --- a/src/plugins/data/common/search/aggs/buckets/create_filter/ip_range.ts +++ b/src/plugins/data/common/search/aggs/buckets/create_filter/ip_range.ts @@ -6,10 +6,10 @@ * Side Public License, v 1. */ +import { buildRangeFilter, RangeFilterParams } from '@kbn/es-query'; import { CidrMask } from '../lib/cidr_mask'; import { IBucketAggConfig } from '../bucket_agg_type'; import { IpRangeKey } from '../lib/ip_range'; -import { buildRangeFilter, RangeFilterParams } from '../../../../../common'; export const createFilterIpRange = (aggConfig: IBucketAggConfig, key: IpRangeKey) => { let range: RangeFilterParams; diff --git a/src/plugins/data/common/search/aggs/buckets/create_filter/range.ts b/src/plugins/data/common/search/aggs/buckets/create_filter/range.ts index 4c2f929aa0675a..258f10f2fd15a0 100644 --- a/src/plugins/data/common/search/aggs/buckets/create_filter/range.ts +++ b/src/plugins/data/common/search/aggs/buckets/create_filter/range.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { buildRangeFilter } from '../../../../../common'; +import { buildRangeFilter } from '@kbn/es-query'; import { AggTypesDependencies } from '../../agg_types'; import { IBucketAggConfig } from '../bucket_agg_type'; diff --git a/src/plugins/data/common/search/aggs/buckets/create_filter/terms.ts b/src/plugins/data/common/search/aggs/buckets/create_filter/terms.ts index 935b52dc55708b..25aa3f334e4b8d 100644 --- a/src/plugins/data/common/search/aggs/buckets/create_filter/terms.ts +++ b/src/plugins/data/common/search/aggs/buckets/create_filter/terms.ts @@ -6,13 +6,8 @@ * Side Public License, v 1. */ +import { buildPhrasesFilter, buildExistsFilter, buildPhraseFilter, Filter } from '@kbn/es-query'; import { IBucketAggConfig } from '../bucket_agg_type'; -import { - buildPhrasesFilter, - buildExistsFilter, - buildPhraseFilter, - Filter, -} from '../../../../../common'; export const createFilterTerms = (aggConfig: IBucketAggConfig, key: string, params: any) => { const field = aggConfig.params.field; diff --git a/src/plugins/data/common/search/aggs/buckets/filter.ts b/src/plugins/data/common/search/aggs/buckets/filter.ts index 900848bb9517f7..2f04e71d0af871 100644 --- a/src/plugins/data/common/search/aggs/buckets/filter.ts +++ b/src/plugins/data/common/search/aggs/buckets/filter.ts @@ -8,13 +8,13 @@ import { cloneDeep } from 'lodash'; import { i18n } from '@kbn/i18n'; +import { buildEsQuery, Query } from '@kbn/es-query'; import { BucketAggType } from './bucket_agg_type'; import { BUCKET_TYPES } from './bucket_agg_types'; import { GeoBoundingBox } from './lib/geo_point'; import { aggFilterFnName } from './filter_fn'; import { BaseAggParams } from '../types'; -import { Query } from '../../../types'; -import { buildEsQuery, getEsQueryConfig } from '../../../es_query'; +import { getEsQueryConfig } from '../../../es_query'; const filterTitle = i18n.translate('data.search.aggs.buckets.filterTitle', { defaultMessage: 'Filter', diff --git a/src/plugins/data/common/search/aggs/buckets/filters.ts b/src/plugins/data/common/search/aggs/buckets/filters.ts index 107b86de040587..c2bb7a6d7c81f7 100644 --- a/src/plugins/data/common/search/aggs/buckets/filters.ts +++ b/src/plugins/data/common/search/aggs/buckets/filters.ts @@ -8,13 +8,14 @@ import { i18n } from '@kbn/i18n'; import { size, transform, cloneDeep } from 'lodash'; +import { buildEsQuery, Query } from '@kbn/es-query'; import { createFilterFilters } from './create_filter/filters'; import { toAngularJSON } from '../utils'; import { BucketAggType } from './bucket_agg_type'; import { BUCKET_TYPES } from './bucket_agg_types'; import { aggFiltersFnName } from './filters_fn'; -import { getEsQueryConfig, buildEsQuery, Query, UI_SETTINGS } from '../../../../common'; +import { getEsQueryConfig, UI_SETTINGS } from '../../../../common'; import { BaseAggParams } from '../types'; const filtersTitle = i18n.translate('data.search.aggs.buckets.filtersTitle', { diff --git a/src/plugins/data/common/search/search_source/search_source.ts b/src/plugins/data/common/search/search_source/search_source.ts index 19e80c7a487dcb..70b29d4afc6873 100644 --- a/src/plugins/data/common/search/search_source/search_source.ts +++ b/src/plugins/data/common/search/search_source/search_source.ts @@ -72,6 +72,7 @@ import { } from 'rxjs/operators'; import { defer, EMPTY, from, Observable } from 'rxjs'; import { estypes } from '@elastic/elasticsearch'; +import { buildEsQuery, Filter } from '@kbn/es-query'; import { normalizeSortRequest } from './normalize_sort_request'; import { fieldWildcardFilter } from '../../../../kibana_utils/common'; import { IIndexPattern, IndexPattern, IndexPatternField } from '../../index_patterns'; @@ -93,8 +94,6 @@ import { getRequestInspectorStats, getResponseInspectorStats } from './inspect'; import { getEsQueryConfig, - buildEsQuery, - Filter, UI_SETTINGS, isErrorResponse, isPartialResponse, diff --git a/src/plugins/data/common/search/tabify/types.ts b/src/plugins/data/common/search/tabify/types.ts index c170b13774932a..758a2dfb181f29 100644 --- a/src/plugins/data/common/search/tabify/types.ts +++ b/src/plugins/data/common/search/tabify/types.ts @@ -7,7 +7,7 @@ */ import { Moment } from 'moment'; -import { RangeFilterParams } from '../../../common'; +import { RangeFilterParams } from '@kbn/es-query'; import { IAggConfig } from '../aggs'; /** @internal **/ diff --git a/src/plugins/data/common/types.ts b/src/plugins/data/common/types.ts index 8072928a1b6709..7f6ae4a346bd00 100644 --- a/src/plugins/data/common/types.ts +++ b/src/plugins/data/common/types.ts @@ -21,3 +21,9 @@ export * from './index_patterns/types'; * not possible. */ export type GetConfigFn = (key: string, defaultOverride?: T) => T; + +type FilterFormatterFunction = (value: any) => string; +export interface FilterValueFormatter { + convert: FilterFormatterFunction; + getConverterFor: (type: string) => FilterFormatterFunction; +} diff --git a/src/plugins/data/public/actions/value_click_action.ts b/src/plugins/data/public/actions/value_click_action.ts index 9644a96a687524..eb8e991cb8891b 100644 --- a/src/plugins/data/public/actions/value_click_action.ts +++ b/src/plugins/data/public/actions/value_click_action.ts @@ -6,11 +6,11 @@ * Side Public License, v 1. */ +import type { Filter } from '@kbn/es-query'; import { Datatable } from 'src/plugins/expressions/public'; import { Action, createAction, UiActionsStart } from '../../../../plugins/ui_actions/public'; import { APPLY_FILTER_TRIGGER } from '../triggers'; import { createFiltersFromValueClickAction } from './filters/create_filters_from_value_click'; -import type { Filter } from '../../common/es_query/filters'; export type ValueClickActionContext = ValueClickContext; export const ACTION_VALUE_CLICK = 'ACTION_VALUE_CLICK'; diff --git a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/types.ts b/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/types.ts index 48e87a73f36719..12a0dae97ebaa0 100644 --- a/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/types.ts +++ b/src/plugins/data/public/autocomplete/providers/kql_query_suggestion/types.ts @@ -6,10 +6,10 @@ * Side Public License, v 1. */ +import { KueryNode } from '@kbn/es-query'; import { CoreSetup } from 'kibana/public'; import { DataPublicPluginStart, - KueryNode, QuerySuggestionBasic, QuerySuggestionGetFnArgs, } from '../../../../../../../src/plugins/data/public'; diff --git a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts index 3dda97566da5ad..8c32cf47f65660 100644 --- a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts +++ b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts @@ -9,7 +9,8 @@ import dateMath from '@elastic/datemath'; import { memoize } from 'lodash'; import { CoreSetup } from 'src/core/public'; -import { IIndexPattern, IFieldType, UI_SETTINGS, buildQueryFromFilters } from '../../../common'; +import { buildQueryFromFilters } from '@kbn/es-query'; +import { IIndexPattern, IFieldType, UI_SETTINGS } from '../../../common'; import { TimefilterSetup } from '../../query'; import { AutocompleteUsageCollector } from '../collectors'; diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index e9e50ebfaf138c..4b034efc165a09 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -6,23 +6,7 @@ * Side Public License, v 1. */ -import { PluginInitializerContext } from '../../../core/public'; -import { ConfigSchema } from '../config'; - -/* - * Filters: - */ - import { - buildEmptyFilter, - buildExistsFilter, - buildPhraseFilter, - buildPhrasesFilter, - buildQueryFilter, - buildRangeFilter, - disableFilter, - FILTERS, - FilterStateStore, getPhraseFilterField, getPhraseFilterValue, isExistsFilter, @@ -34,9 +18,33 @@ import { isQueryStringFilter, isRangeFilter, toggleFilterNegated, - compareFilters, - COMPARE_ALL_OPTIONS, -} from '../common'; + buildEmptyFilter, + buildExistsFilter, + buildPhraseFilter, + buildPhrasesFilter, + buildQueryFilter, + buildRangeFilter, + disableFilter, + fromKueryExpression, + toElasticsearchQuery, + nodeTypes, + buildEsQuery, + buildQueryFromFilters, + luceneStringToDsl, + decorateQuery, +} from '@kbn/es-query'; +/* + * esQuery and esKuery: + */ + +import { PluginInitializerContext } from '../../../core/public'; +import { ConfigSchema } from '../config'; + +/* + * Filters: + */ + +import { FILTERS, FilterStateStore, compareFilters, COMPARE_ALL_OPTIONS } from '../common'; import { FilterLabel } from './ui'; import { FilterItem } from './ui/filter_bar'; @@ -103,22 +111,10 @@ export type { PhraseFilter, CustomFilter, MatchAllFilter, -} from '../common'; - -/* - * esQuery and esKuery: - */ + IFieldSubType, +} from '@kbn/es-query'; -import { - fromKueryExpression, - toElasticsearchQuery, - nodeTypes, - buildEsQuery, - getEsQueryConfig, - buildQueryFromFilters, - luceneStringToDsl, - decorateQuery, -} from '../common'; +import { getEsQueryConfig } from '../common'; export const esKuery = { nodeTypes, @@ -134,8 +130,6 @@ export const esQuery = { decorateQuery, }; -export { EsQueryConfig, KueryNode } from '../common'; - /* * Field Formatters: */ @@ -258,7 +252,6 @@ export { export { IIndexPattern, IFieldType, - IFieldSubType, ES_FIELD_TYPES, KBN_FIELD_TYPES, IndexPatternAttributes, @@ -486,7 +479,7 @@ export { getKbnTypeNames, } from '../common'; -export { isTimeRange, isQuery, isFilter, isFilters } from '../common'; +export { isTimeRange, isQuery } from '../common'; export { ACTION_GLOBAL_APPLY_FILTER, ApplyGlobalFilterActionContext } from './actions'; export { APPLY_FILTER_TRIGGER } from './triggers'; diff --git a/src/plugins/data/public/query/filter_manager/filter_manager.ts b/src/plugins/data/public/query/filter_manager/filter_manager.ts index d4f312ba81a3b1..36610c51cddc45 100644 --- a/src/plugins/data/public/query/filter_manager/filter_manager.ts +++ b/src/plugins/data/public/query/filter_manager/filter_manager.ts @@ -11,6 +11,7 @@ import { Subject } from 'rxjs'; import { IUiSettingsClient } from 'src/core/public'; +import { isFilterPinned, Filter } from '@kbn/es-query'; import { sortFilters } from './lib/sort_filters'; import { mapAndFlattenFilters } from './lib/map_and_flatten_filters'; import { onlyDisabledFiltersChanged } from './lib/only_disabled'; @@ -18,9 +19,7 @@ import { PartitionedFilters } from './types'; import { FilterStateStore, - Filter, uniqFilters, - isFilterPinned, compareFilters, COMPARE_ALL_OPTIONS, UI_SETTINGS, diff --git a/src/plugins/data/public/query/filter_manager/lib/generate_filters.ts b/src/plugins/data/public/query/filter_manager/lib/generate_filters.ts index 0a4998a1595230..566b26b0698dd2 100644 --- a/src/plugins/data/public/query/filter_manager/lib/generate_filters.ts +++ b/src/plugins/data/public/query/filter_manager/lib/generate_filters.ts @@ -8,8 +8,6 @@ import _ from 'lodash'; import { - IFieldType, - IIndexPattern, Filter, isExistsFilter, isPhraseFilter, @@ -19,7 +17,9 @@ import { buildFilter, FilterStateStore, FILTERS, -} from '../../../../common'; +} from '@kbn/es-query'; + +import { IFieldType, IIndexPattern } from '../../../../common'; import { FilterManager } from '../filter_manager'; function getExistingFilter( diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_default.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_default.ts index f4abd65385da25..c30965e777c461 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_default.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_default.ts @@ -7,7 +7,7 @@ */ import { find, keys, get } from 'lodash'; -import { Filter, FILTERS } from '../../../../../common'; +import { Filter, FILTERS } from '@kbn/es-query'; export const mapDefault = (filter: Filter) => { const metaProperty = /(^\$|meta)/; diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_exists.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_exists.ts index b40701726d52d4..19ebc66ae2d462 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_exists.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_exists.ts @@ -7,7 +7,7 @@ */ import { get } from 'lodash'; -import { Filter, isExistsFilter, FILTERS } from '../../../../../common'; +import { Filter, isExistsFilter, FILTERS } from '@kbn/es-query'; export const mapExists = (filter: Filter) => { if (isExistsFilter(filter)) { diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.ts index d1e2a649c400f2..dfa8e862e1b4c4 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.ts @@ -6,13 +6,9 @@ * Side Public License, v 1. */ -import { - FilterValueFormatter, - GeoBoundingBoxFilter, - FILTERS, - isGeoBoundingBoxFilter, - Filter, -} from '../../../../../common'; +import { GeoBoundingBoxFilter, FILTERS, isGeoBoundingBoxFilter, Filter } from '@kbn/es-query'; + +import { FilterValueFormatter } from '../../../../../common'; const getFormattedValueFn = (params: any) => { return (formatter?: FilterValueFormatter) => { diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.ts index 7bcedd9a7f9514..e1c21aae64da66 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.ts @@ -6,13 +6,9 @@ * Side Public License, v 1. */ -import { - FilterValueFormatter, - GeoPolygonFilter, - FILTERS, - Filter, - isGeoPolygonFilter, -} from '../../../../../common'; +import { GeoPolygonFilter, FILTERS, Filter, isGeoPolygonFilter } from '@kbn/es-query'; + +import { FilterValueFormatter } from '../../../../../common'; const POINTS_SEPARATOR = ', '; diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_match_all.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_match_all.ts index a3c9086676f66b..32231492b2f22b 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_match_all.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_match_all.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter, isMatchAllFilter, FILTERS } from '../../../../../common'; +import { Filter, isMatchAllFilter, FILTERS } from '@kbn/es-query'; export const mapMatchAll = (filter: Filter) => { if (isMatchAllFilter(filter)) { diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_missing.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_missing.ts index b14fe4fb9da0fd..41af3760a652e8 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_missing.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_missing.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter, isMissingFilter, FILTERS } from '../../../../../common'; +import { Filter, isMissingFilter, FILTERS } from '@kbn/es-query'; export const mapMissing = (filter: Filter) => { if (isMissingFilter(filter)) { diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrase.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrase.ts index d8eb14ec5a67cd..64576d4978c99f 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrase.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrase.ts @@ -9,14 +9,15 @@ import { get } from 'lodash'; import { PhraseFilter, - FilterValueFormatter, getPhraseFilterValue, getPhraseFilterField, FILTERS, isScriptedPhraseFilter, Filter, isPhraseFilter, -} from '../../../../../common'; +} from '@kbn/es-query'; + +import { FilterValueFormatter } from '../../../../../common'; const getScriptedPhraseValue = (filter: PhraseFilter) => get(filter, ['script', 'script', 'params', 'value']); diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrases.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrases.ts index 5601dd66e52066..9ffdd3070e43a5 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrases.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrases.ts @@ -6,7 +6,9 @@ * Side Public License, v 1. */ -import { Filter, FilterValueFormatter, isPhrasesFilter } from '../../../../../common'; +import { Filter, isPhrasesFilter } from '@kbn/es-query'; + +import { FilterValueFormatter } from '../../../../../common'; const getFormattedValueFn = (params: any) => { return (formatter?: FilterValueFormatter) => { diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_query_string.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_query_string.ts index 9c11f74b605168..89355b6d1f4232 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_query_string.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_query_string.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { FILTERS, Filter, isQueryStringFilter } from '../../../../../common'; +import { FILTERS, Filter, isQueryStringFilter } from '@kbn/es-query'; export const mapQueryString = (filter: Filter) => { if (isQueryStringFilter(filter)) { diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_range.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_range.ts index b58128bd5dbdb2..ee86c1aa3c3095 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_range.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_range.ts @@ -7,14 +7,9 @@ */ import { get, hasIn } from 'lodash'; -import { - FilterValueFormatter, - RangeFilter, - isScriptedRangeFilter, - isRangeFilter, - Filter, - FILTERS, -} from '../../../../../common'; +import { RangeFilter, isScriptedRangeFilter, isRangeFilter, Filter, FILTERS } from '@kbn/es-query'; + +import { FilterValueFormatter } from '../../../../../common'; const getFormattedValueFn = (left: any, right: any) => { return (formatter?: FilterValueFormatter) => { diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_spatial_filter.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_spatial_filter.ts index 229257c1a7d81f..d31b5bb9e608da 100644 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_spatial_filter.ts +++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_spatial_filter.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Filter, FILTERS } from '../../../../../common'; +import { Filter, FILTERS } from '@kbn/es-query'; // Use mapSpatialFilter mapper to avoid bloated meta with value and params for spatial filters. export const mapSpatialFilter = (filter: Filter) => { diff --git a/src/plugins/data/public/query/query_service.ts b/src/plugins/data/public/query/query_service.ts index 3e86c6aa01fd9f..5104a934fdec8a 100644 --- a/src/plugins/data/public/query/query_service.ts +++ b/src/plugins/data/public/query/query_service.ts @@ -9,13 +9,14 @@ import { share } from 'rxjs/operators'; import { IUiSettingsClient, SavedObjectsClientContract } from 'src/core/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; +import { buildEsQuery } from '@kbn/es-query'; import { FilterManager } from './filter_manager'; import { createAddToQueryLog } from './lib'; import { TimefilterService, TimefilterSetup } from './timefilter'; import { createSavedQueryService } from './saved_query/saved_query_service'; import { createQueryStateObservable } from './state_sync/create_global_query_observable'; import { QueryStringManager, QueryStringContract } from './query_string'; -import { buildEsQuery, getEsQueryConfig, TimeRange } from '../../common'; +import { getEsQueryConfig, TimeRange } from '../../common'; import { getUiSettings } from '../services'; import { NowProviderInternalContract } from '../now_provider'; import { IndexPattern } from '..'; diff --git a/src/plugins/data/public/query/state_sync/create_global_query_observable.ts b/src/plugins/data/public/query/state_sync/create_global_query_observable.ts index 7e5b4ebed8785f..3c94d6eb3c056e 100644 --- a/src/plugins/data/public/query/state_sync/create_global_query_observable.ts +++ b/src/plugins/data/public/query/state_sync/create_global_query_observable.ts @@ -8,11 +8,12 @@ import { Observable, Subscription } from 'rxjs'; import { map, tap } from 'rxjs/operators'; +import { isFilterPinned } from '@kbn/es-query'; import { TimefilterSetup } from '../timefilter'; import { FilterManager } from '../filter_manager'; import { QueryState, QueryStateChange } from './index'; import { createStateContainer } from '../../../../kibana_utils/public'; -import { isFilterPinned, compareFilters, COMPARE_ALL_OPTIONS } from '../../../common'; +import { compareFilters, COMPARE_ALL_OPTIONS } from '../../../common'; import { QueryStringContract } from '../query_string'; export function createQueryStateObservable({ diff --git a/src/plugins/data/public/query/timefilter/lib/change_time_filter.ts b/src/plugins/data/public/query/timefilter/lib/change_time_filter.ts index a5601bbc2457a9..0f4cdabc69d6b2 100644 --- a/src/plugins/data/public/query/timefilter/lib/change_time_filter.ts +++ b/src/plugins/data/public/query/timefilter/lib/change_time_filter.ts @@ -8,8 +8,9 @@ import moment from 'moment'; import { keys } from 'lodash'; +import { RangeFilter } from '@kbn/es-query'; import { TimefilterContract } from '../../timefilter'; -import { RangeFilter, TimeRange } from '../../../../common'; +import { TimeRange } from '../../../../common'; export function convertRangeFilterToTimeRange(filter: RangeFilter) { const key = keys(filter.range)[0]; diff --git a/src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts b/src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts index 9e2b19002ff7f5..19e2c656be50d4 100644 --- a/src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts +++ b/src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts @@ -6,8 +6,9 @@ * Side Public License, v 1. */ +import { Filter, isRangeFilter, RangeFilter } from '@kbn/es-query'; import { keys, partition } from 'lodash'; -import { Filter, isRangeFilter, RangeFilter, TimeRange } from '../../../../common'; +import { TimeRange } from '../../../../common'; import { convertRangeFilterToTimeRangeString } from './change_time_filter'; export function extractTimeFilter(timeFieldName: string, filters: Filter[]) { diff --git a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx index 4655bbf8e91a55..084650130e518a 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx @@ -8,15 +8,6 @@ import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiPopover } from '@elastic/eui'; import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react'; -import classNames from 'classnames'; -import React, { useState, useRef } from 'react'; - -import { METRIC_TYPE } from '@kbn/analytics'; -import { FilterEditor } from './filter_editor'; -import { FILTER_EDITOR_WIDTH, FilterItem } from './filter_item'; -import { FilterOptions } from './filter_options'; -import { useKibana } from '../../../../kibana_react/public'; -import { IDataPluginServices, IIndexPattern } from '../..'; import { buildEmptyFilter, Filter, @@ -26,8 +17,18 @@ import { toggleFilterDisabled, toggleFilterNegated, unpinFilter, - UI_SETTINGS, -} from '../../../common'; +} from '@kbn/es-query'; +import classNames from 'classnames'; +import React, { useState, useRef } from 'react'; + +import { METRIC_TYPE } from '@kbn/analytics'; +import { FilterEditor } from './filter_editor'; +import { FILTER_EDITOR_WIDTH, FilterItem } from './filter_item'; +import { FilterOptions } from './filter_options'; +import { useKibana } from '../../../../kibana_react/public'; +import { IDataPluginServices, IIndexPattern } from '../..'; + +import { UI_SETTINGS } from '../../../common'; interface Props { filters: Filter[]; diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx index 734161ea87232b..90ca8e0783a20f 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx @@ -23,6 +23,14 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react'; +import { + Filter, + FieldFilter, + buildFilter, + buildCustomFilter, + cleanFilter, + getFilterParams, +} from '@kbn/es-query'; import { get } from 'lodash'; import React, { Component } from 'react'; import { GenericComboBox, GenericComboBoxProps } from './generic_combo_box'; @@ -39,14 +47,6 @@ import { PhrasesValuesInput } from './phrases_values_input'; import { RangeValueInput } from './range_value_input'; import { getIndexPatternFromFilter } from '../../../query'; import { IIndexPattern, IFieldType } from '../../..'; -import { - Filter, - FieldFilter, - buildFilter, - buildCustomFilter, - cleanFilter, - getFilterParams, -} from '../../../../common'; export interface Props { filter: Filter; diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.ts b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.ts index e15f667128c4f2..ea172c2ccac351 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.ts +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.ts @@ -7,15 +7,9 @@ */ import dateMath from '@elastic/datemath'; +import { Filter, FieldFilter } from '@kbn/es-query'; import { FILTER_OPERATORS, Operator } from './filter_operators'; -import { - isFilterable, - IIndexPattern, - IFieldType, - IpAddress, - Filter, - FieldFilter, -} from '../../../../../common'; +import { isFilterable, IIndexPattern, IFieldType, IpAddress } from '../../../../../common'; export function getFieldFromFilter(filter: FieldFilter, indexPattern: IIndexPattern) { return indexPattern.fields.find((field) => field.name === filter.meta.key); diff --git a/src/plugins/data/public/ui/filter_bar/filter_item.tsx b/src/plugins/data/public/ui/filter_bar/filter_item.tsx index 09e0571c2a870e..b37fc9108ccd2f 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_item.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_item.tsx @@ -8,6 +8,13 @@ import { EuiContextMenu, EuiPopover } from '@elastic/eui'; import { InjectedIntl } from '@kbn/i18n/react'; +import { + Filter, + isFilterPinned, + toggleFilterNegated, + toggleFilterPinned, + toggleFilterDisabled, +} from '@kbn/es-query'; import classNames from 'classnames'; import React, { MouseEvent, useState, useEffect } from 'react'; import { IUiSettingsClient } from 'src/core/public'; @@ -15,13 +22,6 @@ import { FilterEditor } from './filter_editor'; import { FilterView } from './filter_view'; import { IIndexPattern } from '../..'; import { getDisplayValueFromFilter, getIndexPatternFromFilter } from '../../query'; -import { - Filter, - isFilterPinned, - toggleFilterNegated, - toggleFilterPinned, - toggleFilterDisabled, -} from '../../../common'; import { getIndexPatterns } from '../../services'; type PanelOptions = 'pinFilter' | 'editFilter' | 'negateFilter' | 'disableFilter' | 'deleteFilter'; diff --git a/src/plugins/data/public/ui/filter_bar/filter_view/index.tsx b/src/plugins/data/public/ui/filter_bar/filter_view/index.tsx index a15cec4bd286d5..d551af87c72791 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_view/index.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_view/index.tsx @@ -9,8 +9,8 @@ import { EuiBadge, useInnerText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { FC } from 'react'; +import { Filter, isFilterPinned } from '@kbn/es-query'; import { FilterLabel } from '../'; -import { Filter, isFilterPinned } from '../../../../common'; import type { FilterLabelStatus } from '../filter_item'; interface Props { diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index 143400a2c09d34..c3fafb18b61958 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -6,10 +6,6 @@ * Side Public License, v 1. */ -import { PluginConfigDescriptor, PluginInitializerContext } from '../../../core/server'; -import { ConfigSchema, configSchema } from '../config'; -import { DataServerPlugin, DataPluginSetup, DataPluginStart } from './plugin'; - import { buildQueryFilter, buildCustomFilter, @@ -20,7 +16,15 @@ import { buildPhrasesFilter, buildRangeFilter, isFilterDisabled, -} from '../common'; + nodeTypes, + fromKueryExpression, + toElasticsearchQuery, + buildEsQuery, + buildQueryFromFilters, +} from '@kbn/es-query'; +import { PluginConfigDescriptor, PluginInitializerContext } from '../../../core/server'; +import { ConfigSchema, configSchema } from '../config'; +import { DataServerPlugin, DataPluginSetup, DataPluginStart } from './plugin'; /* * Filter helper namespace: @@ -52,14 +56,7 @@ export const exporters = { * esQuery and esKuery: */ -import { - nodeTypes, - fromKueryExpression, - toElasticsearchQuery, - buildEsQuery, - buildQueryFromFilters, - getEsQueryConfig, -} from '../common'; +import { getEsQueryConfig } from '../common'; export const esKuery = { nodeTypes, @@ -73,7 +70,7 @@ export const esQuery = { buildEsQuery, }; -export { EsQueryConfig, KueryNode } from '../common'; +export type { EsQueryConfig, KueryNode, IFieldSubType } from '@kbn/es-query'; /* * Field Formats: @@ -146,7 +143,6 @@ export { export { IFieldType, - IFieldSubType, ES_FIELD_TYPES, KBN_FIELD_TYPES, IndexPatternAttributes, diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/annotations/build_request_body.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/annotations/build_request_body.ts index c1d25b096ff451..8a6b59d3a94804 100644 --- a/src/plugins/vis_type_timeseries/server/lib/vis_data/annotations/build_request_body.ts +++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/annotations/build_request_body.ts @@ -7,7 +7,7 @@ */ import { IUiSettingsClient } from 'kibana/server'; -import { EsQueryConfig } from 'src/plugins/data/server'; +import { EsQueryConfig } from '@kbn/es-query'; import type { Annotation, FetchedIndexPattern, Panel } from '../../../../common/types'; import { VisTypeTimeseriesVisDataRequest } from '../../../types'; import { DefaultSearchCapabilities } from '../../search_strategies'; diff --git a/src/plugins/vis_type_timeseries/server/types.ts b/src/plugins/vis_type_timeseries/server/types.ts index 2fc46b7cd1f11c..878e826c9be627 100644 --- a/src/plugins/vis_type_timeseries/server/types.ts +++ b/src/plugins/vis_type_timeseries/server/types.ts @@ -7,13 +7,10 @@ */ import { Observable } from 'rxjs'; +import { EsQueryConfig } from '@kbn/es-query'; import { SharedGlobalConfig } from 'kibana/server'; import type { IRouter, IUiSettingsClient, KibanaRequest } from 'src/core/server'; -import type { - DataRequestHandlerContext, - EsQueryConfig, - IndexPatternsService, -} from '../../data/server'; +import type { DataRequestHandlerContext, IndexPatternsService } from '../../data/server'; import type { VisPayload } from '../common/types'; import type { SearchStrategyRegistry } from './lib/search_strategies'; import type { CachedIndexPatternFetcher } from './lib/search_strategies/lib/cached_index_pattern_fetcher'; diff --git a/x-pack/plugins/alerting/server/authorization/alerting_authorization_kuery.ts b/x-pack/plugins/alerting/server/authorization/alerting_authorization_kuery.ts index 5205e6afdf29f3..efba94958fcbfb 100644 --- a/x-pack/plugins/alerting/server/authorization/alerting_authorization_kuery.ts +++ b/x-pack/plugins/alerting/server/authorization/alerting_authorization_kuery.ts @@ -7,8 +7,7 @@ import { remove } from 'lodash'; import { JsonObject } from '@kbn/common-utils'; -import { nodeBuilder, EsQueryConfig } from '../../../../../src/plugins/data/common'; -import { toElasticsearchQuery } from '../../../../../src/plugins/data/common/es_query'; +import { EsQueryConfig, nodeBuilder, toElasticsearchQuery } from '@kbn/es-query'; import { KueryNode } from '../../../../../src/plugins/data/server'; import { RegistryAlertTypeWithAuth } from './alerting_authorization'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx index a0a6b30e541a71..ec1421577dc2ba 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx @@ -23,9 +23,10 @@ import { EuiButtonIcon, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { EsQueryConfig, Query, Filter } from '@kbn/es-query'; import { FormattedMessage } from '@kbn/i18n/react'; import { CoreStart } from 'kibana/public'; -import { DataPublicPluginStart, EsQueryConfig, Query, Filter } from 'src/plugins/data/public'; +import { DataPublicPluginStart } from 'src/plugins/data/public'; import { htmlIdGenerator } from '@elastic/eui'; import { DatasourceDataPanelProps, DataType, StateSetter } from '../types'; import { ChildDragDropProvider, DragContextState } from '../drag_drop'; diff --git a/x-pack/plugins/lists/server/services/utils/get_query_filter.ts b/x-pack/plugins/lists/server/services/utils/get_query_filter.ts index 25c8f9880063fb..ff0e42870ab306 100644 --- a/x-pack/plugins/lists/server/services/utils/get_query_filter.ts +++ b/x-pack/plugins/lists/server/services/utils/get_query_filter.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { DslQuery, EsQueryConfig } from 'src/plugins/data/common'; +import { DslQuery, EsQueryConfig } from '@kbn/es-query'; import { Filter, Query, esQuery } from '../../../../../../src/plugins/data/server'; diff --git a/x-pack/plugins/maps/common/elasticsearch_util/spatial_filter_utils.ts b/x-pack/plugins/maps/common/elasticsearch_util/spatial_filter_utils.ts index 9a2b2c21136dfb..0e2c38bf7afe4e 100644 --- a/x-pack/plugins/maps/common/elasticsearch_util/spatial_filter_utils.ts +++ b/x-pack/plugins/maps/common/elasticsearch_util/spatial_filter_utils.ts @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { Feature, Geometry, Polygon, Position } from 'geojson'; // @ts-expect-error import turfCircle from '@turf/circle'; -import { FilterMeta, FILTERS } from '../../../../../src/plugins/data/common'; +import { FilterMeta, FILTERS } from '@kbn/es-query'; import { MapExtent } from '../descriptor_types'; import { ES_SPATIAL_RELATIONS } from '../constants'; import { getEsSpatialRelationLabel } from '../i18n_getters'; diff --git a/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.ts b/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.ts index 86e66577abd456..d3fec07d16bb63 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.ts @@ -11,12 +11,8 @@ import type { CreateExceptionListItemSchema, } from '@kbn/securitysolution-io-ts-list-types'; import { buildExceptionFilter } from '@kbn/securitysolution-list-utils'; -import { - Filter, - IIndexPattern, - buildEsQuery, - EsQueryConfig, -} from '../../../../../src/plugins/data/common'; +import { Filter, EsQueryConfig, IndexPatternBase, buildEsQuery } from '@kbn/es-query'; + import { ESBoolQuery } from '../typed_json'; import { Query, Index, TimestampOverrideOrUndefined } from './schemas/common/schemas'; @@ -28,7 +24,7 @@ export const getQueryFilter = ( lists: Array, excludeExceptions: boolean = true ): ESBoolQuery => { - const indexPattern: IIndexPattern = { + const indexPattern: IndexPatternBase = { fields: [], title: index.join(), }; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.tsx index f2a40711116027..d811e7ca18eddc 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.tsx @@ -8,6 +8,7 @@ import { isEmpty, get } from 'lodash/fp'; import memoizeOne from 'memoize-one'; +import { EsQueryConfig, Filter, Query } from '@kbn/es-query'; import { handleSkipFocus, elementOrChildrenHasFocus, @@ -24,12 +25,7 @@ import { EXISTS_OPERATOR, } from './data_providers/data_provider'; import { BrowserFields } from '../../../common/containers/source'; -import { - IIndexPattern, - Query, - EsQueryConfig, - Filter, -} from '../../../../../../../src/plugins/data/public'; +import { IIndexPattern } from '../../../../../../../src/plugins/data/public'; import { EVENTS_TABLE_CLASS_NAME } from './styles'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/helpers.tsx b/x-pack/plugins/timelines/public/components/t_grid/helpers.tsx index fc040522f3e15c..6cfd97c8bad55a 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/helpers.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/helpers.tsx @@ -5,6 +5,7 @@ * 2.0. */ +import type { Filter, EsQueryConfig, Query } from '@kbn/es-query'; import { isEmpty, get } from 'lodash/fp'; import memoizeOne from 'memoize-one'; import { @@ -14,12 +15,7 @@ import { handleSkipFocus, stopPropagationAndPreventDefault, } from '../../../common'; -import type { - EsQueryConfig, - Filter, - IIndexPattern, - Query, -} from '../../../../../../src/plugins/data/public'; +import type { IIndexPattern } from '../../../../../../src/plugins/data/public'; import type { BrowserFields } from '../../../common/search_strategy/index_fields'; import { DataProviderType, EXISTS_OPERATOR } from '../../../common/types/timeline'; // eslint-disable-next-line no-duplicate-imports diff --git a/x-pack/plugins/timelines/public/components/utils/keury/index.ts b/x-pack/plugins/timelines/public/components/utils/keury/index.ts index e31d682fd7021a..391b15e8fdbac4 100644 --- a/x-pack/plugins/timelines/public/components/utils/keury/index.ts +++ b/x-pack/plugins/timelines/public/components/utils/keury/index.ts @@ -7,15 +7,9 @@ import { isEmpty, isString, flow } from 'lodash/fp'; import { JsonObject } from '@kbn/common-utils'; +import { EsQueryConfig, Filter, Query } from '@kbn/es-query'; -import { - EsQueryConfig, - Query, - Filter, - esQuery, - esKuery, - IIndexPattern, -} from '../../../../../../../src/plugins/data/public'; +import { esQuery, esKuery, IIndexPattern } from '../../../../../../../src/plugins/data/public'; export const convertKueryToElasticSearchQuery = ( kueryExpression: string, From ebb9a1476ac7e4909b3122fc0acc113f80d706b5 Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 30 Jun 2021 10:10:09 +0100 Subject: [PATCH 12/52] comment --- src/plugins/data/common/es_query/es_query/types.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/data/common/es_query/es_query/types.ts b/src/plugins/data/common/es_query/es_query/types.ts index ef028e1aa9d4a2..9282072cd444d4 100644 --- a/src/plugins/data/common/es_query/es_query/types.ts +++ b/src/plugins/data/common/es_query/es_query/types.ts @@ -14,6 +14,9 @@ export interface IFieldSubType { } export interface IndexPatternFieldBase { name: string; + /** + * Kibana field type + */ type: string; subType?: IFieldSubType; /** From 712b31d001bc25d051b16898241df13a4277791b Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 30 Jun 2021 10:58:57 +0100 Subject: [PATCH 13/52] js --- packages/kbn-es-query/BUILD.bazel | 2 +- packages/kbn-es-query/tsconfig.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel index 94793e946f7b6f..4302a583c5734e 100644 --- a/packages/kbn-es-query/BUILD.bazel +++ b/packages/kbn-es-query/BUILD.bazel @@ -21,7 +21,6 @@ filegroup( NPM_MODULE_EXTRA_FILES = [ "package.json", "README.md", - "src/kuery/ast/_generated_/kuery.js", ] SRC_DEPS = [ @@ -55,6 +54,7 @@ ts_project( args = ['--pretty'], srcs = SRCS, deps = DEPS, + allow_js = True, declaration = True, declaration_map = True, incremental = True, diff --git a/packages/kbn-es-query/tsconfig.json b/packages/kbn-es-query/tsconfig.json index 72e9767a7b7702..40a1896db51ba7 100644 --- a/packages/kbn-es-query/tsconfig.json +++ b/packages/kbn-es-query/tsconfig.json @@ -6,6 +6,7 @@ "declaration": true, "declarationMap": true, "sourceMap": true, + "allowJs": true, "sourceRoot": "../../../../packages/kbn-es-query/src", "types": [ "jest", From 831e759d5e0fa2c4467cf7e4774328925e7bbe60 Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 30 Jun 2021 14:27:01 +0100 Subject: [PATCH 14/52] ts --- packages/kbn-es-query/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel index 4302a583c5734e..687dc07aa88015 100644 --- a/packages/kbn-es-query/BUILD.bazel +++ b/packages/kbn-es-query/BUILD.bazel @@ -6,7 +6,7 @@ PKG_REQUIRE_NAME = "@kbn/es-query" SOURCE_FILES = glob( [ - "src/**/*.ts", + "src/**/*", ], exclude = ["**/*.test.*"], ) From cf6a35057020fcc510bf38dc0d829ae3a0978f46 Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 30 Jun 2021 18:08:14 +0100 Subject: [PATCH 15/52] update peg --- tasks/config/peg.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/config/peg.js b/tasks/config/peg.js index 754f7a0290fe7d..b65381c238496d 100644 --- a/tasks/config/peg.js +++ b/tasks/config/peg.js @@ -8,8 +8,8 @@ module.exports = { kuery: { - src: 'src/plugins/data/common/es_query/kuery/ast/kuery.peg', - dest: 'src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js', + src: 'packages/kbn-es-query/src/kuery/ast/kuery.peg', + dest: 'packages/kbn-es-query/src/kuery/ast/_generated_/kuery.js', options: { allowedStartRules: ['start', 'Literal'], cache: true, From f987afe67bf62df3500052d7ca93f202a9833dc9 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 1 Jul 2021 13:02:57 +0100 Subject: [PATCH 16/52] chore(NA): working build for kbn-es-query --- packages/BUILD.bazel | 2 +- packages/kbn-es-query/.babelrc | 3 - packages/kbn-es-query/BUILD.bazel | 34 +- .../ast/kuery.peg => grammar/grammar.peggy} | 5 - .../src/kuery/ast/_generated_/kuery.js | 2912 ----------------- packages/kbn-es-query/src/kuery/ast/ast.ts | 4 +- packages/kbn-es-query/tsconfig.json | 1 - 7 files changed, 29 insertions(+), 2932 deletions(-) delete mode 100644 packages/kbn-es-query/.babelrc rename packages/kbn-es-query/{src/kuery/ast/kuery.peg => grammar/grammar.peggy} (98%) delete mode 100644 packages/kbn-es-query/src/kuery/ast/_generated_/kuery.js diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 1afb4afd74aacc..d9b9e1d2066a66 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -21,9 +21,9 @@ filegroup( "//packages/kbn-docs-utils:build", "//packages/kbn-es:build", "//packages/kbn-es-archiver:build", + "//packages/kbn-es-query:build", "//packages/kbn-eslint-import-resolver-kibana:build", "//packages/kbn-eslint-plugin-eslint:build", - "//packages/kbn-es-query:build", "//packages/kbn-expect:build", "//packages/kbn-i18n:build", "//packages/kbn-interpreter:build", diff --git a/packages/kbn-es-query/.babelrc b/packages/kbn-es-query/.babelrc deleted file mode 100644 index 7da72d17791281..00000000000000 --- a/packages/kbn-es-query/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["@kbn/babel-preset/node_preset"] -} diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel index 687dc07aa88015..957ffa49380ccf 100644 --- a/packages/kbn-es-query/BUILD.bazel +++ b/packages/kbn-es-query/BUILD.bazel @@ -1,4 +1,5 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") +load("@npm//peggy:index.bzl", "peggy") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") PKG_BASE_NAME = "kbn-es-query" @@ -8,7 +9,10 @@ SOURCE_FILES = glob( [ "src/**/*", ], - exclude = ["**/*.test.*"], + exclude = [ + "**/*.test.*", + "**/__fixtures__", + ], ) SRCS = SOURCE_FILES @@ -24,23 +28,38 @@ NPM_MODULE_EXTRA_FILES = [ ] SRC_DEPS = [ + "//packages/kbn-common-utils", "//packages/kbn-config-schema", + "//packages/kbn-i18n", + "@npm//@elastic/elasticsearch", "@npm//load-json-file", - "@npm//tslib", + "@npm//lodash", "@npm//moment-timezone", + "@npm//tslib", ] TYPES_DEPS = [ - "@npm//@types/moment-timezone", - "@npm//@elastic/elasticsearch", - "//packages/kbn-common-utils", - "//packages/kbn-i18n", "@npm//@types/jest", + "@npm//@types/lodash", + "@npm//@types/moment-timezone", "@npm//@types/node", ] DEPS = SRC_DEPS + TYPES_DEPS +peggy( + name = "grammar", + data = [ + ":grammar/grammar.peggy" + ], + output_dir = True, + args = [ + "-o", + "$(@D)/index.js", + "./%s/grammar/grammar.peggy" % package_name() + ], +) + ts_config( name = "tsconfig", src = "tsconfig.json", @@ -54,7 +73,6 @@ ts_project( args = ['--pretty'], srcs = SRCS, deps = DEPS, - allow_js = True, declaration = True, declaration_map = True, incremental = True, @@ -66,7 +84,7 @@ ts_project( js_library( name = PKG_BASE_NAME, - srcs = NPM_MODULE_EXTRA_FILES, + srcs = NPM_MODULE_EXTRA_FILES + [":grammar"], deps = DEPS + [":tsc"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], diff --git a/packages/kbn-es-query/src/kuery/ast/kuery.peg b/packages/kbn-es-query/grammar/grammar.peggy similarity index 98% rename from packages/kbn-es-query/src/kuery/ast/kuery.peg rename to packages/kbn-es-query/grammar/grammar.peggy index dbea96eaac5b28..edb65b561d766e 100644 --- a/packages/kbn-es-query/src/kuery/ast/kuery.peg +++ b/packages/kbn-es-query/grammar/grammar.peggy @@ -1,8 +1,3 @@ -/** - * To generate the parsing module (kuery.js), run `grunt peg` - * To watch changes and generate on file change, run `grunt watch:peg` - */ - // Initialization block { const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; diff --git a/packages/kbn-es-query/src/kuery/ast/_generated_/kuery.js b/packages/kbn-es-query/src/kuery/ast/_generated_/kuery.js deleted file mode 100644 index 05897685a3b66c..00000000000000 --- a/packages/kbn-es-query/src/kuery/ast/_generated_/kuery.js +++ /dev/null @@ -1,2912 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -module.exports = (function () { - /* - * Generated by PEG.js 0.9.0. - * - * http://pegjs.org/ - */ - - function peg$subclass(child, parent) { - function ctor() { - this.constructor = child; - } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); - } - - function peg$SyntaxError(message, expected, found, location) { - this.message = message; - this.expected = expected; - this.found = found; - this.location = location; - this.name = 'SyntaxError'; - - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, peg$SyntaxError); - } - } - - peg$subclass(peg$SyntaxError, Error); - - function peg$parse(input) { - const options = arguments.length > 1 ? arguments[1] : {}; - const parser = this; - - const peg$FAILED = {}; - - const peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral }; - let peg$startRuleFunction = peg$parsestart; - - const peg$c0 = function (query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - if (query !== null) return query; - return nodeTypes.function.buildNode('is', '*', '*'); - }; - const peg$c1 = function (head, query) { - return query; - }; - const peg$c2 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('or', nodes); - }; - const peg$c3 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('and', nodes); - }; - const peg$c4 = function (query) { - if (query.type === 'cursor') return query; - return buildFunctionNode('not', [query]); - }; - const peg$c5 = '('; - const peg$c6 = { type: 'literal', value: '(', description: '"("' }; - const peg$c7 = ')'; - const peg$c8 = { type: 'literal', value: ')', description: '")"' }; - const peg$c9 = function (query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - return query; - }; - const peg$c10 = ':'; - const peg$c11 = { type: 'literal', value: ':', description: '":"' }; - const peg$c12 = '{'; - const peg$c13 = { type: 'literal', value: '{', description: '"{"' }; - const peg$c14 = '}'; - const peg$c15 = { type: 'literal', value: '}', description: '"}"' }; - const peg$c16 = function (field, query, trailing) { - if (query.type === 'cursor') { - return { - ...query, - nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, - }; - } - - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - return buildFunctionNode('nested', [field, query]); - }; - const peg$c17 = { type: 'other', description: 'fieldName' }; - const peg$c18 = function (field, operator, value) { - if (value.type === 'cursor') { - return { - ...value, - suggestionTypes: ['conjunction'], - }; - } - const range = buildNamedArgNode(operator, value); - return buildFunctionNode('range', [field, range]); - }; - const peg$c19 = function (field, partial) { - if (partial.type === 'cursor') { - return { - ...partial, - fieldName: field.value, - suggestionTypes: ['value', 'conjunction'], - }; - } - return partial(field); - }; - const peg$c20 = function (partial) { - if (partial.type === 'cursor') { - const fieldName = `${partial.prefix}${partial.suffix}`.trim(); - return { - ...partial, - fieldName, - suggestionTypes: ['field', 'operator', 'conjunction'], - }; - } - const field = buildLiteralNode(null); - return partial(field); - }; - const peg$c21 = function (partial, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - return partial; - }; - const peg$c22 = function (head, partial) { - return partial; - }; - const peg$c23 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'], - }; - } - return (field) => - buildFunctionNode( - 'or', - nodes.map((partial) => partial(field)) - ); - }; - const peg$c24 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'], - }; - } - return (field) => - buildFunctionNode( - 'and', - nodes.map((partial) => partial(field)) - ); - }; - const peg$c25 = function (partial) { - if (partial.type === 'cursor') { - return { - ...list, - suggestionTypes: ['value'], - }; - } - return (field) => buildFunctionNode('not', [partial(field)]); - }; - const peg$c26 = { type: 'other', description: 'value' }; - const peg$c27 = function (value) { - if (value.type === 'cursor') return value; - const isPhrase = buildLiteralNode(true); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }; - const peg$c28 = function (value) { - if (value.type === 'cursor') return value; - - if ( - !allowLeadingWildcards && - value.type === 'wildcard' && - nodeTypes.wildcard.hasLeadingWildcard(value) - ) { - error( - 'Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.' - ); - } - - const isPhrase = buildLiteralNode(false); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }; - const peg$c29 = { type: 'other', description: 'OR' }; - const peg$c30 = 'or'; - const peg$c31 = { type: 'literal', value: 'or', description: '"or"' }; - const peg$c32 = { type: 'other', description: 'AND' }; - const peg$c33 = 'and'; - const peg$c34 = { type: 'literal', value: 'and', description: '"and"' }; - const peg$c35 = { type: 'other', description: 'NOT' }; - const peg$c36 = 'not'; - const peg$c37 = { type: 'literal', value: 'not', description: '"not"' }; - const peg$c38 = { type: 'other', description: 'literal' }; - const peg$c39 = function () { - return parseCursor; - }; - const peg$c40 = '"'; - const peg$c41 = { type: 'literal', value: '"', description: '"\\""' }; - const peg$c42 = function (prefix, cursor, suffix) { - const { start, end } = location(); - return { - type: 'cursor', - start: start.offset, - end: end.offset - cursor.length, - prefix: prefix.join(''), - suffix: suffix.join(''), - text: text().replace(cursor, ''), - }; - }; - const peg$c43 = function (chars) { - return buildLiteralNode(chars.join('')); - }; - const peg$c44 = '\\'; - const peg$c45 = { type: 'literal', value: '\\', description: '"\\\\"' }; - const peg$c46 = /^[\\"]/; - const peg$c47 = { type: 'class', value: '[\\\\"]', description: '[\\\\"]' }; - const peg$c48 = function (char) { - return char; - }; - const peg$c49 = /^[^"]/; - const peg$c50 = { type: 'class', value: '[^"]', description: '[^"]' }; - const peg$c51 = function (chars) { - const sequence = chars.join('').trim(); - if (sequence === 'null') return buildLiteralNode(null); - if (sequence === 'true') return buildLiteralNode(true); - if (sequence === 'false') return buildLiteralNode(false); - if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); - return buildLiteralNode(sequence); - }; - const peg$c52 = { type: 'any', description: 'any character' }; - const peg$c53 = '*'; - const peg$c54 = { type: 'literal', value: '*', description: '"*"' }; - const peg$c55 = function () { - return wildcardSymbol; - }; - const peg$c56 = '\\t'; - const peg$c57 = { type: 'literal', value: '\\t', description: '"\\\\t"' }; - const peg$c58 = function () { - return '\t'; - }; - const peg$c59 = '\\r'; - const peg$c60 = { type: 'literal', value: '\\r', description: '"\\\\r"' }; - const peg$c61 = function () { - return '\r'; - }; - const peg$c62 = '\\n'; - const peg$c63 = { type: 'literal', value: '\\n', description: '"\\\\n"' }; - const peg$c64 = function () { - return '\n'; - }; - const peg$c65 = function (keyword) { - return keyword; - }; - const peg$c66 = /^[\\():<>"*{}]/; - const peg$c67 = { type: 'class', value: '[\\\\():<>"*{}]', description: '[\\\\():<>"*{}]' }; - const peg$c68 = function (sequence) { - return sequence; - }; - const peg$c69 = 'u'; - const peg$c70 = { type: 'literal', value: 'u', description: '"u"' }; - const peg$c71 = function (digits) { - return String.fromCharCode(parseInt(digits, 16)); - }; - const peg$c72 = /^[0-9a-f]/i; - const peg$c73 = { type: 'class', value: '[0-9a-f]i', description: '[0-9a-f]i' }; - const peg$c74 = '<='; - const peg$c75 = { type: 'literal', value: '<=', description: '"<="' }; - const peg$c76 = function () { - return 'lte'; - }; - const peg$c77 = '>='; - const peg$c78 = { type: 'literal', value: '>=', description: '">="' }; - const peg$c79 = function () { - return 'gte'; - }; - const peg$c80 = '<'; - const peg$c81 = { type: 'literal', value: '<', description: '"<"' }; - const peg$c82 = function () { - return 'lt'; - }; - const peg$c83 = '>'; - const peg$c84 = { type: 'literal', value: '>', description: '">"' }; - const peg$c85 = function () { - return 'gt'; - }; - const peg$c86 = { type: 'other', description: 'whitespace' }; - const peg$c87 = /^[ \t\r\n\xA0]/; - const peg$c88 = { - type: 'class', - value: '[\\ \\t\\r\\n\\u00A0]', - description: '[\\ \\t\\r\\n\\u00A0]', - }; - const peg$c89 = '@kuery-cursor@'; - const peg$c90 = { type: 'literal', value: '@kuery-cursor@', description: '"@kuery-cursor@"' }; - const peg$c91 = function () { - return cursorSymbol; - }; - - let peg$currPos = 0; - let peg$savedPos = 0; - const peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }]; - let peg$maxFailPos = 0; - let peg$maxFailExpected = []; - let peg$silentFails = 0; - - const peg$resultsCache = {}; - - let peg$result; - - if ('startRule' in options) { - if (!(options.startRule in peg$startRuleFunctions)) { - throw new Error('Can\'t start parsing from rule "' + options.startRule + '".'); - } - - peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; - } - - function text() { - return input.substring(peg$savedPos, peg$currPos); - } - - function location() { - return peg$computeLocation(peg$savedPos, peg$currPos); - } - - function expected(description) { - throw peg$buildException( - null, - [{ type: 'other', description: description }], - input.substring(peg$savedPos, peg$currPos), - peg$computeLocation(peg$savedPos, peg$currPos) - ); - } - - function error(message) { - throw peg$buildException( - message, - null, - input.substring(peg$savedPos, peg$currPos), - peg$computeLocation(peg$savedPos, peg$currPos) - ); - } - - function peg$computePosDetails(pos) { - let details = peg$posDetailsCache[pos]; - let p; - let ch; - - if (details) { - return details; - } else { - p = pos - 1; - while (!peg$posDetailsCache[p]) { - p--; - } - - details = peg$posDetailsCache[p]; - details = { - line: details.line, - column: details.column, - seenCR: details.seenCR, - }; - - while (p < pos) { - ch = input.charAt(p); - if (ch === '\n') { - if (!details.seenCR) { - details.line++; - } - details.column = 1; - details.seenCR = false; - } else if (ch === '\r' || ch === '\u2028' || ch === '\u2029') { - details.line++; - details.column = 1; - details.seenCR = true; - } else { - details.column++; - details.seenCR = false; - } - - p++; - } - - peg$posDetailsCache[pos] = details; - return details; - } - } - - function peg$computeLocation(startPos, endPos) { - const startPosDetails = peg$computePosDetails(startPos); - const endPosDetails = peg$computePosDetails(endPos); - - return { - start: { - offset: startPos, - line: startPosDetails.line, - column: startPosDetails.column, - }, - end: { - offset: endPos, - line: endPosDetails.line, - column: endPosDetails.column, - }, - }; - } - - function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { - return; - } - - if (peg$currPos > peg$maxFailPos) { - peg$maxFailPos = peg$currPos; - peg$maxFailExpected = []; - } - - peg$maxFailExpected.push(expected); - } - - function peg$buildException(message, expected, found, location) { - function cleanupExpected(expected) { - let i = 1; - - expected.sort(function (a, b) { - if (a.description < b.description) { - return -1; - } else if (a.description > b.description) { - return 1; - } else { - return 0; - } - }); - - while (i < expected.length) { - if (expected[i - 1] === expected[i]) { - expected.splice(i, 1); - } else { - i++; - } - } - } - - function buildMessage(expected, found) { - function stringEscape(s) { - function hex(ch) { - return ch.charCodeAt(0).toString(16).toUpperCase(); - } - - return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\x08/g, '\\b') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\f/g, '\\f') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function (ch) { - return '\\x0' + hex(ch); - }) - .replace(/[\x10-\x1F\x80-\xFF]/g, function (ch) { - return '\\x' + hex(ch); - }) - .replace(/[\u0100-\u0FFF]/g, function (ch) { - return '\\u0' + hex(ch); - }) - .replace(/[\u1000-\uFFFF]/g, function (ch) { - return '\\u' + hex(ch); - }); - } - - const expectedDescs = new Array(expected.length); - let expectedDesc; - let foundDesc; - let i; - - for (i = 0; i < expected.length; i++) { - expectedDescs[i] = expected[i].description; - } - - expectedDesc = - expected.length > 1 - ? expectedDescs.slice(0, -1).join(', ') + ' or ' + expectedDescs[expected.length - 1] - : expectedDescs[0]; - - foundDesc = found ? '"' + stringEscape(found) + '"' : 'end of input'; - - return 'Expected ' + expectedDesc + ' but ' + foundDesc + ' found.'; - } - - if (expected !== null) { - cleanupExpected(expected); - } - - return new peg$SyntaxError( - message !== null ? message : buildMessage(expected, found), - expected, - found, - location - ); - } - - function peg$parsestart() { - let s0; - let s1; - let s2; - let s3; - - const key = peg$currPos * 37 + 0; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parseOrQuery(); - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - s3 = peg$parseOptionalSpace(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c0(s2, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseOrQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 1; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseAndQuery(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c2(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$parseAndQuery(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseAndQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 2; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseNotQuery(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c3(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$parseNotQuery(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseNotQuery() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 3; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseNot(); - if (s1 !== peg$FAILED) { - s2 = peg$parseSubQuery(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c4(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$parseSubQuery(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseSubQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 4; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c5; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c6); - } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseOrQuery(); - if (s3 !== peg$FAILED) { - s4 = peg$parseOptionalSpace(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c7; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c8); - } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c9(s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$parseNestedQuery(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseNestedQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - let s6; - let s7; - let s8; - let s9; - - const key = peg$currPos * 37 + 5; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseField(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c10; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c11); - } - } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 123) { - s5 = peg$c12; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c13); - } - } - if (s5 !== peg$FAILED) { - s6 = []; - s7 = peg$parseSpace(); - while (s7 !== peg$FAILED) { - s6.push(s7); - s7 = peg$parseSpace(); - } - if (s6 !== peg$FAILED) { - s7 = peg$parseOrQuery(); - if (s7 !== peg$FAILED) { - s8 = peg$parseOptionalSpace(); - if (s8 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s9 = peg$c14; - peg$currPos++; - } else { - s9 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c15); - } - } - if (s9 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c16(s1, s7, s8); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$parseExpression(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseExpression() { - let s0; - - const key = peg$currPos * 37 + 6; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseFieldRangeExpression(); - if (s0 === peg$FAILED) { - s0 = peg$parseFieldValueExpression(); - if (s0 === peg$FAILED) { - s0 = peg$parseValueExpression(); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseField() { - let s0; - let s1; - - const key = peg$currPos * 37 + 7; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - s0 = peg$parseLiteral(); - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c17); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseFieldRangeExpression() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 8; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseField(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseRangeOperator(); - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseLiteral(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c18(s1, s3, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseFieldValueExpression() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 9; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseField(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c10; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c11); - } - } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c19(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseValueExpression() { - let s0; - let s1; - - const key = peg$currPos * 37 + 10; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseValue(); - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c20(s1); - } - s0 = s1; - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseListOfValues() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 11; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c5; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c6); - } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseOrListOfValues(); - if (s3 !== peg$FAILED) { - s4 = peg$parseOptionalSpace(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c7; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c8); - } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c21(s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$parseValue(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseOrListOfValues() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 12; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseAndListOfValues(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c23(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$parseAndListOfValues(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseAndListOfValues() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 13; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseNotListOfValues(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c24(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$parseNotListOfValues(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseNotListOfValues() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 14; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseNot(); - if (s1 !== peg$FAILED) { - s2 = peg$parseListOfValues(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c25(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$parseListOfValues(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseValue() { - let s0; - let s1; - - const key = peg$currPos * 37 + 15; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - s0 = peg$currPos; - s1 = peg$parseQuotedString(); - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c27(s1); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseUnquotedLiteral(); - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c28(s1); - } - s0 = s1; - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c26); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseOr() { - let s0; - let s1; - let s2; - let s3; - let s4; - - const key = peg$currPos * 37 + 16; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { - s2 = input.substr(peg$currPos, 2); - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c31); - } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - } else { - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c29); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseAnd() { - let s0; - let s1; - let s2; - let s3; - let s4; - - const key = peg$currPos * 37 + 17; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { - s2 = input.substr(peg$currPos, 3); - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c34); - } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - } else { - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c32); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseNot() { - let s0; - let s1; - let s2; - let s3; - - const key = peg$currPos * 37 + 18; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - s0 = peg$currPos; - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { - s1 = input.substr(peg$currPos, 3); - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c37); - } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c35); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLiteral() { - let s0; - let s1; - - const key = peg$currPos * 37 + 19; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - s0 = peg$parseQuotedString(); - if (s0 === peg$FAILED) { - s0 = peg$parseUnquotedLiteral(); - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c38); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseQuotedString() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - let s6; - - const key = peg$currPos * 37 + 20; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c40; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseQuotedCharacter(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseQuotedCharacter(); - } - if (s3 !== peg$FAILED) { - s4 = peg$parseCursor(); - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseQuotedCharacter(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseQuotedCharacter(); - } - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c40; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } - } - if (s6 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s3, s4, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c40; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseQuotedCharacter(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseQuotedCharacter(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c40; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c43(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseQuotedCharacter() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 21; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseEscapedWhitespace(); - if (s0 === peg$FAILED) { - s0 = peg$parseEscapedUnicodeSequence(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } - } - if (s1 !== peg$FAILED) { - if (peg$c46.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c47); - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c48(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - s2 = peg$parseCursor(); - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = void 0; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (peg$c49.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c50); - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c48(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseUnquotedLiteral() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 22; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseUnquotedCharacter(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseUnquotedCharacter(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseCursor(); - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseUnquotedCharacter(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseUnquotedCharacter(); - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s2, s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - s2 = peg$parseUnquotedCharacter(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseUnquotedCharacter(); - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c51(s1); - } - s0 = s1; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseUnquotedCharacter() { - let s0; - let s1; - let s2; - let s3; - let s4; - - const key = peg$currPos * 37 + 23; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseEscapedWhitespace(); - if (s0 === peg$FAILED) { - s0 = peg$parseEscapedSpecialCharacter(); - if (s0 === peg$FAILED) { - s0 = peg$parseEscapedUnicodeSequence(); - if (s0 === peg$FAILED) { - s0 = peg$parseEscapedKeyword(); - if (s0 === peg$FAILED) { - s0 = peg$parseWildcard(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - s2 = peg$parseSpecialCharacter(); - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = void 0; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - peg$silentFails++; - s3 = peg$parseKeyword(); - peg$silentFails--; - if (s3 === peg$FAILED) { - s2 = void 0; - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - s3 = peg$currPos; - peg$silentFails++; - s4 = peg$parseCursor(); - peg$silentFails--; - if (s4 === peg$FAILED) { - s3 = void 0; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - if (input.length > peg$currPos) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c52); - } - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c48(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } - } - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseWildcard() { - let s0; - let s1; - - const key = peg$currPos * 37 + 24; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 42) { - s1 = peg$c53; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c54); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c55(); - } - s0 = s1; - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseOptionalSpace() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 25; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseCursor(); - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s2, s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = []; - s1 = peg$parseSpace(); - while (s1 !== peg$FAILED) { - s0.push(s1); - s1 = peg$parseSpace(); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseEscapedWhitespace() { - let s0; - let s1; - - const key = peg$currPos * 37 + 26; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c56) { - s1 = peg$c56; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c57); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c58(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c59) { - s1 = peg$c59; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c60); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c61(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c62) { - s1 = peg$c62; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c63); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c64(); - } - s0 = s1; - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseEscapedSpecialCharacter() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 27; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseSpecialCharacter(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c48(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseEscapedKeyword() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 28; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { - s2 = input.substr(peg$currPos, 2); - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c31); - } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { - s2 = input.substr(peg$currPos, 3); - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c34); - } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { - s2 = input.substr(peg$currPos, 3); - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c37); - } - } - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c65(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseKeyword() { - let s0; - - const key = peg$currPos * 37 + 29; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseOr(); - if (s0 === peg$FAILED) { - s0 = peg$parseAnd(); - if (s0 === peg$FAILED) { - s0 = peg$parseNot(); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseSpecialCharacter() { - let s0; - - const key = peg$currPos * 37 + 30; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - if (peg$c66.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c67); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseEscapedUnicodeSequence() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 31; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseUnicodeSequence(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c68(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseUnicodeSequence() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - let s6; - let s7; - - const key = peg$currPos * 37 + 32; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 117) { - s1 = peg$c69; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c70); - } - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$currPos; - s4 = peg$parseHexDigit(); - if (s4 !== peg$FAILED) { - s5 = peg$parseHexDigit(); - if (s5 !== peg$FAILED) { - s6 = peg$parseHexDigit(); - if (s6 !== peg$FAILED) { - s7 = peg$parseHexDigit(); - if (s7 !== peg$FAILED) { - s4 = [s4, s5, s6, s7]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - s2 = input.substring(s2, peg$currPos); - } else { - s2 = s3; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c71(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseHexDigit() { - let s0; - - const key = peg$currPos * 37 + 33; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - if (peg$c72.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c73); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseRangeOperator() { - let s0; - let s1; - - const key = peg$currPos * 37 + 34; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c74) { - s1 = peg$c74; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c75); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c76(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c77) { - s1 = peg$c77; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c78); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c79(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c80; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c81); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c82(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 62) { - s1 = peg$c83; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c84); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c85(); - } - s0 = s1; - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseSpace() { - let s0; - let s1; - - const key = peg$currPos * 37 + 35; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - if (peg$c87.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c88); - } - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c86); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseCursor() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 36; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 14) === peg$c89) { - s2 = peg$c89; - peg$currPos += 14; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c90); - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c91(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - const { - parseCursor, - cursorSymbol, - allowLeadingWildcards = true, - helpers: { nodeTypes }, - } = options; - const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; - const buildLiteralNode = nodeTypes.literal.buildNode; - const buildWildcardNode = nodeTypes.wildcard.buildNode; - const buildNamedArgNode = nodeTypes.namedArg.buildNode; - const { wildcardSymbol } = nodeTypes.wildcard; - - peg$result = peg$startRuleFunction(); - - if (peg$result !== peg$FAILED && peg$currPos === input.length) { - return peg$result; - } else { - if (peg$result !== peg$FAILED && peg$currPos < input.length) { - peg$fail({ type: 'end', description: 'end of input' }); - } - - throw peg$buildException( - null, - peg$maxFailExpected, - peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, - peg$maxFailPos < input.length - ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) - : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) - ); - } - } - - return { - SyntaxError: peg$SyntaxError, - parse: peg$parse, - }; -})(); diff --git a/packages/kbn-es-query/src/kuery/ast/ast.ts b/packages/kbn-es-query/src/kuery/ast/ast.ts index 3e7b25897cab75..74af3114c34786 100644 --- a/packages/kbn-es-query/src/kuery/ast/ast.ts +++ b/packages/kbn-es-query/src/kuery/ast/ast.ts @@ -11,8 +11,8 @@ import { nodeTypes } from '../node_types/index'; import { KQLSyntaxError } from '../kuery_syntax_error'; import { KueryNode, DslQuery, KueryParseOptions } from '../types'; -// @ts-ignore -import { parse as parseKuery } from './_generated_/kuery'; +// @ts-expect-error +import { parse as parseKuery } from '../../../grammar'; import { IndexPatternBase } from '../..'; const fromExpression = ( diff --git a/packages/kbn-es-query/tsconfig.json b/packages/kbn-es-query/tsconfig.json index 40a1896db51ba7..72e9767a7b7702 100644 --- a/packages/kbn-es-query/tsconfig.json +++ b/packages/kbn-es-query/tsconfig.json @@ -6,7 +6,6 @@ "declaration": true, "declarationMap": true, "sourceMap": true, - "allowJs": true, "sourceRoot": "../../../../packages/kbn-es-query/src", "types": [ "jest", From aeb1cccaac454ff930fc3358b041927163a6c256 Mon Sep 17 00:00:00 2001 From: Liza K Date: Thu, 1 Jul 2021 16:36:34 +0100 Subject: [PATCH 17/52] remove old build task --- tasks/config/peg.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tasks/config/peg.js b/tasks/config/peg.js index b65381c238496d..0c299ae5748dd2 100644 --- a/tasks/config/peg.js +++ b/tasks/config/peg.js @@ -7,14 +7,6 @@ */ module.exports = { - kuery: { - src: 'packages/kbn-es-query/src/kuery/ast/kuery.peg', - dest: 'packages/kbn-es-query/src/kuery/ast/_generated_/kuery.js', - options: { - allowedStartRules: ['start', 'Literal'], - cache: true, - }, - }, timelion_chain: { src: 'src/plugins/vis_type_timelion/common/chain.peg', dest: 'src/plugins/vis_type_timelion/common/_generated_/chain.js', From 79ecff3ffd9f983625ff81860cdf2e80b3ed4798 Mon Sep 17 00:00:00 2001 From: Liza K Date: Thu, 1 Jul 2021 16:55:23 +0100 Subject: [PATCH 18/52] import cleanup --- packages/kbn-es-query/src/kuery/index.ts | 5 ++--- src/plugins/data/common/es_query/index.ts | 6 +++++- src/plugins/data/public/index.ts | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/kbn-es-query/src/kuery/index.ts b/packages/kbn-es-query/src/kuery/index.ts index 72eecc09756b48..a33f44b9547155 100644 --- a/packages/kbn-es-query/src/kuery/index.ts +++ b/packages/kbn-es-query/src/kuery/index.ts @@ -8,6 +8,5 @@ export { KQLSyntaxError } from './kuery_syntax_error'; export { nodeTypes, nodeBuilder } from './node_types'; -export * from './ast'; - -export * from './types'; +export { fromKueryExpression, toElasticsearchQuery } from './ast'; +export { KueryNode } from './types'; diff --git a/src/plugins/data/common/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index 1d660f606ecd39..f49c3c42ac79a0 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -7,4 +7,8 @@ */ export { getEsQueryConfig } from './get_es_query_config'; -export { Filter, FilterStateStore, FILTERS } from '@kbn/es-query'; + +/** + * @deprecated Use imports from `@kbn/es-query` directly + */ +export { nodeBuilder, Filter, FilterMeta, FilterStateStore, FILTERS } from '@kbn/es-query'; diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 4b034efc165a09..b1ef48146373b9 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -102,6 +102,9 @@ export const esFilters = { extractTimeRange, }; +/** + * @deprecated Import from `@kbn/es-query` directly. + */ export type { RangeFilter, RangeFilterMeta, From 65f1854b418304532dd98b34b78e492273eae609 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 5 Jul 2021 10:25:46 +0100 Subject: [PATCH 19/52] Fix imports --- .../src/filters/exists_filter.test.ts | 8 ++--- .../src/filters/get_filter_field.test.ts | 8 ++--- .../src/filters/phrases_filter.test.ts | 8 ++--- .../src/filters/stubs/fields.mocks.ts | 35 +++++++++++++++++++ src/plugins/data/common/es_query/index.ts | 18 +++++++++- src/plugins/data/common/stubs.ts | 2 +- .../public/common/mock/timeline_results.ts | 2 +- 7 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 packages/kbn-es-query/src/filters/stubs/fields.mocks.ts diff --git a/packages/kbn-es-query/src/filters/exists_filter.test.ts b/packages/kbn-es-query/src/filters/exists_filter.test.ts index 848fcead5f5d9c..0309dbf1424a35 100644 --- a/packages/kbn-es-query/src/filters/exists_filter.test.ts +++ b/packages/kbn-es-query/src/filters/exists_filter.test.ts @@ -7,13 +7,13 @@ */ import { buildExistsFilter, getExistsFilterField } from './exists_filter'; -import { IIndexPattern } from '../../index_patterns'; -import { fields } from '../../index_patterns/fields/fields.mocks'; +import { fields } from './stubs/fields.mocks'; +import { IndexPatternBase } from '..'; describe('exists filter', function () { - const indexPattern: IIndexPattern = ({ + const indexPattern: IndexPatternBase = { fields, - } as unknown) as IIndexPattern; + }; describe('getExistsFilterField', function () { it('should return the name of the field an exists query is targeting', () => { diff --git a/packages/kbn-es-query/src/filters/get_filter_field.test.ts b/packages/kbn-es-query/src/filters/get_filter_field.test.ts index b9ae8f3abaa0c5..0425aa6cc8c725 100644 --- a/packages/kbn-es-query/src/filters/get_filter_field.test.ts +++ b/packages/kbn-es-query/src/filters/get_filter_field.test.ts @@ -9,14 +9,14 @@ import { buildPhraseFilter } from './phrase_filter'; import { buildQueryFilter } from './query_string_filter'; import { getFilterField } from './get_filter_field'; -import { IIndexPattern } from '../../index_patterns'; -import { fields } from '../../index_patterns/fields/fields.mocks'; +import { IndexPatternBase } from '..'; +import { fields } from './stubs/fields.mocks'; describe('getFilterField', function () { - const indexPattern: IIndexPattern = ({ + const indexPattern: IndexPatternBase = { id: 'logstash-*', fields, - } as unknown) as IIndexPattern; + }; it('should return the field name from known filter types that target a specific field', () => { const field = indexPattern.fields.find((patternField) => patternField.name === 'extension'); diff --git a/packages/kbn-es-query/src/filters/phrases_filter.test.ts b/packages/kbn-es-query/src/filters/phrases_filter.test.ts index 68ef69ba76eeb8..5e742187cdf05c 100644 --- a/packages/kbn-es-query/src/filters/phrases_filter.test.ts +++ b/packages/kbn-es-query/src/filters/phrases_filter.test.ts @@ -7,13 +7,13 @@ */ import { buildPhrasesFilter, getPhrasesFilterField } from './phrases_filter'; -import { IIndexPattern } from '../../index_patterns'; -import { fields } from '../../index_patterns/fields/fields.mocks'; +import { IndexPatternBase } from '..'; +import { fields } from './stubs/fields.mocks'; describe('phrases filter', function () { - const indexPattern: IIndexPattern = ({ + const indexPattern: IndexPatternBase = { fields, - } as unknown) as IIndexPattern; + }; describe('getPhrasesFilterField', function () { it('should return the name of the field a phrases query is targeting', () => { diff --git a/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts b/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts new file mode 100644 index 00000000000000..d9e30bd58bfcc0 --- /dev/null +++ b/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { IndexPatternFieldBase } from '../..'; + +/** + * Base index pattern fields for testing + */ +export const fields: IndexPatternFieldBase[] = [ + { + name: 'bytes', + type: 'number', + scripted: false, + }, + { + name: '@timestamp', + type: 'date', + scripted: false, + }, + { + name: 'extension', + type: 'string', + scripted: false, + }, + { + name: 'machine.os', + type: 'string', + scripted: false, + }, +]; diff --git a/src/plugins/data/common/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index f49c3c42ac79a0..7f1d7dc6ae737e 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -9,6 +9,22 @@ export { getEsQueryConfig } from './get_es_query_config'; /** + * Legacy re-exports from package. * @deprecated Use imports from `@kbn/es-query` directly */ -export { nodeBuilder, Filter, FilterMeta, FilterStateStore, FILTERS } from '@kbn/es-query'; +export { + nodeBuilder, + buildQueryFilter, + buildPhrasesFilter, + buildPhraseFilter, + buildRangeFilter, + buildCustomFilter, + buildFilter, + buildEmptyFilter, + buildExistsFilter, + toggleFilterNegated, + Filter, + FilterMeta, + FilterStateStore, + FILTERS, +} from '@kbn/es-query'; diff --git a/src/plugins/data/common/stubs.ts b/src/plugins/data/common/stubs.ts index 25f9dda7d33b48..1d12be4342fef1 100644 --- a/src/plugins/data/common/stubs.ts +++ b/src/plugins/data/common/stubs.ts @@ -8,4 +8,4 @@ export { stubIndexPattern, stubIndexPatternWithFields } from './index_patterns/index_pattern.stub'; export { stubFields } from './index_patterns/field.stub'; -export * from './es_query/filters/stubs'; +export * from '@kbn/es-query/target/filters/stubs'; diff --git a/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts index 806031b07e0c9e..f271f49e56a292 100644 --- a/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts +++ b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FilterStateStore } from '../../../../../../src/plugins/data/common/es_query/filters/meta_filter'; +import { FilterStateStore } from '../../../../../../src/plugins/data/common'; import { TimelineId, From 328d60f168c950151fc40195c98f11d9c127cbaf Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 5 Jul 2021 13:22:53 +0100 Subject: [PATCH 20/52] imports --- packages/kbn-es-query/src/filters/stubs/index.ts | 1 + packages/kbn-es-query/src/kuery/ast/ast.test.ts | 10 +++++----- src/plugins/data/common/es_query/index.ts | 10 ++++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/kbn-es-query/src/filters/stubs/index.ts b/packages/kbn-es-query/src/filters/stubs/index.ts index cd766b378f2c80..e4d99b50822578 100644 --- a/packages/kbn-es-query/src/filters/stubs/index.ts +++ b/packages/kbn-es-query/src/filters/stubs/index.ts @@ -10,3 +10,4 @@ export * from './exists_filter'; export * from './phrase_filter'; export * from './phrases_filter'; export * from './range_filter'; +export * from './fields.mocks'; diff --git a/packages/kbn-es-query/src/kuery/ast/ast.test.ts b/packages/kbn-es-query/src/kuery/ast/ast.test.ts index f8d7dc02d38fce..54c28ef183cf94 100644 --- a/packages/kbn-es-query/src/kuery/ast/ast.test.ts +++ b/packages/kbn-es-query/src/kuery/ast/ast.test.ts @@ -8,17 +8,17 @@ import { fromKueryExpression, fromLiteralExpression, toElasticsearchQuery } from './ast'; import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../index_patterns'; +import { IndexPatternBase } from '../..'; import { KueryNode } from '../types'; +import { fields } from '../../filters/stubs'; describe('kuery AST API', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('fromKueryExpression', () => { diff --git a/src/plugins/data/common/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index 7f1d7dc6ae737e..b6389b99928fbc 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -14,6 +14,16 @@ export { getEsQueryConfig } from './get_es_query_config'; */ export { nodeBuilder, + isFilters, + isExistsFilter, + isMatchAllFilter, + isGeoBoundingBoxFilter, + isGeoPolygonFilter, + isMissingFilter, + isPhraseFilter, + isPhrasesFilter, + isRangeFilter, + isQueryStringFilter, buildQueryFilter, buildPhrasesFilter, buildPhraseFilter, From ecc572a2617c24bf50b11dbd05907b60f0fba7df Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 5 Jul 2021 15:17:03 +0100 Subject: [PATCH 21/52] stubs in package tests --- .../src/es_query/build_es_query.test.ts | 9 ++++---- .../src/es_query/from_filters.test.ts | 8 +++---- .../src/es_query/from_kuery.test.ts | 10 ++++---- .../src/es_query/handle_nested_filter.test.ts | 2 +- .../src/filters/exists_filter.test.ts | 2 +- .../src/filters/get_filter_field.test.ts | 2 +- .../src/filters/phrase_filter.test.ts | 23 ++++++++++--------- .../src/filters/phrases_filter.test.ts | 2 +- .../src/filters/range_filter.test.ts | 20 ++++++++-------- .../src/filters/stubs/fields.mocks.ts | 21 +++++++++++++++++ .../src/kuery/functions/and.test.ts | 10 ++++---- .../src/kuery/functions/exists.test.ts | 10 ++++---- .../kuery/functions/geo_bounding_box.test.ts | 10 ++++---- .../src/kuery/functions/geo_polygon.test.ts | 10 ++++---- .../src/kuery/functions/is.test.ts | 10 ++++---- .../src/kuery/functions/nested.test.ts | 10 ++++---- .../src/kuery/functions/not.test.ts | 10 ++++---- .../src/kuery/functions/or.test.ts | 10 ++++---- .../src/kuery/functions/range.test.ts | 10 ++++---- .../kuery/functions/utils/get_fields.test.ts | 2 +- .../utils/get_full_field_name_node.test.ts | 10 ++++---- .../src/kuery/node_types/function.test.ts | 11 ++++----- .../es_query/get_es_query_config.test.ts | 2 +- src/plugins/data/public/index.ts | 4 +++- .../geo_containment/es_query_builder.ts | 8 +++---- 25 files changed, 124 insertions(+), 102 deletions(-) diff --git a/packages/kbn-es-query/src/es_query/build_es_query.test.ts b/packages/kbn-es-query/src/es_query/build_es_query.test.ts index fa9a2c85aaef54..737739c5573ba1 100644 --- a/packages/kbn-es-query/src/es_query/build_es_query.test.ts +++ b/packages/kbn-es-query/src/es_query/build_es_query.test.ts @@ -10,15 +10,14 @@ import { buildEsQuery } from './build_es_query'; import { fromKueryExpression, toElasticsearchQuery } from '../kuery'; import { luceneStringToDsl } from './lucene_string_to_dsl'; import { decorateQuery } from './decorate_query'; -import { IIndexPattern } from '../../index_patterns'; import { MatchAllFilter } from '../filters'; -import { fields } from '../../index_patterns/mocks'; -import { Query } from '../../query/types'; +import { fields } from '../filters/stubs'; +import { IndexPatternBase } from './types'; describe('build query', () => { - const indexPattern: IIndexPattern = ({ + const indexPattern: IndexPatternBase = { fields, - } as unknown) as IIndexPattern; + }; describe('buildEsQuery', () => { it('should return the parameters of an Elasticsearch bool query', () => { diff --git a/packages/kbn-es-query/src/es_query/from_filters.test.ts b/packages/kbn-es-query/src/es_query/from_filters.test.ts index 4a60db48c41b68..e3a56b5a9d63d0 100644 --- a/packages/kbn-es-query/src/es_query/from_filters.test.ts +++ b/packages/kbn-es-query/src/es_query/from_filters.test.ts @@ -7,14 +7,14 @@ */ import { buildQueryFromFilters } from './from_filters'; -import { IIndexPattern } from '../../index_patterns'; import { ExistsFilter, Filter, MatchAllFilter } from '../filters'; -import { fields } from '../../index_patterns/mocks'; +import { fields } from '../filters/stubs'; +import { IndexPatternBase } from './types'; describe('build query', () => { - const indexPattern: IIndexPattern = ({ + const indexPattern: IndexPatternBase = { fields, - } as unknown) as IIndexPattern; + }; describe('buildQueryFromFilters', () => { test('should return the parameters of an Elasticsearch bool query', () => { diff --git a/packages/kbn-es-query/src/es_query/from_kuery.test.ts b/packages/kbn-es-query/src/es_query/from_kuery.test.ts index 920102566f8b32..fb224121c66332 100644 --- a/packages/kbn-es-query/src/es_query/from_kuery.test.ts +++ b/packages/kbn-es-query/src/es_query/from_kuery.test.ts @@ -8,14 +8,14 @@ import { buildQueryFromKuery } from './from_kuery'; import { fromKueryExpression, toElasticsearchQuery } from '../kuery'; -import { IIndexPattern } from '../../index_patterns'; -import { fields } from '../../index_patterns/mocks'; -import { Query } from '../../query/types'; +import { fields } from '../filters/stubs'; +import { IndexPatternBase } from './types'; +import { Query } from '..'; describe('build query', () => { - const indexPattern: IIndexPattern = ({ + const indexPattern: IndexPatternBase = { fields, - } as unknown) as IIndexPattern; + }; describe('buildQueryFromKuery', () => { test('should return the parameters of an Elasticsearch bool query', () => { diff --git a/packages/kbn-es-query/src/es_query/handle_nested_filter.test.ts b/packages/kbn-es-query/src/es_query/handle_nested_filter.test.ts index 24852ebf33bda3..9c7b6070c7ec0f 100644 --- a/packages/kbn-es-query/src/es_query/handle_nested_filter.test.ts +++ b/packages/kbn-es-query/src/es_query/handle_nested_filter.test.ts @@ -7,7 +7,7 @@ */ import { handleNestedFilter } from './handle_nested_filter'; -import { fields } from '../../index_patterns/mocks'; +import { fields } from '../filters/stubs'; import { buildPhraseFilter, buildQueryFilter } from '../filters'; import { IndexPatternBase } from './types'; diff --git a/packages/kbn-es-query/src/filters/exists_filter.test.ts b/packages/kbn-es-query/src/filters/exists_filter.test.ts index 0309dbf1424a35..c9da75e8a52010 100644 --- a/packages/kbn-es-query/src/filters/exists_filter.test.ts +++ b/packages/kbn-es-query/src/filters/exists_filter.test.ts @@ -8,7 +8,7 @@ import { buildExistsFilter, getExistsFilterField } from './exists_filter'; import { fields } from './stubs/fields.mocks'; -import { IndexPatternBase } from '..'; +import { IndexPatternBase } from '../..'; describe('exists filter', function () { const indexPattern: IndexPatternBase = { diff --git a/packages/kbn-es-query/src/filters/get_filter_field.test.ts b/packages/kbn-es-query/src/filters/get_filter_field.test.ts index 0425aa6cc8c725..3a3bd98265a9a7 100644 --- a/packages/kbn-es-query/src/filters/get_filter_field.test.ts +++ b/packages/kbn-es-query/src/filters/get_filter_field.test.ts @@ -9,7 +9,7 @@ import { buildPhraseFilter } from './phrase_filter'; import { buildQueryFilter } from './query_string_filter'; import { getFilterField } from './get_filter_field'; -import { IndexPatternBase } from '..'; +import { IndexPatternBase } from '../..'; import { fields } from './stubs/fields.mocks'; describe('getFilterField', function () { diff --git a/packages/kbn-es-query/src/filters/phrase_filter.test.ts b/packages/kbn-es-query/src/filters/phrase_filter.test.ts index 513f0e29b5b245..7e6ccadc800d44 100644 --- a/packages/kbn-es-query/src/filters/phrase_filter.test.ts +++ b/packages/kbn-es-query/src/filters/phrase_filter.test.ts @@ -11,16 +11,17 @@ import { buildPhraseFilter, getPhraseFilterField, } from './phrase_filter'; -import { fields, getField } from '../../index_patterns/mocks'; -import { IIndexPattern } from '../../index_patterns'; +import { fields, getField } from '../filters/stubs'; +import { IndexPatternBase } from '../es_query'; describe('Phrase filter builder', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { indexPattern = { id: 'id', - } as IIndexPattern; + fields, + }; }); it('should be a function', () => { @@ -30,7 +31,7 @@ describe('Phrase filter builder', () => { it('should return a match query filter when passed a standard string field', () => { const field = getField('extension'); - expect(buildPhraseFilter(field, 'jpg', indexPattern)).toEqual({ + expect(buildPhraseFilter(field!, 'jpg', indexPattern)).toEqual({ meta: { index: 'id', }, @@ -45,7 +46,7 @@ describe('Phrase filter builder', () => { it('should return a match query filter when passed a standard numeric field', () => { const field = getField('bytes'); - expect(buildPhraseFilter(field, '5', indexPattern)).toEqual({ + expect(buildPhraseFilter(field!, '5', indexPattern)).toEqual({ meta: { index: 'id', }, @@ -60,7 +61,7 @@ describe('Phrase filter builder', () => { it('should return a match query filter when passed a standard bool field', () => { const field = getField('ssl'); - expect(buildPhraseFilter(field, 'true', indexPattern)).toEqual({ + expect(buildPhraseFilter(field!, 'true', indexPattern)).toEqual({ meta: { index: 'id', }, @@ -75,7 +76,7 @@ describe('Phrase filter builder', () => { it('should return a script filter when passed a scripted field', () => { const field = getField('script number'); - expect(buildPhraseFilter(field, 5, indexPattern)).toEqual({ + expect(buildPhraseFilter(field!, 5, indexPattern)).toEqual({ meta: { index: 'id', field: 'script number', @@ -95,7 +96,7 @@ describe('Phrase filter builder', () => { it('should return a script filter when passed a scripted field with numeric conversion', () => { const field = getField('script number'); - expect(buildPhraseFilter(field, '5', indexPattern)).toEqual({ + expect(buildPhraseFilter(field!, '5', indexPattern)).toEqual({ meta: { index: 'id', field: 'script number', @@ -140,9 +141,9 @@ describe('buildInlineScriptForPhraseFilter', () => { }); describe('getPhraseFilterField', function () { - const indexPattern: IIndexPattern = ({ + const indexPattern: IndexPatternBase = { fields, - } as unknown) as IIndexPattern; + }; it('should return the name of the field a phrase query is targeting', () => { const field = indexPattern.fields.find((patternField) => patternField.name === 'extension'); diff --git a/packages/kbn-es-query/src/filters/phrases_filter.test.ts b/packages/kbn-es-query/src/filters/phrases_filter.test.ts index 5e742187cdf05c..57965a6bdd7cfa 100644 --- a/packages/kbn-es-query/src/filters/phrases_filter.test.ts +++ b/packages/kbn-es-query/src/filters/phrases_filter.test.ts @@ -7,7 +7,7 @@ */ import { buildPhrasesFilter, getPhrasesFilterField } from './phrases_filter'; -import { IndexPatternBase } from '..'; +import { IndexPatternBase } from '../..'; import { fields } from './stubs/fields.mocks'; describe('phrases filter', function () { diff --git a/packages/kbn-es-query/src/filters/range_filter.test.ts b/packages/kbn-es-query/src/filters/range_filter.test.ts index 30e52b21d52b75..634471b1d4d9e3 100644 --- a/packages/kbn-es-query/src/filters/range_filter.test.ts +++ b/packages/kbn-es-query/src/filters/range_filter.test.ts @@ -8,7 +8,7 @@ import { each } from 'lodash'; import { buildRangeFilter, getRangeFilterField, RangeFilter } from './range_filter'; -import { fields, getField } from '../../index_patterns/mocks'; +import { fields, getField } from '../filters/stubs'; import { IndexPatternBase, IndexPatternFieldBase } from '../es_query'; describe('Range filter builder', () => { @@ -27,7 +27,7 @@ describe('Range filter builder', () => { it('should return a range filter when passed a standard field', () => { const field = getField('bytes'); - expect(buildRangeFilter(field, { gte: 1, lte: 3 }, indexPattern)).toEqual({ + expect(buildRangeFilter(field!, { gte: 1, lte: 3 }, indexPattern)).toEqual({ meta: { index: 'id', params: {}, @@ -44,7 +44,7 @@ describe('Range filter builder', () => { it('should return a script filter when passed a scripted field', () => { const field = getField('script number'); - expect(buildRangeFilter(field, { gte: 1, lte: 3 }, indexPattern)).toEqual({ + expect(buildRangeFilter(field!, { gte: 1, lte: 3 }, indexPattern)).toEqual({ meta: { field: 'script number', index: 'id', @@ -67,7 +67,7 @@ describe('Range filter builder', () => { it('should convert strings to numbers if the field is scripted and type number', () => { const field = getField('script number'); - expect(buildRangeFilter(field, { gte: '1', lte: '3' }, indexPattern)).toEqual({ + expect(buildRangeFilter(field!, { gte: '1', lte: '3' }, indexPattern)).toEqual({ meta: { field: 'script number', index: 'id', @@ -95,7 +95,7 @@ describe('Range filter builder', () => { `gte(() -> { ${field!.script} }, params.gte) && ` + `lte(() -> { ${field!.script} }, params.lte)`; - const rangeFilter = buildRangeFilter(field, { gte: 1, lte: 3 }, indexPattern); + const rangeFilter = buildRangeFilter(field!, { gte: 1, lte: 3 }, indexPattern); expect(rangeFilter.script!.script.source).toBe(expected); }); @@ -104,11 +104,11 @@ describe('Range filter builder', () => { const field = getField('script number'); expect(() => { - buildRangeFilter(field, { gte: 1, gt: 3 }, indexPattern); + buildRangeFilter(field!, { gte: 1, gt: 3 }, indexPattern); }).toThrowError(); expect(() => { - buildRangeFilter(field, { lte: 1, lt: 3 }, indexPattern); + buildRangeFilter(field!, { lte: 1, lt: 3 }, indexPattern); }).toThrowError(); }); @@ -120,7 +120,7 @@ describe('Range filter builder', () => { [key]: 5, }; - const filter = buildRangeFilter(field, params, indexPattern); + const filter = buildRangeFilter(field!, params, indexPattern); const script = filter.script!.script; expect(script.source).toBe('(' + field!.script + ')' + operator + key); @@ -134,7 +134,7 @@ describe('Range filter builder', () => { let filter: RangeFilter; beforeEach(() => { - field = getField('script number'); + field = getField('script number')!; filter = buildRangeFilter(field, { gte: 0, lt: Infinity }, indexPattern); }); @@ -164,7 +164,7 @@ describe('Range filter builder', () => { let filter: RangeFilter; beforeEach(() => { - field = getField('script number'); + field = getField('script number')!; filter = buildRangeFilter(field, { gte: -Infinity, lt: Infinity }, indexPattern); }); diff --git a/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts b/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts index d9e30bd58bfcc0..acd0a4aaacb921 100644 --- a/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts +++ b/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts @@ -17,6 +17,11 @@ export const fields: IndexPatternFieldBase[] = [ type: 'number', scripted: false, }, + { + name: 'ssl', + type: 'boolean', + scripted: false, + }, { name: '@timestamp', type: 'date', @@ -32,4 +37,20 @@ export const fields: IndexPatternFieldBase[] = [ type: 'string', scripted: false, }, + { + name: 'script number', + type: 'number', + scripted: true, + script: '1234', + lang: 'expression', + }, + { + name: 'script date', + type: 'date', + scripted: true, + script: '1234', + lang: 'painless', + }, ]; + +export const getField = (name: string) => fields.find((field) => field.name === name); diff --git a/packages/kbn-es-query/src/kuery/functions/and.test.ts b/packages/kbn-es-query/src/kuery/functions/and.test.ts index fae7888d75536f..e3feca5bb0b0e8 100644 --- a/packages/kbn-es-query/src/kuery/functions/and.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/and.test.ts @@ -7,24 +7,24 @@ */ import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../index_patterns'; +import { fields } from '../../filters/stubs'; import * as ast from '../ast'; // @ts-ignore import * as and from './and'; +import { IndexPatternBase } from '../../es_query'; const childNode1 = nodeTypes.function.buildNode('is', 'machine.os', 'osx'); const childNode2 = nodeTypes.function.buildNode('is', 'extension', 'jpg'); describe('kuery functions', () => { describe('and', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/exists.test.ts b/packages/kbn-es-query/src/kuery/functions/exists.test.ts index 4036e7c4089f07..b957e8f3af10bc 100644 --- a/packages/kbn-es-query/src/kuery/functions/exists.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/exists.test.ts @@ -7,20 +7,20 @@ */ import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../index_patterns'; +import { fields } from '../../filters/stubs'; +import { IndexPatternBase } from '../..'; // @ts-ignore import * as exists from './exists'; describe('kuery functions', () => { describe('exists', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts b/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts index 54c2383be785af..2d7d4e4b4bc944 100644 --- a/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts @@ -8,8 +8,8 @@ import { get } from 'lodash'; import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../index_patterns'; +import { fields } from '../../filters/stubs'; +import { IndexPatternBase } from '../..'; // @ts-ignore import * as geoBoundingBox from './geo_bounding_box'; @@ -27,12 +27,12 @@ const params = { describe('kuery functions', () => { describe('geoBoundingBox', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts b/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts index a106754a5f56f6..d0145088b359bf 100644 --- a/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts @@ -7,8 +7,8 @@ */ import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../index_patterns'; +import { fields } from '../../filters/stubs'; +import { IndexPatternBase } from '../..'; // @ts-ignore import * as geoPolygon from './geo_polygon'; @@ -30,12 +30,12 @@ const points = [ describe('kuery functions', () => { describe('geoPolygon', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/is.test.ts b/packages/kbn-es-query/src/kuery/functions/is.test.ts index 55aac8189c1d89..2236b5690c3e3f 100644 --- a/packages/kbn-es-query/src/kuery/functions/is.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/is.test.ts @@ -7,20 +7,20 @@ */ import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; +import { fields } from '../../filters/stubs'; // @ts-ignore import * as is from './is'; -import { IIndexPattern } from '../../../index_patterns'; +import { IndexPatternBase } from '../..'; describe('kuery functions', () => { describe('is', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/nested.test.ts b/packages/kbn-es-query/src/kuery/functions/nested.test.ts index 50460500c08776..1311fdf63dec90 100644 --- a/packages/kbn-es-query/src/kuery/functions/nested.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/nested.test.ts @@ -7,8 +7,8 @@ */ import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../index_patterns'; +import { fields } from '../../filters/stubs'; +import { IndexPatternBase } from '../..'; import * as ast from '../ast'; @@ -19,12 +19,12 @@ const childNode = nodeTypes.function.buildNode('is', 'child', 'foo'); describe('kuery functions', () => { describe('nested', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/not.test.ts b/packages/kbn-es-query/src/kuery/functions/not.test.ts index ab83df581edd78..ea99eb15b4a330 100644 --- a/packages/kbn-es-query/src/kuery/functions/not.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/not.test.ts @@ -7,8 +7,8 @@ */ import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../index_patterns'; +import { fields } from '../../filters/stubs'; +import { IndexPatternBase } from '../..'; import * as ast from '../ast'; @@ -19,12 +19,12 @@ const childNode = nodeTypes.function.buildNode('is', 'extension', 'jpg'); describe('kuery functions', () => { describe('not', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/or.test.ts b/packages/kbn-es-query/src/kuery/functions/or.test.ts index 5e151098a5ef94..7b096c510a7898 100644 --- a/packages/kbn-es-query/src/kuery/functions/or.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/or.test.ts @@ -7,8 +7,8 @@ */ import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../index_patterns'; +import { fields } from '../../filters/stubs'; +import { IndexPatternBase } from '../..'; import * as ast from '../ast'; @@ -20,12 +20,12 @@ const childNode2 = nodeTypes.function.buildNode('is', 'extension', 'jpg'); describe('kuery functions', () => { describe('or', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/range.test.ts b/packages/kbn-es-query/src/kuery/functions/range.test.ts index c4bc9c1372b27d..e85399bcacfc63 100644 --- a/packages/kbn-es-query/src/kuery/functions/range.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/range.test.ts @@ -8,8 +8,8 @@ import { get } from 'lodash'; import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../index_patterns'; +import { fields } from '../../filters/stubs'; +import { IndexPatternBase } from '../..'; import { RangeFilterParams } from '../../filters'; // @ts-ignore @@ -17,12 +17,12 @@ import * as range from './range'; describe('kuery functions', () => { describe('range', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts b/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts index 949f94d0435539..84c86fc3c7e8d8 100644 --- a/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts @@ -7,7 +7,7 @@ */ import { IndexPatternBase } from '../../..'; -import { fields } from '../../../../index_patterns/mocks'; +import { fields } from '../../../filters/stubs'; import { nodeTypes } from '../../index'; diff --git a/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts b/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts index 639f5584ef5925..938073b45243a5 100644 --- a/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts @@ -7,19 +7,19 @@ */ import { nodeTypes } from '../../node_types'; -import { fields } from '../../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../../index_patterns'; +import { fields } from '../../../filters/stubs'; +import { IndexPatternBase } from '../../..'; // @ts-ignore import { getFullFieldNameNode } from './get_full_field_name_node'; describe('getFullFieldNameNode', function () { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); test('should return unchanged name node if no nested path is passed in', () => { diff --git a/packages/kbn-es-query/src/kuery/node_types/function.test.ts b/packages/kbn-es-query/src/kuery/node_types/function.test.ts index 42c06d7fdb603c..e1e0da75394ac5 100644 --- a/packages/kbn-es-query/src/kuery/node_types/function.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/function.test.ts @@ -6,22 +6,21 @@ * Side Public License, v 1. */ -import { fields } from '../../../index_patterns/mocks'; - import { nodeTypes } from './index'; -import { IIndexPattern } from '../../../index_patterns'; import { buildNode, buildNodeWithArgumentNodes, toElasticsearchQuery } from './function'; import { toElasticsearchQuery as isFunctionToElasticsearchQuery } from '../functions/is'; +import { IndexPatternBase } from '../../es_query'; +import { fields } from '../../filters/stubs/fields.mocks'; describe('kuery node types', () => { describe('function', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNode', () => { diff --git a/src/plugins/data/common/es_query/get_es_query_config.test.ts b/src/plugins/data/common/es_query/get_es_query_config.test.ts index 6963960d7ce03b..5513f2649265fc 100644 --- a/src/plugins/data/common/es_query/get_es_query_config.test.ts +++ b/src/plugins/data/common/es_query/get_es_query_config.test.ts @@ -9,7 +9,7 @@ import { get } from 'lodash'; import { getEsQueryConfig } from './get_es_query_config'; import { IUiSettingsClient } from 'kibana/public'; -import { UI_SETTINGS } from '../../'; +import { UI_SETTINGS } from '..'; const config = ({ get(item: string) { diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index b1ef48146373b9..e2abaf8d9a331c 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -105,7 +105,7 @@ export const esFilters = { /** * @deprecated Import from `@kbn/es-query` directly. */ -export type { +export { RangeFilter, RangeFilterMeta, RangeFilterParams, @@ -115,6 +115,8 @@ export type { CustomFilter, MatchAllFilter, IFieldSubType, + isFilter, + isFilters, } from '@kbn/es-query'; import { getEsQueryConfig } from '../common'; diff --git a/x-pack/plugins/stack_alerts/server/alert_types/geo_containment/es_query_builder.ts b/x-pack/plugins/stack_alerts/server/alert_types/geo_containment/es_query_builder.ts index 1e26ea09618d5a..104ca52deafa75 100644 --- a/x-pack/plugins/stack_alerts/server/alert_types/geo_containment/es_query_builder.ts +++ b/x-pack/plugins/stack_alerts/server/alert_types/geo_containment/es_query_builder.ts @@ -9,12 +9,12 @@ import { ElasticsearchClient } from 'kibana/server'; import { Logger } from 'src/core/server'; import type { ApiResponse, estypes } from '@elastic/elasticsearch'; import { - Query, - IIndexPattern, fromKueryExpression, toElasticsearchQuery, luceneStringToDsl, -} from '../../../../../../src/plugins/data/common'; + IndexPatternBase, + Query, +} from '@kbn/es-query'; export const OTHER_CATEGORY = 'other'; // Consider dynamically obtaining from config? @@ -22,7 +22,7 @@ const MAX_TOP_LEVEL_QUERY_SIZE = 0; const MAX_SHAPES_QUERY_SIZE = 10000; const MAX_BUCKETS_LIMIT = 65535; -export const getEsFormattedQuery = (query: Query, indexPattern?: IIndexPattern) => { +export const getEsFormattedQuery = (query: Query, indexPattern?: IndexPatternBase) => { let esFormattedQuery; const queryLanguage = query.language; From 32dc2889432b6c817eea92a22e6b0615351a4e57 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 5 Jul 2021 17:19:50 +0100 Subject: [PATCH 22/52] test --- .../data/common/search/expressions/esaggs/create_filter.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/data/common/search/expressions/esaggs/create_filter.test.ts b/src/plugins/data/common/search/expressions/esaggs/create_filter.test.ts index 591bcc4947b08a..b78980cb5136e1 100644 --- a/src/plugins/data/common/search/expressions/esaggs/create_filter.test.ts +++ b/src/plugins/data/common/search/expressions/esaggs/create_filter.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { isRangeFilter } from '../../../es_query/filters'; +import { isRangeFilter } from '@kbn/es-query'; import { BytesFormat, FieldFormatsGetConfigFn } from '../../../field_formats'; import { AggConfigs, IAggConfig } from '../../aggs'; import { mockAggTypesRegistry } from '../../aggs/test_helpers'; From 08e5d740f8d25e0e9e1d7d885adfa477cc5e7dd0 Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 7 Jul 2021 18:42:30 +0100 Subject: [PATCH 23/52] mock grammar --- packages/kbn-es-query/BUILD.bazel | 1 + .../kbn-es-query/grammar/__mocks__/grammar.js | 2914 +++++++++++++++++ .../kbn-es-query/grammar/__mocks__/index.ts | 9 + packages/kbn-es-query/grammar/index.ts | 10 + .../src/filters/stubs/fields.mocks.ts | 24 + .../kbn-es-query/src/kuery/ast/ast.test.ts | 2 + packages/kbn-es-query/src/kuery/ast/ast.ts | 1 - .../src/kuery/functions/and.test.ts | 4 +- .../src/kuery/functions/exists.test.ts | 2 + .../kuery/functions/geo_bounding_box.test.ts | 3 +- .../src/kuery/functions/geo_polygon.test.ts | 3 +- .../src/kuery/functions/is.test.ts | 3 +- .../src/kuery/functions/nested.test.ts | 3 +- .../src/kuery/functions/not.test.ts | 4 +- .../src/kuery/functions/or.test.ts | 2 +- .../src/kuery/functions/range.test.ts | 2 +- .../kuery/functions/utils/get_fields.test.ts | 4 +- .../utils/get_full_field_name_node.test.ts | 4 +- .../src/kuery/kuery_syntax_error.test.ts | 2 + .../src/kuery/node_types/function.test.ts | 2 + .../src/kuery/node_types/literal.test.ts | 2 + .../src/kuery/node_types/named_arg.test.ts | 4 +- .../src/kuery/node_types/node_builder.test.ts | 2 + .../src/kuery/node_types/wildcard.test.ts | 2 + 24 files changed, 2992 insertions(+), 17 deletions(-) create mode 100644 packages/kbn-es-query/grammar/__mocks__/grammar.js create mode 100644 packages/kbn-es-query/grammar/__mocks__/index.ts create mode 100644 packages/kbn-es-query/grammar/index.ts diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel index 957ffa49380ccf..3740288d596fbe 100644 --- a/packages/kbn-es-query/BUILD.bazel +++ b/packages/kbn-es-query/BUILD.bazel @@ -12,6 +12,7 @@ SOURCE_FILES = glob( exclude = [ "**/*.test.*", "**/__fixtures__", + "**/__mocks__", ], ) diff --git a/packages/kbn-es-query/grammar/__mocks__/grammar.js b/packages/kbn-es-query/grammar/__mocks__/grammar.js new file mode 100644 index 00000000000000..fb8f3adbcc767a --- /dev/null +++ b/packages/kbn-es-query/grammar/__mocks__/grammar.js @@ -0,0 +1,2914 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/* eslint-disable */ + +module.exports = (function () { + /* + * Generated by PEG.js 0.9.0. + * + * http://pegjs.org/ + */ + + function peg$subclass(child, parent) { + function ctor() { + this.constructor = child; + } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } + + function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = 'SyntaxError'; + + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, peg$SyntaxError); + } + } + + peg$subclass(peg$SyntaxError, Error); + + function peg$parse(input) { + const options = arguments.length > 1 ? arguments[1] : {}; + const parser = this; + + const peg$FAILED = {}; + + const peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral }; + let peg$startRuleFunction = peg$parsestart; + + const peg$c0 = function (query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + if (query !== null) return query; + return nodeTypes.function.buildNode('is', '*', '*'); + }; + const peg$c1 = function (head, query) { + return query; + }; + const peg$c2 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('or', nodes); + }; + const peg$c3 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('and', nodes); + }; + const peg$c4 = function (query) { + if (query.type === 'cursor') return query; + return buildFunctionNode('not', [query]); + }; + const peg$c5 = '('; + const peg$c6 = { type: 'literal', value: '(', description: '"("' }; + const peg$c7 = ')'; + const peg$c8 = { type: 'literal', value: ')', description: '")"' }; + const peg$c9 = function (query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + return query; + }; + const peg$c10 = ':'; + const peg$c11 = { type: 'literal', value: ':', description: '":"' }; + const peg$c12 = '{'; + const peg$c13 = { type: 'literal', value: '{', description: '"{"' }; + const peg$c14 = '}'; + const peg$c15 = { type: 'literal', value: '}', description: '"}"' }; + const peg$c16 = function (field, query, trailing) { + if (query.type === 'cursor') { + return { + ...query, + nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, + }; + } + + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + return buildFunctionNode('nested', [field, query]); + }; + const peg$c17 = { type: 'other', description: 'fieldName' }; + const peg$c18 = function (field, operator, value) { + if (value.type === 'cursor') { + return { + ...value, + suggestionTypes: ['conjunction'], + }; + } + const range = buildNamedArgNode(operator, value); + return buildFunctionNode('range', [field, range]); + }; + const peg$c19 = function (field, partial) { + if (partial.type === 'cursor') { + return { + ...partial, + fieldName: field.value, + suggestionTypes: ['value', 'conjunction'], + }; + } + return partial(field); + }; + const peg$c20 = function (partial) { + if (partial.type === 'cursor') { + const fieldName = `${partial.prefix}${partial.suffix}`.trim(); + return { + ...partial, + fieldName, + suggestionTypes: ['field', 'operator', 'conjunction'], + }; + } + const field = buildLiteralNode(null); + return partial(field); + }; + const peg$c21 = function (partial, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + return partial; + }; + const peg$c22 = function (head, partial) { + return partial; + }; + const peg$c23 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'], + }; + } + return (field) => + buildFunctionNode( + 'or', + nodes.map((partial) => partial(field)) + ); + }; + const peg$c24 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'], + }; + } + return (field) => + buildFunctionNode( + 'and', + nodes.map((partial) => partial(field)) + ); + }; + const peg$c25 = function (partial) { + if (partial.type === 'cursor') { + return { + ...list, + suggestionTypes: ['value'], + }; + } + return (field) => buildFunctionNode('not', [partial(field)]); + }; + const peg$c26 = { type: 'other', description: 'value' }; + const peg$c27 = function (value) { + if (value.type === 'cursor') return value; + const isPhrase = buildLiteralNode(true); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + const peg$c28 = function (value) { + if (value.type === 'cursor') return value; + + if ( + !allowLeadingWildcards && + value.type === 'wildcard' && + nodeTypes.wildcard.hasLeadingWildcard(value) + ) { + error( + 'Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.' + ); + } + + const isPhrase = buildLiteralNode(false); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + const peg$c29 = { type: 'other', description: 'OR' }; + const peg$c30 = 'or'; + const peg$c31 = { type: 'literal', value: 'or', description: '"or"' }; + const peg$c32 = { type: 'other', description: 'AND' }; + const peg$c33 = 'and'; + const peg$c34 = { type: 'literal', value: 'and', description: '"and"' }; + const peg$c35 = { type: 'other', description: 'NOT' }; + const peg$c36 = 'not'; + const peg$c37 = { type: 'literal', value: 'not', description: '"not"' }; + const peg$c38 = { type: 'other', description: 'literal' }; + const peg$c39 = function () { + return parseCursor; + }; + const peg$c40 = '"'; + const peg$c41 = { type: 'literal', value: '"', description: '"\\""' }; + const peg$c42 = function (prefix, cursor, suffix) { + const { start, end } = location(); + return { + type: 'cursor', + start: start.offset, + end: end.offset - cursor.length, + prefix: prefix.join(''), + suffix: suffix.join(''), + text: text().replace(cursor, ''), + }; + }; + const peg$c43 = function (chars) { + return buildLiteralNode(chars.join('')); + }; + const peg$c44 = '\\'; + const peg$c45 = { type: 'literal', value: '\\', description: '"\\\\"' }; + const peg$c46 = /^[\\"]/; + const peg$c47 = { type: 'class', value: '[\\\\"]', description: '[\\\\"]' }; + const peg$c48 = function (char) { + return char; + }; + const peg$c49 = /^[^"]/; + const peg$c50 = { type: 'class', value: '[^"]', description: '[^"]' }; + const peg$c51 = function (chars) { + const sequence = chars.join('').trim(); + if (sequence === 'null') return buildLiteralNode(null); + if (sequence === 'true') return buildLiteralNode(true); + if (sequence === 'false') return buildLiteralNode(false); + if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); + return buildLiteralNode(sequence); + }; + const peg$c52 = { type: 'any', description: 'any character' }; + const peg$c53 = '*'; + const peg$c54 = { type: 'literal', value: '*', description: '"*"' }; + const peg$c55 = function () { + return wildcardSymbol; + }; + const peg$c56 = '\\t'; + const peg$c57 = { type: 'literal', value: '\\t', description: '"\\\\t"' }; + const peg$c58 = function () { + return '\t'; + }; + const peg$c59 = '\\r'; + const peg$c60 = { type: 'literal', value: '\\r', description: '"\\\\r"' }; + const peg$c61 = function () { + return '\r'; + }; + const peg$c62 = '\\n'; + const peg$c63 = { type: 'literal', value: '\\n', description: '"\\\\n"' }; + const peg$c64 = function () { + return '\n'; + }; + const peg$c65 = function (keyword) { + return keyword; + }; + const peg$c66 = /^[\\():<>"*{}]/; + const peg$c67 = { type: 'class', value: '[\\\\():<>"*{}]', description: '[\\\\():<>"*{}]' }; + const peg$c68 = function (sequence) { + return sequence; + }; + const peg$c69 = 'u'; + const peg$c70 = { type: 'literal', value: 'u', description: '"u"' }; + const peg$c71 = function (digits) { + return String.fromCharCode(parseInt(digits, 16)); + }; + const peg$c72 = /^[0-9a-f]/i; + const peg$c73 = { type: 'class', value: '[0-9a-f]i', description: '[0-9a-f]i' }; + const peg$c74 = '<='; + const peg$c75 = { type: 'literal', value: '<=', description: '"<="' }; + const peg$c76 = function () { + return 'lte'; + }; + const peg$c77 = '>='; + const peg$c78 = { type: 'literal', value: '>=', description: '">="' }; + const peg$c79 = function () { + return 'gte'; + }; + const peg$c80 = '<'; + const peg$c81 = { type: 'literal', value: '<', description: '"<"' }; + const peg$c82 = function () { + return 'lt'; + }; + const peg$c83 = '>'; + const peg$c84 = { type: 'literal', value: '>', description: '">"' }; + const peg$c85 = function () { + return 'gt'; + }; + const peg$c86 = { type: 'other', description: 'whitespace' }; + const peg$c87 = /^[ \t\r\n\xA0]/; + const peg$c88 = { + type: 'class', + value: '[\\ \\t\\r\\n\\u00A0]', + description: '[\\ \\t\\r\\n\\u00A0]', + }; + const peg$c89 = '@kuery-cursor@'; + const peg$c90 = { type: 'literal', value: '@kuery-cursor@', description: '"@kuery-cursor@"' }; + const peg$c91 = function () { + return cursorSymbol; + }; + + let peg$currPos = 0; + let peg$savedPos = 0; + const peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }]; + let peg$maxFailPos = 0; + let peg$maxFailExpected = []; + let peg$silentFails = 0; + + const peg$resultsCache = {}; + + let peg$result; + + if ('startRule' in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error('Can\'t start parsing from rule "' + options.startRule + '".'); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function text() { + return input.substring(peg$savedPos, peg$currPos); + } + + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); + } + + function expected(description) { + throw peg$buildException( + null, + [{ type: 'other', description: description }], + input.substring(peg$savedPos, peg$currPos), + peg$computeLocation(peg$savedPos, peg$currPos) + ); + } + + function error(message) { + throw peg$buildException( + message, + null, + input.substring(peg$savedPos, peg$currPos), + peg$computeLocation(peg$savedPos, peg$currPos) + ); + } + + function peg$computePosDetails(pos) { + let details = peg$posDetailsCache[pos]; + let p; + let ch; + + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column, + seenCR: details.seenCR, + }; + + while (p < pos) { + ch = input.charAt(p); + if (ch === '\n') { + if (!details.seenCR) { + details.line++; + } + details.column = 1; + details.seenCR = false; + } else if (ch === '\r' || ch === '\u2028' || ch === '\u2029') { + details.line++; + details.column = 1; + details.seenCR = true; + } else { + details.column++; + details.seenCR = false; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + const startPosDetails = peg$computePosDetails(startPos); + const endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column, + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column, + }, + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { + return; + } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildException(message, expected, found, location) { + function cleanupExpected(expected) { + let i = 1; + + expected.sort(function (a, b) { + if (a.description < b.description) { + return -1; + } else if (a.description > b.description) { + return 1; + } else { + return 0; + } + }); + + while (i < expected.length) { + if (expected[i - 1] === expected[i]) { + expected.splice(i, 1); + } else { + i++; + } + } + } + + function buildMessage(expected, found) { + function stringEscape(s) { + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\x08/g, '\\b') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\f/g, '\\f') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }) + .replace(/[\x10-\x1F\x80-\xFF]/g, function (ch) { + return '\\x' + hex(ch); + }) + .replace(/[\u0100-\u0FFF]/g, function (ch) { + return '\\u0' + hex(ch); + }) + .replace(/[\u1000-\uFFFF]/g, function (ch) { + return '\\u' + hex(ch); + }); + } + + const expectedDescs = new Array(expected.length); + let expectedDesc; + let foundDesc; + let i; + + for (i = 0; i < expected.length; i++) { + expectedDescs[i] = expected[i].description; + } + + expectedDesc = + expected.length > 1 + ? expectedDescs.slice(0, -1).join(', ') + ' or ' + expectedDescs[expected.length - 1] + : expectedDescs[0]; + + foundDesc = found ? '"' + stringEscape(found) + '"' : 'end of input'; + + return 'Expected ' + expectedDesc + ' but ' + foundDesc + ' found.'; + } + + if (expected !== null) { + cleanupExpected(expected); + } + + return new peg$SyntaxError( + message !== null ? message : buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsestart() { + let s0; + let s1; + let s2; + let s3; + + const key = peg$currPos * 37 + 0; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$parseSpace(); + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseSpace(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parseOrQuery(); + if (s2 === peg$FAILED) { + s2 = null; + } + if (s2 !== peg$FAILED) { + s3 = peg$parseOptionalSpace(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseOrQuery() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + const key = peg$currPos * 37 + 1; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseAndQuery(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c2(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseAndQuery(); + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseAndQuery() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + const key = peg$currPos * 37 + 2; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseNotQuery(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c3(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNotQuery(); + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseNotQuery() { + let s0; + let s1; + let s2; + + const key = peg$currPos * 37 + 3; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseNot(); + if (s1 !== peg$FAILED) { + s2 = peg$parseSubQuery(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c4(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseSubQuery(); + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseSubQuery() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + const key = peg$currPos * 37 + 4; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c5; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c6); + } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + if (s2 !== peg$FAILED) { + s3 = peg$parseOrQuery(); + if (s3 !== peg$FAILED) { + s4 = peg$parseOptionalSpace(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c7; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c8); + } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c9(s3, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNestedQuery(); + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseNestedQuery() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + let s6; + let s7; + let s8; + let s9; + + const key = peg$currPos * 37 + 5; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseField(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c10; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c11); + } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseSpace(); + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s5 = peg$c12; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c13); + } + } + if (s5 !== peg$FAILED) { + s6 = []; + s7 = peg$parseSpace(); + while (s7 !== peg$FAILED) { + s6.push(s7); + s7 = peg$parseSpace(); + } + if (s6 !== peg$FAILED) { + s7 = peg$parseOrQuery(); + if (s7 !== peg$FAILED) { + s8 = peg$parseOptionalSpace(); + if (s8 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s9 = peg$c14; + peg$currPos++; + } else { + s9 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c15); + } + } + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c16(s1, s7, s8); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseExpression(); + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseExpression() { + let s0; + + const key = peg$currPos * 37 + 6; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$parseFieldRangeExpression(); + if (s0 === peg$FAILED) { + s0 = peg$parseFieldValueExpression(); + if (s0 === peg$FAILED) { + s0 = peg$parseValueExpression(); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseField() { + let s0; + let s1; + + const key = peg$currPos * 37 + 7; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + peg$silentFails++; + s0 = peg$parseLiteral(); + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c17); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseFieldRangeExpression() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + const key = peg$currPos * 37 + 8; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseField(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + if (s2 !== peg$FAILED) { + s3 = peg$parseRangeOperator(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseSpace(); + } + if (s4 !== peg$FAILED) { + s5 = peg$parseLiteral(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c18(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseFieldValueExpression() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + const key = peg$currPos * 37 + 9; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseField(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c10; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c11); + } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseSpace(); + } + if (s4 !== peg$FAILED) { + s5 = peg$parseListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c19(s1, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseValueExpression() { + let s0; + let s1; + + const key = peg$currPos * 37 + 10; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseValue(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c20(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseListOfValues() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + const key = peg$currPos * 37 + 11; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c5; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c6); + } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + if (s2 !== peg$FAILED) { + s3 = peg$parseOrListOfValues(); + if (s3 !== peg$FAILED) { + s4 = peg$parseOptionalSpace(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c7; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c8); + } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c21(s3, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseValue(); + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseOrListOfValues() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + const key = peg$currPos * 37 + 12; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseAndListOfValues(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c23(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseAndListOfValues(); + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseAndListOfValues() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + const key = peg$currPos * 37 + 13; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseNotListOfValues(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c24(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNotListOfValues(); + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseNotListOfValues() { + let s0; + let s1; + let s2; + + const key = peg$currPos * 37 + 14; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseNot(); + if (s1 !== peg$FAILED) { + s2 = peg$parseListOfValues(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c25(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseListOfValues(); + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseValue() { + let s0; + let s1; + + const key = peg$currPos * 37 + 15; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parseQuotedString(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c27(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseUnquotedLiteral(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c28(s1); + } + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c26); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseOr() { + let s0; + let s1; + let s2; + let s3; + let s4; + + const key = peg$currPos * 37 + 16; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = peg$parseSpace(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseSpace(); + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { + s2 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c31); + } + } + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parseSpace(); + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parseSpace(); + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s1 = [s1, s2, s3]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c29); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseAnd() { + let s0; + let s1; + let s2; + let s3; + let s4; + + const key = peg$currPos * 37 + 17; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = peg$parseSpace(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseSpace(); + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { + s2 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c34); + } + } + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parseSpace(); + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parseSpace(); + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s1 = [s1, s2, s3]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c32); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseNot() { + let s0; + let s1; + let s2; + let s3; + + const key = peg$currPos * 37 + 18; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + peg$silentFails++; + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c37); + } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c35); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseLiteral() { + let s0; + let s1; + + const key = peg$currPos * 37 + 19; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + peg$silentFails++; + s0 = peg$parseQuotedString(); + if (s0 === peg$FAILED) { + s0 = peg$parseUnquotedLiteral(); + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c38); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseQuotedString() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + let s6; + + const key = peg$currPos * 37 + 20; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = void 0; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s2 = peg$c40; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } + } + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parseQuotedCharacter(); + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parseQuotedCharacter(); + } + if (s3 !== peg$FAILED) { + s4 = peg$parseCursor(); + if (s4 !== peg$FAILED) { + s5 = []; + s6 = peg$parseQuotedCharacter(); + while (s6 !== peg$FAILED) { + s5.push(s6); + s6 = peg$parseQuotedCharacter(); + } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s6 = peg$c40; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } + } + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c42(s3, s4, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c40; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseQuotedCharacter(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseQuotedCharacter(); + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c40; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c43(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseQuotedCharacter() { + let s0; + let s1; + let s2; + + const key = peg$currPos * 37 + 21; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$parseEscapedWhitespace(); + if (s0 === peg$FAILED) { + s0 = peg$parseEscapedUnicodeSequence(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c45); + } + } + if (s1 !== peg$FAILED) { + if (peg$c46.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c47); + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c48(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$currPos; + peg$silentFails++; + s2 = peg$parseCursor(); + peg$silentFails--; + if (s2 === peg$FAILED) { + s1 = void 0; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (peg$c49.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c50); + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c48(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseUnquotedLiteral() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + const key = peg$currPos * 37 + 22; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = void 0; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseUnquotedCharacter(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseUnquotedCharacter(); + } + if (s2 !== peg$FAILED) { + s3 = peg$parseCursor(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseUnquotedCharacter(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseUnquotedCharacter(); + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c42(s2, s3, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = []; + s2 = peg$parseUnquotedCharacter(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseUnquotedCharacter(); + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c51(s1); + } + s0 = s1; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseUnquotedCharacter() { + let s0; + let s1; + let s2; + let s3; + let s4; + + const key = peg$currPos * 37 + 23; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$parseEscapedWhitespace(); + if (s0 === peg$FAILED) { + s0 = peg$parseEscapedSpecialCharacter(); + if (s0 === peg$FAILED) { + s0 = peg$parseEscapedUnicodeSequence(); + if (s0 === peg$FAILED) { + s0 = peg$parseEscapedKeyword(); + if (s0 === peg$FAILED) { + s0 = peg$parseWildcard(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$currPos; + peg$silentFails++; + s2 = peg$parseSpecialCharacter(); + peg$silentFails--; + if (s2 === peg$FAILED) { + s1 = void 0; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseKeyword(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = void 0; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s3 = peg$currPos; + peg$silentFails++; + s4 = peg$parseCursor(); + peg$silentFails--; + if (s4 === peg$FAILED) { + s3 = void 0; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + if (input.length > peg$currPos) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c52); + } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c48(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseWildcard() { + let s0; + let s1; + + const key = peg$currPos * 37 + 24; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c53; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c54); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c55(); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseOptionalSpace() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + const key = peg$currPos * 37 + 25; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = void 0; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + if (s2 !== peg$FAILED) { + s3 = peg$parseCursor(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseSpace(); + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c42(s2, s3, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = []; + s1 = peg$parseSpace(); + while (s1 !== peg$FAILED) { + s0.push(s1); + s1 = peg$parseSpace(); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseEscapedWhitespace() { + let s0; + let s1; + + const key = peg$currPos * 37 + 26; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c56) { + s1 = peg$c56; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c57); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c58(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c59) { + s1 = peg$c59; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c60); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c61(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c62) { + s1 = peg$c62; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c63); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c64(); + } + s0 = s1; + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseEscapedSpecialCharacter() { + let s0; + let s1; + let s2; + + const key = peg$currPos * 37 + 27; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c45); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseSpecialCharacter(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c48(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseEscapedKeyword() { + let s0; + let s1; + let s2; + + const key = peg$currPos * 37 + 28; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c45); + } + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { + s2 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c31); + } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { + s2 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c34); + } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { + s2 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c37); + } + } + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c65(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseKeyword() { + let s0; + + const key = peg$currPos * 37 + 29; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$parseOr(); + if (s0 === peg$FAILED) { + s0 = peg$parseAnd(); + if (s0 === peg$FAILED) { + s0 = peg$parseNot(); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseSpecialCharacter() { + let s0; + + const key = peg$currPos * 37 + 30; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + if (peg$c66.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c67); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseEscapedUnicodeSequence() { + let s0; + let s1; + let s2; + + const key = peg$currPos * 37 + 31; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c45); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseUnicodeSequence(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c68(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseUnicodeSequence() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + let s6; + let s7; + + const key = peg$currPos * 37 + 32; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 117) { + s1 = peg$c69; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c70); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = peg$currPos; + s4 = peg$parseHexDigit(); + if (s4 !== peg$FAILED) { + s5 = peg$parseHexDigit(); + if (s5 !== peg$FAILED) { + s6 = peg$parseHexDigit(); + if (s6 !== peg$FAILED) { + s7 = peg$parseHexDigit(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s2 = input.substring(s2, peg$currPos); + } else { + s2 = s3; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c71(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseHexDigit() { + let s0; + + const key = peg$currPos * 37 + 33; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + if (peg$c72.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c73); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseRangeOperator() { + let s0; + let s1; + + const key = peg$currPos * 37 + 34; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c74) { + s1 = peg$c74; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c75); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c76(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c77) { + s1 = peg$c77; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c78); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c79(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 60) { + s1 = peg$c80; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c81); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c82(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 62) { + s1 = peg$c83; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c84); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c85(); + } + s0 = s1; + } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseSpace() { + let s0; + let s1; + + const key = peg$currPos * 37 + 35; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + peg$silentFails++; + if (peg$c87.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c88); + } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c86); + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseCursor() { + let s0; + let s1; + let s2; + + const key = peg$currPos * 37 + 36; + const cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = void 0; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 14) === peg$c89) { + s2 = peg$c89; + peg$currPos += 14; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c90); + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c91(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + const { + parseCursor, + cursorSymbol, + allowLeadingWildcards = true, + helpers: { nodeTypes }, + } = options; + const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; + const buildLiteralNode = nodeTypes.literal.buildNode; + const buildWildcardNode = nodeTypes.wildcard.buildNode; + const buildNamedArgNode = nodeTypes.namedArg.buildNode; + const { wildcardSymbol } = nodeTypes.wildcard; + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail({ type: 'end', description: 'end of input' }); + } + + throw peg$buildException( + null, + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); + } + } + + return { + SyntaxError: peg$SyntaxError, + parse: peg$parse, + }; +})(); diff --git a/packages/kbn-es-query/grammar/__mocks__/index.ts b/packages/kbn-es-query/grammar/__mocks__/index.ts new file mode 100644 index 00000000000000..c8466fead14a14 --- /dev/null +++ b/packages/kbn-es-query/grammar/__mocks__/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { parse } from './grammar'; diff --git a/packages/kbn-es-query/grammar/index.ts b/packages/kbn-es-query/grammar/index.ts new file mode 100644 index 00000000000000..811fa723da3b8d --- /dev/null +++ b/packages/kbn-es-query/grammar/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +// @ts-expect-error +export { parse } from '../../../grammar'; diff --git a/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts b/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts index acd0a4aaacb921..2507293b874771 100644 --- a/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts +++ b/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts @@ -37,6 +37,11 @@ export const fields: IndexPatternFieldBase[] = [ type: 'string', scripted: false, }, + { + name: 'machine.os.raw', + type: 'string', + scripted: false, + }, { name: 'script number', type: 'number', @@ -51,6 +56,25 @@ export const fields: IndexPatternFieldBase[] = [ script: '1234', lang: 'painless', }, + { + name: 'script string', + type: 'string', + scripted: true, + script: '1234', + lang: 'painless', + }, + { + name: 'nestedField.child', + type: 'string', + scripted: false, + subType: { nested: { path: 'nestedField' } }, + }, + { + name: 'nestedField.nestedChild.doublyNestedChild', + type: 'string', + scripted: false, + subType: { nested: { path: 'nestedField.nestedChild' } }, + }, ]; export const getField = (name: string) => fields.find((field) => field.name === name); diff --git a/packages/kbn-es-query/src/kuery/ast/ast.test.ts b/packages/kbn-es-query/src/kuery/ast/ast.test.ts index 54c28ef183cf94..be9e19e78ce9e0 100644 --- a/packages/kbn-es-query/src/kuery/ast/ast.test.ts +++ b/packages/kbn-es-query/src/kuery/ast/ast.test.ts @@ -12,6 +12,8 @@ import { IndexPatternBase } from '../..'; import { KueryNode } from '../types'; import { fields } from '../../filters/stubs'; +jest.mock('../../../grammar'); + describe('kuery AST API', () => { let indexPattern: IndexPatternBase; diff --git a/packages/kbn-es-query/src/kuery/ast/ast.ts b/packages/kbn-es-query/src/kuery/ast/ast.ts index 74af3114c34786..43457eb49b2d5d 100644 --- a/packages/kbn-es-query/src/kuery/ast/ast.ts +++ b/packages/kbn-es-query/src/kuery/ast/ast.ts @@ -11,7 +11,6 @@ import { nodeTypes } from '../node_types/index'; import { KQLSyntaxError } from '../kuery_syntax_error'; import { KueryNode, DslQuery, KueryParseOptions } from '../types'; -// @ts-expect-error import { parse as parseKuery } from '../../../grammar'; import { IndexPatternBase } from '../..'; diff --git a/packages/kbn-es-query/src/kuery/functions/and.test.ts b/packages/kbn-es-query/src/kuery/functions/and.test.ts index e3feca5bb0b0e8..3ff3f01003bdad 100644 --- a/packages/kbn-es-query/src/kuery/functions/and.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/and.test.ts @@ -9,11 +9,11 @@ import { nodeTypes } from '../node_types'; import { fields } from '../../filters/stubs'; import * as ast from '../ast'; - -// @ts-ignore import * as and from './and'; import { IndexPatternBase } from '../../es_query'; +jest.mock('../../../grammar'); + const childNode1 = nodeTypes.function.buildNode('is', 'machine.os', 'osx'); const childNode2 = nodeTypes.function.buildNode('is', 'extension', 'jpg'); diff --git a/packages/kbn-es-query/src/kuery/functions/exists.test.ts b/packages/kbn-es-query/src/kuery/functions/exists.test.ts index b957e8f3af10bc..403a6add442f0a 100644 --- a/packages/kbn-es-query/src/kuery/functions/exists.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/exists.test.ts @@ -10,6 +10,8 @@ import { nodeTypes } from '../node_types'; import { fields } from '../../filters/stubs'; import { IndexPatternBase } from '../..'; +jest.mock('../../../grammar'); + // @ts-ignore import * as exists from './exists'; diff --git a/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts b/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts index 2d7d4e4b4bc944..c14d1a53826774 100644 --- a/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts @@ -11,9 +11,10 @@ import { nodeTypes } from '../node_types'; import { fields } from '../../filters/stubs'; import { IndexPatternBase } from '../..'; -// @ts-ignore import * as geoBoundingBox from './geo_bounding_box'; +jest.mock('../../../grammar'); + const params = { bottomRight: { lat: 50.73, diff --git a/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts b/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts index d0145088b359bf..b862fe00450ac9 100644 --- a/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts @@ -10,9 +10,10 @@ import { nodeTypes } from '../node_types'; import { fields } from '../../filters/stubs'; import { IndexPatternBase } from '../..'; -// @ts-ignore import * as geoPolygon from './geo_polygon'; +jest.mock('../../../grammar'); + const points = [ { lat: 69.77, diff --git a/packages/kbn-es-query/src/kuery/functions/is.test.ts b/packages/kbn-es-query/src/kuery/functions/is.test.ts index 2236b5690c3e3f..f1b05d6215ec6a 100644 --- a/packages/kbn-es-query/src/kuery/functions/is.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/is.test.ts @@ -9,10 +9,11 @@ import { nodeTypes } from '../node_types'; import { fields } from '../../filters/stubs'; -// @ts-ignore import * as is from './is'; import { IndexPatternBase } from '../..'; +jest.mock('../../../grammar'); + describe('kuery functions', () => { describe('is', () => { let indexPattern: IndexPatternBase; diff --git a/packages/kbn-es-query/src/kuery/functions/nested.test.ts b/packages/kbn-es-query/src/kuery/functions/nested.test.ts index 1311fdf63dec90..67f861674b92c2 100644 --- a/packages/kbn-es-query/src/kuery/functions/nested.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/nested.test.ts @@ -12,9 +12,10 @@ import { IndexPatternBase } from '../..'; import * as ast from '../ast'; -// @ts-ignore import * as nested from './nested'; +jest.mock('../../../grammar'); + const childNode = nodeTypes.function.buildNode('is', 'child', 'foo'); describe('kuery functions', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/not.test.ts b/packages/kbn-es-query/src/kuery/functions/not.test.ts index ea99eb15b4a330..ff26487315df2f 100644 --- a/packages/kbn-es-query/src/kuery/functions/not.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/not.test.ts @@ -11,10 +11,10 @@ import { fields } from '../../filters/stubs'; import { IndexPatternBase } from '../..'; import * as ast from '../ast'; - -// @ts-ignore import * as not from './not'; +jest.mock('../../../grammar'); + const childNode = nodeTypes.function.buildNode('is', 'extension', 'jpg'); describe('kuery functions', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/or.test.ts b/packages/kbn-es-query/src/kuery/functions/or.test.ts index 7b096c510a7898..d321bb8fe6f7eb 100644 --- a/packages/kbn-es-query/src/kuery/functions/or.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/or.test.ts @@ -12,8 +12,8 @@ import { IndexPatternBase } from '../..'; import * as ast from '../ast'; -// @ts-ignore import * as or from './or'; +jest.mock('../../../grammar'); const childNode1 = nodeTypes.function.buildNode('is', 'machine.os', 'osx'); const childNode2 = nodeTypes.function.buildNode('is', 'extension', 'jpg'); diff --git a/packages/kbn-es-query/src/kuery/functions/range.test.ts b/packages/kbn-es-query/src/kuery/functions/range.test.ts index e85399bcacfc63..fee9aec382fb34 100644 --- a/packages/kbn-es-query/src/kuery/functions/range.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/range.test.ts @@ -12,8 +12,8 @@ import { fields } from '../../filters/stubs'; import { IndexPatternBase } from '../..'; import { RangeFilterParams } from '../../filters'; -// @ts-ignore import * as range from './range'; +jest.mock('../../../grammar'); describe('kuery functions', () => { describe('range', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts b/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts index 84c86fc3c7e8d8..ed6bd1d12bad01 100644 --- a/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts @@ -10,10 +10,10 @@ import { IndexPatternBase } from '../../..'; import { fields } from '../../../filters/stubs'; import { nodeTypes } from '../../index'; - -// @ts-ignore import { getFields } from './get_fields'; +jest.mock('../../../../grammar'); + describe('getFields', () => { let indexPattern: IndexPatternBase; diff --git a/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts b/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts index 938073b45243a5..bac40128f5335d 100644 --- a/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts @@ -9,10 +9,10 @@ import { nodeTypes } from '../../node_types'; import { fields } from '../../../filters/stubs'; import { IndexPatternBase } from '../../..'; - -// @ts-ignore import { getFullFieldNameNode } from './get_full_field_name_node'; +jest.mock('../../../../grammar'); + describe('getFullFieldNameNode', function () { let indexPattern: IndexPatternBase; diff --git a/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts index 6875bc3e5f74f9..79c5c7374f3bad 100644 --- a/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts @@ -8,6 +8,8 @@ import { fromKueryExpression } from './ast'; +jest.mock('../../grammar'); + describe('kql syntax errors', () => { it('should throw an error for a field query missing a value', () => { expect(() => { diff --git a/packages/kbn-es-query/src/kuery/node_types/function.test.ts b/packages/kbn-es-query/src/kuery/node_types/function.test.ts index e1e0da75394ac5..fb327dc539102d 100644 --- a/packages/kbn-es-query/src/kuery/node_types/function.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/function.test.ts @@ -13,6 +13,8 @@ import { toElasticsearchQuery as isFunctionToElasticsearchQuery } from '../funct import { IndexPatternBase } from '../../es_query'; import { fields } from '../../filters/stubs/fields.mocks'; +jest.mock('../../../grammar'); + describe('kuery node types', () => { describe('function', () => { let indexPattern: IndexPatternBase; diff --git a/packages/kbn-es-query/src/kuery/node_types/literal.test.ts b/packages/kbn-es-query/src/kuery/node_types/literal.test.ts index c370292de38bcc..e6649b23ccdcd7 100644 --- a/packages/kbn-es-query/src/kuery/node_types/literal.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/literal.test.ts @@ -9,6 +9,8 @@ // @ts-ignore import { buildNode, toElasticsearchQuery } from './literal'; +jest.mock('../../../grammar'); + describe('kuery node types', () => { describe('literal', () => { describe('buildNode', () => { diff --git a/packages/kbn-es-query/src/kuery/node_types/named_arg.test.ts b/packages/kbn-es-query/src/kuery/node_types/named_arg.test.ts index 2c3fb43ee0f590..f0edda90694d2c 100644 --- a/packages/kbn-es-query/src/kuery/node_types/named_arg.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/named_arg.test.ts @@ -7,10 +7,10 @@ */ import { nodeTypes } from './index'; - -// @ts-ignore import { buildNode, toElasticsearchQuery } from './named_arg'; +jest.mock('../../../grammar'); + describe('kuery node types', () => { describe('named arg', () => { describe('buildNode', () => { diff --git a/packages/kbn-es-query/src/kuery/node_types/node_builder.test.ts b/packages/kbn-es-query/src/kuery/node_types/node_builder.test.ts index d6439f8e7cc876..fefe2d79fc7eb8 100644 --- a/packages/kbn-es-query/src/kuery/node_types/node_builder.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/node_builder.test.ts @@ -9,6 +9,8 @@ import { nodeBuilder } from './node_builder'; import { toElasticsearchQuery } from '../index'; +jest.mock('../../../grammar'); + describe('nodeBuilder', () => { describe('is method', () => { test('string value', () => { diff --git a/packages/kbn-es-query/src/kuery/node_types/wildcard.test.ts b/packages/kbn-es-query/src/kuery/node_types/wildcard.test.ts index 8c20851cfe3f9a..076bccb334c99f 100644 --- a/packages/kbn-es-query/src/kuery/node_types/wildcard.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/wildcard.test.ts @@ -16,6 +16,8 @@ import { // @ts-ignore } from './wildcard'; +jest.mock('../../../grammar'); + describe('kuery node types', () => { describe('wildcard', () => { describe('buildNode', () => { From 06ac5484fb0f4b48790c3bebe994a07a1ebb812e Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 8 Jul 2021 14:13:28 +0100 Subject: [PATCH 24/52] fix(NA): build for package --- packages/kbn-es-query/BUILD.bazel | 32 ++++++++++++++++--- packages/kbn-es-query/package.json | 6 ++-- .../src/es_query/build_es_query.test.ts | 2 ++ .../src/es_query/from_kuery.test.ts | 2 ++ .../kbn-es-query/src/kuery/ast/ast.test.ts | 2 +- packages/kbn-es-query/src/kuery/ast/ast.ts | 2 +- .../src/kuery/functions/and.test.ts | 2 +- .../src/kuery/functions/exists.test.ts | 2 +- .../kuery/functions/geo_bounding_box.test.ts | 2 +- .../src/kuery/functions/geo_polygon.test.ts | 2 +- .../src/kuery/functions/is.test.ts | 2 +- .../src/kuery/functions/nested.test.ts | 2 +- .../src/kuery/functions/not.test.ts | 2 +- .../src/kuery/functions/or.test.ts | 2 +- .../src/kuery/functions/range.test.ts | 2 +- .../kuery/functions/utils/get_fields.test.ts | 2 +- .../utils/get_full_field_name_node.test.ts | 2 +- .../kuery}/grammar/__mocks__/grammar.js | 0 .../kuery}/grammar/__mocks__/index.ts | 2 +- .../{ => src/kuery}/grammar/index.ts | 0 .../src/kuery/kuery_syntax_error.test.ts | 2 +- .../src/kuery/node_types/function.test.ts | 2 +- .../src/kuery/node_types/literal.test.ts | 2 +- .../src/kuery/node_types/named_arg.test.ts | 2 +- .../src/kuery/node_types/node_builder.test.ts | 2 +- .../src/kuery/node_types/wildcard.test.ts | 2 +- packages/kbn-es-query/tsconfig.browser.json | 21 ++++++++++++ packages/kbn-es-query/tsconfig.json | 7 +++- 28 files changed, 82 insertions(+), 28 deletions(-) rename packages/kbn-es-query/{ => src/kuery}/grammar/__mocks__/grammar.js (100%) rename packages/kbn-es-query/{ => src/kuery}/grammar/__mocks__/index.ts (95%) rename packages/kbn-es-query/{ => src/kuery}/grammar/index.ts (100%) create mode 100644 packages/kbn-es-query/tsconfig.browser.json diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel index 3740288d596fbe..0f81e4db375af2 100644 --- a/packages/kbn-es-query/BUILD.bazel +++ b/packages/kbn-es-query/BUILD.bazel @@ -11,8 +11,9 @@ SOURCE_FILES = glob( ], exclude = [ "**/*.test.*", - "**/__fixtures__", - "**/__mocks__", + "**/__fixtures__/**", + "**/__mocks__/**", + "**/__snapshots__/**", ], ) @@ -69,24 +70,47 @@ ts_config( ], ) +ts_config( + name = "tsconfig_browser", + src = "tsconfig.browser.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.browser.json", + ], +) + ts_project( name = "tsc", args = ['--pretty'], srcs = SRCS, deps = DEPS, declaration = True, + declaration_dir = "target_types", declaration_map = True, incremental = True, - out_dir = "target", + out_dir = "target_node", source_map = True, root_dir = "src", tsconfig = ":tsconfig", ) +ts_project( + name = "tsc_browser", + args = ['--pretty'], + srcs = SRCS, + deps = DEPS, + declaration = False, + incremental = True, + out_dir = "target_web", + source_map = True, + root_dir = "src", + tsconfig = ":tsconfig_browser", +) + js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES + [":grammar"], - deps = DEPS + [":tsc"], + deps = DEPS + [":tsc", ":tsc_browser"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-es-query/package.json b/packages/kbn-es-query/package.json index 36bf5ee4cb1e3a..335ef61b8b3602 100644 --- a/packages/kbn-es-query/package.json +++ b/packages/kbn-es-query/package.json @@ -1,8 +1,8 @@ { "name": "@kbn/es-query", - "main": "./target/index.js", - "browser": "./target/index.js", - "types": "./target/index.d.ts", + "browser": "./target_web/index.js", + "main": "./target_node/index.js", + "types": "./target_types/index.d.ts", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true diff --git a/packages/kbn-es-query/src/es_query/build_es_query.test.ts b/packages/kbn-es-query/src/es_query/build_es_query.test.ts index 737739c5573ba1..d963f9246509b4 100644 --- a/packages/kbn-es-query/src/es_query/build_es_query.test.ts +++ b/packages/kbn-es-query/src/es_query/build_es_query.test.ts @@ -14,6 +14,8 @@ import { MatchAllFilter } from '../filters'; import { fields } from '../filters/stubs'; import { IndexPatternBase } from './types'; +jest.mock('../kuery/grammar'); + describe('build query', () => { const indexPattern: IndexPatternBase = { fields, diff --git a/packages/kbn-es-query/src/es_query/from_kuery.test.ts b/packages/kbn-es-query/src/es_query/from_kuery.test.ts index fb224121c66332..24580138543937 100644 --- a/packages/kbn-es-query/src/es_query/from_kuery.test.ts +++ b/packages/kbn-es-query/src/es_query/from_kuery.test.ts @@ -12,6 +12,8 @@ import { fields } from '../filters/stubs'; import { IndexPatternBase } from './types'; import { Query } from '..'; +jest.mock('../kuery/grammar'); + describe('build query', () => { const indexPattern: IndexPatternBase = { fields, diff --git a/packages/kbn-es-query/src/kuery/ast/ast.test.ts b/packages/kbn-es-query/src/kuery/ast/ast.test.ts index be9e19e78ce9e0..459ace026796c3 100644 --- a/packages/kbn-es-query/src/kuery/ast/ast.test.ts +++ b/packages/kbn-es-query/src/kuery/ast/ast.test.ts @@ -12,7 +12,7 @@ import { IndexPatternBase } from '../..'; import { KueryNode } from '../types'; import { fields } from '../../filters/stubs'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); describe('kuery AST API', () => { let indexPattern: IndexPatternBase; diff --git a/packages/kbn-es-query/src/kuery/ast/ast.ts b/packages/kbn-es-query/src/kuery/ast/ast.ts index 43457eb49b2d5d..6f43098a752de4 100644 --- a/packages/kbn-es-query/src/kuery/ast/ast.ts +++ b/packages/kbn-es-query/src/kuery/ast/ast.ts @@ -11,7 +11,7 @@ import { nodeTypes } from '../node_types/index'; import { KQLSyntaxError } from '../kuery_syntax_error'; import { KueryNode, DslQuery, KueryParseOptions } from '../types'; -import { parse as parseKuery } from '../../../grammar'; +import { parse as parseKuery } from '../grammar'; import { IndexPatternBase } from '../..'; const fromExpression = ( diff --git a/packages/kbn-es-query/src/kuery/functions/and.test.ts b/packages/kbn-es-query/src/kuery/functions/and.test.ts index 3ff3f01003bdad..1e6797485c9648 100644 --- a/packages/kbn-es-query/src/kuery/functions/and.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/and.test.ts @@ -12,7 +12,7 @@ import * as ast from '../ast'; import * as and from './and'; import { IndexPatternBase } from '../../es_query'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); const childNode1 = nodeTypes.function.buildNode('is', 'machine.os', 'osx'); const childNode2 = nodeTypes.function.buildNode('is', 'extension', 'jpg'); diff --git a/packages/kbn-es-query/src/kuery/functions/exists.test.ts b/packages/kbn-es-query/src/kuery/functions/exists.test.ts index 403a6add442f0a..0941e478e816b1 100644 --- a/packages/kbn-es-query/src/kuery/functions/exists.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/exists.test.ts @@ -10,7 +10,7 @@ import { nodeTypes } from '../node_types'; import { fields } from '../../filters/stubs'; import { IndexPatternBase } from '../..'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); // @ts-ignore import * as exists from './exists'; diff --git a/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts b/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts index c14d1a53826774..028c5e39bf5da3 100644 --- a/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/geo_bounding_box.test.ts @@ -13,7 +13,7 @@ import { IndexPatternBase } from '../..'; import * as geoBoundingBox from './geo_bounding_box'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); const params = { bottomRight: { diff --git a/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts b/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts index b862fe00450ac9..f16ca378866f05 100644 --- a/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/geo_polygon.test.ts @@ -12,7 +12,7 @@ import { IndexPatternBase } from '../..'; import * as geoPolygon from './geo_polygon'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); const points = [ { diff --git a/packages/kbn-es-query/src/kuery/functions/is.test.ts b/packages/kbn-es-query/src/kuery/functions/is.test.ts index f1b05d6215ec6a..292159e727a92a 100644 --- a/packages/kbn-es-query/src/kuery/functions/is.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/is.test.ts @@ -12,7 +12,7 @@ import { fields } from '../../filters/stubs'; import * as is from './is'; import { IndexPatternBase } from '../..'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); describe('kuery functions', () => { describe('is', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/nested.test.ts b/packages/kbn-es-query/src/kuery/functions/nested.test.ts index 67f861674b92c2..47e515b9bd47fc 100644 --- a/packages/kbn-es-query/src/kuery/functions/nested.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/nested.test.ts @@ -14,7 +14,7 @@ import * as ast from '../ast'; import * as nested from './nested'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); const childNode = nodeTypes.function.buildNode('is', 'child', 'foo'); diff --git a/packages/kbn-es-query/src/kuery/functions/not.test.ts b/packages/kbn-es-query/src/kuery/functions/not.test.ts index ff26487315df2f..a44f3e9c5dda84 100644 --- a/packages/kbn-es-query/src/kuery/functions/not.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/not.test.ts @@ -13,7 +13,7 @@ import { IndexPatternBase } from '../..'; import * as ast from '../ast'; import * as not from './not'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); const childNode = nodeTypes.function.buildNode('is', 'extension', 'jpg'); diff --git a/packages/kbn-es-query/src/kuery/functions/or.test.ts b/packages/kbn-es-query/src/kuery/functions/or.test.ts index d321bb8fe6f7eb..15faa7e1753d3b 100644 --- a/packages/kbn-es-query/src/kuery/functions/or.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/or.test.ts @@ -13,7 +13,7 @@ import { IndexPatternBase } from '../..'; import * as ast from '../ast'; import * as or from './or'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); const childNode1 = nodeTypes.function.buildNode('is', 'machine.os', 'osx'); const childNode2 = nodeTypes.function.buildNode('is', 'extension', 'jpg'); diff --git a/packages/kbn-es-query/src/kuery/functions/range.test.ts b/packages/kbn-es-query/src/kuery/functions/range.test.ts index fee9aec382fb34..fa1805e64887ca 100644 --- a/packages/kbn-es-query/src/kuery/functions/range.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/range.test.ts @@ -13,7 +13,7 @@ import { IndexPatternBase } from '../..'; import { RangeFilterParams } from '../../filters'; import * as range from './range'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); describe('kuery functions', () => { describe('range', () => { diff --git a/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts b/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts index ed6bd1d12bad01..4125b0a5725660 100644 --- a/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/utils/get_fields.test.ts @@ -12,7 +12,7 @@ import { fields } from '../../../filters/stubs'; import { nodeTypes } from '../../index'; import { getFields } from './get_fields'; -jest.mock('../../../../grammar'); +jest.mock('../../grammar'); describe('getFields', () => { let indexPattern: IndexPatternBase; diff --git a/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts b/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts index bac40128f5335d..dccfc5d1c463a1 100644 --- a/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/utils/get_full_field_name_node.test.ts @@ -11,7 +11,7 @@ import { fields } from '../../../filters/stubs'; import { IndexPatternBase } from '../../..'; import { getFullFieldNameNode } from './get_full_field_name_node'; -jest.mock('../../../../grammar'); +jest.mock('../../grammar'); describe('getFullFieldNameNode', function () { let indexPattern: IndexPatternBase; diff --git a/packages/kbn-es-query/grammar/__mocks__/grammar.js b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js similarity index 100% rename from packages/kbn-es-query/grammar/__mocks__/grammar.js rename to packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js diff --git a/packages/kbn-es-query/grammar/__mocks__/index.ts b/packages/kbn-es-query/src/kuery/grammar/__mocks__/index.ts similarity index 95% rename from packages/kbn-es-query/grammar/__mocks__/index.ts rename to packages/kbn-es-query/src/kuery/grammar/__mocks__/index.ts index c8466fead14a14..9103c852c48456 100644 --- a/packages/kbn-es-query/grammar/__mocks__/index.ts +++ b/packages/kbn-es-query/src/kuery/grammar/__mocks__/index.ts @@ -5,5 +5,5 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ - +// @ts-expect-error export { parse } from './grammar'; diff --git a/packages/kbn-es-query/grammar/index.ts b/packages/kbn-es-query/src/kuery/grammar/index.ts similarity index 100% rename from packages/kbn-es-query/grammar/index.ts rename to packages/kbn-es-query/src/kuery/grammar/index.ts diff --git a/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts index 79c5c7374f3bad..a755f2b6efe64a 100644 --- a/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts @@ -8,7 +8,7 @@ import { fromKueryExpression } from './ast'; -jest.mock('../../grammar'); +jest.mock('./grammar'); describe('kql syntax errors', () => { it('should throw an error for a field query missing a value', () => { diff --git a/packages/kbn-es-query/src/kuery/node_types/function.test.ts b/packages/kbn-es-query/src/kuery/node_types/function.test.ts index fb327dc539102d..5df6ba1916046b 100644 --- a/packages/kbn-es-query/src/kuery/node_types/function.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/function.test.ts @@ -13,7 +13,7 @@ import { toElasticsearchQuery as isFunctionToElasticsearchQuery } from '../funct import { IndexPatternBase } from '../../es_query'; import { fields } from '../../filters/stubs/fields.mocks'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); describe('kuery node types', () => { describe('function', () => { diff --git a/packages/kbn-es-query/src/kuery/node_types/literal.test.ts b/packages/kbn-es-query/src/kuery/node_types/literal.test.ts index e6649b23ccdcd7..7a36be704a6095 100644 --- a/packages/kbn-es-query/src/kuery/node_types/literal.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/literal.test.ts @@ -9,7 +9,7 @@ // @ts-ignore import { buildNode, toElasticsearchQuery } from './literal'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); describe('kuery node types', () => { describe('literal', () => { diff --git a/packages/kbn-es-query/src/kuery/node_types/named_arg.test.ts b/packages/kbn-es-query/src/kuery/node_types/named_arg.test.ts index f0edda90694d2c..fa944660288d55 100644 --- a/packages/kbn-es-query/src/kuery/node_types/named_arg.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/named_arg.test.ts @@ -9,7 +9,7 @@ import { nodeTypes } from './index'; import { buildNode, toElasticsearchQuery } from './named_arg'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); describe('kuery node types', () => { describe('named arg', () => { diff --git a/packages/kbn-es-query/src/kuery/node_types/node_builder.test.ts b/packages/kbn-es-query/src/kuery/node_types/node_builder.test.ts index fefe2d79fc7eb8..aefd40c6db3fb6 100644 --- a/packages/kbn-es-query/src/kuery/node_types/node_builder.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/node_builder.test.ts @@ -9,7 +9,7 @@ import { nodeBuilder } from './node_builder'; import { toElasticsearchQuery } from '../index'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); describe('nodeBuilder', () => { describe('is method', () => { diff --git a/packages/kbn-es-query/src/kuery/node_types/wildcard.test.ts b/packages/kbn-es-query/src/kuery/node_types/wildcard.test.ts index 076bccb334c99f..9f444eec82b69b 100644 --- a/packages/kbn-es-query/src/kuery/node_types/wildcard.test.ts +++ b/packages/kbn-es-query/src/kuery/node_types/wildcard.test.ts @@ -16,7 +16,7 @@ import { // @ts-ignore } from './wildcard'; -jest.mock('../../../grammar'); +jest.mock('../grammar'); describe('kuery node types', () => { describe('wildcard', () => { diff --git a/packages/kbn-es-query/tsconfig.browser.json b/packages/kbn-es-query/tsconfig.browser.json new file mode 100644 index 00000000000000..0a1c21cc8e05b6 --- /dev/null +++ b/packages/kbn-es-query/tsconfig.browser.json @@ -0,0 +1,21 @@ +{ + "extends": "../../tsconfig.browser.json", + "compilerOptions": { + "incremental": true, + "outDir": "./target_web", + "declaration": false, + "sourceMap": true, + "sourceRoot": "../../../../packages/kbn-es-query/src", + "types": [ + "jest", + "node" + ], + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "**/__fixtures__/**/*", + "**/__mocks__/**/*" + ] +} diff --git a/packages/kbn-es-query/tsconfig.json b/packages/kbn-es-query/tsconfig.json index 72e9767a7b7702..866004ef2dbd4d 100644 --- a/packages/kbn-es-query/tsconfig.json +++ b/packages/kbn-es-query/tsconfig.json @@ -2,7 +2,8 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "incremental": true, - "outDir": "target", + "declarationDir": "./target_types", + "outDir": "./target_node", "declaration": true, "declarationMap": true, "sourceMap": true, @@ -14,5 +15,9 @@ }, "include": [ "src/**/*" + ], + "exclude": [ + "**/__fixtures__/**/*", + "**/__mocks__/**/*" ] } From 7096c571dd1739e6fd56c90c5794de7a5e65fc25 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 12 Jul 2021 11:02:12 +0100 Subject: [PATCH 25/52] imports \ exports --- src/plugins/data/common/es_query/index.ts | 9 +++++++++ .../search/search_source/create_search_source.test.ts | 2 +- src/plugins/data/public/index.ts | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/data/common/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index b6389b99928fbc..4c9519b5a47483 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -34,6 +34,15 @@ export { buildExistsFilter, toggleFilterNegated, Filter, + ExistsFilter, + GeoPolygonFilter, + PhraseFilter, + MatchAllFilter, + CustomFilter, + MissingFilter, + RangeFilter, + GeoBoundingBoxFilter, + KueryNode, FilterMeta, FilterStateStore, FILTERS, diff --git a/src/plugins/data/common/search/search_source/create_search_source.test.ts b/src/plugins/data/common/search/search_source/create_search_source.test.ts index 6a6ac1dfa93e7e..c084b029a5bd2d 100644 --- a/src/plugins/data/common/search/search_source/create_search_source.test.ts +++ b/src/plugins/data/common/search/search_source/create_search_source.test.ts @@ -10,7 +10,7 @@ import { createSearchSource as createSearchSourceFactory } from './create_search import { SearchSourceDependencies } from './search_source'; import { IIndexPattern } from '../../index_patterns'; import { IndexPatternsContract } from '../../index_patterns/index_patterns'; -import { Filter } from '../../es_query/filters'; +import { Filter } from '../../es_query'; describe('createSearchSource', () => { const indexPatternMock: IIndexPattern = {} as IIndexPattern; diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index e2abaf8d9a331c..270182bec2bf6b 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -106,6 +106,7 @@ export const esFilters = { * @deprecated Import from `@kbn/es-query` directly. */ export { + KueryNode, RangeFilter, RangeFilterMeta, RangeFilterParams, From a085c1510fbc3703eec156ef006c4d3fe662a6a1 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 12 Jul 2021 11:38:25 +0100 Subject: [PATCH 26/52] docs and ts projects --- ...plugin-plugins-data-public.customfilter.md | 13 - ...na-plugin-plugins-data-public.esfilters.md | 44 +-- ...bana-plugin-plugins-data-public.eskuery.md | 6 +- ...bana-plugin-plugins-data-public.esquery.md | 6 +- ...lic.esqueryconfig.allowleadingwildcards.md | 11 - ...-data-public.esqueryconfig.dateformattz.md | 11 - ...eryconfig.ignorefilteriffieldnotinindex.md | 11 - ...lugin-plugins-data-public.esqueryconfig.md | 21 -- ...public.esqueryconfig.querystringoptions.md | 11 - ...plugin-plugins-data-public.existsfilter.md | 14 - ...ibana-plugin-plugins-data-public.filter.md | 15 - ...bana-plugin-plugins-data-public.gettime.md | 4 +- ...lugin-plugins-data-public.ifieldsubtype.md | 19 -- ...plugins-data-public.ifieldsubtype.multi.md | 13 - ...lugins-data-public.ifieldsubtype.nested.md | 13 - ...n-plugins-data-public.indexpatternfield.md | 2 +- ...s-data-public.indexpatternfield.subtype.md | 2 +- ...ns-data-public.indexpatternfield.tojson.md | 4 +- ...ana-plugin-plugins-data-public.isfilter.md | 11 - ...na-plugin-plugins-data-public.isfilters.md | 11 - ...na-plugin-plugins-data-public.kuerynode.md | 18 - ...ugin-plugins-data-public.kuerynode.type.md | 11 - ...ugin-plugins-data-public.matchallfilter.md | 14 - .../kibana-plugin-plugins-data-public.md | 15 - ...plugin-plugins-data-public.phrasefilter.md | 20 -- ...lugin-plugins-data-public.phrasesfilter.md | 13 - ...kibana-plugin-plugins-data-public.query.md | 16 - ...-plugin-plugins-data-public.rangefilter.md | 21 -- ...gin-plugins-data-public.rangefiltermeta.md | 15 - ...ns-data-public.rangefilterparams.format.md | 11 - ...gins-data-public.rangefilterparams.from.md | 11 - ...lugins-data-public.rangefilterparams.gt.md | 11 - ...ugins-data-public.rangefilterparams.gte.md | 11 - ...lugins-data-public.rangefilterparams.lt.md | 11 - ...ugins-data-public.rangefilterparams.lte.md | 11 - ...n-plugins-data-public.rangefilterparams.md | 24 -- ...lugins-data-public.rangefilterparams.to.md | 11 - ...s-data-public.searchsourcefields.filter.md | 1 - ...-plugins-data-public.searchsourcefields.md | 4 +- ...ns-data-public.searchsourcefields.query.md | 1 - ...na-plugin-plugins-data-server.esfilters.md | 14 +- ...bana-plugin-plugins-data-server.eskuery.md | 6 +- ...bana-plugin-plugins-data-server.esquery.md | 6 +- ...ver.esqueryconfig.allowleadingwildcards.md | 11 - ...-data-server.esqueryconfig.dateformattz.md | 11 - ...eryconfig.ignorefilteriffieldnotinindex.md | 11 - ...lugin-plugins-data-server.esqueryconfig.md | 21 -- ...server.esqueryconfig.querystringoptions.md | 11 - ...ibana-plugin-plugins-data-server.filter.md | 15 - ...bana-plugin-plugins-data-server.gettime.md | 4 +- ...lugin-plugins-data-server.ifieldsubtype.md | 19 -- ...plugins-data-server.ifieldsubtype.multi.md | 13 - ...lugins-data-server.ifieldsubtype.nested.md | 13 - ...na-plugin-plugins-data-server.kuerynode.md | 18 - ...ugin-plugins-data-server.kuerynode.type.md | 11 - .../kibana-plugin-plugins-data-server.md | 5 - ...kibana-plugin-plugins-data-server.query.md | 16 - packages/kbn-es-query/tsconfig.json | 2 +- src/plugins/data/public/index.ts | 1 + src/plugins/data/public/public.api.md | 317 ++++++------------ src/plugins/data/server/server.api.md | 168 ++++------ 61 files changed, 214 insertions(+), 971 deletions(-) delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.multi.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.nested.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.type.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.format.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.from.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gt.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gte.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lt.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lte.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.to.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.multi.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.nested.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.type.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.md diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md deleted file mode 100644 index 0a3b4e54cfe55b..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [CustomFilter](./kibana-plugin-plugins-data-public.customfilter.md) - -## CustomFilter type - -Signature: - -```typescript -export declare type CustomFilter = Filter & { - query: any; -}; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md index d06ce1b2ef2bc0..d816763e51e75c 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md @@ -12,21 +12,21 @@ esFilters: { FilterItem: (props: import("./ui/filter_bar/filter_item").FilterItemProps) => JSX.Element; FILTERS: typeof FILTERS; FilterStateStore: typeof FilterStateStore; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; - 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").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; - isRangeFilter: (filter: any) => filter is import("../common").RangeFilter; - isMatchAllFilter: (filter: any) => filter is import("../common").MatchAllFilter; - isMissingFilter: (filter: any) => filter is import("../common").MissingFilter; - isQueryStringFilter: (filter: any) => filter is import("../common").QueryStringFilter; - isFilterPinned: (filter: import("../common").Filter) => boolean | undefined; - toggleFilterNegated: (filter: import("../common").Filter) => { + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isPhraseFilter: (filter: any) => filter is import("@kbn/es-query").PhraseFilter; + isExistsFilter: (filter: any) => filter is import("@kbn/es-query").ExistsFilter; + isPhrasesFilter: (filter: any) => filter is import("@kbn/es-query").PhrasesFilter; + isRangeFilter: (filter: any) => filter is import("@kbn/es-query").RangeFilter; + isMatchAllFilter: (filter: any) => filter is import("@kbn/es-query").MatchAllFilter; + isMissingFilter: (filter: any) => filter is import("@kbn/es-query").MissingFilter; + isQueryStringFilter: (filter: any) => filter is import("@kbn/es-query").QueryStringFilter; + isFilterPinned: (filter: import("@kbn/es-query").Filter) => boolean | undefined; + toggleFilterNegated: (filter: import("@kbn/es-query").Filter) => { meta: { negate: boolean; alias: string | null; @@ -39,20 +39,20 @@ esFilters: { params?: any; value?: string | undefined; }; - $state?: import("../common").FilterState | undefined; + $state?: import("@kbn/es-query/target_types/filters/types").FilterState | undefined; query?: any; }; - disableFilter: (filter: import("../common").Filter) => import("../common").Filter; - getPhraseFilterField: (filter: import("../common").PhraseFilter) => string; - getPhraseFilterValue: (filter: import("../common").PhraseFilter) => string | number | boolean; + disableFilter: (filter: import("@kbn/es-query").Filter) => import("@kbn/es-query").Filter; + getPhraseFilterField: (filter: import("@kbn/es-query").PhraseFilter) => string; + getPhraseFilterValue: (filter: import("@kbn/es-query").PhraseFilter) => string | number | boolean; getDisplayValueFromFilter: typeof getDisplayValueFromFilter; - compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; + compareFilters: (first: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], second: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions; generateFilters: typeof generateFilters; - onlyDisabledFiltersChanged: (newFilters?: import("../common").Filter[] | undefined, oldFilters?: import("../common").Filter[] | undefined) => boolean; + onlyDisabledFiltersChanged: (newFilters?: import("@kbn/es-query").Filter[] | undefined, oldFilters?: import("@kbn/es-query").Filter[] | undefined) => boolean; changeTimeFilter: typeof changeTimeFilter; convertRangeFilterToTimeRangeString: typeof convertRangeFilterToTimeRangeString; - mapAndFlattenFilters: (filters: import("../common").Filter[]) => import("../common").Filter[]; + mapAndFlattenFilters: (filters: import("@kbn/es-query").Filter[]) => import("@kbn/es-query").Filter[]; extractTimeFilter: typeof extractTimeFilter; extractTimeRange: typeof extractTimeRange; } diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md index 332114e6375863..9debef0e596f1d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md @@ -8,8 +8,8 @@ ```typescript esKuery: { - nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; - toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; } ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md index 0bc9c0c12fc3a4..11d24b81490faa 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md @@ -10,11 +10,11 @@ esQuery: { buildEsQuery: typeof buildEsQuery; getEsQueryConfig: typeof getEsQueryConfig; - buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../common").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../common").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; luceneStringToDsl: typeof luceneStringToDsl; decorateQuery: typeof decorateQuery; diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md deleted file mode 100644 index 71eb23ac6299b6..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) > [allowLeadingWildcards](./kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md) - -## EsQueryConfig.allowLeadingWildcards property - -Signature: - -```typescript -allowLeadingWildcards: boolean; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md deleted file mode 100644 index e9c4c26878a974..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) > [dateFormatTZ](./kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md) - -## EsQueryConfig.dateFormatTZ property - -Signature: - -```typescript -dateFormatTZ?: string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md deleted file mode 100644 index 9f765c51d0a698..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) > [ignoreFilterIfFieldNotInIndex](./kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md) - -## EsQueryConfig.ignoreFilterIfFieldNotInIndex property - -Signature: - -```typescript -ignoreFilterIfFieldNotInIndex: boolean; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md deleted file mode 100644 index 5252f8058b488f..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md +++ /dev/null @@ -1,21 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) - -## EsQueryConfig interface - -Signature: - -```typescript -export interface EsQueryConfig -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [allowLeadingWildcards](./kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md) | boolean | | -| [dateFormatTZ](./kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md) | string | | -| [ignoreFilterIfFieldNotInIndex](./kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md) | boolean | | -| [queryStringOptions](./kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md) | Record<string, any> | | - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md deleted file mode 100644 index feaa8f1821e307..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) > [queryStringOptions](./kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md) - -## EsQueryConfig.queryStringOptions property - -Signature: - -```typescript -queryStringOptions: Record; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md deleted file mode 100644 index f1279934db84c4..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md +++ /dev/null @@ -1,14 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ExistsFilter](./kibana-plugin-plugins-data-public.existsfilter.md) - -## ExistsFilter type - -Signature: - -```typescript -export declare type ExistsFilter = Filter & { - meta: ExistsFilterMeta; - exists?: FilterExistsProperty; -}; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md deleted file mode 100644 index 9212b757e07dfc..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md +++ /dev/null @@ -1,15 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Filter](./kibana-plugin-plugins-data-public.filter.md) - -## Filter type - -Signature: - -```typescript -export declare type Filter = { - $state?: FilterState; - meta: FilterMeta; - query?: any; -}; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md index 3969a97fa7789f..7fd1914d1a4a59 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md @@ -10,7 +10,7 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("../..").RangeFilter | undefined; +}): import("@kbn/es-query").RangeFilter | undefined; ``` ## Parameters @@ -23,5 +23,5 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRan Returns: -`import("../..").RangeFilter | undefined` +`import("@kbn/es-query").RangeFilter | undefined` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md deleted file mode 100644 index 7e6ea86d7f3e87..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md +++ /dev/null @@ -1,19 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) - -## IFieldSubType interface - -Signature: - -```typescript -export interface IFieldSubType -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [multi](./kibana-plugin-plugins-data-public.ifieldsubtype.multi.md) | {
parent: string;
} | | -| [nested](./kibana-plugin-plugins-data-public.ifieldsubtype.nested.md) | {
path: string;
} | | - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.multi.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.multi.md deleted file mode 100644 index 6cfc6f037d0135..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.multi.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) > [multi](./kibana-plugin-plugins-data-public.ifieldsubtype.multi.md) - -## IFieldSubType.multi property - -Signature: - -```typescript -multi?: { - parent: string; - }; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.nested.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.nested.md deleted file mode 100644 index f9308b90a1b96d..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.nested.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) > [nested](./kibana-plugin-plugins-data-public.ifieldsubtype.nested.md) - -## IFieldSubType.nested property - -Signature: - -```typescript -nested?: { - path: string; - }; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md index 16546ceca958d7..dc206ceabefe27 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md @@ -37,7 +37,7 @@ export declare class IndexPatternField implements IFieldType | [searchable](./kibana-plugin-plugins-data-public.indexpatternfield.searchable.md) | | boolean | | | [sortable](./kibana-plugin-plugins-data-public.indexpatternfield.sortable.md) | | boolean | | | [spec](./kibana-plugin-plugins-data-public.indexpatternfield.spec.md) | | FieldSpec | | -| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("../..").IFieldSubType | undefined | | +| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("@kbn/es-query").IFieldSubType | undefined | | | [type](./kibana-plugin-plugins-data-public.indexpatternfield.type.md) | | string | | | [visualizable](./kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md) | | boolean | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md index 6cd5247291602d..f5e25e3191f724 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md @@ -7,5 +7,5 @@ Signature: ```typescript -get subType(): import("../..").IFieldSubType | undefined; +get subType(): import("@kbn/es-query").IFieldSubType | undefined; ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md index b77f3d1f374fbf..9afcef6afed3ae 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md @@ -19,7 +19,7 @@ toJSON(): { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../..").IFieldSubType | undefined; + subType: import("@kbn/es-query").IFieldSubType | undefined; customLabel: string | undefined; }; ``` @@ -37,7 +37,7 @@ toJSON(): { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../..").IFieldSubType | undefined; + subType: import("@kbn/es-query").IFieldSubType | undefined; customLabel: string | undefined; }` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md deleted file mode 100644 index f1916e89c2c98e..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [isFilter](./kibana-plugin-plugins-data-public.isfilter.md) - -## isFilter variable - -Signature: - -```typescript -isFilter: (x: unknown) => x is Filter -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md deleted file mode 100644 index 558da72cc26bb4..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [isFilters](./kibana-plugin-plugins-data-public.isfilters.md) - -## isFilters variable - -Signature: - -```typescript -isFilters: (x: unknown) => x is Filter[] -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md deleted file mode 100644 index 276f25da8cb9f3..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md +++ /dev/null @@ -1,18 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) - -## KueryNode interface - -Signature: - -```typescript -export interface KueryNode -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [type](./kibana-plugin-plugins-data-public.kuerynode.type.md) | keyof NodeTypes | | - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.type.md deleted file mode 100644 index 2ff96b6421c2ef..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.type.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) > [type](./kibana-plugin-plugins-data-public.kuerynode.type.md) - -## KueryNode.type property - -Signature: - -```typescript -type: keyof NodeTypes; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md deleted file mode 100644 index 740b83bb5c5636..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md +++ /dev/null @@ -1,14 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [MatchAllFilter](./kibana-plugin-plugins-data-public.matchallfilter.md) - -## MatchAllFilter type - -Signature: - -```typescript -export declare type MatchAllFilter = Filter & { - meta: MatchAllFilterMeta; - match_all: any; -}; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md index 65c4601d5faec9..03cc9383d3343a 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md @@ -61,11 +61,9 @@ | [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) | Data plugin public Start contract | | [DataPublicPluginStartActions](./kibana-plugin-plugins-data-public.datapublicpluginstartactions.md) | utilities to generate filters from action context | | [DataPublicPluginStartUi](./kibana-plugin-plugins-data-public.datapublicpluginstartui.md) | Data plugin prewired UI components | -| [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) | | | [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) | | | [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) | | | [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md) | | -| [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) | | | [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) | | | [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) | | | [IIndexPatternFieldList](./kibana-plugin-plugins-data-public.iindexpatternfieldlist.md) | | @@ -78,7 +76,6 @@ | [ISearchSetup](./kibana-plugin-plugins-data-public.isearchsetup.md) | The setup contract exposed by the Search plugin exposes the search strategy extension point. | | [ISearchStart](./kibana-plugin-plugins-data-public.isearchstart.md) | search service | | [ISearchStartSearchSource](./kibana-plugin-plugins-data-public.isearchstartsearchsource.md) | high level search service | -| [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) | | | [OptionedValueProp](./kibana-plugin-plugins-data-public.optionedvalueprop.md) | | | [QueryState](./kibana-plugin-plugins-data-public.querystate.md) | All query state service state | | [QueryStateChange](./kibana-plugin-plugins-data-public.querystatechange.md) | | @@ -86,7 +83,6 @@ | [QuerySuggestionBasic](./kibana-plugin-plugins-data-public.querysuggestionbasic.md) | \* | | [QuerySuggestionField](./kibana-plugin-plugins-data-public.querysuggestionfield.md) | \* | | [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) | \* | -| [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) | | | [Reason](./kibana-plugin-plugins-data-public.reason.md) | | | [RefreshInterval](./kibana-plugin-plugins-data-public.refreshinterval.md) | | | [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) | | @@ -123,8 +119,6 @@ | [injectSearchSourceReferences](./kibana-plugin-plugins-data-public.injectsearchsourcereferences.md) | | | [isCompleteResponse](./kibana-plugin-plugins-data-public.iscompleteresponse.md) | | | [isErrorResponse](./kibana-plugin-plugins-data-public.iserrorresponse.md) | | -| [isFilter](./kibana-plugin-plugins-data-public.isfilter.md) | | -| [isFilters](./kibana-plugin-plugins-data-public.isfilters.md) | | | [isPartialResponse](./kibana-plugin-plugins-data-public.ispartialresponse.md) | | | [isQuery](./kibana-plugin-plugins-data-public.isquery.md) | | | [isTimeRange](./kibana-plugin-plugins-data-public.istimerange.md) | | @@ -147,13 +141,11 @@ | [AggsStart](./kibana-plugin-plugins-data-public.aggsstart.md) | AggsStart represents the actual external contract as AggsCommonStart is only used internally. The difference is that AggsStart includes the typings for the registry with initialized agg types. | | [AutocompleteStart](./kibana-plugin-plugins-data-public.autocompletestart.md) | \* | | [AutoRefreshDoneFn](./kibana-plugin-plugins-data-public.autorefreshdonefn.md) | | -| [CustomFilter](./kibana-plugin-plugins-data-public.customfilter.md) | | | [EsaggsExpressionFunctionDefinition](./kibana-plugin-plugins-data-public.esaggsexpressionfunctiondefinition.md) | | | [EsdslExpressionFunctionDefinition](./kibana-plugin-plugins-data-public.esdslexpressionfunctiondefinition.md) | | | [EsQuerySortValue](./kibana-plugin-plugins-data-public.esquerysortvalue.md) | | | [EsRawResponseExpressionTypeDefinition](./kibana-plugin-plugins-data-public.esrawresponseexpressiontypedefinition.md) | | | [ExecutionContextSearch](./kibana-plugin-plugins-data-public.executioncontextsearch.md) | | -| [ExistsFilter](./kibana-plugin-plugins-data-public.existsfilter.md) | | | [ExpressionFunctionKibana](./kibana-plugin-plugins-data-public.expressionfunctionkibana.md) | | | [ExpressionFunctionKibanaContext](./kibana-plugin-plugins-data-public.expressionfunctionkibanacontext.md) | | | [ExpressionValueSearchContext](./kibana-plugin-plugins-data-public.expressionvaluesearchcontext.md) | | @@ -161,7 +153,6 @@ | [FieldFormatsContentType](./kibana-plugin-plugins-data-public.fieldformatscontenttype.md) | \* | | [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md) | | | [FieldFormatsStart](./kibana-plugin-plugins-data-public.fieldformatsstart.md) | | -| [Filter](./kibana-plugin-plugins-data-public.filter.md) | | | [IAggConfig](./kibana-plugin-plugins-data-public.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. | | [IAggType](./kibana-plugin-plugins-data-public.iaggtype.md) | | | [IEsError](./kibana-plugin-plugins-data-public.ieserror.md) | | @@ -180,16 +171,10 @@ | [ISessionsClient](./kibana-plugin-plugins-data-public.isessionsclient.md) | | | [ISessionService](./kibana-plugin-plugins-data-public.isessionservice.md) | | | [KibanaContext](./kibana-plugin-plugins-data-public.kibanacontext.md) | | -| [MatchAllFilter](./kibana-plugin-plugins-data-public.matchallfilter.md) | | | [ParsedInterval](./kibana-plugin-plugins-data-public.parsedinterval.md) | | -| [PhraseFilter](./kibana-plugin-plugins-data-public.phrasefilter.md) | | -| [PhrasesFilter](./kibana-plugin-plugins-data-public.phrasesfilter.md) | | -| [Query](./kibana-plugin-plugins-data-public.query.md) | | | [QueryStart](./kibana-plugin-plugins-data-public.querystart.md) | | | [QuerySuggestion](./kibana-plugin-plugins-data-public.querysuggestion.md) | \* | | [QuerySuggestionGetFn](./kibana-plugin-plugins-data-public.querysuggestiongetfn.md) | | -| [RangeFilter](./kibana-plugin-plugins-data-public.rangefilter.md) | | -| [RangeFilterMeta](./kibana-plugin-plugins-data-public.rangefiltermeta.md) | | | [SavedQueryTimeFilter](./kibana-plugin-plugins-data-public.savedquerytimefilter.md) | | | [SearchBarProps](./kibana-plugin-plugins-data-public.searchbarprops.md) | | | [StatefulSearchBarProps](./kibana-plugin-plugins-data-public.statefulsearchbarprops.md) | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md deleted file mode 100644 index 8d0447d58634c9..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md +++ /dev/null @@ -1,20 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [PhraseFilter](./kibana-plugin-plugins-data-public.phrasefilter.md) - -## PhraseFilter type - -Signature: - -```typescript -export declare type PhraseFilter = Filter & { - meta: PhraseFilterMeta; - script?: { - script: { - source?: any; - lang?: estypes.ScriptLanguage; - params: any; - }; - }; -}; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md deleted file mode 100644 index ab205cb62fd149..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [PhrasesFilter](./kibana-plugin-plugins-data-public.phrasesfilter.md) - -## PhrasesFilter type - -Signature: - -```typescript -export declare type PhrasesFilter = Filter & { - meta: PhrasesFilterMeta; -}; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.md deleted file mode 100644 index e15b04236a0b53..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.md +++ /dev/null @@ -1,16 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Query](./kibana-plugin-plugins-data-public.query.md) - -## Query type - -Signature: - -```typescript -export declare type Query = { - query: string | { - [key: string]: any; - }; - language: string; -}; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md deleted file mode 100644 index 1cb627ec3a8f93..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md +++ /dev/null @@ -1,21 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilter](./kibana-plugin-plugins-data-public.rangefilter.md) - -## RangeFilter type - -Signature: - -```typescript -export declare type RangeFilter = Filter & EsRangeFilter & { - meta: RangeFilterMeta; - script?: { - script: { - params: any; - lang: estypes.ScriptLanguage; - source: any; - }; - }; - match_all?: any; -}; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md deleted file mode 100644 index 609e98cb6faa8f..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md +++ /dev/null @@ -1,15 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterMeta](./kibana-plugin-plugins-data-public.rangefiltermeta.md) - -## RangeFilterMeta type - -Signature: - -```typescript -export declare type RangeFilterMeta = FilterMeta & { - params: RangeFilterParams; - field?: any; - formattedValue?: string; -}; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.format.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.format.md deleted file mode 100644 index 15926481923ab6..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.format.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [format](./kibana-plugin-plugins-data-public.rangefilterparams.format.md) - -## RangeFilterParams.format property - -Signature: - -```typescript -format?: string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.from.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.from.md deleted file mode 100644 index 99b8d75e9c3169..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.from.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [from](./kibana-plugin-plugins-data-public.rangefilterparams.from.md) - -## RangeFilterParams.from property - -Signature: - -```typescript -from?: number | string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gt.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gt.md deleted file mode 100644 index 32bfc6eeb68cb6..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gt.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [gt](./kibana-plugin-plugins-data-public.rangefilterparams.gt.md) - -## RangeFilterParams.gt property - -Signature: - -```typescript -gt?: number | string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gte.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gte.md deleted file mode 100644 index 81345e4a816105..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gte.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [gte](./kibana-plugin-plugins-data-public.rangefilterparams.gte.md) - -## RangeFilterParams.gte property - -Signature: - -```typescript -gte?: number | string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lt.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lt.md deleted file mode 100644 index 6250fecfe59d61..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lt.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [lt](./kibana-plugin-plugins-data-public.rangefilterparams.lt.md) - -## RangeFilterParams.lt property - -Signature: - -```typescript -lt?: number | string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lte.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lte.md deleted file mode 100644 index c4f3cbf00b304f..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lte.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [lte](./kibana-plugin-plugins-data-public.rangefilterparams.lte.md) - -## RangeFilterParams.lte property - -Signature: - -```typescript -lte?: number | string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md deleted file mode 100644 index 977559f5e6cb2b..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md +++ /dev/null @@ -1,24 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) - -## RangeFilterParams interface - -Signature: - -```typescript -export interface RangeFilterParams -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [format](./kibana-plugin-plugins-data-public.rangefilterparams.format.md) | string | | -| [from](./kibana-plugin-plugins-data-public.rangefilterparams.from.md) | number | string | | -| [gt](./kibana-plugin-plugins-data-public.rangefilterparams.gt.md) | number | string | | -| [gte](./kibana-plugin-plugins-data-public.rangefilterparams.gte.md) | number | string | | -| [lt](./kibana-plugin-plugins-data-public.rangefilterparams.lt.md) | number | string | | -| [lte](./kibana-plugin-plugins-data-public.rangefilterparams.lte.md) | number | string | | -| [to](./kibana-plugin-plugins-data-public.rangefilterparams.to.md) | number | string | | - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.to.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.to.md deleted file mode 100644 index c9d0069fb75f5a..00000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.to.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [to](./kibana-plugin-plugins-data-public.rangefilterparams.to.md) - -## RangeFilterParams.to property - -Signature: - -```typescript -to?: number | string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md index 5fd615cc647d29..214df9601dc8e5 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md @@ -4,7 +4,6 @@ ## SearchSourceFields.filter property -[Filter](./kibana-plugin-plugins-data-public.filter.md) Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md index 981d956a9e89be..93a24d1013b1be 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md @@ -19,13 +19,13 @@ export interface SearchSourceFields | [aggs](./kibana-plugin-plugins-data-public.searchsourcefields.aggs.md) | object | IAggConfigs | (() => object) | [AggConfigs](./kibana-plugin-plugins-data-public.aggconfigs.md) | | [fields](./kibana-plugin-plugins-data-public.searchsourcefields.fields.md) | SearchFieldValue[] | Retrieve fields via the search Fields API | | [fieldsFromSource](./kibana-plugin-plugins-data-public.searchsourcefields.fieldsfromsource.md) | NameList | Retreive fields directly from \_source (legacy behavior) | -| [filter](./kibana-plugin-plugins-data-public.searchsourcefields.filter.md) | Filter[] | Filter | (() => Filter[] | Filter | undefined) | [Filter](./kibana-plugin-plugins-data-public.filter.md) | +| [filter](./kibana-plugin-plugins-data-public.searchsourcefields.filter.md) | Filter[] | Filter | (() => Filter[] | Filter | undefined) | | | [from](./kibana-plugin-plugins-data-public.searchsourcefields.from.md) | number | | | [highlight](./kibana-plugin-plugins-data-public.searchsourcefields.highlight.md) | any | | | [highlightAll](./kibana-plugin-plugins-data-public.searchsourcefields.highlightall.md) | boolean | | | [index](./kibana-plugin-plugins-data-public.searchsourcefields.index.md) | IndexPattern | | | [parent](./kibana-plugin-plugins-data-public.searchsourcefields.parent.md) | SearchSourceFields | | -| [query](./kibana-plugin-plugins-data-public.searchsourcefields.query.md) | Query | [Query](./kibana-plugin-plugins-data-public.query.md) | +| [query](./kibana-plugin-plugins-data-public.searchsourcefields.query.md) | Query | | | [searchAfter](./kibana-plugin-plugins-data-public.searchsourcefields.searchafter.md) | EsQuerySearchAfter | | | [size](./kibana-plugin-plugins-data-public.searchsourcefields.size.md) | number | | | [sort](./kibana-plugin-plugins-data-public.searchsourcefields.sort.md) | EsQuerySortValue | EsQuerySortValue[] | [EsQuerySortValue](./kibana-plugin-plugins-data-public.esquerysortvalue.md) | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.query.md index 661ce94a06afb3..78bf800c58c20c 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.query.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.query.md @@ -4,7 +4,6 @@ ## SearchSourceFields.query property -[Query](./kibana-plugin-plugins-data-public.query.md) Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md index 594afcf9ee0ddd..4504ff9d8287cf 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md @@ -8,14 +8,14 @@ ```typescript esFilters: { - buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; buildCustomFilter: typeof buildCustomFilter; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; - buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; buildFilter: typeof buildFilter; - 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; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isFilterDisabled: (filter: import("@kbn/es-query").Filter) => boolean; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md index fce25a899de8e8..4989b2b5ad5844 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md @@ -8,8 +8,8 @@ ```typescript esKuery: { - nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; - toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md index 68507f3fb9b81d..5fcc6d29807e1e 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md @@ -8,11 +8,11 @@ ```typescript esQuery: { - buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../common").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../common").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; getEsQueryConfig: typeof getEsQueryConfig; buildEsQuery: typeof buildEsQuery; diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md deleted file mode 100644 index ce8303d720747b..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) > [allowLeadingWildcards](./kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md) - -## EsQueryConfig.allowLeadingWildcards property - -Signature: - -```typescript -allowLeadingWildcards: boolean; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md deleted file mode 100644 index d3e86f19709f88..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) > [dateFormatTZ](./kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md) - -## EsQueryConfig.dateFormatTZ property - -Signature: - -```typescript -dateFormatTZ?: string; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md deleted file mode 100644 index 93b3e8915c482d..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) > [ignoreFilterIfFieldNotInIndex](./kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md) - -## EsQueryConfig.ignoreFilterIfFieldNotInIndex property - -Signature: - -```typescript -ignoreFilterIfFieldNotInIndex: boolean; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md deleted file mode 100644 index 9ae604e07cabd2..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md +++ /dev/null @@ -1,21 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) - -## EsQueryConfig interface - -Signature: - -```typescript -export interface EsQueryConfig -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [allowLeadingWildcards](./kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md) | boolean | | -| [dateFormatTZ](./kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md) | string | | -| [ignoreFilterIfFieldNotInIndex](./kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md) | boolean | | -| [queryStringOptions](./kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md) | Record<string, any> | | - diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md deleted file mode 100644 index 437d36112d015e..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) > [queryStringOptions](./kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md) - -## EsQueryConfig.queryStringOptions property - -Signature: - -```typescript -queryStringOptions: Record; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md deleted file mode 100644 index 519bbaf8f94168..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md +++ /dev/null @@ -1,15 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Filter](./kibana-plugin-plugins-data-server.filter.md) - -## Filter type - -Signature: - -```typescript -export declare type Filter = { - $state?: FilterState; - meta: FilterMeta; - query?: any; -}; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md index 54e7cf92f500cf..7f2267aff7049e 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md @@ -10,7 +10,7 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("../..").RangeFilter | undefined; +}): import("@kbn/es-query").RangeFilter | undefined; ``` ## Parameters @@ -23,5 +23,5 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRan Returns: -`import("../..").RangeFilter | undefined` +`import("@kbn/es-query").RangeFilter | undefined` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md deleted file mode 100644 index 70140e51a7316d..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md +++ /dev/null @@ -1,19 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) - -## IFieldSubType interface - -Signature: - -```typescript -export interface IFieldSubType -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [multi](./kibana-plugin-plugins-data-server.ifieldsubtype.multi.md) | {
parent: string;
} | | -| [nested](./kibana-plugin-plugins-data-server.ifieldsubtype.nested.md) | {
path: string;
} | | - diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.multi.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.multi.md deleted file mode 100644 index 31a3bc53d63438..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.multi.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) > [multi](./kibana-plugin-plugins-data-server.ifieldsubtype.multi.md) - -## IFieldSubType.multi property - -Signature: - -```typescript -multi?: { - parent: string; - }; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.nested.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.nested.md deleted file mode 100644 index b53a4406aedc21..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.nested.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) > [nested](./kibana-plugin-plugins-data-server.ifieldsubtype.nested.md) - -## IFieldSubType.nested property - -Signature: - -```typescript -nested?: { - path: string; - }; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md deleted file mode 100644 index 3a258a5b986166..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md +++ /dev/null @@ -1,18 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [KueryNode](./kibana-plugin-plugins-data-server.kuerynode.md) - -## KueryNode interface - -Signature: - -```typescript -export interface KueryNode -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [type](./kibana-plugin-plugins-data-server.kuerynode.type.md) | keyof NodeTypes | | - diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.type.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.type.md deleted file mode 100644 index 192a2c05191c75..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.type.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [KueryNode](./kibana-plugin-plugins-data-server.kuerynode.md) > [type](./kibana-plugin-plugins-data-server.kuerynode.type.md) - -## KueryNode.type property - -Signature: - -```typescript -type: keyof NodeTypes; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md index ab14abdd74e87d..25ae54e831da70 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md @@ -48,11 +48,9 @@ | [AggParamOption](./kibana-plugin-plugins-data-server.aggparamoption.md) | | | [AsyncSearchResponse](./kibana-plugin-plugins-data-server.asyncsearchresponse.md) | | | [AsyncSearchStatusResponse](./kibana-plugin-plugins-data-server.asyncsearchstatusresponse.md) | | -| [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) | | | [FieldDescriptor](./kibana-plugin-plugins-data-server.fielddescriptor.md) | | | [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) | | | [IEsSearchRequest](./kibana-plugin-plugins-data-server.iessearchrequest.md) | | -| [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) | | | [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) | | | [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) | Interface for an index pattern saved object | | [IScopedSearchClient](./kibana-plugin-plugins-data-server.iscopedsearchclient.md) | | @@ -61,7 +59,6 @@ | [ISearchSetup](./kibana-plugin-plugins-data-server.isearchsetup.md) | | | [ISearchStart](./kibana-plugin-plugins-data-server.isearchstart.md) | | | [ISearchStrategy](./kibana-plugin-plugins-data-server.isearchstrategy.md) | Search strategy interface contains a search method that takes in a request and returns a promise that resolves to a response. | -| [KueryNode](./kibana-plugin-plugins-data-server.kuerynode.md) | | | [OptionedValueProp](./kibana-plugin-plugins-data-server.optionedvalueprop.md) | | | [PluginSetup](./kibana-plugin-plugins-data-server.pluginsetup.md) | | | [PluginStart](./kibana-plugin-plugins-data-server.pluginstart.md) | | @@ -102,7 +99,6 @@ | [ExpressionFunctionKibanaContext](./kibana-plugin-plugins-data-server.expressionfunctionkibanacontext.md) | | | [ExpressionValueSearchContext](./kibana-plugin-plugins-data-server.expressionvaluesearchcontext.md) | | | [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md) | | -| [Filter](./kibana-plugin-plugins-data-server.filter.md) | | | [IAggConfig](./kibana-plugin-plugins-data-server.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. | | [IAggType](./kibana-plugin-plugins-data-server.iaggtype.md) | | | [IEsSearchResponse](./kibana-plugin-plugins-data-server.iessearchresponse.md) | | @@ -112,7 +108,6 @@ | [IndexPatternLoadExpressionFunctionDefinition](./kibana-plugin-plugins-data-server.indexpatternloadexpressionfunctiondefinition.md) | | | [KibanaContext](./kibana-plugin-plugins-data-server.kibanacontext.md) | | | [ParsedInterval](./kibana-plugin-plugins-data-server.parsedinterval.md) | | -| [Query](./kibana-plugin-plugins-data-server.query.md) | | | [SearchRequestHandlerContext](./kibana-plugin-plugins-data-server.searchrequesthandlercontext.md) | | | [TimeRange](./kibana-plugin-plugins-data-server.timerange.md) | | diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.md deleted file mode 100644 index 6a7bdfe51f1c0a..00000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.md +++ /dev/null @@ -1,16 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Query](./kibana-plugin-plugins-data-server.query.md) - -## Query type - -Signature: - -```typescript -export declare type Query = { - query: string | { - [key: string]: any; - }; - language: string; -}; -``` diff --git a/packages/kbn-es-query/tsconfig.json b/packages/kbn-es-query/tsconfig.json index 866004ef2dbd4d..b48d90373e2cba 100644 --- a/packages/kbn-es-query/tsconfig.json +++ b/packages/kbn-es-query/tsconfig.json @@ -18,6 +18,6 @@ ], "exclude": [ "**/__fixtures__/**/*", - "**/__mocks__/**/*" + "**/__mocks__/**/grammar.js", ] } diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 270182bec2bf6b..6da94cfa38ee36 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -116,6 +116,7 @@ export { CustomFilter, MatchAllFilter, IFieldSubType, + EsQueryConfig, isFilter, isFilters, } from '@kbn/es-query'; diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index b8af7c12d57fcc..cd9ee801894af4 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -12,19 +12,23 @@ import { ApplicationStart } from 'kibana/public'; import { Assign } from '@kbn/utility-types'; import { BfetchPublicSetup } from 'src/plugins/bfetch/public'; import Boom from '@hapi/boom'; +import { buildEsQuery } from '@kbn/es-query'; import { ConfigDeprecationProvider } from '@kbn/config'; import { CoreSetup } from 'src/core/public'; import { CoreSetup as CoreSetup_2 } from 'kibana/public'; import { CoreStart } from 'kibana/public'; import { CoreStart as CoreStart_2 } from 'src/core/public'; +import { CustomFilter } from '@kbn/es-query'; import { Datatable as Datatable_2 } from 'src/plugins/expressions'; import { Datatable as Datatable_3 } from 'src/plugins/expressions/common'; import { DatatableColumn as DatatableColumn_2 } from 'src/plugins/expressions'; import { DatatableColumnType as DatatableColumnType_2 } from 'src/plugins/expressions/common'; +import { decorateQuery } from '@kbn/es-query'; import { DetailedPeerCertificate } from 'tls'; import { Ensure } from '@kbn/utility-types'; import { EnvironmentMode } from '@kbn/config'; import { ErrorToastOptions } from 'src/core/public/notifications'; +import { EsQueryConfig } from '@kbn/es-query'; import { estypes } from '@elastic/elasticsearch'; import { EuiBreadcrumb } from '@elastic/eui'; import { EuiButtonEmptyProps } from '@elastic/eui'; @@ -35,10 +39,14 @@ import { EuiGlobalToastListToast } from '@elastic/eui'; import { EuiIconProps } from '@elastic/eui'; import { EventEmitter } from 'events'; import { ExecutionContext } from 'src/plugins/expressions/common'; +import { ExistsFilter } from '@kbn/es-query'; import { ExpressionAstExpression } from 'src/plugins/expressions/common'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { ExpressionsSetup } from 'src/plugins/expressions/public'; import { ExpressionValueBoxed } from 'src/plugins/expressions/common'; +import { Filter } from '@kbn/es-query'; +import { FILTERS } from '@kbn/es-query'; +import { FilterStateStore } from '@kbn/es-query'; import { FormatFactory as FormatFactory_2 } from 'src/plugins/data/common/field_formats/utils'; import { History } from 'history'; import { Href } from 'history'; @@ -46,18 +54,25 @@ import { HttpSetup } from 'kibana/public'; import { IAggConfigs as IAggConfigs_2 } from 'src/plugins/data/public'; import { IconType } from '@elastic/eui'; import { IEsSearchResponse as IEsSearchResponse_2 } from 'src/plugins/data/public'; +import { IFieldSubType } from '@kbn/es-query'; import { IncomingHttpHeaders } from 'http'; +import { IndexPatternBase } from '@kbn/es-query'; +import { IndexPatternFieldBase } from '@kbn/es-query'; import { InjectedIntl } from '@kbn/i18n/react'; import { ISearchOptions as ISearchOptions_2 } from 'src/plugins/data/public'; import { ISearchSource as ISearchSource_2 } from 'src/plugins/data/public'; +import { isFilter } from '@kbn/es-query'; +import { isFilters } from '@kbn/es-query'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { IUiSettingsClient } from 'src/core/public'; -import { JsonValue } from '@kbn/common-utils'; import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; +import { KueryNode } from '@kbn/es-query'; import { Location } from 'history'; import { LocationDescriptorObject } from 'history'; import { Logger } from '@kbn/logging'; import { LogMeta } from '@kbn/logging'; +import { luceneStringToDsl } from '@kbn/es-query'; +import { MatchAllFilter } from '@kbn/es-query'; import { MaybePromise } from '@kbn/utility-types'; import { Moment } from 'moment'; import moment from 'moment'; @@ -67,6 +82,8 @@ import { Observable } from 'rxjs'; import { PackageInfo } from '@kbn/config'; import { Path } from 'history'; import { PeerCertificate } from 'tls'; +import { PhraseFilter } from '@kbn/es-query'; +import { PhrasesFilter } from '@kbn/es-query'; import { Plugin } from 'src/core/public'; import { PluginInitializerContext as PluginInitializerContext_2 } from 'src/core/public'; import { PluginInitializerContext as PluginInitializerContext_3 } from 'kibana/public'; @@ -74,7 +91,11 @@ import { PopoverAnchorPosition } from '@elastic/eui'; import { PublicContract } from '@kbn/utility-types'; import { PublicMethodsOf } from '@kbn/utility-types'; import { PublicUiSettingsParams } from 'src/core/server/types'; +import { Query } from '@kbn/es-query'; +import { RangeFilter } from '@kbn/es-query'; import { RangeFilter as RangeFilter_2 } from 'src/plugins/data/public'; +import { RangeFilterMeta } from '@kbn/es-query'; +import { RangeFilterParams } from '@kbn/es-query'; import React from 'react'; import * as React_2 from 'react'; import { RecursiveReadonly } from '@kbn/utility-types'; @@ -614,12 +635,7 @@ export const connectToQueryState: ({ timefilter: { timefil // @public (undocumented) export const createSavedQueryService: (savedObjectsClient: SavedObjectsClientContract) => SavedQueryService; -// Warning: (ae-missing-release-tag) "CustomFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type CustomFilter = Filter & { - query: any; -}; +export { CustomFilter } // Warning: (ae-forgotten-export) The symbol "DataSetupDependencies" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataStartDependencies" needs to be exported by the entry point index.d.ts @@ -805,21 +821,21 @@ export const esFilters: { FilterItem: (props: import("./ui/filter_bar/filter_item").FilterItemProps) => JSX.Element; FILTERS: typeof FILTERS; FilterStateStore: typeof FilterStateStore; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; - 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").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; - isRangeFilter: (filter: any) => filter is import("../common").RangeFilter; - isMatchAllFilter: (filter: any) => filter is import("../common").MatchAllFilter; - isMissingFilter: (filter: any) => filter is import("../common").MissingFilter; - isQueryStringFilter: (filter: any) => filter is import("../common").QueryStringFilter; - isFilterPinned: (filter: import("../common").Filter) => boolean | undefined; - toggleFilterNegated: (filter: import("../common").Filter) => { + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isPhraseFilter: (filter: any) => filter is import("@kbn/es-query").PhraseFilter; + isExistsFilter: (filter: any) => filter is import("@kbn/es-query").ExistsFilter; + isPhrasesFilter: (filter: any) => filter is import("@kbn/es-query").PhrasesFilter; + isRangeFilter: (filter: any) => filter is import("@kbn/es-query").RangeFilter; + isMatchAllFilter: (filter: any) => filter is import("@kbn/es-query").MatchAllFilter; + isMissingFilter: (filter: any) => filter is import("@kbn/es-query").MissingFilter; + isQueryStringFilter: (filter: any) => filter is import("@kbn/es-query").QueryStringFilter; + isFilterPinned: (filter: import("@kbn/es-query").Filter) => boolean | undefined; + toggleFilterNegated: (filter: import("@kbn/es-query").Filter) => { meta: { negate: boolean; alias: string | null; @@ -832,20 +848,20 @@ export const esFilters: { params?: any; value?: string | undefined; }; - $state?: import("../common").FilterState | undefined; + $state?: import("@kbn/es-query/target_types/filters/types").FilterState | undefined; query?: any; }; - disableFilter: (filter: import("../common").Filter) => import("../common").Filter; - getPhraseFilterField: (filter: import("../common").PhraseFilter) => string; - getPhraseFilterValue: (filter: import("../common").PhraseFilter) => string | number | boolean; + disableFilter: (filter: import("@kbn/es-query").Filter) => import("@kbn/es-query").Filter; + getPhraseFilterField: (filter: import("@kbn/es-query").PhraseFilter) => string; + getPhraseFilterValue: (filter: import("@kbn/es-query").PhraseFilter) => string | number | boolean; getDisplayValueFromFilter: typeof getDisplayValueFromFilter; - compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; + compareFilters: (first: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], second: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions; generateFilters: typeof generateFilters; - onlyDisabledFiltersChanged: (newFilters?: import("../common").Filter[] | undefined, oldFilters?: import("../common").Filter[] | undefined) => boolean; + onlyDisabledFiltersChanged: (newFilters?: import("@kbn/es-query").Filter[] | undefined, oldFilters?: import("@kbn/es-query").Filter[] | undefined) => boolean; changeTimeFilter: typeof changeTimeFilter; convertRangeFilterToTimeRangeString: typeof convertRangeFilterToTimeRangeString; - mapAndFlattenFilters: (filters: import("../common").Filter[]) => import("../common").Filter[]; + mapAndFlattenFilters: (filters: import("@kbn/es-query").Filter[]) => import("@kbn/es-query").Filter[]; extractTimeFilter: typeof extractTimeFilter; extractTimeRange: typeof extractTimeRange; }; @@ -854,9 +870,9 @@ export const esFilters: { // // @public (undocumented) export const esKuery: { - nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; - toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; }; // Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -865,29 +881,17 @@ export const esKuery: { export const esQuery: { buildEsQuery: typeof buildEsQuery; getEsQueryConfig: typeof getEsQueryConfig; - buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../common").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../common").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; luceneStringToDsl: typeof luceneStringToDsl; decorateQuery: typeof decorateQuery; }; -// Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export interface EsQueryConfig { - // (undocumented) - allowLeadingWildcards: boolean; - // (undocumented) - dateFormatTZ?: string; - // (undocumented) - ignoreFilterIfFieldNotInIndex: boolean; - // (undocumented) - queryStringOptions: Record; -} +export { EsQueryConfig } // Warning: (ae-forgotten-export) The symbol "SortDirectionNumeric" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SortDirectionFormat" needs to be exported by the entry point index.d.ts @@ -913,13 +917,7 @@ export type ExecutionContextSearch = { timeRange?: TimeRange; }; -// Warning: (ae-missing-release-tag) "ExistsFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type ExistsFilter = Filter & { - meta: ExistsFilterMeta; - exists?: FilterExistsProperty; -}; +export { ExistsFilter } // Warning: (ae-missing-release-tag) "exporters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1074,14 +1072,7 @@ export type FieldFormatsStart = Omit // @public (undocumented) export const fieldList: (specs?: FieldSpec[], shortDotsEnable?: boolean) => IIndexPatternFieldList; -// Warning: (ae-missing-release-tag) "Filter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type Filter = { - $state?: FilterState; - meta: FilterMeta; - query?: any; -}; +export { Filter } // Warning: (ae-missing-release-tag) "FilterManager" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1150,7 +1141,7 @@ export function getSearchParamsFromRequest(searchRequest: SearchRequest, depende export function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("../..").RangeFilter | undefined; +}): import("@kbn/es-query").RangeFilter | undefined; // Warning: (ae-missing-release-tag) "IAggConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1226,21 +1217,8 @@ export type IFieldFormatsRegistry = PublicMethodsOf; // @public (undocumented) export type IFieldParamType = FieldParamType; -// Warning: (ae-missing-release-tag) "IFieldSubType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export interface IFieldSubType { - // (undocumented) - multi?: { - parent: string; - }; - // (undocumented) - nested?: { - path: string; - }; -} +export { IFieldSubType } -// 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) @@ -1273,7 +1251,6 @@ export interface IFieldType extends IndexPatternFieldBase { visualizable?: boolean; } -// Warning: (ae-forgotten-export) The symbol "IndexPatternBase" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "IIndexPattern" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public @deprecated (undocumented) @@ -1551,7 +1528,7 @@ export class IndexPatternField implements IFieldType { // (undocumented) readonly spec: FieldSpec; // (undocumented) - get subType(): import("../..").IFieldSubType | undefined; + get subType(): import("@kbn/es-query").IFieldSubType | undefined; // (undocumented) toJSON(): { count: number; @@ -1565,7 +1542,7 @@ export class IndexPatternField implements IFieldType { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../..").IFieldSubType | undefined; + subType: import("@kbn/es-query").IFieldSubType | undefined; customLabel: string | undefined; }; // (undocumented) @@ -1796,15 +1773,9 @@ export type ISessionsClient = PublicContract; // @public (undocumented) export type ISessionService = PublicContract; -// Warning: (ae-missing-release-tag) "isFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export const isFilter: (x: unknown) => x is Filter; +export { isFilter } -// Warning: (ae-missing-release-tag) "isFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export const isFilters: (x: unknown) => x is Filter[]; +export { isFilters } // Warning: (ae-missing-release-tag) "isPartialResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1868,25 +1839,9 @@ export enum KBN_FIELD_TYPES { // @public (undocumented) export type KibanaContext = ExpressionValueSearchContext; -// Warning: (ae-missing-release-tag) "KueryNode" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export interface KueryNode { - // (undocumented) - [key: string]: any; - // Warning: (ae-forgotten-export) The symbol "NodeTypes" needs to be exported by the entry point index.d.ts - // - // (undocumented) - type: keyof NodeTypes; -} +export { KueryNode } -// Warning: (ae-missing-release-tag) "MatchAllFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type MatchAllFilter = Filter & { - meta: MatchAllFilterMeta; - match_all: any; -}; +export { MatchAllFilter } // Warning: (ae-missing-release-tag) "METRIC_TYPES" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1993,26 +1948,9 @@ export type ParsedInterval = ReturnType; // @public (undocumented) export const parseSearchSourceJSON: (searchSourceJSON: string) => SearchSourceFields; -// Warning: (ae-missing-release-tag) "PhraseFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type PhraseFilter = Filter & { - meta: PhraseFilterMeta; - script?: { - script: { - source?: any; - lang?: estypes.ScriptLanguage; - params: any; - }; - }; -}; +export { PhraseFilter } -// Warning: (ae-missing-release-tag) "PhrasesFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type PhrasesFilter = Filter & { - meta: PhrasesFilterMeta; -}; +export { PhrasesFilter } // Warning: (ae-forgotten-export) The symbol "PluginInitializerContext" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "plugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -2020,15 +1958,7 @@ export type PhrasesFilter = Filter & { // @public (undocumented) export function plugin(initializerContext: PluginInitializerContext): DataPlugin; -// Warning: (ae-missing-release-tag) "Query" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type Query = { - query: string | { - [key: string]: any; - }; - language: string; -}; +export { Query } // Warning: (ae-forgotten-export) The symbol "QueryService" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "QueryStart" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -2194,50 +2124,11 @@ export enum QuerySuggestionTypes { Value = "value" } -// Warning: (ae-forgotten-export) The symbol "EsRangeFilter" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "RangeFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type RangeFilter = Filter & EsRangeFilter & { - meta: RangeFilterMeta; - script?: { - script: { - params: any; - lang: estypes.ScriptLanguage; - source: any; - }; - }; - match_all?: any; -}; +export { RangeFilter } -// Warning: (ae-missing-release-tag) "RangeFilterMeta" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type RangeFilterMeta = FilterMeta & { - params: RangeFilterParams; - field?: any; - formattedValue?: string; -}; +export { RangeFilterMeta } -// Warning: (ae-missing-release-tag) "RangeFilterParams" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export interface RangeFilterParams { - // (undocumented) - format?: string; - // (undocumented) - from?: number | string; - // (undocumented) - gt?: number | string; - // (undocumented) - gte?: number | string; - // (undocumented) - lt?: number | string; - // (undocumented) - lte?: number | string; - // (undocumented) - to?: number | string; -} +export { RangeFilterParams } // Warning: (ae-missing-release-tag) "Reason" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -2519,6 +2410,8 @@ export interface SearchSourceFields { fields?: SearchFieldValue[]; // @deprecated fieldsFromSource?: NameList; + // Warning: (ae-unresolved-link) The @link reference could not be resolved: Reexported declarations are not supported + // // (undocumented) filter?: Filter[] | Filter | (() => Filter[] | Filter | undefined); // (undocumented) @@ -2533,6 +2426,8 @@ export interface SearchSourceFields { index?: IndexPattern; // (undocumented) parent?: SearchSourceFields; + // Warning: (ae-unresolved-link) The @link reference could not be resolved: Reexported declarations are not supported + // // (undocumented) query?: Query; // Warning: (ae-forgotten-export) The symbol "EsQuerySearchAfter" needs to be exported by the entry point index.d.ts @@ -2722,50 +2617,39 @@ export interface WaitUntilNextSessionCompletesOptions { // Warnings were encountered during analysis: // -// src/plugins/data/common/es_query/filters/exists_filter.ts:19:3 - (ae-forgotten-export) The symbol "ExistsFilterMeta" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/es_query/filters/exists_filter.ts:20:3 - (ae-forgotten-export) The symbol "FilterExistsProperty" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/es_query/filters/match_all_filter.ts:17:3 - (ae-forgotten-export) The symbol "MatchAllFilterMeta" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/es_query/filters/meta_filter.ts:43:3 - (ae-forgotten-export) The symbol "FilterState" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/es_query/filters/meta_filter.ts:44:3 - (ae-forgotten-export) The symbol "FilterMeta" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/es_query/filters/phrase_filter.ts:22:3 - (ae-forgotten-export) The symbol "PhraseFilterMeta" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/es_query/filters/phrases_filter.ts:20:3 - (ae-forgotten-export) The symbol "PhrasesFilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:65:5 - (ae-forgotten-export) The symbol "FormatFieldFn" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:138:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:169:7 - (ae-forgotten-export) The symbol "RuntimeField" needs to be exported by the entry point index.d.ts // src/plugins/data/common/search/aggs/types.ts:129:51 - (ae-forgotten-export) The symbol "AggTypesRegistryStart" needs to be exported by the entry point index.d.ts // src/plugins/data/public/field_formats/field_formats_service.ts:56:3 - (ae-forgotten-export) The symbol "FormatFactory" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:56:23 - (ae-forgotten-export) The symbol "FILTERS" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:56:23 - (ae-forgotten-export) The symbol "getDisplayValueFromFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:56:23 - (ae-forgotten-export) The symbol "generateFilters" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:56:23 - (ae-forgotten-export) The symbol "changeTimeFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:56:23 - (ae-forgotten-export) The symbol "convertRangeFilterToTimeRangeString" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:56:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:56:23 - (ae-forgotten-export) The symbol "extractTimeRange" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:129:21 - (ae-forgotten-export) The symbol "buildEsQuery" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:129:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:129:21 - (ae-forgotten-export) The symbol "luceneStringToDsl" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:129:21 - (ae-forgotten-export) The symbol "decorateQuery" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:170:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:213:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "getDisplayValueFromFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "generateFilters" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "changeTimeFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "convertRangeFilterToTimeRangeString" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "extractTimeRange" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:132:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:214:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:239:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:239:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:239:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:239:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:239:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:409:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:409:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:409:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts @@ -2780,7 +2664,6 @@ export interface WaitUntilNextSessionCompletesOptions { // src/plugins/data/public/index.ts:432:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:433:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:436:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:34:5 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts // src/plugins/data/public/search/session/session_service.ts:62:5 - (ae-forgotten-export) The symbol "UrlGeneratorStateMapping" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index c21024d8264621..67af3c0fb9f6df 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -8,6 +8,9 @@ import { $Values } from '@kbn/utility-types'; import { Adapters } from 'src/plugins/inspector/common'; import { Assign } from '@kbn/utility-types'; import { BfetchServerSetup } from 'src/plugins/bfetch/server'; +import { buildCustomFilter } from '@kbn/es-query'; +import { buildEsQuery } from '@kbn/es-query'; +import { buildFilter } from '@kbn/es-query'; import { ConfigDeprecationProvider } from '@kbn/config'; import { CoreSetup } from 'src/core/server'; import { CoreSetup as CoreSetup_2 } from 'kibana/server'; @@ -23,6 +26,7 @@ import { ElasticsearchClient as ElasticsearchClient_2 } from 'kibana/server'; import { Ensure } from '@kbn/utility-types'; import { EnvironmentMode } from '@kbn/config'; import { ErrorToastOptions } from 'src/core/public/notifications'; +import { EsQueryConfig } from '@kbn/es-query'; import { estypes } from '@elastic/elasticsearch'; import { EventEmitter } from 'events'; import { ExecutionContext } from 'src/plugins/expressions/common'; @@ -30,17 +34,21 @@ import { ExpressionAstExpression } from 'src/plugins/expressions/common'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { ExpressionsServerSetup } from 'src/plugins/expressions/server'; import { ExpressionValueBoxed } from 'src/plugins/expressions/common'; +import { Filter } from '@kbn/es-query'; import { FormatFactory as FormatFactory_2 } from 'src/plugins/data/common/field_formats/utils'; import { IAggConfigs as IAggConfigs_2 } from 'src/plugins/data/public'; import { IEsSearchResponse as IEsSearchResponse_2 } from 'src/plugins/data/public'; +import { IFieldSubType } from '@kbn/es-query'; +import { IndexPatternBase } from '@kbn/es-query'; +import { IndexPatternFieldBase } from '@kbn/es-query'; import { IScopedClusterClient } from 'src/core/server'; import { ISearchOptions as ISearchOptions_2 } from 'src/plugins/data/public'; import { ISearchSource } from 'src/plugins/data/public'; import { IUiSettingsClient } from 'src/core/server'; import { IUiSettingsClient as IUiSettingsClient_3 } from 'kibana/server'; -import { JsonValue } from '@kbn/common-utils'; import { KibanaRequest } from 'src/core/server'; import { KibanaRequest as KibanaRequest_2 } from 'kibana/server'; +import { KueryNode } from '@kbn/es-query'; import { Logger } from 'src/core/server'; import { Logger as Logger_2 } from 'kibana/server'; import { LoggerFactory } from '@kbn/logging'; @@ -54,6 +62,7 @@ import { Plugin as Plugin_2 } from 'src/core/server'; import { Plugin as Plugin_3 } from 'kibana/server'; import { PluginInitializerContext as PluginInitializerContext_2 } from 'src/core/server'; import { PublicMethodsOf } from '@kbn/utility-types'; +import { Query } from '@kbn/es-query'; import { RangeFilter } from 'src/plugins/data/public'; import { RecursiveReadonly } from '@kbn/utility-types'; import { RequestAdapter } from 'src/plugins/inspector/common'; @@ -444,53 +453,41 @@ export type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<'e // // @public (undocumented) export const esFilters: { - buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; buildCustomFilter: typeof buildCustomFilter; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; - buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; buildFilter: typeof buildFilter; - 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; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isFilterDisabled: (filter: import("@kbn/es-query").Filter) => boolean; }; // Warning: (ae-missing-release-tag) "esKuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const esKuery: { - nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; - toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; }; // Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const esQuery: { - buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../common").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../common").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; getEsQueryConfig: typeof getEsQueryConfig; buildEsQuery: typeof buildEsQuery; }; -// Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export interface EsQueryConfig { - // (undocumented) - allowLeadingWildcards: boolean; - // (undocumented) - dateFormatTZ?: string; - // (undocumented) - ignoreFilterIfFieldNotInIndex: boolean; - // (undocumented) - queryStringOptions: Record; -} +export { EsQueryConfig } // Warning: (ae-missing-release-tag) "ExecutionContextSearch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -593,14 +590,7 @@ export const fieldFormats: { // @public (undocumented) export type FieldFormatsGetConfigFn = GetConfigFn; -// Warning: (ae-missing-release-tag) "Filter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type Filter = { - $state?: FilterState; - meta: FilterMeta; - query?: any; -}; +export { Filter } // Warning: (ae-missing-release-tag) "getCapabilitiesForRollupIndices" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -628,7 +618,7 @@ export function getShardTimeout(config: SharedGlobalConfig_2): Pick): { @@ -679,21 +669,8 @@ export type IFieldFormatsRegistry = PublicMethodsOf; // @public (undocumented) export type IFieldParamType = FieldParamType; -// Warning: (ae-missing-release-tag) "IFieldSubType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export interface IFieldSubType { - // (undocumented) - multi?: { - parent: string; - }; - // (undocumented) - nested?: { - path: string; - }; -} +export { IFieldSubType } -// 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) @@ -1126,17 +1103,7 @@ export enum KBN_FIELD_TYPES { // @public (undocumented) export type KibanaContext = ExpressionValueSearchContext; -// Warning: (ae-missing-release-tag) "KueryNode" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export interface KueryNode { - // (undocumented) - [key: string]: any; - // Warning: (ae-forgotten-export) The symbol "NodeTypes" needs to be exported by the entry point index.d.ts - // - // (undocumented) - type: keyof NodeTypes; -} +export { KueryNode } // Warning: (ae-missing-release-tag) "mergeCapabilitiesWithFields" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1303,15 +1270,7 @@ export interface PluginStart { search: ISearchStart; } -// Warning: (ae-missing-release-tag) "Query" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type Query = { - query: string | { - [key: string]: any; - }; - language: string; -}; +export { Query } // Warning: (ae-missing-release-tag) "RefreshInterval" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1510,47 +1469,42 @@ export function usageProvider(core: CoreSetup_2): SearchUsage; // Warnings were encountered during analysis: // -// src/plugins/data/common/es_query/filters/meta_filter.ts:43:3 - (ae-forgotten-export) The symbol "FilterState" needs to be exported by the entry point index.d.ts -// src/plugins/data/common/es_query/filters/meta_filter.ts:44:3 - (ae-forgotten-export) The symbol "FilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:52:45 - (ae-forgotten-export) The symbol "IndexPatternFieldMap" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:65:5 - (ae-forgotten-export) The symbol "FormatFieldFn" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:138:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:169:7 - (ae-forgotten-export) The symbol "RuntimeField" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:29:23 - (ae-forgotten-export) The symbol "buildCustomFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:29:23 - (ae-forgotten-export) The symbol "buildFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:46:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:70:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:70:21 - (ae-forgotten-export) The symbol "buildEsQuery" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:133:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:133:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:250:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:250:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:252:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:253:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:262:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:263:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:264:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:268:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:269:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:273:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:276:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:277:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:50:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:67:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:130:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:130:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:246:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:246:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:248:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:249:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:258:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:259:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:260:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:264:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:265:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:269:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:272:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:273:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts // src/plugins/data/server/plugin.ts:81:74 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts // src/plugins/data/server/search/types.ts:115:5 - (ae-forgotten-export) The symbol "ISearchStartSearchSource" needs to be exported by the entry point index.d.ts From 13d3e15bb89b36fcc4f6c30604b6972eacebb0d1 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 12 Jul 2021 12:36:09 +0100 Subject: [PATCH 27/52] Bazel bazel bazel --- packages/kbn-es-query/BUILD.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel index 0f81e4db375af2..b82d178231eb5d 100644 --- a/packages/kbn-es-query/BUILD.bazel +++ b/packages/kbn-es-query/BUILD.bazel @@ -56,6 +56,8 @@ peggy( ], output_dir = True, args = [ + "--allowed-start-rules", + "expression,argument", "-o", "$(@D)/index.js", "./%s/grammar/grammar.peggy" % package_name() From 0603bcdb10985e86dcd61fed575b005310e7de0a Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 12 Jul 2021 13:28:51 +0100 Subject: [PATCH 28/52] i18n --- .../kbn-es-query/src/kuery/kuery_syntax_error.ts | 12 ++++++------ src/dev/i18n/tasks/extract_untracked_translations.ts | 1 + x-pack/plugins/translations/translations/ja-JP.json | 6 ------ x-pack/plugins/translations/translations/zh-CN.json | 6 ------ 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts index a9adbad4781b7c..35fd8d34db6aec 100644 --- a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts @@ -9,21 +9,21 @@ import { repeat } from 'lodash'; import { i18n } from '@kbn/i18n'; -const endOfInputText = i18n.translate('data.common.kql.errors.endOfInputText', { +const endOfInputText = i18n.translate('esquery.kql.errors.endOfInputText', { defaultMessage: 'end of input', }); const grammarRuleTranslations: Record = { - fieldName: i18n.translate('data.common.kql.errors.fieldNameText', { + fieldName: i18n.translate('esquery.kql.errors.fieldNameText', { defaultMessage: 'field name', }), - value: i18n.translate('data.common.kql.errors.valueText', { + value: i18n.translate('esquery.kql.errors.valueText', { defaultMessage: 'value', }), - literal: i18n.translate('data.common.kql.errors.literalText', { + literal: i18n.translate('esquery.kql.errors.literalText', { defaultMessage: 'literal', }), - whitespace: i18n.translate('data.common.kql.errors.whitespaceText', { + whitespace: i18n.translate('esquery.kql.errors.whitespaceText', { defaultMessage: 'whitespace', }), }; @@ -50,7 +50,7 @@ export class KQLSyntaxError extends Error { const translatedExpectationText = translatedExpectations.join(', '); - message = i18n.translate('data.common.kql.errors.syntaxError', { + message = i18n.translate('esquery.kql.errors.syntaxError', { defaultMessage: 'Expected {expectedList} but {foundInput} found.', values: { expectedList: translatedExpectationText, diff --git a/src/dev/i18n/tasks/extract_untracked_translations.ts b/src/dev/i18n/tasks/extract_untracked_translations.ts index 64ac773db27a7c..a86cdb1d7065f0 100644 --- a/src/dev/i18n/tasks/extract_untracked_translations.ts +++ b/src/dev/i18n/tasks/extract_untracked_translations.ts @@ -37,6 +37,7 @@ export async function extractUntrackedMessagesTask({ '**/__fixtures__/**', '**/packages/kbn-i18n/**', '**/packages/kbn-plugin-generator/template/**', + '**/packages/kbn-es-query/**', '**/target/**', '**/test/**', '**/scripts/**', diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 2b1088d8c11aea..43804f924570a9 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -779,12 +779,6 @@ "data.advancedSettings.timepicker.today": "今日", "data.aggTypes.buckets.ranges.rangesFormatMessage": "{gte} {from} と {lt} {to}", "data.aggTypes.buckets.ranges.rangesFormatMessageArrowRight": "{from} → {to}", - "data.common.kql.errors.endOfInputText": "インプットの終わり", - "data.common.kql.errors.fieldNameText": "フィールド名", - "data.common.kql.errors.literalText": "文字通り", - "data.common.kql.errors.syntaxError": "{expectedList} を期待しましたが {foundInput} が検出されました。", - "data.common.kql.errors.valueText": "値", - "data.common.kql.errors.whitespaceText": "空白類", "data.errors.fetchError": "ネットワークとプロキシ構成を確認してください。問題が解決しない場合は、ネットワーク管理者に問い合わせてください。", "data.fieldFormats.boolean.title": "ブール", "data.fieldFormats.bytes.title": "バイト", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 04394a1ac17047..a9a0b90664b82f 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -782,12 +782,6 @@ "data.advancedSettings.timepicker.today": "今日", "data.aggTypes.buckets.ranges.rangesFormatMessage": "{gte} {from} 且 {lt} {to}", "data.aggTypes.buckets.ranges.rangesFormatMessageArrowRight": "{from} → {to}", - "data.common.kql.errors.endOfInputText": "输入结束", - "data.common.kql.errors.fieldNameText": "字段名称", - "data.common.kql.errors.literalText": "文本", - "data.common.kql.errors.syntaxError": "应找到 {expectedList},但却找到了 {foundInput}。", - "data.common.kql.errors.valueText": "值", - "data.common.kql.errors.whitespaceText": "空白", "data.errors.fetchError": "请检查您的网络和代理配置。如果问题持续存在,请联系网络管理员。", "data.fieldFormats.boolean.title": "布尔型", "data.fieldFormats.bytes.title": "字节", From 450a05960b18131f1abccc93e3eb3f7b29452565 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 12 Jul 2021 16:12:09 +0100 Subject: [PATCH 29/52] i18n, stubs, imports and bazel fun --- .i18nrc.json | 1 + packages/kbn-es-query/BUILD.bazel | 2 +- packages/kbn-es-query/src/es_query/index.ts | 1 + .../src/filters/build_filter.test.ts | 8 +- .../src/kuery/grammar/__mocks__/grammar.js | 4098 ++++++++--------- .../src/kuery/kuery_syntax_error.ts | 12 +- .../tasks/extract_untracked_translations.ts | 1 - .../common/es_query/stubs/exists_filter.ts | 23 + .../data/common/es_query/stubs/index.ts | 12 + .../common/es_query/stubs/phrase_filter.ts | 27 + .../common/es_query/stubs/phrases_filter.ts | 25 + .../common/es_query/stubs/range_filter.ts | 29 + src/plugins/data/common/stubs.ts | 2 +- .../request_processors/annotations/types.ts | 2 +- .../vis_type_timeseries/server/types.ts | 2 +- .../vis_type_vega/public/data_model/types.ts | 4 +- .../server/alerts_client/tests/find.test.ts | 2 +- .../VisitorBreakdownMap/useMapFilters.ts | 2 +- x-pack/plugins/ml/common/types/es_client.ts | 3 +- .../embeddables/common/process_filters.ts | 3 +- x-pack/plugins/ml/public/embeddables/types.ts | 8 +- .../columns/report_definition_field.tsx | 2 +- .../series_editor/columns/filter_expanded.tsx | 2 +- .../shared/exploratory_view/types.ts | 4 +- .../components/alerts_table/actions.tsx | 5 +- .../detection_engine/rules/api.test.ts | 2 +- .../detection_engine/reference_rules/query.ts | 4 +- .../lib/detection_engine/signals/types.ts | 2 +- .../server/lib/index_fields/types.ts | 2 +- x-pack/plugins/timelines/common/typed_json.ts | 2 +- .../translations/translations/ja-JP.json | 6 + .../translations/translations/zh-CN.json | 6 + 32 files changed, 2035 insertions(+), 2269 deletions(-) create mode 100644 src/plugins/data/common/es_query/stubs/exists_filter.ts create mode 100644 src/plugins/data/common/es_query/stubs/index.ts create mode 100644 src/plugins/data/common/es_query/stubs/phrase_filter.ts create mode 100644 src/plugins/data/common/es_query/stubs/phrases_filter.ts create mode 100644 src/plugins/data/common/es_query/stubs/range_filter.ts diff --git a/.i18nrc.json b/.i18nrc.json index 390e5e917d08e7..9435e4fe7b3b64 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -27,6 +27,7 @@ "management": ["src/legacy/core_plugins/management", "src/plugins/management"], "maps_legacy": "src/plugins/maps_legacy", "monaco": "packages/kbn-monaco/src", + "esQuery": "packages/kbn-es-query/src", "presentationUtil": "src/plugins/presentation_util", "indexPatternFieldEditor": "src/plugins/index_pattern_field_editor", "indexPatternManagement": "src/plugins/index_pattern_management", diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel index b82d178231eb5d..51f5d6b4594fb8 100644 --- a/packages/kbn-es-query/BUILD.bazel +++ b/packages/kbn-es-query/BUILD.bazel @@ -57,7 +57,7 @@ peggy( output_dir = True, args = [ "--allowed-start-rules", - "expression,argument", + "Expression", "-o", "$(@D)/index.js", "./%s/grammar/grammar.peggy" % package_name() diff --git a/packages/kbn-es-query/src/es_query/index.ts b/packages/kbn-es-query/src/es_query/index.ts index beba50f50dd812..5195d68de903fa 100644 --- a/packages/kbn-es-query/src/es_query/index.ts +++ b/packages/kbn-es-query/src/es_query/index.ts @@ -11,3 +11,4 @@ export { buildQueryFromFilters } from './from_filters'; export { luceneStringToDsl } from './lucene_string_to_dsl'; export { decorateQuery } from './decorate_query'; export { IndexPatternBase, IndexPatternFieldBase, IFieldSubType } from './types'; +export { DslQuery } from './es_query_dsl'; diff --git a/packages/kbn-es-query/src/filters/build_filter.test.ts b/packages/kbn-es-query/src/filters/build_filter.test.ts index 33221e3838d9e7..d7cf7938b3737f 100644 --- a/packages/kbn-es-query/src/filters/build_filter.test.ts +++ b/packages/kbn-es-query/src/filters/build_filter.test.ts @@ -7,9 +7,15 @@ */ import { buildFilter, FilterStateStore, FILTERS } from '.'; -import { stubIndexPattern, stubFields } from '../../../common/stubs'; +import { IndexPatternBase } from '..'; +import { fields as stubFields } from './stubs'; describe('buildFilter', () => { + const stubIndexPattern: IndexPatternBase = { + id: 'logstash-*', + fields: stubFields, + }; + it('should build phrase filters', () => { const params = 'foo'; const alias = 'bar'; diff --git a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js index fb8f3adbcc767a..d58bb023fdfe3a 100644 --- a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js +++ b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js @@ -6,571 +6,607 @@ * Side Public License, v 1. */ -/* eslint-disable */ +// Generated by Peggy 0.11.0. +// +// https://github.com/peggyjs/peggy -module.exports = (function () { - /* - * Generated by PEG.js 0.9.0. - * - * http://pegjs.org/ - */ +/* eslint-disable */ - function peg$subclass(child, parent) { - function ctor() { - this.constructor = child; - } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); +function peg$subclass(child, parent) { + function C() { + this.constructor = child; + } + C.prototype = parent.prototype; + child.prototype = new C(); +} + +function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = 'SyntaxError'; + + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, peg$SyntaxError); } +} - function peg$SyntaxError(message, expected, found, location) { - this.message = message; - this.expected = expected; - this.found = found; - this.location = location; - this.name = 'SyntaxError'; +peg$subclass(peg$SyntaxError, Error); - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, peg$SyntaxError); - } - } +peg$SyntaxError.buildMessage = function (expected, found) { + const DESCRIBE_EXPECTATION_FNS = { + literal: function (expectation) { + return '"' + literalEscape(expectation.text) + '"'; + }, - peg$subclass(peg$SyntaxError, Error); + class: function (expectation) { + const escapedParts = expectation.parts.map(function (part) { + return Array.isArray(part) + ? classEscape(part[0]) + '-' + classEscape(part[1]) + : classEscape(part); + }); - function peg$parse(input) { - const options = arguments.length > 1 ? arguments[1] : {}; - const parser = this; + return '[' + (expectation.inverted ? '^' : '') + escapedParts + ']'; + }, - const peg$FAILED = {}; + any: function () { + return 'any character'; + }, - const peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral }; - let peg$startRuleFunction = peg$parsestart; + end: function () { + return 'end of input'; + }, - const peg$c0 = function (query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - if (query !== null) return query; - return nodeTypes.function.buildNode('is', '*', '*'); - }; - const peg$c1 = function (head, query) { - return query; - }; - const peg$c2 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('or', nodes); - }; - const peg$c3 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('and', nodes); - }; - const peg$c4 = function (query) { - if (query.type === 'cursor') return query; - return buildFunctionNode('not', [query]); - }; - const peg$c5 = '('; - const peg$c6 = { type: 'literal', value: '(', description: '"("' }; - const peg$c7 = ')'; - const peg$c8 = { type: 'literal', value: ')', description: '")"' }; - const peg$c9 = function (query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - return query; - }; - const peg$c10 = ':'; - const peg$c11 = { type: 'literal', value: ':', description: '":"' }; - const peg$c12 = '{'; - const peg$c13 = { type: 'literal', value: '{', description: '"{"' }; - const peg$c14 = '}'; - const peg$c15 = { type: 'literal', value: '}', description: '"}"' }; - const peg$c16 = function (field, query, trailing) { - if (query.type === 'cursor') { - return { - ...query, - nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, - }; - } - - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - return buildFunctionNode('nested', [field, query]); - }; - const peg$c17 = { type: 'other', description: 'fieldName' }; - const peg$c18 = function (field, operator, value) { - if (value.type === 'cursor') { - return { - ...value, - suggestionTypes: ['conjunction'], - }; - } - const range = buildNamedArgNode(operator, value); - return buildFunctionNode('range', [field, range]); - }; - const peg$c19 = function (field, partial) { - if (partial.type === 'cursor') { - return { - ...partial, - fieldName: field.value, - suggestionTypes: ['value', 'conjunction'], - }; - } - return partial(field); - }; - const peg$c20 = function (partial) { - if (partial.type === 'cursor') { - const fieldName = `${partial.prefix}${partial.suffix}`.trim(); - return { - ...partial, - fieldName, - suggestionTypes: ['field', 'operator', 'conjunction'], - }; - } - const field = buildLiteralNode(null); - return partial(field); - }; - const peg$c21 = function (partial, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - return partial; - }; - const peg$c22 = function (head, partial) { - return partial; - }; - const peg$c23 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'], - }; - } - return (field) => - buildFunctionNode( - 'or', - nodes.map((partial) => partial(field)) - ); - }; - const peg$c24 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'], - }; - } - return (field) => - buildFunctionNode( - 'and', - nodes.map((partial) => partial(field)) - ); - }; - const peg$c25 = function (partial) { - if (partial.type === 'cursor') { - return { - ...list, - suggestionTypes: ['value'], - }; - } - return (field) => buildFunctionNode('not', [partial(field)]); - }; - const peg$c26 = { type: 'other', description: 'value' }; - const peg$c27 = function (value) { - if (value.type === 'cursor') return value; - const isPhrase = buildLiteralNode(true); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }; - const peg$c28 = function (value) { - if (value.type === 'cursor') return value; - - if ( - !allowLeadingWildcards && - value.type === 'wildcard' && - nodeTypes.wildcard.hasLeadingWildcard(value) - ) { - error( - 'Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.' - ); - } + other: function (expectation) { + return expectation.description; + }, + }; - const isPhrase = buildLiteralNode(false); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }; - const peg$c29 = { type: 'other', description: 'OR' }; - const peg$c30 = 'or'; - const peg$c31 = { type: 'literal', value: 'or', description: '"or"' }; - const peg$c32 = { type: 'other', description: 'AND' }; - const peg$c33 = 'and'; - const peg$c34 = { type: 'literal', value: 'and', description: '"and"' }; - const peg$c35 = { type: 'other', description: 'NOT' }; - const peg$c36 = 'not'; - const peg$c37 = { type: 'literal', value: 'not', description: '"not"' }; - const peg$c38 = { type: 'other', description: 'literal' }; - const peg$c39 = function () { - return parseCursor; - }; - const peg$c40 = '"'; - const peg$c41 = { type: 'literal', value: '"', description: '"\\""' }; - const peg$c42 = function (prefix, cursor, suffix) { - const { start, end } = location(); - return { - type: 'cursor', - start: start.offset, - end: end.offset - cursor.length, - prefix: prefix.join(''), - suffix: suffix.join(''), - text: text().replace(cursor, ''), - }; - }; - const peg$c43 = function (chars) { - return buildLiteralNode(chars.join('')); - }; - const peg$c44 = '\\'; - const peg$c45 = { type: 'literal', value: '\\', description: '"\\\\"' }; - const peg$c46 = /^[\\"]/; - const peg$c47 = { type: 'class', value: '[\\\\"]', description: '[\\\\"]' }; - const peg$c48 = function (char) { - return char; - }; - const peg$c49 = /^[^"]/; - const peg$c50 = { type: 'class', value: '[^"]', description: '[^"]' }; - const peg$c51 = function (chars) { - const sequence = chars.join('').trim(); - if (sequence === 'null') return buildLiteralNode(null); - if (sequence === 'true') return buildLiteralNode(true); - if (sequence === 'false') return buildLiteralNode(false); - if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); - return buildLiteralNode(sequence); - }; - const peg$c52 = { type: 'any', description: 'any character' }; - const peg$c53 = '*'; - const peg$c54 = { type: 'literal', value: '*', description: '"*"' }; - const peg$c55 = function () { - return wildcardSymbol; - }; - const peg$c56 = '\\t'; - const peg$c57 = { type: 'literal', value: '\\t', description: '"\\\\t"' }; - const peg$c58 = function () { - return '\t'; - }; - const peg$c59 = '\\r'; - const peg$c60 = { type: 'literal', value: '\\r', description: '"\\\\r"' }; - const peg$c61 = function () { - return '\r'; - }; - const peg$c62 = '\\n'; - const peg$c63 = { type: 'literal', value: '\\n', description: '"\\\\n"' }; - const peg$c64 = function () { - return '\n'; - }; - const peg$c65 = function (keyword) { - return keyword; - }; - const peg$c66 = /^[\\():<>"*{}]/; - const peg$c67 = { type: 'class', value: '[\\\\():<>"*{}]', description: '[\\\\():<>"*{}]' }; - const peg$c68 = function (sequence) { - return sequence; - }; - const peg$c69 = 'u'; - const peg$c70 = { type: 'literal', value: 'u', description: '"u"' }; - const peg$c71 = function (digits) { - return String.fromCharCode(parseInt(digits, 16)); - }; - const peg$c72 = /^[0-9a-f]/i; - const peg$c73 = { type: 'class', value: '[0-9a-f]i', description: '[0-9a-f]i' }; - const peg$c74 = '<='; - const peg$c75 = { type: 'literal', value: '<=', description: '"<="' }; - const peg$c76 = function () { - return 'lte'; - }; - const peg$c77 = '>='; - const peg$c78 = { type: 'literal', value: '>=', description: '">="' }; - const peg$c79 = function () { - return 'gte'; - }; - const peg$c80 = '<'; - const peg$c81 = { type: 'literal', value: '<', description: '"<"' }; - const peg$c82 = function () { - return 'lt'; - }; - const peg$c83 = '>'; - const peg$c84 = { type: 'literal', value: '>', description: '">"' }; - const peg$c85 = function () { - return 'gt'; - }; - const peg$c86 = { type: 'other', description: 'whitespace' }; - const peg$c87 = /^[ \t\r\n\xA0]/; - const peg$c88 = { - type: 'class', - value: '[\\ \\t\\r\\n\\u00A0]', - description: '[\\ \\t\\r\\n\\u00A0]', - }; - const peg$c89 = '@kuery-cursor@'; - const peg$c90 = { type: 'literal', value: '@kuery-cursor@', description: '"@kuery-cursor@"' }; - const peg$c91 = function () { - return cursorSymbol; - }; + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } - let peg$currPos = 0; - let peg$savedPos = 0; - const peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }]; - let peg$maxFailPos = 0; - let peg$maxFailExpected = []; - let peg$silentFails = 0; + function literalEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch); + }); + } - const peg$resultsCache = {}; + function classEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/\]/g, '\\]') + .replace(/\^/g, '\\^') + .replace(/-/g, '\\-') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch); + }); + } - let peg$result; + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } - if ('startRule' in options) { - if (!(options.startRule in peg$startRuleFunctions)) { - throw new Error('Can\'t start parsing from rule "' + options.startRule + '".'); - } + function describeExpected(expected) { + const descriptions = expected.map(describeExpectation); + let i; + let j; - peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; - } + descriptions.sort(); - function text() { - return input.substring(peg$savedPos, peg$currPos); + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + descriptions.length = j; } - function location() { - return peg$computeLocation(peg$savedPos, peg$currPos); - } + switch (descriptions.length) { + case 1: + return descriptions[0]; - function expected(description) { - throw peg$buildException( - null, - [{ type: 'other', description: description }], - input.substring(peg$savedPos, peg$currPos), - peg$computeLocation(peg$savedPos, peg$currPos) - ); - } + case 2: + return descriptions[0] + ' or ' + descriptions[1]; - function error(message) { - throw peg$buildException( - message, - null, - input.substring(peg$savedPos, peg$currPos), - peg$computeLocation(peg$savedPos, peg$currPos) - ); + default: + return ( + descriptions.slice(0, -1).join(', ') + ', or ' + descriptions[descriptions.length - 1] + ); } + } + + function describeFound(found) { + return found ? '"' + literalEscape(found) + '"' : 'end of input'; + } - function peg$computePosDetails(pos) { - let details = peg$posDetailsCache[pos]; - let p; - let ch; + return 'Expected ' + describeExpected(expected) + ' but ' + describeFound(found) + ' found.'; +}; - if (details) { - return details; - } else { - p = pos - 1; - while (!peg$posDetailsCache[p]) { - p--; - } +function peg$parse(input, options) { + options = options !== undefined ? options : {}; - details = peg$posDetailsCache[p]; - details = { - line: details.line, - column: details.column, - seenCR: details.seenCR, - }; - - while (p < pos) { - ch = input.charAt(p); - if (ch === '\n') { - if (!details.seenCR) { - details.line++; - } - details.column = 1; - details.seenCR = false; - } else if (ch === '\r' || ch === '\u2028' || ch === '\u2029') { - details.line++; - details.column = 1; - details.seenCR = true; - } else { - details.column++; - details.seenCR = false; - } + const peg$FAILED = {}; - p++; - } + const peg$startRuleFunctions = { expression: peg$parseexpression, argument: peg$parseargument }; + let peg$startRuleFunction = peg$parseexpression; - peg$posDetailsCache[pos] = details; - return details; - } + const peg$c0 = function (query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + if (query !== null) return query; + return nodeTypes.function.buildNode('is', '*', '*'); + }; + const peg$c1 = function (head, query) { + return query; + }; + const peg$c2 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('or', nodes); + }; + const peg$c3 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('and', nodes); + }; + const peg$c4 = function (query) { + if (query.type === 'cursor') return query; + return buildFunctionNode('not', [query]); + }; + const peg$c5 = '('; + const peg$c6 = peg$literalExpectation('(', false); + const peg$c7 = ')'; + const peg$c8 = peg$literalExpectation(')', false); + const peg$c9 = function (query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + return query; + }; + const peg$c10 = ':'; + const peg$c11 = peg$literalExpectation(':', false); + const peg$c12 = '{'; + const peg$c13 = peg$literalExpectation('{', false); + const peg$c14 = '}'; + const peg$c15 = peg$literalExpectation('}', false); + const peg$c16 = function (field, query, trailing) { + if (query.type === 'cursor') { + return { + ...query, + nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, + }; } - function peg$computeLocation(startPos, endPos) { - const startPosDetails = peg$computePosDetails(startPos); - const endPosDetails = peg$computePosDetails(endPos); - + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + return buildFunctionNode('nested', [field, query]); + }; + const peg$c17 = peg$otherExpectation('fieldName'); + const peg$c18 = function (field, operator, value) { + if (value.type === 'cursor') { + return { + ...value, + suggestionTypes: ['conjunction'], + }; + } + const range = buildNamedArgNode(operator, value); + return buildFunctionNode('range', [field, range]); + }; + const peg$c19 = function (field, partial) { + if (partial.type === 'cursor') { + return { + ...partial, + fieldName: field.value, + suggestionTypes: ['value', 'conjunction'], + }; + } + return partial(field); + }; + const peg$c20 = function (partial) { + if (partial.type === 'cursor') { + const fieldName = `${partial.prefix}${partial.suffix}`.trim(); + return { + ...partial, + fieldName, + suggestionTypes: ['field', 'operator', 'conjunction'], + }; + } + const field = buildLiteralNode(null); + return partial(field); + }; + const peg$c21 = function (partial, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'], + }; + } + return partial; + }; + const peg$c22 = function (head, partial) { + return partial; + }; + const peg$c23 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'], + }; + } + return (field) => + buildFunctionNode( + 'or', + nodes.map((partial) => partial(field)) + ); + }; + const peg$c24 = function (head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'], + }; + } + return (field) => + buildFunctionNode( + 'and', + nodes.map((partial) => partial(field)) + ); + }; + const peg$c25 = function (partial) { + if (partial.type === 'cursor') { return { - start: { - offset: startPos, - line: startPosDetails.line, - column: startPosDetails.column, - }, - end: { - offset: endPos, - line: endPosDetails.line, - column: endPosDetails.column, - }, + ...list, + suggestionTypes: ['value'], }; } + return (field) => buildFunctionNode('not', [partial(field)]); + }; + const peg$c26 = peg$otherExpectation('value'); + const peg$c27 = function (value) { + if (value.type === 'cursor') return value; + const isPhrase = buildLiteralNode(true); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + const peg$c28 = function (value) { + if (value.type === 'cursor') return value; + + if ( + !allowLeadingWildcards && + value.type === 'wildcard' && + nodeTypes.wildcard.hasLeadingWildcard(value) + ) { + error( + 'Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.' + ); + } - function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { - return; - } + const isPhrase = buildLiteralNode(false); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + const peg$c29 = peg$otherExpectation('OR'); + const peg$c30 = 'or'; + const peg$c31 = peg$literalExpectation('or', true); + const peg$c32 = peg$otherExpectation('AND'); + const peg$c33 = 'and'; + const peg$c34 = peg$literalExpectation('and', true); + const peg$c35 = peg$otherExpectation('NOT'); + const peg$c36 = 'not'; + const peg$c37 = peg$literalExpectation('not', true); + const peg$c38 = peg$otherExpectation('literal'); + const peg$c39 = function () { + return parseCursor; + }; + const peg$c40 = '"'; + const peg$c41 = peg$literalExpectation('"', false); + const peg$c42 = function (prefix, cursor, suffix) { + const { start, end } = location(); + return { + type: 'cursor', + start: start.offset, + end: end.offset - cursor.length, + prefix: prefix.join(''), + suffix: suffix.join(''), + text: text().replace(cursor, ''), + }; + }; + const peg$c43 = function (chars) { + return buildLiteralNode(chars.join('')); + }; + const peg$c44 = '\\'; + const peg$c45 = peg$literalExpectation('\\', false); + const peg$c46 = /^[\\"]/; + const peg$c47 = peg$classExpectation(['\\', '"'], false, false); + const peg$c48 = function (char) { + return char; + }; + const peg$c49 = /^[^"]/; + const peg$c50 = peg$classExpectation(['"'], true, false); + const peg$c51 = function (chars) { + const sequence = chars.join('').trim(); + if (sequence === 'null') return buildLiteralNode(null); + if (sequence === 'true') return buildLiteralNode(true); + if (sequence === 'false') return buildLiteralNode(false); + if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); + return buildLiteralNode(sequence); + }; + const peg$c52 = peg$anyExpectation(); + const peg$c53 = '*'; + const peg$c54 = peg$literalExpectation('*', false); + const peg$c55 = function () { + return wildcardSymbol; + }; + const peg$c56 = '\\t'; + const peg$c57 = peg$literalExpectation('\\t', false); + const peg$c58 = function () { + return '\t'; + }; + const peg$c59 = '\\r'; + const peg$c60 = peg$literalExpectation('\\r', false); + const peg$c61 = function () { + return '\r'; + }; + const peg$c62 = '\\n'; + const peg$c63 = peg$literalExpectation('\\n', false); + const peg$c64 = function () { + return '\n'; + }; + const peg$c65 = function (keyword) { + return keyword; + }; + const peg$c66 = /^[\\():<>"*{}]/; + const peg$c67 = peg$classExpectation( + ['\\', '(', ')', ':', '<', '>', '"', '*', '{', '}'], + false, + false + ); + const peg$c68 = function (sequence) { + return sequence; + }; + const peg$c69 = 'u'; + const peg$c70 = peg$literalExpectation('u', false); + const peg$c71 = function (digits) { + return String.fromCharCode(parseInt(digits, 16)); + }; + const peg$c72 = /^[0-9a-f]/i; + const peg$c73 = peg$classExpectation( + [ + ['0', '9'], + ['a', 'f'], + ], + false, + true + ); + const peg$c74 = '<='; + const peg$c75 = peg$literalExpectation('<=', false); + const peg$c76 = function () { + return 'lte'; + }; + const peg$c77 = '>='; + const peg$c78 = peg$literalExpectation('>=', false); + const peg$c79 = function () { + return 'gte'; + }; + const peg$c80 = '<'; + const peg$c81 = peg$literalExpectation('<', false); + const peg$c82 = function () { + return 'lt'; + }; + const peg$c83 = '>'; + const peg$c84 = peg$literalExpectation('>', false); + const peg$c85 = function () { + return 'gt'; + }; + const peg$c86 = peg$otherExpectation('whitespace'); + const peg$c87 = /^[ \t\r\n\xA0]/; + const peg$c88 = peg$classExpectation([' ', '\t', '\r', '\n', '\xA0'], false, false); + const peg$c89 = '@kuery-cursor@'; + const peg$c90 = peg$literalExpectation('@kuery-cursor@', false); + const peg$c91 = function () { + return cursorSymbol; + }; - if (peg$currPos > peg$maxFailPos) { - peg$maxFailPos = peg$currPos; - peg$maxFailExpected = []; - } + let peg$currPos = 0; + let peg$savedPos = 0; + const peg$posDetailsCache = [{ line: 1, column: 1 }]; + let peg$maxFailPos = 0; + let peg$maxFailExpected = []; + let peg$silentFails = 0; + + let peg$result; - peg$maxFailExpected.push(expected); + if ('startRule' in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error('Can\'t start parsing from rule "' + options.startRule + '".'); } - function peg$buildException(message, expected, found, location) { - function cleanupExpected(expected) { - let i = 1; + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } - expected.sort(function (a, b) { - if (a.description < b.description) { - return -1; - } else if (a.description > b.description) { - return 1; - } else { - return 0; - } - }); + function text() { + return input.substring(peg$savedPos, peg$currPos); + } - while (i < expected.length) { - if (expected[i - 1] === expected[i]) { - expected.splice(i, 1); - } else { - i++; - } - } - } + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); + } - function buildMessage(expected, found) { - function stringEscape(s) { - function hex(ch) { - return ch.charCodeAt(0).toString(16).toUpperCase(); - } + function expected(description, location) { + location = location !== undefined ? location : peg$computeLocation(peg$savedPos, peg$currPos); - return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\x08/g, '\\b') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\f/g, '\\f') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function (ch) { - return '\\x0' + hex(ch); - }) - .replace(/[\x10-\x1F\x80-\xFF]/g, function (ch) { - return '\\x' + hex(ch); - }) - .replace(/[\u0100-\u0FFF]/g, function (ch) { - return '\\u0' + hex(ch); - }) - .replace(/[\u1000-\uFFFF]/g, function (ch) { - return '\\u' + hex(ch); - }); - } + throw peg$buildStructuredError( + [peg$otherExpectation(description)], + input.substring(peg$savedPos, peg$currPos), + location + ); + } - const expectedDescs = new Array(expected.length); - let expectedDesc; - let foundDesc; - let i; + function error(message, location) { + location = location !== undefined ? location : peg$computeLocation(peg$savedPos, peg$currPos); - for (i = 0; i < expected.length; i++) { - expectedDescs[i] = expected[i].description; - } + throw peg$buildSimpleError(message, location); + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: 'literal', text: text, ignoreCase: ignoreCase }; + } - expectedDesc = - expected.length > 1 - ? expectedDescs.slice(0, -1).join(', ') + ' or ' + expectedDescs[expected.length - 1] - : expectedDescs[0]; + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: 'class', parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$anyExpectation() { + return { type: 'any' }; + } + + function peg$endExpectation() { + return { type: 'end' }; + } + + function peg$otherExpectation(description) { + return { type: 'other', description: description }; + } - foundDesc = found ? '"' + stringEscape(found) + '"' : 'end of input'; + function peg$computePosDetails(pos) { + let details = peg$posDetailsCache[pos]; + let p; - return 'Expected ' + expectedDesc + ' but ' + foundDesc + ' found.'; + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; } - if (expected !== null) { - cleanupExpected(expected); + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column, + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; } - return new peg$SyntaxError( - message !== null ? message : buildMessage(expected, found), - expected, - found, - location - ); + peg$posDetailsCache[pos] = details; + + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + const startPosDetails = peg$computePosDetails(startPos); + const endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column, + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column, + }, + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { + return; } - function peg$parsestart() { - let s0; - let s1; - let s2; - let s3; + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } - const key = peg$currPos * 37 + 0; - const cached = peg$resultsCache[key]; + peg$maxFailExpected.push(expected); + } - if (cached) { - peg$currPos = cached.nextPos; + function peg$buildSimpleError(message, location) { + return new peg$SyntaxError(message, null, null, location); + } - return cached.result; - } + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } - s0 = peg$currPos; - s1 = []; + function peg$parsestart() { + let s0; + let s1; + let s2; + let s3; + + s0 = peg$currPos; + s1 = []; + s2 = peg$parseSpace(); + while (s2 !== peg$FAILED) { + s1.push(s2); s2 = peg$parseSpace(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); + } + if (s1 !== peg$FAILED) { + s2 = peg$parseOrQuery(); + if (s2 === peg$FAILED) { + s2 = null; } - if (s1 !== peg$FAILED) { - s2 = peg$parseOrQuery(); - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - s3 = peg$parseOptionalSpace(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c0(s2, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s2 !== peg$FAILED) { + s3 = peg$parseOptionalSpace(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s2, s3); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -579,269 +615,225 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseOrQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 1; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseAndQuery(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + function peg$parseOrQuery() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + s0 = peg$currPos; + s1 = peg$parseAndQuery(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } + } else { + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c2(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c2(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseAndQuery(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseAndQuery(); } - function peg$parseAndQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 2; - const cached = peg$resultsCache[key]; + return s0; + } - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseNotQuery(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + function peg$parseAndQuery() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + s0 = peg$currPos; + s1 = peg$parseNotQuery(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } + } else { + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c3(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c3(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseNotQuery(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNotQuery(); } - function peg$parseNotQuery() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 3; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseNotQuery() { + let s0; + let s1; + let s2; - s0 = peg$currPos; - s1 = peg$parseNot(); - if (s1 !== peg$FAILED) { - s2 = peg$parseSubQuery(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c4(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s0 = peg$currPos; + s1 = peg$parseNot(); + if (s1 !== peg$FAILED) { + s2 = peg$parseSubQuery(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c4(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseSubQuery(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseSubQuery(); } - function peg$parseSubQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 4; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c5; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c6); - } + function peg$parseSubQuery() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c5; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c6); } - if (s1 !== peg$FAILED) { - s2 = []; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseOrQuery(); - if (s3 !== peg$FAILED) { - s4 = peg$parseOptionalSpace(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c7; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c8); - } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c9(s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s3 = peg$parseOrQuery(); + if (s3 !== peg$FAILED) { + s4 = peg$parseOptionalSpace(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c7; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c8); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c9(s3, s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -858,101 +850,90 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseNestedQuery(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNestedQuery(); } - function peg$parseNestedQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - let s6; - let s7; - let s8; - let s9; - - const key = peg$currPos * 37 + 5; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseField(); - if (s1 !== peg$FAILED) { - s2 = []; + function peg$parseNestedQuery() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + let s6; + let s7; + let s8; + let s9; + + s0 = peg$currPos; + s1 = peg$parseField(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c10; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c11); - } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c10; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c11); } - if (s3 !== peg$FAILED) { - s4 = []; + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 123) { - s5 = peg$c12; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c13); - } + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s5 = peg$c12; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c13); } - if (s5 !== peg$FAILED) { - s6 = []; + } + if (s5 !== peg$FAILED) { + s6 = []; + s7 = peg$parseSpace(); + while (s7 !== peg$FAILED) { + s6.push(s7); s7 = peg$parseSpace(); - while (s7 !== peg$FAILED) { - s6.push(s7); - s7 = peg$parseSpace(); - } - if (s6 !== peg$FAILED) { - s7 = peg$parseOrQuery(); - if (s7 !== peg$FAILED) { - s8 = peg$parseOptionalSpace(); - if (s8 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s9 = peg$c14; - peg$currPos++; - } else { - s9 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c15); - } - } - if (s9 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c16(s1, s7, s8); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; + } + if (s6 !== peg$FAILED) { + s7 = peg$parseOrQuery(); + if (s7 !== peg$FAILED) { + s8 = peg$parseOptionalSpace(); + if (s8 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s9 = peg$c14; + peg$currPos++; + } else { + s9 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c15); } + } + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c16(s1, s7, s8); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -985,113 +966,80 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseExpression(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseExpression(); } - function peg$parseExpression() { - let s0; - - const key = peg$currPos * 37 + 6; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseExpression() { + let s0; - s0 = peg$parseFieldRangeExpression(); + s0 = peg$parseFieldRangeExpression(); + if (s0 === peg$FAILED) { + s0 = peg$parseFieldValueExpression(); if (s0 === peg$FAILED) { - s0 = peg$parseFieldValueExpression(); - if (s0 === peg$FAILED) { - s0 = peg$parseValueExpression(); - } + s0 = peg$parseValueExpression(); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseField() { - let s0; - let s1; - - const key = peg$currPos * 37 + 7; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseField() { + let s0; + let s1; - peg$silentFails++; - s0 = peg$parseLiteral(); - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c17); - } + peg$silentFails++; + s0 = peg$parseLiteral(); + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c17); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseFieldRangeExpression() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 8; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseField(); - if (s1 !== peg$FAILED) { - s2 = []; + function peg$parseFieldRangeExpression() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + s0 = peg$currPos; + s1 = peg$parseField(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseRangeOperator(); - if (s3 !== peg$FAILED) { - s4 = []; + } + if (s2 !== peg$FAILED) { + s3 = peg$parseRangeOperator(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseLiteral(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c18(s1, s3, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s4 !== peg$FAILED) { + s5 = peg$parseLiteral(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c18(s1, s3, s5); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1108,65 +1056,54 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseFieldValueExpression() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 9; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseField(); - if (s1 !== peg$FAILED) { - s2 = []; + function peg$parseFieldValueExpression() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + s0 = peg$currPos; + s1 = peg$parseField(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c10; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c11); - } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c10; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c11); } - if (s3 !== peg$FAILED) { - s4 = []; + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c19(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s4 !== peg$FAILED) { + s5 = peg$parseListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c19(s1, s5); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1183,94 +1120,72 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseValueExpression() { - let s0; - let s1; + return s0; + } - const key = peg$currPos * 37 + 10; - const cached = peg$resultsCache[key]; + function peg$parseValueExpression() { + let s0; + let s1; - if (cached) { - peg$currPos = cached.nextPos; + s0 = peg$currPos; + s1 = peg$parseValue(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c20(s1); + } + s0 = s1; - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseValue(); - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c20(s1); + function peg$parseListOfValues() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c5; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c6); } - s0 = s1; - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - - function peg$parseListOfValues() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 11; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c5; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c6); - } - } - if (s1 !== peg$FAILED) { - s2 = []; + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseOrListOfValues(); - if (s3 !== peg$FAILED) { - s4 = peg$parseOptionalSpace(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c7; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c8); - } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c21(s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s3 = peg$parseOrListOfValues(); + if (s3 !== peg$FAILED) { + s4 = peg$parseOptionalSpace(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c7; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c8); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c21(s3, s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1287,315 +1202,260 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseValue(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseValue(); } - function peg$parseOrListOfValues() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 12; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseAndListOfValues(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + function peg$parseOrListOfValues() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + s0 = peg$currPos; + s1 = peg$parseAndListOfValues(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } + } else { + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c23(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c23(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseAndListOfValues(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseAndListOfValues(); } - function peg$parseAndListOfValues() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 13; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - s1 = peg$parseNotListOfValues(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + function peg$parseAndListOfValues() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + s0 = peg$currPos; + s1 = peg$parseNotListOfValues(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseAnd(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNotListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseAnd(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNotListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c22(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } + } else { + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c24(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c24(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseNotListOfValues(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNotListOfValues(); } - function peg$parseNotListOfValues() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 14; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseNotListOfValues() { + let s0; + let s1; + let s2; - s0 = peg$currPos; - s1 = peg$parseNot(); - if (s1 !== peg$FAILED) { - s2 = peg$parseListOfValues(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c25(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s0 = peg$currPos; + s1 = peg$parseNot(); + if (s1 !== peg$FAILED) { + s2 = peg$parseListOfValues(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c25(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseListOfValues(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseListOfValues(); } - function peg$parseValue() { - let s0; - let s1; - - const key = peg$currPos * 37 + 15; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseValue() { + let s0; + let s1; - peg$silentFails++; + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parseQuotedString(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c27(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { s0 = peg$currPos; - s1 = peg$parseQuotedString(); + s1 = peg$parseUnquotedLiteral(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c27(s1); + s1 = peg$c28(s1); } s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseUnquotedLiteral(); - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c28(s1); - } - s0 = s1; - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c26); - } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c26); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseOr() { - let s0; - let s1; - let s2; - let s3; - let s4; - - const key = peg$currPos * 37 + 16; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; + function peg$parseOr() { + let s0; + let s1; + let s2; + let s3; + let s4; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = peg$parseSpace(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseSpace(); } - - peg$silentFails++; - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { + s2 = input.substr(peg$currPos, 2); + peg$currPos += 2; } else { - s1 = peg$FAILED; + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c31); + } } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { - s2 = input.substr(peg$currPos, 2); - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c31); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parseSpace(); + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parseSpace(); } + } else { + s3 = peg$FAILED; } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - } else { - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s3 !== peg$FAILED) { + s1 = [s1, s2, s3]; + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1604,75 +1464,64 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c29); - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c29); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseAnd() { - let s0; - let s1; - let s2; - let s3; - let s4; - - const key = peg$currPos * 37 + 17; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; + function peg$parseAnd() { + let s0; + let s1; + let s2; + let s3; + let s4; + + peg$silentFails++; + s0 = peg$currPos; + s1 = []; + s2 = peg$parseSpace(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseSpace(); } - - peg$silentFails++; - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { + s2 = input.substr(peg$currPos, 3); + peg$currPos += 3; } else { - s1 = peg$FAILED; + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c34); + } } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { - s2 = input.substr(peg$currPos, 3); - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c34); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parseSpace(); + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parseSpace(); } + } else { + s3 = peg$FAILED; } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - } else { - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s3 !== peg$FAILED) { + s1 = [s1, s2, s3]; + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1681,59 +1530,160 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c32); - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c32); } + } - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } - return s0; + function peg$parseNot() { + let s0; + let s1; + let s2; + let s3; + + peg$silentFails++; + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c37); + } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c35); + } } - function peg$parseNot() { - let s0; - let s1; - let s2; - let s3; - - const key = peg$currPos * 37 + 18; - const cached = peg$resultsCache[key]; + return s0; + } - if (cached) { - peg$currPos = cached.nextPos; + function peg$parseLiteral() { + let s0; + let s1; - return cached.result; + peg$silentFails++; + s0 = peg$parseQuotedString(); + if (s0 === peg$FAILED) { + s0 = peg$parseUnquotedLiteral(); + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c38); } + } - peg$silentFails++; - s0 = peg$currPos; - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { - s1 = input.substr(peg$currPos, 3); - peg$currPos += 3; + return s0; + } + + function peg$parseQuotedString() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + let s6; + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s2 = peg$c40; + peg$currPos++; } else { - s1 = peg$FAILED; + s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c37); + peg$fail(peg$c41); } } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - } else { - s2 = peg$FAILED; + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parseQuotedCharacter(); + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parseQuotedCharacter(); } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; + if (s3 !== peg$FAILED) { + s4 = peg$parseCursor(); + if (s4 !== peg$FAILED) { + s5 = []; + s6 = peg$parseQuotedCharacter(); + while (s6 !== peg$FAILED) { + s5.push(s6); + s6 = peg$parseQuotedCharacter(); + } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s6 = peg$c40; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } + } + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c42(s3, s4, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1742,128 +1692,42 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c35); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLiteral() { - let s0; - let s1; - - const key = peg$currPos * 37 + 19; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - peg$silentFails++; - s0 = peg$parseQuotedString(); - if (s0 === peg$FAILED) { - s0 = peg$parseUnquotedLiteral(); - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c38); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - function peg$parseQuotedString() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - let s6; - - const key = peg$currPos * 37 + 20; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - + if (s0 === peg$FAILED) { s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c40; + peg$currPos++; } else { s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } } if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c40; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } + s2 = []; + s3 = peg$parseQuotedCharacter(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseQuotedCharacter(); } if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseQuotedCharacter(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseQuotedCharacter(); + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c40; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c41); + } } if (s3 !== peg$FAILED) { - s4 = peg$parseCursor(); - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseQuotedCharacter(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseQuotedCharacter(); - } - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c40; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } - } - if (s6 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s3, s4, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + peg$savedPos = s0; + s1 = peg$c43(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1876,42 +1740,44 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } + } + + return s0; + } + + function peg$parseQuotedCharacter() { + let s0; + let s1; + let s2; + + s0 = peg$parseEscapedWhitespace(); + if (s0 === peg$FAILED) { + s0 = peg$parseEscapedUnicodeSequence(); if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c40; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c41); + peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseQuotedCharacter(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseQuotedCharacter(); + if (peg$c46.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c47); + } } if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c40; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c43(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + peg$savedPos = s0; + s1 = peg$c48(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1920,49 +1786,26 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseQuotedCharacter() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 21; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseEscapedWhitespace(); - if (s0 === peg$FAILED) { - s0 = peg$parseEscapedUnicodeSequence(); if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; + s1 = peg$currPos; + peg$silentFails++; + s2 = peg$parseCursor(); + peg$silentFails--; + if (s2 === peg$FAILED) { + s1 = undefined; } else { + peg$currPos = s1; s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } } if (s1 !== peg$FAILED) { - if (peg$c46.test(input.charAt(peg$currPos))) { + if (peg$c49.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c47); + peg$fail(peg$c50); } } if (s2 !== peg$FAILED) { @@ -1977,98 +1820,49 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - s2 = peg$parseCursor(); - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = void 0; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (peg$c49.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c50); - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c48(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseUnquotedLiteral() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 22; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = []; + function peg$parseUnquotedLiteral() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseUnquotedCharacter(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseUnquotedCharacter(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseUnquotedCharacter(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseCursor(); - if (s3 !== peg$FAILED) { - s4 = []; + } + if (s2 !== peg$FAILED) { + s3 = peg$parseCursor(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseUnquotedCharacter(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseUnquotedCharacter(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseUnquotedCharacter(); - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s2, s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c42(s2, s3, s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2081,107 +1875,96 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - s2 = peg$parseUnquotedCharacter(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseUnquotedCharacter(); - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c51(s1); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = []; + s2 = peg$parseUnquotedCharacter(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseUnquotedCharacter(); } - s0 = s1; + } else { + s1 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c51(s1); + } + s0 = s1; } - function peg$parseUnquotedCharacter() { - let s0; - let s1; - let s2; - let s3; - let s4; - - const key = peg$currPos * 37 + 23; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseUnquotedCharacter() { + let s0; + let s1; + let s2; + let s3; + let s4; - s0 = peg$parseEscapedWhitespace(); + s0 = peg$parseEscapedWhitespace(); + if (s0 === peg$FAILED) { + s0 = peg$parseEscapedSpecialCharacter(); if (s0 === peg$FAILED) { - s0 = peg$parseEscapedSpecialCharacter(); + s0 = peg$parseEscapedUnicodeSequence(); if (s0 === peg$FAILED) { - s0 = peg$parseEscapedUnicodeSequence(); + s0 = peg$parseEscapedKeyword(); if (s0 === peg$FAILED) { - s0 = peg$parseEscapedKeyword(); + s0 = peg$parseWildcard(); if (s0 === peg$FAILED) { - s0 = peg$parseWildcard(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; + s0 = peg$currPos; + s1 = peg$currPos; + peg$silentFails++; + s2 = peg$parseSpecialCharacter(); + peg$silentFails--; + if (s2 === peg$FAILED) { + s1 = undefined; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; peg$silentFails++; - s2 = peg$parseSpecialCharacter(); + s3 = peg$parseKeyword(); peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = void 0; + if (s3 === peg$FAILED) { + s2 = undefined; } else { - peg$currPos = s1; - s1 = peg$FAILED; + peg$currPos = s2; + s2 = peg$FAILED; } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; + if (s2 !== peg$FAILED) { + s3 = peg$currPos; peg$silentFails++; - s3 = peg$parseKeyword(); + s4 = peg$parseCursor(); peg$silentFails--; - if (s3 === peg$FAILED) { - s2 = void 0; + if (s4 === peg$FAILED) { + s3 = undefined; } else { - peg$currPos = s2; - s2 = peg$FAILED; + peg$currPos = s3; + s3 = peg$FAILED; } - if (s2 !== peg$FAILED) { - s3 = peg$currPos; - peg$silentFails++; - s4 = peg$parseCursor(); - peg$silentFails--; - if (s4 === peg$FAILED) { - s3 = void 0; + if (s3 !== peg$FAILED) { + if (input.length > peg$currPos) { + s4 = input.charAt(peg$currPos); + peg$currPos++; } else { - peg$currPos = s3; - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - if (input.length > peg$currPos) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c52); - } - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c48(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; + s4 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c52); } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c48(s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2194,100 +1977,78 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } } } } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseWildcard() { - let s0; - let s1; - - const key = peg$currPos * 37 + 24; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseWildcard() { + let s0; + let s1; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 42) { - s1 = peg$c53; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c54); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c55(); + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c53; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c54); } - s0 = s1; - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c55(); + } + s0 = s1; - function peg$parseOptionalSpace() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - - const key = peg$currPos * 37 + 25; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = []; + function peg$parseOptionalSpace() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseCursor(); - if (s3 !== peg$FAILED) { - s4 = []; + } + if (s2 !== peg$FAILED) { + s3 = peg$parseCursor(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s2, s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c42(s2, s3, s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2300,348 +2061,271 @@ module.exports = (function () { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = []; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = []; + s1 = peg$parseSpace(); + while (s1 !== peg$FAILED) { + s0.push(s1); s1 = peg$parseSpace(); - while (s1 !== peg$FAILED) { - s0.push(s1); - s1 = peg$parseSpace(); - } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseEscapedWhitespace() { - let s0; - let s1; - - const key = peg$currPos * 37 + 26; - const cached = peg$resultsCache[key]; + return s0; + } - if (cached) { - peg$currPos = cached.nextPos; + function peg$parseEscapedWhitespace() { + let s0; + let s1; - return cached.result; + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c56) { + s1 = peg$c56; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c57); } - + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c58(); + } + s0 = s1; + if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c56) { - s1 = peg$c56; + if (input.substr(peg$currPos, 2) === peg$c59) { + s1 = peg$c59; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c57); + peg$fail(peg$c60); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c58(); + s1 = peg$c61(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c59) { - s1 = peg$c59; + if (input.substr(peg$currPos, 2) === peg$c62) { + s1 = peg$c62; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c60); + peg$fail(peg$c63); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c61(); + s1 = peg$c64(); } s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c62) { - s1 = peg$c62; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c63); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c64(); - } - s0 = s1; - } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseEscapedSpecialCharacter() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 27; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseEscapedSpecialCharacter() { + let s0; + let s1; + let s2; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c45); } - if (s1 !== peg$FAILED) { - s2 = peg$parseSpecialCharacter(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c48(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseSpecialCharacter(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c48(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseEscapedKeyword() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 28; - const cached = peg$resultsCache[key]; + return s0; + } - if (cached) { - peg$currPos = cached.nextPos; + function peg$parseEscapedKeyword() { + let s0; + let s1; + let s2; - return cached.result; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c45); } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { + s2 = input.substr(peg$currPos, 2); + peg$currPos += 2; } else { - s1 = peg$FAILED; + s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c45); + peg$fail(peg$c31); } } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { - s2 = input.substr(peg$currPos, 2); - peg$currPos += 2; + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { + s2 = input.substr(peg$currPos, 3); + peg$currPos += 3; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c31); + peg$fail(peg$c34); } } if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c34); - } - } - if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { - s2 = input.substr(peg$currPos, 3); - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c37); - } + peg$fail(peg$c37); } } } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c65(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c65(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseKeyword() { - let s0; - - const key = peg$currPos * 37 + 29; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseKeyword() { + let s0; - s0 = peg$parseOr(); + s0 = peg$parseOr(); + if (s0 === peg$FAILED) { + s0 = peg$parseAnd(); if (s0 === peg$FAILED) { - s0 = peg$parseAnd(); - if (s0 === peg$FAILED) { - s0 = peg$parseNot(); - } + s0 = peg$parseNot(); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseSpecialCharacter() { - let s0; - - const key = peg$currPos * 37 + 30; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseSpecialCharacter() { + let s0; - if (peg$c66.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c67); - } + if (peg$c66.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c67); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseEscapedUnicodeSequence() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 31; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseEscapedUnicodeSequence() { + let s0; + let s1; + let s2; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c44; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c45); } - if (s1 !== peg$FAILED) { - s2 = peg$parseUnicodeSequence(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c68(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseUnicodeSequence(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c68(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseUnicodeSequence() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - let s6; - let s7; - - const key = peg$currPos * 37 + 32; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } + return s0; + } - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 117) { - s1 = peg$c69; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c70); - } + function peg$parseUnicodeSequence() { + let s0; + let s1; + let s2; + let s3; + let s4; + let s5; + let s6; + let s7; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 117) { + s1 = peg$c69; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c70); } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$currPos; - s4 = peg$parseHexDigit(); - if (s4 !== peg$FAILED) { - s5 = peg$parseHexDigit(); - if (s5 !== peg$FAILED) { - s6 = peg$parseHexDigit(); - if (s6 !== peg$FAILED) { - s7 = peg$parseHexDigit(); - if (s7 !== peg$FAILED) { - s4 = [s4, s5, s6, s7]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = peg$currPos; + s4 = peg$parseHexDigit(); + if (s4 !== peg$FAILED) { + s5 = peg$parseHexDigit(); + if (s5 !== peg$FAILED) { + s6 = peg$parseHexDigit(); + if (s6 !== peg$FAILED) { + s7 = peg$parseHexDigit(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; @@ -2654,261 +2338,217 @@ module.exports = (function () { peg$currPos = s3; s3 = peg$FAILED; } - if (s3 !== peg$FAILED) { - s2 = input.substring(s2, peg$currPos); - } else { - s2 = s3; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c71(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s2 = input.substring(s2, peg$currPos); + } else { + s2 = s3; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c71(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseHexDigit() { - let s0; - - const key = peg$currPos * 37 + 33; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseHexDigit() { + let s0; - if (peg$c72.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c73); - } + if (peg$c72.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c73); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseRangeOperator() { - let s0; - let s1; - - const key = peg$currPos * 37 + 34; - const cached = peg$resultsCache[key]; + return s0; + } - if (cached) { - peg$currPos = cached.nextPos; + function peg$parseRangeOperator() { + let s0; + let s1; - return cached.result; + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c74) { + s1 = peg$c74; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c75); } - + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c76(); + } + s0 = s1; + if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c74) { - s1 = peg$c74; + if (input.substr(peg$currPos, 2) === peg$c77) { + s1 = peg$c77; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c75); + peg$fail(peg$c78); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c76(); + s1 = peg$c79(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c77) { - s1 = peg$c77; - peg$currPos += 2; + if (input.charCodeAt(peg$currPos) === 60) { + s1 = peg$c80; + peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c78); + peg$fail(peg$c81); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c79(); + s1 = peg$c82(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c80; + if (input.charCodeAt(peg$currPos) === 62) { + s1 = peg$c83; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c81); + peg$fail(peg$c84); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c82(); + s1 = peg$c85(); } s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 62) { - s1 = peg$c83; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c84); - } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c85(); - } - s0 = s1; - } } } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseSpace() { - let s0; - let s1; - - const key = peg$currPos * 37 + 35; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseSpace() { + let s0; + let s1; - peg$silentFails++; - if (peg$c87.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c88); - } + peg$silentFails++; + if (peg$c87.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c88); } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c86); - } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c86); } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; } - function peg$parseCursor() { - let s0; - let s1; - let s2; - - const key = peg$currPos * 37 + 36; - const cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; + return s0; + } - return cached.result; - } + function peg$parseCursor() { + let s0; + let s1; + let s2; - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c39(); - if (s1) { - s1 = void 0; + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$c39(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 14) === peg$c89) { + s2 = peg$c89; + peg$currPos += 14; } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 14) === peg$c89) { - s2 = peg$c89; - peg$currPos += 14; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c90); - } - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c91(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c90); } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c91(); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - const { - parseCursor, - cursorSymbol, - allowLeadingWildcards = true, - helpers: { nodeTypes }, - } = options; - const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; - const buildLiteralNode = nodeTypes.literal.buildNode; - const buildWildcardNode = nodeTypes.wildcard.buildNode; - const buildNamedArgNode = nodeTypes.namedArg.buildNode; - const { wildcardSymbol } = nodeTypes.wildcard; - - peg$result = peg$startRuleFunction(); - - if (peg$result !== peg$FAILED && peg$currPos === input.length) { - return peg$result; - } else { - if (peg$result !== peg$FAILED && peg$currPos < input.length) { - peg$fail({ type: 'end', description: 'end of input' }); - } + return s0; + } - throw peg$buildException( - null, - peg$maxFailExpected, - peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, - peg$maxFailPos < input.length - ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) - : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) - ); + const { + parseCursor, + cursorSymbol, + allowLeadingWildcards = true, + helpers: { nodeTypes }, + } = options; + const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; + const buildLiteralNode = nodeTypes.literal.buildNode; + const buildWildcardNode = nodeTypes.wildcard.buildNode; + const buildNamedArgNode = nodeTypes.namedArg.buildNode; + const { wildcardSymbol } = nodeTypes.wildcard; + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); } +} - return { - SyntaxError: peg$SyntaxError, - parse: peg$parse, - }; -})(); +module.exports = { + SyntaxError: peg$SyntaxError, + parse: peg$parse, +}; diff --git a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts index 35fd8d34db6aec..7588a1fcf6d2c1 100644 --- a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts @@ -9,21 +9,21 @@ import { repeat } from 'lodash'; import { i18n } from '@kbn/i18n'; -const endOfInputText = i18n.translate('esquery.kql.errors.endOfInputText', { +const endOfInputText = i18n.translate('esQuery.kql.errors.endOfInputText', { defaultMessage: 'end of input', }); const grammarRuleTranslations: Record = { - fieldName: i18n.translate('esquery.kql.errors.fieldNameText', { + fieldName: i18n.translate('esQuery.kql.errors.fieldNameText', { defaultMessage: 'field name', }), - value: i18n.translate('esquery.kql.errors.valueText', { + value: i18n.translate('esQuery.kql.errors.valueText', { defaultMessage: 'value', }), - literal: i18n.translate('esquery.kql.errors.literalText', { + literal: i18n.translate('esQuery.kql.errors.literalText', { defaultMessage: 'literal', }), - whitespace: i18n.translate('esquery.kql.errors.whitespaceText', { + whitespace: i18n.translate('esQuery.kql.errors.whitespaceText', { defaultMessage: 'whitespace', }), }; @@ -50,7 +50,7 @@ export class KQLSyntaxError extends Error { const translatedExpectationText = translatedExpectations.join(', '); - message = i18n.translate('esquery.kql.errors.syntaxError', { + message = i18n.translate('esQuery.kql.errors.syntaxError', { defaultMessage: 'Expected {expectedList} but {foundInput} found.', values: { expectedList: translatedExpectationText, diff --git a/src/dev/i18n/tasks/extract_untracked_translations.ts b/src/dev/i18n/tasks/extract_untracked_translations.ts index a86cdb1d7065f0..64ac773db27a7c 100644 --- a/src/dev/i18n/tasks/extract_untracked_translations.ts +++ b/src/dev/i18n/tasks/extract_untracked_translations.ts @@ -37,7 +37,6 @@ export async function extractUntrackedMessagesTask({ '**/__fixtures__/**', '**/packages/kbn-i18n/**', '**/packages/kbn-plugin-generator/template/**', - '**/packages/kbn-es-query/**', '**/target/**', '**/test/**', '**/scripts/**', diff --git a/src/plugins/data/common/es_query/stubs/exists_filter.ts b/src/plugins/data/common/es_query/stubs/exists_filter.ts new file mode 100644 index 00000000000000..b10aa67db517e5 --- /dev/null +++ b/src/plugins/data/common/es_query/stubs/exists_filter.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ExistsFilter, FilterStateStore } from '..'; + +export const existsFilter: ExistsFilter = { + meta: { + index: 'logstash-*', + negate: false, + disabled: false, + type: 'exists', + key: 'machine.os', + alias: null, + }, + $state: { + store: FilterStateStore.APP_STATE, + }, +}; diff --git a/src/plugins/data/common/es_query/stubs/index.ts b/src/plugins/data/common/es_query/stubs/index.ts new file mode 100644 index 00000000000000..cd766b378f2c80 --- /dev/null +++ b/src/plugins/data/common/es_query/stubs/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './exists_filter'; +export * from './phrase_filter'; +export * from './phrases_filter'; +export * from './range_filter'; diff --git a/src/plugins/data/common/es_query/stubs/phrase_filter.ts b/src/plugins/data/common/es_query/stubs/phrase_filter.ts new file mode 100644 index 00000000000000..23b51afd64e511 --- /dev/null +++ b/src/plugins/data/common/es_query/stubs/phrase_filter.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { FilterStateStore, PhraseFilter } from '@kbn/es-query'; + +export const phraseFilter: PhraseFilter = { + meta: { + negate: false, + index: 'logstash-*', + type: 'phrase', + key: 'machine.os', + value: 'ios', + disabled: false, + alias: null, + params: { + query: 'ios', + }, + }, + $state: { + store: FilterStateStore.APP_STATE, + }, +}; diff --git a/src/plugins/data/common/es_query/stubs/phrases_filter.ts b/src/plugins/data/common/es_query/stubs/phrases_filter.ts new file mode 100644 index 00000000000000..56c3af56175da4 --- /dev/null +++ b/src/plugins/data/common/es_query/stubs/phrases_filter.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { FilterStateStore, PhrasesFilter } from '@kbn/es-query'; + +export const phrasesFilter: PhrasesFilter = { + meta: { + index: 'logstash-*', + type: 'phrases', + key: 'machine.os.raw', + value: 'win xp, osx', + params: ['win xp', 'osx'], + negate: false, + disabled: false, + alias: null, + }, + $state: { + store: FilterStateStore.APP_STATE, + }, +}; diff --git a/src/plugins/data/common/es_query/stubs/range_filter.ts b/src/plugins/data/common/es_query/stubs/range_filter.ts new file mode 100644 index 00000000000000..485a569eb9d4bb --- /dev/null +++ b/src/plugins/data/common/es_query/stubs/range_filter.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { FilterStateStore, RangeFilter } from '@kbn/es-query'; + +export const rangeFilter: RangeFilter = { + meta: { + index: 'logstash-*', + negate: false, + disabled: false, + alias: null, + type: 'range', + key: 'bytes', + value: '0 to 10', + params: { + gte: 0, + lt: 10, + }, + }, + $state: { + store: FilterStateStore.APP_STATE, + }, + range: {}, +}; diff --git a/src/plugins/data/common/stubs.ts b/src/plugins/data/common/stubs.ts index 1d12be4342fef1..d64d788d60ead4 100644 --- a/src/plugins/data/common/stubs.ts +++ b/src/plugins/data/common/stubs.ts @@ -8,4 +8,4 @@ export { stubIndexPattern, stubIndexPatternWithFields } from './index_patterns/index_pattern.stub'; export { stubFields } from './index_patterns/field.stub'; -export * from '@kbn/es-query/target/filters/stubs'; +export * from './es_query/stubs'; diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/types.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/types.ts index 42b750cfd27c60..0b67d6f0d19843 100644 --- a/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/types.ts +++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/request_processors/annotations/types.ts @@ -7,9 +7,9 @@ */ import type { IUiSettingsClient } from 'kibana/server'; +import type { EsQueryConfig } from '@kbn/es-query'; import type { VisTypeTimeseriesVisDataRequest } from '../../../../types'; import type { Annotation, FetchedIndexPattern, Panel } from '../../../../../common/types'; -import type { EsQueryConfig } from '../../../../../../data/common'; import type { SearchCapabilities } from '../../../search_strategies'; import type { ProcessorFunction } from '../../build_processor_function'; diff --git a/src/plugins/vis_type_timeseries/server/types.ts b/src/plugins/vis_type_timeseries/server/types.ts index 42f0cbf8c613f4..11131f33e4a1cb 100644 --- a/src/plugins/vis_type_timeseries/server/types.ts +++ b/src/plugins/vis_type_timeseries/server/types.ts @@ -9,8 +9,8 @@ import { Observable } from 'rxjs'; import { EsQueryConfig } from '@kbn/es-query'; import { SharedGlobalConfig } from 'kibana/server'; -import type { DataRequestHandlerContext, IndexPatternsService } from '../../data/server'; import type { IRouter, IUiSettingsClient, KibanaRequest } from 'src/core/server'; +import type { DataRequestHandlerContext, IndexPatternsService } from '../../data/server'; import type { Series, VisPayload } from '../common/types'; import type { SearchStrategyRegistry } from './lib/search_strategies'; import type { CachedIndexPatternFetcher } from './lib/search_strategies/lib/cached_index_pattern_fetcher'; diff --git a/src/plugins/vis_type_vega/public/data_model/types.ts b/src/plugins/vis_type_vega/public/data_model/types.ts index 9e3cf0a5421c1c..4d57ccf402a9a8 100644 --- a/src/plugins/vis_type_vega/public/data_model/types.ts +++ b/src/plugins/vis_type_vega/public/data_model/types.ts @@ -7,9 +7,7 @@ */ import type { estypes } from '@elastic/elasticsearch'; - -import { Filter } from 'src/plugins/data/public'; -import { DslQuery } from 'src/plugins/data/common'; +import { DslQuery, Filter } from '@kbn/es-query'; import { Assign } from '@kbn/utility-types'; import { Spec } from 'vega'; import { EsQueryParser } from './es_query_parser'; diff --git a/x-pack/plugins/alerting/server/alerts_client/tests/find.test.ts b/x-pack/plugins/alerting/server/alerts_client/tests/find.test.ts index 5ec39681a758bb..5368128b431d12 100644 --- a/x-pack/plugins/alerting/server/alerts_client/tests/find.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/tests/find.test.ts @@ -10,7 +10,7 @@ import { savedObjectsClientMock, loggingSystemMock } from '../../../../../../src import { taskManagerMock } from '../../../../task_manager/server/mocks'; import { alertTypeRegistryMock } from '../../alert_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; -import { nodeTypes } from '../../../../../../src/plugins/data/common'; +import { nodeTypes } from '@kbn/es-query'; import { esKuery } from '../../../../../../src/plugins/data/server'; import { encryptedSavedObjectsMock } from '../../../../encrypted_saved_objects/server/mocks'; import { actionsAuthorizationMock } from '../../../../actions/server/mocks'; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts index 5c3a3dce43b3c8..bedc1818758ce8 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts @@ -6,8 +6,8 @@ */ import { useMemo } from 'react'; +import { FieldFilter as Filter } from '@kbn/es-query'; import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { FieldFilter as Filter } from '../../../../../../../../src/plugins/data/common'; import { CLIENT_GEO_COUNTRY_ISO_CODE, SERVICE_NAME, diff --git a/x-pack/plugins/ml/common/types/es_client.ts b/x-pack/plugins/ml/common/types/es_client.ts index 29a7a81aa56939..433deac02bc9c3 100644 --- a/x-pack/plugins/ml/common/types/es_client.ts +++ b/x-pack/plugins/ml/common/types/es_client.ts @@ -8,8 +8,7 @@ import { estypes } from '@elastic/elasticsearch'; import { JsonObject } from '@kbn/common-utils'; -import { buildEsQuery } from '../../../../../src/plugins/data/common/es_query/es_query'; -import type { DslQuery } from '../../../../../src/plugins/data/common/es_query/kuery'; +import { buildEsQuery, DslQuery } from '@kbn/es-query'; import { isPopulatedObject } from '../util/object_utils'; diff --git a/x-pack/plugins/ml/public/embeddables/common/process_filters.ts b/x-pack/plugins/ml/public/embeddables/common/process_filters.ts index 8ff75205b4d488..e054df09bd95bd 100644 --- a/x-pack/plugins/ml/public/embeddables/common/process_filters.ts +++ b/x-pack/plugins/ml/public/embeddables/common/process_filters.ts @@ -5,8 +5,7 @@ * 2.0. */ -import { Filter } from '../../../../../../src/plugins/data/common/es_query/filters'; -import { Query } from '../../../../../../src/plugins/data/common/query'; +import { Filter, Query } from '@kbn/es-query'; import { esKuery, esQuery } from '../../../../../../src/plugins/data/public'; export function processFilters(filters: Filter[], query: Query, controlledBy?: string) { diff --git a/x-pack/plugins/ml/public/embeddables/types.ts b/x-pack/plugins/ml/public/embeddables/types.ts index 60355dae5baf41..436eee0698708e 100644 --- a/x-pack/plugins/ml/public/embeddables/types.ts +++ b/x-pack/plugins/ml/public/embeddables/types.ts @@ -6,14 +6,10 @@ */ import type { CoreStart } from 'kibana/public'; +import type { Filter, Query } from '@kbn/es-query'; import type { JobId } from '../../common/types/anomaly_detection_jobs'; import type { SwimlaneType } from '../application/explorer/explorer_constants'; -import type { Filter } from '../../../../../src/plugins/data/common/es_query/filters'; -import type { - Query, - RefreshInterval, - TimeRange, -} from '../../../../../src/plugins/data/common/query'; +import type { RefreshInterval, TimeRange } from '../../../../../src/plugins/data/common'; import type { EmbeddableInput, EmbeddableOutput, diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_definition_field.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_definition_field.tsx index d137b36a7e8c7a..8a83b5c2a8cb00 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_definition_field.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_definition_field.tsx @@ -8,12 +8,12 @@ import React, { useMemo } from 'react'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { isEmpty } from 'lodash'; +import { ExistsFilter } from '@kbn/es-query'; import FieldValueSuggestions from '../../../field_value_suggestions'; import { useSeriesStorage } from '../../hooks/use_series_storage'; import { useAppIndexPatternContext } from '../../hooks/use_app_index_pattern'; import { ESFilter } from '../../../../../../../../../src/core/types/elasticsearch'; import { PersistableFilter } from '../../../../../../../lens/common'; -import { ExistsFilter } from '../../../../../../../../../src/plugins/data/common/es_query/filters'; import { buildPhrasesFilter } from '../../configurations/utils'; import { SeriesConfig } from '../../types'; import { ALL_VALUES_SELECTED } from '../../../field_value_suggestions/field_value_combobox'; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_expanded.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_expanded.tsx index 6f9d8efdc0681e..4310402a43a087 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_expanded.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/filter_expanded.tsx @@ -12,6 +12,7 @@ import { rgba } from 'polished'; import { i18n } from '@kbn/i18n'; import { QueryDslQueryContainer } from '@elastic/elasticsearch/api/types'; import { map } from 'lodash'; +import { ExistsFilter } from '@kbn/es-query'; import { useAppIndexPatternContext } from '../../hooks/use_app_index_pattern'; import { useSeriesStorage } from '../../hooks/use_series_storage'; import { SeriesConfig, UrlFilter } from '../../types'; @@ -20,7 +21,6 @@ import { useValuesList } from '../../../../../hooks/use_values_list'; import { euiStyled } from '../../../../../../../../../src/plugins/kibana_react/common'; import { ESFilter } from '../../../../../../../../../src/core/types/elasticsearch'; import { PersistableFilter } from '../../../../../../../lens/common'; -import { ExistsFilter } from '../../../../../../../../../src/plugins/data/common/es_query/filters'; interface Props { seriesId: string; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts index 717d98715453de..fbda2f4ff62e2c 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts @@ -6,6 +6,7 @@ */ import { PaletteOutput } from 'src/plugins/charts/public'; +import { ExistsFilter } from '@kbn/es-query'; import { LastValueIndexPatternColumn, DateHistogramIndexPatternColumn, @@ -16,8 +17,7 @@ import { } from '../../../../../lens/public'; import { PersistableFilter } from '../../../../../lens/common'; -import { IIndexPattern } from '../../../../../../../src/plugins/data/common/index_patterns'; -import { ExistsFilter } from '../../../../../../../src/plugins/data/common/es_query/filters'; +import { IIndexPattern } from '../../../../../../../src/plugins/data/public'; export const ReportViewTypes = { dist: 'data-distribution', diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx index 601e0509009cea..1d0274cd07c4c2 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx @@ -12,7 +12,7 @@ import { getOr, isEmpty } from 'lodash/fp'; import moment from 'moment'; import { i18n } from '@kbn/i18n'; -import type { Filter } from '../../../../../../../src/plugins/data/common/es_query/filters'; +import type { FilterStateStore, Filter } from '@kbn/es-query'; import { KueryFilterQueryKind, TimelineId, @@ -49,7 +49,6 @@ import { DataProvider, QueryOperator, } from '../../../timelines/components/timeline/data_providers/data_provider'; -import { esFilters } from '../../../../../../../src/plugins/data/public'; import { getTimelineTemplate } from '../../../timelines/containers/api'; export const getUpdateAlertsQuery = (eventIds: Readonly) => { @@ -283,7 +282,7 @@ export const buildAlertsKqlFilter = ( params: alertIds, }, $state: { - store: esFilters.FilterStateStore.APP_STATE, + store: FilterStateStore.APP_STATE, }, }, ]; diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts index ec9ee47bcb0876..8fd2b5f437bcd1 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts @@ -29,7 +29,7 @@ import { } from '../../../../../common/detection_engine/schemas/request/rule_schemas.mock'; import { getPatchRulesSchemaMock } from '../../../../../common/detection_engine/schemas/request/patch_rules_schema.mock'; import { rulesMock } from './mock'; -import { buildEsQuery } from 'src/plugins/data/common'; +import { buildEsQuery } from '@kbn/es-query'; const abortCtrl = new AbortController(); const mockKibanaServices = KibanaServices.get as jest.Mock; jest.mock('../../../../common/lib/kibana'); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts index 4ca9448f5e3c73..a6225ae2731a7b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts @@ -10,7 +10,7 @@ import { schema } from '@kbn/config-schema'; import { Logger } from '@kbn/logging'; import { ESSearchRequest } from 'src/core/types/elasticsearch'; -import { buildEsQuery, IIndexPattern } from '../../../../../../../src/plugins/data/common'; +import { buildEsQuery, IndexPatternBase } from '@kbn/es-query'; import { RuleDataClient, @@ -50,7 +50,7 @@ export const createQueryAlertType = (ruleDataClient: RuleDataClient, logger: Log params: { indexPatterns, customQuery }, }) { try { - const indexPattern: IIndexPattern = { + const indexPattern: IndexPatternBase = { fields: [], title: indexPatterns.join(), }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts index 3fc36d5930a0aa..70788ae9ac04d0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts @@ -6,7 +6,7 @@ */ import type { estypes } from '@elastic/elasticsearch'; -import { DslQuery, Filter } from 'src/plugins/data/common'; +import { DslQuery, Filter } from '@kbn/es-query'; import moment, { Moment } from 'moment'; import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; import { Status } from '../../../../common/detection_engine/schemas/common/schemas'; diff --git a/x-pack/plugins/security_solution/server/lib/index_fields/types.ts b/x-pack/plugins/security_solution/server/lib/index_fields/types.ts index 8426742ed723a4..db374c7b2d8f61 100644 --- a/x-pack/plugins/security_solution/server/lib/index_fields/types.ts +++ b/x-pack/plugins/security_solution/server/lib/index_fields/types.ts @@ -5,8 +5,8 @@ * 2.0. */ +import { IFieldSubType } from '@kbn/es-query'; import { FrameworkRequest } from '../framework'; -import { IFieldSubType } from '../../../../../../src/plugins/data/common'; export interface FieldsAdapter { getIndexFields(req: FrameworkRequest, indices: string[]): Promise; diff --git a/x-pack/plugins/timelines/common/typed_json.ts b/x-pack/plugins/timelines/common/typed_json.ts index 71ece547778710..c639c1c0322dc9 100644 --- a/x-pack/plugins/timelines/common/typed_json.ts +++ b/x-pack/plugins/timelines/common/typed_json.ts @@ -6,7 +6,7 @@ */ import { JsonObject } from '@kbn/common-utils'; -import { DslQuery, Filter } from 'src/plugins/data/common'; +import { DslQuery, Filter } from '@kbn/es-query'; export type ESQuery = | ESRangeQuery diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 43804f924570a9..8ee36afb12d5b5 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -779,6 +779,12 @@ "data.advancedSettings.timepicker.today": "今日", "data.aggTypes.buckets.ranges.rangesFormatMessage": "{gte} {from} と {lt} {to}", "data.aggTypes.buckets.ranges.rangesFormatMessageArrowRight": "{from} → {to}", + "esQuery.kql.errors.endOfInputText": "インプットの終わり", + "esQuery.kql.errors.fieldNameText": "フィールド名", + "esQuery.kql.errors.literalText": "文字通り", + "esQuery.kql.errors.syntaxError": "{expectedList} を期待しましたが {foundInput} が検出されました。", + "esQuery.kql.errors.valueText": "値", + "esQuery.kql.errors.whitespaceText": "空白類", "data.errors.fetchError": "ネットワークとプロキシ構成を確認してください。問題が解決しない場合は、ネットワーク管理者に問い合わせてください。", "data.fieldFormats.boolean.title": "ブール", "data.fieldFormats.bytes.title": "バイト", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index a9a0b90664b82f..d3e0570b4bc0b6 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -782,6 +782,12 @@ "data.advancedSettings.timepicker.today": "今日", "data.aggTypes.buckets.ranges.rangesFormatMessage": "{gte} {from} 且 {lt} {to}", "data.aggTypes.buckets.ranges.rangesFormatMessageArrowRight": "{from} → {to}", + "esQuery.kql.errors.endOfInputText": "输入结束", + "esQuery.kql.errors.fieldNameText": "字段名称", + "esQuery.kql.errors.literalText": "文本", + "esQuery.kql.errors.syntaxError": "应找到 {expectedList},但却找到了 {foundInput}。", + "esQuery.kql.errors.valueText": "值", + "esQuery.kql.errors.whitespaceText": "空白", "data.errors.fetchError": "请检查您的网络和代理配置。如果问题持续存在,请联系网络管理员。", "data.fieldFormats.boolean.title": "布尔型", "data.fieldFormats.bytes.title": "字节", From 72ee2faab91d1f7ffc88f3f5abd51ccdef44fabb Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 12 Jul 2021 16:30:44 +0100 Subject: [PATCH 30/52] imports --- packages/kbn-es-query/src/es_query/types.ts | 1 + .../search_strategies/log_entries/log_entries.ts | 2 +- .../log_stream/log_stream_error_boundary.tsx | 2 +- x-pack/plugins/osquery/common/typed_json.ts | 3 +-- .../common/search_strategy/index_fields/index.ts | 10 +++------- .../detections/components/alerts_table/actions.tsx | 2 +- .../common/search_strategy/index_fields/index.ts | 10 +++------- 7 files changed, 11 insertions(+), 19 deletions(-) diff --git a/packages/kbn-es-query/src/es_query/types.ts b/packages/kbn-es-query/src/es_query/types.ts index 9282072cd444d4..ca6a5427790535 100644 --- a/packages/kbn-es-query/src/es_query/types.ts +++ b/packages/kbn-es-query/src/es_query/types.ts @@ -34,4 +34,5 @@ export interface IndexPatternFieldBase { export interface IndexPatternBase { fields: IndexPatternFieldBase[]; id?: string; + title?: string; } diff --git a/x-pack/plugins/infra/common/search_strategies/log_entries/log_entries.ts b/x-pack/plugins/infra/common/search_strategies/log_entries/log_entries.ts index 071432e4937c32..b9841abad6ab5d 100644 --- a/x-pack/plugins/infra/common/search_strategies/log_entries/log_entries.ts +++ b/x-pack/plugins/infra/common/search_strategies/log_entries/log_entries.ts @@ -6,7 +6,7 @@ */ import * as rt from 'io-ts'; -import { DslQuery } from '../../../../../../src/plugins/data/common'; +import { DslQuery } from '@kbn/es-query'; import { logSourceColumnConfigurationRT } from '../../log_sources/log_source_configuration'; import { logEntryAfterCursorRT, diff --git a/x-pack/plugins/infra/public/components/log_stream/log_stream_error_boundary.tsx b/x-pack/plugins/infra/public/components/log_stream/log_stream_error_boundary.tsx index c55e6d299127be..41a9e13dcc178f 100644 --- a/x-pack/plugins/infra/public/components/log_stream/log_stream_error_boundary.tsx +++ b/x-pack/plugins/infra/public/components/log_stream/log_stream_error_boundary.tsx @@ -8,7 +8,7 @@ import { EuiCodeBlock, EuiEmptyPrompt } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import { KQLSyntaxError } from '../../../../../../src/plugins/data/common'; +import { KQLSyntaxError } from '@kbn/es-query'; import { RenderErrorFunc, ResettableErrorBoundary } from '../resettable_error_boundary'; export const LogStreamErrorBoundary: React.FC<{ resetOnChange: any }> = ({ diff --git a/x-pack/plugins/osquery/common/typed_json.ts b/x-pack/plugins/osquery/common/typed_json.ts index 8ce6907beb80bd..7ef7469a5ebe74 100644 --- a/x-pack/plugins/osquery/common/typed_json.ts +++ b/x-pack/plugins/osquery/common/typed_json.ts @@ -5,8 +5,7 @@ * 2.0. */ -import { DslQuery, Filter } from 'src/plugins/data/common'; - +import { DslQuery, Filter } from '@kbn/es-query'; import { JsonObject } from '@kbn/common-utils'; export type ESQuery = diff --git a/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts b/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts index 76ab48a8243db3..09c0312977b291 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts @@ -5,12 +5,8 @@ * 2.0. */ -import { IIndexPattern } from 'src/plugins/data/public'; -import { - IEsSearchRequest, - IEsSearchResponse, - IFieldSubType, -} from '../../../../../../src/plugins/data/common'; +import { IndexPatternBase, IFieldSubType } from '@kbn/es-query'; +import { IEsSearchRequest, IEsSearchResponse } from '../../../../../../src/plugins/data/common'; import { DocValueFields, Maybe } from '../common'; export type BeatFieldsFactoryQueryType = 'beatFields'; @@ -83,7 +79,7 @@ export type BrowserFields = Readonly>>; export const EMPTY_BROWSER_FIELDS = {}; export const EMPTY_DOCVALUE_FIELD: DocValueFields[] = []; -export const EMPTY_INDEX_PATTERN: IIndexPattern = { +export const EMPTY_INDEX_PATTERN: IndexPatternBase = { fields: [], title: '', }; diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx index 1d0274cd07c4c2..245aa67d677be4 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx @@ -12,7 +12,7 @@ import { getOr, isEmpty } from 'lodash/fp'; import moment from 'moment'; import { i18n } from '@kbn/i18n'; -import type { FilterStateStore, Filter } from '@kbn/es-query'; +import { FilterStateStore, Filter } from '@kbn/es-query'; import { KueryFilterQueryKind, TimelineId, diff --git a/x-pack/plugins/timelines/common/search_strategy/index_fields/index.ts b/x-pack/plugins/timelines/common/search_strategy/index_fields/index.ts index 76ab48a8243db3..8fbab31b492666 100644 --- a/x-pack/plugins/timelines/common/search_strategy/index_fields/index.ts +++ b/x-pack/plugins/timelines/common/search_strategy/index_fields/index.ts @@ -5,12 +5,8 @@ * 2.0. */ -import { IIndexPattern } from 'src/plugins/data/public'; -import { - IEsSearchRequest, - IEsSearchResponse, - IFieldSubType, -} from '../../../../../../src/plugins/data/common'; +import { IFieldSubType, IndexPatternBase } from '@kbn/es-query'; +import { IEsSearchRequest, IEsSearchResponse } from '../../../../../../src/plugins/data/common'; import { DocValueFields, Maybe } from '../common'; export type BeatFieldsFactoryQueryType = 'beatFields'; @@ -83,7 +79,7 @@ export type BrowserFields = Readonly>>; export const EMPTY_BROWSER_FIELDS = {}; export const EMPTY_DOCVALUE_FIELD: DocValueFields[] = []; -export const EMPTY_INDEX_PATTERN: IIndexPattern = { +export const EMPTY_INDEX_PATTERN: IndexPatternBase = { fields: [], title: '', }; From 724eeb159dcd4138c813d1170f61b40bc2af7f56 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 12 Jul 2021 16:42:32 +0100 Subject: [PATCH 31/52] export any type so we don't break code (compatible with before moving to package) --- packages/kbn-es-query/src/es_query/index.ts | 1 - packages/kbn-es-query/src/kuery/index.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/kbn-es-query/src/es_query/index.ts b/packages/kbn-es-query/src/es_query/index.ts index 5195d68de903fa..beba50f50dd812 100644 --- a/packages/kbn-es-query/src/es_query/index.ts +++ b/packages/kbn-es-query/src/es_query/index.ts @@ -11,4 +11,3 @@ export { buildQueryFromFilters } from './from_filters'; export { luceneStringToDsl } from './lucene_string_to_dsl'; export { decorateQuery } from './decorate_query'; export { IndexPatternBase, IndexPatternFieldBase, IFieldSubType } from './types'; -export { DslQuery } from './es_query_dsl'; diff --git a/packages/kbn-es-query/src/kuery/index.ts b/packages/kbn-es-query/src/kuery/index.ts index a33f44b9547155..7796785f853943 100644 --- a/packages/kbn-es-query/src/kuery/index.ts +++ b/packages/kbn-es-query/src/kuery/index.ts @@ -9,4 +9,4 @@ export { KQLSyntaxError } from './kuery_syntax_error'; export { nodeTypes, nodeBuilder } from './node_types'; export { fromKueryExpression, toElasticsearchQuery } from './ast'; -export { KueryNode } from './types'; +export { DslQuery, KueryNode } from './types'; From 6dd0ae441e03f09c49f214462f15e941ef0c2176 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 12 Jul 2021 17:23:50 +0100 Subject: [PATCH 32/52] dont change siem yet --- packages/kbn-es-query/src/es_query/build_es_query.test.ts | 2 +- .../common/search_strategy/index_fields/index.ts | 5 +++-- x-pack/plugins/security_solution/common/typed_json.ts | 2 +- .../security_solution/public/common/mock/index_pattern.ts | 2 +- .../security_solution/public/common/store/sourcerer/model.ts | 2 +- .../detections/components/rules/autocomplete_field/index.tsx | 2 +- .../server/lib/detection_engine/reference_rules/query.ts | 5 +++-- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/kbn-es-query/src/es_query/build_es_query.test.ts b/packages/kbn-es-query/src/es_query/build_es_query.test.ts index d963f9246509b4..b31269c4f81600 100644 --- a/packages/kbn-es-query/src/es_query/build_es_query.test.ts +++ b/packages/kbn-es-query/src/es_query/build_es_query.test.ts @@ -10,7 +10,7 @@ import { buildEsQuery } from './build_es_query'; import { fromKueryExpression, toElasticsearchQuery } from '../kuery'; import { luceneStringToDsl } from './lucene_string_to_dsl'; import { decorateQuery } from './decorate_query'; -import { MatchAllFilter } from '../filters'; +import { MatchAllFilter, Query } from '../filters'; import { fields } from '../filters/stubs'; import { IndexPatternBase } from './types'; diff --git a/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts b/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts index 09c0312977b291..fbbe67f55bce4e 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { IndexPatternBase, IFieldSubType } from '@kbn/es-query'; +import { IFieldSubType } from '@kbn/es-query'; +import type { IIndexPattern } from 'src/plugins/data/public'; import { IEsSearchRequest, IEsSearchResponse } from '../../../../../../src/plugins/data/common'; import { DocValueFields, Maybe } from '../common'; @@ -79,7 +80,7 @@ export type BrowserFields = Readonly>>; export const EMPTY_BROWSER_FIELDS = {}; export const EMPTY_DOCVALUE_FIELD: DocValueFields[] = []; -export const EMPTY_INDEX_PATTERN: IndexPatternBase = { +export const EMPTY_INDEX_PATTERN: IIndexPattern = { fields: [], title: '', }; diff --git a/x-pack/plugins/security_solution/common/typed_json.ts b/x-pack/plugins/security_solution/common/typed_json.ts index 8ce6907beb80bd..1c42ab3a6fd24a 100644 --- a/x-pack/plugins/security_solution/common/typed_json.ts +++ b/x-pack/plugins/security_solution/common/typed_json.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { DslQuery, Filter } from 'src/plugins/data/common'; +import { DslQuery, Filter } from '@kbn/es-query'; import { JsonObject } from '@kbn/common-utils'; diff --git a/x-pack/plugins/security_solution/public/common/mock/index_pattern.ts b/x-pack/plugins/security_solution/public/common/mock/index_pattern.ts index 224d38c8462f26..d19d6ee734654c 100644 --- a/x-pack/plugins/security_solution/public/common/mock/index_pattern.ts +++ b/x-pack/plugins/security_solution/public/common/mock/index_pattern.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IIndexPattern } from '../../../../../../src/plugins/data/common/index_patterns'; +import { IIndexPattern } from '../../../../../../src/plugins/data/common'; export const mockIndexPattern: IIndexPattern = { fields: [ diff --git a/x-pack/plugins/security_solution/public/common/store/sourcerer/model.ts b/x-pack/plugins/security_solution/public/common/store/sourcerer/model.ts index fa1eec9ee0e826..26497c7f6ee3ba 100644 --- a/x-pack/plugins/security_solution/public/common/store/sourcerer/model.ts +++ b/x-pack/plugins/security_solution/public/common/store/sourcerer/model.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IIndexPattern } from '../../../../../../../src/plugins/data/common/index_patterns'; +import { IIndexPattern } from '../../../../../../../src/plugins/data/common'; import { DocValueFields } from '../../../../common/search_strategy/common'; import { BrowserFields, diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/autocomplete_field/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/autocomplete_field/index.tsx index 503a568f137442..51404f65dc7d40 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/autocomplete_field/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/autocomplete_field/index.tsx @@ -10,7 +10,7 @@ import { EuiFormRow } from '@elastic/eui'; import { FieldHook } from '../../../../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; import { FieldComponent } from '../../../../common/components/autocomplete/field'; import { IFieldType } from '../../../../../../../../src/plugins/data/common/index_patterns/fields'; -import { IIndexPattern } from '../../../../../../../../src/plugins/data/common/index_patterns'; +import { IIndexPattern } from '../../../../../../../../src/plugins/data/common'; interface AutocompleteFieldProps { dataTestSubj: string; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts index a6225ae2731a7b..d4ce280e732680 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts @@ -10,8 +10,9 @@ import { schema } from '@kbn/config-schema'; import { Logger } from '@kbn/logging'; import { ESSearchRequest } from 'src/core/types/elasticsearch'; -import { buildEsQuery, IndexPatternBase } from '@kbn/es-query'; +import { buildEsQuery } from '@kbn/es-query'; +import type { IIndexPattern } from 'src/plugins/data/public'; import { RuleDataClient, createPersistenceRuleTypeFactory, @@ -50,7 +51,7 @@ export const createQueryAlertType = (ruleDataClient: RuleDataClient, logger: Log params: { indexPatterns, customQuery }, }) { try { - const indexPattern: IndexPatternBase = { + const indexPattern: IIndexPattern = { fields: [], title: indexPatterns.join(), }; From e0d24461ee046482fe31dcf2550d42c400a1a464 Mon Sep 17 00:00:00 2001 From: Liza K Date: Tue, 13 Jul 2021 11:20:01 +0100 Subject: [PATCH 33/52] imports --- .../src/es_query/filter_matches_index.test.ts | 14 +++++++------- .../kbn-es-query/src/es_query/from_lucene.test.ts | 2 +- .../kbn-es-query/src/filters/exists_filter.test.ts | 2 +- .../src/filters/get_filter_field.test.ts | 2 +- .../src/filters/phrases_filter.test.ts | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/kbn-es-query/src/es_query/filter_matches_index.test.ts b/packages/kbn-es-query/src/es_query/filter_matches_index.test.ts index ad4d7ff8d78e27..bf4e1291ca4382 100644 --- a/packages/kbn-es-query/src/es_query/filter_matches_index.test.ts +++ b/packages/kbn-es-query/src/es_query/filter_matches_index.test.ts @@ -8,12 +8,12 @@ import { Filter } from '../filters'; import { filterMatchesIndex } from './filter_matches_index'; -import { IIndexPattern } from '../../index_patterns'; +import { IndexPatternBase } from './types'; describe('filterMatchesIndex', () => { it('should return true if the filter has no meta', () => { const filter = {} as Filter; - const indexPattern = { id: 'foo', fields: [{ name: 'bar' }] } as IIndexPattern; + const indexPattern = { id: 'foo', fields: [{ name: 'bar' }] } as IndexPatternBase; expect(filterMatchesIndex(filter, indexPattern)).toBe(true); }); @@ -26,35 +26,35 @@ describe('filterMatchesIndex', () => { it('should return true if the filter key matches a field name', () => { const filter = { meta: { index: 'foo', key: 'bar' } } as Filter; - const indexPattern = { id: 'foo', fields: [{ name: 'bar' }] } as IIndexPattern; + const indexPattern = { id: 'foo', fields: [{ name: 'bar' }] } as IndexPatternBase; expect(filterMatchesIndex(filter, indexPattern)).toBe(true); }); it('should return true if custom filter for the same index is passed', () => { const filter = { meta: { index: 'foo', key: 'bar', type: 'custom' } } as Filter; - const indexPattern = { id: 'foo', fields: [{ name: 'bara' }] } as IIndexPattern; + const indexPattern = { id: 'foo', fields: [{ name: 'bara' }] } as IndexPatternBase; expect(filterMatchesIndex(filter, indexPattern)).toBe(true); }); it('should return false if custom filter for a different index is passed', () => { const filter = { meta: { index: 'foo', key: 'bar', type: 'custom' } } as Filter; - const indexPattern = { id: 'food', fields: [{ name: 'bara' }] } as IIndexPattern; + const indexPattern = { id: 'food', fields: [{ name: 'bara' }] } as IndexPatternBase; expect(filterMatchesIndex(filter, indexPattern)).toBe(false); }); it('should return false if the filter key does not match a field name', () => { const filter = { meta: { index: 'foo', key: 'baz' } } as Filter; - const indexPattern = { id: 'foo', fields: [{ name: 'bar' }] } as IIndexPattern; + const indexPattern = { id: 'foo', fields: [{ name: 'bar' }] } as IndexPatternBase; expect(filterMatchesIndex(filter, indexPattern)).toBe(false); }); it('should return true if the filter has meta without a key', () => { const filter = { meta: { index: 'foo' } } as Filter; - const indexPattern = { id: 'foo', fields: [{ name: 'bar' }] } as IIndexPattern; + const indexPattern = { id: 'foo', fields: [{ name: 'bar' }] } as IndexPatternBase; expect(filterMatchesIndex(filter, indexPattern)).toBe(true); }); diff --git a/packages/kbn-es-query/src/es_query/from_lucene.test.ts b/packages/kbn-es-query/src/es_query/from_lucene.test.ts index 2438a4b40e2564..e4ca435ae88624 100644 --- a/packages/kbn-es-query/src/es_query/from_lucene.test.ts +++ b/packages/kbn-es-query/src/es_query/from_lucene.test.ts @@ -9,7 +9,7 @@ import { buildQueryFromLucene } from './from_lucene'; import { decorateQuery } from './decorate_query'; import { luceneStringToDsl } from './lucene_string_to_dsl'; -import { Query } from '../../query/types'; +import { Query } from '..'; describe('build query', () => { describe('buildQueryFromLucene', () => { diff --git a/packages/kbn-es-query/src/filters/exists_filter.test.ts b/packages/kbn-es-query/src/filters/exists_filter.test.ts index c9da75e8a52010..83976d45f8e045 100644 --- a/packages/kbn-es-query/src/filters/exists_filter.test.ts +++ b/packages/kbn-es-query/src/filters/exists_filter.test.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ +import { IndexPatternBase } from '..'; import { buildExistsFilter, getExistsFilterField } from './exists_filter'; import { fields } from './stubs/fields.mocks'; -import { IndexPatternBase } from '../..'; describe('exists filter', function () { const indexPattern: IndexPatternBase = { diff --git a/packages/kbn-es-query/src/filters/get_filter_field.test.ts b/packages/kbn-es-query/src/filters/get_filter_field.test.ts index 3a3bd98265a9a7..0425aa6cc8c725 100644 --- a/packages/kbn-es-query/src/filters/get_filter_field.test.ts +++ b/packages/kbn-es-query/src/filters/get_filter_field.test.ts @@ -9,7 +9,7 @@ import { buildPhraseFilter } from './phrase_filter'; import { buildQueryFilter } from './query_string_filter'; import { getFilterField } from './get_filter_field'; -import { IndexPatternBase } from '../..'; +import { IndexPatternBase } from '..'; import { fields } from './stubs/fields.mocks'; describe('getFilterField', function () { diff --git a/packages/kbn-es-query/src/filters/phrases_filter.test.ts b/packages/kbn-es-query/src/filters/phrases_filter.test.ts index 57965a6bdd7cfa..5e742187cdf05c 100644 --- a/packages/kbn-es-query/src/filters/phrases_filter.test.ts +++ b/packages/kbn-es-query/src/filters/phrases_filter.test.ts @@ -7,7 +7,7 @@ */ import { buildPhrasesFilter, getPhrasesFilterField } from './phrases_filter'; -import { IndexPatternBase } from '../..'; +import { IndexPatternBase } from '..'; import { fields } from './stubs/fields.mocks'; describe('phrases filter', function () { From 6279ad9105e032d1eeab16f27430c06450d82155 Mon Sep 17 00:00:00 2001 From: Liza K Date: Tue, 13 Jul 2021 12:54:34 +0100 Subject: [PATCH 34/52] update mock grammar --- .../src/kuery/grammar/__mocks__/grammar.js | 1071 +++++++---------- 1 file changed, 402 insertions(+), 669 deletions(-) diff --git a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js index d58bb023fdfe3a..a91e67fead7f07 100644 --- a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js +++ b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js @@ -12,10 +12,10 @@ /* eslint-disable */ +"use strict"; + function peg$subclass(child, parent) { - function C() { - this.constructor = child; - } + function C() { this.constructor = child; } C.prototype = parent.prototype; child.prototype = new C(); } @@ -25,42 +25,42 @@ function peg$SyntaxError(message, expected, found, location) { this.expected = expected; this.found = found; this.location = location; - this.name = 'SyntaxError'; + this.name = "SyntaxError"; - if (typeof Error.captureStackTrace === 'function') { + if (typeof Error.captureStackTrace === "function") { Error.captureStackTrace(this, peg$SyntaxError); } } peg$subclass(peg$SyntaxError, Error); -peg$SyntaxError.buildMessage = function (expected, found) { - const DESCRIBE_EXPECTATION_FNS = { - literal: function (expectation) { - return '"' + literalEscape(expectation.text) + '"'; +peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; }, - class: function (expectation) { - const escapedParts = expectation.parts.map(function (part) { + class: function(expectation) { + var escapedParts = expectation.parts.map(function(part) { return Array.isArray(part) - ? classEscape(part[0]) + '-' + classEscape(part[1]) + ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part); }); - return '[' + (expectation.inverted ? '^' : '') + escapedParts + ']'; + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; }, - any: function () { - return 'any character'; + any: function() { + return "any character"; }, - end: function () { - return 'end of input'; + end: function() { + return "end of input"; }, - other: function (expectation) { + other: function(expectation) { return expectation.description; - }, + } }; function hex(ch) { @@ -69,36 +69,28 @@ peg$SyntaxError.buildMessage = function (expected, found) { function literalEscape(s) { return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\0/g, '\\0') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x0F]/g, function (ch) { - return '\\x0' + hex(ch); - }) - .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { - return '\\x' + hex(ch); - }); + .replace(/\\/g, "\\\\") + .replace(/"/g, "\\\"") + .replace(/\0/g, "\\0") + .replace(/\t/g, "\\t") + .replace(/\n/g, "\\n") + .replace(/\r/g, "\\r") + .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); } function classEscape(s) { return s - .replace(/\\/g, '\\\\') - .replace(/\]/g, '\\]') - .replace(/\^/g, '\\^') - .replace(/-/g, '\\-') - .replace(/\0/g, '\\0') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x0F]/g, function (ch) { - return '\\x0' + hex(ch); - }) - .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { - return '\\x' + hex(ch); - }); + .replace(/\\/g, "\\\\") + .replace(/\]/g, "\\]") + .replace(/\^/g, "\\^") + .replace(/-/g, "\\-") + .replace(/\0/g, "\\0") + .replace(/\t/g, "\\t") + .replace(/\n/g, "\\n") + .replace(/\r/g, "\\r") + .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); } function describeExpectation(expectation) { @@ -106,9 +98,8 @@ peg$SyntaxError.buildMessage = function (expected, found) { } function describeExpected(expected) { - const descriptions = expected.map(describeExpectation); - let i; - let j; + var descriptions = expected.map(describeExpectation); + var i, j; descriptions.sort(); @@ -127,334 +118,279 @@ peg$SyntaxError.buildMessage = function (expected, found) { return descriptions[0]; case 2: - return descriptions[0] + ' or ' + descriptions[1]; + return descriptions[0] + " or " + descriptions[1]; default: - return ( - descriptions.slice(0, -1).join(', ') + ', or ' + descriptions[descriptions.length - 1] - ); + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; } } function describeFound(found) { - return found ? '"' + literalEscape(found) + '"' : 'end of input'; + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; } - return 'Expected ' + describeExpected(expected) + ' but ' + describeFound(found) + ' found.'; + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; }; function peg$parse(input, options) { options = options !== undefined ? options : {}; - const peg$FAILED = {}; + var peg$FAILED = {}; - const peg$startRuleFunctions = { expression: peg$parseexpression, argument: peg$parseargument }; - let peg$startRuleFunction = peg$parseexpression; + var peg$startRuleFunctions = { Expression: peg$parseExpression }; + var peg$startRuleFunction = peg$parseExpression; - const peg$c0 = function (query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - if (query !== null) return query; - return nodeTypes.function.buildNode('is', '*', '*'); - }; - const peg$c1 = function (head, query) { - return query; - }; - const peg$c2 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('or', nodes); - }; - const peg$c3 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('and', nodes); - }; - const peg$c4 = function (query) { - if (query.type === 'cursor') return query; - return buildFunctionNode('not', [query]); - }; - const peg$c5 = '('; - const peg$c6 = peg$literalExpectation('(', false); - const peg$c7 = ')'; - const peg$c8 = peg$literalExpectation(')', false); - const peg$c9 = function (query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - return query; - }; - const peg$c10 = ':'; - const peg$c11 = peg$literalExpectation(':', false); - const peg$c12 = '{'; - const peg$c13 = peg$literalExpectation('{', false); - const peg$c14 = '}'; - const peg$c15 = peg$literalExpectation('}', false); - const peg$c16 = function (field, query, trailing) { - if (query.type === 'cursor') { - return { - ...query, - nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, - }; - } + var peg$c0 = function(query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + if (query !== null) return query; + return nodeTypes.function.buildNode('is', '*', '*'); + }; + var peg$c1 = function(head, query) { return query; }; + var peg$c2 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('or', nodes); + }; + var peg$c3 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('and', nodes); + }; + var peg$c4 = function(query) { + if (query.type === 'cursor') return query; + return buildFunctionNode('not', [query]); + }; + var peg$c5 = "("; + var peg$c6 = peg$literalExpectation("(", false); + var peg$c7 = ")"; + var peg$c8 = peg$literalExpectation(")", false); + var peg$c9 = function(query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + return query; + }; + var peg$c10 = ":"; + var peg$c11 = peg$literalExpectation(":", false); + var peg$c12 = "{"; + var peg$c13 = peg$literalExpectation("{", false); + var peg$c14 = "}"; + var peg$c15 = peg$literalExpectation("}", false); + var peg$c16 = function(field, query, trailing) { + if (query.type === 'cursor') { + return { + ...query, + nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, + } + }; - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - return buildFunctionNode('nested', [field, query]); - }; - const peg$c17 = peg$otherExpectation('fieldName'); - const peg$c18 = function (field, operator, value) { - if (value.type === 'cursor') { - return { - ...value, - suggestionTypes: ['conjunction'], - }; - } - const range = buildNamedArgNode(operator, value); - return buildFunctionNode('range', [field, range]); - }; - const peg$c19 = function (field, partial) { - if (partial.type === 'cursor') { - return { - ...partial, - fieldName: field.value, - suggestionTypes: ['value', 'conjunction'], - }; - } - return partial(field); - }; - const peg$c20 = function (partial) { - if (partial.type === 'cursor') { - const fieldName = `${partial.prefix}${partial.suffix}`.trim(); - return { - ...partial, - fieldName, - suggestionTypes: ['field', 'operator', 'conjunction'], - }; - } - const field = buildLiteralNode(null); - return partial(field); - }; - const peg$c21 = function (partial, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'], - }; - } - return partial; - }; - const peg$c22 = function (head, partial) { - return partial; - }; - const peg$c23 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'], - }; - } - return (field) => - buildFunctionNode( - 'or', - nodes.map((partial) => partial(field)) - ); - }; - const peg$c24 = function (head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find((node) => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'], - }; - } - return (field) => - buildFunctionNode( - 'and', - nodes.map((partial) => partial(field)) - ); - }; - const peg$c25 = function (partial) { - if (partial.type === 'cursor') { - return { - ...list, - suggestionTypes: ['value'], + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + return buildFunctionNode('nested', [field, query]); }; - } - return (field) => buildFunctionNode('not', [partial(field)]); - }; - const peg$c26 = peg$otherExpectation('value'); - const peg$c27 = function (value) { - if (value.type === 'cursor') return value; - const isPhrase = buildLiteralNode(true); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }; - const peg$c28 = function (value) { - if (value.type === 'cursor') return value; - - if ( - !allowLeadingWildcards && - value.type === 'wildcard' && - nodeTypes.wildcard.hasLeadingWildcard(value) - ) { - error( - 'Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.' - ); - } - - const isPhrase = buildLiteralNode(false); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }; - const peg$c29 = peg$otherExpectation('OR'); - const peg$c30 = 'or'; - const peg$c31 = peg$literalExpectation('or', true); - const peg$c32 = peg$otherExpectation('AND'); - const peg$c33 = 'and'; - const peg$c34 = peg$literalExpectation('and', true); - const peg$c35 = peg$otherExpectation('NOT'); - const peg$c36 = 'not'; - const peg$c37 = peg$literalExpectation('not', true); - const peg$c38 = peg$otherExpectation('literal'); - const peg$c39 = function () { - return parseCursor; - }; - const peg$c40 = '"'; - const peg$c41 = peg$literalExpectation('"', false); - const peg$c42 = function (prefix, cursor, suffix) { - const { start, end } = location(); - return { - type: 'cursor', - start: start.offset, - end: end.offset - cursor.length, - prefix: prefix.join(''), - suffix: suffix.join(''), - text: text().replace(cursor, ''), + var peg$c17 = peg$otherExpectation("fieldName"); + var peg$c18 = function(field, operator, value) { + if (value.type === 'cursor') { + return { + ...value, + suggestionTypes: ['conjunction'] + }; + } + const range = buildNamedArgNode(operator, value); + return buildFunctionNode('range', [field, range]); }; - }; - const peg$c43 = function (chars) { - return buildLiteralNode(chars.join('')); - }; - const peg$c44 = '\\'; - const peg$c45 = peg$literalExpectation('\\', false); - const peg$c46 = /^[\\"]/; - const peg$c47 = peg$classExpectation(['\\', '"'], false, false); - const peg$c48 = function (char) { - return char; - }; - const peg$c49 = /^[^"]/; - const peg$c50 = peg$classExpectation(['"'], true, false); - const peg$c51 = function (chars) { - const sequence = chars.join('').trim(); - if (sequence === 'null') return buildLiteralNode(null); - if (sequence === 'true') return buildLiteralNode(true); - if (sequence === 'false') return buildLiteralNode(false); - if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); - return buildLiteralNode(sequence); - }; - const peg$c52 = peg$anyExpectation(); - const peg$c53 = '*'; - const peg$c54 = peg$literalExpectation('*', false); - const peg$c55 = function () { - return wildcardSymbol; - }; - const peg$c56 = '\\t'; - const peg$c57 = peg$literalExpectation('\\t', false); - const peg$c58 = function () { - return '\t'; - }; - const peg$c59 = '\\r'; - const peg$c60 = peg$literalExpectation('\\r', false); - const peg$c61 = function () { - return '\r'; - }; - const peg$c62 = '\\n'; - const peg$c63 = peg$literalExpectation('\\n', false); - const peg$c64 = function () { - return '\n'; - }; - const peg$c65 = function (keyword) { - return keyword; - }; - const peg$c66 = /^[\\():<>"*{}]/; - const peg$c67 = peg$classExpectation( - ['\\', '(', ')', ':', '<', '>', '"', '*', '{', '}'], - false, - false - ); - const peg$c68 = function (sequence) { - return sequence; - }; - const peg$c69 = 'u'; - const peg$c70 = peg$literalExpectation('u', false); - const peg$c71 = function (digits) { - return String.fromCharCode(parseInt(digits, 16)); - }; - const peg$c72 = /^[0-9a-f]/i; - const peg$c73 = peg$classExpectation( - [ - ['0', '9'], - ['a', 'f'], - ], - false, - true - ); - const peg$c74 = '<='; - const peg$c75 = peg$literalExpectation('<=', false); - const peg$c76 = function () { - return 'lte'; - }; - const peg$c77 = '>='; - const peg$c78 = peg$literalExpectation('>=', false); - const peg$c79 = function () { - return 'gte'; - }; - const peg$c80 = '<'; - const peg$c81 = peg$literalExpectation('<', false); - const peg$c82 = function () { - return 'lt'; - }; - const peg$c83 = '>'; - const peg$c84 = peg$literalExpectation('>', false); - const peg$c85 = function () { - return 'gt'; - }; - const peg$c86 = peg$otherExpectation('whitespace'); - const peg$c87 = /^[ \t\r\n\xA0]/; - const peg$c88 = peg$classExpectation([' ', '\t', '\r', '\n', '\xA0'], false, false); - const peg$c89 = '@kuery-cursor@'; - const peg$c90 = peg$literalExpectation('@kuery-cursor@', false); - const peg$c91 = function () { - return cursorSymbol; - }; - - let peg$currPos = 0; - let peg$savedPos = 0; - const peg$posDetailsCache = [{ line: 1, column: 1 }]; - let peg$maxFailPos = 0; - let peg$maxFailExpected = []; - let peg$silentFails = 0; + var peg$c19 = function(field, partial) { + if (partial.type === 'cursor') { + return { + ...partial, + fieldName: field.value, + suggestionTypes: ['value', 'conjunction'] + }; + } + return partial(field); + }; + var peg$c20 = function(partial) { + if (partial.type === 'cursor') { + const fieldName = `${partial.prefix}${partial.suffix}`.trim(); + return { + ...partial, + fieldName, + suggestionTypes: ['field', 'operator', 'conjunction'] + }; + } + const field = buildLiteralNode(null); + return partial(field); + }; + var peg$c21 = function(partial, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + return partial; + }; + var peg$c22 = function(head, partial) { return partial; }; + var peg$c23 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('or', nodes.map(partial => partial(field))); + }; + var peg$c24 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('and', nodes.map(partial => partial(field))); + }; + var peg$c25 = function(partial) { + if (partial.type === 'cursor') { + return { + ...list, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('not', [partial(field)]); + }; + var peg$c26 = peg$otherExpectation("value"); + var peg$c27 = function(value) { + if (value.type === 'cursor') return value; + const isPhrase = buildLiteralNode(true); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + var peg$c28 = function(value) { + if (value.type === 'cursor') return value; - let peg$result; + if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) { + error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.'); + } - if ('startRule' in options) { + const isPhrase = buildLiteralNode(false); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + var peg$c29 = peg$otherExpectation("OR"); + var peg$c30 = "or"; + var peg$c31 = peg$literalExpectation("or", true); + var peg$c32 = peg$otherExpectation("AND"); + var peg$c33 = "and"; + var peg$c34 = peg$literalExpectation("and", true); + var peg$c35 = peg$otherExpectation("NOT"); + var peg$c36 = "not"; + var peg$c37 = peg$literalExpectation("not", true); + var peg$c38 = peg$otherExpectation("literal"); + var peg$c39 = function() { return parseCursor; }; + var peg$c40 = "\""; + var peg$c41 = peg$literalExpectation("\"", false); + var peg$c42 = function(prefix, cursor, suffix) { + const { start, end } = location(); + return { + type: 'cursor', + start: start.offset, + end: end.offset - cursor.length, + prefix: prefix.join(''), + suffix: suffix.join(''), + text: text().replace(cursor, '') + }; + }; + var peg$c43 = function(chars) { + return buildLiteralNode(chars.join('')); + }; + var peg$c44 = "\\"; + var peg$c45 = peg$literalExpectation("\\", false); + var peg$c46 = /^[\\"]/; + var peg$c47 = peg$classExpectation(["\\", "\""], false, false); + var peg$c48 = function(char) { return char; }; + var peg$c49 = /^[^"]/; + var peg$c50 = peg$classExpectation(["\""], true, false); + var peg$c51 = function(chars) { + const sequence = chars.join('').trim(); + if (sequence === 'null') return buildLiteralNode(null); + if (sequence === 'true') return buildLiteralNode(true); + if (sequence === 'false') return buildLiteralNode(false); + if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); + return buildLiteralNode(sequence); + }; + var peg$c52 = peg$anyExpectation(); + var peg$c53 = "*"; + var peg$c54 = peg$literalExpectation("*", false); + var peg$c55 = function() { return wildcardSymbol; }; + var peg$c56 = "\\t"; + var peg$c57 = peg$literalExpectation("\\t", false); + var peg$c58 = function() { return '\t'; }; + var peg$c59 = "\\r"; + var peg$c60 = peg$literalExpectation("\\r", false); + var peg$c61 = function() { return '\r'; }; + var peg$c62 = "\\n"; + var peg$c63 = peg$literalExpectation("\\n", false); + var peg$c64 = function() { return '\n'; }; + var peg$c65 = function(keyword) { return keyword; }; + var peg$c66 = /^[\\():<>"*{}]/; + var peg$c67 = peg$classExpectation(["\\", "(", ")", ":", "<", ">", "\"", "*", "{", "}"], false, false); + var peg$c68 = function(sequence) { return sequence; }; + var peg$c69 = "u"; + var peg$c70 = peg$literalExpectation("u", false); + var peg$c71 = function(digits) { + return String.fromCharCode(parseInt(digits, 16)); + }; + var peg$c72 = /^[0-9a-f]/i; + var peg$c73 = peg$classExpectation([["0", "9"], ["a", "f"]], false, true); + var peg$c74 = "<="; + var peg$c75 = peg$literalExpectation("<=", false); + var peg$c76 = function() { return 'lte'; }; + var peg$c77 = ">="; + var peg$c78 = peg$literalExpectation(">=", false); + var peg$c79 = function() { return 'gte'; }; + var peg$c80 = "<"; + var peg$c81 = peg$literalExpectation("<", false); + var peg$c82 = function() { return 'lt'; }; + var peg$c83 = ">"; + var peg$c84 = peg$literalExpectation(">", false); + var peg$c85 = function() { return 'gt'; }; + var peg$c86 = peg$otherExpectation("whitespace"); + var peg$c87 = /^[ \t\r\n\xA0]/; + var peg$c88 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); + var peg$c89 = "@kuery-cursor@"; + var peg$c90 = peg$literalExpectation("@kuery-cursor@", false); + var peg$c91 = function() { return cursorSymbol; }; + + var peg$currPos = 0; + var peg$savedPos = 0; + var peg$posDetailsCache = [{ line: 1, column: 1 }]; + var peg$maxFailPos = 0; + var peg$maxFailExpected = []; + var peg$silentFails = 0; + + var peg$result; + + if ("startRule" in options) { if (!(options.startRule in peg$startRuleFunctions)) { - throw new Error('Can\'t start parsing from rule "' + options.startRule + '".'); + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); } peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; @@ -469,7 +405,9 @@ function peg$parse(input, options) { } function expected(description, location) { - location = location !== undefined ? location : peg$computeLocation(peg$savedPos, peg$currPos); + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); throw peg$buildStructuredError( [peg$otherExpectation(description)], @@ -479,34 +417,36 @@ function peg$parse(input, options) { } function error(message, location) { - location = location !== undefined ? location : peg$computeLocation(peg$savedPos, peg$currPos); + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); throw peg$buildSimpleError(message, location); } function peg$literalExpectation(text, ignoreCase) { - return { type: 'literal', text: text, ignoreCase: ignoreCase }; + return { type: "literal", text: text, ignoreCase: ignoreCase }; } function peg$classExpectation(parts, inverted, ignoreCase) { - return { type: 'class', parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; } function peg$anyExpectation() { - return { type: 'any' }; + return { type: "any" }; } function peg$endExpectation() { - return { type: 'end' }; + return { type: "end" }; } function peg$otherExpectation(description) { - return { type: 'other', description: description }; + return { type: "other", description: description }; } function peg$computePosDetails(pos) { - let details = peg$posDetailsCache[pos]; - let p; + var details = peg$posDetailsCache[pos]; + var p; if (details) { return details; @@ -519,7 +459,7 @@ function peg$parse(input, options) { details = peg$posDetailsCache[p]; details = { line: details.line, - column: details.column, + column: details.column }; while (p < pos) { @@ -540,27 +480,25 @@ function peg$parse(input, options) { } function peg$computeLocation(startPos, endPos) { - const startPosDetails = peg$computePosDetails(startPos); - const endPosDetails = peg$computePosDetails(endPos); + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); return { start: { offset: startPos, line: startPosDetails.line, - column: startPosDetails.column, + column: startPosDetails.column }, end: { offset: endPos, line: endPosDetails.line, - column: endPosDetails.column, - }, + column: endPosDetails.column + } }; } function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { - return; - } + if (peg$currPos < peg$maxFailPos) { return; } if (peg$currPos > peg$maxFailPos) { peg$maxFailPos = peg$currPos; @@ -584,10 +522,7 @@ function peg$parse(input, options) { } function peg$parsestart() { - let s0; - let s1; - let s2; - let s3; + var s0, s1, s2, s3; s0 = peg$currPos; s1 = []; @@ -624,12 +559,7 @@ function peg$parse(input, options) { } function peg$parseOrQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseAndQuery(); @@ -694,12 +624,7 @@ function peg$parse(input, options) { } function peg$parseAndQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseNotQuery(); @@ -764,9 +689,7 @@ function peg$parse(input, options) { } function peg$parseNotQuery() { - let s0; - let s1; - let s2; + var s0, s1, s2; s0 = peg$currPos; s1 = peg$parseNot(); @@ -792,12 +715,7 @@ function peg$parse(input, options) { } function peg$parseSubQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { @@ -805,9 +723,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c6); - } + if (peg$silentFails === 0) { peg$fail(peg$c6); } } if (s1 !== peg$FAILED) { s2 = []; @@ -826,9 +742,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c8); - } + if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; @@ -862,16 +776,7 @@ function peg$parse(input, options) { } function peg$parseNestedQuery() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - let s6; - let s7; - let s8; - let s9; + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parseField(); @@ -888,9 +793,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c11); - } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s3 !== peg$FAILED) { s4 = []; @@ -905,9 +808,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c13); - } + if (peg$silentFails === 0) { peg$fail(peg$c13); } } if (s5 !== peg$FAILED) { s6 = []; @@ -926,9 +827,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c15); - } + if (peg$silentFails === 0) { peg$fail(peg$c15); } } if (s9 !== peg$FAILED) { peg$savedPos = s0; @@ -978,7 +877,7 @@ function peg$parse(input, options) { } function peg$parseExpression() { - let s0; + var s0; s0 = peg$parseFieldRangeExpression(); if (s0 === peg$FAILED) { @@ -992,29 +891,21 @@ function peg$parse(input, options) { } function peg$parseField() { - let s0; - let s1; + var s0, s1; peg$silentFails++; s0 = peg$parseLiteral(); peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c17); - } + if (peg$silentFails === 0) { peg$fail(peg$c17); } } return s0; } function peg$parseFieldRangeExpression() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseField(); @@ -1065,12 +956,7 @@ function peg$parse(input, options) { } function peg$parseFieldValueExpression() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseField(); @@ -1087,9 +973,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c11); - } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s3 !== peg$FAILED) { s4 = []; @@ -1129,8 +1013,7 @@ function peg$parse(input, options) { } function peg$parseValueExpression() { - let s0; - let s1; + var s0, s1; s0 = peg$currPos; s1 = peg$parseValue(); @@ -1144,12 +1027,7 @@ function peg$parse(input, options) { } function peg$parseListOfValues() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { @@ -1157,9 +1035,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c6); - } + if (peg$silentFails === 0) { peg$fail(peg$c6); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1178,9 +1054,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c8); - } + if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; @@ -1214,12 +1088,7 @@ function peg$parse(input, options) { } function peg$parseOrListOfValues() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseAndListOfValues(); @@ -1284,12 +1153,7 @@ function peg$parse(input, options) { } function peg$parseAndListOfValues() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseNotListOfValues(); @@ -1354,9 +1218,7 @@ function peg$parse(input, options) { } function peg$parseNotListOfValues() { - let s0; - let s1; - let s2; + var s0, s1, s2; s0 = peg$currPos; s1 = peg$parseNot(); @@ -1382,8 +1244,7 @@ function peg$parse(input, options) { } function peg$parseValue() { - let s0; - let s1; + var s0, s1; peg$silentFails++; s0 = peg$currPos; @@ -1405,20 +1266,14 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c26); - } + if (peg$silentFails === 0) { peg$fail(peg$c26); } } return s0; } function peg$parseOr() { - let s0; - let s1; - let s2; - let s3; - let s4; + var s0, s1, s2, s3, s4; peg$silentFails++; s0 = peg$currPos; @@ -1438,9 +1293,7 @@ function peg$parse(input, options) { peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c31); - } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1471,20 +1324,14 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c29); - } + if (peg$silentFails === 0) { peg$fail(peg$c29); } } return s0; } function peg$parseAnd() { - let s0; - let s1; - let s2; - let s3; - let s4; + var s0, s1, s2, s3, s4; peg$silentFails++; s0 = peg$currPos; @@ -1504,9 +1351,7 @@ function peg$parse(input, options) { peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c34); - } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1537,19 +1382,14 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c32); - } + if (peg$silentFails === 0) { peg$fail(peg$c32); } } return s0; } function peg$parseNot() { - let s0; - let s1; - let s2; - let s3; + var s0, s1, s2, s3; peg$silentFails++; s0 = peg$currPos; @@ -1558,9 +1398,7 @@ function peg$parse(input, options) { peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c37); - } + if (peg$silentFails === 0) { peg$fail(peg$c37); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1587,17 +1425,14 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c35); - } + if (peg$silentFails === 0) { peg$fail(peg$c35); } } return s0; } function peg$parseLiteral() { - let s0; - let s1; + var s0, s1; peg$silentFails++; s0 = peg$parseQuotedString(); @@ -1607,22 +1442,14 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c38); - } + if (peg$silentFails === 0) { peg$fail(peg$c38); } } return s0; } function peg$parseQuotedString() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - let s6; + var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; peg$savedPos = peg$currPos; @@ -1638,9 +1465,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1664,9 +1489,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s6 !== peg$FAILED) { peg$savedPos = s0; @@ -1703,9 +1526,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1720,9 +1541,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c41); - } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; @@ -1746,9 +1565,7 @@ function peg$parse(input, options) { } function peg$parseQuotedCharacter() { - let s0; - let s1; - let s2; + var s0, s1, s2; s0 = peg$parseEscapedWhitespace(); if (s0 === peg$FAILED) { @@ -1760,9 +1577,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { if (peg$c46.test(input.charAt(peg$currPos))) { @@ -1770,9 +1585,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c47); - } + if (peg$silentFails === 0) { peg$fail(peg$c47); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; @@ -1804,9 +1617,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c50); - } + if (peg$silentFails === 0) { peg$fail(peg$c50); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; @@ -1828,12 +1639,7 @@ function peg$parse(input, options) { } function peg$parseUnquotedLiteral() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; peg$savedPos = peg$currPos; @@ -1902,11 +1708,7 @@ function peg$parse(input, options) { } function peg$parseUnquotedCharacter() { - let s0; - let s1; - let s2; - let s3; - let s4; + var s0, s1, s2, s3, s4; s0 = peg$parseEscapedWhitespace(); if (s0 === peg$FAILED) { @@ -1957,9 +1759,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c52); - } + if (peg$silentFails === 0) { peg$fail(peg$c52); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; @@ -1991,8 +1791,7 @@ function peg$parse(input, options) { } function peg$parseWildcard() { - let s0; - let s1; + var s0, s1; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 42) { @@ -2000,9 +1799,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c54); - } + if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2014,12 +1811,7 @@ function peg$parse(input, options) { } function peg$parseOptionalSpace() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; + var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; peg$savedPos = peg$currPos; @@ -2078,8 +1870,7 @@ function peg$parse(input, options) { } function peg$parseEscapedWhitespace() { - let s0; - let s1; + var s0, s1; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c56) { @@ -2087,9 +1878,7 @@ function peg$parse(input, options) { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c57); - } + if (peg$silentFails === 0) { peg$fail(peg$c57); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2103,9 +1892,7 @@ function peg$parse(input, options) { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c60); - } + if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2119,9 +1906,7 @@ function peg$parse(input, options) { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c63); - } + if (peg$silentFails === 0) { peg$fail(peg$c63); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2135,9 +1920,7 @@ function peg$parse(input, options) { } function peg$parseEscapedSpecialCharacter() { - let s0; - let s1; - let s2; + var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { @@ -2145,9 +1928,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { s2 = peg$parseSpecialCharacter(); @@ -2168,9 +1949,7 @@ function peg$parse(input, options) { } function peg$parseEscapedKeyword() { - let s0; - let s1; - let s2; + var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { @@ -2178,9 +1957,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { @@ -2188,9 +1965,7 @@ function peg$parse(input, options) { peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c31); - } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { @@ -2198,9 +1973,7 @@ function peg$parse(input, options) { peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c34); - } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { @@ -2208,9 +1981,7 @@ function peg$parse(input, options) { peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c37); - } + if (peg$silentFails === 0) { peg$fail(peg$c37); } } } } @@ -2231,7 +2002,7 @@ function peg$parse(input, options) { } function peg$parseKeyword() { - let s0; + var s0; s0 = peg$parseOr(); if (s0 === peg$FAILED) { @@ -2245,25 +2016,21 @@ function peg$parse(input, options) { } function peg$parseSpecialCharacter() { - let s0; + var s0; if (peg$c66.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c67); - } + if (peg$silentFails === 0) { peg$fail(peg$c67); } } return s0; } function peg$parseEscapedUnicodeSequence() { - let s0; - let s1; - let s2; + var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { @@ -2271,9 +2038,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c45); - } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { s2 = peg$parseUnicodeSequence(); @@ -2294,14 +2059,7 @@ function peg$parse(input, options) { } function peg$parseUnicodeSequence() { - let s0; - let s1; - let s2; - let s3; - let s4; - let s5; - let s6; - let s7; + var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 117) { @@ -2309,9 +2067,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c70); - } + if (peg$silentFails === 0) { peg$fail(peg$c70); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2364,24 +2120,21 @@ function peg$parse(input, options) { } function peg$parseHexDigit() { - let s0; + var s0; if (peg$c72.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c73); - } + if (peg$silentFails === 0) { peg$fail(peg$c73); } } return s0; } function peg$parseRangeOperator() { - let s0; - let s1; + var s0, s1; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c74) { @@ -2389,9 +2142,7 @@ function peg$parse(input, options) { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c75); - } + if (peg$silentFails === 0) { peg$fail(peg$c75); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2405,9 +2156,7 @@ function peg$parse(input, options) { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c78); - } + if (peg$silentFails === 0) { peg$fail(peg$c78); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2421,9 +2170,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c81); - } + if (peg$silentFails === 0) { peg$fail(peg$c81); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2437,9 +2184,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c84); - } + if (peg$silentFails === 0) { peg$fail(peg$c84); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -2454,8 +2199,7 @@ function peg$parse(input, options) { } function peg$parseSpace() { - let s0; - let s1; + var s0, s1; peg$silentFails++; if (peg$c87.test(input.charAt(peg$currPos))) { @@ -2463,25 +2207,19 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c88); - } + if (peg$silentFails === 0) { peg$fail(peg$c88); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c86); - } + if (peg$silentFails === 0) { peg$fail(peg$c86); } } return s0; } function peg$parseCursor() { - let s0; - let s1; - let s2; + var s0, s1, s2; s0 = peg$currPos; peg$savedPos = peg$currPos; @@ -2497,9 +2235,7 @@ function peg$parse(input, options) { peg$currPos += 14; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { - peg$fail(peg$c90); - } + if (peg$silentFails === 0) { peg$fail(peg$c90); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; @@ -2517,17 +2253,14 @@ function peg$parse(input, options) { return s0; } - const { - parseCursor, - cursorSymbol, - allowLeadingWildcards = true, - helpers: { nodeTypes }, - } = options; - const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; - const buildLiteralNode = nodeTypes.literal.buildNode; - const buildWildcardNode = nodeTypes.wildcard.buildNode; - const buildNamedArgNode = nodeTypes.namedArg.buildNode; - const { wildcardSymbol } = nodeTypes.wildcard; + + const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; + const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; + const buildLiteralNode = nodeTypes.literal.buildNode; + const buildWildcardNode = nodeTypes.wildcard.buildNode; + const buildNamedArgNode = nodeTypes.namedArg.buildNode; + const { wildcardSymbol } = nodeTypes.wildcard; + peg$result = peg$startRuleFunction(); @@ -2550,5 +2283,5 @@ function peg$parse(input, options) { module.exports = { SyntaxError: peg$SyntaxError, - parse: peg$parse, + parse: peg$parse }; From ec4e160333a9d7bc9b11a7644d95cb0b6486671b Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 13 Jul 2021 16:16:09 +0100 Subject: [PATCH 35/52] chore(NA): correctly setup the pegjs build arguments --- packages/kbn-es-query/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel index 51f5d6b4594fb8..9639a1057cac3c 100644 --- a/packages/kbn-es-query/BUILD.bazel +++ b/packages/kbn-es-query/BUILD.bazel @@ -57,7 +57,7 @@ peggy( output_dir = True, args = [ "--allowed-start-rules", - "Expression", + "start,Literal", "-o", "$(@D)/index.js", "./%s/grammar/grammar.peggy" % package_name() From ad97a5846da2af5b5d4b064917eea255c6162b5c Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 13 Jul 2021 17:41:21 +0100 Subject: [PATCH 36/52] chore(NA): update tests expected messages --- .../src/kuery/grammar/__mocks__/grammar.js | 296 +++++++++--------- .../src/kuery/kuery_syntax_error.test.ts | 32 +- .../apis/saved_objects/find.ts | 2 +- 3 files changed, 170 insertions(+), 160 deletions(-) diff --git a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js index a91e67fead7f07..8a7bd31386f9fa 100644 --- a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js +++ b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js @@ -10,8 +10,6 @@ // // https://github.com/peggyjs/peggy -/* eslint-disable */ - "use strict"; function peg$subclass(child, parent) { @@ -139,49 +137,49 @@ function peg$parse(input, options) { var peg$FAILED = {}; - var peg$startRuleFunctions = { Expression: peg$parseExpression }; - var peg$startRuleFunction = peg$parseExpression; + var peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral }; + var peg$startRuleFunction = peg$parsestart; var peg$c0 = function(query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - if (query !== null) return query; - return nodeTypes.function.buildNode('is', '*', '*'); - }; + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + if (query !== null) return query; + return nodeTypes.function.buildNode('is', '*', '*'); + }; var peg$c1 = function(head, query) { return query; }; var peg$c2 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('or', nodes); - }; + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('or', nodes); + }; var peg$c3 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('and', nodes); - }; + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('and', nodes); + }; var peg$c4 = function(query) { - if (query.type === 'cursor') return query; - return buildFunctionNode('not', [query]); - }; + if (query.type === 'cursor') return query; + return buildFunctionNode('not', [query]); + }; var peg$c5 = "("; var peg$c6 = peg$literalExpectation("(", false); var peg$c7 = ")"; var peg$c8 = peg$literalExpectation(")", false); var peg$c9 = function(query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return query; - }; + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + return query; + }; var peg$c10 = ":"; var peg$c11 = peg$literalExpectation(":", false); var peg$c12 = "{"; @@ -189,111 +187,111 @@ function peg$parse(input, options) { var peg$c14 = "}"; var peg$c15 = peg$literalExpectation("}", false); var peg$c16 = function(field, query, trailing) { - if (query.type === 'cursor') { - return { - ...query, - nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, - } - }; + if (query.type === 'cursor') { + return { + ...query, + nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, + } + }; - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return buildFunctionNode('nested', [field, query]); + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] }; + } + return buildFunctionNode('nested', [field, query]); + }; var peg$c17 = peg$otherExpectation("fieldName"); var peg$c18 = function(field, operator, value) { - if (value.type === 'cursor') { - return { - ...value, - suggestionTypes: ['conjunction'] - }; - } - const range = buildNamedArgNode(operator, value); - return buildFunctionNode('range', [field, range]); - }; + if (value.type === 'cursor') { + return { + ...value, + suggestionTypes: ['conjunction'] + }; + } + const range = buildNamedArgNode(operator, value); + return buildFunctionNode('range', [field, range]); + }; var peg$c19 = function(field, partial) { - if (partial.type === 'cursor') { - return { - ...partial, - fieldName: field.value, - suggestionTypes: ['value', 'conjunction'] - }; - } - return partial(field); - }; + if (partial.type === 'cursor') { + return { + ...partial, + fieldName: field.value, + suggestionTypes: ['value', 'conjunction'] + }; + } + return partial(field); + }; var peg$c20 = function(partial) { - if (partial.type === 'cursor') { - const fieldName = `${partial.prefix}${partial.suffix}`.trim(); - return { - ...partial, - fieldName, - suggestionTypes: ['field', 'operator', 'conjunction'] - }; - } - const field = buildLiteralNode(null); - return partial(field); - }; + if (partial.type === 'cursor') { + const fieldName = `${partial.prefix}${partial.suffix}`.trim(); + return { + ...partial, + fieldName, + suggestionTypes: ['field', 'operator', 'conjunction'] + }; + } + const field = buildLiteralNode(null); + return partial(field); + }; var peg$c21 = function(partial, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return partial; - }; + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + return partial; + }; var peg$c22 = function(head, partial) { return partial; }; var peg$c23 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('or', nodes.map(partial => partial(field))); - }; + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('or', nodes.map(partial => partial(field))); + }; var peg$c24 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('and', nodes.map(partial => partial(field))); - }; + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('and', nodes.map(partial => partial(field))); + }; var peg$c25 = function(partial) { - if (partial.type === 'cursor') { - return { - ...list, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('not', [partial(field)]); - }; + if (partial.type === 'cursor') { + return { + ...list, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('not', [partial(field)]); + }; var peg$c26 = peg$otherExpectation("value"); var peg$c27 = function(value) { - if (value.type === 'cursor') return value; - const isPhrase = buildLiteralNode(true); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }; + if (value.type === 'cursor') return value; + const isPhrase = buildLiteralNode(true); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; var peg$c28 = function(value) { - if (value.type === 'cursor') return value; + if (value.type === 'cursor') return value; - if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) { - error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.'); - } + if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) { + error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.'); + } - const isPhrase = buildLiteralNode(false); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }; + const isPhrase = buildLiteralNode(false); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; var peg$c29 = peg$otherExpectation("OR"); var peg$c30 = "or"; var peg$c31 = peg$literalExpectation("or", true); @@ -308,19 +306,19 @@ function peg$parse(input, options) { var peg$c40 = "\""; var peg$c41 = peg$literalExpectation("\"", false); var peg$c42 = function(prefix, cursor, suffix) { - const { start, end } = location(); - return { - type: 'cursor', - start: start.offset, - end: end.offset - cursor.length, - prefix: prefix.join(''), - suffix: suffix.join(''), - text: text().replace(cursor, '') - }; + const { start, end } = location(); + return { + type: 'cursor', + start: start.offset, + end: end.offset - cursor.length, + prefix: prefix.join(''), + suffix: suffix.join(''), + text: text().replace(cursor, '') }; + }; var peg$c43 = function(chars) { - return buildLiteralNode(chars.join('')); - }; + return buildLiteralNode(chars.join('')); + }; var peg$c44 = "\\"; var peg$c45 = peg$literalExpectation("\\", false); var peg$c46 = /^[\\"]/; @@ -329,13 +327,13 @@ function peg$parse(input, options) { var peg$c49 = /^[^"]/; var peg$c50 = peg$classExpectation(["\""], true, false); var peg$c51 = function(chars) { - const sequence = chars.join('').trim(); - if (sequence === 'null') return buildLiteralNode(null); - if (sequence === 'true') return buildLiteralNode(true); - if (sequence === 'false') return buildLiteralNode(false); - if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); - return buildLiteralNode(sequence); - }; + const sequence = chars.join('').trim(); + if (sequence === 'null') return buildLiteralNode(null); + if (sequence === 'true') return buildLiteralNode(true); + if (sequence === 'false') return buildLiteralNode(false); + if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); + return buildLiteralNode(sequence); + }; var peg$c52 = peg$anyExpectation(); var peg$c53 = "*"; var peg$c54 = peg$literalExpectation("*", false); @@ -356,8 +354,8 @@ function peg$parse(input, options) { var peg$c69 = "u"; var peg$c70 = peg$literalExpectation("u", false); var peg$c71 = function(digits) { - return String.fromCharCode(parseInt(digits, 16)); - }; + return String.fromCharCode(parseInt(digits, 16)); + }; var peg$c72 = /^[0-9a-f]/i; var peg$c73 = peg$classExpectation([["0", "9"], ["a", "f"]], false, true); var peg$c74 = "<="; @@ -2254,12 +2252,12 @@ function peg$parse(input, options) { } - const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; - const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; - const buildLiteralNode = nodeTypes.literal.buildNode; - const buildWildcardNode = nodeTypes.wildcard.buildNode; - const buildNamedArgNode = nodeTypes.namedArg.buildNode; - const { wildcardSymbol } = nodeTypes.wildcard; + const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; + const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; + const buildLiteralNode = nodeTypes.literal.buildNode; + const buildWildcardNode = nodeTypes.wildcard.buildNode; + const buildNamedArgNode = nodeTypes.namedArg.buildNode; + const { wildcardSymbol } = nodeTypes.wildcard; peg$result = peg$startRuleFunction(); diff --git a/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts index a755f2b6efe64a..c45d5fd356fce6 100644 --- a/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts @@ -15,7 +15,7 @@ describe('kql syntax errors', () => { expect(() => { fromKueryExpression('response:'); }).toThrow( - 'Expected "(", "{", value, whitespace but end of input found.\n' + + 'Expected whitespace, , whitespace, , value, whitespace, , whitespace, , value, whitespace, , whitespace, , value, whitespace, , whitespace, , value but end of input found.\n' + 'response:\n' + '---------^' ); @@ -25,7 +25,7 @@ describe('kql syntax errors', () => { expect(() => { fromKueryExpression('response:200 or '); }).toThrow( - 'Expected "(", NOT, field name, value but end of input found.\n' + + 'Expected NOT, , field name, field name, field name, value, NOT, , field name, field name, field name, value but end of input found.\n' + 'response:200 or \n' + '----------------^' ); @@ -35,7 +35,9 @@ describe('kql syntax errors', () => { expect(() => { fromKueryExpression('response:(200 or )'); }).toThrow( - 'Expected "(", NOT, value but ")" found.\n' + 'response:(200 or )\n' + '-----------------^' + 'Expected NOT, , value, NOT, , value, NOT, , value, NOT, , value, NOT, , value, NOT, , value, NOT, , value, NOT, , value but ")" found.\n' + + 'response:(200 or )\n' + + '-----------------^' ); }); @@ -43,7 +45,7 @@ describe('kql syntax errors', () => { expect(() => { fromKueryExpression('response:200 and not '); }).toThrow( - 'Expected "(", field name, value but end of input found.\n' + + 'Expected , field name, field name, field name, value, , field name, field name, field name, value but end of input found.\n' + 'response:200 and not \n' + '---------------------^' ); @@ -53,7 +55,7 @@ describe('kql syntax errors', () => { expect(() => { fromKueryExpression('response:(200 and not )'); }).toThrow( - 'Expected "(", value but ")" found.\n' + + 'Expected , value, , value, , value, , value, , value, , value, , value, , value but ")" found.\n' + 'response:(200 and not )\n' + '----------------------^' ); @@ -62,32 +64,42 @@ describe('kql syntax errors', () => { it('should throw an error for unbalanced quotes', () => { expect(() => { fromKueryExpression('foo:"ba '); - }).toThrow('Expected "(", "{", value, whitespace but """ found.\n' + 'foo:"ba \n' + '----^'); + }).toThrow( + 'Expected whitespace, , whitespace, , value, whitespace, , whitespace, , value, whitespace, , whitespace, , value, whitespace, , whitespace, , value but """ found.\n' + + 'foo:"ba \n' + + '----^' + ); }); it('should throw an error for unescaped quotes in a quoted string', () => { expect(() => { fromKueryExpression('foo:"ba "r"'); - }).toThrow('Expected AND, OR, end of input but "r" found.\n' + 'foo:"ba "r"\n' + '---------^'); + }).toThrow( + 'Expected AND, OR, AND, whitespace, but "r" found.\n' + 'foo:"ba "r"\n' + '---------^' + ); }); it('should throw an error for unescaped special characters in literals', () => { expect(() => { fromKueryExpression('foo:ba:r'); - }).toThrow('Expected AND, OR, end of input but ":" found.\n' + 'foo:ba:r\n' + '------^'); + }).toThrow('Expected AND, OR, AND, whitespace, but ":" found.\n' + 'foo:ba:r\n' + '------^'); }); it('should throw an error for range queries missing a value', () => { expect(() => { fromKueryExpression('foo > '); - }).toThrow('Expected literal, whitespace but end of input found.\n' + 'foo > \n' + '------^'); + }).toThrow( + 'Expected whitespace, literal, whitespace, literal, whitespace, literal, whitespace, literal but end of input found.\n' + + 'foo > \n' + + '------^' + ); }); it('should throw an error for range queries missing a field', () => { expect(() => { fromKueryExpression('< 1000'); }).toThrow( - 'Expected "(", NOT, end of input, field name, value, whitespace but "<" found.\n' + + 'Expected whitespace, NOT, , field name, field name, field name, value, NOT, , field name, field name, field name, value, NOT, , field name, field name, field name, value, NOT, , field name, field name, field name, value, whitespace, but "<" found.\n' + '< 1000\n' + '^' ); diff --git a/test/api_integration/apis/saved_objects/find.ts b/test/api_integration/apis/saved_objects/find.ts index a38043c7c93524..2255fad51d5a86 100644 --- a/test/api_integration/apis/saved_objects/find.ts +++ b/test/api_integration/apis/saved_objects/find.ts @@ -184,7 +184,7 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.body).to.eql({ error: 'Bad Request', message: - 'KQLSyntaxError: Expected AND, OR, end of input but "<" found.\ndashboard.' + + 'KQLSyntaxError: Expected AND, OR, AND, whitespace, but "<" found.\ndashboard.' + 'attributes.title:foo Date: Tue, 13 Jul 2021 19:17:45 +0200 Subject: [PATCH 37/52] eslint --- packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js index 8a7bd31386f9fa..4f3667b7373c27 100644 --- a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js +++ b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js @@ -10,6 +10,8 @@ // // https://github.com/peggyjs/peggy +/* eslint-disable */ + "use strict"; function peg$subclass(child, parent) { From 3dfc6a57cf10f3082eda3be01251561dbf09760f Mon Sep 17 00:00:00 2001 From: Liza K Date: Thu, 15 Jul 2021 12:10:34 +0200 Subject: [PATCH 38/52] Docs and deprecation --- ...ic.aggconfigs.getsearchsourcetimefilter.md | 4 +- ...plugin-plugins-data-public.customfilter.md | 16 + ...na-plugin-plugins-data-public.esfilters.md | 46 +-- ...bana-plugin-plugins-data-public.eskuery.md | 6 +- ...bana-plugin-plugins-data-public.esquery.md | 12 +- ...lugin-plugins-data-public.esqueryconfig.md | 16 + ...plugin-plugins-data-public.existsfilter.md | 16 + ...ibana-plugin-plugins-data-public.filter.md | 16 + ...bana-plugin-plugins-data-public.gettime.md | 4 +- ...lugin-plugins-data-public.ifieldsubtype.md | 16 + ...n-plugins-data-public.indexpatternfield.md | 2 +- ...s-data-public.indexpatternfield.subtype.md | 2 +- ...ns-data-public.indexpatternfield.tojson.md | 4 +- ...ana-plugin-plugins-data-public.isfilter.md | 16 + ...na-plugin-plugins-data-public.isfilters.md | 16 + ...na-plugin-plugins-data-public.kuerynode.md | 16 + ...ugin-plugins-data-public.matchallfilter.md | 16 + .../kibana-plugin-plugins-data-public.md | 14 + ...plugin-plugins-data-public.phrasefilter.md | 16 + ...lugin-plugins-data-public.phrasesfilter.md | 16 + ...-plugin-plugins-data-public.rangefilter.md | 16 + ...gin-plugins-data-public.rangefiltermeta.md | 16 + ...n-plugins-data-public.rangefilterparams.md | 16 + ...s-data-public.searchsourcefields.filter.md | 1 + ...-plugins-data-public.searchsourcefields.md | 2 +- ...na-plugin-plugins-data-server.esfilters.md | 18 +- ...bana-plugin-plugins-data-server.eskuery.md | 6 +- ...bana-plugin-plugins-data-server.esquery.md | 8 +- ...lugin-plugins-data-server.esqueryconfig.md | 16 + ...ibana-plugin-plugins-data-server.filter.md | 16 + ...bana-plugin-plugins-data-server.gettime.md | 4 +- ...lugin-plugins-data-server.ifieldsubtype.md | 16 + ...na-plugin-plugins-data-server.kuerynode.md | 16 + .../kibana-plugin-plugins-data-server.md | 4 + src/plugins/data/common/es_query/index.ts | 325 +++++++++++++++++- src/plugins/data/public/index.ts | 34 +- src/plugins/data/public/public.api.md | 205 ++++++----- src/plugins/data/server/index.ts | 14 +- src/plugins/data/server/server.api.md | 128 +++---- .../common/types/timeline/columns/index.ts | 3 +- 40 files changed, 902 insertions(+), 232 deletions(-) create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md index 1f8bc1300a0a86..9ebc685f2a77d6 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md @@ -7,7 +7,7 @@ Signature: ```typescript -getSearchSourceTimeFilter(forceNow?: Date): RangeFilter[] | { +getSearchSourceTimeFilter(forceNow?: Date): import("@kbn/es-query").RangeFilter[] | { meta: { index: string | undefined; params: {}; @@ -43,7 +43,7 @@ getSearchSourceTimeFilter(forceNow?: Date): RangeFilter[] | { Returns: -`RangeFilter[] | { +`import("@kbn/es-query").RangeFilter[] | { meta: { index: string | undefined; params: {}; diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md new file mode 100644 index 00000000000000..d986ad634d0c67 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [CustomFilter](./kibana-plugin-plugins-data-public.customfilter.md) + +## CustomFilter type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type CustomFilter = oldCustomFilter; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md index 3d667b59cd591d..eb06d994261974 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md @@ -10,23 +10,23 @@ esFilters: { FilterLabel: (props: import("./ui/filter_bar/filter_editor/lib/filter_label").FilterLabelProps) => JSX.Element; FilterItem: (props: import("./ui/filter_bar/filter_item").FilterItemProps) => JSX.Element; - FILTERS: typeof FILTERS; + FILTERS: typeof import("@kbn/es-query").FILTERS; FilterStateStore: typeof FilterStateStore; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; - buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../common").ExistsFilter; - buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../common").PhraseFilter; - buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").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("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - isRangeFilter: (filter: any) => filter is import("../common").RangeFilter; - isMatchAllFilter: (filter: any) => filter is import("../common").MatchAllFilter; - isMissingFilter: (filter: any) => filter is import("../common").MissingFilter; - isQueryStringFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - isFilterPinned: (filter: import("../common").Filter) => boolean | undefined; - toggleFilterNegated: (filter: import("../common").Filter) => { + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isPhraseFilter: (filter: any) => filter is import("@kbn/es-query").PhraseFilter; + isExistsFilter: (filter: any) => filter is import("@kbn/es-query").ExistsFilter; + isPhrasesFilter: (filter: any) => filter is import("@kbn/es-query").PhrasesFilter; + isRangeFilter: (filter: any) => filter is import("@kbn/es-query").RangeFilter; + isMatchAllFilter: (filter: any) => filter is import("@kbn/es-query").MatchAllFilter; + isMissingFilter: (filter: any) => filter is import("@kbn/es-query").MissingFilter; + isQueryStringFilter: (filter: any) => filter is import("@kbn/es-query").QueryStringFilter; + isFilterPinned: (filter: import("@kbn/es-query").Filter) => boolean | undefined; + toggleFilterNegated: (filter: import("@kbn/es-query").Filter) => { meta: { negate: boolean; alias: string | null; @@ -39,20 +39,20 @@ esFilters: { params?: any; value?: string | undefined; }; - $state?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/filters/types").FilterState | undefined; + $state?: import("@kbn/es-query/target_types/filters/types").FilterState | undefined; query?: any; }; - disableFilter: (filter: import("../common").Filter) => import("../common").Filter; - getPhraseFilterField: (filter: import("../common").PhraseFilter) => string; - getPhraseFilterValue: (filter: import("../common").PhraseFilter) => string | number | boolean; + disableFilter: (filter: import("@kbn/es-query").Filter) => import("@kbn/es-query").Filter; + getPhraseFilterField: (filter: import("@kbn/es-query").PhraseFilter) => string; + getPhraseFilterValue: (filter: import("@kbn/es-query").PhraseFilter) => string | number | boolean; getDisplayValueFromFilter: typeof getDisplayValueFromFilter; - compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; + compareFilters: (first: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], second: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions; generateFilters: typeof generateFilters; - onlyDisabledFiltersChanged: (newFilters?: import("../common").Filter[] | undefined, oldFilters?: import("../common").Filter[] | undefined) => boolean; + onlyDisabledFiltersChanged: (newFilters?: import("@kbn/es-query").Filter[] | undefined, oldFilters?: import("@kbn/es-query").Filter[] | undefined) => boolean; changeTimeFilter: typeof changeTimeFilter; convertRangeFilterToTimeRangeString: typeof convertRangeFilterToTimeRangeString; - mapAndFlattenFilters: (filters: import("../common").Filter[]) => import("../common").Filter[]; + mapAndFlattenFilters: (filters: import("@kbn/es-query").Filter[]) => import("@kbn/es-query").Filter[]; extractTimeFilter: typeof extractTimeFilter; extractTimeRange: typeof extractTimeRange; } diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md index 7b1dad4200f6e8..9debef0e596f1d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md @@ -8,8 +8,8 @@ ```typescript esKuery: { - nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../common").KueryNode; - toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; } ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md index f1ecacba10e289..4261fae07c951a 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md @@ -8,15 +8,15 @@ ```typescript esQuery: { - buildEsQuery: typeof buildEsQuery; + buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; getEsQueryConfig: typeof getEsQueryConfig; - buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../common").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../common").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; - luceneStringToDsl: typeof luceneStringToDsl; - decorateQuery: typeof decorateQuery; + luceneStringToDsl: typeof import("@kbn/es-query").luceneStringToDsl; + decorateQuery: typeof import("@kbn/es-query").decorateQuery; } ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md new file mode 100644 index 00000000000000..d9ae1c5be5e744 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) + +## EsQueryConfig type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type EsQueryConfig = oldEsQueryConfig; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md new file mode 100644 index 00000000000000..d2d59fa2de0583 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ExistsFilter](./kibana-plugin-plugins-data-public.existsfilter.md) + +## ExistsFilter type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type ExistsFilter = oldExistsFilter; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md new file mode 100644 index 00000000000000..4447cb2ec96f0e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Filter](./kibana-plugin-plugins-data-public.filter.md) + +## Filter type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type Filter = oldFilter; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md index 3969a97fa7789f..7fd1914d1a4a59 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md @@ -10,7 +10,7 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("../..").RangeFilter | undefined; +}): import("@kbn/es-query").RangeFilter | undefined; ``` ## Parameters @@ -23,5 +23,5 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRan Returns: -`import("../..").RangeFilter | undefined` +`import("@kbn/es-query").RangeFilter | undefined` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md new file mode 100644 index 00000000000000..218395792b5a48 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) + +## IFieldSubType type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type IFieldSubType = oldIFieldSubType; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md index 9a91a0a8683059..dc206ceabefe27 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md @@ -37,7 +37,7 @@ export declare class IndexPatternField implements IFieldType | [searchable](./kibana-plugin-plugins-data-public.indexpatternfield.searchable.md) | | boolean | | | [sortable](./kibana-plugin-plugins-data-public.indexpatternfield.sortable.md) | | boolean | | | [spec](./kibana-plugin-plugins-data-public.indexpatternfield.spec.md) | | FieldSpec | | -| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("../../../public").IFieldSubType | undefined | | +| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("@kbn/es-query").IFieldSubType | undefined | | | [type](./kibana-plugin-plugins-data-public.indexpatternfield.type.md) | | string | | | [visualizable](./kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md) | | boolean | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md index 3d6f3c5f40a06e..f5e25e3191f724 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md @@ -7,5 +7,5 @@ Signature: ```typescript -get subType(): import("../../../public").IFieldSubType | undefined; +get subType(): import("@kbn/es-query").IFieldSubType | undefined; ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md index 1831668cdcd5ab..9afcef6afed3ae 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md @@ -19,7 +19,7 @@ toJSON(): { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../../../public").IFieldSubType | undefined; + subType: import("@kbn/es-query").IFieldSubType | undefined; customLabel: string | undefined; }; ``` @@ -37,7 +37,7 @@ toJSON(): { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../../../public").IFieldSubType | undefined; + subType: import("@kbn/es-query").IFieldSubType | undefined; customLabel: string | undefined; }` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md new file mode 100644 index 00000000000000..4869ed7d1e5afc --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [isFilter](./kibana-plugin-plugins-data-public.isfilter.md) + +## isFilter variable + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +isFilter: (x: unknown) => x is oldFilter +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md new file mode 100644 index 00000000000000..22165fd061f774 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [isFilters](./kibana-plugin-plugins-data-public.isfilters.md) + +## isFilters variable + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +isFilters: (x: unknown) => x is oldFilter[] +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md new file mode 100644 index 00000000000000..76c3c9efd35146 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) + +## KueryNode type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type KueryNode = oldKueryNode; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md new file mode 100644 index 00000000000000..56ab10571a7c04 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [MatchAllFilter](./kibana-plugin-plugins-data-public.matchallfilter.md) + +## MatchAllFilter type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type MatchAllFilter = oldMatchAllFilter; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md index 962795af1dc74e..e60e26bcb503ed 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md @@ -120,6 +120,8 @@ | [injectSearchSourceReferences](./kibana-plugin-plugins-data-public.injectsearchsourcereferences.md) | | | [isCompleteResponse](./kibana-plugin-plugins-data-public.iscompleteresponse.md) | | | [isErrorResponse](./kibana-plugin-plugins-data-public.iserrorresponse.md) | | +| [isFilter](./kibana-plugin-plugins-data-public.isfilter.md) | | +| [isFilters](./kibana-plugin-plugins-data-public.isfilters.md) | | | [isPartialResponse](./kibana-plugin-plugins-data-public.ispartialresponse.md) | | | [isQuery](./kibana-plugin-plugins-data-public.isquery.md) | | | [isTimeRange](./kibana-plugin-plugins-data-public.istimerange.md) | | @@ -142,11 +144,14 @@ | [AggsStart](./kibana-plugin-plugins-data-public.aggsstart.md) | AggsStart represents the actual external contract as AggsCommonStart is only used internally. The difference is that AggsStart includes the typings for the registry with initialized agg types. | | [AutocompleteStart](./kibana-plugin-plugins-data-public.autocompletestart.md) | \* | | [AutoRefreshDoneFn](./kibana-plugin-plugins-data-public.autorefreshdonefn.md) | | +| [CustomFilter](./kibana-plugin-plugins-data-public.customfilter.md) | | | [EsaggsExpressionFunctionDefinition](./kibana-plugin-plugins-data-public.esaggsexpressionfunctiondefinition.md) | | | [EsdslExpressionFunctionDefinition](./kibana-plugin-plugins-data-public.esdslexpressionfunctiondefinition.md) | | +| [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) | | | [EsQuerySortValue](./kibana-plugin-plugins-data-public.esquerysortvalue.md) | | | [EsRawResponseExpressionTypeDefinition](./kibana-plugin-plugins-data-public.esrawresponseexpressiontypedefinition.md) | | | [ExecutionContextSearch](./kibana-plugin-plugins-data-public.executioncontextsearch.md) | | +| [ExistsFilter](./kibana-plugin-plugins-data-public.existsfilter.md) | | | [ExpressionFunctionKibana](./kibana-plugin-plugins-data-public.expressionfunctionkibana.md) | | | [ExpressionFunctionKibanaContext](./kibana-plugin-plugins-data-public.expressionfunctionkibanacontext.md) | | | [ExpressionValueSearchContext](./kibana-plugin-plugins-data-public.expressionvaluesearchcontext.md) | | @@ -154,6 +159,7 @@ | [FieldFormatsContentType](./kibana-plugin-plugins-data-public.fieldformatscontenttype.md) | \* | | [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md) | | | [FieldFormatsStart](./kibana-plugin-plugins-data-public.fieldformatsstart.md) | | +| [Filter](./kibana-plugin-plugins-data-public.filter.md) | | | [IAggConfig](./kibana-plugin-plugins-data-public.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. | | [IAggType](./kibana-plugin-plugins-data-public.iaggtype.md) | | | [IEsError](./kibana-plugin-plugins-data-public.ieserror.md) | | @@ -161,6 +167,7 @@ | [IFieldFormat](./kibana-plugin-plugins-data-public.ifieldformat.md) | | | [IFieldFormatsRegistry](./kibana-plugin-plugins-data-public.ifieldformatsregistry.md) | | | [IFieldParamType](./kibana-plugin-plugins-data-public.ifieldparamtype.md) | | +| [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) | | | [IMetricAggType](./kibana-plugin-plugins-data-public.imetricaggtype.md) | | | [IndexPatternAggRestrictions](./kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md) | | | [IndexPatternLoadExpressionFunctionDefinition](./kibana-plugin-plugins-data-public.indexpatternloadexpressionfunctiondefinition.md) | | @@ -172,10 +179,17 @@ | [ISessionsClient](./kibana-plugin-plugins-data-public.isessionsclient.md) | | | [ISessionService](./kibana-plugin-plugins-data-public.isessionservice.md) | | | [KibanaContext](./kibana-plugin-plugins-data-public.kibanacontext.md) | | +| [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) | | +| [MatchAllFilter](./kibana-plugin-plugins-data-public.matchallfilter.md) | | | [ParsedInterval](./kibana-plugin-plugins-data-public.parsedinterval.md) | | +| [PhraseFilter](./kibana-plugin-plugins-data-public.phrasefilter.md) | | +| [PhrasesFilter](./kibana-plugin-plugins-data-public.phrasesfilter.md) | | | [QueryStart](./kibana-plugin-plugins-data-public.querystart.md) | | | [QuerySuggestion](./kibana-plugin-plugins-data-public.querysuggestion.md) | \* | | [QuerySuggestionGetFn](./kibana-plugin-plugins-data-public.querysuggestiongetfn.md) | | +| [RangeFilter](./kibana-plugin-plugins-data-public.rangefilter.md) | | +| [RangeFilterMeta](./kibana-plugin-plugins-data-public.rangefiltermeta.md) | | +| [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) | | | [SavedQueryTimeFilter](./kibana-plugin-plugins-data-public.savedquerytimefilter.md) | | | [SearchBarProps](./kibana-plugin-plugins-data-public.searchbarprops.md) | | | [StatefulSearchBarProps](./kibana-plugin-plugins-data-public.statefulsearchbarprops.md) | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md new file mode 100644 index 00000000000000..d37c5a0649d217 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [PhraseFilter](./kibana-plugin-plugins-data-public.phrasefilter.md) + +## PhraseFilter type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type PhraseFilter = oldPhraseFilter; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md new file mode 100644 index 00000000000000..2984749ce47b4b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [PhrasesFilter](./kibana-plugin-plugins-data-public.phrasesfilter.md) + +## PhrasesFilter type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type PhrasesFilter = oldPhrasesFilter; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md new file mode 100644 index 00000000000000..5dfaefaa818a2e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilter](./kibana-plugin-plugins-data-public.rangefilter.md) + +## RangeFilter type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type RangeFilter = oldRangeFilter; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md new file mode 100644 index 00000000000000..bd148b3941ef76 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterMeta](./kibana-plugin-plugins-data-public.rangefiltermeta.md) + +## RangeFilterMeta type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type RangeFilterMeta = oldRangeFilterMeta; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md new file mode 100644 index 00000000000000..6bfa013079293a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) + +## RangeFilterParams type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type RangeFilterParams = oldRangeFilterParams; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md index 214df9601dc8e5..5fd615cc647d29 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md @@ -4,6 +4,7 @@ ## SearchSourceFields.filter property +[Filter](./kibana-plugin-plugins-data-public.filter.md) Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md index 93a24d1013b1be..22dc6fa9f627ba 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md @@ -19,7 +19,7 @@ export interface SearchSourceFields | [aggs](./kibana-plugin-plugins-data-public.searchsourcefields.aggs.md) | object | IAggConfigs | (() => object) | [AggConfigs](./kibana-plugin-plugins-data-public.aggconfigs.md) | | [fields](./kibana-plugin-plugins-data-public.searchsourcefields.fields.md) | SearchFieldValue[] | Retrieve fields via the search Fields API | | [fieldsFromSource](./kibana-plugin-plugins-data-public.searchsourcefields.fieldsfromsource.md) | NameList | Retreive fields directly from \_source (legacy behavior) | -| [filter](./kibana-plugin-plugins-data-public.searchsourcefields.filter.md) | Filter[] | Filter | (() => Filter[] | Filter | undefined) | | +| [filter](./kibana-plugin-plugins-data-public.searchsourcefields.filter.md) | Filter[] | Filter | (() => Filter[] | Filter | undefined) | [Filter](./kibana-plugin-plugins-data-public.filter.md) | | [from](./kibana-plugin-plugins-data-public.searchsourcefields.from.md) | number | | | [highlight](./kibana-plugin-plugins-data-public.searchsourcefields.highlight.md) | any | | | [highlightAll](./kibana-plugin-plugins-data-public.searchsourcefields.highlightall.md) | boolean | | diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md index 6245b196bfd904..9006b088993a14 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md @@ -8,14 +8,14 @@ ```typescript esFilters: { - buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - buildCustomFilter: typeof buildCustomFilter; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; - buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../common").ExistsFilter; - buildFilter: typeof buildFilter; - buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../common").PhraseFilter; - buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter; - isFilterDisabled: (filter: import("../common").Filter) => boolean; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; + buildCustomFilter: typeof import("@kbn/es-query").buildCustomFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; + buildFilter: typeof import("@kbn/es-query").buildFilter; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isFilterDisabled: (filter: import("@kbn/es-query").Filter) => boolean; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md index deb6ad74873fff..4989b2b5ad5844 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md @@ -8,8 +8,8 @@ ```typescript esKuery: { - nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../common").KueryNode; - toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md index c195fa985f2bea..8dfea00081d890 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md @@ -8,13 +8,13 @@ ```typescript esQuery: { - buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../common").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../common").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; getEsQueryConfig: typeof getEsQueryConfig; - buildEsQuery: typeof buildEsQuery; + buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md new file mode 100644 index 00000000000000..1b9bc2181d52db --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) + +## EsQueryConfig type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type EsQueryConfig = oldEsQueryConfig; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md new file mode 100644 index 00000000000000..bdd2cc3c11642c --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Filter](./kibana-plugin-plugins-data-server.filter.md) + +## Filter type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type Filter = oldFilter; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md index 54e7cf92f500cf..7f2267aff7049e 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md @@ -10,7 +10,7 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("../..").RangeFilter | undefined; +}): import("@kbn/es-query").RangeFilter | undefined; ``` ## Parameters @@ -23,5 +23,5 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRan Returns: -`import("../..").RangeFilter | undefined` +`import("@kbn/es-query").RangeFilter | undefined` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md new file mode 100644 index 00000000000000..b758e8fcca6443 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) + +## IFieldSubType type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type IFieldSubType = oldIFieldSubType; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md new file mode 100644 index 00000000000000..428fc2470e8529 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [KueryNode](./kibana-plugin-plugins-data-server.kuerynode.md) + +## KueryNode type + +> Warning: This API is now obsolete. +> +> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> + +Signature: + +```typescript +declare type KueryNode = oldKueryNode; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md index 25ae54e831da70..8e23f47976bd9f 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md @@ -94,19 +94,23 @@ | [AggGroupName](./kibana-plugin-plugins-data-server.agggroupname.md) | | | [AggParam](./kibana-plugin-plugins-data-server.aggparam.md) | | | [EsaggsExpressionFunctionDefinition](./kibana-plugin-plugins-data-server.esaggsexpressionfunctiondefinition.md) | | +| [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) | | | [ExecutionContextSearch](./kibana-plugin-plugins-data-server.executioncontextsearch.md) | | | [ExpressionFunctionKibana](./kibana-plugin-plugins-data-server.expressionfunctionkibana.md) | | | [ExpressionFunctionKibanaContext](./kibana-plugin-plugins-data-server.expressionfunctionkibanacontext.md) | | | [ExpressionValueSearchContext](./kibana-plugin-plugins-data-server.expressionvaluesearchcontext.md) | | | [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md) | | +| [Filter](./kibana-plugin-plugins-data-server.filter.md) | | | [IAggConfig](./kibana-plugin-plugins-data-server.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. | | [IAggType](./kibana-plugin-plugins-data-server.iaggtype.md) | | | [IEsSearchResponse](./kibana-plugin-plugins-data-server.iessearchresponse.md) | | | [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) | | | [IFieldParamType](./kibana-plugin-plugins-data-server.ifieldparamtype.md) | | +| [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) | | | [IMetricAggType](./kibana-plugin-plugins-data-server.imetricaggtype.md) | | | [IndexPatternLoadExpressionFunctionDefinition](./kibana-plugin-plugins-data-server.indexpatternloadexpressionfunctiondefinition.md) | | | [KibanaContext](./kibana-plugin-plugins-data-server.kibanacontext.md) | | +| [KueryNode](./kibana-plugin-plugins-data-server.kuerynode.md) | | | [ParsedInterval](./kibana-plugin-plugins-data-server.parsedinterval.md) | | | [SearchRequestHandlerContext](./kibana-plugin-plugins-data-server.searchrequesthandlercontext.md) | | | [TimeRange](./kibana-plugin-plugins-data-server.timerange.md) | | diff --git a/src/plugins/data/common/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index 4c9519b5a47483..a99db2071f8ca2 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -8,11 +8,319 @@ export { getEsQueryConfig } from './get_es_query_config'; +// NOTE: Trick to deprecate exports https://stackoverflow.com/a/49152018/372086 +import { + isFilterDisabled as oldIsFilterDisabled, + disableFilter as oldDisableFilter, + fromKueryExpression as oldFromKueryExpression, + toElasticsearchQuery as oldToElasticsearchQuery, + nodeTypes as oldNodeTypes, + buildEsQuery as oldBuildEsQuery, + buildQueryFromFilters as oldBuildQueryFromFilters, + luceneStringToDsl as oldLuceneStringToDsl, + decorateQuery as olddecorateQuery, + getPhraseFilterField as oldgetPhraseFilterField, + getPhraseFilterValue as oldgetPhraseFilterValue, + isFilterPinned as oldIsFilterPinned, + nodeBuilder as oldNodeBuilder, + isFilters as oldIsFilters, + isExistsFilter as oldIsExistsFilter, + isMatchAllFilter as oldIsMatchAllFilter, + isGeoBoundingBoxFilter as oldIsGeoBoundingBoxFilter, + isGeoPolygonFilter as oldIsGeoPolygonFilter, + isMissingFilter as oldIsMissingFilter, + isPhraseFilter as oldIsPhraseFilter, + isPhrasesFilter as oldIsPhrasesFilter, + isRangeFilter as oldIsRangeFilter, + isQueryStringFilter as oldIsQueryStringFilter, + buildQueryFilter as oldBuildQueryFilter, + buildPhrasesFilter as oldBuildPhrasesFilter, + buildPhraseFilter as oldBuildPhraseFilter, + buildRangeFilter as oldBuildRangeFilter, + buildCustomFilter as oldBuildCustomFilter, + buildFilter as oldBuildFilter, + buildEmptyFilter as oldBuildEmptyFilter, + buildExistsFilter as oldBuildExistsFilter, + toggleFilterNegated as oldtoggleFilterNegated, + Filter as oldFilter, + RangeFilterMeta as oldRangeFilterMeta, + RangeFilterParams as oldRangeFilterParams, + ExistsFilter as oldExistsFilter, + GeoPolygonFilter as oldGeoPolygonFilter, + PhrasesFilter as oldPhrasesFilter, + PhraseFilter as oldPhraseFilter, + MatchAllFilter as oldMatchAllFilter, + CustomFilter as oldCustomFilter, + MissingFilter as oldMissingFilter, + RangeFilter as oldRangeFilter, + GeoBoundingBoxFilter as oldGeoBoundingBoxFilter, + KueryNode as oldKueryNode, + FilterMeta as oldFilterMeta, + FILTERS as oldFILTERS, + IFieldSubType as oldIFieldSubType, + EsQueryConfig as oldEsQueryConfig, + isFilter as oldIsFilter, + FilterStateStore, +} from '@kbn/es-query'; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ + +const isFilter = oldIsFilter; +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isFilterDisabled = oldIsFilterDisabled; +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const disableFilter = oldDisableFilter; +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const fromKueryExpression = oldFromKueryExpression; +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const toElasticsearchQuery = oldToElasticsearchQuery; +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const nodeTypes = oldNodeTypes; +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const buildEsQuery = oldBuildEsQuery; +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const buildQueryFromFilters = oldBuildQueryFromFilters; +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const luceneStringToDsl = oldLuceneStringToDsl; +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const decorateQuery = olddecorateQuery; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const getPhraseFilterField = oldgetPhraseFilterField; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const getPhraseFilterValue = oldgetPhraseFilterValue; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isFilterPinned = oldIsFilterPinned; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const nodeBuilder = oldNodeBuilder; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isFilters = oldIsFilters; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isExistsFilter = oldIsExistsFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isMatchAllFilter = oldIsMatchAllFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isGeoBoundingBoxFilter = oldIsGeoBoundingBoxFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isGeoPolygonFilter = oldIsGeoPolygonFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isMissingFilter = oldIsMissingFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isPhraseFilter = oldIsPhraseFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isPhrasesFilter = oldIsPhrasesFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isRangeFilter = oldIsRangeFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const isQueryStringFilter = oldIsQueryStringFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const buildQueryFilter = oldBuildQueryFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const buildPhrasesFilter = oldBuildPhrasesFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const buildPhraseFilter = oldBuildPhraseFilter; + /** - * Legacy re-exports from package. - * @deprecated Use imports from `@kbn/es-query` directly + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. */ +const buildRangeFilter = oldBuildRangeFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const buildCustomFilter = oldBuildCustomFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const buildFilter = oldBuildFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const buildEmptyFilter = oldBuildEmptyFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const buildExistsFilter = oldBuildExistsFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const toggleFilterNegated = oldtoggleFilterNegated; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +const FILTERS = oldFILTERS; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type Filter = oldFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type RangeFilterMeta = oldRangeFilterMeta; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type RangeFilterParams = oldRangeFilterParams; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type ExistsFilter = oldExistsFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type GeoPolygonFilter = oldGeoPolygonFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type PhrasesFilter = oldPhrasesFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type PhraseFilter = oldPhraseFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type MatchAllFilter = oldMatchAllFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type CustomFilter = oldCustomFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type MissingFilter = oldMissingFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type RangeFilter = oldRangeFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type GeoBoundingBoxFilter = oldGeoBoundingBoxFilter; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type KueryNode = oldKueryNode; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type FilterMeta = oldFilterMeta; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type IFieldSubType = oldIFieldSubType; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ +type EsQueryConfig = oldEsQueryConfig; + +/** + * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ + export { + disableFilter, + fromKueryExpression, + toElasticsearchQuery, + nodeTypes, + buildEsQuery, + buildQueryFromFilters, + luceneStringToDsl, + decorateQuery, + getPhraseFilterField, + getPhraseFilterValue, + isFilterPinned, nodeBuilder, isFilters, isExistsFilter, @@ -33,9 +341,16 @@ export { buildEmptyFilter, buildExistsFilter, toggleFilterNegated, + FILTERS, + isFilter, + isFilterDisabled, + FilterStateStore, Filter, + RangeFilterMeta, + RangeFilterParams, ExistsFilter, GeoPolygonFilter, + PhrasesFilter, PhraseFilter, MatchAllFilter, CustomFilter, @@ -44,6 +359,6 @@ export { GeoBoundingBoxFilter, KueryNode, FilterMeta, - FilterStateStore, - FILTERS, -} from '@kbn/es-query'; + IFieldSubType, + EsQueryConfig, +}; diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index d066e58f886cf7..e02576b8bb5f8e 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -6,6 +6,17 @@ * Side Public License, v 1. */ +/* + * esQuery and esKuery: + */ + +import { PluginInitializerContext } from '../../../core/public'; +import { ConfigSchema } from '../config'; + +/* + * Filters: + */ + import { getPhraseFilterField, getPhraseFilterValue, @@ -32,19 +43,11 @@ import { buildQueryFromFilters, luceneStringToDsl, decorateQuery, -} from '@kbn/es-query'; -/* - * esQuery and esKuery: - */ - -import { PluginInitializerContext } from '../../../core/public'; -import { ConfigSchema } from '../config'; - -/* - * Filters: - */ - -import { FILTERS, FilterStateStore, compareFilters, COMPARE_ALL_OPTIONS } from '../common'; + FILTERS, + FilterStateStore, + compareFilters, + COMPARE_ALL_OPTIONS, +} from '../common'; import { FilterLabel } from './ui'; import { FilterItem } from './ui/filter_bar'; @@ -102,9 +105,6 @@ export const esFilters = { extractTimeRange, }; -/** - * @deprecated Import from `@kbn/es-query` directly. - */ export { KueryNode, RangeFilter, @@ -119,7 +119,7 @@ export { EsQueryConfig, isFilter, isFilters, -} from '@kbn/es-query'; +} from '../common'; import { getEsQueryConfig } from '../common'; diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index 3e28df2de0e574..d634d4db0fb141 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -12,23 +12,21 @@ import { ApplicationStart } from 'kibana/public'; import { Assign } from '@kbn/utility-types'; import { BfetchPublicSetup } from 'src/plugins/bfetch/public'; import Boom from '@hapi/boom'; -import { buildEsQuery } from '@kbn/es-query'; import { ConfigDeprecationProvider } from '@kbn/config'; import { CoreSetup } from 'src/core/public'; import { CoreSetup as CoreSetup_2 } from 'kibana/public'; import { CoreStart } from 'kibana/public'; import { CoreStart as CoreStart_2 } from 'src/core/public'; -import { CustomFilter } from '@kbn/es-query'; +import { CustomFilter as CustomFilter_2 } from '@kbn/es-query'; import { Datatable as Datatable_2 } from 'src/plugins/expressions'; import { Datatable as Datatable_3 } from 'src/plugins/expressions/common'; import { DatatableColumn as DatatableColumn_2 } from 'src/plugins/expressions'; import { DatatableColumnType as DatatableColumnType_2 } from 'src/plugins/expressions/common'; -import { decorateQuery } from '@kbn/es-query'; import { DetailedPeerCertificate } from 'tls'; import { Ensure } from '@kbn/utility-types'; import { EnvironmentMode } from '@kbn/config'; import { ErrorToastOptions } from 'src/core/public/notifications'; -import { EsQueryConfig } from '@kbn/es-query'; +import { EsQueryConfig as EsQueryConfig_2 } from '@kbn/es-query'; import { estypes } from '@elastic/elasticsearch'; import { EuiBreadcrumb } from '@elastic/eui'; import { EuiButtonEmptyProps } from '@elastic/eui'; @@ -39,13 +37,12 @@ import { EuiGlobalToastListToast } from '@elastic/eui'; import { EuiIconProps } from '@elastic/eui'; import { EventEmitter } from 'events'; import { ExecutionContext } from 'src/plugins/expressions/common'; -import { ExistsFilter } from '@kbn/es-query'; +import { ExistsFilter as ExistsFilter_2 } from '@kbn/es-query'; import { ExpressionAstExpression } from 'src/plugins/expressions/common'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { ExpressionsSetup } from 'src/plugins/expressions/public'; import { ExpressionValueBoxed } from 'src/plugins/expressions/common'; -import { Filter } from '@kbn/es-query'; -import { FILTERS } from '@kbn/es-query'; +import { Filter as Filter_2 } from '@kbn/es-query'; import { FilterStateStore } from '@kbn/es-query'; import { FormatFactory as FormatFactory_2 } from 'src/plugins/data/common/field_formats/utils'; import { History } from 'history'; @@ -54,25 +51,22 @@ import { HttpSetup } from 'kibana/public'; import { IAggConfigs as IAggConfigs_2 } from 'src/plugins/data/public'; import { IconType } from '@elastic/eui'; import { IEsSearchResponse as IEsSearchResponse_2 } from 'src/plugins/data/public'; -import { IFieldSubType } from '@kbn/es-query'; +import { IFieldSubType as IFieldSubType_2 } from '@kbn/es-query'; import { IncomingHttpHeaders } from 'http'; import { IndexPatternBase } from '@kbn/es-query'; import { IndexPatternFieldBase } from '@kbn/es-query'; import { InjectedIntl } from '@kbn/i18n/react'; import { ISearchOptions as ISearchOptions_2 } from 'src/plugins/data/public'; import { ISearchSource as ISearchSource_2 } from 'src/plugins/data/public'; -import { isFilter } from '@kbn/es-query'; -import { isFilters } from '@kbn/es-query'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { IUiSettingsClient } from 'src/core/public'; import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; -import { KueryNode } from '@kbn/es-query'; +import { KueryNode as KueryNode_2 } from '@kbn/es-query'; import { Location } from 'history'; import { LocationDescriptorObject } from 'history'; import { Logger } from '@kbn/logging'; import { LogMeta } from '@kbn/logging'; -import { luceneStringToDsl } from '@kbn/es-query'; -import { MatchAllFilter } from '@kbn/es-query'; +import { MatchAllFilter as MatchAllFilter_2 } from '@kbn/es-query'; import { MaybePromise } from '@kbn/utility-types'; import { Moment } from 'moment'; import moment from 'moment'; @@ -82,8 +76,8 @@ import { Observable } from 'rxjs'; import { PackageInfo } from '@kbn/config'; import { Path } from 'history'; import { PeerCertificate } from 'tls'; -import { PhraseFilter } from '@kbn/es-query'; -import { PhrasesFilter } from '@kbn/es-query'; +import { PhraseFilter as PhraseFilter_2 } from '@kbn/es-query'; +import { PhrasesFilter as PhrasesFilter_2 } from '@kbn/es-query'; import { Plugin } from 'src/core/public'; import { PluginInitializerContext as PluginInitializerContext_2 } from 'src/core/public'; import { PluginInitializerContext as PluginInitializerContext_3 } from 'kibana/public'; @@ -92,10 +86,9 @@ import { PublicContract } from '@kbn/utility-types'; import { PublicMethodsOf } from '@kbn/utility-types'; import { PublicUiSettingsParams } from 'src/core/server/types'; import { Query } from '@kbn/es-query'; -import { RangeFilter } from '@kbn/es-query'; -import { RangeFilter as RangeFilter_2 } from 'src/plugins/data/public'; -import { RangeFilterMeta } from '@kbn/es-query'; -import { RangeFilterParams } from '@kbn/es-query'; +import { RangeFilter as RangeFilter_2 } from '@kbn/es-query'; +import { RangeFilterMeta as RangeFilterMeta_2 } from '@kbn/es-query'; +import { RangeFilterParams as RangeFilterParams_2 } from '@kbn/es-query'; import React from 'react'; import * as React_2 from 'react'; import { RecursiveReadonly } from '@kbn/utility-types'; @@ -282,7 +275,7 @@ export class AggConfigs { getResponseAggById(id: string): AggConfig | undefined; getResponseAggs(): AggConfig[]; // (undocumented) - getSearchSourceTimeFilter(forceNow?: Date): RangeFilter_2[] | { + getSearchSourceTimeFilter(forceNow?: Date): import("@kbn/es-query").RangeFilter[] | { meta: { index: string | undefined; params: {}; @@ -635,7 +628,10 @@ export const connectToQueryState: ({ timefilter: { timefil // @public (undocumented) export const createSavedQueryService: (savedObjectsClient: SavedObjectsClientContract) => SavedQueryService; -export { CustomFilter } +// Warning: (ae-missing-release-tag) "CustomFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type CustomFilter = CustomFilter_2; // Warning: (ae-forgotten-export) The symbol "DataSetupDependencies" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataStartDependencies" needs to be exported by the entry point index.d.ts @@ -819,23 +815,23 @@ export type EsdslExpressionFunctionDefinition = ExpressionFunctionDefinition JSX.Element; FilterItem: (props: import("./ui/filter_bar/filter_item").FilterItemProps) => JSX.Element; - FILTERS: typeof FILTERS; + FILTERS: typeof import("@kbn/es-query").FILTERS; FilterStateStore: typeof FilterStateStore; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; - buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../common").ExistsFilter; - buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../common").PhraseFilter; - buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").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("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - isRangeFilter: (filter: any) => filter is import("../common").RangeFilter; - isMatchAllFilter: (filter: any) => filter is import("../common").MatchAllFilter; - isMissingFilter: (filter: any) => filter is import("../common").MissingFilter; - isQueryStringFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - isFilterPinned: (filter: import("../common").Filter) => boolean | undefined; - toggleFilterNegated: (filter: import("../common").Filter) => { + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isPhraseFilter: (filter: any) => filter is import("@kbn/es-query").PhraseFilter; + isExistsFilter: (filter: any) => filter is import("@kbn/es-query").ExistsFilter; + isPhrasesFilter: (filter: any) => filter is import("@kbn/es-query").PhrasesFilter; + isRangeFilter: (filter: any) => filter is import("@kbn/es-query").RangeFilter; + isMatchAllFilter: (filter: any) => filter is import("@kbn/es-query").MatchAllFilter; + isMissingFilter: (filter: any) => filter is import("@kbn/es-query").MissingFilter; + isQueryStringFilter: (filter: any) => filter is import("@kbn/es-query").QueryStringFilter; + isFilterPinned: (filter: import("@kbn/es-query").Filter) => boolean | undefined; + toggleFilterNegated: (filter: import("@kbn/es-query").Filter) => { meta: { negate: boolean; alias: string | null; @@ -848,20 +844,20 @@ export const esFilters: { params?: any; value?: string | undefined; }; - $state?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/filters/types").FilterState | undefined; + $state?: import("@kbn/es-query/target_types/filters/types").FilterState | undefined; query?: any; }; - disableFilter: (filter: import("../common").Filter) => import("../common").Filter; - getPhraseFilterField: (filter: import("../common").PhraseFilter) => string; - getPhraseFilterValue: (filter: import("../common").PhraseFilter) => string | number | boolean; + disableFilter: (filter: import("@kbn/es-query").Filter) => import("@kbn/es-query").Filter; + getPhraseFilterField: (filter: import("@kbn/es-query").PhraseFilter) => string; + getPhraseFilterValue: (filter: import("@kbn/es-query").PhraseFilter) => string | number | boolean; getDisplayValueFromFilter: typeof getDisplayValueFromFilter; - compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; + compareFilters: (first: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], second: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions; generateFilters: typeof generateFilters; - onlyDisabledFiltersChanged: (newFilters?: import("../common").Filter[] | undefined, oldFilters?: import("../common").Filter[] | undefined) => boolean; + onlyDisabledFiltersChanged: (newFilters?: import("@kbn/es-query").Filter[] | undefined, oldFilters?: import("@kbn/es-query").Filter[] | undefined) => boolean; changeTimeFilter: typeof changeTimeFilter; convertRangeFilterToTimeRangeString: typeof convertRangeFilterToTimeRangeString; - mapAndFlattenFilters: (filters: import("../common").Filter[]) => import("../common").Filter[]; + mapAndFlattenFilters: (filters: import("@kbn/es-query").Filter[]) => import("@kbn/es-query").Filter[]; extractTimeFilter: typeof extractTimeFilter; extractTimeRange: typeof extractTimeRange; }; @@ -870,28 +866,31 @@ export const esFilters: { // // @public (undocumented) export const esKuery: { - nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../common").KueryNode; - toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; }; // Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const esQuery: { - buildEsQuery: typeof buildEsQuery; + buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; getEsQueryConfig: typeof getEsQueryConfig; - buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../common").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../common").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; - luceneStringToDsl: typeof luceneStringToDsl; - decorateQuery: typeof decorateQuery; + luceneStringToDsl: typeof import("@kbn/es-query").luceneStringToDsl; + decorateQuery: typeof import("@kbn/es-query").decorateQuery; }; -export { EsQueryConfig } +// Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type EsQueryConfig = EsQueryConfig_2; // Warning: (ae-forgotten-export) The symbol "SortDirectionNumeric" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SortDirectionFormat" needs to be exported by the entry point index.d.ts @@ -917,7 +916,10 @@ export type ExecutionContextSearch = { timeRange?: TimeRange; }; -export { ExistsFilter } +// Warning: (ae-missing-release-tag) "ExistsFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type ExistsFilter = ExistsFilter_2; // Warning: (ae-missing-release-tag) "exporters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1072,7 +1074,10 @@ export type FieldFormatsStart = Omit // @public (undocumented) export const fieldList: (specs?: FieldSpec[], shortDotsEnable?: boolean) => IIndexPatternFieldList; -export { Filter } +// Warning: (ae-missing-release-tag) "Filter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type Filter = Filter_2; // Warning: (ae-missing-release-tag) "FilterManager" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1080,15 +1085,15 @@ export { Filter } export class FilterManager { constructor(uiSettings: IUiSettingsClient); // (undocumented) - addFilters(filters: Filter[] | Filter, pinFilterStatus?: boolean): void; + addFilters(filters: Filter_2[] | Filter_2, pinFilterStatus?: boolean): void; // (undocumented) - getAppFilters(): Filter[]; + getAppFilters(): Filter_2[]; // (undocumented) getFetches$(): import("rxjs").Observable; // (undocumented) - getFilters(): Filter[]; + getFilters(): Filter_2[]; // (undocumented) - getGlobalFilters(): Filter[]; + getGlobalFilters(): Filter_2[]; // Warning: (ae-forgotten-export) The symbol "PartitionedFilters" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -1098,13 +1103,13 @@ export class FilterManager { // (undocumented) removeAll(): void; // (undocumented) - removeFilter(filter: Filter): void; - setAppFilters(newAppFilters: Filter[]): void; + removeFilter(filter: Filter_2): void; + setAppFilters(newAppFilters: Filter_2[]): void; // (undocumented) - setFilters(newFilters: Filter[], pinFilterStatus?: boolean): void; + setFilters(newFilters: Filter_2[], pinFilterStatus?: boolean): void; // (undocumented) - static setFiltersStore(filters: Filter[], store: FilterStateStore, shouldOverrideStore?: boolean): void; - setGlobalFilters(newGlobalFilters: Filter[]): void; + static setFiltersStore(filters: Filter_2[], store: FilterStateStore, shouldOverrideStore?: boolean): void; + setGlobalFilters(newGlobalFilters: Filter_2[]): void; } // Warning: (ae-forgotten-export) The symbol "QueryLanguage" needs to be exported by the entry point index.d.ts @@ -1141,7 +1146,7 @@ export function getSearchParamsFromRequest(searchRequest: SearchRequest, depende export function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("../..").RangeFilter | undefined; +}): import("@kbn/es-query").RangeFilter | undefined; // Warning: (ae-missing-release-tag) "IAggConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1217,7 +1222,10 @@ export type IFieldFormatsRegistry = PublicMethodsOf; // @public (undocumented) export type IFieldParamType = FieldParamType; -export { IFieldSubType } +// Warning: (ae-missing-release-tag) "IFieldSubType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type IFieldSubType = IFieldSubType_2; // Warning: (ae-missing-release-tag) "IFieldType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1528,7 +1536,7 @@ export class IndexPatternField implements IFieldType { // (undocumented) readonly spec: FieldSpec; // (undocumented) - get subType(): import("../../../public").IFieldSubType | undefined; + get subType(): import("@kbn/es-query").IFieldSubType | undefined; // (undocumented) toJSON(): { count: number; @@ -1542,7 +1550,7 @@ export class IndexPatternField implements IFieldType { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../../../public").IFieldSubType | undefined; + subType: import("@kbn/es-query").IFieldSubType | undefined; customLabel: string | undefined; }; // (undocumented) @@ -1785,9 +1793,15 @@ export type ISessionsClient = PublicContract; // @public (undocumented) export type ISessionService = PublicContract; -export { isFilter } +// Warning: (ae-missing-release-tag) "isFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export const isFilter: (x: unknown) => x is Filter_2; -export { isFilters } +// Warning: (ae-missing-release-tag) "isFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export const isFilters: (x: unknown) => x is Filter_2[]; // Warning: (ae-missing-release-tag) "isPartialResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1851,9 +1865,15 @@ export enum KBN_FIELD_TYPES { // @public (undocumented) export type KibanaContext = ExpressionValueSearchContext; -export { KueryNode } +// Warning: (ae-missing-release-tag) "KueryNode" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type KueryNode = KueryNode_2; -export { MatchAllFilter } +// Warning: (ae-missing-release-tag) "MatchAllFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type MatchAllFilter = MatchAllFilter_2; // Warning: (ae-missing-release-tag) "METRIC_TYPES" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1960,9 +1980,15 @@ export type ParsedInterval = ReturnType; // @public (undocumented) export const parseSearchSourceJSON: (searchSourceJSON: string) => SearchSourceFields; -export { PhraseFilter } +// Warning: (ae-missing-release-tag) "PhraseFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type PhraseFilter = PhraseFilter_2; -export { PhrasesFilter } +// Warning: (ae-missing-release-tag) "PhrasesFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type PhrasesFilter = PhrasesFilter_2; // Warning: (ae-forgotten-export) The symbol "PluginInitializerContext" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "plugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -2136,11 +2162,20 @@ export enum QuerySuggestionTypes { Value = "value" } -export { RangeFilter } +// Warning: (ae-missing-release-tag) "RangeFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type RangeFilter = RangeFilter_2; -export { RangeFilterMeta } +// Warning: (ae-missing-release-tag) "RangeFilterMeta" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type RangeFilterMeta = RangeFilterMeta_2; -export { RangeFilterParams } +// Warning: (ae-missing-release-tag) "RangeFilterParams" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type RangeFilterParams = RangeFilterParams_2; // Warning: (ae-missing-release-tag) "Reason" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -2422,8 +2457,6 @@ export interface SearchSourceFields { fields?: SearchFieldValue[]; // @deprecated fieldsFromSource?: NameList; - // Warning: (ae-unresolved-link) The @link reference could not be resolved: Reexported declarations are not supported - // // (undocumented) filter?: Filter[] | Filter | (() => Filter[] | Filter | undefined); // (undocumented) @@ -2634,12 +2667,12 @@ export interface WaitUntilNextSessionCompletesOptions { // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:169:7 - (ae-forgotten-export) The symbol "RuntimeField" needs to be exported by the entry point index.d.ts // src/plugins/data/common/search/aggs/types.ts:129:51 - (ae-forgotten-export) The symbol "AggTypesRegistryStart" needs to be exported by the entry point index.d.ts // src/plugins/data/public/field_formats/field_formats_service.ts:56:3 - (ae-forgotten-export) The symbol "FormatFactory" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "getDisplayValueFromFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "generateFilters" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "changeTimeFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "convertRangeFilterToTimeRangeString" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:64:23 - (ae-forgotten-export) The symbol "extractTimeRange" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "getDisplayValueFromFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "generateFilters" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "changeTimeFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "convertRangeFilterToTimeRangeString" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "extractTimeRange" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:132:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index c3fafb18b61958..eab2458e463d9c 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -21,15 +21,15 @@ import { toElasticsearchQuery, buildEsQuery, buildQueryFromFilters, -} from '@kbn/es-query'; +} from '../common'; import { PluginConfigDescriptor, PluginInitializerContext } from '../../../core/server'; import { ConfigSchema, configSchema } from '../config'; import { DataServerPlugin, DataPluginSetup, DataPluginStart } from './plugin'; /* + * @deprecated Please import from the package kbn/es-query directly. This will be deprecated in v8.0.0. * Filter helper namespace: */ - export const esFilters = { buildQueryFilter, buildCustomFilter, @@ -58,19 +58,27 @@ export const exporters = { import { getEsQueryConfig } from '../common'; +/* + * @deprecated Please import from the package kbn/es-query directly. This will be deprecated in v8.0.0. + * Filter helper namespace: + */ export const esKuery = { nodeTypes, fromKueryExpression, toElasticsearchQuery, }; +/* + * @deprecated Please import from the package kbn/es-query directly. This will be deprecated in v8.0.0. + * Filter helper namespace: + */ export const esQuery = { buildQueryFromFilters, getEsQueryConfig, buildEsQuery, }; -export type { EsQueryConfig, KueryNode, IFieldSubType } from '@kbn/es-query'; +export type { EsQueryConfig, KueryNode, IFieldSubType } from '../common'; /* * Field Formats: diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 1771994dfe9209..c7dd84b60d6247 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -8,9 +8,6 @@ import { $Values } from '@kbn/utility-types'; import { Adapters } from 'src/plugins/inspector/common'; import { Assign } from '@kbn/utility-types'; import { BfetchServerSetup } from 'src/plugins/bfetch/server'; -import { buildCustomFilter } from '@kbn/es-query'; -import { buildEsQuery } from '@kbn/es-query'; -import { buildFilter } from '@kbn/es-query'; import { ConfigDeprecationProvider } from '@kbn/config'; import { CoreSetup } from 'src/core/server'; import { CoreSetup as CoreSetup_2 } from 'kibana/server'; @@ -26,7 +23,7 @@ import { ElasticsearchClient as ElasticsearchClient_2 } from 'kibana/server'; import { Ensure } from '@kbn/utility-types'; import { EnvironmentMode } from '@kbn/config'; import { ErrorToastOptions } from 'src/core/public/notifications'; -import { EsQueryConfig } from '@kbn/es-query'; +import { EsQueryConfig as EsQueryConfig_2 } from '@kbn/es-query'; import { estypes } from '@elastic/elasticsearch'; import { EventEmitter } from 'events'; import { ExecutionContext } from 'src/plugins/expressions/common'; @@ -34,11 +31,11 @@ import { ExpressionAstExpression } from 'src/plugins/expressions/common'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { ExpressionsServerSetup } from 'src/plugins/expressions/server'; import { ExpressionValueBoxed } from 'src/plugins/expressions/common'; -import { Filter } from '@kbn/es-query'; +import { Filter as Filter_2 } from '@kbn/es-query'; import { FormatFactory as FormatFactory_2 } from 'src/plugins/data/common/field_formats/utils'; import { IAggConfigs as IAggConfigs_2 } from 'src/plugins/data/public'; import { IEsSearchResponse as IEsSearchResponse_2 } from 'src/plugins/data/public'; -import { IFieldSubType } from '@kbn/es-query'; +import { IFieldSubType as IFieldSubType_2 } from '@kbn/es-query'; import { IndexPatternBase } from '@kbn/es-query'; import { IndexPatternFieldBase } from '@kbn/es-query'; import { IScopedClusterClient } from 'src/core/server'; @@ -48,7 +45,7 @@ import { IUiSettingsClient } from 'src/core/server'; import { IUiSettingsClient as IUiSettingsClient_3 } from 'kibana/server'; import { KibanaRequest } from 'src/core/server'; import { KibanaRequest as KibanaRequest_2 } from 'kibana/server'; -import { KueryNode } from '@kbn/es-query'; +import { KueryNode as KueryNode_2 } from '@kbn/es-query'; import { Logger } from 'src/core/server'; import { Logger as Logger_2 } from 'kibana/server'; import { LoggerFactory } from '@kbn/logging'; @@ -63,7 +60,6 @@ import { Plugin as Plugin_3 } from 'kibana/server'; import { PluginInitializerContext as PluginInitializerContext_2 } from 'src/core/server'; import { PublicMethodsOf } from '@kbn/utility-types'; import { Query } from '@kbn/es-query'; -import { RangeFilter } from 'src/plugins/data/public'; import { RecursiveReadonly } from '@kbn/utility-types'; import { RequestAdapter } from 'src/plugins/inspector/common'; import { RequestHandlerContext } from 'src/core/server'; @@ -453,41 +449,44 @@ export type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<'e // // @public (undocumented) export const esFilters: { - buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - buildCustomFilter: typeof buildCustomFilter; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; - buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../common").ExistsFilter; - buildFilter: typeof buildFilter; - buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../common").PhraseFilter; - buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter; - isFilterDisabled: (filter: import("../common").Filter) => boolean; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; + buildCustomFilter: typeof import("@kbn/es-query").buildCustomFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; + buildFilter: typeof import("@kbn/es-query").buildFilter; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isFilterDisabled: (filter: import("@kbn/es-query").Filter) => boolean; }; // Warning: (ae-missing-release-tag) "esKuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const esKuery: { - nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../common").KueryNode; - toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; }; // Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const esQuery: { - buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../common").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../common").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; getEsQueryConfig: typeof getEsQueryConfig; - buildEsQuery: typeof buildEsQuery; + buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; }; -export { EsQueryConfig } +// Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type EsQueryConfig = EsQueryConfig_2; // Warning: (ae-missing-release-tag) "ExecutionContextSearch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -590,7 +589,10 @@ export const fieldFormats: { // @public (undocumented) export type FieldFormatsGetConfigFn = GetConfigFn; -export { Filter } +// Warning: (ae-missing-release-tag) "Filter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type Filter = Filter_2; // Warning: (ae-missing-release-tag) "getCapabilitiesForRollupIndices" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -618,7 +620,7 @@ export function getShardTimeout(config: SharedGlobalConfig_2): Pick): { @@ -669,7 +671,10 @@ export type IFieldFormatsRegistry = PublicMethodsOf; // @public (undocumented) export type IFieldParamType = FieldParamType; -export { IFieldSubType } +// Warning: (ae-missing-release-tag) "IFieldSubType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type IFieldSubType = IFieldSubType_2; // Warning: (ae-missing-release-tag) "IFieldType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1103,7 +1108,10 @@ export enum KBN_FIELD_TYPES { // @public (undocumented) export type KibanaContext = ExpressionValueSearchContext; -export { KueryNode } +// Warning: (ae-missing-release-tag) "KueryNode" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated (undocumented) +export type KueryNode = KueryNode_2; // Warning: (ae-missing-release-tag) "mergeCapabilitiesWithFields" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1474,37 +1482,37 @@ export function usageProvider(core: CoreSetup_2): SearchUsage; // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:138:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:169:7 - (ae-forgotten-export) The symbol "RuntimeField" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:50:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:67:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:98:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:130:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:130:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:246:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:246:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:248:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:249:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:258:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:259:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:260:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:264:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:265:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:269:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:272:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:273:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:75:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:142:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:142:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:258:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:258:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:260:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:261:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:270:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:271:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:272:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:276:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:277:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:281:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:284:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:285:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts // src/plugins/data/server/plugin.ts:81:74 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts // src/plugins/data/server/search/types.ts:115:5 - (ae-forgotten-export) The symbol "ISearchStartSearchSource" needs to be exported by the entry point index.d.ts diff --git a/x-pack/plugins/timelines/common/types/timeline/columns/index.ts b/x-pack/plugins/timelines/common/types/timeline/columns/index.ts index 61f0c6a0b8f23a..9161ea3ea78ce4 100644 --- a/x-pack/plugins/timelines/common/types/timeline/columns/index.ts +++ b/x-pack/plugins/timelines/common/types/timeline/columns/index.ts @@ -6,8 +6,7 @@ */ import { EuiDataGridColumn } from '@elastic/eui'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { IFieldSubType } from '../../../../../../../src/plugins/data/public'; +import { IFieldSubType } from '../../../../../../../src/plugins/data/common'; import { TimelineNonEcsData } from '../../../search_strategy/timeline'; export type ColumnHeaderType = 'not-filtered' | 'text-filter'; From 5595d71407084e440fbafee16d5e0982881f6842 Mon Sep 17 00:00:00 2001 From: Liza K Date: Thu, 15 Jul 2021 12:17:40 +0200 Subject: [PATCH 39/52] docs --- ...plugin-plugins-data-public.customfilter.md | 2 +- ...bana-plugin-plugins-data-public.eskuery.md | 5 ++ ...bana-plugin-plugins-data-public.esquery.md | 5 ++ ...lugin-plugins-data-public.esqueryconfig.md | 2 +- ...plugin-plugins-data-public.existsfilter.md | 2 +- ...ibana-plugin-plugins-data-public.filter.md | 2 +- ...lugin-plugins-data-public.ifieldsubtype.md | 2 +- ...ana-plugin-plugins-data-public.isfilter.md | 2 +- ...na-plugin-plugins-data-public.isfilters.md | 2 +- ...na-plugin-plugins-data-public.kuerynode.md | 2 +- ...ugin-plugins-data-public.matchallfilter.md | 2 +- ...plugin-plugins-data-public.phrasefilter.md | 2 +- ...lugin-plugins-data-public.phrasesfilter.md | 2 +- ...-plugin-plugins-data-public.rangefilter.md | 2 +- ...gin-plugins-data-public.rangefiltermeta.md | 2 +- ...n-plugins-data-public.rangefilterparams.md | 2 +- ...lugin-plugins-data-server.esqueryconfig.md | 2 +- ...ibana-plugin-plugins-data-server.filter.md | 2 +- ...lugin-plugins-data-server.ifieldsubtype.md | 2 +- ...na-plugin-plugins-data-server.kuerynode.md | 2 +- src/plugins/data/common/es_query/index.ts | 1 - src/plugins/data/public/index.ts | 6 ++ src/plugins/data/public/public.api.md | 76 +++++++++---------- src/plugins/data/server/index.ts | 4 +- src/plugins/data/server/server.api.md | 60 +++++++-------- 25 files changed, 104 insertions(+), 89 deletions(-) diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md index d986ad634d0c67..94cfa33943ed30 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md index 9debef0e596f1d..a17e350c516d5d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md @@ -4,6 +4,11 @@ ## esKuery variable +> Warning: This API is now obsolete. +> +> Please import helpers from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> + Signature: ```typescript diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md index 4261fae07c951a..43bcb7e0cc0e34 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md @@ -4,6 +4,11 @@ ## esQuery variable +> Warning: This API is now obsolete. +> +> Please import helpers from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> + Signature: ```typescript diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md index d9ae1c5be5e744..dbc04dc383ef9c 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md index d2d59fa2de0583..b4bcabb6b447ee 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md index 4447cb2ec96f0e..63d8f985aae2d3 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md index 218395792b5a48..fc69ce5934ee58 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md index 4869ed7d1e5afc..bb95eb8935fff4 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md index 22165fd061f774..3d3735cdb3c54f 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md index 76c3c9efd35146..4b1dfb99be0c95 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md index 56ab10571a7c04..9898b8b7c75b79 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md index d37c5a0649d217..a22f12aedb5cbc 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md index 2984749ce47b4b..14b36e153f0f15 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md index 5dfaefaa818a2e..cfacc96034fe3c 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md index bd148b3941ef76..4927ac016173e9 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md index 6bfa013079293a..0b7d6cf060775d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md index 1b9bc2181d52db..9bacd138bafeba 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md index bdd2cc3c11642c..020fa4d80d512b 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md index b758e8fcca6443..26637c5a892fd3 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md index 428fc2470e8529..807b1225a728cf 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from @kbn/es-query directly. This will be deprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. > Signature: diff --git a/src/plugins/data/common/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index a99db2071f8ca2..34367601cd61ce 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -66,7 +66,6 @@ import { /** * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. */ - const isFilter = oldIsFilter; /** * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index e02576b8bb5f8e..7a2e55d3b43d72 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -123,12 +123,18 @@ export { import { getEsQueryConfig } from '../common'; +/** + * @deprecated Please import helpers from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ export const esKuery = { nodeTypes, fromKueryExpression, toElasticsearchQuery, }; +/** + * @deprecated Please import helpers from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + */ export const esQuery = { buildEsQuery, getEsQueryConfig, diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index d634d4db0fb141..dc42d864420779 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -864,7 +864,7 @@ export const esFilters: { // Warning: (ae-missing-release-tag) "esKuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // -// @public (undocumented) +// @public @deprecated (undocumented) export const esKuery: { nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; @@ -873,7 +873,7 @@ export const esKuery: { // Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // -// @public (undocumented) +// @public @deprecated (undocumented) export const esQuery: { buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; getEsQueryConfig: typeof getEsQueryConfig; @@ -2673,42 +2673,42 @@ export interface WaitUntilNextSessionCompletesOptions { // src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "convertRangeFilterToTimeRangeString" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "extractTimeRange" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:132:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:171:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:214:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:239:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:239:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:239:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:239:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:239:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:410:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:410:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:410:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:412:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:413:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:422:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:423:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:424:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:425:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:429:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:430:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:433:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:434:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:437:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:139:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:221:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:246:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:246:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:246:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:246:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:246:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:417:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:417:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:417:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:419:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:420:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:429:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:430:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:431:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:432:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:436:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:437:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:440:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:441:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:444:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // src/plugins/data/public/search/session/session_service.ts:62:5 - (ae-forgotten-export) The symbol "UrlGeneratorStateMapping" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index eab2458e463d9c..a9e8cda0823148 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -59,8 +59,8 @@ export const exporters = { import { getEsQueryConfig } from '../common'; /* + * Filter helper namespace * @deprecated Please import from the package kbn/es-query directly. This will be deprecated in v8.0.0. - * Filter helper namespace: */ export const esKuery = { nodeTypes, @@ -69,8 +69,8 @@ export const esKuery = { }; /* + * Filter helper namespace * @deprecated Please import from the package kbn/es-query directly. This will be deprecated in v8.0.0. - * Filter helper namespace: */ export const esQuery = { buildQueryFromFilters, diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index c7dd84b60d6247..63b50c2d0e42d3 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -1483,36 +1483,36 @@ export function usageProvider(core: CoreSetup_2): SearchUsage; // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:169:7 - (ae-forgotten-export) The symbol "RuntimeField" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:50:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:75:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:110:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:142:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:142:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:258:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:258:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:260:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:261:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:270:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:271:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:272:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:276:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:277:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:281:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:284:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:285:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:106:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:138:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:138:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:254:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:254:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:256:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:257:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:266:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:267:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:268:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:272:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:273:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:277:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:280:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:281:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts // src/plugins/data/server/plugin.ts:81:74 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts // src/plugins/data/server/search/types.ts:115:5 - (ae-forgotten-export) The symbol "ISearchStartSearchSource" needs to be exported by the entry point index.d.ts From b6e9920c1795a9ecff9e9d6848747b3a77f3f20d Mon Sep 17 00:00:00 2001 From: Liza K Date: Thu, 15 Jul 2021 12:19:21 +0200 Subject: [PATCH 40/52] typo --- ...plugin-plugins-data-public.customfilter.md | 2 +- ...bana-plugin-plugins-data-public.eskuery.md | 2 +- ...bana-plugin-plugins-data-public.esquery.md | 2 +- ...lugin-plugins-data-public.esqueryconfig.md | 2 +- ...plugin-plugins-data-public.existsfilter.md | 2 +- ...ibana-plugin-plugins-data-public.filter.md | 2 +- ...lugin-plugins-data-public.ifieldsubtype.md | 2 +- ...ana-plugin-plugins-data-public.isfilter.md | 2 +- ...na-plugin-plugins-data-public.isfilters.md | 2 +- ...na-plugin-plugins-data-public.kuerynode.md | 2 +- ...ugin-plugins-data-public.matchallfilter.md | 2 +- ...plugin-plugins-data-public.phrasefilter.md | 2 +- ...lugin-plugins-data-public.phrasesfilter.md | 2 +- ...-plugin-plugins-data-public.rangefilter.md | 2 +- ...gin-plugins-data-public.rangefiltermeta.md | 2 +- ...n-plugins-data-public.rangefilterparams.md | 2 +- src/plugins/data/common/es_query/index.ts | 102 +++++++++--------- src/plugins/data/public/index.ts | 4 +- src/plugins/data/public/public.api.md | 72 ++++++------- 19 files changed, 105 insertions(+), 105 deletions(-) diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md index 94cfa33943ed30..6763a8d2ba0bf4 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md index a17e350c516d5d..6ed9898ddd7187 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import helpers from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import helpers from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md index 43bcb7e0cc0e34..fa2ee4faa74665 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import helpers from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import helpers from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md index dbc04dc383ef9c..4480329c2df192 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md index b4bcabb6b447ee..ab756295eac8c3 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md index 63d8f985aae2d3..bf8d4ced016a3e 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md index fc69ce5934ee58..d5d8a0b62d3c5b 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md index bb95eb8935fff4..2848e20edde1be 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md index 3d3735cdb3c54f..881d50b8a49e1a 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md index 4b1dfb99be0c95..9cea144ff9d46a 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md index 9898b8b7c75b79..39ae82865808c4 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md index a22f12aedb5cbc..ca38ac25dcf507 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md index 14b36e153f0f15..0c293cb909276b 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md index cfacc96034fe3c..3d9af100a707a8 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md index 4927ac016173e9..4060a71e62cd0a 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md index 0b7d6cf060775d..cdf237ea5a1ec0 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/src/plugins/data/common/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index 34367601cd61ce..6d5084900b11d1 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -64,248 +64,248 @@ import { } from '@kbn/es-query'; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isFilter = oldIsFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isFilterDisabled = oldIsFilterDisabled; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const disableFilter = oldDisableFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const fromKueryExpression = oldFromKueryExpression; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const toElasticsearchQuery = oldToElasticsearchQuery; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const nodeTypes = oldNodeTypes; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const buildEsQuery = oldBuildEsQuery; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const buildQueryFromFilters = oldBuildQueryFromFilters; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const luceneStringToDsl = oldLuceneStringToDsl; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const decorateQuery = olddecorateQuery; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const getPhraseFilterField = oldgetPhraseFilterField; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const getPhraseFilterValue = oldgetPhraseFilterValue; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isFilterPinned = oldIsFilterPinned; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const nodeBuilder = oldNodeBuilder; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isFilters = oldIsFilters; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isExistsFilter = oldIsExistsFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isMatchAllFilter = oldIsMatchAllFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isGeoBoundingBoxFilter = oldIsGeoBoundingBoxFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isGeoPolygonFilter = oldIsGeoPolygonFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isMissingFilter = oldIsMissingFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isPhraseFilter = oldIsPhraseFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isPhrasesFilter = oldIsPhrasesFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isRangeFilter = oldIsRangeFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const isQueryStringFilter = oldIsQueryStringFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const buildQueryFilter = oldBuildQueryFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const buildPhrasesFilter = oldBuildPhrasesFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const buildPhraseFilter = oldBuildPhraseFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const buildRangeFilter = oldBuildRangeFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const buildCustomFilter = oldBuildCustomFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const buildFilter = oldBuildFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const buildEmptyFilter = oldBuildEmptyFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const buildExistsFilter = oldBuildExistsFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const toggleFilterNegated = oldtoggleFilterNegated; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ const FILTERS = oldFILTERS; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type Filter = oldFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type RangeFilterMeta = oldRangeFilterMeta; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type RangeFilterParams = oldRangeFilterParams; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type ExistsFilter = oldExistsFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type GeoPolygonFilter = oldGeoPolygonFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type PhrasesFilter = oldPhrasesFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type PhraseFilter = oldPhraseFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type MatchAllFilter = oldMatchAllFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type CustomFilter = oldCustomFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type MissingFilter = oldMissingFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type RangeFilter = oldRangeFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type GeoBoundingBoxFilter = oldGeoBoundingBoxFilter; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type KueryNode = oldKueryNode; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type FilterMeta = oldFilterMeta; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type IFieldSubType = oldIFieldSubType; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ type EsQueryConfig = oldEsQueryConfig; /** - * @deprecated Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ export { diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 7a2e55d3b43d72..3800ca10308512 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -124,7 +124,7 @@ export { import { getEsQueryConfig } from '../common'; /** - * @deprecated Please import helpers from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import helpers from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ export const esKuery = { nodeTypes, @@ -133,7 +133,7 @@ export const esKuery = { }; /** - * @deprecated Please import helpers from the package kbn/es-query directly. This import will be eprecated in v8.0.0. + * @deprecated Please import helpers from the package kbn/es-query directly. This import will be deprecated in v8.0.0. */ export const esQuery = { buildEsQuery, diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index dc42d864420779..c8f2c9e14de2ad 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -2673,42 +2673,42 @@ export interface WaitUntilNextSessionCompletesOptions { // src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "convertRangeFilterToTimeRangeString" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "extractTimeRange" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:139:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:221:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:246:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:246:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:246:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:246:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:246:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:417:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:417:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:417:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:419:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:420:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:429:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:430:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:431:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:432:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:436:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:437:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:440:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:441:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:444:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:138:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:220:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:245:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:245:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:245:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:245:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:245:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:416:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:416:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:416:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:418:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:419:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:428:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:429:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:430:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:431:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:435:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:436:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:439:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:440:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:443:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // src/plugins/data/public/search/session/session_service.ts:62:5 - (ae-forgotten-export) The symbol "UrlGeneratorStateMapping" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) From b20dfbfa34f2d5e61fdbc70793a26182eeae53ce Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 19 Jul 2021 17:27:02 +0200 Subject: [PATCH 41/52] update preggy, format error --- package.json | 6 +- .../src/kuery/grammar/__mocks__/grammar.js | 1181 ++++++++--------- .../src/kuery/kuery_syntax_error.ts | 18 +- .../service/lib/repository.test.js | 1 + .../common/query/persistable_state.test.ts | 2 +- yarn.lock | 8 +- 6 files changed, 580 insertions(+), 636 deletions(-) diff --git a/package.json b/package.json index 6970c319d01907..1b9747bcae4848 100644 --- a/package.json +++ b/package.json @@ -128,10 +128,10 @@ "@kbn/apm-config-loader": "link:bazel-bin/packages/kbn-apm-config-loader", "@kbn/apm-utils": "link:bazel-bin/packages/kbn-apm-utils", "@kbn/common-utils": "link:bazel-bin/packages/kbn-common-utils", - "@kbn/es-query": "link:bazel-bin/packages/kbn-es-query", "@kbn/config": "link:bazel-bin/packages/kbn-config", "@kbn/config-schema": "link:bazel-bin/packages/kbn-config-schema", "@kbn/crypto": "link:bazel-bin/packages/kbn-crypto", + "@kbn/es-query": "link:bazel-bin/packages/kbn-es-query", "@kbn/i18n": "link:bazel-bin/packages/kbn-i18n", "@kbn/interpreter": "link:bazel-bin/packages/kbn-interpreter", "@kbn/io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils", @@ -154,9 +154,9 @@ "@kbn/securitysolution-utils": "link:bazel-bin/packages/kbn-securitysolution-utils", "@kbn/server-http-tools": "link:bazel-bin/packages/kbn-server-http-tools", "@kbn/server-route-repository": "link:bazel-bin/packages/kbn-server-route-repository", - "@kbn/typed-react-router-config": "link:bazel-bin/packages/kbn-typed-react-router-config", "@kbn/std": "link:bazel-bin/packages/kbn-std", "@kbn/tinymath": "link:bazel-bin/packages/kbn-tinymath", + "@kbn/typed-react-router-config": "link:bazel-bin/packages/kbn-typed-react-router-config", "@kbn/ui-framework": "link:bazel-bin/packages/kbn-ui-framework", "@kbn/ui-shared-deps": "link:bazel-bin/packages/kbn-ui-shared-deps", "@kbn/utility-types": "link:bazel-bin/packages/kbn-utility-types", @@ -322,7 +322,7 @@ "p-retry": "^4.2.0", "papaparse": "^5.2.0", "pdfmake": "^0.1.65", - "peggy": "^1.0.0", + "peggy": "^1.2.0", "pegjs": "0.10.0", "pluralize": "3.1.0", "pngjs": "^3.4.0", diff --git a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js index 4f3667b7373c27..3a7759655c47ef 100644 --- a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js +++ b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js @@ -6,10 +6,9 @@ * Side Public License, v 1. */ -// Generated by Peggy 0.11.0. +// Generated by Peggy 1.2.0. // -// https://github.com/peggyjs/peggy - +// https://peggyjs.org/ /* eslint-disable */ "use strict"; @@ -21,19 +20,57 @@ function peg$subclass(child, parent) { } function peg$SyntaxError(message, expected, found, location) { - this.message = message; - this.expected = expected; - this.found = found; - this.location = location; - this.name = "SyntaxError"; - - if (typeof Error.captureStackTrace === "function") { - Error.captureStackTrace(this, peg$SyntaxError); + var self = Error.call(this, message); + if (Object.setPrototypeOf) { + Object.setPrototypeOf(self, peg$SyntaxError.prototype); } + self.expected = expected; + self.found = found; + self.location = location; + self.name = "SyntaxError"; + return self; } peg$subclass(peg$SyntaxError, Error); +function peg$padEnd(str, targetLength, padString) { + padString = padString || " "; + if (str.length > targetLength) { return str; } + targetLength -= str.length; + padString += padString.repeat(targetLength); + return str + padString.slice(0, targetLength); +} + +peg$SyntaxError.prototype.format = function(sources) { + var str = "Error: " + this.message; + if (this.location) { + var src = null; + var k; + for (k = 0; k < sources.length; k++) { + if (sources[k].source === this.location.source) { + src = sources[k].text.split(/\r\n|\n|\r/g); + break; + } + } + var s = this.location.start; + var loc = this.location.source + ":" + s.line + ":" + s.column; + if (src) { + var e = this.location.end; + var filler = peg$padEnd("", s.line.toString().length); + var line = src[s.line - 1]; + var last = s.line === e.line ? e.column : line.length + 1; + str += "\n --> " + loc + "\n" + + filler + " |\n" + + s.line + " | " + line + "\n" + + filler + " | " + peg$padEnd("", s.column - 1) + + peg$padEnd("", last - s.column, "^"); + } else { + str += "\n at " + loc; + } + } + return str; +}; + peg$SyntaxError.buildMessage = function(expected, found) { var DESCRIBE_EXPECTATION_FNS = { literal: function(expectation) { @@ -138,246 +175,250 @@ function peg$parse(input, options) { options = options !== undefined ? options : {}; var peg$FAILED = {}; + var peg$source = options.grammarSource; - var peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral }; + var peg$startRuleFunctions = { start: peg$parsestart }; var peg$startRuleFunction = peg$parsestart; - var peg$c0 = function(query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - if (query !== null) return query; - return nodeTypes.function.buildNode('is', '*', '*'); - }; - var peg$c1 = function(head, query) { return query; }; - var peg$c2 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('or', nodes); - }; - var peg$c3 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) return cursor; - return buildFunctionNode('and', nodes); - }; - var peg$c4 = function(query) { - if (query.type === 'cursor') return query; - return buildFunctionNode('not', [query]); - }; - var peg$c5 = "("; - var peg$c6 = peg$literalExpectation("(", false); - var peg$c7 = ")"; - var peg$c8 = peg$literalExpectation(")", false); - var peg$c9 = function(query, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return query; - }; - var peg$c10 = ":"; - var peg$c11 = peg$literalExpectation(":", false); - var peg$c12 = "{"; - var peg$c13 = peg$literalExpectation("{", false); - var peg$c14 = "}"; - var peg$c15 = peg$literalExpectation("}", false); - var peg$c16 = function(field, query, trailing) { - if (query.type === 'cursor') { - return { - ...query, - nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, - } + var peg$c0 = "("; + var peg$c1 = ")"; + var peg$c2 = ":"; + var peg$c3 = "{"; + var peg$c4 = "}"; + var peg$c5 = "or"; + var peg$c6 = "and"; + var peg$c7 = "not"; + var peg$c8 = "\""; + var peg$c9 = "\\"; + var peg$c10 = "*"; + var peg$c11 = "\\t"; + var peg$c12 = "\\r"; + var peg$c13 = "\\n"; + var peg$c14 = "u"; + var peg$c15 = "<="; + var peg$c16 = ">="; + var peg$c17 = "<"; + var peg$c18 = ">"; + var peg$c19 = "@kuery-cursor@"; + + var peg$r0 = /^[\\"]/; + var peg$r1 = /^[^"]/; + var peg$r2 = /^[\\():<>"*{}]/; + var peg$r3 = /^[0-9a-f]/i; + var peg$r4 = /^[ \t\r\n\xA0]/; + + var peg$e0 = peg$literalExpectation("(", false); + var peg$e1 = peg$literalExpectation(")", false); + var peg$e2 = peg$literalExpectation(":", false); + var peg$e3 = peg$literalExpectation("{", false); + var peg$e4 = peg$literalExpectation("}", false); + var peg$e5 = peg$otherExpectation("fieldName"); + var peg$e6 = peg$otherExpectation("value"); + var peg$e7 = peg$otherExpectation("OR"); + var peg$e8 = peg$literalExpectation("or", true); + var peg$e9 = peg$otherExpectation("AND"); + var peg$e10 = peg$literalExpectation("and", true); + var peg$e11 = peg$otherExpectation("NOT"); + var peg$e12 = peg$literalExpectation("not", true); + var peg$e13 = peg$otherExpectation("literal"); + var peg$e14 = peg$literalExpectation("\"", false); + var peg$e15 = peg$literalExpectation("\\", false); + var peg$e16 = peg$classExpectation(["\\", "\""], false, false); + var peg$e17 = peg$classExpectation(["\""], true, false); + var peg$e18 = peg$anyExpectation(); + var peg$e19 = peg$literalExpectation("*", false); + var peg$e20 = peg$literalExpectation("\\t", false); + var peg$e21 = peg$literalExpectation("\\r", false); + var peg$e22 = peg$literalExpectation("\\n", false); + var peg$e23 = peg$classExpectation(["\\", "(", ")", ":", "<", ">", "\"", "*", "{", "}"], false, false); + var peg$e24 = peg$literalExpectation("u", false); + var peg$e25 = peg$classExpectation([["0", "9"], ["a", "f"]], false, true); + var peg$e26 = peg$literalExpectation("<=", false); + var peg$e27 = peg$literalExpectation(">=", false); + var peg$e28 = peg$literalExpectation("<", false); + var peg$e29 = peg$literalExpectation(">", false); + var peg$e30 = peg$otherExpectation("whitespace"); + var peg$e31 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); + var peg$e32 = peg$literalExpectation("@kuery-cursor@", false); + + var peg$f0 = function(query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + if (query !== null) return query; + return nodeTypes.function.buildNode('is', '*', '*'); + }; + var peg$f1 = function(head, query) { return query; }; + var peg$f2 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('or', nodes); + }; + var peg$f3 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) return cursor; + return buildFunctionNode('and', nodes); + }; + var peg$f4 = function(query) { + if (query.type === 'cursor') return query; + return buildFunctionNode('not', [query]); }; + var peg$f5 = function(query, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + return query; + }; + var peg$f6 = function(field, query, trailing) { + if (query.type === 'cursor') { + return { + ...query, + nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value, + } + }; - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return buildFunctionNode('nested', [field, query]); - }; - var peg$c17 = peg$otherExpectation("fieldName"); - var peg$c18 = function(field, operator, value) { - if (value.type === 'cursor') { - return { - ...value, - suggestionTypes: ['conjunction'] - }; - } - const range = buildNamedArgNode(operator, value); - return buildFunctionNode('range', [field, range]); - }; - var peg$c19 = function(field, partial) { - if (partial.type === 'cursor') { - return { - ...partial, - fieldName: field.value, - suggestionTypes: ['value', 'conjunction'] - }; - } - return partial(field); - }; - var peg$c20 = function(partial) { - if (partial.type === 'cursor') { - const fieldName = `${partial.prefix}${partial.suffix}`.trim(); - return { - ...partial, - fieldName, - suggestionTypes: ['field', 'operator', 'conjunction'] - }; - } - const field = buildLiteralNode(null); - return partial(field); - }; - var peg$c21 = function(partial, trailing) { - if (trailing.type === 'cursor') { - return { - ...trailing, - suggestionTypes: ['conjunction'] - }; - } - return partial; - }; - var peg$c22 = function(head, partial) { return partial; }; - var peg$c23 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('or', nodes.map(partial => partial(field))); - }; - var peg$c24 = function(head, tail) { - const nodes = [head, ...tail]; - const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); - if (cursor) { - return { - ...cursor, - suggestionTypes: ['value'] - }; - } - return (field) => buildFunctionNode('and', nodes.map(partial => partial(field))); - }; - var peg$c25 = function(partial) { - if (partial.type === 'cursor') { - return { - ...list, - suggestionTypes: ['value'] + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + return buildFunctionNode('nested', [field, query]); }; - } - return (field) => buildFunctionNode('not', [partial(field)]); - }; - var peg$c26 = peg$otherExpectation("value"); - var peg$c27 = function(value) { - if (value.type === 'cursor') return value; - const isPhrase = buildLiteralNode(true); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }; - var peg$c28 = function(value) { - if (value.type === 'cursor') return value; + var peg$f7 = function(field, operator, value) { + if (value.type === 'cursor') { + return { + ...value, + suggestionTypes: ['conjunction'] + }; + } + const range = buildNamedArgNode(operator, value); + return buildFunctionNode('range', [field, range]); + }; + var peg$f8 = function(field, partial) { + if (partial.type === 'cursor') { + return { + ...partial, + fieldName: field.value, + suggestionTypes: ['value', 'conjunction'] + }; + } + return partial(field); + }; + var peg$f9 = function(partial) { + if (partial.type === 'cursor') { + const fieldName = `${partial.prefix}${partial.suffix}`.trim(); + return { + ...partial, + fieldName, + suggestionTypes: ['field', 'operator', 'conjunction'] + }; + } + const field = buildLiteralNode(null); + return partial(field); + }; + var peg$f10 = function(partial, trailing) { + if (trailing.type === 'cursor') { + return { + ...trailing, + suggestionTypes: ['conjunction'] + }; + } + return partial; + }; + var peg$f11 = function(head, partial) { return partial; }; + var peg$f12 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('or', nodes.map(partial => partial(field))); + }; + var peg$f13 = function(head, tail) { + const nodes = [head, ...tail]; + const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); + if (cursor) { + return { + ...cursor, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('and', nodes.map(partial => partial(field))); + }; + var peg$f14 = function(partial) { + if (partial.type === 'cursor') { + return { + ...list, + suggestionTypes: ['value'] + }; + } + return (field) => buildFunctionNode('not', [partial(field)]); + }; + var peg$f15 = function(value) { + if (value.type === 'cursor') return value; + const isPhrase = buildLiteralNode(true); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + var peg$f16 = function(value) { + if (value.type === 'cursor') return value; - if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) { - error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.'); - } + if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) { + error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.'); + } - const isPhrase = buildLiteralNode(false); - return (field) => buildFunctionNode('is', [field, value, isPhrase]); - }; - var peg$c29 = peg$otherExpectation("OR"); - var peg$c30 = "or"; - var peg$c31 = peg$literalExpectation("or", true); - var peg$c32 = peg$otherExpectation("AND"); - var peg$c33 = "and"; - var peg$c34 = peg$literalExpectation("and", true); - var peg$c35 = peg$otherExpectation("NOT"); - var peg$c36 = "not"; - var peg$c37 = peg$literalExpectation("not", true); - var peg$c38 = peg$otherExpectation("literal"); - var peg$c39 = function() { return parseCursor; }; - var peg$c40 = "\""; - var peg$c41 = peg$literalExpectation("\"", false); - var peg$c42 = function(prefix, cursor, suffix) { - const { start, end } = location(); - return { - type: 'cursor', - start: start.offset, - end: end.offset - cursor.length, - prefix: prefix.join(''), - suffix: suffix.join(''), - text: text().replace(cursor, '') + const isPhrase = buildLiteralNode(false); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); }; - }; - var peg$c43 = function(chars) { - return buildLiteralNode(chars.join('')); - }; - var peg$c44 = "\\"; - var peg$c45 = peg$literalExpectation("\\", false); - var peg$c46 = /^[\\"]/; - var peg$c47 = peg$classExpectation(["\\", "\""], false, false); - var peg$c48 = function(char) { return char; }; - var peg$c49 = /^[^"]/; - var peg$c50 = peg$classExpectation(["\""], true, false); - var peg$c51 = function(chars) { - const sequence = chars.join('').trim(); - if (sequence === 'null') return buildLiteralNode(null); - if (sequence === 'true') return buildLiteralNode(true); - if (sequence === 'false') return buildLiteralNode(false); - if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); - return buildLiteralNode(sequence); - }; - var peg$c52 = peg$anyExpectation(); - var peg$c53 = "*"; - var peg$c54 = peg$literalExpectation("*", false); - var peg$c55 = function() { return wildcardSymbol; }; - var peg$c56 = "\\t"; - var peg$c57 = peg$literalExpectation("\\t", false); - var peg$c58 = function() { return '\t'; }; - var peg$c59 = "\\r"; - var peg$c60 = peg$literalExpectation("\\r", false); - var peg$c61 = function() { return '\r'; }; - var peg$c62 = "\\n"; - var peg$c63 = peg$literalExpectation("\\n", false); - var peg$c64 = function() { return '\n'; }; - var peg$c65 = function(keyword) { return keyword; }; - var peg$c66 = /^[\\():<>"*{}]/; - var peg$c67 = peg$classExpectation(["\\", "(", ")", ":", "<", ">", "\"", "*", "{", "}"], false, false); - var peg$c68 = function(sequence) { return sequence; }; - var peg$c69 = "u"; - var peg$c70 = peg$literalExpectation("u", false); - var peg$c71 = function(digits) { - return String.fromCharCode(parseInt(digits, 16)); - }; - var peg$c72 = /^[0-9a-f]/i; - var peg$c73 = peg$classExpectation([["0", "9"], ["a", "f"]], false, true); - var peg$c74 = "<="; - var peg$c75 = peg$literalExpectation("<=", false); - var peg$c76 = function() { return 'lte'; }; - var peg$c77 = ">="; - var peg$c78 = peg$literalExpectation(">=", false); - var peg$c79 = function() { return 'gte'; }; - var peg$c80 = "<"; - var peg$c81 = peg$literalExpectation("<", false); - var peg$c82 = function() { return 'lt'; }; - var peg$c83 = ">"; - var peg$c84 = peg$literalExpectation(">", false); - var peg$c85 = function() { return 'gt'; }; - var peg$c86 = peg$otherExpectation("whitespace"); - var peg$c87 = /^[ \t\r\n\xA0]/; - var peg$c88 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); - var peg$c89 = "@kuery-cursor@"; - var peg$c90 = peg$literalExpectation("@kuery-cursor@", false); - var peg$c91 = function() { return cursorSymbol; }; + var peg$f17 = function() { return parseCursor; }; + var peg$f18 = function(prefix, cursor, suffix) { + const { start, end } = location(); + return { + type: 'cursor', + start: start.offset, + end: end.offset - cursor.length, + prefix: prefix.join(''), + suffix: suffix.join(''), + text: text().replace(cursor, '') + }; + }; + var peg$f19 = function(chars) { + return buildLiteralNode(chars.join('')); + }; + var peg$f20 = function(char) { return char; }; + var peg$f21 = function(chars) { + const sequence = chars.join('').trim(); + if (sequence === 'null') return buildLiteralNode(null); + if (sequence === 'true') return buildLiteralNode(true); + if (sequence === 'false') return buildLiteralNode(false); + if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); + return buildLiteralNode(sequence); + }; + var peg$f22 = function() { return wildcardSymbol; }; + var peg$f23 = function() { return '\t'; }; + var peg$f24 = function() { return '\r'; }; + var peg$f25 = function() { return '\n'; }; + var peg$f26 = function(keyword) { return keyword; }; + var peg$f27 = function(sequence) { return sequence; }; + var peg$f28 = function(digits) { + return String.fromCharCode(parseInt(digits, 16)); + }; + var peg$f29 = function() { return 'lte'; }; + var peg$f30 = function() { return 'gte'; }; + var peg$f31 = function() { return 'lt'; }; + var peg$f32 = function() { return 'gt'; }; + var peg$f33 = function() { return cursorSymbol; }; var peg$currPos = 0; var peg$savedPos = 0; @@ -400,6 +441,18 @@ function peg$parse(input, options) { return input.substring(peg$savedPos, peg$currPos); } + function offset() { + return peg$savedPos; + } + + function range() { + return { + source: peg$source, + start: peg$savedPos, + end: peg$currPos + }; + } + function location() { return peg$computeLocation(peg$savedPos, peg$currPos); } @@ -484,6 +537,7 @@ function peg$parse(input, options) { var endPosDetails = peg$computePosDetails(endPos); return { + source: peg$source, start: { offset: startPos, line: startPosDetails.line, @@ -531,25 +585,14 @@ function peg$parse(input, options) { s1.push(s2); s2 = peg$parseSpace(); } - if (s1 !== peg$FAILED) { - s2 = peg$parseOrQuery(); - if (s2 === peg$FAILED) { - s2 = null; - } - if (s2 !== peg$FAILED) { - s3 = peg$parseOptionalSpace(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c0(s2, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s2 = peg$parseOrQuery(); + if (s2 === peg$FAILED) { + s2 = null; + } + s3 = peg$parseOptionalSpace(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f0(s2, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -571,8 +614,7 @@ function peg$parse(input, options) { s5 = peg$parseAndQuery(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; + s3 = peg$f1(s1, s5); } else { peg$currPos = s3; s3 = peg$FAILED; @@ -590,8 +632,7 @@ function peg$parse(input, options) { s5 = peg$parseAndQuery(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; + s3 = peg$f1(s1, s5); } else { peg$currPos = s3; s3 = peg$FAILED; @@ -606,8 +647,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c2(s1, s2); - s0 = s1; + s0 = peg$f2(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -636,8 +676,7 @@ function peg$parse(input, options) { s5 = peg$parseNotQuery(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; + s3 = peg$f1(s1, s5); } else { peg$currPos = s3; s3 = peg$FAILED; @@ -655,8 +694,7 @@ function peg$parse(input, options) { s5 = peg$parseNotQuery(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c1(s1, s5); - s3 = s4; + s3 = peg$f1(s1, s5); } else { peg$currPos = s3; s3 = peg$FAILED; @@ -671,8 +709,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c3(s1, s2); - s0 = s1; + s0 = peg$f3(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -697,8 +734,7 @@ function peg$parse(input, options) { s2 = peg$parseSubQuery(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c4(s2); - s0 = s1; + s0 = peg$f4(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -719,11 +755,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c5; + s1 = peg$c0; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + if (peg$silentFails === 0) { peg$fail(peg$e0); } } if (s1 !== peg$FAILED) { s2 = []; @@ -732,26 +768,20 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$parseSpace(); } - if (s2 !== peg$FAILED) { - s3 = peg$parseOrQuery(); - if (s3 !== peg$FAILED) { - s4 = peg$parseOptionalSpace(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c7; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c9(s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseOrQuery(); + if (s3 !== peg$FAILED) { + s4 = peg$parseOptionalSpace(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c1; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e1); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f5(s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -787,64 +817,48 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$parseSpace(); } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c10; + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c2; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseSpace(); + } + if (input.charCodeAt(peg$currPos) === 123) { + s5 = peg$c3; peg$currPos++; } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); + if (s5 !== peg$FAILED) { + s6 = []; + s7 = peg$parseSpace(); + while (s7 !== peg$FAILED) { + s6.push(s7); + s7 = peg$parseSpace(); } - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 123) { - s5 = peg$c12; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } - } - if (s5 !== peg$FAILED) { - s6 = []; - s7 = peg$parseSpace(); - while (s7 !== peg$FAILED) { - s6.push(s7); - s7 = peg$parseSpace(); + s7 = peg$parseOrQuery(); + if (s7 !== peg$FAILED) { + s8 = peg$parseOptionalSpace(); + if (s8 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s9 = peg$c4; + peg$currPos++; + } else { + s9 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e4); } } - if (s6 !== peg$FAILED) { - s7 = peg$parseOrQuery(); - if (s7 !== peg$FAILED) { - s8 = peg$parseOptionalSpace(); - if (s8 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s9 = peg$c14; - peg$currPos++; - } else { - s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c15); } - } - if (s9 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c16(s1, s7, s8); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s9 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f6(s1, s7, s8); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -898,7 +912,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } + if (peg$silentFails === 0) { peg$fail(peg$e5); } } return s0; @@ -916,29 +930,18 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$parseSpace(); } - if (s2 !== peg$FAILED) { - s3 = peg$parseRangeOperator(); - if (s3 !== peg$FAILED) { - s4 = []; + s3 = peg$parseRangeOperator(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseLiteral(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c18(s1, s3, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + s5 = peg$parseLiteral(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f7(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -967,35 +970,24 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$parseSpace(); } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c10; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } - } - if (s3 !== peg$FAILED) { - s4 = []; + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c2; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e2); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseListOfValues(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c19(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + s5 = peg$parseListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f8(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1019,7 +1011,7 @@ function peg$parse(input, options) { s1 = peg$parseValue(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c20(s1); + s1 = peg$f9(s1); } s0 = s1; @@ -1031,11 +1023,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c5; + s1 = peg$c0; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + if (peg$silentFails === 0) { peg$fail(peg$e0); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1044,26 +1036,20 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$parseSpace(); } - if (s2 !== peg$FAILED) { - s3 = peg$parseOrListOfValues(); - if (s3 !== peg$FAILED) { - s4 = peg$parseOptionalSpace(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c7; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c21(s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseOrListOfValues(); + if (s3 !== peg$FAILED) { + s4 = peg$parseOptionalSpace(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c1; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e1); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f10(s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1100,8 +1086,7 @@ function peg$parse(input, options) { s5 = peg$parseAndListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; + s3 = peg$f11(s1, s5); } else { peg$currPos = s3; s3 = peg$FAILED; @@ -1119,8 +1104,7 @@ function peg$parse(input, options) { s5 = peg$parseAndListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; + s3 = peg$f11(s1, s5); } else { peg$currPos = s3; s3 = peg$FAILED; @@ -1135,8 +1119,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c23(s1, s2); - s0 = s1; + s0 = peg$f12(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1165,8 +1148,7 @@ function peg$parse(input, options) { s5 = peg$parseNotListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; + s3 = peg$f11(s1, s5); } else { peg$currPos = s3; s3 = peg$FAILED; @@ -1184,8 +1166,7 @@ function peg$parse(input, options) { s5 = peg$parseNotListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c22(s1, s5); - s3 = s4; + s3 = peg$f11(s1, s5); } else { peg$currPos = s3; s3 = peg$FAILED; @@ -1200,8 +1181,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c24(s1, s2); - s0 = s1; + s0 = peg$f13(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1226,8 +1206,7 @@ function peg$parse(input, options) { s2 = peg$parseListOfValues(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c25(s2); - s0 = s1; + s0 = peg$f14(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1251,7 +1230,7 @@ function peg$parse(input, options) { s1 = peg$parseQuotedString(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c27(s1); + s1 = peg$f15(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -1259,14 +1238,14 @@ function peg$parse(input, options) { s1 = peg$parseUnquotedLiteral(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c28(s1); + s1 = peg$f16(s1); } s0 = s1; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } + if (peg$silentFails === 0) { peg$fail(peg$e6); } } return s0; @@ -1288,12 +1267,12 @@ function peg$parse(input, options) { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c5) { s2 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } + if (peg$silentFails === 0) { peg$fail(peg$e8); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1324,7 +1303,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c29); } + if (peg$silentFails === 0) { peg$fail(peg$e7); } } return s0; @@ -1346,12 +1325,12 @@ function peg$parse(input, options) { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c6) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } + if (peg$silentFails === 0) { peg$fail(peg$e10); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1382,7 +1361,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } + if (peg$silentFails === 0) { peg$fail(peg$e9); } } return s0; @@ -1393,12 +1372,12 @@ function peg$parse(input, options) { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c7) { s1 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c37); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1425,7 +1404,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c35); } + if (peg$silentFails === 0) { peg$fail(peg$e11); } } return s0; @@ -1442,7 +1421,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } return s0; @@ -1453,7 +1432,7 @@ function peg$parse(input, options) { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c39(); + s1 = peg$f17(); if (s1) { s1 = undefined; } else { @@ -1461,11 +1440,11 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c40; + s2 = peg$c8; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } + if (peg$silentFails === 0) { peg$fail(peg$e14); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1474,35 +1453,24 @@ function peg$parse(input, options) { s3.push(s4); s4 = peg$parseQuotedCharacter(); } - if (s3 !== peg$FAILED) { - s4 = peg$parseCursor(); - if (s4 !== peg$FAILED) { - s5 = []; + s4 = peg$parseCursor(); + if (s4 !== peg$FAILED) { + s5 = []; + s6 = peg$parseQuotedCharacter(); + while (s6 !== peg$FAILED) { + s5.push(s6); s6 = peg$parseQuotedCharacter(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseQuotedCharacter(); - } - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c40; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } - } - if (s6 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s3, s4, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + if (input.charCodeAt(peg$currPos) === 34) { + s6 = peg$c8; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f18(s3, s4, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1522,11 +1490,11 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c40; + s1 = peg$c8; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } + if (peg$silentFails === 0) { peg$fail(peg$e14); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1535,22 +1503,16 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$parseQuotedCharacter(); } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c40; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c43(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c8; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f19(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1573,24 +1535,23 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; + s1 = peg$c9; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { peg$fail(peg$e15); } } if (s1 !== peg$FAILED) { - if (peg$c46.test(input.charAt(peg$currPos))) { + if (peg$r0.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c47); } + if (peg$silentFails === 0) { peg$fail(peg$e16); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c48(s2); - s0 = s1; + s0 = peg$f20(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1612,17 +1573,16 @@ function peg$parse(input, options) { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (peg$c49.test(input.charAt(peg$currPos))) { + if (peg$r1.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c50); } + if (peg$silentFails === 0) { peg$fail(peg$e17); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c48(s2); - s0 = s1; + s0 = peg$f20(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1643,7 +1603,7 @@ function peg$parse(input, options) { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c39(); + s1 = peg$f17(); if (s1) { s1 = undefined; } else { @@ -1656,27 +1616,16 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$parseUnquotedCharacter(); } - if (s2 !== peg$FAILED) { - s3 = peg$parseCursor(); - if (s3 !== peg$FAILED) { - s4 = []; + s3 = peg$parseCursor(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseUnquotedCharacter(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseUnquotedCharacter(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseUnquotedCharacter(); - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s2, s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + peg$savedPos = s0; + s0 = peg$f18(s2, s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1699,7 +1648,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c51(s1); + s1 = peg$f21(s1); } s0 = s1; } @@ -1759,12 +1708,11 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } + if (peg$silentFails === 0) { peg$fail(peg$e18); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c48(s4); - s0 = s1; + s0 = peg$f20(s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1795,15 +1743,15 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 42) { - s1 = peg$c53; + s1 = peg$c10; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c54); } + if (peg$silentFails === 0) { peg$fail(peg$e19); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c55(); + s1 = peg$f22(); } s0 = s1; @@ -1815,7 +1763,7 @@ function peg$parse(input, options) { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c39(); + s1 = peg$f17(); if (s1) { s1 = undefined; } else { @@ -1828,27 +1776,16 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$parseSpace(); } - if (s2 !== peg$FAILED) { - s3 = peg$parseCursor(); - if (s3 !== peg$FAILED) { - s4 = []; + s3 = peg$parseCursor(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c42(s2, s3, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + peg$savedPos = s0; + s0 = peg$f18(s2, s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1873,44 +1810,44 @@ function peg$parse(input, options) { var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c56) { - s1 = peg$c56; + if (input.substr(peg$currPos, 2) === peg$c11) { + s1 = peg$c11; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c57); } + if (peg$silentFails === 0) { peg$fail(peg$e20); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c58(); + s1 = peg$f23(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c59) { - s1 = peg$c59; + if (input.substr(peg$currPos, 2) === peg$c12) { + s1 = peg$c12; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c60); } + if (peg$silentFails === 0) { peg$fail(peg$e21); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c61(); + s1 = peg$f24(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c62) { - s1 = peg$c62; + if (input.substr(peg$currPos, 2) === peg$c13) { + s1 = peg$c13; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c63); } + if (peg$silentFails === 0) { peg$fail(peg$e22); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c64(); + s1 = peg$f25(); } s0 = s1; } @@ -1924,18 +1861,17 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; + s1 = peg$c9; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { peg$fail(peg$e15); } } if (s1 !== peg$FAILED) { s2 = peg$parseSpecialCharacter(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c48(s2); - s0 = s1; + s0 = peg$f20(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1953,42 +1889,41 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; + s1 = peg$c9; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { peg$fail(peg$e15); } } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c5) { s2 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c31); } + if (peg$silentFails === 0) { peg$fail(peg$e8); } } if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c6) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c34); } + if (peg$silentFails === 0) { peg$fail(peg$e10); } } if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c7) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c37); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c65(s2); - s0 = s1; + s0 = peg$f26(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2018,12 +1953,12 @@ function peg$parse(input, options) { function peg$parseSpecialCharacter() { var s0; - if (peg$c66.test(input.charAt(peg$currPos))) { + if (peg$r2.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } + if (peg$silentFails === 0) { peg$fail(peg$e23); } } return s0; @@ -2034,18 +1969,17 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c44; + s1 = peg$c9; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { peg$fail(peg$e15); } } if (s1 !== peg$FAILED) { s2 = peg$parseUnicodeSequence(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c68(s2); - s0 = s1; + s0 = peg$f27(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2063,11 +1997,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 117) { - s1 = peg$c69; + s1 = peg$c14; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } + if (peg$silentFails === 0) { peg$fail(peg$e24); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2105,8 +2039,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c71(s2); - s0 = s1; + s0 = peg$f28(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2122,12 +2055,12 @@ function peg$parse(input, options) { function peg$parseHexDigit() { var s0; - if (peg$c72.test(input.charAt(peg$currPos))) { + if (peg$r3.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$e25); } } return s0; @@ -2137,58 +2070,58 @@ function peg$parse(input, options) { var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c74) { - s1 = peg$c74; + if (input.substr(peg$currPos, 2) === peg$c15) { + s1 = peg$c15; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$e26); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c76(); + s1 = peg$f29(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c77) { - s1 = peg$c77; + if (input.substr(peg$currPos, 2) === peg$c16) { + s1 = peg$c16; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c78); } + if (peg$silentFails === 0) { peg$fail(peg$e27); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c79(); + s1 = peg$f30(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c80; + s1 = peg$c17; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$e28); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c82(); + s1 = peg$f31(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { - s1 = peg$c83; + s1 = peg$c18; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } + if (peg$silentFails === 0) { peg$fail(peg$e29); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c85(); + s1 = peg$f32(); } s0 = s1; } @@ -2202,17 +2135,17 @@ function peg$parse(input, options) { var s0, s1; peg$silentFails++; - if (peg$c87.test(input.charAt(peg$currPos))) { + if (peg$r4.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c88); } + if (peg$silentFails === 0) { peg$fail(peg$e31); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c86); } + if (peg$silentFails === 0) { peg$fail(peg$e30); } } return s0; @@ -2223,24 +2156,23 @@ function peg$parse(input, options) { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c39(); + s1 = peg$f17(); if (s1) { s1 = undefined; } else { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 14) === peg$c89) { - s2 = peg$c89; + if (input.substr(peg$currPos, 14) === peg$c19) { + s2 = peg$c19; peg$currPos += 14; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } + if (peg$silentFails === 0) { peg$fail(peg$e32); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c91(); - s0 = s1; + s0 = peg$f33(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2254,12 +2186,13 @@ function peg$parse(input, options) { } - const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; - const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; - const buildLiteralNode = nodeTypes.literal.buildNode; - const buildWildcardNode = nodeTypes.wildcard.buildNode; - const buildNamedArgNode = nodeTypes.namedArg.buildNode; - const { wildcardSymbol } = nodeTypes.wildcard; + const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; + console.log( '--------------------------------------', nodeTypes ) + const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; + const buildLiteralNode = nodeTypes.literal.buildNode; + const buildWildcardNode = nodeTypes.wildcard.buildNode; + const buildNamedArgNode = nodeTypes.namedArg.buildNode; + const { wildcardSymbol } = nodeTypes.wildcard; peg$result = peg$startRuleFunction(); diff --git a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts index 7588a1fcf6d2c1..fe994267596405 100644 --- a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { repeat } from 'lodash'; +import { repeat, uniq } from 'lodash'; import { i18n } from '@kbn/i18n'; const endOfInputText = i18n.translate('esQuery.kql.errors.endOfInputText', { @@ -35,7 +35,9 @@ interface KQLSyntaxErrorData extends Error { } interface KQLSyntaxErrorExpected { - description: string; + description?: string; + text?: string; + type: string; } export class KQLSyntaxError extends Error { @@ -45,10 +47,18 @@ export class KQLSyntaxError extends Error { let message = error.message; if (error.expected) { const translatedExpectations = error.expected.map((expected) => { - return grammarRuleTranslations[expected.description] || expected.description; + return ( + grammarRuleTranslations[expected.description || ''] || + expected.description || + expected.text + ); }); - const translatedExpectationText = translatedExpectations.join(', '); + const translatedExpectationText = uniq(translatedExpectations) + .filter((item) => item !== undefined) + .sort() + .map((item) => `"${item}"`) + .join(', '); message = i18n.translate('esQuery.kql.errors.syntaxError', { defaultMessage: 'Expected {expectedList} but {foundInput} found.', diff --git a/src/core/server/saved_objects/service/lib/repository.test.js b/src/core/server/saved_objects/service/lib/repository.test.js index 27228361aef22c..df0cd0ff01eea5 100644 --- a/src/core/server/saved_objects/service/lib/repository.test.js +++ b/src/core/server/saved_objects/service/lib/repository.test.js @@ -33,6 +33,7 @@ import { errors as EsErrors } from '@elastic/elasticsearch'; const { nodeTypes } = esKuery; jest.mock('./search_dsl/search_dsl', () => ({ getSearchDsl: jest.fn() })); +jest.mock('../../../../../../packages/kbn-es-query/src/kuery/grammar'); // BEWARE: The SavedObjectClient depends on the implementation details of the SavedObjectsRepository // so any breaking changes to this repository are considered breaking changes to the SavedObjectsClient. diff --git a/src/plugins/data/common/query/persistable_state.test.ts b/src/plugins/data/common/query/persistable_state.test.ts index 62ea17e0304133..807cc72a071bef 100644 --- a/src/plugins/data/common/query/persistable_state.test.ts +++ b/src/plugins/data/common/query/persistable_state.test.ts @@ -7,7 +7,7 @@ */ import { extract, inject } from './persistable_state'; -import { Filter } from '../es_query/filters'; +import { Filter } from '@kbn/es-query'; describe('filter manager persistable state tests', () => { const filters: Filter[] = [ diff --git a/yarn.lock b/yarn.lock index 20980b9963dedf..15674443e8ce3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21534,10 +21534,10 @@ pdfmake@^0.1.65: pdfkit "^0.11.0" svg-to-pdfkit "^0.1.8" -peggy@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/peggy/-/peggy-1.0.0.tgz#df6c7816c9df0ef35e071aaf96836cb866fe7eb4" - integrity sha512-lH12sxAXj4Aug+vH6IGoByIQOREIlhH+x4Uzb9kce6DD8wcGeidkC0JYEOwHormKrLt5BFLTbR4PuD/tiMOirQ== +peggy@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/peggy/-/peggy-1.2.0.tgz#657ba45900cbef1dc9f52356704bdbb193c2021c" + integrity sha512-PQ+NKpAobImfMprYQtc4Egmyi29bidRGEX0kKjCU5uuW09s0Cthwqhfy7mLkwcB4VcgacE5L/ZjruD/kOPCUUw== pegjs@0.10.0: version "0.10.0" From 9534de5da5334421a775e015571e5fce1531cafa Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 19 Jul 2021 17:48:52 +0200 Subject: [PATCH 42/52] docs --- .../server/kibana-plugin-plugins-data-server.esqueryconfig.md | 2 +- .../data/server/kibana-plugin-plugins-data-server.filter.md | 2 +- .../server/kibana-plugin-plugins-data-server.ifieldsubtype.md | 2 +- .../data/server/kibana-plugin-plugins-data-server.kuerynode.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md index 9bacd138bafeba..5c736f40cdbf4f 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md index 020fa4d80d512b..f46ff36277d938 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md index 26637c5a892fd3..e8e872577b46b7 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md index 807b1225a728cf..a5c14ee8627b1e 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Please import from the package kbn/es-query directly. This import will be eprecated in v8.0.0. +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. > Signature: From 5edad80976cc2607dbd2947f0bd571a94c8a3619 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 19 Jul 2021 19:51:27 +0200 Subject: [PATCH 43/52] Better error formatting --- packages/kbn-es-query/package.json | 2 +- .../src/kuery/grammar/__mocks__/grammar.js | 3 +-- .../src/kuery/kuery_syntax_error.ts | 20 +++++++++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/kbn-es-query/package.json b/packages/kbn-es-query/package.json index 335ef61b8b3602..4958e09723d625 100644 --- a/packages/kbn-es-query/package.json +++ b/packages/kbn-es-query/package.json @@ -6,4 +6,4 @@ "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true -} \ No newline at end of file +} \ No newline at end of file diff --git a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js index 3a7759655c47ef..89c13bb2b05c23 100644 --- a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js +++ b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js @@ -177,7 +177,7 @@ function peg$parse(input, options) { var peg$FAILED = {}; var peg$source = options.grammarSource; - var peg$startRuleFunctions = { start: peg$parsestart }; + var peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral }; var peg$startRuleFunction = peg$parsestart; var peg$c0 = "("; @@ -2187,7 +2187,6 @@ function peg$parse(input, options) { const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; - console.log( '--------------------------------------', nodeTypes ) const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; const buildLiteralNode = nodeTypes.literal.buildNode; const buildWildcardNode = nodeTypes.wildcard.buildNode; diff --git a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts index fe994267596405..c4ff7f465ae906 100644 --- a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts @@ -47,17 +47,13 @@ export class KQLSyntaxError extends Error { let message = error.message; if (error.expected) { const translatedExpectations = error.expected.map((expected) => { - return ( - grammarRuleTranslations[expected.description || ''] || - expected.description || - expected.text - ); + const key = this.getItemText(expected); + return grammarRuleTranslations[key] || key; }); const translatedExpectationText = uniq(translatedExpectations) .filter((item) => item !== undefined) .sort() - .map((item) => `"${item}"`) .join(', '); message = i18n.translate('esQuery.kql.errors.syntaxError', { @@ -77,4 +73,16 @@ export class KQLSyntaxError extends Error { this.name = 'KQLSyntaxError'; this.shortMessage = message; } + + private getItemText(item: KQLSyntaxErrorExpected): string { + if (item.type === 'other') { + return item.description!; + } else if (item.type === 'literal') { + return item.text!; + } else if (item.type === 'end') { + return 'end of input'; + } else { + return item.text || item.description || ''; + } + } } From 7c46199995d9a17807131676fb97490892e1104c Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 19 Jul 2021 19:52:51 +0200 Subject: [PATCH 44/52] space --- packages/kbn-es-query/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-es-query/package.json b/packages/kbn-es-query/package.json index 4958e09723d625..335ef61b8b3602 100644 --- a/packages/kbn-es-query/package.json +++ b/packages/kbn-es-query/package.json @@ -6,4 +6,4 @@ "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true -} \ No newline at end of file +} \ No newline at end of file From f336f20bf67e701d7231b11775e74a7dcc30eaf5 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 19 Jul 2021 20:01:53 +0200 Subject: [PATCH 45/52] formatting --- packages/kbn-es-query/src/kuery/kuery_syntax_error.ts | 2 +- test/api_integration/apis/saved_objects/find.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts index c4ff7f465ae906..24b3c06f33796d 100644 --- a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts @@ -78,7 +78,7 @@ export class KQLSyntaxError extends Error { if (item.type === 'other') { return item.description!; } else if (item.type === 'literal') { - return item.text!; + return `"${item.text!}"`; } else if (item.type === 'end') { return 'end of input'; } else { diff --git a/test/api_integration/apis/saved_objects/find.ts b/test/api_integration/apis/saved_objects/find.ts index 2255fad51d5a86..5a8145711d6269 100644 --- a/test/api_integration/apis/saved_objects/find.ts +++ b/test/api_integration/apis/saved_objects/find.ts @@ -184,7 +184,7 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.body).to.eql({ error: 'Bad Request', message: - 'KQLSyntaxError: Expected AND, OR, AND, whitespace, but "<" found.\ndashboard.' + + 'KQLSyntaxError: Expected AND, OR, whitespace but "<" found.\ndashboard.' + 'attributes.title:foo Date: Mon, 19 Jul 2021 20:06:32 +0200 Subject: [PATCH 46/52] jest --- .../src/kuery/kuery_syntax_error.ts | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts index 24b3c06f33796d..aa4440579eb49b 100644 --- a/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts @@ -28,6 +28,18 @@ const grammarRuleTranslations: Record = { }), }; +const getItemText = (item: KQLSyntaxErrorExpected): string => { + if (item.type === 'other') { + return item.description!; + } else if (item.type === 'literal') { + return `"${item.text!}"`; + } else if (item.type === 'end') { + return 'end of input'; + } else { + return item.text || item.description || ''; + } +}; + interface KQLSyntaxErrorData extends Error { found: string; expected: KQLSyntaxErrorExpected[] | null; @@ -47,7 +59,7 @@ export class KQLSyntaxError extends Error { let message = error.message; if (error.expected) { const translatedExpectations = error.expected.map((expected) => { - const key = this.getItemText(expected); + const key = getItemText(expected); return grammarRuleTranslations[key] || key; }); @@ -73,16 +85,4 @@ export class KQLSyntaxError extends Error { this.name = 'KQLSyntaxError'; this.shortMessage = message; } - - private getItemText(item: KQLSyntaxErrorExpected): string { - if (item.type === 'other') { - return item.description!; - } else if (item.type === 'literal') { - return `"${item.text!}"`; - } else if (item.type === 'end') { - return 'end of input'; - } else { - return item.text || item.description || ''; - } - } } From 78375dd9d40f3fedaf60aa39cd825b573017857d Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 19 Jul 2021 20:20:44 +0200 Subject: [PATCH 47/52] cleanup --- src/core/server/saved_objects/service/lib/repository.test.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/server/saved_objects/service/lib/repository.test.js b/src/core/server/saved_objects/service/lib/repository.test.js index df0cd0ff01eea5..474721ff3610a5 100644 --- a/src/core/server/saved_objects/service/lib/repository.test.js +++ b/src/core/server/saved_objects/service/lib/repository.test.js @@ -33,8 +33,6 @@ import { errors as EsErrors } from '@elastic/elasticsearch'; const { nodeTypes } = esKuery; jest.mock('./search_dsl/search_dsl', () => ({ getSearchDsl: jest.fn() })); -jest.mock('../../../../../../packages/kbn-es-query/src/kuery/grammar'); - // BEWARE: The SavedObjectClient depends on the implementation details of the SavedObjectsRepository // so any breaking changes to this repository are considered breaking changes to the SavedObjectsClient. From 1c1d571ff3b87ec204b3aec5b0743cf466613914 Mon Sep 17 00:00:00 2001 From: Liza K Date: Mon, 19 Jul 2021 20:21:56 +0200 Subject: [PATCH 48/52] test --- test/api_integration/apis/saved_objects/find.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api_integration/apis/saved_objects/find.ts b/test/api_integration/apis/saved_objects/find.ts index 5a8145711d6269..6510a9b3f8d97a 100644 --- a/test/api_integration/apis/saved_objects/find.ts +++ b/test/api_integration/apis/saved_objects/find.ts @@ -184,7 +184,7 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.body).to.eql({ error: 'Bad Request', message: - 'KQLSyntaxError: Expected AND, OR, whitespace but "<" found.\ndashboard.' + + 'KQLSyntaxError: Expected AND, OR, end of input, whitespace "<" found.\ndashboard.' + 'attributes.title:foo Date: Mon, 19 Jul 2021 20:41:36 +0200 Subject: [PATCH 49/52] err --- test/api_integration/apis/saved_objects/find.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api_integration/apis/saved_objects/find.ts b/test/api_integration/apis/saved_objects/find.ts index 6510a9b3f8d97a..9b2b3a96cba5b7 100644 --- a/test/api_integration/apis/saved_objects/find.ts +++ b/test/api_integration/apis/saved_objects/find.ts @@ -184,7 +184,7 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.body).to.eql({ error: 'Bad Request', message: - 'KQLSyntaxError: Expected AND, OR, end of input, whitespace "<" found.\ndashboard.' + + 'KQLSyntaxError: Expected AND, OR, end of input, whitespace but "<" found.\ndashboard.' + 'attributes.title:foo Date: Tue, 20 Jul 2021 11:01:48 +0200 Subject: [PATCH 50/52] jest error messages --- .../src/kuery/kuery_syntax_error.test.ts | 34 +++++++------------ .../response_processors/series/math.test.js | 2 +- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts b/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts index c45d5fd356fce6..e04b1abdc84944 100644 --- a/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.test.ts @@ -15,7 +15,7 @@ describe('kql syntax errors', () => { expect(() => { fromKueryExpression('response:'); }).toThrow( - 'Expected whitespace, , whitespace, , value, whitespace, , whitespace, , value, whitespace, , whitespace, , value, whitespace, , whitespace, , value but end of input found.\n' + + 'Expected "(", "{", value, whitespace but end of input found.\n' + 'response:\n' + '---------^' ); @@ -25,7 +25,7 @@ describe('kql syntax errors', () => { expect(() => { fromKueryExpression('response:200 or '); }).toThrow( - 'Expected NOT, , field name, field name, field name, value, NOT, , field name, field name, field name, value but end of input found.\n' + + 'Expected "(", NOT, field name, value but end of input found.\n' + 'response:200 or \n' + '----------------^' ); @@ -35,9 +35,7 @@ describe('kql syntax errors', () => { expect(() => { fromKueryExpression('response:(200 or )'); }).toThrow( - 'Expected NOT, , value, NOT, , value, NOT, , value, NOT, , value, NOT, , value, NOT, , value, NOT, , value, NOT, , value but ")" found.\n' + - 'response:(200 or )\n' + - '-----------------^' + 'Expected "(", NOT, value but ")" found.\n' + 'response:(200 or )\n' + '-----------------^' ); }); @@ -45,17 +43,17 @@ describe('kql syntax errors', () => { expect(() => { fromKueryExpression('response:200 and not '); }).toThrow( - 'Expected , field name, field name, field name, value, , field name, field name, field name, value but end of input found.\n' + + 'Expected "(", field name, value but end of input found.\n' + 'response:200 and not \n' + '---------------------^' ); }); - it('should throw an error for a NOT list missing a sub-query', () => { + it('should throw an error for a "missing a sub-query', () => { expect(() => { fromKueryExpression('response:(200 and not )'); }).toThrow( - 'Expected , value, , value, , value, , value, , value, , value, , value, , value but ")" found.\n' + + 'Expected "(", value but ")" found.\n' + 'response:(200 and not )\n' + '----------------------^' ); @@ -64,42 +62,36 @@ describe('kql syntax errors', () => { it('should throw an error for unbalanced quotes', () => { expect(() => { fromKueryExpression('foo:"ba '); - }).toThrow( - 'Expected whitespace, , whitespace, , value, whitespace, , whitespace, , value, whitespace, , whitespace, , value, whitespace, , whitespace, , value but """ found.\n' + - 'foo:"ba \n' + - '----^' - ); + }).toThrow('Expected "(", "{", value, whitespace but """ found.\n' + 'foo:"ba \n' + '----^'); }); it('should throw an error for unescaped quotes in a quoted string', () => { expect(() => { fromKueryExpression('foo:"ba "r"'); }).toThrow( - 'Expected AND, OR, AND, whitespace, but "r" found.\n' + 'foo:"ba "r"\n' + '---------^' + 'Expected AND, OR, end of input, whitespace but "r" found.\n' + 'foo:"ba "r"\n' + '---------^' ); }); it('should throw an error for unescaped special characters in literals', () => { expect(() => { fromKueryExpression('foo:ba:r'); - }).toThrow('Expected AND, OR, AND, whitespace, but ":" found.\n' + 'foo:ba:r\n' + '------^'); + }).toThrow( + 'Expected AND, OR, end of input, whitespace but ":" found.\n' + 'foo:ba:r\n' + '------^' + ); }); it('should throw an error for range queries missing a value', () => { expect(() => { fromKueryExpression('foo > '); - }).toThrow( - 'Expected whitespace, literal, whitespace, literal, whitespace, literal, whitespace, literal but end of input found.\n' + - 'foo > \n' + - '------^' - ); + }).toThrow('Expected literal, whitespace but end of input found.\n' + 'foo > \n' + '------^'); }); it('should throw an error for range queries missing a field', () => { expect(() => { fromKueryExpression('< 1000'); }).toThrow( - 'Expected whitespace, NOT, , field name, field name, field name, value, NOT, , field name, field name, field name, value, NOT, , field name, field name, field name, value, NOT, , field name, field name, field name, value, whitespace, but "<" found.\n' + + 'Expected "(", NOT, end of input, field name, value, whitespace but "<" found.\n' + '< 1000\n' + '^' ); diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/math.test.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/math.test.js index 7b5eb1e029069f..d8508f6b735a0f 100644 --- a/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/math.test.js +++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/response_processors/series/math.test.js @@ -168,7 +168,7 @@ describe('math(resp, panel, series)', () => { )(await mathAgg(resp, panel, series)((results) => results))([]); } catch (e) { expect(e.message).toEqual( - 'Failed to parse expression. Expected "*", "+", "-", "/", or end of input but "(" found.' + 'Failed to parse expression. Expected "*", "+", "-", "/", end of input, or whitespace but "(" found.' ); } }); From c19d0cabd19b48e4c9310e6fec5a3d0e0b37a737 Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 21 Jul 2021 13:43:21 +0200 Subject: [PATCH 51/52] docs --- ...ic.aggconfigs.getsearchsourcetimefilter.md | 4 +- ...na-plugin-plugins-data-public.esfilters.md | 46 ++++++------ ...bana-plugin-plugins-data-public.eskuery.md | 6 +- ...bana-plugin-plugins-data-public.esquery.md | 12 ++-- ...bana-plugin-plugins-data-public.gettime.md | 4 +- ...n-plugins-data-public.indexpatternfield.md | 2 +- ...s-data-public.indexpatternfield.subtype.md | 2 +- ...ns-data-public.indexpatternfield.tojson.md | 4 +- ...na-plugin-plugins-data-server.esfilters.md | 18 ++--- ...bana-plugin-plugins-data-server.eskuery.md | 6 +- ...bana-plugin-plugins-data-server.esquery.md | 8 +-- ...bana-plugin-plugins-data-server.gettime.md | 4 +- src/plugins/data/public/public.api.md | 72 +++++++++---------- src/plugins/data/server/server.api.md | 34 ++++----- 14 files changed, 111 insertions(+), 111 deletions(-) diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md index 9ebc685f2a77d6..db6faf2e0d0f70 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md @@ -7,7 +7,7 @@ Signature: ```typescript -getSearchSourceTimeFilter(forceNow?: Date): import("@kbn/es-query").RangeFilter[] | { +getSearchSourceTimeFilter(forceNow?: Date): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter[] | { meta: { index: string | undefined; params: {}; @@ -43,7 +43,7 @@ getSearchSourceTimeFilter(forceNow?: Date): import("@kbn/es-query").RangeFilter[ Returns: -`import("@kbn/es-query").RangeFilter[] | { +`import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter[] | { meta: { index: string | undefined; params: {}; diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md index eb06d994261974..61ccf44d57386f 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md @@ -10,23 +10,23 @@ esFilters: { FilterLabel: (props: import("./ui/filter_bar/filter_editor/lib/filter_label").FilterLabelProps) => JSX.Element; FilterItem: (props: import("./ui/filter_bar/filter_item").FilterItemProps) => JSX.Element; - FILTERS: typeof import("@kbn/es-query").FILTERS; + FILTERS: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").FILTERS; FilterStateStore: typeof FilterStateStore; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; - buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; - buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; - buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; - buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; - buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; - isPhraseFilter: (filter: any) => filter is import("@kbn/es-query").PhraseFilter; - isExistsFilter: (filter: any) => filter is import("@kbn/es-query").ExistsFilter; - isPhrasesFilter: (filter: any) => filter is import("@kbn/es-query").PhrasesFilter; - isRangeFilter: (filter: any) => filter is import("@kbn/es-query").RangeFilter; - isMatchAllFilter: (filter: any) => filter is import("@kbn/es-query").MatchAllFilter; - isMissingFilter: (filter: any) => filter is import("@kbn/es-query").MissingFilter; - isQueryStringFilter: (filter: any) => filter is import("@kbn/es-query").QueryStringFilter; - isFilterPinned: (filter: import("@kbn/es-query").Filter) => boolean | undefined; - toggleFilterNegated: (filter: import("@kbn/es-query").Filter) => { + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; + buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; + buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; + buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; + buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase, formattedValue?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; + isPhraseFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; + isExistsFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; + isPhrasesFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; + isRangeFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; + isMatchAllFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").MatchAllFilter; + isMissingFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").MissingFilter; + isQueryStringFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; + isFilterPinned: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => boolean | undefined; + toggleFilterNegated: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => { meta: { negate: boolean; alias: string | null; @@ -39,20 +39,20 @@ esFilters: { params?: any; value?: string | undefined; }; - $state?: import("@kbn/es-query/target_types/filters/types").FilterState | undefined; + $state?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/filters/types").FilterState | undefined; query?: any; }; - disableFilter: (filter: import("@kbn/es-query").Filter) => import("@kbn/es-query").Filter; - getPhraseFilterField: (filter: import("@kbn/es-query").PhraseFilter) => string; - getPhraseFilterValue: (filter: import("@kbn/es-query").PhraseFilter) => string | number | boolean; + disableFilter: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; + getPhraseFilterField: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter) => string; + getPhraseFilterValue: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter) => string | number | boolean; getDisplayValueFromFilter: typeof getDisplayValueFromFilter; - compareFilters: (first: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], second: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; + compareFilters: (first: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter | import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[], second: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter | import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions; generateFilters: typeof generateFilters; - onlyDisabledFiltersChanged: (newFilters?: import("@kbn/es-query").Filter[] | undefined, oldFilters?: import("@kbn/es-query").Filter[] | undefined) => boolean; + onlyDisabledFiltersChanged: (newFilters?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, oldFilters?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined) => boolean; changeTimeFilter: typeof changeTimeFilter; convertRangeFilterToTimeRangeString: typeof convertRangeFilterToTimeRangeString; - mapAndFlattenFilters: (filters: import("@kbn/es-query").Filter[]) => import("@kbn/es-query").Filter[]; + mapAndFlattenFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; extractTimeFilter: typeof extractTimeFilter; extractTimeRange: typeof extractTimeRange; } diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md index 6ed9898ddd7187..0552118c8d6a2a 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md @@ -13,8 +13,8 @@ ```typescript esKuery: { - nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; - toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode; + toElasticsearchQuery: (node: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; } ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md index fa2ee4faa74665..fbb538b9471a46 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md @@ -13,15 +13,15 @@ ```typescript esQuery: { - buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; + buildEsQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildEsQuery; getEsQueryConfig: typeof getEsQueryConfig; - buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("@kbn/es-query").Filter[]; + filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; should: never[]; - must_not: import("@kbn/es-query").Filter[]; + must_not: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; }; - luceneStringToDsl: typeof import("@kbn/es-query").luceneStringToDsl; - decorateQuery: typeof import("@kbn/es-query").decorateQuery; + luceneStringToDsl: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").luceneStringToDsl; + decorateQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").decorateQuery; } ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md index 7fd1914d1a4a59..ff7b4c3439f7c5 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md @@ -10,7 +10,7 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("@kbn/es-query").RangeFilter | undefined; +}): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter | undefined; ``` ## Parameters @@ -23,5 +23,5 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRan Returns: -`import("@kbn/es-query").RangeFilter | undefined` +`import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter | undefined` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md index dc206ceabefe27..34136dbd75e044 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md @@ -37,7 +37,7 @@ export declare class IndexPatternField implements IFieldType | [searchable](./kibana-plugin-plugins-data-public.indexpatternfield.searchable.md) | | boolean | | | [sortable](./kibana-plugin-plugins-data-public.indexpatternfield.sortable.md) | | boolean | | | [spec](./kibana-plugin-plugins-data-public.indexpatternfield.spec.md) | | FieldSpec | | -| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("@kbn/es-query").IFieldSubType | undefined | | +| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined | | | [type](./kibana-plugin-plugins-data-public.indexpatternfield.type.md) | | string | | | [visualizable](./kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md) | | boolean | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md index f5e25e3191f724..50a21c5c2db3a2 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md @@ -7,5 +7,5 @@ Signature: ```typescript -get subType(): import("@kbn/es-query").IFieldSubType | undefined; +get subType(): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined; ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md index 9afcef6afed3ae..3d34148d42b9e3 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md @@ -19,7 +19,7 @@ toJSON(): { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("@kbn/es-query").IFieldSubType | undefined; + subType: import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined; customLabel: string | undefined; }; ``` @@ -37,7 +37,7 @@ toJSON(): { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("@kbn/es-query").IFieldSubType | undefined; + subType: import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined; customLabel: string | undefined; }` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md index 9006b088993a14..c166bb9e6a2fba 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md @@ -8,14 +8,14 @@ ```typescript esFilters: { - buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; - buildCustomFilter: typeof import("@kbn/es-query").buildCustomFilter; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; - buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; - buildFilter: typeof import("@kbn/es-query").buildFilter; - buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; - buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; - buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; - isFilterDisabled: (filter: import("@kbn/es-query").Filter) => boolean; + buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; + buildCustomFilter: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildCustomFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; + buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; + buildFilter: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildFilter; + buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; + buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; + buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase, formattedValue?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; + isFilterDisabled: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => boolean; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md index 4989b2b5ad5844..118ba4a433f2a3 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md @@ -8,8 +8,8 @@ ```typescript esKuery: { - nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; - toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode; + toElasticsearchQuery: (node: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md index 8dfea00081d890..8c02476782ab84 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md @@ -8,13 +8,13 @@ ```typescript esQuery: { - buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("@kbn/es-query").Filter[]; + filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; should: never[]; - must_not: import("@kbn/es-query").Filter[]; + must_not: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; }; getEsQueryConfig: typeof getEsQueryConfig; - buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; + buildEsQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildEsQuery; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md index 7f2267aff7049e..7f0f08da2892f5 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md @@ -10,7 +10,7 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("@kbn/es-query").RangeFilter | undefined; +}): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter | undefined; ``` ## Parameters @@ -23,5 +23,5 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRan Returns: -`import("@kbn/es-query").RangeFilter | undefined` +`import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter | undefined` diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index 33113076c7247c..d135041b448b26 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -276,7 +276,7 @@ export class AggConfigs { getResponseAggById(id: string): AggConfig | undefined; getResponseAggs(): AggConfig[]; // (undocumented) - getSearchSourceTimeFilter(forceNow?: Date): import("@kbn/es-query").RangeFilter[] | { + getSearchSourceTimeFilter(forceNow?: Date): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter[] | { meta: { index: string | undefined; params: {}; @@ -816,23 +816,23 @@ export type EsdslExpressionFunctionDefinition = ExpressionFunctionDefinition JSX.Element; FilterItem: (props: import("./ui/filter_bar/filter_item").FilterItemProps) => JSX.Element; - FILTERS: typeof import("@kbn/es-query").FILTERS; + FILTERS: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").FILTERS; FilterStateStore: typeof FilterStateStore; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; - buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; - buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; - buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; - buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; - buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; - isPhraseFilter: (filter: any) => filter is import("@kbn/es-query").PhraseFilter; - isExistsFilter: (filter: any) => filter is import("@kbn/es-query").ExistsFilter; - isPhrasesFilter: (filter: any) => filter is import("@kbn/es-query").PhrasesFilter; - isRangeFilter: (filter: any) => filter is import("@kbn/es-query").RangeFilter; - isMatchAllFilter: (filter: any) => filter is import("@kbn/es-query").MatchAllFilter; - isMissingFilter: (filter: any) => filter is import("@kbn/es-query").MissingFilter; - isQueryStringFilter: (filter: any) => filter is import("@kbn/es-query").QueryStringFilter; - isFilterPinned: (filter: import("@kbn/es-query").Filter) => boolean | undefined; - toggleFilterNegated: (filter: import("@kbn/es-query").Filter) => { + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; + buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; + buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; + buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; + buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase, formattedValue?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; + isPhraseFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; + isExistsFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; + isPhrasesFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; + isRangeFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; + isMatchAllFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").MatchAllFilter; + isMissingFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").MissingFilter; + isQueryStringFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; + isFilterPinned: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => boolean | undefined; + toggleFilterNegated: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => { meta: { negate: boolean; alias: string | null; @@ -845,20 +845,20 @@ export const esFilters: { params?: any; value?: string | undefined; }; - $state?: import("@kbn/es-query/target_types/filters/types").FilterState | undefined; + $state?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/filters/types").FilterState | undefined; query?: any; }; - disableFilter: (filter: import("@kbn/es-query").Filter) => import("@kbn/es-query").Filter; - getPhraseFilterField: (filter: import("@kbn/es-query").PhraseFilter) => string; - getPhraseFilterValue: (filter: import("@kbn/es-query").PhraseFilter) => string | number | boolean; + disableFilter: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; + getPhraseFilterField: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter) => string; + getPhraseFilterValue: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter) => string | number | boolean; getDisplayValueFromFilter: typeof getDisplayValueFromFilter; - compareFilters: (first: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], second: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; + compareFilters: (first: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter | import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[], second: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter | import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions; generateFilters: typeof generateFilters; - onlyDisabledFiltersChanged: (newFilters?: import("@kbn/es-query").Filter[] | undefined, oldFilters?: import("@kbn/es-query").Filter[] | undefined) => boolean; + onlyDisabledFiltersChanged: (newFilters?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, oldFilters?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined) => boolean; changeTimeFilter: typeof changeTimeFilter; convertRangeFilterToTimeRangeString: typeof convertRangeFilterToTimeRangeString; - mapAndFlattenFilters: (filters: import("@kbn/es-query").Filter[]) => import("@kbn/es-query").Filter[]; + mapAndFlattenFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; extractTimeFilter: typeof extractTimeFilter; extractTimeRange: typeof extractTimeRange; }; @@ -867,25 +867,25 @@ export const esFilters: { // // @public @deprecated (undocumented) export const esKuery: { - nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; - toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode; + toElasticsearchQuery: (node: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; }; // Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public @deprecated (undocumented) export const esQuery: { - buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; + buildEsQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildEsQuery; getEsQueryConfig: typeof getEsQueryConfig; - buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("@kbn/es-query").Filter[]; + filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; should: never[]; - must_not: import("@kbn/es-query").Filter[]; + must_not: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; }; - luceneStringToDsl: typeof import("@kbn/es-query").luceneStringToDsl; - decorateQuery: typeof import("@kbn/es-query").decorateQuery; + luceneStringToDsl: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").luceneStringToDsl; + decorateQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").decorateQuery; }; // Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -1160,7 +1160,7 @@ export function getSearchParamsFromRequest(searchRequest: SearchRequest, depende export function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("@kbn/es-query").RangeFilter | undefined; +}): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter | undefined; // Warning: (ae-missing-release-tag) "IAggConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1550,7 +1550,7 @@ export class IndexPatternField implements IFieldType { // (undocumented) readonly spec: FieldSpec; // (undocumented) - get subType(): import("@kbn/es-query").IFieldSubType | undefined; + get subType(): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined; // (undocumented) toJSON(): { count: number; @@ -1564,7 +1564,7 @@ export class IndexPatternField implements IFieldType { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("@kbn/es-query").IFieldSubType | undefined; + subType: import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined; customLabel: string | undefined; }; // (undocumented) diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 8616343c1154ce..49352dd240be78 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -450,38 +450,38 @@ export type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<'e // // @public (undocumented) export const esFilters: { - buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; - buildCustomFilter: typeof import("@kbn/es-query").buildCustomFilter; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; - buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; - buildFilter: typeof import("@kbn/es-query").buildFilter; - buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; - buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; - buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; - isFilterDisabled: (filter: import("@kbn/es-query").Filter) => boolean; + buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; + buildCustomFilter: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildCustomFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; + buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; + buildFilter: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildFilter; + buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; + buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; + buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase, formattedValue?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; + isFilterDisabled: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => boolean; }; // Warning: (ae-missing-release-tag) "esKuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const esKuery: { - nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; - toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode; + toElasticsearchQuery: (node: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; }; // Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const esQuery: { - buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("@kbn/es-query").Filter[]; + filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; should: never[]; - must_not: import("@kbn/es-query").Filter[]; + must_not: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; }; getEsQueryConfig: typeof getEsQueryConfig; - buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; + buildEsQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildEsQuery; }; // Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -621,7 +621,7 @@ export function getShardTimeout(config: SharedGlobalConfig_2): Pick): { From b6a0734aa11b8089ad8e80933c7e9c1717a9b098 Mon Sep 17 00:00:00 2001 From: Liza K Date: Wed, 21 Jul 2021 14:41:16 +0200 Subject: [PATCH 52/52] doc --- ...ic.aggconfigs.getsearchsourcetimefilter.md | 4 +- ...na-plugin-plugins-data-public.esfilters.md | 46 ++++++------ ...bana-plugin-plugins-data-public.eskuery.md | 6 +- ...bana-plugin-plugins-data-public.esquery.md | 12 ++-- ...bana-plugin-plugins-data-public.gettime.md | 4 +- ...n-plugins-data-public.indexpatternfield.md | 2 +- ...s-data-public.indexpatternfield.subtype.md | 2 +- ...ns-data-public.indexpatternfield.tojson.md | 4 +- ...na-plugin-plugins-data-server.esfilters.md | 18 ++--- ...bana-plugin-plugins-data-server.eskuery.md | 6 +- ...bana-plugin-plugins-data-server.esquery.md | 8 +-- ...bana-plugin-plugins-data-server.gettime.md | 4 +- src/plugins/data/public/public.api.md | 72 +++++++++---------- src/plugins/data/server/server.api.md | 34 ++++----- 14 files changed, 111 insertions(+), 111 deletions(-) diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md index db6faf2e0d0f70..9ebc685f2a77d6 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.getsearchsourcetimefilter.md @@ -7,7 +7,7 @@ Signature: ```typescript -getSearchSourceTimeFilter(forceNow?: Date): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter[] | { +getSearchSourceTimeFilter(forceNow?: Date): import("@kbn/es-query").RangeFilter[] | { meta: { index: string | undefined; params: {}; @@ -43,7 +43,7 @@ getSearchSourceTimeFilter(forceNow?: Date): import("../../../../../../bazel-out/ Returns: -`import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter[] | { +`import("@kbn/es-query").RangeFilter[] | { meta: { index: string | undefined; params: {}; diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md index 61ccf44d57386f..eb06d994261974 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md @@ -10,23 +10,23 @@ esFilters: { FilterLabel: (props: import("./ui/filter_bar/filter_editor/lib/filter_label").FilterLabelProps) => JSX.Element; FilterItem: (props: import("./ui/filter_bar/filter_item").FilterItemProps) => JSX.Element; - FILTERS: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").FILTERS; + FILTERS: typeof import("@kbn/es-query").FILTERS; FilterStateStore: typeof FilterStateStore; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; - buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; - buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; - buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase, formattedValue?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; - isPhraseFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; - isExistsFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; - isPhrasesFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - isRangeFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; - isMatchAllFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").MatchAllFilter; - isMissingFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").MissingFilter; - isQueryStringFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - isFilterPinned: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => boolean | undefined; - toggleFilterNegated: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => { + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isPhraseFilter: (filter: any) => filter is import("@kbn/es-query").PhraseFilter; + isExistsFilter: (filter: any) => filter is import("@kbn/es-query").ExistsFilter; + isPhrasesFilter: (filter: any) => filter is import("@kbn/es-query").PhrasesFilter; + isRangeFilter: (filter: any) => filter is import("@kbn/es-query").RangeFilter; + isMatchAllFilter: (filter: any) => filter is import("@kbn/es-query").MatchAllFilter; + isMissingFilter: (filter: any) => filter is import("@kbn/es-query").MissingFilter; + isQueryStringFilter: (filter: any) => filter is import("@kbn/es-query").QueryStringFilter; + isFilterPinned: (filter: import("@kbn/es-query").Filter) => boolean | undefined; + toggleFilterNegated: (filter: import("@kbn/es-query").Filter) => { meta: { negate: boolean; alias: string | null; @@ -39,20 +39,20 @@ esFilters: { params?: any; value?: string | undefined; }; - $state?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/filters/types").FilterState | undefined; + $state?: import("@kbn/es-query/target_types/filters/types").FilterState | undefined; query?: any; }; - disableFilter: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; - getPhraseFilterField: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter) => string; - getPhraseFilterValue: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter) => string | number | boolean; + disableFilter: (filter: import("@kbn/es-query").Filter) => import("@kbn/es-query").Filter; + getPhraseFilterField: (filter: import("@kbn/es-query").PhraseFilter) => string; + getPhraseFilterValue: (filter: import("@kbn/es-query").PhraseFilter) => string | number | boolean; getDisplayValueFromFilter: typeof getDisplayValueFromFilter; - compareFilters: (first: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter | import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[], second: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter | import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; + compareFilters: (first: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], second: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions; generateFilters: typeof generateFilters; - onlyDisabledFiltersChanged: (newFilters?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, oldFilters?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined) => boolean; + onlyDisabledFiltersChanged: (newFilters?: import("@kbn/es-query").Filter[] | undefined, oldFilters?: import("@kbn/es-query").Filter[] | undefined) => boolean; changeTimeFilter: typeof changeTimeFilter; convertRangeFilterToTimeRangeString: typeof convertRangeFilterToTimeRangeString; - mapAndFlattenFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; + mapAndFlattenFilters: (filters: import("@kbn/es-query").Filter[]) => import("@kbn/es-query").Filter[]; extractTimeFilter: typeof extractTimeFilter; extractTimeRange: typeof extractTimeRange; } diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md index 0552118c8d6a2a..6ed9898ddd7187 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md @@ -13,8 +13,8 @@ ```typescript esKuery: { - nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode; - toElasticsearchQuery: (node: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; } ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md index fbb538b9471a46..fa2ee4faa74665 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md @@ -13,15 +13,15 @@ ```typescript esQuery: { - buildEsQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildEsQuery; + buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; getEsQueryConfig: typeof getEsQueryConfig; - buildQueryFromFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; - luceneStringToDsl: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").luceneStringToDsl; - decorateQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").decorateQuery; + luceneStringToDsl: typeof import("@kbn/es-query").luceneStringToDsl; + decorateQuery: typeof import("@kbn/es-query").decorateQuery; } ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md index ff7b4c3439f7c5..7fd1914d1a4a59 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md @@ -10,7 +10,7 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter | undefined; +}): import("@kbn/es-query").RangeFilter | undefined; ``` ## Parameters @@ -23,5 +23,5 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRan Returns: -`import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter | undefined` +`import("@kbn/es-query").RangeFilter | undefined` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md index 34136dbd75e044..dc206ceabefe27 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md @@ -37,7 +37,7 @@ export declare class IndexPatternField implements IFieldType | [searchable](./kibana-plugin-plugins-data-public.indexpatternfield.searchable.md) | | boolean | | | [sortable](./kibana-plugin-plugins-data-public.indexpatternfield.sortable.md) | | boolean | | | [spec](./kibana-plugin-plugins-data-public.indexpatternfield.spec.md) | | FieldSpec | | -| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined | | +| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("@kbn/es-query").IFieldSubType | undefined | | | [type](./kibana-plugin-plugins-data-public.indexpatternfield.type.md) | | string | | | [visualizable](./kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md) | | boolean | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md index 50a21c5c2db3a2..f5e25e3191f724 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md @@ -7,5 +7,5 @@ Signature: ```typescript -get subType(): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined; +get subType(): import("@kbn/es-query").IFieldSubType | undefined; ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md index 3d34148d42b9e3..9afcef6afed3ae 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md @@ -19,7 +19,7 @@ toJSON(): { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined; + subType: import("@kbn/es-query").IFieldSubType | undefined; customLabel: string | undefined; }; ``` @@ -37,7 +37,7 @@ toJSON(): { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined; + subType: import("@kbn/es-query").IFieldSubType | undefined; customLabel: string | undefined; }` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md index c166bb9e6a2fba..9006b088993a14 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md @@ -8,14 +8,14 @@ ```typescript esFilters: { - buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - buildCustomFilter: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildCustomFilter; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; - buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; - buildFilter: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildFilter; - buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; - buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase, formattedValue?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; - isFilterDisabled: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => boolean; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; + buildCustomFilter: typeof import("@kbn/es-query").buildCustomFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; + buildFilter: typeof import("@kbn/es-query").buildFilter; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isFilterDisabled: (filter: import("@kbn/es-query").Filter) => boolean; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md index 118ba4a433f2a3..4989b2b5ad5844 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md @@ -8,8 +8,8 @@ ```typescript esKuery: { - nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode; - toElasticsearchQuery: (node: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md index 8c02476782ab84..8dfea00081d890 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md @@ -8,13 +8,13 @@ ```typescript esQuery: { - buildQueryFromFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; getEsQueryConfig: typeof getEsQueryConfig; - buildEsQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildEsQuery; + buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; } ``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md index 7f0f08da2892f5..7f2267aff7049e 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.gettime.md @@ -10,7 +10,7 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter | undefined; +}): import("@kbn/es-query").RangeFilter | undefined; ``` ## Parameters @@ -23,5 +23,5 @@ export declare function getTime(indexPattern: IIndexPattern | undefined, timeRan Returns: -`import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter | undefined` +`import("@kbn/es-query").RangeFilter | undefined` diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index d135041b448b26..33113076c7247c 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -276,7 +276,7 @@ export class AggConfigs { getResponseAggById(id: string): AggConfig | undefined; getResponseAggs(): AggConfig[]; // (undocumented) - getSearchSourceTimeFilter(forceNow?: Date): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter[] | { + getSearchSourceTimeFilter(forceNow?: Date): import("@kbn/es-query").RangeFilter[] | { meta: { index: string | undefined; params: {}; @@ -816,23 +816,23 @@ export type EsdslExpressionFunctionDefinition = ExpressionFunctionDefinition JSX.Element; FilterItem: (props: import("./ui/filter_bar/filter_item").FilterItemProps) => JSX.Element; - FILTERS: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").FILTERS; + FILTERS: typeof import("@kbn/es-query").FILTERS; FilterStateStore: typeof FilterStateStore; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; - buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; - buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; - buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase, formattedValue?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; - isPhraseFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; - isExistsFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; - isPhrasesFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - isRangeFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; - isMatchAllFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").MatchAllFilter; - isMissingFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").MissingFilter; - isQueryStringFilter: (filter: any) => filter is import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - isFilterPinned: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => boolean | undefined; - toggleFilterNegated: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => { + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isPhraseFilter: (filter: any) => filter is import("@kbn/es-query").PhraseFilter; + isExistsFilter: (filter: any) => filter is import("@kbn/es-query").ExistsFilter; + isPhrasesFilter: (filter: any) => filter is import("@kbn/es-query").PhrasesFilter; + isRangeFilter: (filter: any) => filter is import("@kbn/es-query").RangeFilter; + isMatchAllFilter: (filter: any) => filter is import("@kbn/es-query").MatchAllFilter; + isMissingFilter: (filter: any) => filter is import("@kbn/es-query").MissingFilter; + isQueryStringFilter: (filter: any) => filter is import("@kbn/es-query").QueryStringFilter; + isFilterPinned: (filter: import("@kbn/es-query").Filter) => boolean | undefined; + toggleFilterNegated: (filter: import("@kbn/es-query").Filter) => { meta: { negate: boolean; alias: string | null; @@ -845,20 +845,20 @@ export const esFilters: { params?: any; value?: string | undefined; }; - $state?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/filters/types").FilterState | undefined; + $state?: import("@kbn/es-query/target_types/filters/types").FilterState | undefined; query?: any; }; - disableFilter: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; - getPhraseFilterField: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter) => string; - getPhraseFilterValue: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter) => string | number | boolean; + disableFilter: (filter: import("@kbn/es-query").Filter) => import("@kbn/es-query").Filter; + getPhraseFilterField: (filter: import("@kbn/es-query").PhraseFilter) => string; + getPhraseFilterValue: (filter: import("@kbn/es-query").PhraseFilter) => string | number | boolean; getDisplayValueFromFilter: typeof getDisplayValueFromFilter; - compareFilters: (first: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter | import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[], second: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter | import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; + compareFilters: (first: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], second: import("@kbn/es-query").Filter | import("@kbn/es-query").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean; COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions; generateFilters: typeof generateFilters; - onlyDisabledFiltersChanged: (newFilters?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, oldFilters?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined) => boolean; + onlyDisabledFiltersChanged: (newFilters?: import("@kbn/es-query").Filter[] | undefined, oldFilters?: import("@kbn/es-query").Filter[] | undefined) => boolean; changeTimeFilter: typeof changeTimeFilter; convertRangeFilterToTimeRangeString: typeof convertRangeFilterToTimeRangeString; - mapAndFlattenFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; + mapAndFlattenFilters: (filters: import("@kbn/es-query").Filter[]) => import("@kbn/es-query").Filter[]; extractTimeFilter: typeof extractTimeFilter; extractTimeRange: typeof extractTimeRange; }; @@ -867,25 +867,25 @@ export const esFilters: { // // @public @deprecated (undocumented) export const esKuery: { - nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode; - toElasticsearchQuery: (node: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; }; // Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public @deprecated (undocumented) export const esQuery: { - buildEsQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildEsQuery; + buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; getEsQueryConfig: typeof getEsQueryConfig; - buildQueryFromFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; - luceneStringToDsl: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").luceneStringToDsl; - decorateQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").decorateQuery; + luceneStringToDsl: typeof import("@kbn/es-query").luceneStringToDsl; + decorateQuery: typeof import("@kbn/es-query").decorateQuery; }; // Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -1160,7 +1160,7 @@ export function getSearchParamsFromRequest(searchRequest: SearchRequest, depende export function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, options?: { forceNow?: Date; fieldName?: string; -}): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter | undefined; +}): import("@kbn/es-query").RangeFilter | undefined; // Warning: (ae-missing-release-tag) "IAggConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1550,7 +1550,7 @@ export class IndexPatternField implements IFieldType { // (undocumented) readonly spec: FieldSpec; // (undocumented) - get subType(): import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined; + get subType(): import("@kbn/es-query").IFieldSubType | undefined; // (undocumented) toJSON(): { count: number; @@ -1564,7 +1564,7 @@ export class IndexPatternField implements IFieldType { searchable: boolean; aggregatable: boolean; readFromDocValues: boolean; - subType: import("../../../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IFieldSubType | undefined; + subType: import("@kbn/es-query").IFieldSubType | undefined; customLabel: string | undefined; }; // (undocumented) diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 49352dd240be78..8616343c1154ce 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -450,38 +450,38 @@ export type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<'e // // @public (undocumented) export const esFilters: { - buildQueryFilter: (query: any, index: string, alias: string) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").QueryStringFilter; - buildCustomFilter: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildCustomFilter; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter; - buildExistsFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").ExistsFilter; - buildFilter: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildFilter; - buildPhraseFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, value: any, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhraseFilter; - buildPhrasesFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: any[], indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").PhrasesFilter; - buildRangeFilter: (field: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternFieldBase, params: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilterParams, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase, formattedValue?: string | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").RangeFilter; - isFilterDisabled: (filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter) => boolean; + buildQueryFilter: (query: any, index: string, alias: string) => import("@kbn/es-query").QueryStringFilter; + buildCustomFilter: typeof import("@kbn/es-query").buildCustomFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("@kbn/es-query").Filter; + buildExistsFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").ExistsFilter; + buildFilter: typeof import("@kbn/es-query").buildFilter; + buildPhraseFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, value: any, indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhraseFilter; + buildPhrasesFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: any[], indexPattern: import("@kbn/es-query").IndexPatternBase) => import("@kbn/es-query").PhrasesFilter; + buildRangeFilter: (field: import("@kbn/es-query").IndexPatternFieldBase, params: import("@kbn/es-query").RangeFilterParams, indexPattern: import("@kbn/es-query").IndexPatternBase, formattedValue?: string | undefined) => import("@kbn/es-query").RangeFilter; + isFilterDisabled: (filter: import("@kbn/es-query").Filter) => boolean; }; // Warning: (ae-missing-release-tag) "esKuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const esKuery: { - nodeTypes: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types/kuery/node_types").NodeTypes; - fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode; - toElasticsearchQuery: (node: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").KueryNode, indexPattern?: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; + nodeTypes: import("@kbn/es-query/target_types/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial | undefined) => import("@kbn/es-query").KueryNode; + toElasticsearchQuery: (node: import("@kbn/es-query").KueryNode, indexPattern?: import("@kbn/es-query").IndexPatternBase | undefined, config?: Record | undefined, context?: Record | undefined) => import("@kbn/common-utils").JsonObject; }; // Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const esQuery: { - buildQueryFromFilters: (filters: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[] | undefined, indexPattern: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { + buildQueryFromFilters: (filters: import("@kbn/es-query").Filter[] | undefined, indexPattern: import("@kbn/es-query").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; - filter: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; + filter: import("@kbn/es-query").Filter[]; should: never[]; - must_not: import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").Filter[]; + must_not: import("@kbn/es-query").Filter[]; }; getEsQueryConfig: typeof getEsQueryConfig; - buildEsQuery: typeof import("../../../../bazel-out/k8-fastbuild/bin/packages/kbn-es-query/target_types").buildEsQuery; + buildEsQuery: typeof import("@kbn/es-query").buildEsQuery; }; // Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -621,7 +621,7 @@ export function getShardTimeout(config: SharedGlobalConfig_2): Pick): {