Skip to content

Commit

Permalink
[Move @kbn/config-schema to server] data
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo committed Aug 29, 2024
1 parent 2853279 commit 16d55fe
Show file tree
Hide file tree
Showing 35 changed files with 33 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/plugins/data/config.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import moment from 'moment/moment';
import { SearchConfigSchema, SearchSessionsConfigSchema } from './config';
import type { SearchConfigSchema, SearchSessionsConfigSchema } from './server/config';

export const getMockSearchConfig = ({
sessions: { enabled = true, defaultExpiration = moment.duration(7, 'd') } = {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { PluginInitializerContext } from '@kbn/core/public';
import { ConfigSchema } from '../config';
import type { ConfigSchema } from '../server/config';

/*
* Filters:
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
IStorageWrapper,
createStartServicesGetter,
} from '@kbn/kibana-utils-plugin/public';
import { ConfigSchema } from '../config';
import type { ConfigSchema } from '../server/config';
import type {
DataPublicPluginSetup,
DataPublicPluginStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import { toPartialResponseAfterTimeout } from './to_partial_response';
import { ISessionService, SearchSessionState } from '../session';
import { SearchResponseCache } from './search_response_cache';
import { SearchAbortController } from './search_abort_controller';
import { SearchConfigSchema } from '../../../config';
import type { SearchConfigSchema } from '../../../server/config';
import type { SearchServiceStartDependencies } from '../search_service';
import { createRequestHash } from './create_request_hash';

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/search_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import {
SHARD_DELAY_AGG_NAME,
} from '../../common/search/aggs/buckets/shard_delay';
import { aggShardDelay } from '../../common/search/aggs/buckets/shard_delay_fn';
import { ConfigSchema } from '../../config';
import type { ConfigSchema } from '../../server/config';
import { NowProviderInternalContract } from '../now_provider';
import { DataPublicPluginStart, DataStartDependencies } from '../types';
import { AggsService } from './aggs';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/session/session_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { i18n } from '@kbn/i18n';
import moment from 'moment';
import { ISearchOptions } from '@kbn/search-types';
import { SearchUsageCollector } from '../..';
import { ConfigSchema } from '../../../config';
import type { ConfigSchema } from '../../../server/config';
import type {
SessionMeta,
SessionStateContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { APP } from '..';
import { SearchSessionsMgmtAPI } from '../lib/api';
import { AsyncSearchIntroDocumentation } from '../lib/documentation';
import { renderApp } from './render';
import { SearchSessionsConfigSchema } from '../../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../../server/config';

export class SearchSessionsMgmtApp {
constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { LocaleWrapper } from '../__mocks__';
import { SearchSessionsMgmtMain } from './main';
import { SharePluginStart } from '@kbn/share-plugin/public';
import { sharePluginMock } from '@kbn/share-plugin/public/mocks';
import { SearchSessionsConfigSchema } from '../../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../../server/config';
import { createSearchUsageCollectorMock } from '../../../collectors/mocks';

let mockCoreSetup: MockedKeys<CoreSetup>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { SearchSessionsMgmtAPI } from '../lib/api';
import type { AsyncSearchIntroDocumentation } from '../lib/documentation';
import { SearchSessionsMgmtTable } from './table';
import { SearchSessionsDeprecatedWarning } from '../../search_sessions_deprecation_message';
import { SearchSessionsConfigSchema } from '../../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../../server/config';
import { SearchUsageCollector } from '../../../collectors';

interface Props {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { LocaleWrapper } from '../../__mocks__';
import { SearchSessionsMgmtTable } from './table';
import { SharePluginStart } from '@kbn/share-plugin/public';
import { sharePluginMock } from '@kbn/share-plugin/public/mocks';
import { SearchSessionsConfigSchema } from '../../../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../../../server/config';
import { createSearchUsageCollectorMock } from '../../../../collectors/mocks';

let mockCoreSetup: MockedKeys<CoreSetup>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { OnActionComplete } from '../actions';
import { getAppFilter } from './app_filter';
import { getStatusFilter } from './status_filter';
import { SearchUsageCollector } from '../../../../collectors';
import { SearchSessionsConfigSchema } from '../../../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../../../server/config';

interface Props {
core: CoreStart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { ISessionsClient, SearchUsageCollector } from '../../..';
import { SEARCH_SESSIONS_MANAGEMENT_ID } from '../constants';
import type { SearchSessionsMgmtAPI } from './lib/api';
import type { AsyncSearchIntroDocumentation } from './lib/documentation';
import { SearchSessionsConfigSchema } from '../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../server/config';

export interface IManagementSectionsPluginsSetup {
management: ManagementSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { SearchSessionStatus } from '../../../../../common';
import { sharePluginMock } from '@kbn/share-plugin/public/mocks';
import { SharePluginStart } from '@kbn/share-plugin/public';
import { SearchSessionsMgmtAPI } from './api';
import { SearchSessionsConfigSchema } from '../../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../../server/config';

let mockCoreSetup: MockedKeys<CoreSetup>;
let mockCoreStart: MockedKeys<CoreStart>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { ISessionsClient } from '../../sessions_client';
import { SearchUsageCollector } from '../../../collectors';
import { SearchSessionsFindResponse, SearchSessionStatus } from '../../../../../common';
import { SearchSessionsConfigSchema } from '../../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../../server/config';

type LocatorsStart = SharePluginStart['url']['locators'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { SearchSessionsMgmtAPI } from './api';
import { getColumns } from './get_columns';
import { SharePluginStart } from '@kbn/share-plugin/public';
import { sharePluginMock } from '@kbn/share-plugin/public/mocks';
import { SearchSessionsConfigSchema } from '../../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../../server/config';
import { createSearchUsageCollectorMock } from '../../../collectors/mocks';

let mockCoreSetup: MockedKeys<CoreSetup>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { SearchSessionsMgmtAPI } from './api';
import { getExpirationStatus } from './get_expiration_status';
import { UISession } from '../types';
import { SearchUsageCollector } from '../../../collectors';
import { SearchSessionsConfigSchema } from '../../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../../server/config';

// Helper function: translate an app string to EuiIcon-friendly string
const appToIcon = (app: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { i18n } from '@kbn/i18n';
import moment from 'moment';
import { SearchSessionsConfigSchema } from '../../../../../config';
import type { SearchSessionsConfigSchema } from '../../../../../server/config';

export const getExpirationStatus = (config: SearchSessionsConfigSchema, expires: string | null) => {
const tNow = moment.utc().valueOf();
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/plugins/data/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { PluginConfigDescriptor, PluginInitializerContext } from '@kbn/core/server';
import { ConfigSchema, configSchema } from '../config';
import { ConfigSchema, configSchema } from './config';
import type { DataServerPlugin, DataPluginSetup, DataPluginStart } from './plugin';

export { getEsQueryConfig, DEFAULT_QUERY_LANGUAGE } from '../common';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { BfetchServerSetup } from '@kbn/bfetch-plugin/server';
import { PluginStart as DataViewsServerPluginStart } from '@kbn/data-views-plugin/server';
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
import { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/server';
import { ConfigSchema } from '../config';
import { ConfigSchema } from './config';
import type { ISearchSetup, ISearchStart } from './search';
import { DatatableUtilitiesService } from './datatable_utilities';
import { SearchService } from './search/search_service';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/server/search/search_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ import {
SHARD_DELAY_AGG_NAME,
} from '../../common/search/aggs/buckets/shard_delay';
import { aggShardDelay } from '../../common/search/aggs/buckets/shard_delay_fn';
import { ConfigSchema } from '../../config';
import { ConfigSchema } from '../config';
import { SearchSessionService } from './session';
import { registerBsearchRoute } from './routes/bsearch';
import { enhancedEsSearchStrategyProvider } from './strategies/ese_search';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { elasticsearchServiceMock } from '@kbn/core/server/mocks';
import { getSessionStatus } from './get_session_status';
import { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '../../../common';
import moment from 'moment';
import { SearchSessionsConfigSchema } from '../../../config';
import { SearchSessionsConfigSchema } from '../../config';

const mockInProgressSearchResponse = {
body: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import moment from 'moment';
import { ElasticsearchClient } from '@kbn/core/server';
import { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '../../../common';
import { SearchStatus } from './types';
import { SearchSessionsConfigSchema } from '../../../config';
import { SearchSessionsConfigSchema } from '../../config';
import { getSearchStatus } from './get_search_status';

export async function getSessionStatus(
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/server/search/session/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import moment from 'moment';
import type { IScopedSearchSessionsClient } from './types';
import { SearchSessionsConfigSchema } from '../../../config';
import { SearchSessionsConfigSchema } from '../../config';

export function createSearchSessionsClientMock(): jest.Mocked<IScopedSearchSessionsClient> {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { SearchSessionService } from './session_service';
import { createRequestHash } from './utils';
import moment from 'moment';
import { coreMock } from '@kbn/core/server/mocks';
import { ConfigSchema } from '../../../config';
import { ConfigSchema } from '../../config';
import type { AuthenticatedUser } from '@kbn/core/server';
import { SEARCH_SESSION_TYPE, SearchSessionStatus } from '../../../common';
import { elasticsearchServiceMock } from '@kbn/core/server/mocks';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/server/search/session/session_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from '../../../common';
import { ISearchSessionService, NoSearchIdInSessionError } from '../..';
import { createRequestHash } from './utils';
import { ConfigSchema, SearchSessionsConfigSchema } from '../../../config';
import { ConfigSchema, SearchSessionsConfigSchema } from '../../config';
import { getSessionStatus } from './get_session_status';

export interface SearchSessionDependencies {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/server/search/session/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
SearchSessionSavedObjectAttributes,
SearchSessionStatusResponse,
} from '../../../common/search';
import { SearchSessionsConfigSchema } from '../../../config';
import { SearchSessionsConfigSchema } from '../../config';

export { SearchStatus } from '../../../common/search';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
AsyncSearchGetRequest,
} from '@elastic/elasticsearch/lib/api/types';
import { ISearchOptions } from '@kbn/search-types';
import { SearchConfigSchema } from '../../../../config';
import { SearchConfigSchema } from '../../../config';

/**
@internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { TransportResult } from '@elastic/elasticsearch';
import { tap } from 'rxjs';
import type { IScopedClusterClient, Logger } from '@kbn/core/server';
import { getKbnServerError } from '@kbn/kibana-utils-plugin/server';
import { SearchConfigSchema } from '../../../../config';
import { SearchConfigSchema } from '../../../config';
import {
EqlSearchStrategyRequest,
EqlSearchStrategyResponse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
getTotalLoaded,
shimHitsTotal,
} from '../es_search';
import { SearchConfigSchema } from '../../../../config';
import { SearchConfigSchema } from '../../../config';
import { sanitizeRequestParams } from '../../sanitize_request_params';

export const enhancedEsSearchStrategyProvider = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { AsyncSearchSubmitRequest } from '@elastic/elasticsearch/lib/api/types';
import { ISearchOptions } from '@kbn/search-types';
import { UI_SETTINGS } from '../../../../common';
import { getDefaultSearchParams } from '../es_search';
import { SearchConfigSchema } from '../../../../config';
import { SearchConfigSchema } from '../../../config';
import {
getCommonDefaultAsyncGetParams,
getCommonDefaultAsyncSubmitParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { getKbnSearchError } from '../../report_search_error';
import type { ISearchStrategy, SearchStrategyDependencies } from '../../types';
import type { IAsyncSearchOptions } from '../../../../common';
import { toAsyncKibanaSearchResponse } from './response_utils';
import { SearchConfigSchema } from '../../../../config';
import { SearchConfigSchema } from '../../../config';

// `drop_null_columns` is going to change the response
// now we get `all_columns` and `columns`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { SqlGetAsyncRequest, SqlQueryRequest } from '@elastic/elasticsearch/lib/api/types';
import { ISearchOptions } from '@kbn/search-types';
import { SearchConfigSchema } from '../../../../config';
import { SearchConfigSchema } from '../../../config';
import {
getCommonDefaultAsyncGetParams,
getCommonDefaultAsyncSubmitParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type {
import { pollSearch } from '../../../../common';
import { getDefaultAsyncGetParams, getDefaultAsyncSubmitParams } from './request_utils';
import { toAsyncKibanaSearchResponse } from './response_utils';
import { SearchConfigSchema } from '../../../../config';
import { SearchConfigSchema } from '../../../config';

export const sqlSearchStrategyProvider = (
searchConfig: SearchConfigSchema,
Expand Down
1 change: 0 additions & 1 deletion src/plugins/data/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"common/**/*",
"public/**/*",
"server/**/*",
"config.ts",
"config.mock.ts",
"common/**/*.json",
"public/**/*.json",
Expand Down

0 comments on commit 16d55fe

Please sign in to comment.