Skip to content

Commit

Permalink
[Move @kbn/config-schema to server] transform (#191685)
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo authored Aug 29, 2024
1 parent 09a3658 commit b36b198
Show file tree
Hide file tree
Showing 96 changed files with 143 additions and 156 deletions.
5 changes: 4 additions & 1 deletion x-pack/plugins/transform/common/types/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

import type { EuiComboBoxOptionOption } from '@elastic/eui/src/components/combo_box/types';
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
import type { LatestFunctionConfig, PutTransformsRequestSchema } from '../api_schemas/transforms';
import type {
LatestFunctionConfig,
PutTransformsRequestSchema,
} from '../../server/routes/api_schemas/transforms';
import type { PivotGroupByDict } from './pivot_group_by';
import type { PivotAggDict } from './pivot_aggs';
import type { TransformHealthAlertRule } from './alerting';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/transform/public/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { ScopedHistory } from '@kbn/core/public';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';

import type { ExperimentalFeatures } from '../../common/config';
import type { ExperimentalFeatures } from '../../server/config';
import { SECTION_SLUG } from './common/constants';
import type { AppDependencies } from './app_dependencies';
import { CloneTransformSection } from './sections/clone_transform';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/transform/public/app/common/data_grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import type { PostTransformsPreviewRequestSchema } from '../../../common/api_schemas/transforms';
import type { PostTransformsPreviewRequestSchema } from '../../../server/routes/api_schemas/transforms';

import type { TransformConfigQuery } from './request';

Expand Down
14 changes: 7 additions & 7 deletions x-pack/plugins/transform/public/app/common/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ import {
type SavedSearchQuery,
} from '@kbn/ml-query-utils';

import {
DEFAULT_CONTINUOUS_MODE_DELAY,
DEFAULT_TRANSFORM_FREQUENCY,
DEFAULT_TRANSFORM_SETTINGS_DOCS_PER_SECOND,
DEFAULT_TRANSFORM_SETTINGS_MAX_PAGE_SEARCH_SIZE,
} from '../../../common/constants';
import type {
PivotTransformPreviewRequestSchema,
PostTransformsPreviewRequestSchema,
PutTransformsLatestRequestSchema,
PutTransformsPivotRequestSchema,
PutTransformsRequestSchema,
} from '../../../common/api_schemas/transforms';
} from '../../../server/routes/api_schemas/transforms';
import {
DEFAULT_CONTINUOUS_MODE_DELAY,
DEFAULT_TRANSFORM_FREQUENCY,
DEFAULT_TRANSFORM_SETTINGS_DOCS_PER_SECOND,
DEFAULT_TRANSFORM_SETTINGS_MAX_PAGE_SEARCH_SIZE,
} from '../../../common/constants';
import type {
DateHistogramAgg,
HistogramAgg,
Expand Down
8 changes: 4 additions & 4 deletions x-pack/plugins/transform/public/app/common/transform_stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* 2.0.
*/

import { TRANSFORM_STATE } from '../../../common/constants';

import type { TransformListRow } from './transform_list';
import type {
PutTransformsLatestRequestSchema,
PutTransformsPivotRequestSchema,
} from '../../../common/api_schemas/transforms';
} from '../../../server/routes/api_schemas/transforms';
import { TRANSFORM_STATE } from '../../../common/constants';

import type { TransformListRow } from './transform_list';

type TransformItem = Omit<TransformListRow, 'config'> & {
config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { toMountPoint } from '@kbn/react-kibana-mount';
import type {
PutTransformsRequestSchema,
PutTransformsResponseSchema,
} from '../../../common/api_schemas/transforms';
} from '../../../server/routes/api_schemas/transforms';
import { addInternalBasePath } from '../../../common/constants';
import type { TransformId } from '../../../common/types/transform';
import { getErrorMessage } from '../../../common/utils/errors';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { i18n } from '@kbn/i18n';
import { toMountPoint } from '@kbn/react-kibana-mount';
import { extractErrorMessage } from '@kbn/ml-error-utils';

import { addInternalBasePath } from '../../../common/constants';
import type {
DeleteTransformsRequestSchema,
DeleteTransformsResponseSchema,
} from '../../../common/api_schemas/delete_transforms';
} from '../../../server/routes/api_schemas/delete_transforms';
import { addInternalBasePath } from '../../../common/constants';
import { getErrorMessage } from '../../../common/utils/errors';

import { useAppDependencies, useToastNotifications } from '../app_dependencies';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import type { KBN_FIELD_TYPES } from '@kbn/field-types';
import { DEFAULT_SAMPLER_SHARD_SIZE } from '@kbn/ml-agg-utils';
import type { SavedSearchQuery } from '@kbn/ml-query-utils';

