[ML] Update imports to use @kbn/field-types package (#147769)

Where applicable, update imports to use `@kbn/field-types` package
instead of `@kbn/data-plugin/common` plugin. Should we move some of our
own code to packages, the import via the plugin wouldn't be allowed.
This commit is contained in:
Walter Rafelsberger 2022-12-20 10:38:03 +01:00 committed by GitHub
parent 687987aa9c
commit 612b16bffa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 50 additions and 50 deletions

View file

@ -10,7 +10,7 @@
import { cloneDeep } from 'lodash';
import { IUiSettingsClient } from '@kbn/core/public';
import { SearchSource } from '@kbn/data-plugin/common';
import { getEsQueryConfig, SearchSource } from '@kbn/data-plugin/common';
import { SavedSearch } from '@kbn/discover-plugin/public';
import { FilterManager } from '@kbn/data-plugin/public';
import {
@ -23,7 +23,6 @@ import {
} from '@kbn/es-query';
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { DataView } from '@kbn/data-views-plugin/public';
import { getEsQueryConfig } from '@kbn/data-plugin/common';
import type { SimpleSavedObject } from '@kbn/core/public';
import { isPopulatedObject } from '@kbn/ml-is-populated-object';

View file

@ -12,7 +12,7 @@ import React, { FC, useCallback, useMemo, useState } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
import { TimefilterContract } from '@kbn/data-plugin/public';
import { DataView } from '@kbn/data-plugin/common';
import type { DataView } from '@kbn/data-plugin/common';
import {
EuiButton,
EuiButtonIcon,

View file

@ -6,7 +6,7 @@
*/
import { i18n } from '@kbn/i18n';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import type { DocLinksStart } from '@kbn/core/public';
export const APP_ID = 'data_visualizer';

View file

@ -6,7 +6,7 @@
*/
import { difference } from 'lodash';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/common';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import type { FindFileStructureResponse } from '@kbn/file-upload-plugin/common';
import type { SupportedFieldType } from '../../../../../common/types';
import { SUPPORTED_FIELD_TYPES } from '../../../../../common/constants';

View file

@ -20,7 +20,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import classNames from 'classnames';
import { i18n } from '@kbn/i18n';
import { DataViewField } from '@kbn/data-views-plugin/public';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/field-types';
import { css } from '@emotion/react';
import { useDataVisualizerKibana } from '../../../kibana_context';
import { roundToDecimalPlace, kibanaFieldFormat } from '../utils';

View file

@ -8,7 +8,7 @@
import React, { FC, useCallback, useMemo, useState } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { TimefilterContract } from '@kbn/data-plugin/public';
import { DataView } from '@kbn/data-plugin/common';
import type { DataView } from '@kbn/data-plugin/common';
import {
EuiButton,

View file

@ -10,7 +10,8 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { merge } from 'rxjs';
import type { EuiTableActionsColumnType } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { DataViewField, KBN_FIELD_TYPES, UI_SETTINGS } from '@kbn/data-plugin/common';
import { type DataViewField, UI_SETTINGS } from '@kbn/data-plugin/common';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import seedrandom from 'seedrandom';
import type { SamplingOption } from '@kbn/discover-plugin/public/application/main/components/field_stats_table/field_stats_table';
import type { RandomSamplerOption } from '../constants/random_sampler';

View file

@ -8,7 +8,7 @@ import { encode } from '@kbn/rison';
import { stringify } from 'query-string';
import { SerializableRecord } from '@kbn/utility-types';
import { Filter, TimeRange } from '@kbn/es-query';
import { RefreshInterval } from '@kbn/data-plugin/common';
import type { RefreshInterval } from '@kbn/data-plugin/common';
import { LocatorDefinition, LocatorPublic } from '@kbn/share-plugin/common';
import { GlobalQueryStateFromUrl } from '@kbn/data-plugin/public';
import { Dictionary, isRisonSerializationRequired } from '../../common/util/url_state';

View file

@ -10,7 +10,7 @@ import { find, get } from 'lodash';
import { catchError, map } from 'rxjs/operators';
import { Observable, of } from 'rxjs';
import { AggregationsTermsAggregation } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import {
import type {
IKibanaSearchRequest,
IKibanaSearchResponse,
ISearchOptions,

View file

@ -8,7 +8,7 @@
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { get } from 'lodash';
import { Query } from '@kbn/es-query';
import { IKibanaSearchResponse } from '@kbn/data-plugin/common';
import type { IKibanaSearchResponse } from '@kbn/data-plugin/common';
import type { AggCardinality } from '@kbn/ml-agg-utils';
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
import { buildAggregationWithSamplingOption } from './build_random_sampler_agg';

View file

@ -6,7 +6,7 @@
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/common';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import {
ML_JOB_AGGREGATION,
KIBANA_AGGREGATION,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ES_FIELD_TYPES } from '@kbn/data-plugin/common';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import {
Field,
Aggregation,

View file

@ -15,7 +15,7 @@ import { i18n } from '@kbn/i18n';
import { CoreSetup } from '@kbn/core/public';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/field-types';
import type { DataView, DataViewField } from '@kbn/data-views-plugin/common';

View file

@ -10,7 +10,7 @@ import { render } from '@testing-library/react';
import { renderHook } from '@testing-library/react-hooks';
import '@testing-library/jest-dom/extend-expect';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import {
isNumericChartData,

View file

@ -15,7 +15,7 @@ import { euiPaletteColorBlind, EuiDataGridColumn } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import {
isNumericChartData,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/field-types';
import { getNumTopClasses, getNumTopFeatureImportanceValues } from './analytics';
import { Field } from '../../../../common/types/fields';
import {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import { newJobCapsServiceAnalytics } from '../../services/new_job_capabilities/new_job_capabilities_service_analytics';

View file

@ -7,7 +7,7 @@
import { i18n } from '@kbn/i18n';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import { EVENT_RATE_FIELD_ID } from '../../../../../../../common/types/fields';
import { ANALYSIS_CONFIG_TYPE } from '../../../../common/analytics';
import { AnalyticsJobType } from '../../../analytics_management/hooks/use_create_analytics_form/state';

View file

@ -9,7 +9,7 @@ import React, { FC, Fragment, useState, useEffect } from 'react';
import { EuiSpacer, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import { AnalyticsJobType } from '../../../analytics_management/hooks/use_create_analytics_form/state';
import { ANALYSIS_CONFIG_TYPE } from '../../../../common/analytics';
import { Field, EVENT_RATE_FIELD_ID } from '../../../../../../../common/types/fields';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import { MlJobFieldType } from '../../../../../common/types/field_types';
export interface FieldRequestConfig {

View file

@ -11,7 +11,7 @@
import { get, union, uniq } from 'lodash';
import moment from 'moment-timezone';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import { asyncForEach } from '@kbn/std';
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
import type { DataViewsContract } from '@kbn/data-views-plugin/public';

View file

@ -7,7 +7,7 @@
import { BehaviorSubject } from 'rxjs';
import { cloneDeep } from 'lodash';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import type { DataView } from '@kbn/data-views-plugin/public';
import { SavedSearchSavedObject } from '../../../../../../common/types/kibana';
import { UrlConfig } from '../../../../../../common/types/custom_urls';

View file

@ -7,7 +7,7 @@
import { i18n } from '@kbn/i18n';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import { Job, Datafeed, Detector } from '../../../../../../../common/types/anomaly_detection_jobs';
import { newJobCapsService } from '../../../../../services/new_job_capabilities/new_job_capabilities_service';
import { NavigateToPath } from '../../../../../contexts/kibana';

View file

@ -16,7 +16,7 @@ import type {
import type { SerializableRecord } from '@kbn/utility-types';
import type { SharePluginStart } from '@kbn/share-plugin/public';
import { layerTypes } from '@kbn/lens-plugin/public';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import { ML_PAGES, ML_APP_LOCATOR } from '../../../../../common/constants/locator';
import { ML_JOB_AGGREGATION } from '../../../../../common/constants/aggregation_types';

View file

@ -17,7 +17,7 @@ import {
EuiLink,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import { useMlKibana, useNavigateToPath } from '../../../../contexts/kibana';
import { useMlContext } from '../../../../contexts/ml';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import { Aggregation, Field, NewJobCaps } from '../../../../common/types/fields';
// create two lists, one removing text fields if there are keyword equivalents and vice versa

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import type { DataView } from '@kbn/data-views-plugin/public';
import type { Field, Aggregation, AggId, FieldId } from '../../../../common/types/fields';
import { EVENT_RATE_FIELD_ID } from '../../../../common/types/fields';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import { DataView } from '@kbn/data-views-plugin/public';
import { Field, NewJobCapsResponse } from '../../../../common/types/fields';
import { processTextAndKeywordFields, NewJobCapabilitiesServiceBase } from './new_job_capabilities';

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { DataViewField } from '@kbn/data-views-plugin/common';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import type { DataViewField } from '@kbn/data-views-plugin/common';
import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types';
import {
kbnTypeToMLJobType,

View file

@ -7,8 +7,8 @@
import { i18n } from '@kbn/i18n';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { DataViewField } from '@kbn/data-views-plugin/common';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import type { DataViewField } from '@kbn/data-views-plugin/common';
import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types';
// convert kibana types to ML Job types

View file

@ -8,7 +8,7 @@
import { cloneDeep } from 'lodash';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { IScopedClusterClient } from '@kbn/core/server';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/common';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import type { DataViewsService } from '@kbn/data-views-plugin/common';
import type { Field, FieldId, NewJobCaps, RollupFields } from '../../../../common/types/fields';
import { combineFieldsAndAggs } from '../../../../common/util/fields_utils';

View file

@ -6,7 +6,7 @@
*/
import { IScopedClusterClient } from '@kbn/core/server';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/server';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import { parseInterval } from '../../../common/util/parse_interval';
import { CombinedJob } from '../../../common/types/anomaly_detection_jobs';
import { validateJobObject } from './validate_job_object';

View file

@ -7,7 +7,7 @@
import { schema, TypeOf } from '@kbn/config-schema';
import type { ES_FIELD_TYPES } from '@kbn/data-plugin/common';
import type { ES_FIELD_TYPES } from '@kbn/field-types';
import type { Dictionary } from '../types/common';
import type { PivotAggDict } from '../types/pivot_aggs';

View file

@ -7,7 +7,7 @@
import { FC } from 'react';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/field-types';
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
import type { AggName } from '../../../common/types/aggregations';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
import { AggName } from '../../../common/types/aggregations';
import { Dictionary } from '../../../common/types/common';

View file

@ -9,7 +9,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { IHttpFetchError } from '@kbn/core-http-browser';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import type { TransformId } from '../../../../common/types/transform';
import type { FieldHistogramsResponseSchema } from '../../../../common/api_schemas/field_histograms';

View file

@ -11,7 +11,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { IHttpFetchError } from '@kbn/core-http-browser';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import type { GetTransformsAuditMessagesResponseSchema } from '../../../common/api_schemas/audit_messages';
import type {

View file

@ -6,7 +6,7 @@
*/
import { getCombinedProperties } from './use_pivot_data';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/common';
import { ES_FIELD_TYPES } from '@kbn/field-types';
describe('getCombinedProperties', () => {
test('extracts missing mappings from docs', () => {

View file

@ -14,7 +14,7 @@ import { i18n } from '@kbn/i18n';
import { getFlattenedObject } from '@kbn/std';
import { difference } from 'lodash';
import { ES_FIELD_TYPES } from '@kbn/data-plugin/common';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import type { PreviewMappingsProperties } from '../../../common/api_schemas/transforms';
import { isPostTransformsPreviewResponseSchema } from '../../../common/api_schemas/type_guards';

View file

@ -10,7 +10,7 @@ import React from 'react';
import { I18nProvider } from '@kbn/i18n-react';
import { FilterAggForm } from './filter_agg_form';
import { CreateTransformWizardContext } from '../../../../wizard/wizard';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import type { RuntimeField } from '@kbn/data-views-plugin/common';
import { DataView } from '@kbn/data-views-plugin/public';
import { FilterTermForm } from './filter_term_form';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import { FilterAggType } from './types';
export const FILTERS = {

View file

@ -6,7 +6,7 @@
*/
import { EuiComboBoxOptionOption } from '@elastic/eui';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/field-types';
import { DataView } from '@kbn/data-views-plugin/public';
import { getNestedProperty } from '../../../../../../../common/utils/object_utils';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
import { EsFieldName } from '../../../../../../../common/types/fields';

View file

@ -8,7 +8,7 @@
import { useCallback, useMemo, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiComboBoxOptionOption } from '@elastic/eui';
import { AggConfigs, FieldParamType } from '@kbn/data-plugin/common';
import type { AggConfigs, FieldParamType } from '@kbn/data-plugin/common';
import { LatestFunctionConfigUI } from '../../../../../../../common/types/transform';
import { StepDefineFormProps } from '../step_define_form';
import { StepDefineExposedState } from '../common';

View file

@ -8,7 +8,7 @@
import { useCallback, useMemo, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import { AggName } from '../../../../../../../common/types/aggregations';
import { dictionaryToArray, isDefined } from '../../../../../../../common/types/common';

View file

@ -24,7 +24,7 @@ import {
EuiText,
} from '@elastic/eui';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import { toMountPoint } from '@kbn/kibana-react-plugin/public';
import { isHttpFetchError } from '@kbn/core-http-browser';

View file

@ -19,7 +19,7 @@ import {
import { i18n } from '@kbn/i18n';
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/common';
import { KBN_FIELD_TYPES } from '@kbn/field-types';
import { isEsIngestPipelines } from '../../../../../../common/api_schemas/type_guards';
import { EditTransformFlyoutFormTextInput } from './edit_transform_flyout_form_text_input';
import { UseEditTransformFlyoutReturnType } from './use_edit_transform_flyout';