[data.search.SearchSource] Move some SearchSource dependencies to the server. (#74607)

This commit is contained in:
Luke Elmers 2020-08-11 09:53:42 -06:00 committed by GitHub
parent bc0b4821ad
commit d84777f053
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 58 additions and 160 deletions

View file

@ -1,22 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [getSearchErrorType](./kibana-plugin-plugins-data-public.getsearcherrortype.md)
## getSearchErrorType() function
<b>Signature:</b>
```typescript
export declare function getSearchErrorType({ message }: Pick<SearchError, 'message'>): "UNSUPPORTED_QUERY" | undefined;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| { message } | <code>Pick&lt;SearchError, 'message'&gt;</code> | |
<b>Returns:</b>
`"UNSUPPORTED_QUERY" | undefined`

View file

@ -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) | \* |

View file

@ -1,20 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) &gt; [(constructor)](./kibana-plugin-plugins-data-public.searcherror._constructor_.md)
## SearchError.(constructor)
Constructs a new instance of the `SearchError` class
<b>Signature:</b>
```typescript
constructor({ status, title, message, path, type }: SearchErrorOptions);
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| { status, title, message, path, type } | <code>SearchErrorOptions</code> | |

View file

@ -2,28 +2,22 @@
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchError](./kibana-plugin-plugins-data-public.searcherror.md)
## SearchError class
## SearchError interface
<b>Signature:</b>
```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 <code>SearchError</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [message](./kibana-plugin-plugins-data-public.searcherror.message.md) | | <code>string</code> | |
| [name](./kibana-plugin-plugins-data-public.searcherror.name.md) | | <code>string</code> | |
| [path](./kibana-plugin-plugins-data-public.searcherror.path.md) | | <code>string</code> | |
| [status](./kibana-plugin-plugins-data-public.searcherror.status.md) | | <code>string</code> | |
| [title](./kibana-plugin-plugins-data-public.searcherror.title.md) | | <code>string</code> | |
| [type](./kibana-plugin-plugins-data-public.searcherror.type.md) | | <code>string</code> | |
| Property | Type | Description |
| --- | --- | --- |
| [message](./kibana-plugin-plugins-data-public.searcherror.message.md) | <code>string</code> | |
| [name](./kibana-plugin-plugins-data-public.searcherror.name.md) | <code>string</code> | |
| [path](./kibana-plugin-plugins-data-public.searcherror.path.md) | <code>string</code> | |
| [status](./kibana-plugin-plugins-data-public.searcherror.status.md) | <code>string</code> | |
| [title](./kibana-plugin-plugins-data-public.searcherror.title.md) | <code>string</code> | |
| [type](./kibana-plugin-plugins-data-public.searcherror.type.md) | <code>string</code> | |

View file

@ -337,7 +337,6 @@ export {
// search
ES_SEARCH_STRATEGY,
getEsPreference,
getSearchErrorType,
ISearch,
ISearchOptions,
ISearchGeneric,

View file

@ -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<SearchError, 'message'>): "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

View file

@ -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';

View file

@ -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

View file

@ -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<SearchError, 'message'>) {
const msg = message.toLowerCase();
if (msg.indexOf('unsupported query') > -1) {
return 'UNSUPPORTED_QUERY';
}
}

View file

@ -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;
}

View file

@ -34,7 +34,6 @@ export {
FetchOptions,
SearchRequest,
SearchResponse,
getSearchErrorType,
getSearchParamsFromRequest,
} from './fetch';

View file

@ -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';

View file

@ -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

View file

@ -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';

View file

@ -17,4 +17,5 @@
* under the License.
*/
export * from './field_wildcard';
export * from './kbn_base_url';
export * from './migrate_legacy_query';

View file

@ -3,5 +3,5 @@
"version": "kibana",
"server": true,
"ui": true,
"extraPublicDirs": ["common/kbn_base_url"]
"extraPublicDirs": ["common", "common/kbn_base_url"]
}

View file

@ -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';

View file

@ -17,7 +17,6 @@
* under the License.
*/
export * from './migrate_legacy_query';
export * from './system_api';
export * from './normalize_path';
// @ts-ignore

View file

@ -50,7 +50,7 @@ export const config: PluginConfigDescriptor<ConfigSchema> = {
],
};
export { kbnBaseUrl } from '../common/kbn_base_url';
export { kbnBaseUrl, migrateLegacyQuery } from '../common';
class Plugin {
public setup(core: CoreSetup) {}

View file

@ -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}$`);

View file

@ -18,6 +18,7 @@
*/
export * from './defer';
export * from './field_wildcard';
export * from './of';
export * from './ui';
export * from './state_containers';

View file

@ -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';

View file

@ -17,4 +17,11 @@
* under the License.
*/
export { Get, Set, createGetterSetter, url } from '../common';
export {
createGetterSetter,
fieldWildcardFilter,
fieldWildcardMatcher,
Get,
Set,
url,
} from '../common';