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

making vis (completely) serializable #64207

Merged
merged 11 commits into from
May 12, 2020
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- 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; [extractSearchSourceReferences](./kibana-plugin-plugins-data-public.extractsearchsourcereferences.md)

## extractSearchSourceReferences variable

<b>Signature:</b>

```typescript
extractReferences: (state: SearchSourceFields) => [SearchSourceFields & {
indexRefName?: string | undefined;
}, SavedObjectReference[]]
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- 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; [injectSearchSourceReferences](./kibana-plugin-plugins-data-public.injectsearchsourcereferences.md)

## injectSearchSourceReferences variable

<b>Signature:</b>

```typescript
injectReferences: (searchSourceFields: SearchSourceFields & {
indexRefName: string;
}, references: SavedObjectReference[]) => SearchSourceFields
```
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@
| [esFilters](./kibana-plugin-plugins-data-public.esfilters.md) | |
| [esKuery](./kibana-plugin-plugins-data-public.eskuery.md) | |
| [esQuery](./kibana-plugin-plugins-data-public.esquery.md) | |
| [extractSearchSourceReferences](./kibana-plugin-plugins-data-public.extractsearchsourcereferences.md) | |
| [fieldFormats](./kibana-plugin-plugins-data-public.fieldformats.md) | |
| [FilterBar](./kibana-plugin-plugins-data-public.filterbar.md) | |
| [getIndexPatternFieldListCreator](./kibana-plugin-plugins-data-public.getindexpatternfieldlistcreator.md) | |
| [getKbnTypeNames](./kibana-plugin-plugins-data-public.getkbntypenames.md) | Get the esTypes known by all kbnFieldTypes {<!-- -->Array<string>} |
| [indexPatterns](./kibana-plugin-plugins-data-public.indexpatterns.md) | |
| [injectSearchSourceReferences](./kibana-plugin-plugins-data-public.injectsearchsourcereferences.md) | |
| [parseSearchSourceJSON](./kibana-plugin-plugins-data-public.parsesearchsourcejson.md) | |
| [QueryStringInput](./kibana-plugin-plugins-data-public.querystringinput.md) | |
| [search](./kibana-plugin-plugins-data-public.search.md) | |
| [SearchBar](./kibana-plugin-plugins-data-public.searchbar.md) | |
Expand Down
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-public](./kibana-plugin-plugins-data-public.md) &gt; [parseSearchSourceJSON](./kibana-plugin-plugins-data-public.parsesearchsourcejson.md)

## parseSearchSourceJSON variable

<b>Signature:</b>

```typescript
parseSearchSourceJSON: (searchSourceJSON: string) => SearchSourceFields
```
3 changes: 3 additions & 0 deletions src/legacy/ui/public/new_platform/__mocks__/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { chartPluginMock } from '../../../../../plugins/charts/public/mocks';
import { advancedSettingsMock } from '../../../../../plugins/advanced_settings/public/mocks';
import { savedObjectsManagementPluginMock } from '../../../../../plugins/saved_objects_management/public/mocks';
import { visualizationsPluginMock } from '../../../../../plugins/visualizations/public/mocks';
import { discoverPluginMock } from '../../../../../plugins/discover/public/mocks';
/* eslint-enable @kbn/eslint/no-restricted-paths */

export const pluginsMock = {
Expand All @@ -48,6 +49,7 @@ export const pluginsMock = {
visualizations: visualizationsPluginMock.createSetupContract(),
kibanaLegacy: kibanaLegacyPluginMock.createSetupContract(),
savedObjectsManagement: savedObjectsManagementPluginMock.createSetupContract(),
discover: discoverPluginMock.createSetupContract(),
Copy link
Member

Choose a reason for hiding this comment

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

You will likely need to add mocks to the karma mocks file as well, since it calls setSetupServices and setStartService expecting the same arguments. This is probably contributing to some of the build failures.

}),
createStart: () => ({
data: dataPluginMock.createStartContract(),
Expand All @@ -62,6 +64,7 @@ export const pluginsMock = {
visualizations: visualizationsPluginMock.createStartContract(),
kibanaLegacy: kibanaLegacyPluginMock.createStartContract(),
savedObjectsManagement: savedObjectsManagementPluginMock.createStartContract(),
discover: discoverPluginMock.createStartContract(),
}),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ export const npStart = {
docViews: {
DocViewer: () => null,
},
savedSearchLoader: {},
},
},
};
Expand Down
2 changes: 2 additions & 0 deletions src/legacy/ui/public/new_platform/set_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function setStartServices(npStart: NpStart) {
dataServices.setIndexPatterns(npStart.plugins.data.indexPatterns);
dataServices.setQueryService(npStart.plugins.data.query);
dataServices.setSearchService(npStart.plugins.data.search);

visualizationsServices.setI18n(npStart.core.i18n);
visualizationsServices.setTypes(
pick(npStart.plugins.visualizations, ['get', 'all', 'getAliases'])
Expand All @@ -82,4 +83,5 @@ export function setStartServices(npStart: NpStart) {
visualizationTypes: visualizationsServices.getTypes(),
});
visualizationsServices.setSavedVisualizationsLoader(savedVisualizationsLoader);
visualizationsServices.setSavedSearchLoader(npStart.plugins.discover.savedSearchLoader);
}
3 changes: 3 additions & 0 deletions src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ export {
SearchResponse,
SearchError,
ISearchSource,
parseSearchSourceJSON,
injectSearchSourceReferences,
extractSearchSourceReferences,
SearchSourceFields,
EsQuerySortValue,
SortDirection,
Expand Down
49 changes: 34 additions & 15 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import * as React_2 from 'react';
import { Required } from '@kbn/utility-types';
import * as Rx from 'rxjs';
import { SavedObject as SavedObject_2 } from 'src/core/public';
import { SavedObjectReference } from 'kibana/public';
import { SavedObjectsClientContract } from 'src/core/public';
import { SearchParams } from 'elasticsearch';
import { SearchResponse as SearchResponse_2 } from 'elasticsearch';
Expand Down Expand Up @@ -420,6 +419,14 @@ export type ExistsFilter = Filter & {
exists?: FilterExistsProperty;
};

// Warning: (ae-forgotten-export) The symbol "SavedObjectReference" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "extractReferences" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const extractSearchSourceReferences: (state: SearchSourceFields) => [SearchSourceFields & {
indexRefName?: string | undefined;
}, SavedObjectReference[]];

// Warning: (ae-missing-release-tag) "FetchOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -1068,6 +1075,13 @@ export interface IndexPatternTypeMeta {
aggs?: Record<string, IndexPatternAggRestrictions>;
}

// Warning: (ae-missing-release-tag) "injectReferences" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const injectSearchSourceReferences: (searchSourceFields: SearchSourceFields & {
indexRefName: string;
}, references: SavedObjectReference[]) => SearchSourceFields;

// Warning: (ae-missing-release-tag) "InputTimeRange" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -1282,6 +1296,11 @@ export interface OptionedValueProp {
// @public (undocumented)
export type ParsedInterval = ReturnType<typeof parseEsInterval>;

// Warning: (ae-missing-release-tag) "parseSearchSourceJSON" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const parseSearchSourceJSON: (searchSourceJSON: string) => SearchSourceFields;

// 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)
Expand Down Expand Up @@ -1819,20 +1838,20 @@ export type TSearchStrategyProvider<T extends TStrategyTypes> = (context: ISearc
// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "getRoutes" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:379:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:380:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:391:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:395:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:403:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:380:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:380:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:380:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:380:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:382:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:383:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:392:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:393:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:394:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:398:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:402:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:403:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:406: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:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/expressions/esaggs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export const esaggs = (): ExpressionFunctionDefinition<typeof name, Input, Argum
const aggs = searchService.aggs.createAggConfigs(indexPattern, aggConfigsState);

// we should move searchSource creation inside courier request handler
const searchSource = searchService.searchSource.create();
const searchSource = await searchService.searchSource.create();

searchSource.setField('index', indexPattern);
searchSource.setField('size', 0);
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/data/public/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export {
SearchSourceFields,
EsQuerySortValue,
SortDirection,
extractReferences as extractSearchSourceReferences,
injectReferences as injectSearchSourceReferences,
parseSearchSourceJSON,
} from './search_source';

export { SearchInterceptor } from './search_interceptor';
Expand Down
13 changes: 5 additions & 8 deletions src/plugins/data/public/search/search_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ import { Plugin, CoreSetup, CoreStart, PackageInfo } from '../../../../core/publ
import { ExpressionsSetup } from '../../../../plugins/expressions/public';

import { SYNC_SEARCH_STRATEGY, syncSearchStrategyProvider } from './sync_search_strategy';
import {
createSearchSourceFromJSON,
SearchSource,
SearchSourceDependencies,
SearchSourceFields,
} from './search_source';
import { createSearchSource, SearchSource, SearchSourceDependencies } from './search_source';
import { ISearchSetup, ISearchStart, TSearchStrategyProvider, TSearchStrategiesMap } from './types';
import { TStrategyTypes } from './strategy_types';
import { getEsClient, LegacyApiCaller } from './legacy';
Expand Down Expand Up @@ -171,8 +166,10 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
},
search,
searchSource: {
create: (fields?: SearchSourceFields) => new SearchSource(fields, searchSourceDependencies),
fromJSON: createSearchSourceFromJSON(dependencies.indexPatterns, searchSourceDependencies),
create: createSearchSource(dependencies.indexPatterns, searchSourceDependencies),
createEmpty: () => {
return new SearchSource({}, searchSourceDependencies);
},
},
setInterceptor: (searchInterceptor: SearchInterceptor) => {
// TODO: should an intercepror have a destroy method?
Expand Down
Loading