Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasolson committed Mar 12, 2020
1 parent 3976cdb commit df058c2
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 29 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) &gt; [ISearchCancel](./kibana-plugin-plugins-data-server.isearchcancel.md)

## ISearchCancel type

<b>Signature:</b>

```typescript
export declare type ISearchCancel<T extends TStrategyTypes> = (id: string) => Promise<void>;
```
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
| Type Alias | Description |
| --- | --- |
| [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md) | |
| [ICancel](./kibana-plugin-plugins-data-server.icancel.md) | |
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) | |
| [ISearch](./kibana-plugin-plugins-data-server.isearch.md) | |
| [ISearchCancel](./kibana-plugin-plugins-data-server.isearchcancel.md) | |
| [TSearchStrategyProvider](./kibana-plugin-plugins-data-server.tsearchstrategyprovider.md) | Search strategy provider creates an instance of a search strategy with the request handler context bound to it. This way every search strategy can use whatever information they require from the request context. |

2 changes: 1 addition & 1 deletion src/plugins/data/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export {

export {
ISearch,
ICancel,
ISearchCancel,
ISearchOptions,
IRequestTypesMap,
IResponseTypesMap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
* under the License.
*/

import { ISearchGeneric, ICancelGeneric } from './i_search';
import { ISearchGeneric, ISearchCancelGeneric } from './i_search';

export interface IRouteHandlerSearchContext {
search: ISearchGeneric;
cancel: ICancelGeneric;
cancel: ISearchCancelGeneric;
}
4 changes: 2 additions & 2 deletions src/plugins/data/server/search/i_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type ISearchGeneric = <T extends TStrategyTypes = typeof ES_SEARCH_STRATE
strategy?: T
) => Promise<IResponseTypesMap[T]>;

export type ICancelGeneric = <T extends TStrategyTypes = typeof ES_SEARCH_STRATEGY>(
export type ISearchCancelGeneric = <T extends TStrategyTypes = typeof ES_SEARCH_STRATEGY>(
id: string,
strategy?: T
) => Promise<void>;
Expand All @@ -52,4 +52,4 @@ export type ISearch<T extends TStrategyTypes> = (
options?: ISearchOptions
) => Promise<IResponseTypesMap[T]>;

export type ICancel<T extends TStrategyTypes> = (id: string) => Promise<void>;
export type ISearchCancel<T extends TStrategyTypes> = (id: string) => Promise<void>;
4 changes: 2 additions & 2 deletions src/plugins/data/server/search/i_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { APICaller } from 'kibana/server';
import { ISearch, ICancel, ISearchGeneric } from './i_search';
import { ISearch, ISearchCancel, ISearchGeneric } from './i_search';
import { TStrategyTypes } from './strategy_types';
import { ISearchContext } from './i_search_context';

Expand All @@ -28,7 +28,7 @@ import { ISearchContext } from './i_search_context';
*/
export interface ISearchStrategy<T extends TStrategyTypes> {
search: ISearch<T>;
cancel?: ICancel<T>;
cancel?: ISearchCancel<T>;
}

/**
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/data/server/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ export { ISearchSetup } from './i_search_setup';

export { ISearchContext } from './i_search_context';

export { ISearch, ICancel, ISearchOptions, IRequestTypesMap, IResponseTypesMap } from './i_search';
export {
ISearch,
ISearchCancel,
ISearchOptions,
IRequestTypesMap,
IResponseTypesMap,
} from './i_search';

export { TStrategyTypes } from './strategy_types';

Expand Down
12 changes: 6 additions & 6 deletions src/plugins/data/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,6 @@ export function getDefaultSearchParams(config: SharedGlobalConfig): {
restTotalHitsAsInt: boolean;
};

// Warning: (ae-forgotten-export) The symbol "TStrategyTypes" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "ICancel" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type ICancel<T extends TStrategyTypes> = (id: string) => Promise<void>;

// Warning: (ae-missing-release-tag) "IFieldFormatsRegistry" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -506,11 +500,17 @@ export interface IResponseTypesMap {
[ES_SEARCH_STRATEGY]: IEsSearchResponse;
}

// Warning: (ae-forgotten-export) The symbol "TStrategyTypes" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "ISearch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type ISearch<T extends TStrategyTypes> = (request: IRequestTypesMap[T], options?: ISearchOptions) => Promise<IResponseTypesMap[T]>;

// Warning: (ae-missing-release-tag) "ISearchCancel" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type ISearchCancel<T extends TStrategyTypes> = (id: string) => Promise<void>;

// Warning: (ae-missing-release-tag) "ISearchContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
TSearchStrategyProvider,
ISearch,
ISearchOptions,
ICancel,
ISearchCancel,
getDefaultSearchParams,
} from '../../../../../src/plugins/data/server';
import { IEnhancedEsSearchRequest } from '../../common';
Expand Down Expand Up @@ -51,7 +51,7 @@ export const enhancedEsSearchStrategyProvider: TSearchStrategyProvider<typeof ES
return { id, total, loaded, rawResponse };
};

const cancel: ICancel<typeof ES_SEARCH_STRATEGY> = async id => {
const cancel: ISearchCancel<typeof ES_SEARCH_STRATEGY> = async id => {
const method = 'DELETE';
const path = `_async_search/${id}`;
await caller('transport.request', { method, path });
Expand All @@ -72,7 +72,7 @@ function asyncSearch(
const path = request.id ? `_async_search/${request.id}` : `${index}/_async_search`;

// Wait up to 1s for the response to return
const query = toSnakeCase({ ...params, waitForCompletion: '1s' });
const query = toSnakeCase({ waitForCompletion: '1s', ...params });

return caller('transport.request', { method, path, body, query }, options);
}
Expand Down

0 comments on commit df058c2

Please sign in to comment.