From d84777f053f6e2be1a6b7b8f19ba498cc6972730 Mon Sep 17 00:00:00 2001 From: Luke Elmers Date: Tue, 11 Aug 2020 09:53:42 -0600 Subject: [PATCH] [data.search.SearchSource] Move some SearchSource dependencies to the server. (#74607) --- ...-plugins-data-public.getsearcherrortype.md | 22 ------- .../kibana-plugin-plugins-data-public.md | 3 +- ...s-data-public.searcherror._constructor_.md | 20 ------ ...-plugin-plugins-data-public.searcherror.md | 26 +++----- src/plugins/data/public/index.ts | 1 - src/plugins/data/public/public.api.md | 39 +++++------- src/plugins/data/public/search/fetch/index.ts | 1 - .../data/public/search/fetch/request_error.ts | 4 +- .../data/public/search/fetch/search_error.ts | 62 ------------------- src/plugins/data/public/search/fetch/types.ts | 9 +++ src/plugins/data/public/search/index.ts | 1 - .../search_source/create_search_source.ts | 2 +- .../public/search/search_source/parse_json.ts | 2 +- .../search/search_source/search_source.ts | 2 +- .../common}/index.ts | 3 +- .../utils => common}/migrate_legacy_query.ts | 0 src/plugins/kibana_legacy/kibana.json | 2 +- src/plugins/kibana_legacy/public/index.ts | 2 +- .../kibana_legacy/public/utils/index.ts | 1 - src/plugins/kibana_legacy/server/index.ts | 2 +- .../field_wildcard.test.ts | 0 .../field_wildcard.ts | 1 + src/plugins/kibana_utils/common/index.ts | 1 + src/plugins/kibana_utils/public/index.ts | 3 +- src/plugins/kibana_utils/server/index.ts | 9 ++- 25 files changed, 58 insertions(+), 160 deletions(-) delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md delete mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md delete mode 100644 src/plugins/data/public/search/fetch/search_error.ts rename src/plugins/{kibana_utils/public/field_wildcard => kibana_legacy/common}/index.ts (91%) rename src/plugins/kibana_legacy/{public/utils => common}/migrate_legacy_query.ts (100%) rename src/plugins/kibana_utils/{public/field_wildcard => common}/field_wildcard.test.ts (100%) rename src/plugins/kibana_utils/{public/field_wildcard => common}/field_wildcard.ts (99%) diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md deleted file mode 100644 index b46728c09379..000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md +++ /dev/null @@ -1,22 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [getSearchErrorType](./kibana-plugin-plugins-data-public.getsearcherrortype.md) - -## getSearchErrorType() function - -Signature: - -```typescript -export declare function getSearchErrorType({ message }: Pick): "UNSUPPORTED_QUERY" | undefined; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| { message } | Pick<SearchError, 'message'> | | - -Returns: - -`"UNSUPPORTED_QUERY" | undefined` - 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 c8d45804a372..53c30b52cb98 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 @@ -18,7 +18,6 @@ | [OptionedParamType](./kibana-plugin-plugins-data-public.optionedparamtype.md) | | | [Plugin](./kibana-plugin-plugins-data-public.plugin.md) | | | [RequestTimeoutError](./kibana-plugin-plugins-data-public.requesttimeouterror.md) | Class used to signify that a request timed out. Useful for applications to conditionally handle this type of error differently than other errors. | -| [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) | | | [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) | | | [TimeHistory](./kibana-plugin-plugins-data-public.timehistory.md) | | @@ -39,7 +38,6 @@ | --- | --- | | [getDefaultQuery(language)](./kibana-plugin-plugins-data-public.getdefaultquery.md) | | | [getEsPreference(uiSettings, sessionId)](./kibana-plugin-plugins-data-public.getespreference.md) | | -| [getSearchErrorType({ message })](./kibana-plugin-plugins-data-public.getsearcherrortype.md) | | | [getSearchParamsFromRequest(searchRequest, dependencies)](./kibana-plugin-plugins-data-public.getsearchparamsfromrequest.md) | | | [getTime(indexPattern, timeRange, options)](./kibana-plugin-plugins-data-public.gettime.md) | | | [plugin(initializerContext)](./kibana-plugin-plugins-data-public.plugin.md) | | @@ -80,6 +78,7 @@ | [RefreshInterval](./kibana-plugin-plugins-data-public.refreshinterval.md) | | | [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) | | | [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) | | +| [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) | | | [SearchInterceptorDeps](./kibana-plugin-plugins-data-public.searchinterceptordeps.md) | | | [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) | | | [TabbedAggColumn](./kibana-plugin-plugins-data-public.tabbedaggcolumn.md) | \* | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md deleted file mode 100644 index 4d7691d24a79..000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md +++ /dev/null @@ -1,20 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) > [(constructor)](./kibana-plugin-plugins-data-public.searcherror._constructor_.md) - -## SearchError.(constructor) - -Constructs a new instance of the `SearchError` class - -Signature: - -```typescript -constructor({ status, title, message, path, type }: SearchErrorOptions); -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| { status, title, message, path, type } | SearchErrorOptions | | - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md index 06e60cadf4a8..65b46bf6cba4 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md @@ -2,28 +2,22 @@ [Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) -## SearchError class +## SearchError interface Signature: ```typescript -export declare class SearchError extends Error +export interface SearchError ``` -## Constructors - -| Constructor | Modifiers | Description | -| --- | --- | --- | -| [(constructor)({ status, title, message, path, type })](./kibana-plugin-plugins-data-public.searcherror._constructor_.md) | | Constructs a new instance of the SearchError class | - ## Properties -| Property | Modifiers | Type | Description | -| --- | --- | --- | --- | -| [message](./kibana-plugin-plugins-data-public.searcherror.message.md) | | string | | -| [name](./kibana-plugin-plugins-data-public.searcherror.name.md) | | string | | -| [path](./kibana-plugin-plugins-data-public.searcherror.path.md) | | string | | -| [status](./kibana-plugin-plugins-data-public.searcherror.status.md) | | string | | -| [title](./kibana-plugin-plugins-data-public.searcherror.title.md) | | string | | -| [type](./kibana-plugin-plugins-data-public.searcherror.type.md) | | string | | +| Property | Type | Description | +| --- | --- | --- | +| [message](./kibana-plugin-plugins-data-public.searcherror.message.md) | string | | +| [name](./kibana-plugin-plugins-data-public.searcherror.name.md) | string | | +| [path](./kibana-plugin-plugins-data-public.searcherror.path.md) | string | | +| [status](./kibana-plugin-plugins-data-public.searcherror.status.md) | string | | +| [title](./kibana-plugin-plugins-data-public.searcherror.title.md) | string | | +| [type](./kibana-plugin-plugins-data-public.searcherror.type.md) | string | | diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 5a9930d2b6b5..f036d5f30a0e 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -337,7 +337,6 @@ export { // search ES_SEARCH_STRATEGY, getEsPreference, - getSearchErrorType, ISearch, ISearchOptions, ISearchGeneric, diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index adff7b205b93..216ed018957e 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -703,11 +703,6 @@ export function getEsPreference(uiSettings: IUiSettingsClient_2, sessionId?: str // @public export const getKbnTypeNames: () => string[]; -// Warning: (ae-missing-release-tag) "getSearchErrorType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export function getSearchErrorType({ message }: Pick): "UNSUPPORTED_QUERY" | undefined; - // Warning: (ae-forgotten-export) The symbol "ISearchRequestParams" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "getSearchParamsFromRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1696,9 +1691,7 @@ export type SearchBarProps = SearchBarOwnProps & SearchBarInjectedDeps; // Warning: (ae-missing-release-tag) "SearchError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export class SearchError extends Error { - // Warning: (ae-forgotten-export) The symbol "SearchErrorOptions" needs to be exported by the entry point index.d.ts - constructor({ status, title, message, path, type }: SearchErrorOptions); +export interface SearchError { // (undocumented) message: string; // (undocumented) @@ -1968,21 +1961,21 @@ export const UI_SETTINGS: { // src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:370:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:370:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:370:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:370:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:372:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:373:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:382:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:383:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:384:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:385:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:393:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:394:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:397:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:369:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:369:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:369:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:369:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:371:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:372:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:381:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:382:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:383:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:384:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:388:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:392:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:393:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:396: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:45:5 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts // src/plugins/data/public/types.ts:54:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts // src/plugins/data/public/types.ts:55:5 - (ae-forgotten-export) The symbol "createFiltersFromRangeSelectAction" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/data/public/search/fetch/index.ts b/src/plugins/data/public/search/fetch/index.ts index ab856d681ba1..79cdad1897f9 100644 --- a/src/plugins/data/public/search/fetch/index.ts +++ b/src/plugins/data/public/search/fetch/index.ts @@ -27,6 +27,5 @@ export { getMaxConcurrentShardRequests, } from './get_search_params'; -export { SearchError, getSearchErrorType } from './search_error'; export { RequestFailure } from './request_error'; export { handleResponse } from './handle_response'; diff --git a/src/plugins/data/public/search/fetch/request_error.ts b/src/plugins/data/public/search/fetch/request_error.ts index e216d32e127c..5e42a6fcf5b6 100644 --- a/src/plugins/data/public/search/fetch/request_error.ts +++ b/src/plugins/data/public/search/fetch/request_error.ts @@ -17,8 +17,8 @@ * under the License. */ -import { KbnError } from '../../../../kibana_utils/public'; -import { SearchResponse, SearchError } from '..'; +import { KbnError } from '../../../../kibana_utils/common'; +import { SearchError, SearchResponse } from './types'; /** * Request Failure - When an entire multi request fails diff --git a/src/plugins/data/public/search/fetch/search_error.ts b/src/plugins/data/public/search/fetch/search_error.ts deleted file mode 100644 index d4042fb17499..000000000000 --- a/src/plugins/data/public/search/fetch/search_error.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -interface SearchErrorOptions { - status: string; - title: string; - message: string; - path: string; - type: string; -} - -export class SearchError extends Error { - public name: string; - public status: string; - public title: string; - public message: string; - public path: string; - public type: string; - - constructor({ status, title, message, path, type }: SearchErrorOptions) { - super(message); - this.name = 'SearchError'; - this.status = status; - this.title = title; - this.message = message; - this.path = path; - this.type = type; - - // captureStackTrace is only available in the V8 engine, so any browser using - // a different JS engine won't have access to this method. - if (Error.captureStackTrace) { - Error.captureStackTrace(this, SearchError); - } - - // Babel doesn't support traditional `extends` syntax for built-in classes. - // https://babeljs.io/docs/en/caveats/#classes - Object.setPrototypeOf(this, SearchError.prototype); - } -} - -export function getSearchErrorType({ message }: Pick) { - const msg = message.toLowerCase(); - if (msg.indexOf('unsupported query') > -1) { - return 'UNSUPPORTED_QUERY'; - } -} diff --git a/src/plugins/data/public/search/fetch/types.ts b/src/plugins/data/public/search/fetch/types.ts index 1aba4f66bb4d..dda66d6b5238 100644 --- a/src/plugins/data/public/search/fetch/types.ts +++ b/src/plugins/data/public/search/fetch/types.ts @@ -33,3 +33,12 @@ export interface FetchHandlers { config: IUiSettingsClient; esShardTimeout: number; } + +export interface SearchError { + name: string; + status: string; + title: string; + message: string; + path: string; + type: string; +} diff --git a/src/plugins/data/public/search/index.ts b/src/plugins/data/public/search/index.ts index 40d45ab88ea9..96445e536714 100644 --- a/src/plugins/data/public/search/index.ts +++ b/src/plugins/data/public/search/index.ts @@ -34,7 +34,6 @@ export { FetchOptions, SearchRequest, SearchResponse, - getSearchErrorType, getSearchParamsFromRequest, } from './fetch'; diff --git a/src/plugins/data/public/search/search_source/create_search_source.ts b/src/plugins/data/public/search/search_source/create_search_source.ts index 3466d60e5dd7..4c44f4d62d46 100644 --- a/src/plugins/data/public/search/search_source/create_search_source.ts +++ b/src/plugins/data/public/search/search_source/create_search_source.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { migrateLegacyQuery } from '../../../../kibana_legacy/public'; +import { migrateLegacyQuery } from '../../../../kibana_legacy/common'; import { SearchSource, SearchSourceDependencies } from './search_source'; import { IndexPatternsContract } from '../../index_patterns/index_patterns'; import { SearchSourceFields } from './types'; diff --git a/src/plugins/data/public/search/search_source/parse_json.ts b/src/plugins/data/public/search/search_source/parse_json.ts index f0eb377cedc7..8f4652531142 100644 --- a/src/plugins/data/public/search/search_source/parse_json.ts +++ b/src/plugins/data/public/search/search_source/parse_json.ts @@ -18,7 +18,7 @@ */ import { SearchSourceFields } from './types'; -import { InvalidJSONProperty } from '../../../../kibana_utils/public'; +import { InvalidJSONProperty } from '../../../../kibana_utils/common'; export const parseSearchSourceJSON = (searchSourceJSON: string) => { // if we have a searchSource, set its values based on the searchSourceJson field diff --git a/src/plugins/data/public/search/search_source/search_source.ts b/src/plugins/data/public/search/search_source/search_source.ts index c97a5d0638a6..847dc8853d6b 100644 --- a/src/plugins/data/public/search/search_source/search_source.ts +++ b/src/plugins/data/public/search/search_source/search_source.ts @@ -75,7 +75,7 @@ import { map } from 'rxjs/operators'; import { CoreStart } from 'kibana/public'; import { normalizeSortRequest } from './normalize_sort_request'; import { filterDocvalueFields } from './filter_docvalue_fields'; -import { fieldWildcardFilter } from '../../../../kibana_utils/public'; +import { fieldWildcardFilter } from '../../../../kibana_utils/common'; import { IIndexPattern, ISearchGeneric, SearchRequest } from '../..'; import { SearchSourceOptions, SearchSourceFields } from './types'; import { FetchOptions, RequestFailure, handleResponse, getSearchParamsFromRequest } from '../fetch'; diff --git a/src/plugins/kibana_utils/public/field_wildcard/index.ts b/src/plugins/kibana_legacy/common/index.ts similarity index 91% rename from src/plugins/kibana_utils/public/field_wildcard/index.ts rename to src/plugins/kibana_legacy/common/index.ts index db9f830e450b..9c16d7b27386 100644 --- a/src/plugins/kibana_utils/public/field_wildcard/index.ts +++ b/src/plugins/kibana_legacy/common/index.ts @@ -17,4 +17,5 @@ * under the License. */ -export * from './field_wildcard'; +export * from './kbn_base_url'; +export * from './migrate_legacy_query'; diff --git a/src/plugins/kibana_legacy/public/utils/migrate_legacy_query.ts b/src/plugins/kibana_legacy/common/migrate_legacy_query.ts similarity index 100% rename from src/plugins/kibana_legacy/public/utils/migrate_legacy_query.ts rename to src/plugins/kibana_legacy/common/migrate_legacy_query.ts diff --git a/src/plugins/kibana_legacy/kibana.json b/src/plugins/kibana_legacy/kibana.json index 606acd8b88b0..79264d95dcc2 100644 --- a/src/plugins/kibana_legacy/kibana.json +++ b/src/plugins/kibana_legacy/kibana.json @@ -3,5 +3,5 @@ "version": "kibana", "server": true, "ui": true, - "extraPublicDirs": ["common/kbn_base_url"] + "extraPublicDirs": ["common", "common/kbn_base_url"] } diff --git a/src/plugins/kibana_legacy/public/index.ts b/src/plugins/kibana_legacy/public/index.ts index 75e81b050574..27b940b0a456 100644 --- a/src/plugins/kibana_legacy/public/index.ts +++ b/src/plugins/kibana_legacy/public/index.ts @@ -24,7 +24,7 @@ export const plugin = (initializerContext: PluginInitializerContext) => new KibanaLegacyPlugin(initializerContext); export * from './plugin'; -export { kbnBaseUrl } from '../common/kbn_base_url'; +export { kbnBaseUrl, migrateLegacyQuery } from '../common'; export { initAngularBootstrap } from './angular_bootstrap'; export { PaginateDirectiveProvider, PaginateControlsDirectiveProvider } from './paginate/paginate'; diff --git a/src/plugins/kibana_legacy/public/utils/index.ts b/src/plugins/kibana_legacy/public/utils/index.ts index e7dd55ec5582..a32cd5e40a04 100644 --- a/src/plugins/kibana_legacy/public/utils/index.ts +++ b/src/plugins/kibana_legacy/public/utils/index.ts @@ -17,7 +17,6 @@ * under the License. */ -export * from './migrate_legacy_query'; export * from './system_api'; export * from './normalize_path'; // @ts-ignore diff --git a/src/plugins/kibana_legacy/server/index.ts b/src/plugins/kibana_legacy/server/index.ts index 0188f9b1ec51..3ddcac1517f7 100644 --- a/src/plugins/kibana_legacy/server/index.ts +++ b/src/plugins/kibana_legacy/server/index.ts @@ -50,7 +50,7 @@ export const config: PluginConfigDescriptor = { ], }; -export { kbnBaseUrl } from '../common/kbn_base_url'; +export { kbnBaseUrl, migrateLegacyQuery } from '../common'; class Plugin { public setup(core: CoreSetup) {} diff --git a/src/plugins/kibana_utils/public/field_wildcard/field_wildcard.test.ts b/src/plugins/kibana_utils/common/field_wildcard.test.ts similarity index 100% rename from src/plugins/kibana_utils/public/field_wildcard/field_wildcard.test.ts rename to src/plugins/kibana_utils/common/field_wildcard.test.ts diff --git a/src/plugins/kibana_utils/public/field_wildcard/field_wildcard.ts b/src/plugins/kibana_utils/common/field_wildcard.ts similarity index 99% rename from src/plugins/kibana_utils/public/field_wildcard/field_wildcard.ts rename to src/plugins/kibana_utils/common/field_wildcard.ts index 2aa9a255bd5c..bfe5a0f3a0a8 100644 --- a/src/plugins/kibana_utils/public/field_wildcard/field_wildcard.ts +++ b/src/plugins/kibana_utils/common/field_wildcard.ts @@ -19,6 +19,7 @@ import { escapeRegExp, memoize } from 'lodash'; +// @internal export const makeRegEx = memoize(function makeRegEx(glob: string) { const globRegex = glob.split('*').map(escapeRegExp).join('.*'); return new RegExp(`^${globRegex}$`); diff --git a/src/plugins/kibana_utils/common/index.ts b/src/plugins/kibana_utils/common/index.ts index c94021872b4e..1ec5737c5a38 100644 --- a/src/plugins/kibana_utils/common/index.ts +++ b/src/plugins/kibana_utils/common/index.ts @@ -18,6 +18,7 @@ */ export * from './defer'; +export * from './field_wildcard'; export * from './of'; export * from './ui'; export * from './state_containers'; diff --git a/src/plugins/kibana_utils/public/index.ts b/src/plugins/kibana_utils/public/index.ts index d1c9eec0e990..7edf62ce04e8 100644 --- a/src/plugins/kibana_utils/public/index.ts +++ b/src/plugins/kibana_utils/public/index.ts @@ -21,6 +21,8 @@ export { calculateObjectHash, defer, Defer, + fieldWildcardFilter, + fieldWildcardMatcher, Get, JsonArray, JsonObject, @@ -34,7 +36,6 @@ export { } from '../common'; export * from './core'; export * from '../common/errors'; -export * from './field_wildcard'; export * from './render_complete'; export * from './resize_checker'; export * from '../common/state_containers'; diff --git a/src/plugins/kibana_utils/server/index.ts b/src/plugins/kibana_utils/server/index.ts index b8b768da0192..bf3361d1e536 100644 --- a/src/plugins/kibana_utils/server/index.ts +++ b/src/plugins/kibana_utils/server/index.ts @@ -17,4 +17,11 @@ * under the License. */ -export { Get, Set, createGetterSetter, url } from '../common'; +export { + createGetterSetter, + fieldWildcardFilter, + fieldWildcardMatcher, + Get, + Set, + url, +} from '../common';