From 2a233ceb198475183c4e8197f0bc37c7242d28ec Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Wed, 21 Jul 2021 17:10:55 +0200 Subject: [PATCH] [Es query] Move to package (#103530) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit May the forces of bootstrapping helps us 🙏🏻 😉 --- .i18nrc.json | 1 + ...ic.aggconfigs.getsearchsourcetimefilter.md | 4 +- ...plugin-plugins-data-public.customfilter.md | 9 +- ...na-plugin-plugins-data-public.esfilters.md | 46 +- ...bana-plugin-plugins-data-public.eskuery.md | 11 +- ...bana-plugin-plugins-data-public.esquery.md | 17 +- ...lic.esqueryconfig.allowleadingwildcards.md | 11 - ...-data-public.esqueryconfig.dateformattz.md | 11 - ...eryconfig.ignorefilteriffieldnotinindex.md | 11 - ...lugin-plugins-data-public.esqueryconfig.md | 19 +- ...public.esqueryconfig.querystringoptions.md | 11 - ...plugin-plugins-data-public.existsfilter.md | 10 +- ...ibana-plugin-plugins-data-public.filter.md | 11 +- ...ugins-data-public.filtermanager.extract.md | 11 + ...a-public.filtermanager.getallmigrations.md | 11 + ...lugins-data-public.filtermanager.inject.md | 11 + ...ta-public.filtermanager.migratetolatest.md | 11 + ...ins-data-public.filtermanager.telemetry.md | 11 + ...bana-plugin-plugins-data-public.gettime.md | 4 +- ...lugin-plugins-data-public.ifieldsubtype.md | 17 +- ...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 | 7 +- ...na-plugin-plugins-data-public.isfilters.md | 7 +- ...na-plugin-plugins-data-public.kuerynode.md | 16 +- ...ugin-plugins-data-public.kuerynode.type.md | 11 - ...ugin-plugins-data-public.matchallfilter.md | 10 +- .../kibana-plugin-plugins-data-public.md | 9 +- ...plugin-plugins-data-public.phrasefilter.md | 16 +- ...lugin-plugins-data-public.phrasesfilter.md | 9 +- ...kibana-plugin-plugins-data-public.query.md | 16 - ...-plugin-plugins-data-public.rangefilter.md | 17 +- ...gin-plugins-data-public.rangefiltermeta.md | 11 +- ...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 | 22 +- ...lugins-data-public.rangefilterparams.to.md | 11 - ...-plugins-data-public.searchsourcefields.md | 2 +- ...ns-data-public.searchsourcefields.query.md | 1 - ...na-plugin-plugins-data-server.esfilters.md | 18 +- ...bana-plugin-plugins-data-server.eskuery.md | 6 +- ...bana-plugin-plugins-data-server.esquery.md | 8 +- ...ver.esqueryconfig.allowleadingwildcards.md | 11 - ...-data-server.esqueryconfig.dateformattz.md | 11 - ...eryconfig.ignorefilteriffieldnotinindex.md | 11 - ...lugin-plugins-data-server.esqueryconfig.md | 19 +- ...server.esqueryconfig.querystringoptions.md | 11 - ...ibana-plugin-plugins-data-server.filter.md | 11 +- ...bana-plugin-plugins-data-server.gettime.md | 4 +- ...lugin-plugins-data-server.ifieldsubtype.md | 17 +- ...plugins-data-server.ifieldsubtype.multi.md | 13 - ...lugins-data-server.ifieldsubtype.nested.md | 13 - ...na-plugin-plugins-data-server.kuerynode.md | 16 +- ...ugin-plugins-data-server.kuerynode.type.md | 11 - .../kibana-plugin-plugins-data-server.md | 7 +- ...kibana-plugin-plugins-data-server.query.md | 16 - package.json | 5 +- packages/BUILD.bazel | 1 + packages/kbn-es-query/BUILD.bazel | 133 + packages/kbn-es-query/README.md | 3 + .../kbn-es-query/grammar/grammar.peggy | 9 +- 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 | 13 +- .../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 | 14 +- .../src}/es_query/filter_matches_index.ts | 0 .../src}/es_query/from_filters.test.ts | 8 +- .../src}/es_query/from_filters.ts | 0 .../src}/es_query/from_kuery.test.ts | 12 +- .../kbn-es-query/src}/es_query/from_kuery.ts | 2 +- .../src}/es_query/from_lucene.test.ts | 2 +- .../kbn-es-query/src}/es_query/from_lucene.ts | 2 +- .../es_query/handle_nested_filter.test.ts | 2 +- .../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 | 1 + .../src}/filters/build_filter.test.ts | 8 +- .../src}/filters/build_filters.ts | 6 +- .../src}/filters/custom_filter.ts | 2 +- .../src}/filters/exists_filter.test.ts | 8 +- .../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 | 8 +- .../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 | 23 +- .../src}/filters/phrase_filter.ts | 2 +- .../src}/filters/phrases_filter.test.ts | 8 +- .../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 | 20 +- .../kbn-es-query/src}/filters/range_filter.ts | 2 +- .../src}/filters/stubs/exists_filter.ts | 0 .../src/filters/stubs/fields.mocks.ts | 80 + .../kbn-es-query/src/filters/stubs/index.ts | 13 + .../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 | 44 + packages/kbn-es-query/src/index.ts | 11 + .../kbn-es-query/src}/kuery/ast/ast.test.ts | 12 +- .../kbn-es-query/src}/kuery/ast/ast.ts | 3 +- .../kbn-es-query/src}/kuery/ast/index.ts | 0 .../src}/kuery/functions/and.test.ts | 14 +- .../kbn-es-query/src}/kuery/functions/and.ts | 2 +- .../src}/kuery/functions/exists.test.ts | 12 +- .../src}/kuery/functions/exists.ts | 2 +- .../kuery/functions/geo_bounding_box.test.ts | 13 +- .../src}/kuery/functions/geo_bounding_box.ts | 2 +- .../src}/kuery/functions/geo_polygon.test.ts | 13 +- .../src}/kuery/functions/geo_polygon.ts | 2 +- .../src}/kuery/functions/index.ts | 0 .../src}/kuery/functions/is.test.ts | 13 +- .../kbn-es-query/src}/kuery/functions/is.ts | 2 +- .../src}/kuery/functions/nested.test.ts | 13 +- .../src}/kuery/functions/nested.ts | 2 +- .../src}/kuery/functions/not.test.ts | 14 +- .../kbn-es-query/src}/kuery/functions/not.ts | 2 +- .../src}/kuery/functions/or.test.ts | 12 +- .../kbn-es-query/src}/kuery/functions/or.ts | 2 +- .../src}/kuery/functions/range.test.ts | 12 +- .../src}/kuery/functions/range.ts | 2 +- .../kuery/functions/utils/get_fields.test.ts | 6 +- .../src}/kuery/functions/utils/get_fields.ts | 2 +- .../utils/get_full_field_name_node.test.ts | 14 +- .../utils/get_full_field_name_node.ts | 2 +- .../src/kuery/grammar/__mocks__/grammar.js | 2219 ++++++++++++++ .../src/kuery/grammar/__mocks__/index.ts | 9 + .../kbn-es-query/src/kuery/grammar/index.ts | 10 + .../kbn-es-query/src}/kuery/index.ts | 5 +- .../src}/kuery/kuery_syntax_error.test.ts | 12 +- .../src}/kuery/kuery_syntax_error.ts | 38 +- .../src}/kuery/node_types/function.test.ts | 13 +- .../src}/kuery/node_types/function.ts | 2 +- .../src}/kuery/node_types/index.ts | 0 .../src}/kuery/node_types/literal.test.ts | 2 + .../src}/kuery/node_types/literal.ts | 0 .../src}/kuery/node_types/named_arg.test.ts | 4 +- .../src}/kuery/node_types/named_arg.ts | 0 .../kuery/node_types/node_builder.test.ts | 2 + .../src}/kuery/node_types/node_builder.ts | 0 .../src}/kuery/node_types/types.ts | 0 .../src}/kuery/node_types/wildcard.test.ts | 2 + .../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.browser.json | 21 + packages/kbn-es-query/tsconfig.json | 23 + .../service/lib/repository.test.js | 1 - .../get_es_query_config.test.ts | 2 +- .../{es_query => }/get_es_query_config.ts | 8 +- src/plugins/data/common/es_query/index.ts | 358 ++- .../es_query/kuery/ast/_generated_/kuery.js | 2635 ----------------- .../common/es_query/stubs/exists_filter.ts | 23 + .../es_query/{filters => }/stubs/index.ts | 0 .../common/es_query/stubs/phrase_filter.ts | 27 + .../common/es_query/stubs/phrases_filter.ts | 25 + .../common/es_query/stubs/range_filter.ts | 29 + .../common/index_patterns/fields/types.ts | 3 +- .../data/common/index_patterns/types.ts | 2 +- .../query/filter_manager/compare_filters.ts | 2 +- .../common/query/persistable_state.test.ts | 2 +- .../data/common/query/persistable_state.ts | 2 +- .../data/common/query/timefilter/get_time.ts | 3 +- src/plugins/data/common/query/types.ts | 6 +- .../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 +- .../expressions/esaggs/create_filter.test.ts | 2 +- .../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 +- .../create_search_source.test.ts | 2 +- .../search_source/extract_references.ts | 2 +- .../search/search_source/search_source.ts | 3 +- .../data/common/search/tabify/types.ts | 2 +- src/plugins/data/common/stubs.ts | 2 +- src/plugins/data/common/types.ts | 6 + .../data/public/actions/value_click_action.ts | 2 +- .../providers/kql_query_suggestion/types.ts | 2 +- src/plugins/data/public/index.ts | 62 +- src/plugins/data/public/public.api.md | 356 +-- .../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 +- .../query/state_sync/sync_state_with_url.ts | 2 +- .../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 +- .../filter_editor/lib/filter_operators.ts | 2 +- .../data/public/ui/filter_bar/filter_item.tsx | 14 +- .../ui/filter_bar/filter_view/index.tsx | 2 +- src/plugins/data/server/index.ts | 34 +- src/plugins/data/server/server.api.md | 168 +- .../request_processors/annotations/types.ts | 2 +- .../response_processors/series/math.test.js | 2 +- .../vis_type_timeseries/server/types.ts | 11 +- .../vis_type_vega/public/data_model/types.ts | 4 +- tasks/config/peg.js | 8 - .../apis/saved_objects/find.ts | 2 +- .../server/alerts_client/tests/find.test.ts | 2 +- .../alerting_authorization_kuery.ts | 3 +- .../VisitorBreakdownMap/useMapFilters.ts | 2 +- .../log_entries/log_entries.ts | 2 +- .../log_stream/log_stream_error_boundary.tsx | 2 +- .../indexpattern_datasource/datapanel.tsx | 3 +- .../server/services/utils/get_query_filter.ts | 2 +- .../spatial_filter_utils.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 +- x-pack/plugins/osquery/common/typed_json.ts | 3 +- .../detection_engine/get_query_filter.ts | 10 +- .../search_strategy/index_fields/index.ts | 9 +- .../security_solution/common/typed_json.ts | 2 +- .../public/common/mock/index_pattern.ts | 2 +- .../public/common/mock/timeline_results.ts | 2 +- .../public/common/store/sourcerer/model.ts | 2 +- .../components/alerts_table/actions.tsx | 5 +- .../rules/autocomplete_field/index.tsx | 2 +- .../detection_engine/rules/api.test.ts | 2 +- .../timelines/components/timeline/helpers.tsx | 8 +- .../detection_engine/reference_rules/query.ts | 3 +- .../lib/detection_engine/signals/types.ts | 2 +- .../geo_containment/es_query_builder.ts | 8 +- .../search_strategy/index_fields/index.ts | 10 +- x-pack/plugins/timelines/common/typed_json.ts | 2 +- .../common/types/timeline/columns/index.ts | 3 +- .../public/components/t_grid/helpers.tsx | 8 +- .../public/components/utils/keury/index.ts | 10 +- .../translations/translations/ja-JP.json | 12 +- .../translations/translations/zh-CN.json | 12 +- yarn.lock | 12 +- 287 files changed, 3983 insertions(+), 3955 deletions(-) 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.querystringoptions.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.extract.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getallmigrations.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.inject.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.migratetolatest.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.telemetry.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.kuerynode.type.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.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.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.querystringoptions.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.type.md delete mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.md create mode 100644 packages/kbn-es-query/BUILD.bazel create mode 100644 packages/kbn-es-query/README.md rename src/plugins/data/common/es_query/kuery/ast/kuery.peg => packages/kbn-es-query/grammar/grammar.peggy (95%) 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 (95%) 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 (92%) 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 (96%) 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 (91%) 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 (98%) 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 (98%) 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 (92%) 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 (98%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/build_filter.test.ts (94%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/filters/build_filters.ts (94%) 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 (81%) 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 (87%) 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 (89%) 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 (85%) 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 (82%) 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 (88%) 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%) create mode 100644 packages/kbn-es-query/src/filters/stubs/fields.mocks.ts create mode 100644 packages/kbn-es-query/src/filters/stubs/index.ts 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 (59%) create mode 100644 packages/kbn-es-query/src/index.ts rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/ast/ast.test.ts (98%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/ast/ast.ts (96%) 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/functions/and.test.ts (88%) 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 (92%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/exists.ts (93%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/geo_bounding_box.test.ts (94%) 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 (94%) 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 (97%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/is.ts (99%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/nested.test.ts (90%) 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 (87%) 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 (90%) 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 (96%) 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 (97%) 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 (92%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/functions/utils/get_full_field_name_node.ts (99%) create mode 100644 packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js create mode 100644 packages/kbn-es-query/src/kuery/grammar/__mocks__/index.ts create mode 100644 packages/kbn-es-query/src/kuery/grammar/index.ts rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/index.ts (80%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/kuery_syntax_error.test.ts (89%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/kuery_syntax_error.ts (59%) rename {src/plugins/data/common/es_query => packages/kbn-es-query/src}/kuery/node_types/function.test.ts (91%) 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 (97%) 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 (98%) 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 (99%) 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 (99%) 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.browser.json create mode 100644 packages/kbn-es-query/tsconfig.json rename src/plugins/data/common/es_query/{es_query => }/get_es_query_config.test.ts (97%) rename src/plugins/data/common/es_query/{es_query => }/get_es_query_config.ts (82%) delete mode 100644 src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js create mode 100644 src/plugins/data/common/es_query/stubs/exists_filter.ts rename src/plugins/data/common/es_query/{filters => }/stubs/index.ts (100%) 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 732644b43e1f7..963d01486282f 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -28,6 +28,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/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 1f8bc1300a0a8..9ebc685f2a77d 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 index 0a3b4e54cfe55..6763a8d2ba0bf 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 @@ -4,10 +4,13 @@ ## CustomFilter type +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -export declare type CustomFilter = Filter & { - query: any; -}; +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 d06ce1b2ef2bc..eb06d99426197 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("../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 332114e637586..6ed9898ddd718 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,12 +4,17 @@ ## esKuery variable +> Warning: This API is now obsolete. +> +> Please import helpers from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```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 0bc9c0c12fc3a..fa2ee4faa7466 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,19 +4,24 @@ ## esQuery variable +> Warning: This API is now obsolete. +> +> Please import helpers from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript esQuery: { - buildEsQuery: typeof buildEsQuery; + buildEsQuery: typeof import("@kbn/es-query").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; + 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.allowleadingwildcards.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md deleted file mode 100644 index 71eb23ac6299b..0000000000000 --- 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 e9c4c26878a97..0000000000000 --- 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 9f765c51d0a69..0000000000000 --- 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 index 5252f8058b488..4480329c2df19 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 @@ -2,20 +2,15 @@ [Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) -## EsQueryConfig interface +## EsQueryConfig type + +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> Signature: ```typescript -export interface EsQueryConfig +declare type EsQueryConfig = oldEsQueryConfig; ``` - -## 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 feaa8f1821e30..0000000000000 --- 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 index f1279934db84c..ab756295eac8c 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 @@ -4,11 +4,13 @@ ## ExistsFilter type +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -export declare type ExistsFilter = Filter & { - meta: ExistsFilterMeta; - exists?: FilterExistsProperty; -}; +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 index 9212b757e07df..bf8d4ced016a3 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 @@ -4,12 +4,13 @@ ## Filter type +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -export declare type Filter = { - $state?: FilterState; - meta: FilterMeta; - query?: any; -}; +declare type Filter = oldFilter; ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.extract.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.extract.md new file mode 100644 index 0000000000000..60ea060cf6323 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.extract.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [extract](./kibana-plugin-plugins-data-public.filtermanager.extract.md) + +## FilterManager.extract property + +Signature: + +```typescript +extract: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getallmigrations.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getallmigrations.md new file mode 100644 index 0000000000000..0d46d806f0563 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getallmigrations.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [getAllMigrations](./kibana-plugin-plugins-data-public.filtermanager.getallmigrations.md) + +## FilterManager.getAllMigrations property + +Signature: + +```typescript +getAllMigrations: () => {}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.inject.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.inject.md new file mode 100644 index 0000000000000..0e3b84cd3cf80 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.inject.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [inject](./kibana-plugin-plugins-data-public.filtermanager.inject.md) + +## FilterManager.inject property + +Signature: + +```typescript +inject: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.migratetolatest.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.migratetolatest.md new file mode 100644 index 0000000000000..2235c55947865 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.migratetolatest.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [migrateToLatest](./kibana-plugin-plugins-data-public.filtermanager.migratetolatest.md) + +## FilterManager.migrateToLatest property + +Signature: + +```typescript +migrateToLatest: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.telemetry.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.telemetry.md new file mode 100644 index 0000000000000..bab6452c34903 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.telemetry.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [telemetry](./kibana-plugin-plugins-data-public.filtermanager.telemetry.md) + +## FilterManager.telemetry property + +Signature: + +```typescript +telemetry: (filters: import("../../../../kibana_utils/common/persistable_state").SerializableState, collector: unknown) => {}; +``` 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 3969a97fa7789..7fd1914d1a4a5 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 index 7e6ea86d7f3e8..d5d8a0b62d3c5 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 @@ -2,18 +2,15 @@ [Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) -## IFieldSubType interface +## IFieldSubType type + +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> Signature: ```typescript -export interface IFieldSubType +declare type IFieldSubType = oldIFieldSubType; ``` - -## 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 6cfc6f037d013..0000000000000 --- 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 f9308b90a1b96..0000000000000 --- 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 16546ceca958d..dc206ceabefe2 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 6cd5247291602..f5e25e3191f72 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 b77f3d1f374fb..9afcef6afed3a 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 index f1916e89c2c98..2848e20edde1b 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 @@ -4,8 +4,13 @@ ## isFilter variable +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -isFilter: (x: unknown) => x is Filter +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 index 558da72cc26bb..881d50b8a49e1 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 @@ -4,8 +4,13 @@ ## isFilters variable +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -isFilters: (x: unknown) => x is Filter[] +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 index 276f25da8cb9f..9cea144ff9d46 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 @@ -2,17 +2,15 @@ [Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) -## KueryNode interface +## KueryNode type + +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> Signature: ```typescript -export interface KueryNode +declare type KueryNode = oldKueryNode; ``` - -## 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 2ff96b6421c2e..0000000000000 --- 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 index 740b83bb5c563..39ae82865808c 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 @@ -4,11 +4,13 @@ ## MatchAllFilter type +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -export declare type MatchAllFilter = Filter & { - meta: MatchAllFilterMeta; - match_all: any; -}; +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 7c2911875ee05..e60e26bcb503e 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 @@ -62,11 +62,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) | | @@ -79,7 +77,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) | | @@ -87,7 +84,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) | | @@ -151,6 +147,7 @@ | [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) | | @@ -170,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) | | @@ -181,16 +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) | | -| [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) | | +| [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 index 8d0447d58634c..ca38ac25dcf50 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 @@ -4,17 +4,13 @@ ## PhraseFilter type +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -export declare type PhraseFilter = Filter & { - meta: PhraseFilterMeta; - script?: { - script: { - source?: any; - lang?: estypes.ScriptLanguage; - params: any; - }; - }; -}; +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 index ab205cb62fd14..0c293cb909276 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 @@ -4,10 +4,13 @@ ## PhrasesFilter type +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -export declare type PhrasesFilter = Filter & { - meta: PhrasesFilterMeta; -}; +declare type PhrasesFilter = oldPhrasesFilter; ``` 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 e15b04236a0b5..0000000000000 --- 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 index 1cb627ec3a8f9..3d9af100a707a 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 @@ -4,18 +4,13 @@ ## RangeFilter type +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -export declare type RangeFilter = Filter & EsRangeFilter & { - meta: RangeFilterMeta; - script?: { - script: { - params: any; - lang: estypes.ScriptLanguage; - source: any; - }; - }; - match_all?: any; -}; +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 index 609e98cb6faa8..4060a71e62cd0 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 @@ -4,12 +4,13 @@ ## RangeFilterMeta type +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -export declare type RangeFilterMeta = FilterMeta & { - params: RangeFilterParams; - field?: any; - formattedValue?: string; -}; +declare type RangeFilterMeta = oldRangeFilterMeta; ``` 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 15926481923ab..0000000000000 --- 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 99b8d75e9c316..0000000000000 --- 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 32bfc6eeb68cb..0000000000000 --- 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 81345e4a81610..0000000000000 --- 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 6250fecfe59d6..0000000000000 --- 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 c4f3cbf00b304..0000000000000 --- 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 index 977559f5e6cb2..cdf237ea5a1ec 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 @@ -2,23 +2,15 @@ [Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) -## RangeFilterParams interface +## RangeFilterParams type + +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> Signature: ```typescript -export interface RangeFilterParams +declare type RangeFilterParams = oldRangeFilterParams; ``` - -## 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 c9d0069fb75f5..0000000000000 --- 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.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md index 981d956a9e89b..22dc6fa9f627b 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 @@ -25,7 +25,7 @@ export interface SearchSourceFields | [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 661ce94a06afb..78bf800c58c20 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 594afcf9ee0dd..9006b088993a1 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; - buildCustomFilter: typeof buildCustomFilter; - buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; - buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").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; + 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 fce25a899de8e..4989b2b5ad584 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 68507f3fb9b81..8dfea00081d89 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("../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; + buildEsQuery: typeof import("@kbn/es-query").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 ce8303d720747..0000000000000 --- 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 d3e86f19709f8..0000000000000 --- 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 93b3e8915c482..0000000000000 --- 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 index 9ae604e07cabd..5c736f40cdbf4 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 @@ -2,20 +2,15 @@ [Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) -## EsQueryConfig interface +## EsQueryConfig type + +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> Signature: ```typescript -export interface EsQueryConfig +declare type EsQueryConfig = oldEsQueryConfig; ``` - -## 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 437d36112d015..0000000000000 --- 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 index 519bbaf8f9416..f46ff36277d93 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 @@ -4,12 +4,13 @@ ## Filter type +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> + Signature: ```typescript -export declare type Filter = { - $state?: FilterState; - meta: FilterMeta; - query?: any; -}; +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 54e7cf92f500c..7f2267aff7049 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 index 70140e51a7316..e8e872577b46b 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 @@ -2,18 +2,15 @@ [Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) -## IFieldSubType interface +## IFieldSubType type + +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> Signature: ```typescript -export interface IFieldSubType +declare type IFieldSubType = oldIFieldSubType; ``` - -## 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 31a3bc53d6343..0000000000000 --- 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 b53a4406aedc2..0000000000000 --- 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 index 3a258a5b98616..a5c14ee8627b1 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 @@ -2,17 +2,15 @@ [Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [KueryNode](./kibana-plugin-plugins-data-server.kuerynode.md) -## KueryNode interface +## KueryNode type + +> Warning: This API is now obsolete. +> +> Please import from the package kbn/es-query directly. This import will be deprecated in v8.0.0. +> Signature: ```typescript -export interface KueryNode +declare type KueryNode = oldKueryNode; ``` - -## 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 192a2c05191c7..0000000000000 --- 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 ab14abdd74e87..8e23f47976bd9 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) | | @@ -97,6 +94,7 @@ | [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) | | @@ -108,11 +106,12 @@ | [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) | | -| [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 6a7bdfe51f1c0..0000000000000 --- 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/package.json b/package.json index cddedb937f499..f0f99043b47e1 100644 --- a/package.json +++ b/package.json @@ -128,6 +128,7 @@ "@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", @@ -150,9 +151,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", @@ -318,7 +319,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/BUILD.bazel b/packages/BUILD.bazel index 938afdc205a44..0719357b6df35 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -21,6 +21,7 @@ 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-expect:build", diff --git a/packages/kbn-es-query/BUILD.bazel b/packages/kbn-es-query/BUILD.bazel new file mode 100644 index 0000000000000..9639a1057cac3 --- /dev/null +++ b/packages/kbn-es-query/BUILD.bazel @@ -0,0 +1,133 @@ +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" +PKG_REQUIRE_NAME = "@kbn/es-query" + +SOURCE_FILES = glob( + [ + "src/**/*", + ], + exclude = [ + "**/*.test.*", + "**/__fixtures__/**", + "**/__mocks__/**", + "**/__snapshots__/**", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", + "README.md", +] + +SRC_DEPS = [ + "//packages/kbn-common-utils", + "//packages/kbn-config-schema", + "//packages/kbn-i18n", + "@npm//@elastic/elasticsearch", + "@npm//load-json-file", + "@npm//lodash", + "@npm//moment-timezone", + "@npm//tslib", +] + +TYPES_DEPS = [ + "@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 = [ + "--allowed-start-rules", + "start,Literal", + "-o", + "$(@D)/index.js", + "./%s/grammar/grammar.peggy" % package_name() + ], +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + ], +) + +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_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", ":tsc_browser"], + 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 0000000000000..644fc4d559eb6 --- /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/src/plugins/data/common/es_query/kuery/ast/kuery.peg b/packages/kbn-es-query/grammar/grammar.peggy similarity index 95% rename from src/plugins/data/common/es_query/kuery/ast/kuery.peg rename to packages/kbn-es-query/grammar/grammar.peggy index dbea96eaac5b2..8f5ef17340aa9 100644 --- a/src/plugins/data/common/es_query/kuery/ast/kuery.peg +++ b/packages/kbn-es-query/grammar/grammar.peggy @@ -1,6 +1,9 @@ -/** - * To generate the parsing module (kuery.js), run `grunt peg` - * To watch changes and generate on file change, run `grunt watch:peg` +/* + * 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. */ // Initialization block diff --git a/packages/kbn-es-query/jest.config.js b/packages/kbn-es-query/jest.config.js new file mode 100644 index 0000000000000..306e12f34f698 --- /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 0000000000000..335ef61b8b360 --- /dev/null +++ b/packages/kbn-es-query/package.json @@ -0,0 +1,9 @@ +{ + "name": "@kbn/es-query", + "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 +} \ 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 95% 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 index fa9a2c85aaef5..b31269c4f8160 100644 --- 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 @@ -10,15 +10,16 @@ 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 { MatchAllFilter, Query } from '../filters'; +import { fields } from '../filters/stubs'; +import { IndexPatternBase } from './types'; + +jest.mock('../kuery/grammar'); 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/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 d7b3c630d1a6e..e8a494ec1b8e4 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 92% 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 index ad4d7ff8d78e2..bf4e1291ca438 100644 --- 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 @@ -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/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 96% 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 index 4a60db48c41b6..e3a56b5a9d63d 100644 --- 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 @@ -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/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 91% 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 index 920102566f8b3..2458013854393 100644 --- 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 @@ -8,14 +8,16 @@ 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 '..'; + +jest.mock('../kuery/grammar'); 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/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 3eccfd8776113..efe8b26a81412 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 98% 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 index 2438a4b40e256..e4ca435ae8862 100644 --- 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 @@ -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/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 6485281cc0fb3..cba789513c983 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 98% 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 index 24852ebf33bda..9c7b6070c7ec0 100644 --- 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 @@ -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/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 92% rename from src/plugins/data/common/es_query/es_query/index.ts rename to packages/kbn-es-query/src/es_query/index.ts index ecc7c8ba5a9f5..beba50f50dd81 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, IndexPatternFieldBase, 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 98% rename from src/plugins/data/common/es_query/es_query/types.ts rename to packages/kbn-es-query/src/es_query/types.ts index 9282072cd444d..ca6a542779053 100644 --- a/src/plugins/data/common/es_query/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/src/plugins/data/common/es_query/filters/build_filter.test.ts b/packages/kbn-es-query/src/filters/build_filter.test.ts similarity index 94% 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 index 33221e3838d9e..d7cf7938b3737 100644 --- a/src/plugins/data/common/es_query/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/src/plugins/data/common/es_query/filters/build_filters.ts b/packages/kbn-es-query/src/filters/build_filters.ts similarity index 94% rename from src/plugins/data/common/es_query/filters/build_filters.ts rename to packages/kbn-es-query/src/filters/build_filters.ts index 1d8d67b6e937f..ae27e64f3a41d 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 { IndexPatternFieldBase, IndexPatternBase } from '../..'; - import { Filter, FILTERS, - FilterStateStore, - FilterMeta, buildPhraseFilter, buildPhrasesFilter, buildRangeFilter, buildExistsFilter, } from '.'; +import { IndexPatternFieldBase, 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 bab226157ddd1..aa9e798a5b1ac 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 81% 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 index 848fcead5f5d9..83976d45f8e04 100644 --- a/src/plugins/data/common/es_query/filters/exists_filter.test.ts +++ b/packages/kbn-es-query/src/filters/exists_filter.test.ts @@ -6,14 +6,14 @@ * Side Public License, v 1. */ +import { IndexPatternBase } from '..'; 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'; 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/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 7a09adb7d9ed6..7785a62261fde 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 { IndexPatternFieldBase, 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 987055405886c..b309515109d48 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 5b284f1b6e3a1..42e417f2c88a4 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 87% 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 index b9ae8f3abaa0c..0425aa6cc8c72 100644 --- 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 @@ -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/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 0782e46bac784..4b540beb03754 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 89% rename from src/plugins/data/common/es_query/filters/index.ts rename to packages/kbn-es-query/src/filters/index.ts index fe7cdadabaee3..90c1675e8a3cf 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, FieldFilter, FilterMeta } 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 36eb5ee1fce18..a3fdd740986d4 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 87455cf1cb763..25fd26c410826 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 d0d337283ca60..0e10cb18d3c21 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 85% 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 index 513f0e29b5b24..7e6ccadc800d4 100644 --- a/src/plugins/data/common/es_query/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/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 68ad16cb31d42..fd5ded010bf07 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 { IndexPatternFieldBase, 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 82% 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 index 68ef69ba76eeb..5e742187cdf05 100644 --- a/src/plugins/data/common/es_query/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/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 7f7831e1c7978..451a0a46789fb 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 { IndexPatternFieldBase, 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 bf960f0ac04b3..b4774d5e65a67 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 88% 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 index 30e52b21d52b7..634471b1d4d9e 100644 --- a/src/plugins/data/common/es_query/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/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 e44e23f64936e..2df313eb7dd76 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, IndexPatternFieldBase } 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/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 0000000000000..2507293b87477 --- /dev/null +++ b/packages/kbn-es-query/src/filters/stubs/fields.mocks.ts @@ -0,0 +1,80 @@ +/* + * 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: 'ssl', + type: 'boolean', + scripted: false, + }, + { + name: '@timestamp', + type: 'date', + scripted: false, + }, + { + name: 'extension', + type: 'string', + scripted: false, + }, + { + name: 'machine.os', + type: 'string', + scripted: false, + }, + { + name: 'machine.os.raw', + 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', + }, + { + 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/filters/stubs/index.ts b/packages/kbn-es-query/src/filters/stubs/index.ts new file mode 100644 index 0000000000000..e4d99b5082257 --- /dev/null +++ b/packages/kbn-es-query/src/filters/stubs/index.ts @@ -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. + */ + +export * from './exists_filter'; +export * from './phrase_filter'; +export * from './phrases_filter'; +export * from './range_filter'; +export * from './fields.mocks'; 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 59% rename from src/plugins/data/common/es_query/filters/types.ts rename to packages/kbn-es-query/src/filters/types.ts index a007189d81a03..13e4a941b9166 100644 --- a/src/plugins/data/common/es_query/filters/types.ts +++ b/packages/kbn-es-query/src/filters/types.ts @@ -40,3 +40,47 @@ 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; +}; + +// 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 0000000000000..bbba52871d4c8 --- /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/ast.test.ts b/packages/kbn-es-query/src/kuery/ast/ast.test.ts similarity index 98% 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 index f8d7dc02d38fc..459ace026796c 100644 --- a/src/plugins/data/common/es_query/kuery/ast/ast.test.ts +++ b/packages/kbn-es-query/src/kuery/ast/ast.test.ts @@ -8,17 +8,19 @@ 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'; + +jest.mock('../grammar'); 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/kuery/ast/ast.ts b/packages/kbn-es-query/src/kuery/ast/ast.ts similarity index 96% rename from src/plugins/data/common/es_query/kuery/ast/ast.ts rename to packages/kbn-es-query/src/kuery/ast/ast.ts index 3e7b25897cab7..6f43098a752de 100644 --- a/src/plugins/data/common/es_query/kuery/ast/ast.ts +++ b/packages/kbn-es-query/src/kuery/ast/ast.ts @@ -11,8 +11,7 @@ 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'; +import { parse as parseKuery } from '../grammar'; import { IndexPatternBase } from '../..'; const fromExpression = ( 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/functions/and.test.ts b/packages/kbn-es-query/src/kuery/functions/and.test.ts similarity index 88% 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 index fae7888d75536..1e6797485c964 100644 --- a/src/plugins/data/common/es_query/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'; + +jest.mock('../grammar'); 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/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 ba7d5d1f6645b..239dd67e73d10 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 92% 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 index 4036e7c4089f0..0941e478e816b 100644 --- a/src/plugins/data/common/es_query/kuery/functions/exists.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/exists.test.ts @@ -7,20 +7,22 @@ */ import { nodeTypes } from '../node_types'; -import { fields } from '../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../index_patterns'; +import { fields } from '../../filters/stubs'; +import { IndexPatternBase } from '../..'; + +jest.mock('../grammar'); // @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/src/plugins/data/common/es_query/kuery/functions/exists.ts b/packages/kbn-es-query/src/kuery/functions/exists.ts similarity index 93% rename from src/plugins/data/common/es_query/kuery/functions/exists.ts rename to packages/kbn-es-query/src/kuery/functions/exists.ts index 4df566d874d8b..0e05ade5181db 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 { IndexPatternFieldBase, IndexPatternBase, KueryNode } from '../..'; import * as literal from '../node_types/literal'; -import { KueryNode, IndexPatternFieldBase, 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 94% 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 index 54c2383be785a..028c5e39bf5da 100644 --- 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 @@ -8,12 +8,13 @@ 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'; +jest.mock('../grammar'); + const params = { bottomRight: { lat: 50.73, @@ -27,12 +28,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/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 79bef10b14f71..b1fd8680af604 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 94% 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 index a106754a5f56f..f16ca378866f0 100644 --- 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 @@ -7,12 +7,13 @@ */ 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'; +jest.mock('../grammar'); + const points = [ { lat: 69.77, @@ -30,12 +31,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/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 2e3280138502a..d02ba84237c7f 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 97% 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 index 55aac8189c1d8..292159e727a92 100644 --- a/src/plugins/data/common/es_query/kuery/functions/is.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/is.test.ts @@ -7,20 +7,21 @@ */ 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 '../..'; + +jest.mock('../grammar'); describe('kuery functions', () => { describe('is', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { 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 99% rename from src/plugins/data/common/es_query/kuery/functions/is.ts rename to packages/kbn-es-query/src/kuery/functions/is.ts index 381913670c26a..c8d33921b084a 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, IndexPatternFieldBase } from '../../..'; +import { IndexPatternBase, KueryNode, IndexPatternFieldBase } 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 90% 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 index 50460500c0877..47e515b9bd47f 100644 --- a/src/plugins/data/common/es_query/kuery/functions/nested.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/nested.test.ts @@ -7,24 +7,25 @@ */ 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'; -// @ts-ignore import * as nested from './nested'; +jest.mock('../grammar'); + 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/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 46ceeaf3e5de6..248de1c40d62a 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 87% 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 index ab83df581edd7..a44f3e9c5dda8 100644 --- a/src/plugins/data/common/es_query/kuery/functions/not.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/not.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 { 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', () => { describe('not', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { 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 f837cd261c814..96404ee800010 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 90% 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 index 5e151098a5ef9..15faa7e1753d3 100644 --- a/src/plugins/data/common/es_query/kuery/functions/or.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/or.test.ts @@ -7,25 +7,25 @@ */ 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'; -// @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'); describe('kuery functions', () => { describe('or', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { 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 7365cc39595e6..b94814e1f7c05 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 96% 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 index c4bc9c1372b27..fa1805e64887c 100644 --- a/src/plugins/data/common/es_query/kuery/functions/range.test.ts +++ b/packages/kbn-es-query/src/kuery/functions/range.test.ts @@ -8,21 +8,21 @@ 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 import * as range from './range'; +jest.mock('../grammar'); describe('kuery functions', () => { describe('range', () => { - let indexPattern: IIndexPattern; + let indexPattern: IndexPatternBase; beforeEach(() => { - indexPattern = ({ + indexPattern = { fields, - } as unknown) as IIndexPattern; + }; }); describe('buildNodeParams', () => { 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 b134434dc182b..e80a365441c43 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 97% 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 index 949f94d043553..4125b0a572566 100644 --- 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 @@ -7,13 +7,13 @@ */ import { IndexPatternBase } from '../../..'; -import { fields } from '../../../../index_patterns/mocks'; +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/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 7dac1262d5062..db3826d4ef8c4 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 92% 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 index 639f5584ef592..dccfc5d1c463a 100644 --- 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 @@ -7,19 +7,19 @@ */ import { nodeTypes } from '../../node_types'; -import { fields } from '../../../../index_patterns/mocks'; -import { IIndexPattern } from '../../../../index_patterns'; - -// @ts-ignore +import { fields } from '../../../filters/stubs'; +import { IndexPatternBase } from '../../..'; import { getFullFieldNameNode } from './get_full_field_name_node'; +jest.mock('../../grammar'); + 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/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 2a31ebeee2fab..6b575fbdea8fb 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, IndexPatternFieldBase, KueryNode } from '../../../..'; +import { IndexPatternBase, IndexPatternFieldBase, KueryNode } from '../../..'; export function getFullFieldNameNode( rootNameNode: any, diff --git a/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js new file mode 100644 index 0000000000000..89c13bb2b05c2 --- /dev/null +++ b/packages/kbn-es-query/src/kuery/grammar/__mocks__/grammar.js @@ -0,0 +1,2219 @@ +/* + * 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. + */ + +// Generated by Peggy 1.2.0. +// +// https://peggyjs.org/ +/* eslint-disable */ + +"use strict"; + +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) { + 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) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + + class: function(expectation) { + var escapedParts = expectation.parts.map(function(part) { + return Array.isArray(part) + ? classEscape(part[0]) + "-" + classEscape(part[1]) + : classEscape(part); + }); + + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, + + any: function() { + return "any character"; + }, + + end: function() { + return "end of input"; + }, + + other: function(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + 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); }); + } + + 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); }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = expected.map(describeExpectation); + var i, j; + + descriptions.sort(); + + 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; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; +}; + +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$startRuleFunction = peg$parsestart; + + 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$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.'); + } + + const isPhrase = buildLiteralNode(false); + return (field) => buildFunctionNode('is', [field, value, isPhrase]); + }; + 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; + 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 + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function text() { + 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); + } + + function expected(description, location) { + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); + + throw peg$buildStructuredError( + [peg$otherExpectation(description)], + input.substring(peg$savedPos, peg$currPos), + location + ); + } + + function error(message, location) { + 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 }; + } + + 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 }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos]; + var p; + + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; + } + + 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++; + } + + peg$posDetailsCache[pos] = details; + + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); + + return { + source: peg$source, + 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$buildSimpleError(message, location) { + return new peg$SyntaxError(message, null, null, location); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = []; + s2 = peg$parseSpace(); + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseSpace(); + } + 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; + } + + return s0; + } + + function peg$parseOrQuery() { + var s0, s1, s2, s3, s4, 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; + s3 = peg$f1(s1, s5); + } 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; + s3 = peg$f1(s1, s5); + } 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; + s0 = peg$f2(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseAndQuery(); + } + + return s0; + } + + function peg$parseAndQuery() { + var s0, s1, s2, s3, s4, 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; + s3 = peg$f1(s1, s5); + } 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; + s3 = peg$f1(s1, s5); + } 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; + s0 = peg$f3(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNotQuery(); + } + + return s0; + } + + function peg$parseNotQuery() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parseNot(); + if (s1 !== peg$FAILED) { + s2 = peg$parseSubQuery(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f4(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseSubQuery(); + } + + return s0; + } + + function peg$parseSubQuery() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c0; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e0); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + 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; + } + } 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(); + } + + return s0; + } + + function peg$parseNestedQuery() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, 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(); + } + 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 { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e3); } + } + 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 (s9 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f6(s1, s7, s8); + } 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(); + } + + return s0; + } + + function peg$parseExpression() { + var s0; + + s0 = peg$parseFieldRangeExpression(); + if (s0 === peg$FAILED) { + s0 = peg$parseFieldValueExpression(); + if (s0 === peg$FAILED) { + s0 = peg$parseValueExpression(); + } + } + + return s0; + } + + function peg$parseField() { + var s0, s1; + + peg$silentFails++; + s0 = peg$parseLiteral(); + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e5); } + } + + return s0; + } + + function peg$parseFieldRangeExpression() { + var s0, s1, s2, s3, s4, 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(); + } + s3 = peg$parseRangeOperator(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseSpace(); + } + s5 = peg$parseLiteral(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f7(s1, s3, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseFieldValueExpression() { + var s0, s1, s2, s3, s4, 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(); + } + 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(); + } + s5 = peg$parseListOfValues(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f8(s1, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseValueExpression() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parseValue(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f9(s1); + } + s0 = s1; + + return s0; + } + + function peg$parseListOfValues() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c0; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e0); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseSpace(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseSpace(); + } + 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; + } + } 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(); + } + + return s0; + } + + function peg$parseOrListOfValues() { + var s0, s1, s2, s3, s4, 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; + s3 = peg$f11(s1, s5); + } 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; + s3 = peg$f11(s1, s5); + } 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; + s0 = peg$f12(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseAndListOfValues(); + } + + return s0; + } + + function peg$parseAndListOfValues() { + var s0, s1, s2, s3, s4, 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; + s3 = peg$f11(s1, s5); + } 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; + s3 = peg$f11(s1, s5); + } 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; + s0 = peg$f13(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseNotListOfValues(); + } + + return s0; + } + + function peg$parseNotListOfValues() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parseNot(); + if (s1 !== peg$FAILED) { + s2 = peg$parseListOfValues(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f14(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseListOfValues(); + } + + return s0; + } + + function peg$parseValue() { + var s0, s1; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parseQuotedString(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f15(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseUnquotedLiteral(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f16(s1); + } + s0 = s1; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + } + + return s0; + } + + function peg$parseOr() { + var s0, s1, s2, s3, s4; + + 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$c5) { + s2 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e8); } + } + 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$e7); } + } + + return s0; + } + + function peg$parseAnd() { + var s0, s1, s2, s3, s4; + + 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$c6) { + s2 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e10); } + } + 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$e9); } + } + + return s0; + } + + function peg$parseNot() { + var s0, s1, s2, s3; + + peg$silentFails++; + s0 = peg$currPos; + 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$e12); } + } + 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$e11); } + } + + return s0; + } + + function peg$parseLiteral() { + var s0, s1; + + 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$e13); } + } + + return s0; + } + + function peg$parseQuotedString() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$f17(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s2 = peg$c8; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parseQuotedCharacter(); + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parseQuotedCharacter(); + } + s4 = peg$parseCursor(); + if (s4 !== peg$FAILED) { + s5 = []; + s6 = peg$parseQuotedCharacter(); + while (s6 !== peg$FAILED) { + s5.push(s6); + s6 = peg$parseQuotedCharacter(); + } + 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; + } + } 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$c8; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseQuotedCharacter(); + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseQuotedCharacter(); + } + 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; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parseQuotedCharacter() { + var s0, s1, s2; + + 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$c9; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s1 !== peg$FAILED) { + 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$e16); } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f20(s2); + } 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 = undefined; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + 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$e17); } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f20(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + + return s0; + } + + function peg$parseUnquotedLiteral() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$f17(); + 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(); + } + s3 = peg$parseCursor(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseUnquotedCharacter(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseUnquotedCharacter(); + } + peg$savedPos = s0; + s0 = peg$f18(s2, s3, s4); + } 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$f21(s1); + } + s0 = s1; + } + + return s0; + } + + function peg$parseUnquotedCharacter() { + var s0, s1, s2, s3, s4; + + 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 = undefined; + } 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 = undefined; + } 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 = undefined; + } 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$e18); } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f20(s4); + } 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; + } + } + } + } + } + } + + return s0; + } + + function peg$parseWildcard() { + var s0, s1; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c10; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e19); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f22(); + } + s0 = s1; + + return s0; + } + + function peg$parseOptionalSpace() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$f17(); + 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(); + } + s3 = peg$parseCursor(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseSpace(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseSpace(); + } + peg$savedPos = s0; + s0 = peg$f18(s2, s3, s4); + } 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(); + } + } + + return s0; + } + + function peg$parseEscapedWhitespace() { + var s0, s1; + + s0 = peg$currPos; + 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$e20); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f23(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + 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$e21); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f24(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + 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$e22); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f25(); + } + s0 = s1; + } + } + + return s0; + } + + function peg$parseEscapedSpecialCharacter() { + var s0, s1, s2; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c9; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseSpecialCharacter(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f20(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseEscapedKeyword() { + var s0, s1, s2; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c9; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s1 !== peg$FAILED) { + 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$e8); } + } + if (s2 === peg$FAILED) { + 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$e10); } + } + if (s2 === peg$FAILED) { + 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$e12); } + } + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f26(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseKeyword() { + var s0; + + s0 = peg$parseOr(); + if (s0 === peg$FAILED) { + s0 = peg$parseAnd(); + if (s0 === peg$FAILED) { + s0 = peg$parseNot(); + } + } + + return s0; + } + + function peg$parseSpecialCharacter() { + var s0; + + 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$e23); } + } + + return s0; + } + + function peg$parseEscapedUnicodeSequence() { + var s0, s1, s2; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c9; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e15); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseUnicodeSequence(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f27(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseUnicodeSequence() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 117) { + s1 = peg$c14; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e24); } + } + 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; + s0 = peg$f28(s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseHexDigit() { + var s0; + + 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$e25); } + } + + return s0; + } + + function peg$parseRangeOperator() { + var s0, s1; + + s0 = peg$currPos; + 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$e26); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f29(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + 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$e27); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f30(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 60) { + s1 = peg$c17; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e28); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f31(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 62) { + s1 = peg$c18; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e29); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f32(); + } + s0 = s1; + } + } + } + + return s0; + } + + function peg$parseSpace() { + var s0, s1; + + peg$silentFails++; + 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$e31); } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e30); } + } + + return s0; + } + + function peg$parseCursor() { + var s0, s1, s2; + + s0 = peg$currPos; + peg$savedPos = peg$currPos; + s1 = peg$f17(); + if (s1) { + s1 = undefined; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + 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$e32); } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f33(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + 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(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) + ); + } +} + +module.exports = { + SyntaxError: peg$SyntaxError, + parse: peg$parse +}; diff --git a/packages/kbn-es-query/src/kuery/grammar/__mocks__/index.ts b/packages/kbn-es-query/src/kuery/grammar/__mocks__/index.ts new file mode 100644 index 0000000000000..9103c852c4845 --- /dev/null +++ b/packages/kbn-es-query/src/kuery/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. + */ +// @ts-expect-error +export { parse } from './grammar'; diff --git a/packages/kbn-es-query/src/kuery/grammar/index.ts b/packages/kbn-es-query/src/kuery/grammar/index.ts new file mode 100644 index 0000000000000..811fa723da3b8 --- /dev/null +++ b/packages/kbn-es-query/src/kuery/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/src/plugins/data/common/es_query/kuery/index.ts b/packages/kbn-es-query/src/kuery/index.ts similarity index 80% rename from src/plugins/data/common/es_query/kuery/index.ts rename to packages/kbn-es-query/src/kuery/index.ts index 72eecc09756b4..7796785f85394 100644 --- a/src/plugins/data/common/es_query/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 { DslQuery, KueryNode } from './types'; 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 89% 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 index 6875bc3e5f74f..e04b1abdc8494 100644 --- 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 @@ -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(() => { @@ -47,7 +49,7 @@ describe('kql syntax errors', () => { ); }); - 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( @@ -66,13 +68,17 @@ describe('kql syntax errors', () => { 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, 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, end of input 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', () => { 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 59% 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 index a9adbad4781b7..aa4440579eb49 100644 --- a/src/plugins/data/common/es_query/kuery/kuery_syntax_error.ts +++ b/packages/kbn-es-query/src/kuery/kuery_syntax_error.ts @@ -6,28 +6,40 @@ * Side Public License, v 1. */ -import { repeat } from 'lodash'; +import { repeat, uniq } 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', }), }; +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; @@ -35,7 +47,9 @@ interface KQLSyntaxErrorData extends Error { } interface KQLSyntaxErrorExpected { - description: string; + description?: string; + text?: string; + type: string; } export class KQLSyntaxError extends Error { @@ -45,12 +59,16 @@ export class KQLSyntaxError extends Error { let message = error.message; if (error.expected) { const translatedExpectations = error.expected.map((expected) => { - return grammarRuleTranslations[expected.description] || expected.description; + const key = getItemText(expected); + return grammarRuleTranslations[key] || key; }); - const translatedExpectationText = translatedExpectations.join(', '); + const translatedExpectationText = uniq(translatedExpectations) + .filter((item) => item !== undefined) + .sort() + .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/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 91% 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 index 42c06d7fdb603..5df6ba1916046 100644 --- 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 @@ -6,22 +6,23 @@ * 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'; + +jest.mock('../grammar'); 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/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 642089a101f31..e72f8a6b1e77a 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 97% 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 index c370292de38bc..7a36be704a609 100644 --- 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 @@ -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/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 98% 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 index 2c3fb43ee0f59..fa944660288d5 100644 --- 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 @@ -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/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 99% 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 index d6439f8e7cc87..aefd40c6db3fb 100644 --- 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 @@ -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/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 99% 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 index 8c20851cfe3f9..9f444eec82b69 100644 --- 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 @@ -16,6 +16,8 @@ import { // @ts-ignore } from './wildcard'; +jest.mock('../grammar'); + describe('kuery node types', () => { describe('wildcard', () => { describe('buildNode', () => { 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.browser.json b/packages/kbn-es-query/tsconfig.browser.json new file mode 100644 index 0000000000000..0a1c21cc8e05b --- /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 new file mode 100644 index 0000000000000..b48d90373e2cb --- /dev/null +++ b/packages/kbn-es-query/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "incremental": true, + "declarationDir": "./target_types", + "outDir": "./target_node", + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "sourceRoot": "../../../../packages/kbn-es-query/src", + "types": [ + "jest", + "node" + ] + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "**/__fixtures__/**/*", + "**/__mocks__/**/grammar.js", + ] +} 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 27228361aef22..474721ff3610a 100644 --- a/src/core/server/saved_objects/service/lib/repository.test.js +++ b/src/core/server/saved_objects/service/lib/repository.test.js @@ -33,7 +33,6 @@ import { errors as EsErrors } from '@elastic/elasticsearch'; const { nodeTypes } = esKuery; jest.mock('./search_dsl/search_dsl', () => ({ getSearchDsl: jest.fn() })); - // 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/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 97% 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 index 6963960d7ce03..5513f2649265f 100644 --- 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 @@ -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/common/es_query/es_query/get_es_query_config.ts b/src/plugins/data/common/es_query/get_es_query_config.ts similarity index 82% 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 a074bb2ddc0e3..e3d39df75255c 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,14 +6,14 @@ * 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; } -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/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index bbba52871d4c8..6d5084900b11d 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -6,6 +6,358 @@ * Side Public License, v 1. */ -export * from './es_query'; -export * from './filters'; -export * from './kuery'; +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 deprecated in v8.0.0. + */ +const isFilter = oldIsFilter; +/** + * @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 deprecated in v8.0.0. + */ +const disableFilter = oldDisableFilter; +/** + * @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 deprecated in v8.0.0. + */ +const toElasticsearchQuery = oldToElasticsearchQuery; +/** + * @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 deprecated in v8.0.0. + */ +const buildEsQuery = oldBuildEsQuery; +/** + * @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 deprecated in v8.0.0. + */ +const luceneStringToDsl = oldLuceneStringToDsl; +/** + * @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 deprecated in v8.0.0. + */ +const getPhraseFilterField = oldgetPhraseFilterField; + +/** + * @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 deprecated in v8.0.0. + */ +const isFilterPinned = oldIsFilterPinned; + +/** + * @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 deprecated in v8.0.0. + */ +const isFilters = oldIsFilters; + +/** + * @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 deprecated in v8.0.0. + */ +const isMatchAllFilter = oldIsMatchAllFilter; + +/** + * @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 deprecated in v8.0.0. + */ +const isGeoPolygonFilter = oldIsGeoPolygonFilter; + +/** + * @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 deprecated in v8.0.0. + */ +const isPhraseFilter = oldIsPhraseFilter; + +/** + * @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 deprecated in v8.0.0. + */ +const isRangeFilter = oldIsRangeFilter; + +/** + * @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 deprecated in v8.0.0. + */ +const buildQueryFilter = oldBuildQueryFilter; + +/** + * @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 deprecated in v8.0.0. + */ +const buildPhraseFilter = oldBuildPhraseFilter; + +/** + * @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 deprecated in v8.0.0. + */ +const buildCustomFilter = oldBuildCustomFilter; + +/** + * @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 deprecated in v8.0.0. + */ +const buildEmptyFilter = oldBuildEmptyFilter; + +/** + * @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 deprecated in v8.0.0. + */ +const toggleFilterNegated = oldtoggleFilterNegated; + +/** + * @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 deprecated in v8.0.0. + */ +type Filter = oldFilter; + +/** + * @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 deprecated in v8.0.0. + */ +type RangeFilterParams = oldRangeFilterParams; + +/** + * @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 deprecated in v8.0.0. + */ +type GeoPolygonFilter = oldGeoPolygonFilter; + +/** + * @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 deprecated in v8.0.0. + */ +type PhraseFilter = oldPhraseFilter; + +/** + * @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 deprecated in v8.0.0. + */ +type CustomFilter = oldCustomFilter; + +/** + * @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 deprecated in v8.0.0. + */ +type RangeFilter = oldRangeFilter; + +/** + * @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 deprecated in v8.0.0. + */ +type KueryNode = oldKueryNode; + +/** + * @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 deprecated in v8.0.0. + */ +type IFieldSubType = oldIFieldSubType; + +/** + * @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 deprecated in v8.0.0. + */ + +export { + disableFilter, + fromKueryExpression, + toElasticsearchQuery, + nodeTypes, + buildEsQuery, + buildQueryFromFilters, + luceneStringToDsl, + decorateQuery, + getPhraseFilterField, + getPhraseFilterValue, + isFilterPinned, + nodeBuilder, + isFilters, + isExistsFilter, + isMatchAllFilter, + isGeoBoundingBoxFilter, + isGeoPolygonFilter, + isMissingFilter, + isPhraseFilter, + isPhrasesFilter, + isRangeFilter, + isQueryStringFilter, + buildQueryFilter, + buildPhrasesFilter, + buildPhraseFilter, + buildRangeFilter, + buildCustomFilter, + buildFilter, + buildEmptyFilter, + buildExistsFilter, + toggleFilterNegated, + FILTERS, + isFilter, + isFilterDisabled, + FilterStateStore, + Filter, + RangeFilterMeta, + RangeFilterParams, + ExistsFilter, + GeoPolygonFilter, + PhrasesFilter, + PhraseFilter, + MatchAllFilter, + CustomFilter, + MissingFilter, + RangeFilter, + GeoBoundingBoxFilter, + KueryNode, + FilterMeta, + IFieldSubType, + EsQueryConfig, +}; diff --git a/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js b/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js deleted file mode 100644 index 7ee744ad5f4c8..0000000000000 --- a/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js +++ /dev/null @@ -1,2635 +0,0 @@ -module.exports = (function() { - "use strict"; - - /* - * 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) { - var options = arguments.length > 1 ? arguments[1] : {}, - parser = this, - - peg$FAILED = {}, - - peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral }, - peg$startRuleFunction = peg$parsestart, - - 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, - } - }; - - 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 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 (!(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) { - var details = peg$posDetailsCache[pos], - p, 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) { - var startPosDetails = peg$computePosDetails(startPos), - 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) { - var 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); }); - } - - var expectedDescs = new Array(expected.length), - expectedDesc, foundDesc, 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() { - var s0, s1, s2, s3; - - var key = peg$currPos * 37 + 0, - 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() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 1, - 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() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 2, - 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() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 3, - 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() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 4, - 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() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; - - var key = peg$currPos * 37 + 5, - 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() { - var s0; - - var key = peg$currPos * 37 + 6, - 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() { - var s0, s1; - - var key = peg$currPos * 37 + 7, - 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() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 8, - 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() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 9, - 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() { - var s0, s1; - - var key = peg$currPos * 37 + 10, - 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() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 11, - 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() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 12, - 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() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 13, - 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() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 14, - 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() { - var s0, s1; - - var key = peg$currPos * 37 + 15, - 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() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 37 + 16, - 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() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 37 + 17, - 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() { - var s0, s1, s2, s3; - - var key = peg$currPos * 37 + 18, - 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() { - var s0, s1; - - var key = peg$currPos * 37 + 19, - 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() { - var s0, s1, s2, s3, s4, s5, s6; - - var key = peg$currPos * 37 + 20, - 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() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 21, - 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() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 22, - 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() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 37 + 23, - 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() { - var s0, s1; - - var key = peg$currPos * 37 + 24, - 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() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 37 + 25, - 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() { - var s0, s1; - - var key = peg$currPos * 37 + 26, - 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() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 27, - 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() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 28, - 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() { - var s0; - - var key = peg$currPos * 37 + 29, - 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() { - var s0; - - var key = peg$currPos * 37 + 30, - 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() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 31, - 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() { - var s0, s1, s2, s3, s4, s5, s6, s7; - - var key = peg$currPos * 37 + 32, - 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() { - var s0; - - var key = peg$currPos * 37 + 33, - 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() { - var s0, s1; - - var key = peg$currPos * 37 + 34, - 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() { - var s0, s1; - - var key = peg$currPos * 37 + 35, - 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() { - var s0, s1, s2; - - var key = peg$currPos * 37 + 36, - 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 - }; -})(); \ No newline at end of file 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 0000000000000..b10aa67db517e --- /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/filters/stubs/index.ts b/src/plugins/data/common/es_query/stubs/index.ts similarity index 100% rename from src/plugins/data/common/es_query/filters/stubs/index.ts rename to src/plugins/data/common/es_query/stubs/index.ts 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 0000000000000..23b51afd64e51 --- /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 0000000000000..56c3af56175da --- /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 0000000000000..485a569eb9d4b --- /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/index_patterns/fields/types.ts b/src/plugins/data/common/index_patterns/fields/types.ts index 3b2e25d3d80a6..38258dd4f53f4 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 1557e886d4200..e5bd6742cf088 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 a6190adc1ba65..fc820779b2461 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/persistable_state.test.ts b/src/plugins/data/common/query/persistable_state.test.ts index 62ea17e030413..807cc72a071be 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/src/plugins/data/common/query/persistable_state.ts b/src/plugins/data/common/query/persistable_state.ts index ef0543bb84a2c..08cda6eb59fbf 100644 --- a/src/plugins/data/common/query/persistable_state.ts +++ b/src/plugins/data/common/query/persistable_state.ts @@ -7,9 +7,9 @@ */ import uuid from 'uuid'; +import { Filter } from '@kbn/es-query'; import { SerializableState } from '../../../kibana_utils/common/persistable_state'; import { SavedObjectReference } from '../../../../core/types'; -import { Filter } from '../es_query/filters'; export const extract = (filters: Filter[]) => { const references: SavedObjectReference[] = []; diff --git a/src/plugins/data/common/query/timefilter/get_time.ts b/src/plugins/data/common/query/timefilter/get_time.ts index 58194fc72dfcf..64842be20fbad 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/query/types.ts b/src/plugins/data/common/query/types.ts index e4e386afdec77..c1861beb1ed90 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/aggs/agg_configs.ts b/src/plugins/data/common/search/aggs/agg_configs.ts index c205b46e077f0..c80becd271bba 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 2a1cd873f6282..39fba23a42210 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 2c0f35d28e989..1fd2250ec9e8b 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 5ba80d35e2cb3..1231637771e32 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 948dac1d23b5b..a265584cf3765 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 d104c8f5c57f5..d5c98dc51562c 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 374c2fdbcf705..bd16b0210a856 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 4c2f929aa0675..258f10f2fd15a 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 935b52dc55708..25aa3f334e4b8 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 900848bb9517f..2f04e71d0af87 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 107b86de04058..c2bb7a6d7c81f 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/expressions/esaggs/create_filter.test.ts b/src/plugins/data/common/search/expressions/esaggs/create_filter.test.ts index 591bcc4947b08..b78980cb5136e 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'; diff --git a/src/plugins/data/common/search/expressions/esdsl.ts b/src/plugins/data/common/search/expressions/esdsl.ts index dee1b19eb3360..a5834001143e4 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 0979328860b4c..75d83ca7f2592 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 edcf884b3ed31..3eb3a11b09857 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 22a7150d4a64e..9c1c78604ea83 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 0b19e8a1e416d..837d4be4d52ea 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 ed71f5362fe85..ed65475a9d285 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/create_search_source.test.ts b/src/plugins/data/common/search/search_source/create_search_source.test.ts index 6a6ac1dfa93e7..c084b029a5bd2 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/common/search/search_source/extract_references.ts b/src/plugins/data/common/search/search_source/extract_references.ts index b63b8ed1cfee2..f099443ef7605 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'; import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../constants'; 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 e60e6fa00b270..13f157da731a6 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 c170b13774932..758a2dfb181f2 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/stubs.ts b/src/plugins/data/common/stubs.ts index 25f9dda7d33b4..d64d788d60ead 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 './es_query/stubs'; diff --git a/src/plugins/data/common/types.ts b/src/plugins/data/common/types.ts index 8072928a1b670..7f6ae4a346bd0 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 9644a96a68752..eb8e991cb8891 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 48e87a73f3671..12a0dae97ebaa 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/index.ts b/src/plugins/data/public/index.ts index 51f3d9fd660e5..e6a5a02123c2b 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -6,6 +6,10 @@ * Side Public License, v 1. */ +/* + * esQuery and esKuery: + */ + import { PluginInitializerContext } from '../../../core/public'; import { ConfigSchema } from '../config'; @@ -14,15 +18,6 @@ import { ConfigSchema } from '../config'; */ import { - buildEmptyFilter, - buildExistsFilter, - buildPhraseFilter, - buildPhrasesFilter, - buildQueryFilter, - buildRangeFilter, - disableFilter, - FILTERS, - FilterStateStore, getPhraseFilterField, getPhraseFilterValue, isExistsFilter, @@ -34,6 +29,22 @@ import { isQueryStringFilter, isRangeFilter, toggleFilterNegated, + buildEmptyFilter, + buildExistsFilter, + buildPhraseFilter, + buildPhrasesFilter, + buildQueryFilter, + buildRangeFilter, + disableFilter, + fromKueryExpression, + toElasticsearchQuery, + nodeTypes, + buildEsQuery, + buildQueryFromFilters, + luceneStringToDsl, + decorateQuery, + FILTERS, + FilterStateStore, compareFilters, COMPARE_ALL_OPTIONS, } from '../common'; @@ -94,7 +105,8 @@ export const esFilters = { extractTimeRange, }; -export type { +export { + KueryNode, RangeFilter, RangeFilterMeta, RangeFilterParams, @@ -103,29 +115,26 @@ export type { PhraseFilter, CustomFilter, MatchAllFilter, + IFieldSubType, + EsQueryConfig, + isFilter, + isFilters, } from '../common'; -/* - * esQuery and esKuery: - */ - -import { - fromKueryExpression, - toElasticsearchQuery, - nodeTypes, - buildEsQuery, - getEsQueryConfig, - buildQueryFromFilters, - luceneStringToDsl, - decorateQuery, -} from '../common'; +import { getEsQueryConfig } from '../common'; +/** + * @deprecated Please import helpers from the package kbn/es-query directly. This import will be deprecated 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 deprecated in v8.0.0. + */ export const esQuery = { buildEsQuery, getEsQueryConfig, @@ -134,8 +143,6 @@ export const esQuery = { decorateQuery, }; -export { EsQueryConfig, KueryNode } from '../common'; - /* * Field Formatters: */ @@ -260,7 +267,6 @@ export { export { IIndexPattern, IFieldType, - IFieldSubType, ES_FIELD_TYPES, KBN_FIELD_TYPES, IndexPatternAttributes, @@ -489,7 +495,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/public.api.md b/src/plugins/data/public/public.api.md index d3311254c8581..8e35719505f81 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -17,6 +17,7 @@ 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 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'; @@ -25,6 +26,7 @@ import { DetailedPeerCertificate } from 'tls'; import { Ensure } from '@kbn/utility-types'; import { EnvironmentMode } from '@kbn/config'; import { ErrorToastOptions } from 'src/core/public/notifications'; +import { EsQueryConfig as EsQueryConfig_2 } from '@kbn/es-query'; import { estypes } from '@elastic/elasticsearch'; import { EuiBreadcrumb } from '@elastic/eui'; import { EuiButtonEmptyProps } from '@elastic/eui'; @@ -35,10 +37,13 @@ import { EuiGlobalToastListToast } from '@elastic/eui'; import { EuiIconProps } from '@elastic/eui'; import { EventEmitter } from 'events'; import { ExecutionContext } from 'src/plugins/expressions/common'; +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 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'; import { Href } from 'history'; @@ -46,19 +51,23 @@ 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 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 { 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 { KibanaExecutionContext } from 'src/core/public'; +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 { MatchAllFilter as MatchAllFilter_2 } from '@kbn/es-query'; import { MaybePromise } from '@kbn/utility-types'; import { Moment } from 'moment'; import moment from 'moment'; @@ -68,6 +77,8 @@ import { Observable } from 'rxjs'; import { PackageInfo } from '@kbn/config'; import { Path } from 'history'; import { PeerCertificate } from 'tls'; +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'; @@ -75,7 +86,10 @@ 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 { RangeFilter as RangeFilter_2 } from 'src/plugins/data/public'; +import { Query } 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'; @@ -262,7 +276,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: {}; @@ -617,10 +631,8 @@ export const createSavedQueryService: (savedObjectsClient: SavedObjectsClientCon // 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; -}; +// @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 @@ -804,23 +816,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("../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; @@ -833,62 +845,53 @@ 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; }; // 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("../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) +// @public @deprecated (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("../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; + 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) // -// @public (undocumented) -export interface EsQueryConfig { - // (undocumented) - allowLeadingWildcards: boolean; - // (undocumented) - dateFormatTZ?: string; - // (undocumented) - ignoreFilterIfFieldNotInIndex: boolean; - // (undocumented) - queryStringOptions: Record; -} +// @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 @@ -916,11 +919,8 @@ export type ExecutionContextSearch = { // 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; -}; +// @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) // @@ -1079,12 +1079,8 @@ export const fieldList: (specs?: FieldSpec[], shortDotsEnable?: boolean) => IInd // 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; -}; +// @public @deprecated (undocumented) +export type Filter = Filter_2; // Warning: (ae-forgotten-export) The symbol "PersistableStateService" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "FilterManager" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -1093,19 +1089,19 @@ export type Filter = { export class FilterManager implements PersistableStateService { constructor(uiSettings: IUiSettingsClient); // (undocumented) - addFilters(filters: Filter[] | Filter, pinFilterStatus?: boolean): void; + addFilters(filters: Filter_2[] | Filter_2, pinFilterStatus?: boolean): void; // (undocumented) extract: any; // (undocumented) getAllMigrations: () => {}; // (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) @@ -1119,13 +1115,13 @@ export class FilterManager implements PersistableStateService { // (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; // (undocumented) telemetry: (filters: import("../../../../kibana_utils/common/persistable_state").SerializableState, collector: unknown) => {}; } @@ -1164,7 +1160,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) // @@ -1242,19 +1238,9 @@ 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; - }; -} +// @public @deprecated (undocumented) +export type IFieldSubType = IFieldSubType_2; -// 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) @@ -1287,7 +1273,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) @@ -1569,7 +1554,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; @@ -1583,7 +1568,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) @@ -1832,13 +1817,13 @@ 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; +// @public @deprecated (undocumented) +export const isFilter: (x: unknown) => x is Filter_2; // 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[]; +// @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) // @@ -1904,23 +1889,13 @@ 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; -} +// @public @deprecated (undocumented) +export type KueryNode = KueryNode_2; // 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; -}; +// @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) // @@ -2029,24 +2004,13 @@ export const parseSearchSourceJSON: (searchSourceJSON: string) => SearchSourceFi // 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; - }; - }; -}; +// @public @deprecated (undocumented) +export type PhraseFilter = PhraseFilter_2; // 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; -}; +// @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) @@ -2054,15 +2018,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) @@ -2232,50 +2188,20 @@ 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; -}; +// @public @deprecated (undocumented) +export type RangeFilter = RangeFilter_2; // 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; -}; +// @public @deprecated (undocumented) +export type RangeFilterMeta = RangeFilterMeta_2; // 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; -} +// @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) // @@ -2571,6 +2497,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 @@ -2760,65 +2688,53 @@ 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:240:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:240:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:240:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:240:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:240:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:412:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:412:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:412:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:414:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:415:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:424:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:425:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:426:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:427:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:431:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:432:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:435:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:436:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:439: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/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: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:247:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:247:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:247:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:247:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:247:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:418:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:418:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:418:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:420:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:421:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:430:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:431:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:432:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:433:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:437:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:438:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:441:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:442:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:445: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/public/query/filter_manager/filter_manager.ts b/src/plugins/data/public/query/filter_manager/filter_manager.ts index d47e4fb33f2a5..d514e0eb18705 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 0a4998a159523..566b26b0698dd 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 f4abd65385da2..c30965e777c46 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 b40701726d52d..19ebc66ae2d46 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 d1e2a649c400f..dfa8e862e1b4c 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 7bcedd9a7f951..e1c21aae64da6 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 a3c9086676f66..32231492b2f22 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 b14fe4fb9da0f..41af3760a652e 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 d8eb14ec5a67c..64576d4978c99 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 5601dd66e5206..9ffdd3070e43a 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 9c11f74b60516..89355b6d1f423 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 b58128bd5dbdb..ee86c1aa3c309 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 229257c1a7d81..d31b5bb9e608d 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 3e86c6aa01fd9..5104a934fdec8 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 7e5b4ebed8785..3c94d6eb3c056 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/state_sync/sync_state_with_url.ts b/src/plugins/data/public/query/state_sync/sync_state_with_url.ts index abb9953b844da..2f068ccdfab4f 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/query/timefilter/lib/change_time_filter.ts b/src/plugins/data/public/query/timefilter/lib/change_time_filter.ts index a5601bbc2457a..0f4cdabc69d6b 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 9e2b19002ff7f..19e2c656be50d 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 cc796ad749f0b..70f25bd510ef0 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 734161ea87232..90ca8e0783a20 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 e15f667128c4f..ea172c2ccac35 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_editor/lib/filter_operators.ts b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts index 218f8f5790e44..bc3f01aeb3c8f 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/src/plugins/data/public/ui/filter_bar/filter_item.tsx b/src/plugins/data/public/ui/filter_bar/filter_item.tsx index 09e0571c2a870..b37fc9108ccd2 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 a15cec4bd286d..d551af87c7279 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 143400a2c09d3..a9e8cda082314 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,12 +16,20 @@ import { buildPhrasesFilter, buildRangeFilter, isFilterDisabled, + nodeTypes, + fromKueryExpression, + toElasticsearchQuery, + buildEsQuery, + buildQueryFromFilters, } 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, @@ -52,28 +56,29 @@ export const exporters = { * esQuery and esKuery: */ -import { - nodeTypes, - fromKueryExpression, - toElasticsearchQuery, - buildEsQuery, - buildQueryFromFilters, - getEsQueryConfig, -} from '../common'; +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. + */ export const esKuery = { nodeTypes, fromKueryExpression, toElasticsearchQuery, }; +/* + * Filter helper namespace + * @deprecated Please import from the package kbn/es-query directly. This will be deprecated in v8.0.0. + */ export const esQuery = { buildQueryFromFilters, getEsQueryConfig, buildEsQuery, }; -export { EsQueryConfig, KueryNode } from '../common'; +export type { EsQueryConfig, KueryNode, IFieldSubType } from '../common'; /* * Field Formats: @@ -146,7 +151,6 @@ export { export { IFieldType, - IFieldSubType, ES_FIELD_TYPES, KBN_FIELD_TYPES, IndexPatternAttributes, diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index f25f7b76bf331..895c1e3b96ae9 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -23,6 +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 as EsQueryConfig_2 } from '@kbn/es-query'; import { estypes } from '@elastic/elasticsearch'; import { EventEmitter } from 'events'; import { ExecutionContext } from 'src/plugins/expressions/common'; @@ -30,18 +31,22 @@ 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 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 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'; 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 { KibanaExecutionContext } from 'src/core/public'; import { KibanaRequest } from 'src/core/server'; import { KibanaRequest as KibanaRequest_2 } from 'kibana/server'; +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'; @@ -55,7 +60,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 { RangeFilter } from 'src/plugins/data/public'; +import { Query } from '@kbn/es-query'; import { RecursiveReadonly } from '@kbn/utility-types'; import { RequestAdapter } from 'src/plugins/inspector/common'; import { RequestHandlerContext } from 'src/core/server'; @@ -445,53 +450,44 @@ export type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<'e // // @public (undocumented) 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").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").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; + 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("../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; + 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) // -// @public (undocumented) -export interface EsQueryConfig { - // (undocumented) - allowLeadingWildcards: boolean; - // (undocumented) - dateFormatTZ?: string; - // (undocumented) - ignoreFilterIfFieldNotInIndex: boolean; - // (undocumented) - queryStringOptions: Record; -} +// @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) // @@ -596,12 +592,8 @@ 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; -}; +// @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) // @@ -629,7 +621,7 @@ export function getShardTimeout(config: SharedGlobalConfig_2): Pick): { @@ -682,19 +674,9 @@ 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; - }; -} +// @public @deprecated (undocumented) +export type IFieldSubType = IFieldSubType_2; -// 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) @@ -1135,15 +1117,8 @@ 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; -} +// @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) // @@ -1308,15 +1283,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) // @@ -1515,47 +1482,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: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: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 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 42b750cfd27c6..0b67d6f0d1984 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/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 7b5eb1e029069..d8508f6b735a0 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.' ); } }); diff --git a/src/plugins/vis_type_timeseries/server/types.ts b/src/plugins/vis_type_timeseries/server/types.ts index a2657f99d222d..11131f33e4a1c 100644 --- a/src/plugins/vis_type_timeseries/server/types.ts +++ b/src/plugins/vis_type_timeseries/server/types.ts @@ -6,14 +6,11 @@ * Side Public License, v 1. */ -import type { Observable } from 'rxjs'; -import type { SharedGlobalConfig } from 'kibana/server'; +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 { 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 9e3cf0a5421c1..4d57ccf402a9a 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/tasks/config/peg.js b/tasks/config/peg.js index 754f7a0290fe7..0c299ae5748dd 100644 --- a/tasks/config/peg.js +++ b/tasks/config/peg.js @@ -7,14 +7,6 @@ */ 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', - 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', diff --git a/test/api_integration/apis/saved_objects/find.ts b/test/api_integration/apis/saved_objects/find.ts index a38043c7c9352..9b2b3a96cba5b 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, end of input, whitespace but "<" found.\ndashboard.' + 'attributes.title:foo = ({ diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx index a0a6b30e541a7..ec1421577dc2b 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 25c8f9880063f..ff0e42870ab30 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 9a2b2c21136df..0e2c38bf7afe4 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/ml/common/types/es_client.ts b/x-pack/plugins/ml/common/types/es_client.ts index 29a7a81aa5693..433deac02bc9c 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 8ff75205b4d48..e054df09bd95b 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 60355dae5baf4..436eee0698708 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 d137b36a7e8c7..8a83b5c2a8cb0 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 6f9d8efdc0681..4310402a43a08 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 717d98715453d..fbda2f4ff62e2 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/osquery/common/typed_json.ts b/x-pack/plugins/osquery/common/typed_json.ts index 8ce6907beb80b..7ef7469a5ebe7 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/detection_engine/get_query_filter.ts b/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.ts index 1e7bcb0002dad..69f21e605627b 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/common/search_strategy/index_fields/index.ts b/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts index 85d339970dc59..f7f3df31db237 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,9 @@ * 2.0. */ -import { IIndexPattern } from 'src/plugins/data/public'; -import { - IEsSearchRequest, - IEsSearchResponse, - IFieldSubType, -} from '../../../../../../src/plugins/data/common'; +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'; interface FieldInfo { diff --git a/x-pack/plugins/security_solution/common/typed_json.ts b/x-pack/plugins/security_solution/common/typed_json.ts index 8ce6907beb80b..1c42ab3a6fd24 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 224d38c8462f2..d19d6ee734654 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/mock/timeline_results.ts b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts index 806031b07e0c9..f271f49e56a29 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, 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 fa1eec9ee0e82..26497c7f6ee3b 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/alerts_table/actions.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx index 601e0509009ce..245aa67d677be 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 { 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/components/rules/autocomplete_field/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/autocomplete_field/index.tsx index 503a568f13744..51404f65dc7d4 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/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 ec9ee47bcb087..8fd2b5f437bcd 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/public/timelines/components/timeline/helpers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.tsx index 7c38474d39dba..2c85f1547dbeb 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/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 4ca9448f5e3c7..d4ce280e73268 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, IIndexPattern } from '../../../../../../../src/plugins/data/common'; +import { buildEsQuery } from '@kbn/es-query'; +import type { IIndexPattern } from 'src/plugins/data/public'; import { RuleDataClient, createPersistenceRuleTypeFactory, 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 edf6d244cfa17..052270d491cda 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/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 37e0a293b03a0..9a95517986bee 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; 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 76ab48a8243db..8fbab31b49266 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: '', }; diff --git a/x-pack/plugins/timelines/common/typed_json.ts b/x-pack/plugins/timelines/common/typed_json.ts index 71ece54777871..c639c1c0322dc 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/timelines/common/types/timeline/columns/index.ts b/x-pack/plugins/timelines/common/types/timeline/columns/index.ts index 61f0c6a0b8f23..9161ea3ea78ce 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'; 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 fc040522f3e15..6cfd97c8bad55 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 e31d682fd7021..391b15e8fdbac 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, diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 4f74d59e56114..f0237de8e2382 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -772,12 +772,12 @@ "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": "空白類", + "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 781283abbb6ce..5027ff99d20b8 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -775,12 +775,12 @@ "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": "空白", + "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/yarn.lock b/yarn.lock index 1f350e6a2967e..fa934ff4b8a8f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2783,6 +2783,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 "" @@ -21530,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"