diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index c13b2bd32d32b..98cd28e9db021 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -49,7 +49,7 @@ pageLoadAssetSize: lists: 202261 logstash: 53548 management: 46112 - maps: 183754 + maps: 80000 mapsLegacy: 87859 mapsLegacyLicensing: 20214 ml: 82187 diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx index ef67501ec761b..1e368b2eb5368 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx @@ -24,7 +24,7 @@ import { import { useLayerList } from './useLayerList'; import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; -import { RenderTooltipContentParams } from '../../../../../../maps/public'; +import type { RenderTooltipContentParams } from '../../../../../../maps/public'; import { MapToolTip } from './MapToolTip'; import { useMapFilters } from './useMapFilters'; import { EmbeddableStart } from '../../../../../../../../src/plugins/embeddable/public'; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/MapToolTip.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/MapToolTip.tsx index 7e6c8ddd493bf..7501d5bfaa2c5 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/MapToolTip.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/MapToolTip.tsx @@ -20,7 +20,7 @@ import { TRANSACTION_DURATION_COUNTRY, TRANSACTION_DURATION_REGION, } from './useLayerList'; -import { RenderTooltipContentParams } from '../../../../../../maps/public'; +import type { RenderTooltipContentParams } from '../../../../../../maps/public'; import { I18LABELS } from '../translations'; type MapToolTipProps = Partial; diff --git a/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts b/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts index 5f81a74ab03ce..a8bc5b9a821f0 100644 --- a/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts +++ b/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts @@ -7,7 +7,7 @@ import _ from 'lodash'; import { Filter } from '../../../../../../src/plugins/data/public'; -import { TooltipFeature } from '../../../../../plugins/maps/common/descriptor_types'; +import type { TooltipFeature } from '../../../../../plugins/maps/common/descriptor_types'; export interface ITooltipProperty { getPropertyKey(): string; diff --git a/x-pack/plugins/maps/public/embeddable/map_embeddable_factory.ts b/x-pack/plugins/maps/public/embeddable/map_embeddable_factory.ts index b1944f8136709..a4ce76b702d13 100644 --- a/x-pack/plugins/maps/public/embeddable/map_embeddable_factory.ts +++ b/x-pack/plugins/maps/public/embeddable/map_embeddable_factory.ts @@ -11,7 +11,6 @@ import { EmbeddableFactoryDefinition, IContainer, } from '../../../../../src/plugins/embeddable/public'; -import '../index.scss'; import { MAP_SAVED_OBJECT_TYPE, APP_ICON } from '../../common/constants'; import { getMapEmbeddableDisplayName } from '../../common/i18n_getters'; import { MapByReferenceInput, MapEmbeddableInput, MapByValueInput } from './types'; diff --git a/x-pack/plugins/maps/public/index.ts b/x-pack/plugins/maps/public/index.ts index 3e6cd8d14ad37..dc9cb2d594fe3 100644 --- a/x-pack/plugins/maps/public/index.ts +++ b/x-pack/plugins/maps/public/index.ts @@ -19,6 +19,8 @@ export const plugin: PluginInitializer = ( export { MAP_SAVED_OBJECT_TYPE } from '../common/constants'; -export { RenderTooltipContentParams } from './classes/tooltips/tooltip_property'; +export type { RenderTooltipContentParams } from './classes/tooltips/tooltip_property'; export { MapsStartApi } from './api'; + +export type { MapEmbeddable, MapEmbeddableInput } from './embeddable'; diff --git a/x-pack/plugins/maps/public/kibana_services.ts b/x-pack/plugins/maps/public/kibana_services.ts index 6fd14d8d42e18..e4b9397fab8e7 100644 --- a/x-pack/plugins/maps/public/kibana_services.ts +++ b/x-pack/plugins/maps/public/kibana_services.ts @@ -5,13 +5,12 @@ * 2.0. */ -import _ from 'lodash'; -import { CoreStart } from 'kibana/public'; +import type { CoreStart } from 'kibana/public'; import type { MapsEmsConfig } from '../../../../src/plugins/maps_ems/public'; -import { MapsConfigType } from '../config'; -import { MapsPluginStartDependencies } from './plugin'; -import { EMSSettings } from '../common/ems_settings'; -import { PaletteRegistry } from '../../../../src/plugins/charts/public'; +import type { MapsConfigType } from '../config'; +import type { MapsPluginStartDependencies } from './plugin'; +import type { EMSSettings } from '../common/ems_settings'; +import type { PaletteRegistry } from '../../../../src/plugins/charts/public'; let kibanaVersion: string; export const setKibanaVersion = (version: string) => (kibanaVersion = version); @@ -75,8 +74,22 @@ export const getEMSSettings = () => { export const getEmsTileLayerId = () => getKibanaCommonConfig().emsTileLayerId; -export const getRegionmapLayers = () => _.get(getKibanaCommonConfig(), 'regionmap.layers', []); -export const getTilemap = () => _.get(getKibanaCommonConfig(), 'tilemap', []); +export const getRegionmapLayers = () => { + const config = getKibanaCommonConfig(); + if (config.regionmap && config.regionmap.layers) { + return config.regionmap.layers; + } else { + return []; + } +}; +export const getTilemap = () => { + const config = getKibanaCommonConfig(); + if (config.tilemap) { + return config.tilemap; + } else { + return {}; + } +}; export const getShareService = () => pluginsStart.share; diff --git a/x-pack/plugins/maps/public/lazy_load_bundle/lazy/index.ts b/x-pack/plugins/maps/public/lazy_load_bundle/lazy/index.ts index 0d908356b714d..85b58da0ab09a 100644 --- a/x-pack/plugins/maps/public/lazy_load_bundle/lazy/index.ts +++ b/x-pack/plugins/maps/public/lazy_load_bundle/lazy/index.ts @@ -5,6 +5,7 @@ * 2.0. */ +import '../../index.scss'; export * from '../../embeddable/map_embeddable'; export * from '../../kibana_services'; export { renderApp } from '../../render_app'; diff --git a/x-pack/plugins/maps/public/maps_vis_type_alias.ts b/x-pack/plugins/maps/public/maps_vis_type_alias.ts index a3a8b55745d84..194b4595c0c93 100644 --- a/x-pack/plugins/maps/public/maps_vis_type_alias.ts +++ b/x-pack/plugins/maps/public/maps_vis_type_alias.ts @@ -6,12 +6,12 @@ */ import { i18n } from '@kbn/i18n'; -import { +import type { VisualizationsSetup, VisualizationStage, } from '../../../../src/plugins/visualizations/public'; -import { SavedObject } from '../../../../src/core/types/saved_objects'; -import { MapSavedObject } from '../common/map_saved_object_type'; +import type { SavedObject } from '../../../../src/core/types/saved_objects'; +import type { MapSavedObject } from '../common/map_saved_object_type'; import { APP_ID, APP_ICON, diff --git a/x-pack/plugins/maps/public/plugin.ts b/x-pack/plugins/maps/public/plugin.ts index be2e097c71dc5..7ddab6bf509ff 100644 --- a/x-pack/plugins/maps/public/plugin.ts +++ b/x-pack/plugins/maps/public/plugin.ts @@ -5,19 +5,19 @@ * 2.0. */ -import { Setup as InspectorSetupContract } from 'src/plugins/inspector/public'; -import { UiActionsStart } from 'src/plugins/ui_actions/public'; -import { NavigationPublicPluginStart } from 'src/plugins/navigation/public'; -import { Start as InspectorStartContract } from 'src/plugins/inspector/public'; -import { DashboardStart } from 'src/plugins/dashboard/public'; -import { +import type { Setup as InspectorSetupContract } from 'src/plugins/inspector/public'; +import type { UiActionsStart } from 'src/plugins/ui_actions/public'; +import type { NavigationPublicPluginStart } from 'src/plugins/navigation/public'; +import type { Start as InspectorStartContract } from 'src/plugins/inspector/public'; +import type { DashboardStart } from 'src/plugins/dashboard/public'; +import type { AppMountParameters, CoreSetup, CoreStart, Plugin, PluginInitializerContext, - DEFAULT_APP_CATEGORIES, } from '../../../../src/core/public'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public'; // @ts-ignore import { MapView } from './inspector/views/map_view'; import { @@ -29,8 +29,8 @@ import { } from './kibana_services'; import { featureCatalogueEntry } from './feature_catalogue_entry'; import { getMapsVisTypeAlias } from './maps_vis_type_alias'; -import { HomePublicPluginSetup } from '../../../../src/plugins/home/public'; -import { +import type { HomePublicPluginSetup } from '../../../../src/plugins/home/public'; +import type { VisualizationsSetup, VisualizationsStart, } from '../../../../src/plugins/visualizations/public'; @@ -43,28 +43,27 @@ import { } from './url_generator'; import { visualizeGeoFieldAction } from './trigger_actions/visualize_geo_field_action'; import { MapEmbeddableFactory } from './embeddable/map_embeddable_factory'; -import { EmbeddableSetup } from '../../../../src/plugins/embeddable/public'; +import type { EmbeddableSetup, EmbeddableStart } from '../../../../src/plugins/embeddable/public'; import { MapsXPackConfig, MapsConfigType } from '../config'; import { getAppTitle } from '../common/i18n_getters'; import { lazyLoadMapModules } from './lazy_load_bundle'; import { MapsStartApi } from './api'; import { createLayerDescriptors, registerLayerWizard, registerSource } from './api'; -import { SharePluginSetup, SharePluginStart } from '../../../../src/plugins/share/public'; -import { EmbeddableStart } from '../../../../src/plugins/embeddable/public'; +import type { SharePluginSetup, SharePluginStart } from '../../../../src/plugins/share/public'; import type { MapsEmsPluginSetup } from '../../../../src/plugins/maps_ems/public'; -import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; -import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/public'; -import { FileUploadPluginStart } from '../../file_upload/public'; -import { SavedObjectsStart } from '../../../../src/plugins/saved_objects/public'; -import { PresentationUtilPluginStart } from '../../../../src/plugins/presentation_util/public'; +import type { DataPublicPluginStart } from '../../../../src/plugins/data/public'; +import type { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/public'; +import type { FileUploadPluginStart } from '../../file_upload/public'; +import type { SavedObjectsStart } from '../../../../src/plugins/saved_objects/public'; +import type { PresentationUtilPluginStart } from '../../../../src/plugins/presentation_util/public'; import { getIsEnterprisePlus, registerLicensedFeatures, setLicensingPluginStart, } from './licensed_features'; import { EMSSettings } from '../common/ems_settings'; -import { SavedObjectTaggingPluginStart } from '../../saved_objects_tagging/public'; -import { ChartsPluginStart } from '../../../../src/plugins/charts/public'; +import type { SavedObjectTaggingPluginStart } from '../../saved_objects_tagging/public'; +import type { ChartsPluginStart } from '../../../../src/plugins/charts/public'; export interface MapsPluginSetupDependencies { inspector: InspectorSetupContract; diff --git a/x-pack/plugins/maps/public/url_generator.ts b/x-pack/plugins/maps/public/url_generator.ts index c82af369fe113..9f28b388c4756 100644 --- a/x-pack/plugins/maps/public/url_generator.ts +++ b/x-pack/plugins/maps/public/url_generator.ts @@ -6,17 +6,17 @@ */ import rison from 'rison-node'; -import { +import type { TimeRange, Filter, Query, - esFilters, QueryState, RefreshInterval, } from '../../../../src/plugins/data/public'; +import { esFilters } from '../../../../src/plugins/data/public'; import { setStateToKbnUrl } from '../../../../src/plugins/kibana_utils/public'; -import { UrlGeneratorsDefinition } from '../../../../src/plugins/share/public'; -import { LayerDescriptor } from '../common/descriptor_types'; +import type { UrlGeneratorsDefinition } from '../../../../src/plugins/share/public'; +import type { LayerDescriptor } from '../common/descriptor_types'; import { INITIAL_LAYERS_KEY } from '../common/constants'; import { lazyLoadMapModules } from './lazy_load_bundle'; diff --git a/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.tsx b/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.tsx index eceea1de4edc0..297746fd23632 100644 --- a/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.tsx +++ b/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.tsx @@ -12,15 +12,11 @@ import minimatch from 'minimatch'; import { IndexPatternMapping } from './types'; import { getLayerList } from './map_config'; import { MAP_SAVED_OBJECT_TYPE } from '../../../../../maps/public'; -import { +import type { + RenderTooltipContentParams, MapEmbeddable, MapEmbeddableInput, - // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../../../../plugins/maps/public/embeddable'; -import { - RenderTooltipContentParams, - // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../../../../plugins/maps/public/classes/tooltips/tooltip_property'; +} from '../../../../../../plugins/maps/public'; import * as i18n from './translations'; import { Query, Filter } from '../../../../../../../src/plugins/data/public'; import { diff --git a/x-pack/plugins/security_solution/public/network/components/embeddables/types.ts b/x-pack/plugins/security_solution/public/network/components/embeddables/types.ts index 7d9c66261924b..6317cad7f8d98 100644 --- a/x-pack/plugins/security_solution/public/network/components/embeddables/types.ts +++ b/x-pack/plugins/security_solution/public/network/components/embeddables/types.ts @@ -5,8 +5,7 @@ * 2.0. */ -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { RenderTooltipContentParams } from '../../../../../maps/public/classes/tooltips/tooltip_property'; +import type { RenderTooltipContentParams } from '../../../../../maps/public'; export interface IndexPatternMapping { title: string; diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/embedded_map.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/embedded_map.tsx index 0903835ef1601..2dc15127529d9 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/embedded_map.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/embedded_map.tsx @@ -26,10 +26,8 @@ import { ViewMode, ErrorEmbeddable, } from '../../../../../../../../../src/plugins/embeddable/public'; -import { - RenderTooltipContentParams, - // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../../../../../maps/public/classes/tooltips/tooltip_property'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import type { RenderTooltipContentParams } from '../../../../../../../maps/public/classes/tooltips/tooltip_property'; export interface EmbeddedMapProps { upPoints: LocationPoint[]; diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/map_tool_tip.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/map_tool_tip.tsx index 7d29786f487e0..c03ed94f8c544 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/map_tool_tip.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/map_tool_tip.tsx @@ -22,12 +22,9 @@ import { AppState } from '../../../../../state'; import { monitorLocationsSelector } from '../../../../../state/selectors'; import { useMonitorId } from '../../../../../hooks'; import { MonitorLocation } from '../../../../../../common/runtime_types/monitor'; +import type { RenderTooltipContentParams } from '../../../../../../../maps/public'; import { formatAvailabilityValue } from '../../availability_reporting/availability_reporting'; import { LastCheckLabel } from '../../translations'; -import { - RenderTooltipContentParams, - // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../../../../../maps/public/classes/tooltips/tooltip_property'; type MapToolTipProps = Partial;