Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up ui/courier exports. #52037

Merged
merged 3 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/legacy/ui/public/courier/fetch/get_search_params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export function getSearchParams(config: IUiSettingsClient, esShardTimeout: numbe
};
}

export function getIgnoreThrottled(config: IUiSettingsClient) {
function getIgnoreThrottled(config: IUiSettingsClient) {
return !config.get('search:includeFrozen');
}

export function getMaxConcurrentShardRequests(config: IUiSettingsClient) {
function getMaxConcurrentShardRequests(config: IUiSettingsClient) {
const maxConcurrentShardRequests = config.get('courier:maxConcurrentShardRequests');
return maxConcurrentShardRequests > 0 ? maxConcurrentShardRequests : undefined;
}
Expand Down
33 changes: 28 additions & 5 deletions src/legacy/ui/public/courier/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,31 @@
* under the License.
*/

export * from './fetch';
export * from './search_source';
export * from './search_strategy';
export * from './utils/courier_inspector_utils';
export * from './types';
export { SearchSource } from './search_source';

// TODO: Exporting this mock outside of jest tests causes errors because
// jest is undefined. Need to refactor the mock to be consistent with
// other NP-style mocks.
// export { searchSourceMock } from './search_source/mocks';

export {
addSearchStrategy, // used externally by Rollups
getSearchErrorType, // used externally by Rollups
hasSearchStategyForIndexPattern, // used externally by Discover
isDefaultTypeIndexPattern, // used externally by Discover
SearchError, // used externally by Visualizations & Rollups
} from './search_strategy';

export {
getRequestInspectorStats,
getResponseInspectorStats,
} from './utils/courier_inspector_utils';

// types
export { SearchSourceContract } from './search_source';

export {
EsQuerySortValue, // used externally by Discover
FetchOptions, // used externally by AggTypes
SortDirection, // used externally by Discover
} from './types';
7 changes: 3 additions & 4 deletions src/legacy/ui/public/courier/utils/courier_inspector_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { i18n } from '@kbn/i18n';
import { SearchResponse } from 'elasticsearch';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like changes in this file don't do anything.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct, they don't make any functional changes; this was simply to make it faster/easier for me to parse which items are exported and which aren't as I'm making the public NP contract. (The rest of the module uses inline exports like this)

import { SearchSourceContract, RequestInspectorStats } from '../types';

function getRequestInspectorStats(searchSource: SearchSourceContract) {
export function getRequestInspectorStats(searchSource: SearchSourceContract) {
const stats: RequestInspectorStats = {};
const index = searchSource.getField('index');

Expand Down Expand Up @@ -56,7 +56,8 @@ function getRequestInspectorStats(searchSource: SearchSourceContract) {

return stats;
}
function getResponseInspectorStats(

export function getResponseInspectorStats(
searchSource: SearchSourceContract,
resp: SearchResponse<unknown>
) {
Expand Down Expand Up @@ -121,5 +122,3 @@ function getResponseInspectorStats(

return stats;
}

export { getRequestInspectorStats, getResponseInspectorStats };