extends PersistableStateDefinition {
+ id: string;
+}
+
export type EmbeddablePersistableStateService = PersistableStateService;
export interface CommonEmbeddableStartContract {
diff --git a/src/plugins/embeddable/server/index.ts b/src/plugins/embeddable/server/index.ts
index 8d88f35a4be22..4b93f0838c649 100644
--- a/src/plugins/embeddable/server/index.ts
+++ b/src/plugins/embeddable/server/index.ts
@@ -10,6 +10,8 @@ import { EmbeddableServerPlugin, EmbeddableSetup, EmbeddableStart } from './plug
export type { EmbeddableSetup, EmbeddableStart };
-export type { EnhancementRegistryDefinition, EmbeddableRegistryDefinition } from './types';
+export type { EnhancementRegistryDefinition } from './types';
+
+export type { EmbeddableRegistryDefinition } from '../common';
export const plugin = () => new EmbeddableServerPlugin();
diff --git a/src/plugins/embeddable/server/plugin.ts b/src/plugins/embeddable/server/plugin.ts
index 51fa1edb2c634..2260d6b34c8e8 100644
--- a/src/plugins/embeddable/server/plugin.ts
+++ b/src/plugins/embeddable/server/plugin.ts
@@ -19,7 +19,6 @@ import {
EnhancementsRegistry,
EnhancementRegistryDefinition,
EnhancementRegistryItem,
- EmbeddableRegistryDefinition,
} from './types';
import {
getExtractFunction,
@@ -27,7 +26,11 @@ import {
getMigrateFunction,
getTelemetryFunction,
} from '../common/lib';
-import { EmbeddableStateWithType, CommonEmbeddableStartContract } from '../common/types';
+import {
+ EmbeddableStateWithType,
+ CommonEmbeddableStartContract,
+ EmbeddableRegistryDefinition,
+} from '../common/types';
import { getAllMigrations } from '../common/lib/get_all_migrations';
export interface EmbeddableSetup extends PersistableStateService {
diff --git a/src/plugins/embeddable/server/types.ts b/src/plugins/embeddable/server/types.ts
index 9b0479d6bc25d..bd78265bea6b1 100644
--- a/src/plugins/embeddable/server/types.ts
+++ b/src/plugins/embeddable/server/types.ts
@@ -23,12 +23,6 @@ export interface EnhancementRegistryItem extends PersistableStateDefinition
{
- id: string;
-}
-
export interface EmbeddableRegistryItem
extends PersistableState
{
id: string;
diff --git a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx
index 139405f6af9f4..723b7e6896229 100644
--- a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx
+++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx
@@ -8,7 +8,6 @@
import { IFieldType, indexPatterns as indexPatternsUtils } from '@kbn/data-plugin/public';
import { flatten } from 'lodash';
-import { escapeKuery } from './lib/escape_kuery';
import { sortPrefixFirst } from './sort_prefix_first';
import { QuerySuggestionField, QuerySuggestionTypes } from '../query_suggestion_provider';
import { KqlQuerySuggestionProvider } from './types';
@@ -27,7 +26,7 @@ const keywordComparator = (first: IFieldType, second: IFieldType) => {
export const setupGetFieldSuggestions: KqlQuerySuggestionProvider = (
core
) => {
- return ({ indexPatterns }, { start, end, prefix, suffix, nestedPath = '' }) => {
+ return async ({ indexPatterns }, { start, end, prefix, suffix, nestedPath = '' }) => {
const allFields = flatten(
indexPatterns.map((indexPattern) => {
return indexPattern.fields.filter(indexPatternsUtils.isFilterable);
@@ -42,7 +41,7 @@ export const setupGetFieldSuggestions: KqlQuerySuggestionProvider {
const remainingPath =
field.subType && field.subType.nested
diff --git a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts
index 1002863fec7f4..cd022ec371e65 100644
--- a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts
+++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts
@@ -9,7 +9,6 @@
import { CoreSetup } from '@kbn/core/public';
import { $Keys } from 'utility-types';
import { flatten, uniqBy } from 'lodash';
-import { fromKueryExpression } from '@kbn/es-query';
import { setupGetFieldSuggestions } from './field';
import { setupGetValueSuggestions } from './value';
import { setupGetOperatorSuggestions } from './operator';
@@ -38,11 +37,12 @@ export const setupKqlQuerySuggestionProvider = (
conjunction: setupGetConjunctionSuggestions(core),
};
- const getSuggestionsByType = (
+ const getSuggestionsByType = async (
cursoredQuery: string,
querySuggestionsArgs: QuerySuggestionGetFnArgs
- ): Array> | [] => {
+ ): Promise> | []> => {
try {
+ const { fromKueryExpression } = await import('@kbn/es-query');
const cursorNode = fromKueryExpression(cursoredQuery, {
cursorSymbol,
parseCursor: true,
@@ -56,13 +56,13 @@ export const setupKqlQuerySuggestionProvider = (
}
};
- return (querySuggestionsArgs) => {
+ return async (querySuggestionsArgs): Promise => {
const { query, selectionStart, selectionEnd } = querySuggestionsArgs;
const cursoredQuery = `${query.substr(0, selectionStart)}${cursorSymbol}${query.substr(
selectionEnd
)}`;
- return Promise.all(getSuggestionsByType(cursoredQuery, querySuggestionsArgs)).then(
+ return Promise.all(await getSuggestionsByType(cursoredQuery, querySuggestionsArgs)).then(
(suggestionsByType) => dedup(flatten(suggestionsByType))
);
};
diff --git a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts
index 6636f9b602687..20a20797c15e2 100644
--- a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts
+++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts
@@ -6,8 +6,6 @@
* Side Public License, v 1.
*/
-import { escapeKuery } from '@kbn/es-query';
-
/**
* Escapes backslashes and double-quotes. (Useful when putting a string in quotes to use as a value
* in a KQL expression. See the QuotedCharacter rule in kuery.peg.)
@@ -15,6 +13,3 @@ import { escapeKuery } from '@kbn/es-query';
export function escapeQuotes(str: string) {
return str.replace(/[\\"]/g, '\\$&');
}
-
-// Re-export this function from the @kbn/es-query package to avoid refactoring
-export { escapeKuery };
diff --git a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts
index e9ca34e546f0b..d7b8b3315fafd 100644
--- a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts
+++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts
@@ -6,10 +6,10 @@
* Side Public License, v 1.
*/
-import { CoreSetup } from '@kbn/core/public';
-import { KueryNode } from '@kbn/es-query';
+import type { KueryNode } from '@kbn/es-query';
+import type { CoreSetup } from '@kbn/core/public';
import type { UnifiedSearchPublicPluginStart } from '../../../types';
-import { QuerySuggestionBasic, QuerySuggestionGetFnArgs } from '../query_suggestion_provider';
+import type { QuerySuggestionBasic, QuerySuggestionGetFnArgs } from '../query_suggestion_provider';
export type KqlQuerySuggestionProvider = (
core: CoreSetup