import { addInternalBasePath, TRANSFORM_REACT_QUERY_KEYS } from '../../../common/constants';
import type {
FieldHistogramsRequestSchema,
FieldHistogramsResponseSchema,
} from '../../../common/api_schemas/field_histograms';
} from '../../../server/routes/api_schemas/field_histograms';
import { addInternalBasePath, TRANSFORM_REACT_QUERY_KEYS } from '../../../common/constants';

import { useAppDependencies } from '../app_dependencies';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useQuery } from '@tanstack/react-query';

import type { IHttpFetchError } from '@kbn/core-http-browser';

import type { GetTransformsResponseSchema } from '../../../common/api_schemas/transforms';
import type { GetTransformsResponseSchema } from '../../../server/routes/api_schemas/transforms';
import { addInternalBasePath, TRANSFORM_REACT_QUERY_KEYS } from '../../../common/constants';
import type { TransformId } from '../../../common/types/transform';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useQuery } from '@tanstack/react-query';

import type { IHttpFetchError } from '@kbn/core-http-browser';

import type { GetTransformsAuditMessagesResponseSchema } from '../../../common/api_schemas/audit_messages';
import type { GetTransformsAuditMessagesResponseSchema } from '../../../server/routes/api_schemas/audit_messages';
import { addInternalBasePath, TRANSFORM_REACT_QUERY_KEYS } from '../../../common/constants';
import type { TransformMessage } from '../../../common/types/messages';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useQuery } from '@tanstack/react-query';

import type { IHttpFetchError } from '@kbn/core-http-browser';

import type { GetTransformNodesResponseSchema } from '../../../common/api_schemas/transforms';
import type { GetTransformNodesResponseSchema } from '../../../server/routes/api_schemas/transforms';
import {
addInternalBasePath,
DEFAULT_REFRESH_INTERVAL_MS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useQuery } from '@tanstack/react-query';

import type { IHttpFetchError } from '@kbn/core-http-browser';

import type { GetTransformsStatsResponseSchema } from '../../../common/api_schemas/transforms_stats';
import type { GetTransformsStatsResponseSchema } from '../../../server/routes/api_schemas/transforms_stats';
import { addInternalBasePath, TRANSFORM_REACT_QUERY_KEYS } from '../../../common/constants';
import type { TransformId } from '../../../common/types/transform';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useQuery } from '@tanstack/react-query';
import type { IHttpFetchError } from '@kbn/core-http-browser';
import { isDefined } from '@kbn/ml-is-defined';

import type { GetTransformsResponseSchema } from '../../../common/api_schemas/transforms';
import type { GetTransformsResponseSchema } from '../../../server/routes/api_schemas/transforms';
import {
addInternalBasePath,
DEFAULT_REFRESH_INTERVAL_MS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { IHttpFetchError } from '@kbn/core-http-browser';
import type {
PostTransformsPreviewRequestSchema,
PostTransformsPreviewResponseSchema,
} from '../../../common/api_schemas/transforms';
} from '../../../server/routes/api_schemas/transforms';
import { addInternalBasePath, TRANSFORM_REACT_QUERY_KEYS } from '../../../common/constants';

import { useAppDependencies } from '../app_dependencies';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { i18n } from '@kbn/i18n';

import { toMountPoint } from '@kbn/react-kibana-mount';

import { addInternalBasePath } from '../../../common/constants';
import { getErrorMessage } from '../../../common/utils/errors';
import type {
ReauthorizeTransformsRequestSchema,
ReauthorizeTransformsResponseSchema,
} from '../../../common/api_schemas/reauthorize_transforms';
} from '../../../server/routes/api_schemas/reauthorize_transforms';
import { addInternalBasePath } from '../../../common/constants';
import { getErrorMessage } from '../../../common/utils/errors';

import { useAppDependencies, useToastNotifications } from '../app_dependencies';
import { ToastNotificationText } from '../components';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { toMountPoint } from '@kbn/react-kibana-mount';
import type {
ResetTransformsRequestSchema,
ResetTransformsResponseSchema,
} from '../../../common/api_schemas/reset_transforms';
} from '../../../server/routes/api_schemas/reset_transforms';
import { addInternalBasePath } from '../../../common/constants';
import { getErrorMessage } from '../../../common/utils/errors';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import { useMutation } from '@tanstack/react-query';
import { i18n } from '@kbn/i18n';
import { toMountPoint } from '@kbn/react-kibana-mount';

