From eb6fa72dd2d18ec13726e6297d3cd49001943d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Thu, 29 Aug 2024 23:10:00 +0200 Subject: [PATCH] [Move `@kbn/config-schema` to server] `unified_search` --- .../unified_search/public/autocomplete/autocomplete_service.ts | 2 +- src/plugins/unified_search/public/index.ts | 2 +- src/plugins/unified_search/public/plugin.ts | 2 +- .../unified_search/server/autocomplete/autocomplete_service.ts | 2 +- src/plugins/unified_search/server/autocomplete/routes.ts | 2 +- .../unified_search/server/autocomplete/terms_agg.test.ts | 2 +- src/plugins/unified_search/server/autocomplete/terms_agg.ts | 2 +- .../unified_search/server/autocomplete/terms_enum.test.ts | 2 +- src/plugins/unified_search/server/autocomplete/terms_enum.ts | 2 +- .../server/autocomplete/value_suggestions_route.ts | 2 +- src/plugins/unified_search/{ => server}/config.ts | 0 src/plugins/unified_search/server/index.ts | 2 +- src/plugins/unified_search/server/mocks.ts | 2 +- src/plugins/unified_search/server/plugin.ts | 2 +- src/plugins/unified_search/tsconfig.json | 2 -- x-pack/plugins/alerting/server/routes/index.ts | 2 +- .../server/routes/suggestions/values_suggestion_alerts.test.ts | 2 +- .../server/routes/suggestions/values_suggestion_alerts.ts | 2 +- .../server/routes/suggestions/values_suggestion_rules.test.ts | 2 +- .../server/routes/suggestions/values_suggestion_rules.ts | 2 +- .../server/endpoint/routes/suggestions/index.test.ts | 2 +- .../server/endpoint/routes/suggestions/index.ts | 2 +- 22 files changed, 20 insertions(+), 22 deletions(-) rename src/plugins/unified_search/{ => server}/config.ts (100%) diff --git a/src/plugins/unified_search/public/autocomplete/autocomplete_service.ts b/src/plugins/unified_search/public/autocomplete/autocomplete_service.ts index 97d128df5a782..93effe9d24d57 100644 --- a/src/plugins/unified_search/public/autocomplete/autocomplete_service.ts +++ b/src/plugins/unified_search/public/autocomplete/autocomplete_service.ts @@ -17,7 +17,7 @@ import { } from './providers/value_suggestion_provider'; import type { ValueSuggestionsGetFn } from './providers/value_suggestion_provider'; -import { ConfigSchema } from '../../config'; +import type { ConfigSchema } from '../../server/config'; import { createUsageCollector } from './collectors'; import { KUERY_LANGUAGE_NAME, diff --git a/src/plugins/unified_search/public/index.ts b/src/plugins/unified_search/public/index.ts index fb689eb3e2d3b..2103a20fb7b83 100755 --- a/src/plugins/unified_search/public/index.ts +++ b/src/plugins/unified_search/public/index.ts @@ -7,7 +7,7 @@ */ import { PluginInitializerContext } from '@kbn/core/public'; -import { ConfigSchema } from '../config'; +import type { ConfigSchema } from '../server/config'; export type { IndexPatternSelectProps } from './index_pattern_select'; export type { QueryStringInputProps } from './query_string_input'; export { QueryStringInput } from './query_string_input'; diff --git a/src/plugins/unified_search/public/plugin.ts b/src/plugins/unified_search/public/plugin.ts index 0e1b2569470b4..ed4c8cebca82d 100755 --- a/src/plugins/unified_search/public/plugin.ts +++ b/src/plugins/unified_search/public/plugin.ts @@ -11,7 +11,7 @@ import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { APPLY_FILTER_TRIGGER } from '@kbn/data-plugin/public'; import { createQueryStringInput } from './query_string_input/get_query_string_input'; import { UPDATE_FILTER_REFERENCES_TRIGGER, updateFilterReferencesTrigger } from './triggers'; -import { ConfigSchema } from '../config'; +import type { ConfigSchema } from '../server/config'; import { setIndexPatterns, setTheme, setOverlays, setAnalytics, setI18n } from './services'; import { AutocompleteService } from './autocomplete/autocomplete_service'; import { createSearchBar } from './search_bar/create_search_bar'; diff --git a/src/plugins/unified_search/server/autocomplete/autocomplete_service.ts b/src/plugins/unified_search/server/autocomplete/autocomplete_service.ts index d1969c381a7ce..2ef0469ae91ed 100644 --- a/src/plugins/unified_search/server/autocomplete/autocomplete_service.ts +++ b/src/plugins/unified_search/server/autocomplete/autocomplete_service.ts @@ -10,7 +10,7 @@ import moment from 'moment'; import { clone } from 'lodash'; import { CoreSetup, Plugin, PluginInitializerContext } from '@kbn/core/server'; import { registerRoutes } from './routes'; -import { ConfigSchema } from '../../config'; +import { ConfigSchema } from '../config'; export class AutocompleteService implements Plugin { private valueSuggestionsEnabled: boolean = true; diff --git a/src/plugins/unified_search/server/autocomplete/routes.ts b/src/plugins/unified_search/server/autocomplete/routes.ts index 4b4321fdf9b8a..24f1384142367 100644 --- a/src/plugins/unified_search/server/autocomplete/routes.ts +++ b/src/plugins/unified_search/server/autocomplete/routes.ts @@ -9,7 +9,7 @@ import { Observable } from 'rxjs'; import { CoreSetup } from '@kbn/core/server'; import { registerValueSuggestionsRoute } from './value_suggestions_route'; -import { ConfigSchema } from '../../config'; +import { ConfigSchema } from '../config'; export function registerRoutes({ http }: CoreSetup, config$: Observable): void { const router = http.createRouter(); diff --git a/src/plugins/unified_search/server/autocomplete/terms_agg.test.ts b/src/plugins/unified_search/server/autocomplete/terms_agg.test.ts index dbc1dc0608d77..6ac7ac55af8c1 100644 --- a/src/plugins/unified_search/server/autocomplete/terms_agg.test.ts +++ b/src/plugins/unified_search/server/autocomplete/terms_agg.test.ts @@ -8,7 +8,7 @@ import { coreMock } from '@kbn/core/server/mocks'; import { ElasticsearchClient, SavedObjectsClientContract } from '@kbn/core/server'; -import { ConfigSchema } from '../../config'; +import { ConfigSchema } from '../config'; import type { DeeplyMockedKeys } from '@kbn/utility-types-jest'; import type { DataViewField, FieldSpec } from '@kbn/data-views-plugin/common'; import { termsAggSuggestions } from './terms_agg'; diff --git a/src/plugins/unified_search/server/autocomplete/terms_agg.ts b/src/plugins/unified_search/server/autocomplete/terms_agg.ts index d87b5696de19f..3b526b6aa536a 100644 --- a/src/plugins/unified_search/server/autocomplete/terms_agg.ts +++ b/src/plugins/unified_search/server/autocomplete/terms_agg.ts @@ -11,7 +11,7 @@ import { ElasticsearchClient, SavedObjectsClientContract } from '@kbn/core/serve import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { getFieldSubtypeNested } from '@kbn/data-plugin/common'; import type { FieldSpec } from '@kbn/data-views-plugin/common'; -import { ConfigSchema } from '../../config'; +import { ConfigSchema } from '../config'; import { findIndexPatternById, getFieldByName } from '../data_views'; export async function termsAggSuggestions( diff --git a/src/plugins/unified_search/server/autocomplete/terms_enum.test.ts b/src/plugins/unified_search/server/autocomplete/terms_enum.test.ts index d434c6472cce7..8d0dd846426ec 100644 --- a/src/plugins/unified_search/server/autocomplete/terms_enum.test.ts +++ b/src/plugins/unified_search/server/autocomplete/terms_enum.test.ts @@ -9,7 +9,7 @@ import { termsEnumSuggestions } from './terms_enum'; import { coreMock } from '@kbn/core/server/mocks'; import { ElasticsearchClient, SavedObjectsClientContract } from '@kbn/core/server'; -import { ConfigSchema } from '../../config'; +import { ConfigSchema } from '../config'; import type { DeeplyMockedKeys } from '@kbn/utility-types-jest'; import { TermsEnumResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import type { DataViewField } from '@kbn/data-views-plugin/common'; diff --git a/src/plugins/unified_search/server/autocomplete/terms_enum.ts b/src/plugins/unified_search/server/autocomplete/terms_enum.ts index ee46785582ca1..b567bea17a352 100644 --- a/src/plugins/unified_search/server/autocomplete/terms_enum.ts +++ b/src/plugins/unified_search/server/autocomplete/terms_enum.ts @@ -10,7 +10,7 @@ import { ElasticsearchClient, SavedObjectsClientContract } from '@kbn/core/serve import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import type { FieldSpec } from '@kbn/data-views-plugin/common'; import { findIndexPatternById, getFieldByName } from '../data_views'; -import { ConfigSchema } from '../../config'; +import { ConfigSchema } from '../config'; export async function termsEnumSuggestions( config: ConfigSchema, diff --git a/src/plugins/unified_search/server/autocomplete/value_suggestions_route.ts b/src/plugins/unified_search/server/autocomplete/value_suggestions_route.ts index 00a5d3eba3a13..4f2146ec18dbb 100644 --- a/src/plugins/unified_search/server/autocomplete/value_suggestions_route.ts +++ b/src/plugins/unified_search/server/autocomplete/value_suggestions_route.ts @@ -11,7 +11,7 @@ import { IRouter } from '@kbn/core/server'; import { firstValueFrom, Observable } from 'rxjs'; import { getRequestAbortedSignal } from '@kbn/data-plugin/server'; import { getKbnServerError, reportServerError } from '@kbn/kibana-utils-plugin/server'; -import type { ConfigSchema } from '../../config'; +import type { ConfigSchema } from '../config'; import { termsEnumSuggestions } from './terms_enum'; import { termsAggSuggestions } from './terms_agg'; diff --git a/src/plugins/unified_search/config.ts b/src/plugins/unified_search/server/config.ts similarity index 100% rename from src/plugins/unified_search/config.ts rename to src/plugins/unified_search/server/config.ts diff --git a/src/plugins/unified_search/server/index.ts b/src/plugins/unified_search/server/index.ts index 8f786e0ed1077..e0ca8f39c661f 100644 --- a/src/plugins/unified_search/server/index.ts +++ b/src/plugins/unified_search/server/index.ts @@ -7,7 +7,7 @@ */ import { PluginConfigDescriptor, PluginInitializerContext } from '@kbn/core/server'; -import { ConfigSchema, configSchema } from '../config'; +import { ConfigSchema, configSchema } from './config'; import type { UnifiedSearchServerPlugin, UnifiedSearchServerPluginSetup, diff --git a/src/plugins/unified_search/server/mocks.ts b/src/plugins/unified_search/server/mocks.ts index 48708e5f2955e..33d68a57ea9db 100644 --- a/src/plugins/unified_search/server/mocks.ts +++ b/src/plugins/unified_search/server/mocks.ts @@ -8,7 +8,7 @@ import moment from 'moment'; import { Observable } from 'rxjs'; -import { ConfigSchema } from '../config'; +import { ConfigSchema } from './config'; import { AutocompleteSetup } from './autocomplete'; const autocompleteSetupMock: jest.Mocked = { diff --git a/src/plugins/unified_search/server/plugin.ts b/src/plugins/unified_search/server/plugin.ts index 6328eeba2f416..498c960e05fea 100644 --- a/src/plugins/unified_search/server/plugin.ts +++ b/src/plugins/unified_search/server/plugin.ts @@ -7,7 +7,7 @@ */ import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/server'; -import { ConfigSchema } from '../config'; +import { ConfigSchema } from './config'; import { AutocompleteService } from './autocomplete'; import { AutocompleteSetup } from './autocomplete/autocomplete_service'; diff --git a/src/plugins/unified_search/tsconfig.json b/src/plugins/unified_search/tsconfig.json index fc830033a69b7..909c0031b5a31 100644 --- a/src/plugins/unified_search/tsconfig.json +++ b/src/plugins/unified_search/tsconfig.json @@ -5,10 +5,8 @@ }, "include": [ "public/**/*", - "config.ts", "public/**/*.json", "server/**/*", - "config.ts", ], "kbn_references": [ "@kbn/core", diff --git a/x-pack/plugins/alerting/server/routes/index.ts b/x-pack/plugins/alerting/server/routes/index.ts index c1fd477922fb9..cf32ddf503ad4 100644 --- a/x-pack/plugins/alerting/server/routes/index.ts +++ b/x-pack/plugins/alerting/server/routes/index.ts @@ -8,7 +8,7 @@ import { IRouter } from '@kbn/core/server'; import { UsageCounter } from '@kbn/usage-collection-plugin/server'; import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; -import type { ConfigSchema } from '@kbn/unified-search-plugin/config'; +import type { ConfigSchema } from '@kbn/unified-search-plugin/server/config'; import { Observable } from 'rxjs'; import { GetAlertIndicesAlias, ILicenseState } from '../lib'; import { defineLegacyRoutes } from './legacy'; diff --git a/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_alerts.test.ts b/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_alerts.test.ts index fd6c014664121..205e90c5e8425 100644 --- a/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_alerts.test.ts +++ b/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_alerts.test.ts @@ -6,7 +6,7 @@ */ import { httpServerMock, httpServiceMock } from '@kbn/core-http-server-mocks'; -import type { ConfigSchema } from '@kbn/unified-search-plugin/config'; +import type { ConfigSchema } from '@kbn/unified-search-plugin/server/config'; import { dataPluginMock } from '@kbn/unified-search-plugin/server/mocks'; import { termsAggSuggestions } from '@kbn/unified-search-plugin/server/autocomplete/terms_agg'; import { Observable } from 'rxjs'; diff --git a/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_alerts.ts b/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_alerts.ts index 47a603014a119..e2feb464ea6d2 100644 --- a/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_alerts.ts +++ b/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_alerts.ts @@ -10,7 +10,7 @@ import { IRouter } from '@kbn/core/server'; import { firstValueFrom, Observable } from 'rxjs'; import { getRequestAbortedSignal } from '@kbn/data-plugin/server'; import { termsAggSuggestions } from '@kbn/unified-search-plugin/server/autocomplete/terms_agg'; -import type { ConfigSchema } from '@kbn/unified-search-plugin/config'; +import type { ConfigSchema } from '@kbn/unified-search-plugin/server/config'; import { UsageCounter } from '@kbn/usage-collection-plugin/server'; import { getKbnServerError, reportServerError } from '@kbn/kibana-utils-plugin/server'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; diff --git a/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_rules.test.ts b/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_rules.test.ts index e29f15bafa08a..42211d3a0f6e5 100644 --- a/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_rules.test.ts +++ b/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_rules.test.ts @@ -6,7 +6,7 @@ */ import { httpServerMock, httpServiceMock } from '@kbn/core-http-server-mocks'; -import type { ConfigSchema } from '@kbn/unified-search-plugin/config'; +import type { ConfigSchema } from '@kbn/unified-search-plugin/server/config'; import { dataPluginMock } from '@kbn/unified-search-plugin/server/mocks'; import { termsAggSuggestions } from '@kbn/unified-search-plugin/server/autocomplete/terms_agg'; import { Observable } from 'rxjs'; diff --git a/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_rules.ts b/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_rules.ts index 6c34efb214c34..06e98b168f937 100644 --- a/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_rules.ts +++ b/x-pack/plugins/alerting/server/routes/suggestions/values_suggestion_rules.ts @@ -10,7 +10,7 @@ import { IRouter } from '@kbn/core/server'; import { firstValueFrom, Observable } from 'rxjs'; import { getRequestAbortedSignal } from '@kbn/data-plugin/server'; import { termsAggSuggestions } from '@kbn/unified-search-plugin/server/autocomplete/terms_agg'; -import type { ConfigSchema } from '@kbn/unified-search-plugin/config'; +import type { ConfigSchema } from '@kbn/unified-search-plugin/server/config'; import { UsageCounter } from '@kbn/usage-collection-plugin/server'; import { getKbnServerError, reportServerError } from '@kbn/kibana-utils-plugin/server'; import { ALERTING_CASES_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server/src/saved_objects_index_pattern'; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.test.ts index 0b354e4aaed33..d8df4fc7131e0 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.test.ts @@ -18,7 +18,7 @@ import type { RequestHandlerContext, SavedObjectsClientContract, } from '@kbn/core/server'; -import type { ConfigSchema } from '@kbn/unified-search-plugin/config'; +import type { ConfigSchema } from '@kbn/unified-search-plugin/server/config'; import type { Observable } from 'rxjs'; import { dataPluginMock } from '@kbn/unified-search-plugin/server/mocks'; import { termsEnumSuggestions } from '@kbn/unified-search-plugin/server/autocomplete/terms_enum'; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.ts b/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.ts index ab5d0f99650e6..6e84e101d2506 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.ts @@ -10,7 +10,7 @@ import { firstValueFrom } from 'rxjs'; import type { RequestHandler, Logger } from '@kbn/core/server'; import type { TypeOf } from '@kbn/config-schema'; import { getRequestAbortedSignal } from '@kbn/data-plugin/server'; -import type { ConfigSchema } from '@kbn/unified-search-plugin/config'; +import type { ConfigSchema } from '@kbn/unified-search-plugin/server/config'; import { termsEnumSuggestions } from '@kbn/unified-search-plugin/server/autocomplete/terms_enum'; import { type EndpointSuggestionsBody,