import { addInternalBasePath } from '../../../common/constants';
import type {
ScheduleNowTransformsRequestSchema,
ScheduleNowTransformsResponseSchema,
} from '../../../common/api_schemas/schedule_now_transforms';
} from '../../../server/routes/api_schemas/schedule_now_transforms';
import { addInternalBasePath } from '../../../common/constants';
import { getErrorMessage } from '../../../common/utils/errors';

import { useAppDependencies, useToastNotifications } from '../app_dependencies';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import { useMutation } from '@tanstack/react-query';
import { i18n } from '@kbn/i18n';
import { toMountPoint } from '@kbn/react-kibana-mount';

import { addInternalBasePath } from '../../../common/constants';
import type {
StartTransformsRequestSchema,
StartTransformsResponseSchema,
} from '../../../common/api_schemas/start_transforms';
} from '../../../server/routes/api_schemas/start_transforms';
import { addInternalBasePath } from '../../../common/constants';
import { getErrorMessage } from '../../../common/utils/errors';

import { useAppDependencies, useToastNotifications } from '../app_dependencies';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { i18n } from '@kbn/i18n';

import { toMountPoint } from '@kbn/react-kibana-mount';

import { addInternalBasePath } from '../../../common/constants';
import type {
StopTransformsRequestSchema,
StopTransformsResponseSchema,
} from '../../../common/api_schemas/stop_transforms';
} from '../../../server/routes/api_schemas/stop_transforms';
import { addInternalBasePath } from '../../../common/constants';
import { getErrorMessage } from '../../../common/utils/errors';

import { useAppDependencies, useToastNotifications } from '../app_dependencies';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
INDEX_STATUS,
} from '@kbn/ml-data-grid';

import type { PreviewMappingsProperties } from '../../../common/api_schemas/transforms';
import type { PreviewMappingsProperties } from '../../../server/routes/api_schemas/transforms';

import { getErrorMessage } from '../../../common/utils/errors';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useMutation } from '@tanstack/react-query';
import type {
PostTransformsUpdateRequestSchema,
PostTransformsUpdateResponseSchema,
} from '../../../common/api_schemas/update_transforms';
} from '../../../server/routes/api_schemas/update_transforms';
import { addInternalBasePath } from '../../../common/constants';
import type { TransformId } from '../../../common/types/transform';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { type TransformEnabledFeatures } from './serverless_context';
import type { PluginsDependencies } from '../plugin';
import { getMlSharedImports } from '../shared_imports';

import type { ExperimentalFeatures } from '../../common/config';
import type { ExperimentalFeatures } from '../../server/config';
import type { AppDependencies } from './app_dependencies';
import { breadcrumbService } from './services/navigation';
import { docTitleService } from './services/navigation';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import { toMountPoint } from '@kbn/react-kibana-mount';

import { DISCOVER_APP_LOCATOR } from '@kbn/discover-plugin/common';

import type {
PutTransformsLatestRequestSchema,
PutTransformsPivotRequestSchema,
} from '../../../../../../server/routes/api_schemas/transforms';
import { PROGRESS_REFRESH_INTERVAL_MS } from '../../../../../../common/constants';

import { getErrorMessage } from '../../../../../../common/utils/errors';
Expand All @@ -37,10 +41,6 @@ import { useCreateTransform, useGetTransformStats, useStartTransforms } from '..
import { useAppDependencies, useToastNotifications } from '../../../../app_dependencies';
import { RedirectToTransformManagement } from '../../../../common/navigation';
import { ToastNotificationText } from '../../../../components';
import type {
PutTransformsLatestRequestSchema,
PutTransformsPivotRequestSchema,
} from '../../../../../../common/api_schemas/transforms';
import { isContinuousTransform } from '../../../../../../common/types/transform';
import { TransformAlertFlyout } from '../../../../../alerting/transform_alerting_flyout';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { TimeRange as TimeRangeMs } from '@kbn/ml-date-picker';
import type { RuntimeMappings } from '@kbn/ml-runtime-field-utils';
import type { SavedSearchQuery } from '@kbn/ml-query-utils';

import type { LatestFunctionConfig } from '../../../../../../../server/routes/api_schemas/transforms';
import type { EsFieldName } from '../../../../../../../common/types/fields';

import type {
Expand All @@ -26,7 +27,6 @@ import type {
LatestFunctionConfigUI,
PivotConfigDefinition,
} from '../../../../../../../common/types/transform';
import type { LatestFunctionConfig } from '../../../../../../../common/api_schemas/transforms';

import type { QUERY_LANGUAGE } from './constants';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { XJsonMode } from '@kbn/ace';

import { XJson } from '@kbn/es-ui-shared-plugin/public';

import type { PostTransformsPreviewRequestSchema } from '../../../../../../../common/api_schemas/transforms';
import type { PostTransformsPreviewRequestSchema } from '../../../../../../../server/routes/api_schemas/transforms';

import type { StepDefineExposedState } from '../common';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { useState } from 'react';

import type { PostTransformsPreviewRequestSchema } from '../../../../../../../common/api_schemas/transforms';
import type { PostTransformsPreviewRequestSchema } from '../../../../../../../server/routes/api_schemas/transforms';

import type { StepDefineExposedState } from '../common';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { i18n } from '@kbn/i18n';
import type { EuiComboBoxOptionOption } from '@elastic/eui';
import type { AggConfigs, FieldParamType } from '@kbn/data-plugin/common';
import { isCounterTimeSeriesMetric } from '@kbn/ml-agg-utils';
import type { LatestFunctionConfig } from '../../../../../../../server/routes/api_schemas/transforms';
import type { LatestFunctionConfigUI } from '../../../../../../../common/types/transform';
import type { StepDefineFormProps } from '../step_define_form';
import type { StepDefineExposedState } from '../common';
import type { LatestFunctionConfig } from '../../../../../../../common/api_schemas/transforms';
import { useAppDependencies } from '../../../../../app_dependencies';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { EuiFormRow, EuiSelect, EuiSpacer, EuiSwitch } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { toMountPoint } from '@kbn/react-kibana-mount';

import type { PostTransformsPreviewRequestSchema } from '../../../../../common/api_schemas/transforms';
import type { PostTransformsPreviewRequestSchema } from '../../../../../server/routes/api_schemas/transforms';
import { isLatestTransform, isPivotTransform } from '../../../../../common/types/transform';
import { getErrorMessage } from '../../../../../common/utils/errors';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { merge } from 'lodash';

import type { PostTransformsUpdateRequestSchema } from '../../../../../common/api_schemas/update_transforms';
import type { PostTransformsUpdateRequestSchema } from '../../../../../server/routes/api_schemas/update_transforms';
import type { TransformConfigUnion } from '../../../../../common/types/transform';

import { getUpdateValue } from './get_update_value';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { merge } from 'lodash';

import { getNestedProperty, setNestedProperty } from '@kbn/ml-nested-property';

import type { PostTransformsUpdateRequestSchema } from '../../../../../common/api_schemas/update_transforms';
import type { PostTransformsUpdateRequestSchema } from '../../../../../server/routes/api_schemas/update_transforms';
import type { TransformConfigUnion } from '../../../../../common/types/transform';

import type { FormFields, FormFieldsState } from './form_field';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/transform/public/app/serverless_context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import type { FC, PropsWithChildren } from 'react';
import React, { createContext, useContext, useMemo } from 'react';
import type { ExperimentalFeatures } from '../../common/config';
import type { ExperimentalFeatures } from '../../server/config';

export interface TransformEnabledFeatures {
showNodeInfo: boolean;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/transform/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import type { ContentManagementPublicStart } from '@kbn/content-management-plugi
import type { SavedSearchPublicPluginStart } from '@kbn/saved-search-plugin/public';
import type { PluginInitializerContext } from '@kbn/core/public';
import type { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public';
import type { ConfigSchema } from '../common/config';
import type { ConfigSchema } from '../server/config';
import { registerFeature } from './register_feature';
import { getTransformHealthRuleType } from './alerting';

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion x-pack/plugins/transform/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import type { PluginInitializerContext, PluginConfigDescriptor } from '@kbn/core/server';
import { configSchema, type ConfigSchema } from '../common/config';
import { configSchema, type ConfigSchema } from './config';

export const plugin = async (ctx: PluginInitializerContext) => {
const { TransformServerPlugin } = await import('./plugin');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* 2.0.
*/

import { addInternalBasePath } from '../../../../common/constants';
import type { TransformIdParamSchema } from '../../../../common/api_schemas/common';
import { transformIdParamSchema } from '../../../../common/api_schemas/common';
import type { TransformIdParamSchema } from '../../api_schemas/common';
import { transformIdParamSchema } from '../../api_schemas/common';
import {
getTransformAuditMessagesQuerySchema,
type GetTransformAuditMessagesQuerySchema,
} from '../../../../common/api_schemas/audit_messages';
} from '../../api_schemas/audit_messages';
import { addInternalBasePath } from '../../../../common/constants';

import type { RouteDependencies } from '../../../types';

Expand Down
Loading

0 comments on commit b36b198

Please sign in to comment.