From 6ec3136d17730920342152f85e45a7a9ae14f1c3 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:21:46 +0000 Subject: [PATCH] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- .../component_template_from_field_map.ts | 2 +- x-pack/plugins/alerting/common/bulk_edit.ts | 2 +- .../alerting/common/maintenance_window.ts | 4 +- .../plugins/alerting/common/parse_duration.ts | 2 +- .../routes/backfill/apis/delete/types/v1.ts | 2 +- .../routes/backfill/apis/find/types/v1.ts | 2 +- .../routes/backfill/apis/get/types/v1.ts | 2 +- .../routes/backfill/apis/schedule/types/v1.ts | 2 +- .../routes/backfill/response/types/v1.ts | 2 +- .../routes/framework/apis/health/types/v1.ts | 2 +- .../apis/archive/types/v1.ts | 4 +- .../apis/bulk_get/types/v1.ts | 4 +- .../apis/create/types/v1.ts | 4 +- .../apis/delete/types/v1.ts | 2 +- .../maintenance_window/apis/find/types/v1.ts | 4 +- .../apis/finish/types/v1.ts | 4 +- .../maintenance_window/apis/get/types/v1.ts | 4 +- .../apis/get_active/types/v1.ts | 2 +- .../apis/update/types/v1.ts | 4 +- .../maintenance_window/response/types/v1.ts | 2 +- .../maintenance_window/shared/types/v1.ts | 2 +- .../common/routes/r_rule/request/types/v1.ts | 2 +- .../common/routes/r_rule/response/types/v1.ts | 2 +- .../r_rule/validation/validate_end_date/v1.ts | 1 - .../validation/validate_start_date/v1.ts | 1 - .../routes/rule/apis/aggregate/types/v1.ts | 2 +- .../routes/rule/apis/bulk_delete/types/v1.ts | 4 +- .../rule/apis/bulk_delete/validation/v1.ts | 2 +- .../routes/rule/apis/bulk_disable/types/v1.ts | 4 +- .../rule/apis/bulk_disable/validation/v1.ts | 2 +- .../routes/rule/apis/bulk_edit/types/v1.ts | 4 +- .../routes/rule/apis/bulk_enable/types/v1.ts | 4 +- .../routes/rule/apis/bulk_untrack/types/v1.ts | 2 +- .../apis/bulk_untrack_by_query/types/v1.ts | 2 +- .../common/routes/rule/apis/clone/types/v1.ts | 4 +- .../routes/rule/apis/create/types/v1.ts | 4 +- .../routes/rule/apis/delete/types/v1.ts | 2 +- .../routes/rule/apis/disable/types/v1.ts | 2 +- .../routes/rule/apis/enable/types/v1.ts | 2 +- .../common/routes/rule/apis/find/types/v1.ts | 4 +- .../common/routes/rule/apis/get/types/v1.ts | 4 +- .../apis/get_schedule_frequency/types/v1.ts | 5 +- .../routes/rule/apis/list_types/types/v1.ts | 2 +- .../routes/rule/apis/mute_alert/types/v1.ts | 2 +- .../routes/rule/apis/mute_all/types/v1.ts | 2 +- .../routes/rule/apis/resolve/types/v1.ts | 2 +- .../common/routes/rule/apis/tags/types/v1.ts | 4 +- .../routes/rule/apis/unmute_alert/types/v1.ts | 2 +- .../routes/rule/apis/unmute_all/types/v1.ts | 2 +- .../routes/rule/apis/update/types/v1.ts | 4 +- .../rule/apis/update_api_key/types/v1.ts | 2 +- .../routes/rule/common/flapping/types/v1.ts | 2 +- .../common/routes/rule/response/types/v1.ts | 4 +- .../rule/validation/validate_duration/v1.ts | 2 +- .../rule/validation/validate_hours/v1.ts | 2 +- .../validation/validate_notify_when/v1.ts | 3 +- .../validation/validate_snooze_schedule/v1.ts | 4 +- .../rule/validation/validate_timezone/v1.ts | 2 +- .../rules_settings/apis/get/types/v1.ts | 2 +- .../rules_settings/apis/update/types/v1.ts | 4 +- .../rules_settings/response/types/v1.ts | 2 +- .../alert_navigation_registry.mock.ts | 2 +- .../alert_navigation_registry.test.ts | 3 +- .../alert_navigation_registry.ts | 4 +- .../public/alert_navigation_registry/types.ts | 2 +- .../application/maintenance_windows.tsx | 6 +- .../use_archive_maintenance_window.test.tsx | 3 +- .../public/hooks/use_breadcrumbs.test.tsx | 3 +- .../alerting/public/hooks/use_breadcrumbs.ts | 12 +-- .../use_create_maintenance_window.test.tsx | 3 +- .../hooks/use_create_maintenance_window.ts | 3 +- .../use_find_maintenance_windows.test.tsx | 3 +- ...sh_and_archive_maintenance_window.test.tsx | 3 +- .../use_finish_maintenance_window.test.tsx | 3 +- .../hooks/use_get_maintenance_window.test.tsx | 3 +- .../public/hooks/use_license.test.tsx | 3 +- .../public/hooks/use_navigation.test.tsx | 3 +- .../use_update_maintenance_window.test.tsx | 3 +- .../hooks/use_update_maintenance_window.ts | 3 +- .../public/lib/common_transformations.test.ts | 3 +- .../public/lib/common_transformations.ts | 6 +- .../alerting/public/lib/test_utils.tsx | 8 +- x-pack/plugins/alerting/public/mocks.ts | 2 +- .../center_justified_spinner.test.tsx | 3 +- .../components/center_justified_spinner.tsx | 2 +- .../create_maintenance_windows_form.test.tsx | 9 +- .../create_maintenance_windows_form.tsx | 5 +- .../components/empty_prompt.test.tsx | 3 +- .../components/empty_prompt.tsx | 2 +- .../fields/date_picker_range_field.tsx | 10 +- .../components/license_prompt.test.tsx | 3 +- .../components/link_icon.test.tsx | 3 +- ...tenance_window_category_selection.test.tsx | 3 +- .../maintenance_window_category_selection.tsx | 6 +- .../maintenance_window_scoped_query.test.tsx | 3 +- .../maintenance_window_scoped_query.tsx | 2 +- ...maintenance_window_scoped_query_switch.tsx | 10 +- .../maintenance_windows_list.test.tsx | 6 +- .../components/maintenance_windows_list.tsx | 13 +-- .../components/page_header.test.tsx | 3 +- .../custom_recurring_schedule.test.tsx | 9 +- .../custom_recurring_schedule.tsx | 8 +- .../recurring_schedule.test.tsx | 9 +- .../recurring_schedule.tsx | 5 +- .../maintenance_windows/components/schema.ts | 5 +- .../components/status_filter.test.tsx | 3 +- .../components/status_filter.tsx | 2 +- .../components/submit_button.test.tsx | 6 +- .../components/table_actions_popover.test.tsx | 3 +- .../components/table_actions_popover.tsx | 2 +- .../components/truncated_text.test.tsx | 3 +- .../upcoming_events_popover.test.tsx | 3 +- .../components/upcoming_events_popover.tsx | 3 +- ...convert_from_maintenance_window_to_form.ts | 3 +- .../helpers/convert_to_rrule.ts | 6 +- .../helpers/get_initial_by_weekday.ts | 2 +- .../helpers/get_nth_by_weekday.ts | 4 +- .../helpers/get_presets.ts | 2 +- .../helpers/get_selected_for_date_picker.ts | 5 +- .../helpers/get_weekday_info.ts | 3 +- .../helpers/parse_schedule.ts | 2 +- .../helpers/recurring_summary.ts | 12 +-- .../pages/maintenance_windows/index.test.tsx | 3 +- .../pages/maintenance_windows/translations.ts | 2 +- x-pack/plugins/alerting/public/plugin.test.ts | 3 +- x-pack/plugins/alerting/public/plugin.ts | 14 +-- .../alerting/public/services/rule_api.test.ts | 2 +- .../alerting/public/services/rule_api.ts | 7 +- .../alerting/public/utils/kibana_react.ts | 6 +- .../alerting/server/alert/alert.test.ts | 4 +- x-pack/plugins/alerting/server/alert/alert.ts | 8 +- .../server/alert/create_alert_factory.ts | 7 +- ...rting_authorization_client_factory.mock.ts | 2 +- ...rting_authorization_client_factory.test.ts | 6 +- .../alerting_authorization_client_factory.ts | 10 +- .../alerts_client/alerts_client.test.ts | 20 ++-- .../server/alerts_client/alerts_client.ts | 22 ++--- .../alerts_client/alerts_client_fixtures.ts | 10 +- .../legacy_alerts_client.test.ts | 7 +- .../alerts_client/legacy_alerts_client.ts | 33 +++---- .../lib/alert_conflict_resolver.test.ts | 2 +- .../lib/alert_conflict_resolver.ts | 4 +- .../alerts_client/lib/build_new_alert.test.ts | 2 +- .../alerts_client/lib/build_new_alert.ts | 6 +- .../alerts_client/lib/build_ongoing_alert.ts | 6 +- .../lib/build_recovered_alert.ts | 6 +- .../lib/build_updated_recovered_alert.ts | 6 +- .../server/alerts_client/lib/format_alert.ts | 2 +- .../alerts_client/lib/format_rule.test.ts | 2 +- .../server/alerts_client/lib/format_rule.ts | 2 +- .../lib/get_summarized_alerts_query.ts | 19 ++-- .../lib/initialize_alerts_client.test.ts | 7 +- .../lib/initialize_alerts_client.ts | 14 +-- .../lib/inject_analyze_wildcard.ts | 2 +- .../lib/is_alert_improving.test.ts | 2 +- .../alerts_client/lib/is_alert_improving.ts | 9 +- .../lib/sanitize_bulk_response.test.ts | 2 +- .../lib/sanitize_bulk_response.ts | 2 +- .../lib/strip_framework_fields.ts | 2 +- .../server/alerts_client/lib/test_fixtures.ts | 2 +- .../alerting/server/alerts_client/types.ts | 18 ++-- .../alerts_service/alerts_service.test.ts | 9 +- .../server/alerts_service/alerts_service.ts | 18 ++-- ...reate_resource_installation_helper.test.ts | 8 +- .../create_resource_installation_helper.ts | 4 +- .../default_lifecycle_policy.ts | 2 +- .../lib/create_concrete_write_index.test.ts | 2 +- .../lib/create_concrete_write_index.ts | 11 +-- .../create_or_update_component_template.ts | 4 +- .../lib/create_or_update_ilm_policy.ts | 6 +- .../create_or_update_index_template.test.ts | 2 +- .../lib/create_or_update_index_template.ts | 8 +- .../lib/data_stream_adapter.mock.ts | 2 +- .../alerts_service/lib/data_stream_adapter.ts | 5 +- .../lib/install_with_timeout.test.ts | 3 +- .../lib/install_with_timeout.ts | 5 +- .../lib/retry_transient_es_errors.ts | 2 +- .../lib/set_alerts_to_untracked.test.ts | 7 +- .../lib/set_alerts_to_untracked.ts | 6 +- .../resource_installer_utils.ts | 2 +- .../types/alerts_filter_query.ts | 4 +- .../methods/delete/delete_backfill.test.ts | 11 ++- .../methods/delete/delete_backfill.ts | 4 +- .../methods/find/find_backfill.test.ts | 11 ++- .../backfill/methods/find/find_backfill.ts | 11 ++- .../backfill/methods/find/types/index.ts | 4 +- .../backfill/methods/get/get_backfill.test.ts | 11 ++- .../backfill/methods/get/get_backfill.ts | 6 +- .../schedule/schedule_backfill.test.ts | 9 +- .../methods/schedule/schedule_backfill.ts | 9 +- .../backfill/methods/schedule/types/index.ts | 4 +- .../backfill/result/types/index.ts | 4 +- ...form_ad_hoc_run_to_backfill_result.test.ts | 4 +- ...transform_ad_hoc_run_to_backfill_result.ts | 6 +- ...sform_backfill_param_to_ad_hoc_run.test.ts | 4 +- .../transform_backfill_param_to_ad_hoc_run.ts | 6 +- .../lib/generate_maintenance_window_events.ts | 4 +- ...maintenance_window_date_and_status.test.ts | 3 +- .../get_maintenance_window_date_and_status.ts | 3 +- .../archive_maintenance_window.test.ts | 8 +- .../archive_maintenance_window_params.ts | 2 +- .../bulk_get_maintenance_windows.test.ts | 8 +- .../bulk_get_maintenance_window_params.ts | 4 +- .../bulk_get_maintenance_window_result.ts | 4 +- .../create/create_maintenance_window.test.ts | 10 +- .../create/create_maintenance_window.ts | 3 +- .../types/create_maintenance_window_params.ts | 4 +- .../delete/delete_maintenance_window.test.ts | 6 +- .../types/delete_maintenance_window_params.ts | 4 +- .../find/find_maintenance_windows.test.ts | 8 +- .../methods/find/find_maintenance_windows.ts | 2 +- .../types/find_maintenance_window_params.ts | 4 +- .../types/find_maintenance_window_result.ts | 4 +- .../finish/finish_maintenance_window.test.ts | 8 +- .../finish/finish_maintenance_window.ts | 7 +- .../types/finish_maintenance_window_params.ts | 4 +- .../get/get_maintenance_window.test.ts | 8 +- .../types/get_maintenance_window_params.ts | 4 +- .../get_active_maintenance_windows.test.ts | 8 +- .../get_active_maintenance_windows.ts | 3 +- .../types/update_maintenance_window_params.ts | 4 +- .../update/update_maintenance_window.test.ts | 10 +- .../update/update_maintenance_window.ts | 5 +- ...window_attributes_to_maintenance_window.ts | 4 +- ...window_to_maintenance_window_attributes.ts | 4 +- .../types/maintenance_window.ts | 6 +- .../server/application/r_rule/types/r_rule.ts | 4 +- .../r_rule/types/r_rule_request.ts | 4 +- .../r_rule/validation/validate_end_date.ts | 1 - .../r_rule/validation/validate_start_date.ts | 1 - .../methods/aggregate/aggregate_rules.test.ts | 11 ++- .../rule/methods/aggregate/aggregate_rules.ts | 5 +- .../default_rule_aggregation_factory/v1.ts | 4 +- .../rule/methods/aggregate/types/index.ts | 6 +- .../bulk_delete/bulk_delete_rules.test.ts | 9 +- .../methods/bulk_delete/bulk_delete_rules.ts | 5 +- .../rule/methods/bulk_delete/types/index.ts | 2 +- .../methods/bulk_delete/validation/index.ts | 2 +- .../bulk_disable/bulk_disable_rules.test.ts | 11 ++- .../bulk_disable/bulk_disable_rules.ts | 9 +- .../rule/methods/bulk_disable/types/index.ts | 2 +- .../methods/bulk_disable/validation/index.ts | 2 +- .../methods/bulk_edit/bulk_edit_rules.test.ts | 16 +-- .../rule/methods/bulk_edit/bulk_edit_rules.ts | 22 +++-- .../types/bulk_edit_rules_options.ts | 8 +- .../validation/validate_snooze_schedule.ts | 2 +- .../bulk_enable/bulk_enable_rules.test.ts | 11 ++- .../methods/bulk_enable/bulk_enable_rules.ts | 23 +++-- .../types/bulk_enable_rules_types.ts | 4 +- .../bulk_untrack/bulk_untrack_alerts.test.ts | 10 +- .../bulk_untrack/bulk_untrack_alerts.ts | 4 +- .../bulk_untrack/types/bulk_untrack_body.ts | 4 +- .../rule/methods/clone/clone_rule.test.ts | 9 +- .../rule/methods/clone/clone_rule.ts | 11 ++- .../methods/clone/types/clone_rule_params.ts | 4 +- .../rule/methods/create/create_rule.test.ts | 15 +-- .../rule/methods/create/create_rule.ts | 12 ++- .../methods/create/types/create_rule_data.ts | 6 +- .../rule/methods/delete/delete_rule.test.ts | 7 +- .../rule/methods/delete/delete_rule.ts | 6 +- .../delete/types/delete_rule_params.ts | 4 +- .../rule/methods/disable/disable_rule.test.ts | 7 +- .../rule/methods/disable/disable_rule.ts | 6 +- .../rule/methods/disable/types/index.ts | 2 +- .../methods/enable_rule/enable_rule.test.ts | 7 +- .../rule/methods/enable_rule/enable_rule.ts | 6 +- .../enable_rule/types/enable_rule_types.ts | 2 +- .../rule/methods/find/find_rules.test.ts | 9 +- .../rule/methods/find/find_rules.ts | 7 +- .../methods/find/types/find_rules_types.ts | 4 +- .../rule/methods/get/get_rule.test.ts | 7 +- .../application/rule/methods/get/get_rule.ts | 8 +- .../rule/methods/get/types/get_rule_params.ts | 4 +- .../get_schedule_frequency.test.ts | 7 +- .../get_schedule_frequency.ts | 6 +- .../types/get_schedule_frequency_result.ts | 4 +- .../rule/methods/mute_alert/mute_instance.ts | 4 +- .../mute_alert/types/mute_alert_params.ts | 4 +- .../rule/methods/mute_all/mute_all.test.ts | 2 +- .../rule/methods/mute_all/mute_all.ts | 6 +- .../mute_all/types/mute_all_rule_types.ts | 2 +- .../rule/methods/resolve/resolve.test.ts | 7 +- .../rule/methods/resolve/resolve_rule.ts | 6 +- .../rule/methods/rule_types/rule_types.ts | 2 +- .../rule/methods/snooze/snooze_rule.ts | 2 +- .../snooze/types/snooze_rule_options.ts | 4 +- .../rule/methods/tags/get_rule_tags.test.ts | 9 +- .../rule/methods/tags/get_rule_tags.ts | 8 +- .../types/rule_tags_aggregation_result.ts | 4 +- .../methods/tags/types/rule_tags_params.ts | 4 +- .../unmute_alert/types/unmute_alert_params.ts | 4 +- .../unmute_alert/unmute_instance.test.ts | 7 +- .../unmute_all/types/unmute_all_rule_types.ts | 2 +- .../methods/unmute_all/unmute_all.test.ts | 2 +- .../rule/methods/unmute_all/unmute_all.ts | 6 +- .../rule/methods/unsnooze/unsnooze_rule.ts | 2 +- .../methods/update/types/update_rule_data.ts | 6 +- .../rule/methods/update/update_rule.test.ts | 12 ++- .../rule/methods/update/update_rule.ts | 11 ++- .../types/update_rule_api_key_types.ts | 4 +- .../update_rule_api_key.test.ts | 7 +- .../update_api_key/update_rule_api_key.ts | 6 +- ...form_raw_actions_to_domain_actions.test.ts | 2 +- ...transform_raw_actions_to_domain_actions.ts | 6 +- ...orm_rule_attributes_to_rule_domain.test.ts | 4 +- ...ransform_rule_attributes_to_rule_domain.ts | 10 +- .../transform_rule_domain_to_rule.test.ts | 2 +- .../transform_rule_domain_to_rule.ts | 2 +- ...orm_rule_domain_to_rule_attributes.test.ts | 2 +- ...ransform_rule_domain_to_rule_attributes.ts | 6 +- .../server/application/rule/types/action.ts | 4 +- .../server/application/rule/types/rule.ts | 8 +- .../rule/validation/validate_duration.ts | 2 +- .../alerting_authorization.mock.ts | 2 +- .../alerting_authorization.test.ts | 13 ++- .../authorization/alerting_authorization.ts | 24 +++-- .../alerting_authorization_kuery.ts | 5 +- .../backfill_client/backfill_client.test.ts | 10 +- .../server/backfill_client/backfill_client.ts | 22 ++--- .../backfill_client/lib/calculate_schedule.ts | 2 +- .../lib/create_backfill_error.ts | 2 +- x-pack/plugins/alerting/server/config.ts | 3 +- .../connector_adapter_registry.ts | 2 +- .../get_system_action_kibana_privileges.ts | 4 +- .../server/connector_adapters/types.ts | 4 +- .../validate_rule_action_params.ts | 2 +- .../data/ad_hoc_run/types/ad_hoc_run.ts | 4 +- .../types/alerts_filter_query_attributes.ts | 2 +- .../methods/bulk_get_maintenance_window_so.ts | 4 +- .../methods/create_maintenance_window_so.ts | 4 +- .../methods/delete_maintenance_window_so.ts | 2 +- .../methods/find_maintenance_window_so.ts | 4 +- .../methods/get_maintenance_window_so.ts | 4 +- .../methods/update_maintenance_window_so.ts | 4 +- .../data/maintenance_window/test_helpers.ts | 2 +- .../types/maintenance_window_attributes.ts | 4 +- .../data/rule/methods/bulk_create_rule_so.ts | 4 +- .../data/rule/methods/bulk_delete_rules_so.ts | 2 +- .../rule/methods/bulk_disable_rules_so.ts | 4 +- .../data/rule/methods/create_rule_so.ts | 4 +- .../data/rule/methods/delete_rule_so.ts | 2 +- .../server/data/rule/methods/find_rules_so.ts | 4 +- .../rule/methods/get_decrypted_rule_so.ts | 8 +- .../server/data/rule/methods/get_rule_so.ts | 6 +- .../data/rule/methods/resolve_rule_so.ts | 6 +- .../data/rule/methods/update_rule_so.ts | 4 +- .../alerting/server/health/get_health.ts | 8 +- x-pack/plugins/alerting/server/health/task.ts | 8 +- .../alerting/server/health/task_state.ts | 3 +- x-pack/plugins/alerting/server/index.ts | 7 +- ...erless_upgrade_and_rollback_checks.test.ts | 2 +- .../bulk_mark_api_keys_for_invalidation.ts | 2 +- .../invalidate_pending_api_keys/task.ts | 20 ++-- .../invalidate_pending_api_keys/task_state.ts | 3 +- .../lib/alert_summary_from_event_log.test.ts | 5 +- .../lib/alert_summary_from_event_log.ts | 5 +- .../alerting_event_logger.test.ts | 12 +-- .../alerting_event_logger.ts | 16 ++- ...eate_alert_event_log_record_object.test.ts | 2 +- .../create_alert_event_log_record_object.ts | 6 +- .../create_get_alert_indices_alias.test.ts | 7 +- .../lib/create_get_alert_indices_alias.ts | 2 +- .../server/lib/determine_alerts_to_return.ts | 4 +- .../server/lib/errors/es_error_parser.ts | 2 +- .../alerting/server/lib/errors/index.ts | 2 +- .../alerting/server/lib/errors/rule_muted.ts | 4 +- .../server/lib/errors/rule_type_disabled.ts | 4 +- .../alerting/server/lib/errors/types.ts | 2 +- .../alerting/server/lib/flapping_utils.ts | 2 +- .../lib/format_execution_log_errors.test.ts | 2 +- .../server/lib/format_execution_log_errors.ts | 4 +- .../server/lib/get_actions_config_map.ts | 2 +- .../server/lib/get_alerts_for_notification.ts | 4 +- .../server/lib/get_es_query_config.ts | 2 +- .../server/lib/get_es_request_timeout.ts | 2 +- .../lib/get_execution_log_aggregation.test.ts | 4 +- .../lib/get_execution_log_aggregation.ts | 7 +- .../server/lib/get_rule_notify_when_type.ts | 2 +- .../server/lib/get_rule_task_timeout.test.ts | 2 +- .../server/lib/get_rule_task_timeout.ts | 2 +- .../alerting/server/lib/get_time_range.ts | 2 +- .../server/lib/is_rule_snoozed.test.ts | 2 +- .../alerting/server/lib/is_rule_snoozed.ts | 2 +- .../server/lib/last_run_status.test.ts | 5 +- .../alerting/server/lib/last_run_status.ts | 17 ++-- .../alerting/server/lib/license_api_access.ts | 2 +- .../alerting/server/lib/license_state.mock.ts | 2 +- .../alerting/server/lib/license_state.test.ts | 7 +- .../alerting/server/lib/license_state.ts | 8 +- .../alerting/server/lib/monitoring.test.ts | 2 +- .../plugins/alerting/server/lib/monitoring.ts | 6 +- .../server/lib/process_alerts.test.ts | 2 +- .../alerting/server/lib/process_alerts.ts | 6 +- .../alerting/server/lib/retry_if_conflicts.ts | 3 +- .../server/lib/rule_execution_status.test.ts | 3 +- .../server/lib/rule_execution_status.ts | 15 ++- .../server/lib/rule_run_metrics_store.ts | 4 +- .../alerting/server/lib/set_flapping.test.ts | 2 +- .../alerting/server/lib/set_flapping.ts | 6 +- .../lib/snooze/is_snooze_active.test.ts | 2 +- .../server/lib/snooze/is_snooze_active.ts | 2 +- .../lib/snooze/is_snooze_expired.test.ts | 2 +- .../server/lib/snooze/is_snooze_expired.ts | 2 +- .../lib/track_deprecated_route_usage.ts | 2 +- .../server/lib/track_legacy_route_usage.ts | 2 +- .../server/lib/trim_recovered_alerts.ts | 6 +- x-pack/plugins/alerting/server/lib/types.ts | 4 +- .../validate_authorize_system_actions.test.ts | 8 +- .../lib/validate_authorize_system_actions.ts | 8 +- .../lib/validate_mutated_rule_type_params.ts | 2 +- .../alerting/server/lib/validate_rrule_by.ts | 1 - .../server/lib/validate_rule_type_params.ts | 2 +- .../server/lib/validate_snooze_date.ts | 2 - .../server/lib/validate_snooze_schedule.ts | 2 +- .../lib/wrap_scoped_cluster_client.test.ts | 2 +- .../server/lib/wrap_scoped_cluster_client.ts | 4 +- .../lib/wrap_search_source_client.test.ts | 2 +- .../server/lib/wrap_search_source_client.ts | 8 +- .../server/maintenance_window_client.mock.ts | 2 +- .../maintenance_window_client.ts | 4 +- .../maintenance_window_client_factory.test.ts | 8 +- .../maintenance_window_client_factory.ts | 4 +- .../server/maintenance_window_feature.ts | 2 +- x-pack/plugins/alerting/server/mocks.ts | 8 +- .../server/monitoring/in_memory_metrics.ts | 2 +- .../register_cluster_collector.test.ts | 8 +- .../monitoring/register_cluster_collector.ts | 9 +- .../register_node_collector.test.ts | 4 +- .../monitoring/register_node_collector.ts | 4 +- .../monitoring/rule_monitoring_service.ts | 2 +- .../monitoring/rule_result_service.test.ts | 5 +- .../server/monitoring/rule_result_service.ts | 2 +- .../alerting/server/monitoring/types.ts | 2 +- x-pack/plugins/alerting/server/plugin.test.ts | 13 +-- x-pack/plugins/alerting/server/plugin.ts | 72 +++++++------- .../server/routes/_mock_handler_arguments.ts | 19 ++-- .../apis/delete/delete_backfill_route.ts | 13 ++- .../apis/find/find_backfill_route.test.ts | 2 +- .../backfill/apis/find/find_backfill_route.ts | 14 ++- .../find/transforms/transform_request/v1.ts | 4 +- .../find/transforms/transform_response/v1.ts | 2 +- .../apis/get/get_backfill_route.test.ts | 2 +- .../backfill/apis/get/get_backfill_route.ts | 11 ++- .../schedule/schedule_backfill_route.test.ts | 2 +- .../apis/schedule/schedule_backfill_route.ts | 11 ++- .../transforms/transform_request/v1.ts | 4 +- .../transforms/transform_response/v1.ts | 2 +- .../v1.test.ts | 2 +- .../v1.ts | 2 +- .../framework/apis/health/health.test.ts | 2 +- .../routes/framework/apis/health/health.ts | 13 +-- .../transform_health_response/v1.ts | 2 +- .../server/routes/get_action_error_log.ts | 12 ++- .../routes/get_flapping_settings.test.ts | 6 +- .../server/routes/get_flapping_settings.ts | 13 ++- .../server/routes/get_global_execution_kpi.ts | 12 ++- .../routes/get_global_execution_logs.test.ts | 2 +- .../routes/get_global_execution_logs.ts | 12 ++- .../routes/get_rule_alert_summary.test.ts | 2 +- .../server/routes/get_rule_alert_summary.ts | 16 ++- .../server/routes/get_rule_execution_kpi.ts | 12 ++- .../routes/get_rule_execution_log.test.ts | 2 +- .../server/routes/get_rule_execution_log.ts | 12 ++- .../alerting/server/routes/get_rule_state.ts | 14 ++- .../plugins/alerting/server/routes/index.ts | 12 +-- .../server/routes/legacy/create.test.ts | 2 +- .../alerting/server/routes/legacy/create.ts | 11 +-- .../alerting/server/routes/legacy/delete.ts | 4 +- .../alerting/server/routes/legacy/disable.ts | 4 +- .../alerting/server/routes/legacy/enable.ts | 4 +- .../alerting/server/routes/legacy/find.ts | 10 +- .../alerting/server/routes/legacy/get.test.ts | 2 +- .../alerting/server/routes/legacy/get.ts | 4 +- .../legacy/get_alert_instance_summary.test.ts | 2 +- .../legacy/get_alert_instance_summary.ts | 7 +- .../server/routes/legacy/get_alert_state.ts | 4 +- .../server/routes/legacy/health.test.ts | 2 +- .../alerting/server/routes/legacy/health.ts | 8 +- .../alerting/server/routes/legacy/index.ts | 2 +- .../routes/legacy/list_alert_types.test.ts | 2 +- .../server/routes/legacy/list_alert_types.ts | 4 +- .../alerting/server/routes/legacy/mute_all.ts | 4 +- .../server/routes/legacy/mute_instance.ts | 6 +- .../server/routes/legacy/unmute_all.ts | 4 +- .../server/routes/legacy/unmute_instance.ts | 4 +- .../server/routes/legacy/update.test.ts | 3 +- .../alerting/server/routes/legacy/update.ts | 11 +-- .../server/routes/legacy/update_api_key.ts | 4 +- .../lib/count_usage_of_predefined_ids.ts | 2 +- .../server/routes/lib/error_handler.ts | 2 +- .../server/routes/lib/rewrite_actions.ts | 6 +- .../routes/lib/rewrite_maintenance_window.ts | 4 +- .../server/routes/lib/rewrite_request_case.ts | 2 +- .../server/routes/lib/rewrite_rule.test.ts | 2 +- .../server/routes/lib/rewrite_rule.ts | 2 +- .../routes/lib/track_legacy_terminology.ts | 2 +- .../server/routes/lib/validate_hours.ts | 2 +- .../server/routes/lib/validate_timezone.ts | 2 +- .../routes/lib/verify_access_and_context.ts | 7 +- .../archive_maintenance_window_route.ts | 20 ++-- .../bulk_get_maintenance_windows_route.ts | 16 ++- .../transform_bulk_get_response/v1.ts | 4 +- .../create_maintenance_window_route.test.ts | 4 +- .../create/create_maintenance_window_route.ts | 16 ++- .../transforms/transform_create_body/v1.ts | 4 +- .../delete/delete_maintenance_window_route.ts | 16 ++- .../find/find_maintenance_windows_route.ts | 10 +- .../v1.ts | 4 +- .../finish/finish_maintenance_window_route.ts | 16 ++- .../apis/get/get_maintenance_window_route.ts | 16 ++- .../get_active_maintenance_windows_route.ts | 14 ++- .../transforms/transform_update_body/v1.ts | 4 +- .../update_maintenance_window_route.test.ts | 2 +- .../update/update_maintenance_window_route.ts | 20 ++-- .../v1.ts | 4 +- .../apis/aggregate/aggregate_rules_route.ts | 15 +-- .../index.ts | 4 +- .../transform_aggregate_body_response/v1.ts | 4 +- .../transform_aggregate_query_request/v1.ts | 4 +- .../bulk_delete_rules_route.test.ts | 2 +- .../bulk_delete/bulk_delete_rules_route.ts | 14 +-- .../bulk_disable_rules_route.test.ts | 2 +- .../bulk_disable/bulk_disable_rules_route.ts | 14 +-- .../bulk_edit/bulk_edit_rules_route.test.ts | 2 +- .../apis/bulk_edit/bulk_edit_rules_route.ts | 14 +-- .../transforms/transform_operations/v1.ts | 4 +- .../bulk_enable_rules_route.test.ts | 6 +- .../bulk_enable/bulk_enable_rules_route.ts | 14 +-- .../transform_bulk_enable_response/v1.test.ts | 2 +- .../transform_bulk_enable_response/v1.ts | 8 +- .../bulk_untrack/bulk_untrack_alerts_route.ts | 14 +-- .../bulk_untrack_alerts_by_query_route.ts | 14 +-- .../rule/apis/clone/clone_rule_route.test.ts | 2 +- .../rule/apis/clone/clone_rule_route.ts | 14 +-- .../apis/create/create_rule_route.test.ts | 2 +- .../rule/apis/create/create_rule_route.ts | 7 +- .../transform_create_body/v1.test.ts | 2 +- .../rule/apis/delete/delete_rule_route.ts | 13 ++- .../rule/apis/disable/disable_rule_route.ts | 12 ++- .../rule/apis/enable/enable_rule_route.ts | 14 +-- .../apis/find/find_internal_rules_route.ts | 14 ++- .../routes/rule/apis/find/find_rules_route.ts | 12 ++- .../transform_find_rules_body/v1.ts | 2 +- .../transform_find_rules_response/v1.ts | 2 +- .../rule/apis/get/get_rule_route.test.ts | 2 +- .../routes/rule/apis/get/get_rule_route.ts | 16 ++- .../get_schedule_frequency_route.ts | 9 +- .../rule/apis/list_types/rule_types.test.ts | 4 +- .../routes/rule/apis/list_types/rule_types.ts | 13 ++- .../transform_rule_types_response/v1.ts | 2 +- .../routes/rule/apis/mute_alert/mute_alert.ts | 14 +-- .../v1.ts | 4 +- .../rule/apis/mute_all/mute_all_rule.ts | 16 +-- .../apis/resolve/resolve_rule_route.test.ts | 4 +- .../rule/apis/resolve/resolve_rule_route.ts | 19 ++-- .../transform_resolve_response/v1.ts | 4 +- .../rule/apis/snooze/snooze_rule_route.ts | 10 +- .../transforms/transform_snooze_body/v1.ts | 4 +- .../routes/rule/apis/tags/get_rule_tags.ts | 13 ++- .../transform_rule_tags_body_response/v1.ts | 2 +- .../transform_rule_tags_query_request/v1.ts | 2 +- .../v1.ts | 6 +- .../apis/unmute_alert/unmute_alert_route.ts | 14 +-- .../rule/apis/unmute_all/unmute_all_rule.ts | 14 +-- .../rule/apis/unsnooze/unsnooze_rule_route.ts | 10 +- .../apis/update/update_rule_route.test.ts | 3 +- .../rule/apis/update/update_rule_route.ts | 13 ++- .../update_rule_api_key_route.ts | 14 +-- .../v1.test.ts | 2 +- .../transform_rule_to_rule_response/v1.ts | 4 +- .../apis/get/get_query_delay_settings.test.ts | 6 +- .../apis/get/get_query_delay_settings.ts | 9 +- .../update_query_delay_settings.test.ts | 6 +- .../update/update_query_delay_settings.ts | 11 ++- .../v1.ts | 4 +- .../alerting/server/routes/run_soon.ts | 7 +- .../server/routes/suggestions/fields_rules.ts | 8 +- .../values_suggestion_alerts.test.ts | 2 +- .../suggestions/values_suggestion_alerts.ts | 18 ++-- .../values_suggestion_rules.test.ts | 2 +- .../suggestions/values_suggestion_rules.ts | 18 ++-- .../routes/update_flapping_settings.test.ts | 6 +- .../server/routes/update_flapping_settings.ts | 17 ++-- .../server/rule_type_registry.mock.ts | 2 +- .../server/rule_type_registry.test.ts | 11 ++- .../alerting/server/rule_type_registry.ts | 26 +++-- .../alerting/server/rules_client.mock.ts | 2 +- .../common/api_key_as_alert_attributes.ts | 6 +- .../common/apply_bulk_edit_operation.test.ts | 2 +- .../rules_client/common/audit_events.ts | 6 +- .../common/build_kuery_node_filter.ts | 3 +- .../server/rules_client/common/constants.ts | 6 +- .../get_and_validate_common_bulk_options.ts | 2 +- .../rules_client/common/inject_references.ts | 6 +- .../common/mapped_params_utils.ts | 12 +-- .../retry_if_bulk_edit_conflicts.test.ts | 4 +- .../common/retry_if_bulk_edit_conflicts.ts | 14 ++- .../retry_if_bulk_operation_conflicts.test.ts | 2 +- .../retry_if_bulk_operation_conflicts.ts | 8 +- .../rules_client/common/snooze_utils.ts | 4 +- .../common/try_to_remove_tasks.ts | 4 +- .../common/validate_attributes.ts | 4 +- .../lib/add_generated_action_values.test.ts | 8 +- .../lib/add_generated_action_values.ts | 5 +- .../lib/check_authorization_and_get_total.ts | 11 ++- .../lib/create_new_api_key_set.test.ts | 8 +- .../lib/create_new_api_key_set.ts | 4 +- .../lib/create_rule_saved_object.ts | 8 +- .../rules_client/lib/denormalize_actions.ts | 4 +- .../rules_client/lib/extract_references.ts | 10 +- .../rules_client/lib/get_alert_from_raw.ts | 6 +- .../lib/get_authorization_filter.ts | 4 +- .../rules_client/lib/get_rule_saved_object.ts | 6 +- .../lib/increment_revision.test.ts | 6 +- .../rules_client/lib/increment_revision.ts | 4 +- .../lib/resolve_rule_saved_object.ts | 6 +- .../server/rules_client/lib/schedule_task.ts | 4 +- .../format_legacy_actions.test.ts | 9 +- .../format_legacy_actions.ts | 5 +- .../migrate_legacy_actions.test.ts | 6 +- .../migrate_legacy_actions.ts | 2 +- .../retrieve_migrated_legacy_actions.ts | 5 +- .../transform_legacy_actions.test.ts | 2 +- .../transform_legacy_actions.ts | 4 +- .../transform_to_notify_when.ts | 2 +- .../lib/siem_legacy_actions/types.ts | 2 +- .../rules_client/lib/untrack_rule_alerts.ts | 4 +- .../server/rules_client/lib/update_meta.ts | 4 +- .../lib/update_meta_attributes.ts | 4 +- .../rules_client/lib/validate_actions.test.ts | 10 +- .../rules_client/lib/validate_actions.ts | 9 +- .../methods/get_action_error_log.ts | 8 +- .../rules_client/methods/get_alert_state.ts | 4 +- .../rules_client/methods/get_alert_summary.ts | 6 +- .../rules_client/methods/get_execution_kpi.ts | 6 +- .../rules_client/methods/get_execution_log.ts | 8 +- .../server/rules_client/methods/run_soon.ts | 7 +- .../server/rules_client/rules_client.ts | 98 +++++++++---------- .../tests/get_action_error_log.test.ts | 13 +-- .../tests/get_alert_state.test.ts | 7 +- .../tests/get_alert_summary.test.ts | 13 +-- .../tests/get_execution_log.test.ts | 11 ++- .../alerting/server/rules_client/tests/lib.ts | 8 +- .../tests/list_rule_types.test.ts | 9 +- .../rules_client/tests/mute_all.test.ts | 7 +- .../rules_client/tests/mute_instance.test.ts | 7 +- .../server/rules_client/tests/resolve.test.ts | 7 +- .../rules_client/tests/run_soon.test.ts | 7 +- .../rules_client/tests/unmute_all.test.ts | 7 +- .../alerting/server/rules_client/types.ts | 34 +++---- .../rules_client_conflict_retries.test.ts | 7 +- .../server/rules_client_factory.test.ts | 11 ++- .../alerting/server/rules_client_factory.ts | 31 +++--- .../rules_settings_flapping_client.test.ts | 8 +- .../rules_settings_flapping_client.ts | 12 +-- .../rules_settings_query_delay_client.test.ts | 8 +- .../rules_settings_query_delay_client.ts | 16 ++- .../rules_settings_client.mock.ts | 5 +- .../rules_settings_client.test.ts | 6 +- .../rules_settings/rules_settings_client.ts | 2 +- .../rules_settings_client_factory.test.ts | 8 +- .../rules_settings_client_factory.ts | 4 +- .../rules_settings/rules_settings_feature.ts | 2 +- .../rules_settings_service.test.ts | 2 +- .../rules_settings/rules_settings_service.ts | 10 +- .../geo_containment/migrations.ts | 8 +- .../saved_objects/get_import_warnings.test.ts | 4 +- .../saved_objects/get_import_warnings.ts | 2 +- .../alerting/server/saved_objects/index.ts | 8 +- .../saved_objects/is_rule_exportable.test.ts | 10 +- .../saved_objects/is_rule_exportable.ts | 6 +- .../maintenance_window_mapping.ts | 2 +- .../saved_objects/migrations/7.10/index.ts | 6 +- .../saved_objects/migrations/7.11/index.ts | 8 +- .../saved_objects/migrations/7.13/index.ts | 8 +- .../saved_objects/migrations/7.14/index.ts | 6 +- .../saved_objects/migrations/7.15/index.ts | 8 +- .../saved_objects/migrations/7.16/index.ts | 8 +- .../saved_objects/migrations/8.0/index.ts | 6 +- .../saved_objects/migrations/8.2/index.ts | 6 +- .../saved_objects/migrations/8.3/index.ts | 6 +- .../saved_objects/migrations/8.4/index.ts | 6 +- .../saved_objects/migrations/8.5/index.ts | 8 +- .../saved_objects/migrations/8.6/index.ts | 7 +- .../saved_objects/migrations/8.7/index.ts | 7 +- .../saved_objects/migrations/8.8/index.ts | 6 +- .../saved_objects/migrations/index.test.ts | 7 +- .../server/saved_objects/migrations/index.ts | 15 +-- .../server/saved_objects/migrations/types.ts | 8 +- .../server/saved_objects/migrations/utils.ts | 6 +- .../ad_hoc_run_params_model_versions.ts | 2 +- ...key_pending_invalidation_model_versions.ts | 2 +- .../maintenance_window_model_versions.ts | 2 +- .../model_versions/rule_model_versions.ts | 2 +- .../rules_settings_model_versions.ts | 2 +- .../partially_update_rule.test.ts | 18 ++-- .../saved_objects/partially_update_rule.ts | 14 +-- .../saved_objects/rrule_mappings_field.ts | 2 +- .../saved_objects/rules_settings_mappings.ts | 2 +- .../saved_objects/schemas/raw_rule/latest.ts | 4 +- .../transform_rule_for_export.ts | 4 +- .../action_scheduler/action_scheduler.test.ts | 8 +- .../action_scheduler/action_scheduler.ts | 18 ++-- .../action_scheduler/lib/build_rule_url.ts | 7 +- .../lib/format_action_to_enqueue.ts | 2 +- .../lib/get_summarized_alerts.ts | 4 +- .../lib/rule_action_helper.test.ts | 4 +- .../lib/rule_action_helper.ts | 11 +-- .../lib/should_schedule_action.ts | 8 +- .../per_alert_action_scheduler.test.ts | 9 +- .../schedulers/per_alert_action_scheduler.ts | 19 ++-- .../summary_action_scheduler.test.ts | 4 +- .../schedulers/summary_action_scheduler.ts | 13 +-- .../system_action_scheduler.test.ts | 11 +-- .../schedulers/system_action_scheduler.ts | 12 +-- .../action_scheduler/test_fixtures.ts | 20 ++-- .../task_runner/action_scheduler/types.ts | 22 ++--- .../task_runner/ad_hoc_task_runner.test.ts | 25 ++--- .../server/task_runner/ad_hoc_task_runner.ts | 41 ++++---- .../ad_hoc_task_running_handler.test.ts | 2 +- .../ad_hoc_task_running_handler.ts | 4 +- .../task_runner/alert_task_instance.test.ts | 8 +- .../server/task_runner/alert_task_instance.ts | 4 +- .../alerting/server/task_runner/fixtures.ts | 11 +-- .../task_runner/get_executor_services.ts | 24 ++--- .../task_runner/inject_action_params.ts | 4 +- .../lib/clear_expired_snoozes.test.ts | 4 +- .../task_runner/lib/clear_expired_snoozes.ts | 4 +- .../lib/partially_update_ad_hoc_run.test.ts | 13 +-- .../lib/partially_update_ad_hoc_run.ts | 11 +-- .../task_runner/lib/process_run_result.ts | 22 +++-- .../lib/task_runner_logger.test.ts | 3 +- .../task_runner/lib/task_runner_logger.ts | 2 +- .../server/task_runner/log_alerts.test.ts | 2 +- .../alerting/server/task_runner/log_alerts.ts | 10 +- .../get_maintenance_windows.test.ts | 6 +- .../get_maintenance_windows.ts | 6 +- .../maintenance_windows_service.test.ts | 4 +- .../maintenance_windows_service.ts | 8 +- .../server/task_runner/rule_loader.test.ts | 6 +- .../server/task_runner/rule_loader.ts | 18 ++-- .../task_runner/rule_running_handler.test.ts | 2 +- .../task_runner/rule_running_handler.ts | 2 +- .../task_runner/rule_type_runner.test.ts | 19 ++-- .../server/task_runner/rule_type_runner.ts | 42 ++++---- .../server/task_runner/task_runner.test.ts | 28 +++--- .../server/task_runner/task_runner.ts | 28 +++--- .../task_runner_alerts_client.test.ts | 22 +++-- .../task_runner/task_runner_cancel.test.ts | 25 +++-- .../task_runner/task_runner_factory.test.ts | 11 ++- .../server/task_runner/task_runner_factory.ts | 10 +- .../task_runner/task_runner_timer.test.ts | 2 +- .../server/task_runner/task_runner_timer.ts | 2 +- .../transform_action_params.test.ts | 2 +- .../task_runner/transform_action_params.ts | 8 +- .../alerting/server/task_runner/types.ts | 48 ++++----- .../alerting/server/test_utils/index.ts | 4 +- x-pack/plugins/alerting/server/types.ts | 38 +++---- .../usage/alerting_usage_collector.test.ts | 7 +- .../server/usage/alerting_usage_collector.ts | 6 +- .../usage/lib/get_telemetry_from_alerts.ts | 4 +- .../usage/lib/get_telemetry_from_event_log.ts | 2 +- .../lib/get_telemetry_from_kibana.test.ts | 2 +- .../usage/lib/get_telemetry_from_kibana.ts | 12 +-- .../lib/get_telemetry_from_task_manager.ts | 2 +- .../lib/group_connectors_by_consumers.ts | 2 +- .../usage/lib/group_rules_by_notify_when.ts | 2 +- .../usage/lib/group_rules_by_search_type.ts | 2 +- .../server/usage/lib/group_rules_by_status.ts | 2 +- .../lib/parse_simple_rule_type_bucket.ts | 2 +- x-pack/plugins/alerting/server/usage/task.ts | 4 +- .../alerting/server/usage/task_state.ts | 3 +- .../server/__mocks__/mock_server.ts | 1 - .../server/__mocks__/test_adapters.ts | 4 +- .../server/graphs/ecs/chunk.ts | 1 - .../server/graphs/ecs/pipeline.ts | 2 +- .../server/graphs/ecs/validate.ts | 2 +- .../server/lib/errors/unsupported_error.ts | 1 - .../server/util/samples.ts | 2 +- 779 files changed, 2536 insertions(+), 2513 deletions(-) diff --git a/x-pack/plugins/alerting/common/alert_schema/field_maps/component_template_from_field_map.ts b/x-pack/plugins/alerting/common/alert_schema/field_maps/component_template_from_field_map.ts index 9d5c651e92cda..74257f2f286e6 100644 --- a/x-pack/plugins/alerting/common/alert_schema/field_maps/component_template_from_field_map.ts +++ b/x-pack/plugins/alerting/common/alert_schema/field_maps/component_template_from_field_map.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ClusterPutComponentTemplateRequest } from '@elastic/elasticsearch/lib/api/types'; +import type { ClusterPutComponentTemplateRequest } from '@elastic/elasticsearch/lib/api/types'; import { type FieldMap } from '@kbn/alerts-as-data-utils'; import { mappingFromFieldMap } from './mapping_from_field_map'; diff --git a/x-pack/plugins/alerting/common/bulk_edit.ts b/x-pack/plugins/alerting/common/bulk_edit.ts index 73773032f5280..fe0f73b00550d 100644 --- a/x-pack/plugins/alerting/common/bulk_edit.ts +++ b/x-pack/plugins/alerting/common/bulk_edit.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Rule } from './rule'; +import type { Rule } from './rule'; export type BulkEditSkipReason = 'RULE_NOT_MODIFIED'; diff --git a/x-pack/plugins/alerting/common/maintenance_window.ts b/x-pack/plugins/alerting/common/maintenance_window.ts index 70e02814bd4e1..de611b00d42cf 100644 --- a/x-pack/plugins/alerting/common/maintenance_window.ts +++ b/x-pack/plugins/alerting/common/maintenance_window.ts @@ -5,8 +5,8 @@ * 2.0. */ import type { IUiSettingsClient, Logger, SavedObjectsClientContract } from '@kbn/core/server'; -import { FilterStateStore } from '@kbn/es-query'; -import { RRuleParams } from './rrule_type'; +import type { FilterStateStore } from '@kbn/es-query'; +import type { RRuleParams } from './rrule_type'; export enum MaintenanceWindowStatus { Running = 'running', diff --git a/x-pack/plugins/alerting/common/parse_duration.ts b/x-pack/plugins/alerting/common/parse_duration.ts index afbbf8609e6e3..82e4aeb2feb39 100644 --- a/x-pack/plugins/alerting/common/parse_duration.ts +++ b/x-pack/plugins/alerting/common/parse_duration.ts @@ -80,7 +80,7 @@ export function validateDurationSchema(duration: string) { if (duration.match(DAYS_REGEX)) { return; } - return 'string is not a valid duration: ' + duration; + return `string is not a valid duration: ${duration}`; } function isSeconds(duration: string) { diff --git a/x-pack/plugins/alerting/common/routes/backfill/apis/delete/types/v1.ts b/x-pack/plugins/alerting/common/routes/backfill/apis/delete/types/v1.ts index 3dfb1c8e78c0e..9a4aeac74cb37 100644 --- a/x-pack/plugins/alerting/common/routes/backfill/apis/delete/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/backfill/apis/delete/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { deleteParamsSchemaV1 } from '..'; +import type { deleteParamsSchemaV1 } from '..'; export type DeleteBackfillRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/backfill/apis/find/types/v1.ts b/x-pack/plugins/alerting/common/routes/backfill/apis/find/types/v1.ts index 90f3ccf8592c6..d6c8029338ad9 100644 --- a/x-pack/plugins/alerting/common/routes/backfill/apis/find/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/backfill/apis/find/types/v1.ts @@ -6,7 +6,7 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { findQuerySchemaV1, findResponseSchemaV1 } from '..'; +import type { findQuerySchemaV1, findResponseSchemaV1 } from '..'; export type FindBackfillRequestQuery = TypeOf; export type FindBackfillResponseBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/backfill/apis/get/types/v1.ts b/x-pack/plugins/alerting/common/routes/backfill/apis/get/types/v1.ts index 199bac2fe8435..f304ae615d93e 100644 --- a/x-pack/plugins/alerting/common/routes/backfill/apis/get/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/backfill/apis/get/types/v1.ts @@ -6,7 +6,7 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { getParamsSchemaV1, getResponseSchemaV1 } from '..'; +import type { getParamsSchemaV1, getResponseSchemaV1 } from '..'; export type GetBackfillRequestParams = TypeOf; export type GetBackfillResponseBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/backfill/apis/schedule/types/v1.ts b/x-pack/plugins/alerting/common/routes/backfill/apis/schedule/types/v1.ts index 3fe5c2989f648..3ae009bb25b30 100644 --- a/x-pack/plugins/alerting/common/routes/backfill/apis/schedule/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/backfill/apis/schedule/types/v1.ts @@ -6,7 +6,7 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { scheduleBodySchemaV1, scheduleResponseSchemaV1 } from '..'; +import type { scheduleBodySchemaV1, scheduleResponseSchemaV1 } from '..'; export type ScheduleBackfillRequestBody = TypeOf; export type ScheduleBackfillResponseBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/backfill/response/types/v1.ts b/x-pack/plugins/alerting/common/routes/backfill/response/types/v1.ts index ff0d94f164f7e..4252eb08c03c7 100644 --- a/x-pack/plugins/alerting/common/routes/backfill/response/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/backfill/response/types/v1.ts @@ -6,7 +6,7 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { backfillResponseSchemaV1, errorResponseSchemaV1 } from '..'; +import type { backfillResponseSchemaV1, errorResponseSchemaV1 } from '..'; export type BackfillResponse = TypeOf; export type ErrorResponse = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/framework/apis/health/types/v1.ts b/x-pack/plugins/alerting/common/routes/framework/apis/health/types/v1.ts index 188e3d0816a54..5dcc542dada84 100644 --- a/x-pack/plugins/alerting/common/routes/framework/apis/health/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/framework/apis/health/types/v1.ts @@ -7,7 +7,7 @@ import type { TypeOf } from '@kbn/config-schema'; -import { healthFrameworkResponseBodySchemaV1, healthFrameworkResponseSchemaV1 } from '..'; +import type { healthFrameworkResponseBodySchemaV1, healthFrameworkResponseSchemaV1 } from '..'; export type HealthFrameworkResponseBody = TypeOf; export type HealthFrameworkResponse = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/archive/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/archive/types/v1.ts index 37ce349e23a1e..9417b74cea703 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/archive/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/archive/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { MaintenanceWindowResponseV1 } from '../../../response'; -import { archiveBodySchemaV1, archiveParamsSchemaV1 } from '..'; +import type { MaintenanceWindowResponseV1 } from '../../../response'; +import type { archiveBodySchemaV1, archiveParamsSchemaV1 } from '..'; export type ArchiveMaintenanceWindowRequestBody = TypeOf; export type ArchiveMaintenanceWindowRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/bulk_get/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/bulk_get/types/v1.ts index 153df0010293a..1a7e9c49f4802 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/bulk_get/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/bulk_get/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { MaintenanceWindowResponseV1 } from '../../../response'; -import { bulkGetBodySchemaV1 } from '..'; +import type { MaintenanceWindowResponseV1 } from '../../../response'; +import type { bulkGetBodySchemaV1 } from '..'; export type BulkGetMaintenanceWindowsRequestBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/create/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/create/types/v1.ts index 269206c977687..5812a3b1b0215 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/create/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/create/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { MaintenanceWindowResponseV1 } from '../../../response'; -import { createBodySchemaV1 } from '..'; +import type { MaintenanceWindowResponseV1 } from '../../../response'; +import type { createBodySchemaV1 } from '..'; export type CreateMaintenanceWindowRequestBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/delete/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/delete/types/v1.ts index 64c02f23b703c..5538a81a86528 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/delete/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/delete/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { deleteParamsSchemaV1 } from '..'; +import type { deleteParamsSchemaV1 } from '..'; export type DeleteMaintenanceWindowRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/find/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/find/types/v1.ts index 0176d2e6689f8..b4f09df18ba4a 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/find/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/find/types/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { +import type { TypeOf } from '@kbn/config-schema'; +import type { findMaintenanceWindowsResponseBodySchema, findMaintenanceWindowsRequestQuerySchema, } from '..'; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/finish/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/finish/types/v1.ts index aff9df5ba9c45..117d759d4210b 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/finish/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/finish/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { MaintenanceWindowResponseV1 } from '../../../response'; -import { finishParamsSchemaV1 } from '..'; +import type { MaintenanceWindowResponseV1 } from '../../../response'; +import type { finishParamsSchemaV1 } from '..'; export type FinishMaintenanceWindowRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/get/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/get/types/v1.ts index c264150229540..a51fa7bdf330d 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/get/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/get/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { MaintenanceWindowResponseV1 } from '../../../response'; -import { getParamsSchemaV1 } from '..'; +import type { MaintenanceWindowResponseV1 } from '../../../response'; +import type { getParamsSchemaV1 } from '..'; export type GetMaintenanceWindowRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/get_active/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/get_active/types/v1.ts index 3e6ed18dc18c2..87f5355c083f4 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/get_active/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/get_active/types/v1.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { MaintenanceWindowResponseV1 } from '../../../response'; +import type { MaintenanceWindowResponseV1 } from '../../../response'; export interface GetActiveMaintenanceWindowsResponse { body: MaintenanceWindowResponseV1[]; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/update/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/update/types/v1.ts index d56107619687a..7410a9e299345 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/apis/update/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/apis/update/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { MaintenanceWindowResponseV1 } from '../../../response'; -import { updateParamsSchemaV1, updateBodySchemaV1 } from '..'; +import type { MaintenanceWindowResponseV1 } from '../../../response'; +import type { updateParamsSchemaV1, updateBodySchemaV1 } from '..'; export type UpdateMaintenanceWindowRequestParams = TypeOf; export type UpdateMaintenanceWindowRequestBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/response/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/response/types/v1.ts index 91fdcbc16674b..83fe9fd0b688b 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/response/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/response/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { maintenanceWindowResponseSchemaV1 } from '..'; +import type { maintenanceWindowResponseSchemaV1 } from '..'; export type MaintenanceWindowResponse = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/maintenance_window/shared/types/v1.ts b/x-pack/plugins/alerting/common/routes/maintenance_window/shared/types/v1.ts index 19c5ae2a133ba..fbda0b6ed998c 100644 --- a/x-pack/plugins/alerting/common/routes/maintenance_window/shared/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/maintenance_window/shared/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { maintenanceWindowCategoryIdsSchemaV1 } from '..'; +import type { maintenanceWindowCategoryIdsSchemaV1 } from '..'; export type MaintenanceWindowCategoryIds = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/r_rule/request/types/v1.ts b/x-pack/plugins/alerting/common/routes/r_rule/request/types/v1.ts index 8a5605b6f9152..796f4247b7cfb 100644 --- a/x-pack/plugins/alerting/common/routes/r_rule/request/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/r_rule/request/types/v1.ts @@ -5,6 +5,6 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { rRuleRequestSchemaV1 } from '../..'; +import type { rRuleRequestSchemaV1 } from '../..'; export type RRuleRequest = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/r_rule/response/types/v1.ts b/x-pack/plugins/alerting/common/routes/r_rule/response/types/v1.ts index 1a35454a87655..c454673770e86 100644 --- a/x-pack/plugins/alerting/common/routes/r_rule/response/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/r_rule/response/types/v1.ts @@ -5,6 +5,6 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { rRuleResponseSchemaV1 } from '../..'; +import type { rRuleResponseSchemaV1 } from '../..'; export type RRuleResponse = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/r_rule/validation/validate_end_date/v1.ts b/x-pack/plugins/alerting/common/routes/r_rule/validation/validate_end_date/v1.ts index 895c1aeea4dfb..7c5ee6d187264 100644 --- a/x-pack/plugins/alerting/common/routes/r_rule/validation/validate_end_date/v1.ts +++ b/x-pack/plugins/alerting/common/routes/r_rule/validation/validate_end_date/v1.ts @@ -9,5 +9,4 @@ export const validateEndDate = (date: string) => { const parsedValue = Date.parse(date); if (isNaN(parsedValue)) return `Invalid date: ${date}`; if (parsedValue <= Date.now()) return `Invalid snooze date as it is in the past: ${date}`; - return; }; diff --git a/x-pack/plugins/alerting/common/routes/r_rule/validation/validate_start_date/v1.ts b/x-pack/plugins/alerting/common/routes/r_rule/validation/validate_start_date/v1.ts index 3cbc0da0af1b5..a40153e0ea324 100644 --- a/x-pack/plugins/alerting/common/routes/r_rule/validation/validate_start_date/v1.ts +++ b/x-pack/plugins/alerting/common/routes/r_rule/validation/validate_start_date/v1.ts @@ -8,5 +8,4 @@ export const validateStartDate = (date: string) => { const parsedValue = Date.parse(date); if (isNaN(parsedValue)) return `Invalid date: ${date}`; - return; }; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/aggregate/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/aggregate/types/v1.ts index 2dc21a72b3783..31dd5dc287230 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/aggregate/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/aggregate/types/v1.ts @@ -6,7 +6,7 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { aggregateRulesRequestBodySchemaV1, aggregateRulesResponseBodySchemaV1 } from '..'; +import type { aggregateRulesRequestBodySchemaV1, aggregateRulesResponseBodySchemaV1 } from '..'; export type AggregateRulesRequestBody = TypeOf; export type AggregateRulesResponseBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_delete/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_delete/types/v1.ts index 3b7f062b836af..90993fa6240af 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_delete/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_delete/types/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { bulkDeleteRulesRequestBodySchemaV1 } from '..'; -import { RuleParamsV1, RuleResponseV1 } from '../../../response'; +import type { bulkDeleteRulesRequestBodySchemaV1 } from '..'; +import type { RuleParamsV1, RuleResponseV1 } from '../../../response'; export interface BulkOperationError { message: string; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_delete/validation/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_delete/validation/v1.ts index 86972849da204..2090d936fa447 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_delete/validation/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_delete/validation/v1.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { BulkDeleteRulesRequestBody } from '..'; +import type { BulkDeleteRulesRequestBody } from '..'; export const validateBulkDeleteRulesBody = (options: BulkDeleteRulesRequestBody) => { const filter = options.filter; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_disable/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_disable/types/v1.ts index ed537d6dbb653..4ba4b37bd07e8 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_disable/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_disable/types/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { bulkDisableRulesRequestBodySchemaV1 } from '..'; -import { RuleParamsV1, RuleResponseV1 } from '../../../response'; +import type { bulkDisableRulesRequestBodySchemaV1 } from '..'; +import type { RuleParamsV1, RuleResponseV1 } from '../../../response'; export interface BulkOperationError { message: string; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_disable/validation/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_disable/validation/v1.ts index 560e61017cd57..b08810be43597 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_disable/validation/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_disable/validation/v1.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { BulkDisableRulesRequestBody } from '..'; +import type { BulkDisableRulesRequestBody } from '..'; export const validateBulkDisableRulesBody = (options: BulkDisableRulesRequestBody) => { const filter = options.filter; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_edit/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_edit/types/v1.ts index 3070f09964c3c..a9515e2546e72 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_edit/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_edit/types/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { RuleParamsV1, RuleResponseV1 } from '../../../response'; -import { bulkEditRulesRequestBodySchemaV1 } from '..'; +import type { RuleParamsV1, RuleResponseV1 } from '../../../response'; +import type { bulkEditRulesRequestBodySchemaV1 } from '..'; export type BulkEditRulesRequestBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_enable/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_enable/types/v1.ts index 49a78d2f82615..35a540c5563de 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_enable/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_enable/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { RuleParamsV1, RuleResponseV1 } from '../../../response'; -import { bulkEnableBodySchemaV1 } from '..'; +import type { RuleParamsV1, RuleResponseV1 } from '../../../response'; +import type { bulkEnableBodySchemaV1 } from '..'; export type BulkEnableRulesRequestBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack/types/v1.ts index 011499122e90a..50f252027d971 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack/types/v1.ts @@ -5,6 +5,6 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { bulkUntrackBodySchemaV1 } from '..'; +import type { bulkUntrackBodySchemaV1 } from '..'; export type BulkUntrackRequestBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack_by_query/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack_by_query/types/v1.ts index 8e6e7b329c112..b4f71dfe4f69f 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack_by_query/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack_by_query/types/v1.ts @@ -5,6 +5,6 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { bulkUntrackByQueryBodySchemaV1 } from '..'; +import type { bulkUntrackByQueryBodySchemaV1 } from '..'; export type BulkUntrackByQueryRequestBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/clone/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/clone/types/v1.ts index 7c2baf997f16c..adcf11dd3b39d 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/clone/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/clone/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { RuleParamsV1, RuleResponseV1 } from '../../../response'; -import { cloneRuleRequestParamsSchemaV1 } from '..'; +import type { RuleParamsV1, RuleResponseV1 } from '../../../response'; +import type { cloneRuleRequestParamsSchemaV1 } from '..'; export type CloneRuleRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/create/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/create/types/v1.ts index 9524c05424724..7256a00f45d40 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/create/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/create/types/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { RuleParamsV1, RuleResponseV1 } from '../../../response'; -import { +import type { RuleParamsV1, RuleResponseV1 } from '../../../response'; +import type { actionSchemaV1, actionFrequencySchemaV1, createParamsSchemaV1, diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/delete/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/delete/types/v1.ts index 8e019949e8139..106fac3cf8cc7 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/delete/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/delete/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { deleteRuleRequestParamsSchemaV1 } from '..'; +import type { deleteRuleRequestParamsSchemaV1 } from '..'; export type DeleteRuleRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/disable/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/disable/types/v1.ts index fdbe84a020606..ae9d12a994601 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/disable/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/disable/types/v1.ts @@ -5,7 +5,7 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { disableRuleRequestBodySchemaV1, disableRuleRequestParamsSchemaV1 } from '..'; +import type { disableRuleRequestBodySchemaV1, disableRuleRequestParamsSchemaV1 } from '..'; export type DisableRuleRequestBody = TypeOf; export type DisableRuleRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/enable/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/enable/types/v1.ts index c9be3f3c78db7..424cb9ee50448 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/enable/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/enable/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { enableRuleRequestParamsSchemaV1 } from '..'; +import type { enableRuleRequestParamsSchemaV1 } from '..'; export type EnableRuleRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/find/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/find/types/v1.ts index 271e791282f43..6ca5d375ae37e 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/find/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/find/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { RuleParamsV1, RuleResponseV1 } from '../../../response'; -import { findRulesRequestQuerySchemaV1 } from '..'; +import type { RuleParamsV1, RuleResponseV1 } from '../../../response'; +import type { findRulesRequestQuerySchemaV1 } from '..'; export type FindRulesRequestQuery = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/get/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/get/types/v1.ts index 84370ebd28240..18f75a126c343 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/get/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/get/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { RuleParamsV1, RuleResponseV1 } from '../../../response'; -import { getRuleRequestParamsSchemaV1 } from '..'; +import type { RuleParamsV1, RuleResponseV1 } from '../../../response'; +import type { getRuleRequestParamsSchemaV1 } from '..'; export type GetRuleRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/get_schedule_frequency/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/get_schedule_frequency/types/v1.ts index 2d117b03c49b9..72ffc70a8af09 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/get_schedule_frequency/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/get_schedule_frequency/types/v1.ts @@ -6,7 +6,10 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { getScheduleFrequencyResponseSchemaV1, getScheduleFrequencyResponseBodySchemaV1 } from '..'; +import type { + getScheduleFrequencyResponseSchemaV1, + getScheduleFrequencyResponseBodySchemaV1, +} from '..'; export type GetScheduleFrequencyResponseBody = TypeOf< typeof getScheduleFrequencyResponseBodySchemaV1 diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/list_types/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/list_types/types/v1.ts index 380b48c1c6615..3239b8a72ba89 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/list_types/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/list_types/types/v1.ts @@ -7,7 +7,7 @@ import type { TypeOf } from '@kbn/config-schema'; -import { typesRulesResponseSchemaV1, typesRulesResponseBodySchemaV1 } from '..'; +import type { typesRulesResponseSchemaV1, typesRulesResponseBodySchemaV1 } from '..'; export type TypesRulesResponse = TypeOf; export type TypesRulesResponseBody = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/mute_alert/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/mute_alert/types/v1.ts index af3832641d530..d25a324722ee7 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/mute_alert/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/mute_alert/types/v1.ts @@ -5,6 +5,6 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { muteAlertParamsSchemaV1 } from '..'; +import type { muteAlertParamsSchemaV1 } from '..'; export type MuteAlertRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/mute_all/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/mute_all/types/v1.ts index c18aa22dadd13..8808bd2175e98 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/mute_all/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/mute_all/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { muteAllRuleRequestParamsSchemaV1 } from '..'; +import type { muteAllRuleRequestParamsSchemaV1 } from '..'; export type MuteAllRuleRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/resolve/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/resolve/types/v1.ts index eb86327c07712..2f821c1c2f7cc 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/resolve/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/resolve/types/v1.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { RuleParamsV1, RuleResponseV1 } from '../../../response'; +import type { RuleParamsV1, RuleResponseV1 } from '../../../response'; export interface ResolveRuleResponse { body: RuleResponseV1; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/tags/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/tags/types/v1.ts index bcd7680a17c97..f18ca216f0289 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/tags/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/tags/types/v1.ts @@ -4,8 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { ruleTagsRequestQuerySchema, ruleTagsFormattedResponseSchema } from '..'; +import type { TypeOf } from '@kbn/config-schema'; +import type { ruleTagsRequestQuerySchema, ruleTagsFormattedResponseSchema } from '..'; export type RuleTagsRequestQuery = TypeOf; export type RuleTagsFormattedResponse = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/unmute_alert/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/unmute_alert/types/v1.ts index 0de4e0e767ceb..a09b9cfc964be 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/unmute_alert/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/unmute_alert/types/v1.ts @@ -5,6 +5,6 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { unmuteAlertParamsSchemaV1 } from '..'; +import type { unmuteAlertParamsSchemaV1 } from '..'; export type UnmuteAlertRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/unmute_all/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/unmute_all/types/v1.ts index 25638574f3972..ff40dcdd618eb 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/unmute_all/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/unmute_all/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { unmuteAllRuleRequestParamsSchemaV1 } from '..'; +import type { unmuteAllRuleRequestParamsSchemaV1 } from '..'; export type UnmuteAllRuleRequestParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/update/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/update/types/v1.ts index 74ad18cac8e87..a06c726628796 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/update/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/update/types/v1.ts @@ -6,9 +6,9 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { RuleParamsV1, RuleResponseV1 } from '../../../response'; +import type { RuleParamsV1, RuleResponseV1 } from '../../../response'; -import { +import type { actionSchemaV1, actionFrequencySchemaV1, updateParamsSchemaV1, diff --git a/x-pack/plugins/alerting/common/routes/rule/apis/update_api_key/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/apis/update_api_key/types/v1.ts index 8966e2875eb5a..58ccea3b3b6fa 100644 --- a/x-pack/plugins/alerting/common/routes/rule/apis/update_api_key/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/apis/update_api_key/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { updateApiKeyParamsSchemaV1 } from '..'; +import type { updateApiKeyParamsSchemaV1 } from '..'; export type UpdateApiKeyParams = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/common/flapping/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/common/flapping/types/v1.ts index 66e338e16ea4c..62b85e897608f 100644 --- a/x-pack/plugins/alerting/common/routes/rule/common/flapping/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/common/flapping/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { flappingSchemaV1 } from '../..'; +import type { flappingSchemaV1 } from '../..'; export type Flapping = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/response/types/v1.ts b/x-pack/plugins/alerting/common/routes/rule/response/types/v1.ts index e32a56a302e63..8b305195610b6 100644 --- a/x-pack/plugins/alerting/common/routes/rule/response/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/response/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { RuleParamsV1 } from '@kbn/response-ops-rule-params'; -import { +import type { RuleParamsV1 } from '@kbn/response-ops-rule-params'; +import type { ruleResponseSchemaV1, ruleSnoozeScheduleSchemaV1, ruleLastRunSchemaV1, diff --git a/x-pack/plugins/alerting/common/routes/rule/validation/validate_duration/v1.ts b/x-pack/plugins/alerting/common/routes/rule/validation/validate_duration/v1.ts index d07d710687cc0..6e2b1b7db64bc 100644 --- a/x-pack/plugins/alerting/common/routes/rule/validation/validate_duration/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/validation/validate_duration/v1.ts @@ -23,5 +23,5 @@ export function validateDuration(duration: string) { if (duration.match(DAYS_REGEX)) { return; } - return 'string is not a valid duration: ' + duration; + return `string is not a valid duration: ${duration}`; } diff --git a/x-pack/plugins/alerting/common/routes/rule/validation/validate_hours/v1.ts b/x-pack/plugins/alerting/common/routes/rule/validation/validate_hours/v1.ts index 5c4fcd264ca04..aeed75d7584d2 100644 --- a/x-pack/plugins/alerting/common/routes/rule/validation/validate_hours/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/validation/validate_hours/v1.ts @@ -9,5 +9,5 @@ export function validateHours(time: string) { if (/^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/.test(time)) { return; } - return 'string is not a valid time in HH:mm format ' + time; + return `string is not a valid time in HH:mm format ${time}`; } diff --git a/x-pack/plugins/alerting/common/routes/rule/validation/validate_notify_when/v1.ts b/x-pack/plugins/alerting/common/routes/rule/validation/validate_notify_when/v1.ts index 38ccd877c49ae..3ed0ebac29ca1 100644 --- a/x-pack/plugins/alerting/common/routes/rule/validation/validate_notify_when/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/validation/validate_notify_when/v1.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { ruleNotifyWhenV1, RuleNotifyWhenV1 } from '../../common'; +import type { RuleNotifyWhenV1 } from '../../common'; +import { ruleNotifyWhenV1 } from '../../common'; export function validateNotifyWhen(notifyWhen: string) { if (Object.values(ruleNotifyWhenV1).includes(notifyWhen as RuleNotifyWhenV1)) { diff --git a/x-pack/plugins/alerting/common/routes/rule/validation/validate_snooze_schedule/v1.ts b/x-pack/plugins/alerting/common/routes/rule/validation/validate_snooze_schedule/v1.ts index 4a93f130e8248..246cd875e8dbc 100644 --- a/x-pack/plugins/alerting/common/routes/rule/validation/validate_snooze_schedule/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/validation/validate_snooze_schedule/v1.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; +import type { TypeOf } from '@kbn/config-schema'; import { Frequency } from '@kbn/rrule'; import moment from 'moment'; -import { rRuleRequestSchema } from '../../../r_rule'; +import type { rRuleRequestSchema } from '../../../r_rule'; export const validateSnoozeSchedule = (schedule: { rRule: TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rule/validation/validate_timezone/v1.ts b/x-pack/plugins/alerting/common/routes/rule/validation/validate_timezone/v1.ts index 68b095f4378d0..7e58d32846295 100644 --- a/x-pack/plugins/alerting/common/routes/rule/validation/validate_timezone/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rule/validation/validate_timezone/v1.ts @@ -11,5 +11,5 @@ export function validateTimezone(timezone: string) { if (moment.tz.names().includes(timezone)) { return; } - return 'string is not a valid timezone: ' + timezone; + return `string is not a valid timezone: ${timezone}`; } diff --git a/x-pack/plugins/alerting/common/routes/rules_settings/apis/get/types/v1.ts b/x-pack/plugins/alerting/common/routes/rules_settings/apis/get/types/v1.ts index 040f3c4813478..03230c4d4c8b7 100644 --- a/x-pack/plugins/alerting/common/routes/rules_settings/apis/get/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rules_settings/apis/get/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { queryDelaySettingsResponseSchemaV1 } from '../../../response'; +import type { queryDelaySettingsResponseSchemaV1 } from '../../../response'; export type GetQueryDelaySettingsResponse = TypeOf; diff --git a/x-pack/plugins/alerting/common/routes/rules_settings/apis/update/types/v1.ts b/x-pack/plugins/alerting/common/routes/rules_settings/apis/update/types/v1.ts index 0b421e73150f5..5c97eac41f6d0 100644 --- a/x-pack/plugins/alerting/common/routes/rules_settings/apis/update/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rules_settings/apis/update/types/v1.ts @@ -6,8 +6,8 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { queryDelaySettingsResponseSchemaV1 } from '../../../response'; -import { updateQueryDelaySettingsBodySchemaV1 } from '..'; +import type { queryDelaySettingsResponseSchemaV1 } from '../../../response'; +import type { updateQueryDelaySettingsBodySchemaV1 } from '..'; export type UpdateQueryDelaySettingsRequestBody = TypeOf< typeof updateQueryDelaySettingsBodySchemaV1 diff --git a/x-pack/plugins/alerting/common/routes/rules_settings/response/types/v1.ts b/x-pack/plugins/alerting/common/routes/rules_settings/response/types/v1.ts index b5671b2d54628..7051f322b5b77 100644 --- a/x-pack/plugins/alerting/common/routes/rules_settings/response/types/v1.ts +++ b/x-pack/plugins/alerting/common/routes/rules_settings/response/types/v1.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { queryDelaySettingsResponseSchemaV1 } from '..'; +import type { queryDelaySettingsResponseSchemaV1 } from '..'; export type QueryDelaySettingsResponse = TypeOf; diff --git a/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.mock.ts b/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.mock.ts index c7d6131f92d52..6f345ba71aaa4 100644 --- a/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.mock.ts +++ b/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.mock.ts @@ -6,7 +6,7 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { AlertNavigationRegistry } from './alert_navigation_registry'; +import type { AlertNavigationRegistry } from './alert_navigation_registry'; type Schema = PublicMethodsOf; diff --git a/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.test.ts b/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.test.ts index c95278fd477a4..63f2ea7f02013 100644 --- a/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.test.ts +++ b/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.test.ts @@ -6,7 +6,8 @@ */ import { AlertNavigationRegistry } from './alert_navigation_registry'; -import { RuleType, RecoveredActionGroup, SanitizedRule } from '../../common'; +import type { RuleType, SanitizedRule } from '../../common'; +import { RecoveredActionGroup } from '../../common'; import { v4 as uuidv4 } from 'uuid'; beforeEach(() => jest.resetAllMocks()); diff --git a/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.ts b/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.ts index 4bc65c6baf4ef..18afe145bb5d4 100644 --- a/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.ts +++ b/x-pack/plugins/alerting/public/alert_navigation_registry/alert_navigation_registry.ts @@ -6,8 +6,8 @@ */ import { i18n } from '@kbn/i18n'; -import { RuleType } from '../../common'; -import { AlertNavigationHandler } from './types'; +import type { RuleType } from '../../common'; +import type { AlertNavigationHandler } from './types'; const DEFAULT_HANDLER = Symbol('*'); export class AlertNavigationRegistry { diff --git a/x-pack/plugins/alerting/public/alert_navigation_registry/types.ts b/x-pack/plugins/alerting/public/alert_navigation_registry/types.ts index 136c44b2cd513..9ea8a05480aca 100644 --- a/x-pack/plugins/alerting/public/alert_navigation_registry/types.ts +++ b/x-pack/plugins/alerting/public/alert_navigation_registry/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SanitizedRule } from '../../common'; +import type { SanitizedRule } from '../../common'; /** * Returns information that can be used to navigate to a specific page to view the given rule. diff --git a/x-pack/plugins/alerting/public/application/maintenance_windows.tsx b/x-pack/plugins/alerting/public/application/maintenance_windows.tsx index 5f4b81bb716f7..dcac97618aa0e 100644 --- a/x-pack/plugins/alerting/public/application/maintenance_windows.tsx +++ b/x-pack/plugins/alerting/public/application/maintenance_windows.tsx @@ -9,16 +9,16 @@ import React, { Suspense } from 'react'; import ReactDOM from 'react-dom'; import { EuiLoadingSpinner } from '@elastic/eui'; -import { CoreStart } from '@kbn/core/public'; +import type { CoreStart } from '@kbn/core/public'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { Storage } from '@kbn/kibana-utils-plugin/public'; -import { ManagementAppMountParams } from '@kbn/management-plugin/public'; +import type { ManagementAppMountParams } from '@kbn/management-plugin/public'; import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; import { Route, Router, Routes } from '@kbn/shared-ux-router'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { MAINTENANCE_WINDOW_PATHS } from '../../common'; import { useLicense } from '../hooks/use_license'; -import { AlertingPluginStart } from '../plugin'; +import type { AlertingPluginStart } from '../plugin'; const MaintenanceWindowsLazy: React.FC = React.lazy(() => import('../pages/maintenance_windows')); const MaintenanceWindowsCreateLazy: React.FC = React.lazy( diff --git a/x-pack/plugins/alerting/public/hooks/use_archive_maintenance_window.test.tsx b/x-pack/plugins/alerting/public/hooks/use_archive_maintenance_window.test.tsx index e6f58df8d3a7f..fae82d189ea68 100644 --- a/x-pack/plugins/alerting/public/hooks/use_archive_maintenance_window.test.tsx +++ b/x-pack/plugins/alerting/public/hooks/use_archive_maintenance_window.test.tsx @@ -7,7 +7,8 @@ import { act, renderHook } from '@testing-library/react-hooks/dom'; import { waitFor } from '@testing-library/react'; -import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils'; +import type { AppMockRenderer } from '../lib/test_utils'; +import { createAppMockRenderer } from '../lib/test_utils'; import { useArchiveMaintenanceWindow } from './use_archive_maintenance_window'; const mockAddDanger = jest.fn(); diff --git a/x-pack/plugins/alerting/public/hooks/use_breadcrumbs.test.tsx b/x-pack/plugins/alerting/public/hooks/use_breadcrumbs.test.tsx index 9eb5970e86a9f..96a75c29063a3 100644 --- a/x-pack/plugins/alerting/public/hooks/use_breadcrumbs.test.tsx +++ b/x-pack/plugins/alerting/public/hooks/use_breadcrumbs.test.tsx @@ -8,7 +8,8 @@ import { renderHook } from '@testing-library/react-hooks'; import { useBreadcrumbs } from './use_breadcrumbs'; import { MAINTENANCE_WINDOW_DEEP_LINK_IDS } from '../../common'; -import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils'; +import type { AppMockRenderer } from '../lib/test_utils'; +import { createAppMockRenderer } from '../lib/test_utils'; const mockSetBreadcrumbs = jest.fn(); const mockSetTitle = jest.fn(); diff --git a/x-pack/plugins/alerting/public/hooks/use_breadcrumbs.ts b/x-pack/plugins/alerting/public/hooks/use_breadcrumbs.ts index 45d849be4d60f..8f8fa32ceaf56 100644 --- a/x-pack/plugins/alerting/public/hooks/use_breadcrumbs.ts +++ b/x-pack/plugins/alerting/public/hooks/use_breadcrumbs.ts @@ -6,15 +6,13 @@ */ import { i18n } from '@kbn/i18n'; -import { ChromeBreadcrumb } from '@kbn/core/public'; -import { MouseEvent, useEffect } from 'react'; +import type { ChromeBreadcrumb } from '@kbn/core/public'; +import type { MouseEvent } from 'react'; +import { useEffect } from 'react'; import { useKibana } from '../utils/kibana_react'; import { useNavigation } from './use_navigation'; -import { - MANAGEMENT_APP_ID, - MaintenanceWindowDeepLinkIds, - MAINTENANCE_WINDOW_DEEP_LINK_IDS, -} from '../../common'; +import type { MaintenanceWindowDeepLinkIds } from '../../common'; +import { MANAGEMENT_APP_ID, MAINTENANCE_WINDOW_DEEP_LINK_IDS } from '../../common'; const breadcrumbTitle: Record = { [MAINTENANCE_WINDOW_DEEP_LINK_IDS.maintenanceWindows]: i18n.translate( diff --git a/x-pack/plugins/alerting/public/hooks/use_create_maintenance_window.test.tsx b/x-pack/plugins/alerting/public/hooks/use_create_maintenance_window.test.tsx index 26d70f2d4e9a8..4be59f2d03989 100644 --- a/x-pack/plugins/alerting/public/hooks/use_create_maintenance_window.test.tsx +++ b/x-pack/plugins/alerting/public/hooks/use_create_maintenance_window.test.tsx @@ -7,7 +7,8 @@ import { act, renderHook } from '@testing-library/react-hooks/dom'; import { waitFor } from '@testing-library/react'; -import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils'; +import type { AppMockRenderer } from '../lib/test_utils'; +import { createAppMockRenderer } from '../lib/test_utils'; import { useCreateMaintenanceWindow } from './use_create_maintenance_window'; const mockAddDanger = jest.fn(); diff --git a/x-pack/plugins/alerting/public/hooks/use_create_maintenance_window.ts b/x-pack/plugins/alerting/public/hooks/use_create_maintenance_window.ts index 399f49f9a4cc0..b20d0b580a5a9 100644 --- a/x-pack/plugins/alerting/public/hooks/use_create_maintenance_window.ts +++ b/x-pack/plugins/alerting/public/hooks/use_create_maintenance_window.ts @@ -11,7 +11,8 @@ import type { IHttpFetchError } from '@kbn/core-http-browser'; import type { KibanaServerError } from '@kbn/kibana-utils-plugin/public'; import { useKibana } from '../utils/kibana_react'; -import { createMaintenanceWindow, CreateParams } from '../services/maintenance_windows_api/create'; +import type { CreateParams } from '../services/maintenance_windows_api/create'; +import { createMaintenanceWindow } from '../services/maintenance_windows_api/create'; const onErrorWithMessage = (message: string) => i18n.translate('xpack.alerting.maintenanceWindowsCreateFailureWithMessage', { diff --git a/x-pack/plugins/alerting/public/hooks/use_find_maintenance_windows.test.tsx b/x-pack/plugins/alerting/public/hooks/use_find_maintenance_windows.test.tsx index d21b145aea937..47336ffc0185e 100644 --- a/x-pack/plugins/alerting/public/hooks/use_find_maintenance_windows.test.tsx +++ b/x-pack/plugins/alerting/public/hooks/use_find_maintenance_windows.test.tsx @@ -7,7 +7,8 @@ import { renderHook } from '@testing-library/react-hooks/dom'; import { waitFor } from '@testing-library/react'; -import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils'; +import type { AppMockRenderer } from '../lib/test_utils'; +import { createAppMockRenderer } from '../lib/test_utils'; import { useFindMaintenanceWindows } from './use_find_maintenance_windows'; const mockAddDanger = jest.fn(); diff --git a/x-pack/plugins/alerting/public/hooks/use_finish_and_archive_maintenance_window.test.tsx b/x-pack/plugins/alerting/public/hooks/use_finish_and_archive_maintenance_window.test.tsx index 8b55812bd0301..d555fa17a2c90 100644 --- a/x-pack/plugins/alerting/public/hooks/use_finish_and_archive_maintenance_window.test.tsx +++ b/x-pack/plugins/alerting/public/hooks/use_finish_and_archive_maintenance_window.test.tsx @@ -7,7 +7,8 @@ import { act, renderHook } from '@testing-library/react-hooks/dom'; import { waitFor } from '@testing-library/react'; -import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils'; +import type { AppMockRenderer } from '../lib/test_utils'; +import { createAppMockRenderer } from '../lib/test_utils'; import { useFinishAndArchiveMaintenanceWindow } from './use_finish_and_archive_maintenance_window'; const mockAddDanger = jest.fn(); diff --git a/x-pack/plugins/alerting/public/hooks/use_finish_maintenance_window.test.tsx b/x-pack/plugins/alerting/public/hooks/use_finish_maintenance_window.test.tsx index 6041796fcc00c..15f49248dc8ac 100644 --- a/x-pack/plugins/alerting/public/hooks/use_finish_maintenance_window.test.tsx +++ b/x-pack/plugins/alerting/public/hooks/use_finish_maintenance_window.test.tsx @@ -7,7 +7,8 @@ import { act, renderHook } from '@testing-library/react-hooks/dom'; import { waitFor } from '@testing-library/react'; -import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils'; +import type { AppMockRenderer } from '../lib/test_utils'; +import { createAppMockRenderer } from '../lib/test_utils'; import { useFinishMaintenanceWindow } from './use_finish_maintenance_window'; const mockAddDanger = jest.fn(); diff --git a/x-pack/plugins/alerting/public/hooks/use_get_maintenance_window.test.tsx b/x-pack/plugins/alerting/public/hooks/use_get_maintenance_window.test.tsx index 3003f1003ce12..2a4e33f6eba76 100644 --- a/x-pack/plugins/alerting/public/hooks/use_get_maintenance_window.test.tsx +++ b/x-pack/plugins/alerting/public/hooks/use_get_maintenance_window.test.tsx @@ -7,7 +7,8 @@ import { renderHook } from '@testing-library/react-hooks/dom'; import { waitFor } from '@testing-library/react'; -import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils'; +import type { AppMockRenderer } from '../lib/test_utils'; +import { createAppMockRenderer } from '../lib/test_utils'; import { useGetMaintenanceWindow } from './use_get_maintenance_window'; const mockAddDanger = jest.fn(); diff --git a/x-pack/plugins/alerting/public/hooks/use_license.test.tsx b/x-pack/plugins/alerting/public/hooks/use_license.test.tsx index 0611a6ba86aec..3b8c3efe81475 100644 --- a/x-pack/plugins/alerting/public/hooks/use_license.test.tsx +++ b/x-pack/plugins/alerting/public/hooks/use_license.test.tsx @@ -8,7 +8,8 @@ import { licensingMock } from '@kbn/licensing-plugin/public/mocks'; import { renderHook } from '@testing-library/react-hooks'; import { useLicense } from './use_license'; -import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils'; +import type { AppMockRenderer } from '../lib/test_utils'; +import { createAppMockRenderer } from '../lib/test_utils'; let appMockRenderer: AppMockRenderer; diff --git a/x-pack/plugins/alerting/public/hooks/use_navigation.test.tsx b/x-pack/plugins/alerting/public/hooks/use_navigation.test.tsx index 2ea981db2a4d5..0051551ad1fb7 100644 --- a/x-pack/plugins/alerting/public/hooks/use_navigation.test.tsx +++ b/x-pack/plugins/alerting/public/hooks/use_navigation.test.tsx @@ -12,7 +12,8 @@ import { useEditMaintenanceWindowsNavigation, useMaintenanceWindowsNavigation, } from './use_navigation'; -import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils'; +import type { AppMockRenderer } from '../lib/test_utils'; +import { createAppMockRenderer } from '../lib/test_utils'; import { MANAGEMENT_APP_ID, MAINTENANCE_WINDOWS_APP_ID } from '../../common'; const mockNavigateTo = jest.fn(); diff --git a/x-pack/plugins/alerting/public/hooks/use_update_maintenance_window.test.tsx b/x-pack/plugins/alerting/public/hooks/use_update_maintenance_window.test.tsx index 6ba19c27c362e..9c1fe93c3daa6 100644 --- a/x-pack/plugins/alerting/public/hooks/use_update_maintenance_window.test.tsx +++ b/x-pack/plugins/alerting/public/hooks/use_update_maintenance_window.test.tsx @@ -7,7 +7,8 @@ import { act, renderHook } from '@testing-library/react-hooks/dom'; import { waitFor } from '@testing-library/react'; -import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils'; +import type { AppMockRenderer } from '../lib/test_utils'; +import { createAppMockRenderer } from '../lib/test_utils'; import { useUpdateMaintenanceWindow } from './use_update_maintenance_window'; const mockAddDanger = jest.fn(); diff --git a/x-pack/plugins/alerting/public/hooks/use_update_maintenance_window.ts b/x-pack/plugins/alerting/public/hooks/use_update_maintenance_window.ts index fcc10e1265d18..febf4900368d8 100644 --- a/x-pack/plugins/alerting/public/hooks/use_update_maintenance_window.ts +++ b/x-pack/plugins/alerting/public/hooks/use_update_maintenance_window.ts @@ -12,7 +12,8 @@ import type { KibanaServerError } from '@kbn/kibana-utils-plugin/public'; import type { MaintenanceWindow } from '../../common'; import { useKibana } from '../utils/kibana_react'; -import { updateMaintenanceWindow, UpdateParams } from '../services/maintenance_windows_api/update'; +import type { UpdateParams } from '../services/maintenance_windows_api/update'; +import { updateMaintenanceWindow } from '../services/maintenance_windows_api/update'; interface UseUpdateMaintenanceWindowProps { onError?: (error: IHttpFetchError) => void; diff --git a/x-pack/plugins/alerting/public/lib/common_transformations.test.ts b/x-pack/plugins/alerting/public/lib/common_transformations.test.ts index 0a3cdcb336386..65b0747edee95 100644 --- a/x-pack/plugins/alerting/public/lib/common_transformations.test.ts +++ b/x-pack/plugins/alerting/public/lib/common_transformations.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { ApiRule, transformRule } from './common_transformations'; +import type { ApiRule } from './common_transformations'; +import { transformRule } from './common_transformations'; import { RuleExecutionStatusErrorReasons, RuleLastRunOutcomeValues } from '../../common'; beforeEach(() => jest.resetAllMocks()); diff --git a/x-pack/plugins/alerting/public/lib/common_transformations.ts b/x-pack/plugins/alerting/public/lib/common_transformations.ts index e79bed27ec3d8..a9944cc6d4982 100644 --- a/x-pack/plugins/alerting/public/lib/common_transformations.ts +++ b/x-pack/plugins/alerting/public/lib/common_transformations.ts @@ -4,8 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { AsApiContract } from '@kbn/actions-plugin/common'; -import { +import type { AsApiContract } from '@kbn/actions-plugin/common'; +import type { RuleExecutionStatus, RuleMonitoring, Rule, @@ -118,7 +118,7 @@ export function transformRule(input: ApiRule): Rule { actions: actionsAPI, next_run: nextRun, last_run: lastRun, - monitoring: monitoring, + monitoring, view_in_app_relative_url: viewInAppRelativeUrl, ...rest } = input; diff --git a/x-pack/plugins/alerting/public/lib/test_utils.tsx b/x-pack/plugins/alerting/public/lib/test_utils.tsx index 3693e2ea6ccb0..e5ac0de9b5be4 100644 --- a/x-pack/plugins/alerting/public/lib/test_utils.tsx +++ b/x-pack/plugins/alerting/public/lib/test_utils.tsx @@ -5,13 +5,15 @@ * 2.0. */ -import React, { FC, PropsWithChildren } from 'react'; +import type { FC, PropsWithChildren } from 'react'; +import React from 'react'; import { BehaviorSubject } from 'rxjs'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; -import { render as reactRender, RenderOptions, RenderResult } from '@testing-library/react'; -import { Capabilities, CoreStart } from '@kbn/core/public'; +import type { RenderOptions, RenderResult } from '@testing-library/react'; +import { render as reactRender } from '@testing-library/react'; +import type { Capabilities, CoreStart } from '@kbn/core/public'; import { coreMock } from '@kbn/core/public/mocks'; import type { ILicense } from '@kbn/licensing-plugin/public'; import { licensingMock } from '@kbn/licensing-plugin/public/mocks'; diff --git a/x-pack/plugins/alerting/public/mocks.ts b/x-pack/plugins/alerting/public/mocks.ts index 977447f29f365..ea2391b11cf8c 100644 --- a/x-pack/plugins/alerting/public/mocks.ts +++ b/x-pack/plugins/alerting/public/mocks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AlertingPublicPlugin } from './plugin'; +import type { AlertingPublicPlugin } from './plugin'; export type Setup = jest.Mocked>; export type Start = jest.Mocked>; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/center_justified_spinner.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/center_justified_spinner.test.tsx index f3c6bacaa7917..f2006e5c216a0 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/center_justified_spinner.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/center_justified_spinner.test.tsx @@ -7,7 +7,8 @@ import React from 'react'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; import { CenterJustifiedSpinner } from './center_justified_spinner'; describe('CenterJustifiedSpinner', () => { diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/center_justified_spinner.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/center_justified_spinner.tsx index 72cf6345623e3..17e158b792f38 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/center_justified_spinner.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/center_justified_spinner.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui'; -import { EuiLoadingSpinnerSize } from '@elastic/eui/src/components/loading/loading_spinner'; +import type { EuiLoadingSpinnerSize } from '@elastic/eui/src/components/loading/loading_spinner'; interface Props { size?: EuiLoadingSpinnerSize; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.test.tsx index 070e88f8b3e73..da12d2e81acd5 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.test.tsx @@ -7,11 +7,10 @@ import React from 'react'; import { within, fireEvent, waitFor } from '@testing-library/react'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; -import { - CreateMaintenanceWindowFormProps, - CreateMaintenanceWindowForm, -} from './create_maintenance_windows_form'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; +import type { CreateMaintenanceWindowFormProps } from './create_maintenance_windows_form'; +import { CreateMaintenanceWindowForm } from './create_maintenance_windows_form'; jest.mock('../../../utils/kibana_react'); jest.mock('../../../services/rule_api', () => ({ diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.tsx index 7f3c25eeaf55d..797147f1a4075 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/create_maintenance_windows_form.tsx @@ -6,10 +6,10 @@ */ import React, { useCallback, useMemo, useState, useRef, useEffect } from 'react'; import moment from 'moment'; +import type { FormSubmitHandler } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; import { FIELD_TYPES, Form, - FormSubmitHandler, getUseField, useForm, useFormData, @@ -35,7 +35,8 @@ import type { ValidFeatureId } from '@kbn/rule-data-utils'; import type { Filter } from '@kbn/es-query'; import type { IHttpFetchError } from '@kbn/core-http-browser'; import type { KibanaServerError } from '@kbn/kibana-utils-plugin/public'; -import { FormProps, schema } from './schema'; +import type { FormProps } from './schema'; +import { schema } from './schema'; import * as i18n from '../translations'; import { RecurringSchedule } from './recurring_schedule_form/recurring_schedule'; import { SubmitButton } from './submit_button'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/empty_prompt.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/empty_prompt.test.tsx index 614e0de265cda..54af3aed1b9ff 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/empty_prompt.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/empty_prompt.test.tsx @@ -8,7 +8,8 @@ import React from 'react'; import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; import { EmptyPrompt } from './empty_prompt'; describe('EmptyPrompt', () => { diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/empty_prompt.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/empty_prompt.tsx index d6b7055f48fcd..d5514ac2bb972 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/empty_prompt.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/empty_prompt.tsx @@ -7,7 +7,7 @@ import React, { useMemo } from 'react'; import { EuiButton, EuiButtonEmpty, EuiPageTemplate } from '@elastic/eui'; -import { DocLinks } from '@kbn/doc-links'; +import type { DocLinks } from '@kbn/doc-links'; import * as i18n from '../translations'; interface EmptyPromptProps { diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/fields/date_picker_range_field.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/fields/date_picker_range_field.tsx index cd312c2df70db..b9a142971f35a 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/fields/date_picker_range_field.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/fields/date_picker_range_field.tsx @@ -6,13 +6,11 @@ */ import React, { useCallback, useState } from 'react'; -import moment, { Moment } from 'moment'; +import type { Moment } from 'moment'; +import moment from 'moment'; import { EuiDatePicker, EuiDatePickerRange, EuiFormRow, EuiSpacer, EuiText } from '@elastic/eui'; -import { - useFormData, - useFormContext, - FieldHook, -} from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; +import type { FieldHook } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; +import { useFormData, useFormContext } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; import * as i18n from '../../translations'; import { getSelectedForDatePicker as getSelected } from '../../helpers/get_selected_for_date_picker'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/license_prompt.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/license_prompt.test.tsx index 3a5ecc97ae1dc..18d3a2e40ef25 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/license_prompt.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/license_prompt.test.tsx @@ -6,7 +6,8 @@ */ import React from 'react'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; import { LicensePrompt } from './license_prompt'; describe('LicensePrompt', () => { diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/link_icon.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/link_icon.test.tsx index 9d1ad779471cb..81828c8cdd818 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/link_icon.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/link_icon.test.tsx @@ -8,7 +8,8 @@ import React from 'react'; import { LinkIcon } from './link_icon'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; describe('LinkIcon', () => { let appMockRenderer: AppMockRenderer; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_category_selection.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_category_selection.test.tsx index d99f75bd3ed64..742984d6edfd5 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_category_selection.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_category_selection.test.tsx @@ -8,7 +8,8 @@ import React from 'react'; import { screen, fireEvent } from '@testing-library/react'; import { MaintenanceWindowCategorySelection } from './maintenance_window_category_selection'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; const mockOnChange = jest.fn(); diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_category_selection.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_category_selection.tsx index d5bd97123fed5..da161e1e58536 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_category_selection.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_category_selection.tsx @@ -24,17 +24,17 @@ const CHECKBOX_OPTIONS = [ { id: DEFAULT_APP_CATEGORIES.observability.id, label: i18n.CREATE_FORM_CATEGORY_OBSERVABILITY_RULES, - ['data-test-subj']: `option-${DEFAULT_APP_CATEGORIES.observability.id}`, + 'data-test-subj': `option-${DEFAULT_APP_CATEGORIES.observability.id}`, }, { id: DEFAULT_APP_CATEGORIES.security.id, label: i18n.CREATE_FORM_CATEGORY_SECURITY_RULES, - ['data-test-subj']: `option-${DEFAULT_APP_CATEGORIES.security.id}`, + 'data-test-subj': `option-${DEFAULT_APP_CATEGORIES.security.id}`, }, { id: DEFAULT_APP_CATEGORIES.management.id, label: i18n.CREATE_FORM_CATEGORY_STACK_RULES, - ['data-test-subj']: `option-${DEFAULT_APP_CATEGORIES.management.id}`, + 'data-test-subj': `option-${DEFAULT_APP_CATEGORIES.management.id}`, }, ].sort((a, b) => a.id.localeCompare(b.id)); diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query.test.tsx index 74f3fd865fe73..70b555e1567fd 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query.test.tsx @@ -8,7 +8,8 @@ import React from 'react'; import { screen } from '@testing-library/react'; import type { AlertConsumers } from '@kbn/rule-data-utils'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; import { MaintenanceWindowScopedQuery } from './maintenance_window_scoped_query'; jest.mock('../../../utils/kibana_react'); diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query.tsx index cd9bb6e58398f..a206394ab8cc2 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query.tsx @@ -7,7 +7,7 @@ import React, { useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiLoadingSpinner } from '@elastic/eui'; -import { AlertConsumers } from '@kbn/rule-data-utils'; +import type { AlertConsumers } from '@kbn/rule-data-utils'; import type { Filter } from '@kbn/es-query'; import { AlertsSearchBar } from '@kbn/alerts-ui-shared'; import { PLUGIN } from '../../../../common/constants/plugin'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query_switch.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query_switch.tsx index db6ebf0282669..03e23cf1c4b81 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query_switch.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_window_scoped_query_switch.tsx @@ -6,14 +6,8 @@ */ import React, { useCallback } from 'react'; -import { - EuiFlexGroup, - EuiText, - EuiFlexItem, - EuiTextColor, - EuiSwitch, - EuiSwitchEvent, -} from '@elastic/eui'; +import type { EuiSwitchEvent } from '@elastic/eui'; +import { EuiFlexGroup, EuiText, EuiFlexItem, EuiTextColor, EuiSwitch } from '@elastic/eui'; import * as i18n from '../translations'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_windows_list.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_windows_list.test.tsx index 5f9c5b23409c0..a64e7b3860fea 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_windows_list.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_windows_list.test.tsx @@ -8,9 +8,11 @@ import React from 'react'; import moment from 'moment'; import { fireEvent, waitFor } from '@testing-library/react'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; import { MaintenanceWindowsList } from './maintenance_windows_list'; -import { MaintenanceWindowStatus, MaintenanceWindow } from '../../../../common'; +import type { MaintenanceWindow } from '../../../../common'; +import { MaintenanceWindowStatus } from '../../../../common'; describe('MaintenanceWindowsList', () => { const date = moment('2023-04-05').toISOString(); diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_windows_list.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_windows_list.tsx index f91856dc8aec9..d793dc4d0b248 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_windows_list.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/maintenance_windows_list.tsx @@ -6,16 +6,15 @@ */ import React, { useCallback, useMemo } from 'react'; +import type { EuiBasicTableColumn, EuiSearchBarProps } from '@elastic/eui'; import { formatDate, EuiInMemoryTable, - EuiBasicTableColumn, EuiFlexGroup, EuiFlexItem, EuiBadge, useEuiTheme, EuiButton, - EuiSearchBarProps, } from '@elastic/eui'; import { css } from '@emotion/react'; import { SortDirection } from '../types'; @@ -23,13 +22,11 @@ import * as i18n from '../translations'; import { useEditMaintenanceWindowsNavigation } from '../../../hooks/use_navigation'; import { STATUS_DISPLAY, STATUS_SORT } from '../constants'; import { UpcomingEventsPopover } from './upcoming_events_popover'; -import { - MaintenanceWindowStatus, - MAINTENANCE_WINDOW_DATE_FORMAT, - MaintenanceWindow, -} from '../../../../common'; +import type { MaintenanceWindowStatus, MaintenanceWindow } from '../../../../common'; +import { MAINTENANCE_WINDOW_DATE_FORMAT } from '../../../../common'; import { StatusFilter } from './status_filter'; -import { TableActionsPopover, TableActionsPopoverProps } from './table_actions_popover'; +import type { TableActionsPopoverProps } from './table_actions_popover'; +import { TableActionsPopover } from './table_actions_popover'; import { useFinishMaintenanceWindow } from '../../../hooks/use_finish_maintenance_window'; import { useArchiveMaintenanceWindow } from '../../../hooks/use_archive_maintenance_window'; import { useFinishAndArchiveMaintenanceWindow } from '../../../hooks/use_finish_and_archive_maintenance_window'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/page_header.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/page_header.test.tsx index fea66d0148d06..b91a2f146401b 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/page_header.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/page_header.test.tsx @@ -8,7 +8,8 @@ import React from 'react'; import { PageHeader } from './page_header'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; describe('PageHeader', () => { let appMockRenderer: AppMockRenderer; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/custom_recurring_schedule.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/custom_recurring_schedule.test.tsx index 873eedddd9b46..db60f4a73247b 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/custom_recurring_schedule.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/custom_recurring_schedule.test.tsx @@ -5,12 +5,15 @@ * 2.0. */ -import React, { FC, PropsWithChildren } from 'react'; +import type { FC, PropsWithChildren } from 'react'; +import React from 'react'; import { fireEvent, waitFor, within } from '@testing-library/react'; import { useForm, Form } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; import { Frequency } from '@kbn/rrule'; -import { AppMockRenderer, createAppMockRenderer } from '../../../../lib/test_utils'; -import { FormProps, schema } from '../schema'; +import type { AppMockRenderer } from '../../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../../lib/test_utils'; +import type { FormProps } from '../schema'; +import { schema } from '../schema'; import { CustomRecurringSchedule } from './custom_recurring_schedule'; import { EndsOptions } from '../../constants'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/custom_recurring_schedule.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/custom_recurring_schedule.tsx index cc8b42b2f6339..149378a155f98 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/custom_recurring_schedule.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/custom_recurring_schedule.tsx @@ -13,16 +13,14 @@ import { getUseField, useFormData, } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; -import { - Field, - MultiButtonGroupFieldValue, -} from '@kbn/es-ui-shared-plugin/static/forms/components'; +import type { MultiButtonGroupFieldValue } from '@kbn/es-ui-shared-plugin/static/forms/components'; +import { Field } from '@kbn/es-ui-shared-plugin/static/forms/components'; import { EuiFlexGroup, EuiFlexItem, EuiFormLabel, EuiSpacer } from '@elastic/eui'; import { CREATE_FORM_CUSTOM_FREQUENCY, WEEKDAY_OPTIONS } from '../../constants'; import * as i18n from '../../translations'; import { getInitialByWeekday } from '../../helpers/get_initial_by_weekday'; import { getWeekdayInfo } from '../../helpers/get_weekday_info'; -import { FormProps } from '../schema'; +import type { FormProps } from '../schema'; import { parseSchedule } from '../../helpers/parse_schedule'; const UseField = getUseField({ component: Field }); diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/recurring_schedule.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/recurring_schedule.test.tsx index 5cf7d7cf58ea0..80978c465faac 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/recurring_schedule.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/recurring_schedule.test.tsx @@ -5,12 +5,15 @@ * 2.0. */ -import React, { FC, PropsWithChildren } from 'react'; +import type { FC, PropsWithChildren } from 'react'; +import React from 'react'; import { Frequency } from '@kbn/rrule'; import { fireEvent, within } from '@testing-library/react'; import { useForm, Form } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; -import { AppMockRenderer, createAppMockRenderer } from '../../../../lib/test_utils'; -import { FormProps, schema } from '../schema'; +import type { AppMockRenderer } from '../../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../../lib/test_utils'; +import type { FormProps } from '../schema'; +import { schema } from '../schema'; import { RecurringSchedule } from './recurring_schedule'; import { EndsOptions } from '../../constants'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/recurring_schedule.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/recurring_schedule.tsx index 444012ba456a8..248e765e08df0 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/recurring_schedule.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/recurring_schedule_form/recurring_schedule.tsx @@ -5,7 +5,8 @@ * 2.0. */ import React, { useMemo, useState } from 'react'; -import moment, { Moment } from 'moment'; +import type { Moment } from 'moment'; +import moment from 'moment'; import { EuiComboBox, EuiFlexGroup, @@ -33,7 +34,7 @@ import * as i18n from '../../translations'; import { CustomRecurringSchedule } from './custom_recurring_schedule'; import { recurringSummary } from '../../helpers/recurring_summary'; import { getPresets } from '../../helpers/get_presets'; -import { FormProps } from '../schema'; +import type { FormProps } from '../schema'; import { parseSchedule } from '../../helpers/parse_schedule'; const UseField = getUseField({ component: Field }); diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/schema.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/schema.ts index 3bf01ddc51f9f..a3b4ad1a88278 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/schema.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/schema.ts @@ -10,8 +10,9 @@ import { FIELD_TYPES } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers'; import { Frequency } from '@kbn/rrule'; import * as i18n from '../translations'; -import { EndsOptions, MaintenanceWindowFrequency } from '../constants'; -import { ScopedQueryAttributes } from '../../../../common'; +import type { MaintenanceWindowFrequency } from '../constants'; +import { EndsOptions } from '../constants'; +import type { ScopedQueryAttributes } from '../../../../common'; const { emptyField } = fieldValidators; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/status_filter.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/status_filter.test.tsx index 3875545e36df4..d9f7a6f21917b 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/status_filter.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/status_filter.test.tsx @@ -9,7 +9,8 @@ import { Query } from '@elastic/eui'; import { fireEvent } from '@testing-library/react'; import React from 'react'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; import { StatusFilter } from './status_filter'; describe('StatusFilter', () => { diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/status_filter.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/status_filter.tsx index d9f7802050d8d..d7d464ab02b0a 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/status_filter.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/status_filter.tsx @@ -7,7 +7,7 @@ import React, { useState, useCallback } from 'react'; import { EuiFilterButton, EuiPopover, EuiFilterGroup, EuiFilterSelectItem } from '@elastic/eui'; -import { CustomComponentProps } from '@elastic/eui/src/components/search_bar/filters/custom_component_filter'; +import type { CustomComponentProps } from '@elastic/eui/src/components/search_bar/filters/custom_component_filter'; import { STATUS_OPTIONS } from '../constants'; import * as i18n from '../translations'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/submit_button.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/submit_button.test.tsx index 0821200e98475..813beb78e8d9f 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/submit_button.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/submit_button.test.tsx @@ -5,14 +5,16 @@ * 2.0. */ -import React, { FC, PropsWithChildren } from 'react'; +import type { FC, PropsWithChildren } from 'react'; +import React from 'react'; import { fireEvent, waitFor } from '@testing-library/react'; import { useForm, Form } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; import { SubmitButton } from './submit_button'; import type { FormProps } from './schema'; import { schema } from './schema'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; describe('SubmitButton', () => { const onSubmit = jest.fn(); diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/table_actions_popover.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/table_actions_popover.test.tsx index d903333119114..97fde9c103f11 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/table_actions_popover.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/table_actions_popover.test.tsx @@ -8,7 +8,8 @@ import { fireEvent } from '@testing-library/react'; import React from 'react'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; import { TableActionsPopover } from './table_actions_popover'; import { MaintenanceWindowStatus } from '../../../../common'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/table_actions_popover.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/table_actions_popover.tsx index b50351eb1188e..353f2d0d060aa 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/table_actions_popover.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/table_actions_popover.tsx @@ -16,7 +16,7 @@ import { EuiPopover, } from '@elastic/eui'; import * as i18n from '../translations'; -import { MaintenanceWindowStatus } from '../../../../common'; +import type { MaintenanceWindowStatus } from '../../../../common'; export interface TableActionsPopoverProps { id: string; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/truncated_text.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/truncated_text.test.tsx index 0a117f0cabb39..21d08881c065b 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/truncated_text.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/truncated_text.test.tsx @@ -8,7 +8,8 @@ import React from 'react'; import { TruncatedText } from './truncated_text'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; describe('TruncatedText', () => { let appMockRenderer: AppMockRenderer; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/upcoming_events_popover.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/upcoming_events_popover.test.tsx index 2f4d2b9a1e905..bb394076ff351 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/upcoming_events_popover.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/upcoming_events_popover.test.tsx @@ -6,7 +6,8 @@ */ import { fireEvent } from '@testing-library/react'; import * as React from 'react'; -import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils'; +import type { AppMockRenderer } from '../../../lib/test_utils'; +import { createAppMockRenderer } from '../../../lib/test_utils'; import { UpcomingEventsPopover } from './upcoming_events_popover'; import { MaintenanceWindowStatus } from '../../../../common'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/upcoming_events_popover.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/upcoming_events_popover.tsx index b5c3d898b8ee9..36efe9f0b2cb0 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/components/upcoming_events_popover.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/components/upcoming_events_popover.tsx @@ -21,7 +21,8 @@ import { formatDate, } from '@elastic/eui'; import * as i18n from '../translations'; -import { MAINTENANCE_WINDOW_DATE_FORMAT, MaintenanceWindow } from '../../../../common'; +import type { MaintenanceWindow } from '../../../../common'; +import { MAINTENANCE_WINDOW_DATE_FORMAT } from '../../../../common'; import { recurringSummary } from '../helpers/recurring_summary'; import { getPresets } from '../helpers/get_presets'; import { convertFromMaintenanceWindowToForm } from '../helpers/convert_from_maintenance_window_to_form'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/convert_from_maintenance_window_to_form.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/convert_from_maintenance_window_to_form.ts index 6adc7310b25b7..93f8ec22b5294 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/convert_from_maintenance_window_to_form.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/convert_from_maintenance_window_to_form.ts @@ -10,7 +10,8 @@ import { Frequency } from '@kbn/rrule'; import { has } from 'lodash'; import type { FormProps, RecurringScheduleFormProps } from '../components/schema'; import type { RRuleParams, MaintenanceWindow } from '../../../../common'; -import { EndsOptions, MaintenanceWindowFrequency } from '../constants'; +import type { MaintenanceWindowFrequency } from '../constants'; +import { EndsOptions } from '../constants'; import { getInitialByWeekday } from './get_initial_by_weekday'; export const convertFromMaintenanceWindowToForm = ( diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/convert_to_rrule.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/convert_to_rrule.ts index 67e95ce3d3dbd..ad98286db2dd3 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/convert_to_rrule.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/convert_to_rrule.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { Moment } from 'moment'; +import type { Moment } from 'moment'; import { Frequency } from '@kbn/rrule'; import { ISO_WEEKDAYS_TO_RRULE } from '../constants'; import { getNthByWeekday } from './get_nth_by_weekday'; -import { RecurringScheduleFormProps } from '../components/schema'; +import type { RecurringScheduleFormProps } from '../components/schema'; import { getPresets } from './get_presets'; -import { RRuleParams } from '../../../../common'; +import type { RRuleParams } from '../../../../common'; import { parseSchedule } from './parse_schedule'; export const convertToRRule = ( diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_initial_by_weekday.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_initial_by_weekday.ts index b11d3bcf6a5e6..5cd6c9e256a72 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_initial_by_weekday.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_initial_by_weekday.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Moment } from 'moment'; +import type { Moment } from 'moment'; import { ISO_WEEKDAYS } from '../../../../common'; import { ISO_WEEKDAYS_TO_RRULE } from '../constants'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_nth_by_weekday.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_nth_by_weekday.ts index 2f7c9516e0e7c..5de293287f037 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_nth_by_weekday.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_nth_by_weekday.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { Moment } from 'moment'; +import type { Moment } from 'moment'; import { ISO_WEEKDAYS_TO_RRULE } from '../constants'; import { getWeekdayInfo } from './get_weekday_info'; export const getNthByWeekday = (startDate: Moment) => { const { isLastOfMonth, nthWeekdayOfMonth } = getWeekdayInfo(startDate); - return `${isLastOfMonth ? '-1' : '+' + nthWeekdayOfMonth}${ + return `${isLastOfMonth ? '-1' : `+${nthWeekdayOfMonth}`}${ ISO_WEEKDAYS_TO_RRULE[startDate.isoWeekday()] }`; }; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_presets.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_presets.ts index 529922eac5e87..2d650263fe8cb 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_presets.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_presets.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Moment } from 'moment'; +import type { Moment } from 'moment'; import { Frequency } from '@kbn/rrule'; import { getInitialByWeekday } from './get_initial_by_weekday'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_selected_for_date_picker.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_selected_for_date_picker.ts index 31bfdc206be9d..5b45f3b0ef9c4 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_selected_for_date_picker.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_selected_for_date_picker.ts @@ -6,10 +6,11 @@ */ import { get } from 'lodash'; -import moment, { Moment } from 'moment'; +import type { Moment } from 'moment'; +import moment from 'moment'; import 'moment-timezone'; -import { FormData } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; +import type { FormData } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; export function getSelectedForDatePicker( form: FormData, diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_weekday_info.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_weekday_info.ts index e70083480d519..5061b75b264fe 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_weekday_info.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/get_weekday_info.ts @@ -5,7 +5,8 @@ * 2.0. */ -import moment, { Moment } from 'moment'; +import type { Moment } from 'moment'; +import moment from 'moment'; export const getWeekdayInfo = (date: Moment, dayOfWeekFmt: string = 'dddd') => { const dayOfWeek = date.format(dayOfWeekFmt); diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/parse_schedule.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/parse_schedule.ts index 6968db721d1fb..fdc541bdba9ce 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/parse_schedule.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/parse_schedule.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RecurringScheduleFormProps } from '../components/schema'; +import type { RecurringScheduleFormProps } from '../components/schema'; export const parseSchedule = ( schedule: RecurringScheduleFormProps | undefined diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/recurring_summary.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/recurring_summary.ts index 34054bbb736ac..546e6f058d580 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/recurring_summary.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/helpers/recurring_summary.ts @@ -5,17 +5,15 @@ * 2.0. */ -import moment, { Moment } from 'moment'; +import type { Moment } from 'moment'; +import moment from 'moment'; import { Frequency } from '@kbn/rrule'; import * as i18n from '../translations'; -import { - MaintenanceWindowFrequency, - ISO_WEEKDAYS_TO_RRULE, - RRULE_WEEKDAYS_TO_ISO_WEEKDAYS, -} from '../constants'; +import type { MaintenanceWindowFrequency } from '../constants'; +import { ISO_WEEKDAYS_TO_RRULE, RRULE_WEEKDAYS_TO_ISO_WEEKDAYS } from '../constants'; import { monthDayDate } from './month_day_date'; import { getNthByWeekday } from './get_nth_by_weekday'; -import { RecurringScheduleFormProps } from '../components/schema'; +import type { RecurringScheduleFormProps } from '../components/schema'; export const recurringSummary = ( startDate: Moment, diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/index.test.tsx b/x-pack/plugins/alerting/public/pages/maintenance_windows/index.test.tsx index c0fa96a8e1637..b803185f01d53 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/index.test.tsx +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/index.test.tsx @@ -7,7 +7,8 @@ import React from 'react'; import { licensingMock } from '@kbn/licensing-plugin/public/mocks'; import type { Capabilities } from '@kbn/core-capabilities-common'; -import { AppMockRenderer, createAppMockRenderer } from '../../lib/test_utils'; +import type { AppMockRenderer } from '../../lib/test_utils'; +import { createAppMockRenderer } from '../../lib/test_utils'; import { useFindMaintenanceWindows } from '../../hooks/use_find_maintenance_windows'; import { MaintenanceWindowsPage } from '.'; import { MAINTENANCE_WINDOW_FEATURE_ID } from '../../../common'; diff --git a/x-pack/plugins/alerting/public/pages/maintenance_windows/translations.ts b/x-pack/plugins/alerting/public/pages/maintenance_windows/translations.ts index 16b2ad825a2e1..fbb037c5ffc62 100644 --- a/x-pack/plugins/alerting/public/pages/maintenance_windows/translations.ts +++ b/x-pack/plugins/alerting/public/pages/maintenance_windows/translations.ts @@ -5,7 +5,7 @@ * 2.0. */ import { i18n } from '@kbn/i18n'; -import { Moment } from 'moment'; +import type { Moment } from 'moment'; import { Frequency } from '@kbn/rrule'; import { monthDayDate } from './helpers/month_day_date'; diff --git a/x-pack/plugins/alerting/public/plugin.test.ts b/x-pack/plugins/alerting/public/plugin.test.ts index 87b7e4573c79f..b74be3c0c244d 100644 --- a/x-pack/plugins/alerting/public/plugin.test.ts +++ b/x-pack/plugins/alerting/public/plugin.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { AlertingPublicPlugin, AlertingUIConfig } from './plugin'; +import type { AlertingUIConfig } from './plugin'; +import { AlertingPublicPlugin } from './plugin'; import { coreMock } from '@kbn/core/public/mocks'; import { createManagementSectionMock, diff --git a/x-pack/plugins/alerting/public/plugin.ts b/x-pack/plugins/alerting/public/plugin.ts index 71bae6b28c94c..3d1be2037d223 100644 --- a/x-pack/plugins/alerting/public/plugin.ts +++ b/x-pack/plugins/alerting/public/plugin.ts @@ -6,16 +6,18 @@ */ import { i18n } from '@kbn/i18n'; -import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public'; -import { ManagementAppMountParams, ManagementSetup } from '@kbn/management-plugin/public'; -import { SpacesPluginStart } from '@kbn/spaces-plugin/public'; -import { LicensingPluginStart } from '@kbn/licensing-plugin/public'; +import type { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public'; +import type { ManagementAppMountParams, ManagementSetup } from '@kbn/management-plugin/public'; +import type { SpacesPluginStart } from '@kbn/spaces-plugin/public'; +import type { LicensingPluginStart } from '@kbn/licensing-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; -import { AlertNavigationRegistry, AlertNavigationHandler } from './alert_navigation_registry'; +import type { AlertNavigationHandler } from './alert_navigation_registry'; +import { AlertNavigationRegistry } from './alert_navigation_registry'; import { loadRule, loadRuleType } from './services/rule_api'; -import { ENABLE_MAINTENANCE_WINDOWS, Rule, MAINTENANCE_WINDOWS_APP_ID } from '../common'; +import type { Rule } from '../common'; +import { ENABLE_MAINTENANCE_WINDOWS, MAINTENANCE_WINDOWS_APP_ID } from '../common'; export interface PluginSetupContract { /** diff --git a/x-pack/plugins/alerting/public/services/rule_api.test.ts b/x-pack/plugins/alerting/public/services/rule_api.test.ts index d9131221be11a..ac665e71751ed 100644 --- a/x-pack/plugins/alerting/public/services/rule_api.test.ts +++ b/x-pack/plugins/alerting/public/services/rule_api.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Rule, RuleType } from '../../common'; +import type { Rule, RuleType } from '../../common'; import { httpServiceMock } from '@kbn/core/public/mocks'; import { loadRule, loadRuleType, loadRuleTypes } from './rule_api'; diff --git a/x-pack/plugins/alerting/public/services/rule_api.ts b/x-pack/plugins/alerting/public/services/rule_api.ts index 346914bb9b8ca..92aba4270adbd 100644 --- a/x-pack/plugins/alerting/public/services/rule_api.ts +++ b/x-pack/plugins/alerting/public/services/rule_api.ts @@ -5,11 +5,12 @@ * 2.0. */ -import { HttpSetup } from '@kbn/core/public'; -import { AsApiContract } from '@kbn/actions-plugin/common'; +import type { HttpSetup } from '@kbn/core/public'; +import type { AsApiContract } from '@kbn/actions-plugin/common'; import { BASE_ALERTING_API_PATH, INTERNAL_BASE_ALERTING_API_PATH } from '../../common'; import type { Rule, RuleType } from '../../common'; -import { transformRule, transformRuleType, ApiRule } from '../lib/common_transformations'; +import type { ApiRule } from '../lib/common_transformations'; +import { transformRule, transformRuleType } from '../lib/common_transformations'; export async function loadRuleTypes({ http }: { http: HttpSetup }): Promise { const res = await http.get>>( diff --git a/x-pack/plugins/alerting/public/utils/kibana_react.ts b/x-pack/plugins/alerting/public/utils/kibana_react.ts index 22b271ee4a288..4e7943fae50b8 100644 --- a/x-pack/plugins/alerting/public/utils/kibana_react.ts +++ b/x-pack/plugins/alerting/public/utils/kibana_react.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { CoreStart } from '@kbn/core/public'; +import type { CoreStart } from '@kbn/core/public'; import { useKibana, useUiSetting } from '@kbn/kibana-react-plugin/public'; -import { Storage } from '@kbn/kibana-utils-plugin/public'; -import { AlertingPluginStart } from '../plugin'; +import type { Storage } from '@kbn/kibana-utils-plugin/public'; +import type { AlertingPluginStart } from '../plugin'; export type StartServices = CoreStart & AlertingPluginStart & diff --git a/x-pack/plugins/alerting/server/alert/alert.test.ts b/x-pack/plugins/alerting/server/alert/alert.test.ts index 6008f86289141..7dde1c27f64d9 100644 --- a/x-pack/plugins/alerting/server/alert/alert.test.ts +++ b/x-pack/plugins/alerting/server/alert/alert.test.ts @@ -7,9 +7,9 @@ import sinon from 'sinon'; import { Alert } from './alert'; -import { AlertInstanceState, AlertInstanceContext, DefaultActionGroupId } from '../../common'; +import type { AlertInstanceState, AlertInstanceContext, DefaultActionGroupId } from '../../common'; import { alertWithAnyUUID } from '../test_utils'; -import { CombinedSummarizedAlerts } from '../types'; +import type { CombinedSummarizedAlerts } from '../types'; let clock: sinon.SinonFakeTimers; diff --git a/x-pack/plugins/alerting/server/alert/alert.ts b/x-pack/plugins/alerting/server/alert/alert.ts index 51a9f29891bcf..e2c35c4410e9a 100644 --- a/x-pack/plugins/alerting/server/alert/alert.ts +++ b/x-pack/plugins/alerting/server/alert/alert.ts @@ -6,12 +6,12 @@ */ import { v4 as uuidV4 } from 'uuid'; -import { AADAlert } from '@kbn/alerts-as-data-utils'; +import type { AADAlert } from '@kbn/alerts-as-data-utils'; import { get, isEmpty } from 'lodash'; -import { MutableAlertInstanceMeta } from '@kbn/alerting-state-types'; +import type { MutableAlertInstanceMeta } from '@kbn/alerting-state-types'; import { ALERT_UUID } from '@kbn/rule-data-utils'; -import { AlertHit, CombinedSummarizedAlerts } from '../types'; -import { +import type { AlertHit, CombinedSummarizedAlerts } from '../types'; +import type { AlertInstanceMeta, AlertInstanceState, RawAlertInstance, diff --git a/x-pack/plugins/alerting/server/alert/create_alert_factory.ts b/x-pack/plugins/alerting/server/alert/create_alert_factory.ts index 0b8d88c035b44..d4e49f250b0c2 100644 --- a/x-pack/plugins/alerting/server/alert/create_alert_factory.ts +++ b/x-pack/plugins/alerting/server/alert/create_alert_factory.ts @@ -5,10 +5,11 @@ * 2.0. */ -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; import { cloneDeep } from 'lodash'; -import { AlertInstanceContext, AlertInstanceState } from '../types'; -import { Alert, PublicAlert } from './alert'; +import type { AlertInstanceContext, AlertInstanceState } from '../types'; +import type { PublicAlert } from './alert'; +import { Alert } from './alert'; import { processAlerts } from '../lib'; import { DISABLE_FLAPPING_SETTINGS } from '../../common/rules_settings'; diff --git a/x-pack/plugins/alerting/server/alerting_authorization_client_factory.mock.ts b/x-pack/plugins/alerting/server/alerting_authorization_client_factory.mock.ts index d80f1d7289627..3cfa0d8dde465 100644 --- a/x-pack/plugins/alerting/server/alerting_authorization_client_factory.mock.ts +++ b/x-pack/plugins/alerting/server/alerting_authorization_client_factory.mock.ts @@ -6,7 +6,7 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { AlertingAuthorizationClientFactory } from './alerting_authorization_client_factory'; +import type { AlertingAuthorizationClientFactory } from './alerting_authorization_client_factory'; const creatAlertingAuthorizationClientFactoryMock = () => { const mocked: jest.Mocked> = { diff --git a/x-pack/plugins/alerting/server/alerting_authorization_client_factory.test.ts b/x-pack/plugins/alerting/server/alerting_authorization_client_factory.test.ts index dca53bb3188e9..b4fd3c1de1962 100644 --- a/x-pack/plugins/alerting/server/alerting_authorization_client_factory.test.ts +++ b/x-pack/plugins/alerting/server/alerting_authorization_client_factory.test.ts @@ -7,10 +7,8 @@ import { mockRouter } from '@kbn/core-http-router-server-mocks'; import { ruleTypeRegistryMock } from './rule_type_registry.mock'; import { securityMock } from '@kbn/security-plugin/server/mocks'; -import { - AlertingAuthorizationClientFactory, - AlertingAuthorizationClientFactoryOpts, -} from './alerting_authorization_client_factory'; +import type { AlertingAuthorizationClientFactoryOpts } from './alerting_authorization_client_factory'; +import { AlertingAuthorizationClientFactory } from './alerting_authorization_client_factory'; import { featuresPluginMock } from '@kbn/features-plugin/server/mocks'; jest.mock('./authorization/alerting_authorization'); diff --git a/x-pack/plugins/alerting/server/alerting_authorization_client_factory.ts b/x-pack/plugins/alerting/server/alerting_authorization_client_factory.ts index ca366a6cee0e4..47b8c63af6a04 100644 --- a/x-pack/plugins/alerting/server/alerting_authorization_client_factory.ts +++ b/x-pack/plugins/alerting/server/alerting_authorization_client_factory.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { KibanaRequest } from '@kbn/core/server'; -import { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server'; -import { FeaturesPluginStart } from '@kbn/features-plugin/server'; -import { Space } from '@kbn/spaces-plugin/server'; +import type { KibanaRequest } from '@kbn/core/server'; +import type { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server'; +import type { FeaturesPluginStart } from '@kbn/features-plugin/server'; +import type { Space } from '@kbn/spaces-plugin/server'; import { AlertingAuthorization } from './authorization/alerting_authorization'; -import { RuleTypeRegistry } from './types'; +import type { RuleTypeRegistry } from './types'; export interface AlertingAuthorizationClientFactoryOpts { ruleTypeRegistry: RuleTypeRegistry; diff --git a/x-pack/plugins/alerting/server/alerts_client/alerts_client.test.ts b/x-pack/plugins/alerting/server/alerts_client/alerts_client.test.ts index 36bf830e47f74..58a80ede1358c 100644 --- a/x-pack/plugins/alerting/server/alerts_client/alerts_client.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/alerts_client.test.ts @@ -7,14 +7,9 @@ import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mocks'; import type { UpdateByQueryRequest } from '@elastic/elasticsearch/lib/api/types'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; -import { - AlertsFilter, - DEFAULT_FLAPPING_SETTINGS, - MaintenanceWindowStatus, - RecoveredActionGroup, - RuleAlertData, -} from '../types'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { AlertsFilter, RuleAlertData } from '../types'; +import { DEFAULT_FLAPPING_SETTINGS, MaintenanceWindowStatus, RecoveredActionGroup } from '../types'; import { ALERT_ACTION_GROUP, ALERT_CONSECUTIVE_MATCHES, @@ -52,8 +47,9 @@ import { import * as LegacyAlertsClientModule from './legacy_alerts_client'; import { LegacyAlertsClient } from './legacy_alerts_client'; import { Alert } from '../alert/alert'; -import { AlertsClient, AlertsClientParams } from './alerts_client'; -import { +import type { AlertsClientParams } from './alerts_client'; +import { AlertsClient } from './alerts_client'; +import type { GetSummarizedAlertsParams, GetMaintenanceWindowScopedQueryAlertsParams, ProcessAlertsOpts, @@ -75,10 +71,10 @@ import { mockAAD, } from './alerts_client_fixtures'; import { getDataStreamAdapter } from '../alerts_service/lib/data_stream_adapter'; -import { MaintenanceWindow } from '../application/maintenance_window/types'; +import type { MaintenanceWindow } from '../application/maintenance_window/types'; import { maintenanceWindowsServiceMock } from '../task_runner/maintenance_windows/maintenance_windows_service.mock'; import { getMockMaintenanceWindow } from '../data/maintenance_window/test_helpers'; -import { KibanaRequest } from '@kbn/core/server'; +import type { KibanaRequest } from '@kbn/core/server'; import { rule } from './lib/test_fixtures'; const date = '2023-03-28T22:27:28.159Z'; diff --git a/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts b/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts index 1bfa1de9e96d6..477f309be27f0 100644 --- a/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts +++ b/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ElasticsearchClient } from '@kbn/core/server'; +import type { ElasticsearchClient } from '@kbn/core/server'; import { ALERT_INSTANCE_ID, ALERT_RULE_UUID, @@ -14,12 +14,12 @@ import { ALERT_MAINTENANCE_WINDOW_IDS, } from '@kbn/rule-data-utils'; import { chunk, flatMap, get, isEmpty, keys } from 'lodash'; -import { SearchRequest } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { SearchRequest } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import type { Alert } from '@kbn/alerts-as-data-utils'; import { DEFAULT_NAMESPACE_STRING } from '@kbn/core-saved-objects-utils-server'; -import { DeepPartial } from '@kbn/utility-types'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; -import { +import type { DeepPartial } from '@kbn/utility-types'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { SummarizedAlerts, ScopedQueryAlerts, AlertInstanceContext, @@ -29,13 +29,11 @@ import { DataStreamAdapter, } from '../types'; import { LegacyAlertsClient } from './legacy_alerts_client'; -import { - getIndexTemplateAndPattern, - IIndexPatternString, -} from '../alerts_service/resource_installer_utils'; -import { CreateAlertsClientParams } from '../alerts_service/alerts_service'; +import type { IIndexPatternString } from '../alerts_service/resource_installer_utils'; +import { getIndexTemplateAndPattern } from '../alerts_service/resource_installer_utils'; +import type { CreateAlertsClientParams } from '../alerts_service/alerts_service'; import type { AlertRule, LogAlertsOpts, ProcessAlertsOpts, SearchResult } from './types'; -import { +import type { IAlertsClient, InitializeExecutionOpts, TrackedAlerts, @@ -425,7 +423,7 @@ export class AlertsClient< const activeAlertsToIndex: Array = []; for (const id of keys(alertsToReturn)) { // See if there's an existing active alert document - if (!!activeAlerts[id]) { + if (activeAlerts[id]) { if ( Object.hasOwn(this.fetchedAlerts.data, id) && get(this.fetchedAlerts.data[id], ALERT_STATUS) === 'active' diff --git a/x-pack/plugins/alerting/server/alerts_client/alerts_client_fixtures.ts b/x-pack/plugins/alerting/server/alerts_client/alerts_client_fixtures.ts index 0da20a5e49b70..85c270e534109 100644 --- a/x-pack/plugins/alerting/server/alerts_client/alerts_client_fixtures.ts +++ b/x-pack/plugins/alerting/server/alerts_client/alerts_client_fixtures.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { +import type { GetSummarizedAlertsParams, GetMaintenanceWindowScopedQueryAlertsParams, UpdateAlertsMaintenanceWindowIdByScopedQueryParams, } from './types'; import type { MaintenanceWindow } from '../application/maintenance_window/types'; -import { AlertRuleData } from '.'; -import { AlertsFilter } from '../types'; +import type { AlertRuleData } from '.'; +import type { AlertsFilter } from '../types'; export const alertRuleData: AlertRuleData = { consumer: 'bar', @@ -139,7 +139,7 @@ export const getExpectedQueryByExecutionUuid = ({ bool: { must_not: { exists: { field: 'kibana.alert.maintenance_window_ids' } } }, }, ...(isLifecycleAlert ? [{ term: { 'event.action': alertTypes[alertType] } }] : []), - ...(!!excludedAlertInstanceIds?.length + ...(excludedAlertInstanceIds?.length ? [ { bool: { @@ -257,7 +257,7 @@ export const getExpectedQueryByTimeRange = ({ }, { term: { 'kibana.alert.rule.uuid': ruleId } } ); - if (!!excludedAlertInstanceIds?.length) { + if (excludedAlertInstanceIds?.length) { filter.push({ bool: { must_not: { diff --git a/x-pack/plugins/alerting/server/alerts_client/legacy_alerts_client.test.ts b/x-pack/plugins/alerting/server/alerts_client/legacy_alerts_client.test.ts index db341d35ce971..7bf90b4e8d86a 100644 --- a/x-pack/plugins/alerting/server/alerts_client/legacy_alerts_client.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/legacy_alerts_client.test.ts @@ -5,8 +5,9 @@ * 2.0. */ import { loggingSystemMock } from '@kbn/core/server/mocks'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; -import { AlertInstanceContext, MaintenanceWindowStatus, RecoveredActionGroup } from '../types'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { AlertInstanceContext } from '../types'; +import { MaintenanceWindowStatus, RecoveredActionGroup } from '../types'; import { LegacyAlertsClient } from './legacy_alerts_client'; import { createAlertFactory, getPublicAlertFactory } from '../alert/create_alert_factory'; import { Alert } from '../alert/alert'; @@ -17,7 +18,7 @@ import { DEFAULT_FLAPPING_SETTINGS } from '../../common/rules_settings'; import { schema } from '@kbn/config-schema'; import { maintenanceWindowsServiceMock } from '../task_runner/maintenance_windows/maintenance_windows_service.mock'; import { getMockMaintenanceWindow } from '../data/maintenance_window/test_helpers'; -import { KibanaRequest } from '@kbn/core/server'; +import type { KibanaRequest } from '@kbn/core/server'; import { alertingEventLoggerMock } from '../lib/alerting_event_logger/alerting_event_logger.mock'; const maintenanceWindowsService = maintenanceWindowsServiceMock.create(); diff --git a/x-pack/plugins/alerting/server/alerts_client/legacy_alerts_client.ts b/x-pack/plugins/alerting/server/alerts_client/legacy_alerts_client.ts index eb77de7d1918a..5738a3d4f8ef2 100644 --- a/x-pack/plugins/alerting/server/alerts_client/legacy_alerts_client.ts +++ b/x-pack/plugins/alerting/server/alerts_client/legacy_alerts_client.ts @@ -4,14 +4,11 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { KibanaRequest, Logger } from '@kbn/core/server'; +import type { KibanaRequest, Logger } from '@kbn/core/server'; import { cloneDeep, keys, merge } from 'lodash'; import { Alert } from '../alert/alert'; -import { - AlertFactory, - createAlertFactory, - getPublicAlertFactory, -} from '../alert/create_alert_factory'; +import type { AlertFactory } from '../alert/create_alert_factory'; +import { createAlertFactory, getPublicAlertFactory } from '../alert/create_alert_factory'; import { determineAlertsToReturn, processAlerts, @@ -20,12 +17,14 @@ import { } from '../lib'; import { trimRecoveredAlerts } from '../lib/trim_recovered_alerts'; import { logAlerts } from '../task_runner/log_alerts'; -import { AlertInstanceContext, AlertInstanceState, WithoutReservedActionGroups } from '../types'; -import { - DEFAULT_FLAPPING_SETTINGS, - RulesSettingsFlappingProperties, -} from '../../common/rules_settings'; -import { +import type { + AlertInstanceContext, + AlertInstanceState, + WithoutReservedActionGroups, +} from '../types'; +import type { RulesSettingsFlappingProperties } from '../../common/rules_settings'; +import { DEFAULT_FLAPPING_SETTINGS } from '../../common/rules_settings'; +import type { IAlertsClient, InitializeExecutionOpts, ProcessAlertsOpts, @@ -33,9 +32,9 @@ import { TrackedAlerts, } from './types'; import { DEFAULT_MAX_ALERTS } from '../config'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; -import { MaintenanceWindowsService } from '../task_runner/maintenance_windows'; -import { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { MaintenanceWindowsService } from '../task_runner/maintenance_windows'; +import type { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; export interface LegacyAlertsClientParams { alertingEventLogger: AlertingEventLogger; @@ -276,7 +275,5 @@ export class LegacyAlertsClient< return null; } - public async setAlertStatusToUntracked() { - return; - } + public async setAlertStatusToUntracked() {} } diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/alert_conflict_resolver.test.ts b/x-pack/plugins/alerting/server/alerts_client/lib/alert_conflict_resolver.test.ts index cc6b43b40da7b..143cb26e3f4e0 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/alert_conflict_resolver.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/alert_conflict_resolver.test.ts @@ -14,7 +14,7 @@ import { ALERT_WORKFLOW_TAGS, EVENT_ACTION, } from '@kbn/rule-data-utils'; -import { +import type { BulkRequest, BulkResponse, BulkResponseItem, diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/alert_conflict_resolver.ts b/x-pack/plugins/alerting/server/alerts_client/lib/alert_conflict_resolver.ts index 55a3a885f1c71..cdf809b59962c 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/alert_conflict_resolver.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/alert_conflict_resolver.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { +import type { BulkRequest, BulkResponse, BulkOperationContainer, MgetResponseItem, } from '@elastic/elasticsearch/lib/api/types'; -import { Logger, ElasticsearchClient } from '@kbn/core/server'; +import type { Logger, ElasticsearchClient } from '@kbn/core/server'; import { ALERT_STATUS, ALERT_STATUS_ACTIVE, diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/build_new_alert.test.ts b/x-pack/plugins/alerting/server/alerts_client/lib/build_new_alert.test.ts index 8c814c528c384..85701cda7c795 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/build_new_alert.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/build_new_alert.test.ts @@ -6,7 +6,7 @@ */ import { Alert as LegacyAlert } from '../../alert/alert'; import { buildNewAlert } from './build_new_alert'; -import { Alert } from '@kbn/alerts-as-data-utils'; +import type { Alert } from '@kbn/alerts-as-data-utils'; import { SPACE_IDS, ALERT_ACTION_GROUP, diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/build_new_alert.ts b/x-pack/plugins/alerting/server/alerts_client/lib/build_new_alert.ts index 223c5a7912814..f086071cd4406 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/build_new_alert.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/build_new_alert.ts @@ -30,9 +30,9 @@ import { ALERT_RULE_EXECUTION_TIMESTAMP, ALERT_SEVERITY_IMPROVING, } from '@kbn/rule-data-utils'; -import { DeepPartial } from '@kbn/utility-types'; -import { Alert as LegacyAlert } from '../../alert/alert'; -import { AlertInstanceContext, AlertInstanceState, RuleAlertData } from '../../types'; +import type { DeepPartial } from '@kbn/utility-types'; +import type { Alert as LegacyAlert } from '../../alert/alert'; +import type { AlertInstanceContext, AlertInstanceState, RuleAlertData } from '../../types'; import type { AlertRule } from '../types'; import { stripFrameworkFields } from './strip_framework_fields'; import { nanosToMicros } from './nanos_to_micros'; diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/build_ongoing_alert.ts b/x-pack/plugins/alerting/server/alerts_client/lib/build_ongoing_alert.ts index 74672cbe0a2cd..568893aea15a1 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/build_ongoing_alert.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/build_ongoing_alert.ts @@ -25,10 +25,10 @@ import { TIMESTAMP, VERSION, } from '@kbn/rule-data-utils'; -import { DeepPartial } from '@kbn/utility-types'; +import type { DeepPartial } from '@kbn/utility-types'; import { get, omit } from 'lodash'; -import { Alert as LegacyAlert } from '../../alert/alert'; -import { AlertInstanceContext, AlertInstanceState, RuleAlertData } from '../../types'; +import type { Alert as LegacyAlert } from '../../alert/alert'; +import type { AlertInstanceContext, AlertInstanceState, RuleAlertData } from '../../types'; import type { AlertRule } from '../types'; import { stripFrameworkFields } from './strip_framework_fields'; import { nanosToMicros } from './nanos_to_micros'; diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/build_recovered_alert.ts b/x-pack/plugins/alerting/server/alerts_client/lib/build_recovered_alert.ts index 92328f7fb94f5..ebd82c2330def 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/build_recovered_alert.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/build_recovered_alert.ts @@ -28,10 +28,10 @@ import { ALERT_SEVERITY_IMPROVING, ALERT_RULE_EXECUTION_UUID, } from '@kbn/rule-data-utils'; -import { DeepPartial } from '@kbn/utility-types'; +import type { DeepPartial } from '@kbn/utility-types'; import { get } from 'lodash'; -import { Alert as LegacyAlert } from '../../alert/alert'; -import { AlertInstanceContext, AlertInstanceState, RuleAlertData } from '../../types'; +import type { Alert as LegacyAlert } from '../../alert/alert'; +import type { AlertInstanceContext, AlertInstanceState, RuleAlertData } from '../../types'; import type { AlertRule } from '../types'; import { stripFrameworkFields } from './strip_framework_fields'; import { nanosToMicros } from './nanos_to_micros'; diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/build_updated_recovered_alert.ts b/x-pack/plugins/alerting/server/alerts_client/lib/build_updated_recovered_alert.ts index ba1e0c4b5f56a..40f5be75dfbb7 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/build_updated_recovered_alert.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/build_updated_recovered_alert.ts @@ -17,10 +17,10 @@ import { ALERT_RULE_EXECUTION_UUID, TIMESTAMP, } from '@kbn/rule-data-utils'; -import { RawAlertInstance } from '@kbn/alerting-state-types'; +import type { RawAlertInstance } from '@kbn/alerting-state-types'; import { get, omit } from 'lodash'; -import { RuleAlertData } from '../../types'; -import { AlertRule } from '../types'; +import type { RuleAlertData } from '../../types'; +import type { AlertRule } from '../types'; import { removeUnflattenedFieldsFromAlert, replaceRefreshableAlertFields } from './format_alert'; interface BuildUpdatedRecoveredAlertOpts { diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/format_alert.ts b/x-pack/plugins/alerting/server/alerts_client/lib/format_alert.ts index 45043bf334be6..d7a8299eb83d2 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/format_alert.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/format_alert.ts @@ -7,7 +7,7 @@ import { cloneDeep, get, isEmpty, isNull, isUndefined, merge, omit } from 'lodash'; import type { Alert } from '@kbn/alerts-as-data-utils'; -import { RuleAlertData } from '../../types'; +import type { RuleAlertData } from '../../types'; import { REFRESH_FIELDS_ALL } from './alert_conflict_resolver'; const expandDottedField = (dottedFieldName: string, val: unknown): object => { diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/format_rule.test.ts b/x-pack/plugins/alerting/server/alerts_client/lib/format_rule.test.ts index c9cc7fbefbfa4..10475cf436e59 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/format_rule.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/format_rule.test.ts @@ -5,7 +5,7 @@ * 2.0. */ import { formatRule } from './format_rule'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; import { RecoveredActionGroup } from '../../types'; import { ALERT_RULE_CATEGORY, diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/format_rule.ts b/x-pack/plugins/alerting/server/alerts_client/lib/format_rule.ts index 33281b918c2a9..130f6033a868f 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/format_rule.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/format_rule.ts @@ -18,7 +18,7 @@ import { SPACE_IDS, } from '@kbn/rule-data-utils'; import type { AlertRule, AlertRuleData } from '../types'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; interface FormatRuleOpts { rule: AlertRuleData; diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/get_summarized_alerts_query.ts b/x-pack/plugins/alerting/server/alerts_client/lib/get_summarized_alerts_query.ts index ab3edece0becc..c2cb59c76d199 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/get_summarized_alerts_query.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/get_summarized_alerts_query.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { +import type { QueryDslQueryContainer, SearchRequest, SearchTotalHits, AggregationsAggregationContainer, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { BoolQuery } from '@kbn/es-query'; +import type { BoolQuery } from '@kbn/es-query'; import { ALERT_END, ALERT_INSTANCE_ID, @@ -23,9 +23,10 @@ import { EVENT_ACTION, TIMESTAMP, } from '@kbn/rule-data-utils'; -import { Alert } from '@kbn/alerts-as-data-utils'; -import { AlertsFilter, ISO_WEEKDAYS, RuleAlertData } from '../../../common'; -import { +import type { Alert } from '@kbn/alerts-as-data-utils'; +import type { AlertsFilter, RuleAlertData } from '../../../common'; +import { ISO_WEEKDAYS } from '../../../common'; +import type { GetLifecycleAlertsQueryByExecutionUuidParams, GetLifecycleAlertsQueryByTimeRangeParams, GetAlertsQueryParams, @@ -36,8 +37,8 @@ import { ScopedQueryAggregationResult, SearchResult, } from '../types'; -import { SummarizedAlertsChunk, ScopedQueryAlerts } from '../..'; -import { FormatAlert } from '../../types'; +import type { SummarizedAlertsChunk, ScopedQueryAlerts } from '../..'; +import type { FormatAlert } from '../../types'; import { expandFlattenedAlert } from './format_alert'; import { injectAnalyzeWildcard } from './inject_analyze_wildcard'; @@ -462,7 +463,7 @@ const getLifecycleAlertsQueries = ({ alertsFilter, }: GetAlertsQueryParams): Array => { let queryBodies; - if (!!executionUuid) { + if (executionUuid) { queryBodies = getLifecycleAlertsQueryByExecutionUuid({ executionUuid: executionUuid!, ruleId, @@ -491,7 +492,7 @@ const getContinualAlertsQuery = ({ alertsFilter, }: GetAlertsQueryParams): SearchRequest['body'] => { let queryBody; - if (!!executionUuid) { + if (executionUuid) { queryBody = getQueryByExecutionUuid({ executionUuid, ruleId, diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/initialize_alerts_client.test.ts b/x-pack/plugins/alerting/server/alerts_client/lib/initialize_alerts_client.test.ts index c97fb9f31f82a..4e731aeab64ff 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/initialize_alerts_client.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/initialize_alerts_client.test.ts @@ -19,11 +19,12 @@ import { ruleRunMetricsStoreMock } from '../../lib/rule_run_metrics_store.mock'; import { alertingEventLoggerMock } from '../../lib/alerting_event_logger/alerting_event_logger.mock'; import { DEFAULT_FLAPPING_SETTINGS } from '../../types'; import { alertsClientMock } from '../alerts_client.mock'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; import { legacyAlertsClientMock } from '../legacy_alerts_client.mock'; -import { initializeAlertsClient, RuleData } from './initialize_alerts_client'; +import type { RuleData } from './initialize_alerts_client'; +import { initializeAlertsClient } from './initialize_alerts_client'; import { maintenanceWindowsServiceMock } from '../../task_runner/maintenance_windows/maintenance_windows_service.mock'; -import { KibanaRequest } from '@kbn/core/server'; +import type { KibanaRequest } from '@kbn/core/server'; const alertingEventLogger = alertingEventLoggerMock.create(); const ruleRunMetricsStore = ruleRunMetricsStoreMock.create(); diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/initialize_alerts_client.ts b/x-pack/plugins/alerting/server/alerts_client/lib/initialize_alerts_client.ts index 97c31ae787427..31055ffb630d4 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/initialize_alerts_client.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/initialize_alerts_client.ts @@ -6,20 +6,20 @@ */ import { DEFAULT_NAMESPACE_STRING } from '@kbn/core-saved-objects-utils-server'; -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; import { LegacyAlertsClient } from '..'; -import { IAlertsClient } from '../types'; -import { AlertsService } from '../../alerts_service'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; -import { +import type { IAlertsClient } from '../types'; +import type { AlertsService } from '../../alerts_service'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { AlertInstanceContext, AlertInstanceState, - DEFAULT_FLAPPING_SETTINGS, RuleAlertData, RuleTypeParams, SanitizedRule, } from '../../types'; -import { RuleTaskInstance, RuleTypeRunnerContext } from '../../task_runner/types'; +import { DEFAULT_FLAPPING_SETTINGS } from '../../types'; +import type { RuleTaskInstance, RuleTypeRunnerContext } from '../../task_runner/types'; export type RuleData = Pick< SanitizedRule, diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/inject_analyze_wildcard.ts b/x-pack/plugins/alerting/server/alerts_client/lib/inject_analyze_wildcard.ts index 58a4f89948973..70646c976c6dc 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/inject_analyze_wildcard.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/inject_analyze_wildcard.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; export const injectAnalyzeWildcard = (query: QueryDslQueryContainer): void => { if (!query) { diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/is_alert_improving.test.ts b/x-pack/plugins/alerting/server/alerts_client/lib/is_alert_improving.test.ts index e2b4136dac163..cf819a69a3515 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/is_alert_improving.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/is_alert_improving.test.ts @@ -11,7 +11,7 @@ import { ALERT_ACTION_GROUP } from '@kbn/rule-data-utils'; import { Alert as LegacyAlert } from '../../alert'; import { isAlertImproving } from './is_alert_improving'; import { existingExpandedNewAlert, existingFlattenedNewAlert } from './test_fixtures'; -import { ActionGroup } from '../../types'; +import type { ActionGroup } from '../../types'; const actionGroupsWithSeverity: Array> = [ { id: 'info', name: 'Info', severity: { level: 0 } }, diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/is_alert_improving.ts b/x-pack/plugins/alerting/server/alerts_client/lib/is_alert_improving.ts index cf8b3205606ee..e495367226ba5 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/is_alert_improving.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/is_alert_improving.ts @@ -8,8 +8,13 @@ import { get } from 'lodash'; import type { Alert } from '@kbn/alerts-as-data-utils'; import { ALERT_ACTION_GROUP } from '@kbn/rule-data-utils'; -import { Alert as LegacyAlert } from '../../alert'; -import { ActionGroup, AlertInstanceState, AlertInstanceContext, RuleAlertData } from '../../types'; +import type { Alert as LegacyAlert } from '../../alert'; +import type { + ActionGroup, + AlertInstanceState, + AlertInstanceContext, + RuleAlertData, +} from '../../types'; export const isAlertImproving = < AlertData extends RuleAlertData, diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/sanitize_bulk_response.test.ts b/x-pack/plugins/alerting/server/alerts_client/lib/sanitize_bulk_response.test.ts index 533bb5b554ae9..e397a6c0e162b 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/sanitize_bulk_response.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/sanitize_bulk_response.test.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { TransportResult } from '@elastic/elasticsearch'; +import type { TransportResult } from '@elastic/elasticsearch'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { sanitizeBulkErrorResponse } from './sanitize_bulk_response'; diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/sanitize_bulk_response.ts b/x-pack/plugins/alerting/server/alerts_client/lib/sanitize_bulk_response.ts index 0c18500c3bd5f..f5ae6dd2eb749 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/sanitize_bulk_response.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/sanitize_bulk_response.ts @@ -5,7 +5,7 @@ * 2.0. */ import { cloneDeep } from 'lodash'; -import { TransportResult } from '@elastic/elasticsearch'; +import type { TransportResult } from '@elastic/elasticsearch'; import { get } from 'lodash'; import { set } from '@kbn/safer-lodash-set'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/strip_framework_fields.ts b/x-pack/plugins/alerting/server/alerts_client/lib/strip_framework_fields.ts index bc55f72147d62..5c9ad368cddec 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/strip_framework_fields.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/strip_framework_fields.ts @@ -8,7 +8,7 @@ import { omit } from 'lodash'; import { ALERT_REASON, ALERT_WORKFLOW_STATUS, TAGS, ALERT_URL } from '@kbn/rule-data-utils'; import { alertFieldMap } from '@kbn/alerts-as-data-utils'; -import { RuleAlertData } from '../../types'; +import type { RuleAlertData } from '../../types'; const allowedFrameworkFields = new Set([ ALERT_REASON, diff --git a/x-pack/plugins/alerting/server/alerts_client/lib/test_fixtures.ts b/x-pack/plugins/alerting/server/alerts_client/lib/test_fixtures.ts index a0ce91d145911..e4e6d1e194e2d 100644 --- a/x-pack/plugins/alerting/server/alerts_client/lib/test_fixtures.ts +++ b/x-pack/plugins/alerting/server/alerts_client/lib/test_fixtures.ts @@ -37,7 +37,7 @@ import { ALERT_END, ALERT_SEVERITY_IMPROVING, } from '@kbn/rule-data-utils'; -import { AlertRule } from '../types'; +import type { AlertRule } from '../types'; import { expandFlattenedAlert } from './format_alert'; export const rule = { diff --git a/x-pack/plugins/alerting/server/alerts_client/types.ts b/x-pack/plugins/alerting/server/alerts_client/types.ts index f3c4a85fa1b71..c294cb2ecbf2c 100644 --- a/x-pack/plugins/alerting/server/alerts_client/types.ts +++ b/x-pack/plugins/alerting/server/alerts_client/types.ts @@ -6,9 +6,9 @@ */ import type { Alert } from '@kbn/alerts-as-data-utils'; -import { DeepPartial } from '@kbn/utility-types'; -import { SearchResponseBody } from '@elastic/elasticsearch/lib/api/types'; -import { +import type { DeepPartial } from '@kbn/utility-types'; +import type { SearchResponseBody } from '@elastic/elasticsearch/lib/api/types'; +import type { ALERT_RULE_CATEGORY, ALERT_RULE_CONSUMER, ALERT_RULE_EXECUTION_UUID, @@ -22,8 +22,8 @@ import { ALERT_UUID, SPACE_IDS, } from '@kbn/rule-data-utils'; -import { Alert as LegacyAlert } from '../alert/alert'; -import { +import type { Alert as LegacyAlert } from '../alert/alert'; +import type { AlertInstanceContext, AlertInstanceState, AlertsFilter, @@ -32,11 +32,11 @@ import { RuleAlertData, WithoutReservedActionGroups, } from '../types'; -import { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; -import { RuleRunMetricsStore } from '../lib/rule_run_metrics_store'; -import { RulesSettingsFlappingProperties } from '../../common/rules_settings'; +import type { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; +import type { RuleRunMetricsStore } from '../lib/rule_run_metrics_store'; +import type { RulesSettingsFlappingProperties } from '../../common/rules_settings'; import type { PublicAlertFactory } from '../alert/create_alert_factory'; -import { MaintenanceWindow } from '../application/maintenance_window/types'; +import type { MaintenanceWindow } from '../application/maintenance_window/types'; export interface AlertRuleData { consumer: string; diff --git a/x-pack/plugins/alerting/server/alerts_service/alerts_service.test.ts b/x-pack/plugins/alerting/server/alerts_service/alerts_service.test.ts index 4b4f632d4cb20..e43ff7e40b431 100644 --- a/x-pack/plugins/alerting/server/alerts_service/alerts_service.test.ts +++ b/x-pack/plugins/alerting/server/alerts_service/alerts_service.test.ts @@ -7,22 +7,23 @@ import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mocks'; import { elasticsearchClientMock } from '@kbn/core-elasticsearch-client-server-mocks'; -import { +import type { IndicesGetDataStreamResponse, IndicesDataStreamIndex, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { errors as EsErrors } from '@elastic/elasticsearch'; import { ReplaySubject, Subject, of } from 'rxjs'; import { AlertsService } from './alerts_service'; -import { IRuleTypeAlerts, RecoveredActionGroup } from '../types'; +import type { IRuleTypeAlerts } from '../types'; +import { RecoveredActionGroup } from '../types'; import { retryUntil } from './test_utils'; import { DEFAULT_NAMESPACE_STRING } from '@kbn/core-saved-objects-utils-server'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; import { AlertsClient } from '../alerts_client'; import { alertsClientMock } from '../alerts_client/alerts_client.mock'; import { getDataStreamAdapter } from './lib/data_stream_adapter'; import { maintenanceWindowsServiceMock } from '../task_runner/maintenance_windows/maintenance_windows_service.mock'; -import { KibanaRequest } from '@kbn/core/server'; +import type { KibanaRequest } from '@kbn/core/server'; import { alertingEventLoggerMock } from '../lib/alerting_event_logger/alerting_event_logger.mock'; jest.mock('../alerts_client'); diff --git a/x-pack/plugins/alerting/server/alerts_service/alerts_service.ts b/x-pack/plugins/alerting/server/alerts_service/alerts_service.ts index 4f0ead6c54206..4d3497d6d8d39 100644 --- a/x-pack/plugins/alerting/server/alerts_service/alerts_service.ts +++ b/x-pack/plugins/alerting/server/alerts_service/alerts_service.ts @@ -6,8 +6,9 @@ */ import { isEmpty, isEqual, omit } from 'lodash'; -import { Logger, ElasticsearchClient } from '@kbn/core/server'; -import { filter, firstValueFrom, Observable } from 'rxjs'; +import type { Logger, ElasticsearchClient } from '@kbn/core/server'; +import type { Observable } from 'rxjs'; +import { filter, firstValueFrom } from 'rxjs'; import { alertFieldMap, ecsFieldMap, legacyAlertFieldMap } from '@kbn/alerts-as-data-utils'; import { DEFAULT_NAMESPACE_STRING } from '@kbn/core-saved-objects-utils-server'; import { @@ -19,18 +20,20 @@ import { getComponentTemplateName, getIndexTemplateAndPattern, } from './resource_installer_utils'; -import { +import type { AlertInstanceContext, AlertInstanceState, IRuleTypeAlerts, RuleAlertData, DataStreamAdapter, } from '../types'; +import type { + InitializationPromise, + ResourceInstallationHelper, +} from './create_resource_installation_helper'; import { createResourceInstallationHelper, errorResult, - InitializationPromise, - ResourceInstallationHelper, successResult, } from './create_resource_installation_helper'; import { @@ -44,8 +47,9 @@ import { } from './lib'; import type { LegacyAlertsClientParams, AlertRuleData } from '../alerts_client'; import { AlertsClient } from '../alerts_client'; -import { IAlertsClient } from '../alerts_client/types'; -import { setAlertsToUntracked, SetAlertsToUntrackedParams } from './lib/set_alerts_to_untracked'; +import type { IAlertsClient } from '../alerts_client/types'; +import type { SetAlertsToUntrackedParams } from './lib/set_alerts_to_untracked'; +import { setAlertsToUntracked } from './lib/set_alerts_to_untracked'; export const TOTAL_FIELDS_LIMIT = 2500; const LEGACY_ALERT_CONTEXT = 'legacy-alert'; diff --git a/x-pack/plugins/alerting/server/alerts_service/create_resource_installation_helper.test.ts b/x-pack/plugins/alerting/server/alerts_service/create_resource_installation_helper.test.ts index 872ce7fc43920..0531506137026 100644 --- a/x-pack/plugins/alerting/server/alerts_service/create_resource_installation_helper.test.ts +++ b/x-pack/plugins/alerting/server/alerts_service/create_resource_installation_helper.test.ts @@ -8,12 +8,14 @@ import { range } from 'lodash'; import { DEFAULT_NAMESPACE_STRING } from '@kbn/core-saved-objects-utils-server'; import { loggingSystemMock } from '@kbn/core/server/mocks'; -import { IRuleTypeAlerts } from '../types'; +import type { IRuleTypeAlerts } from '../types'; +import type { + InitializationPromise, + ResourceInstallationHelper, +} from './create_resource_installation_helper'; import { createResourceInstallationHelper, errorResult, - InitializationPromise, - ResourceInstallationHelper, successResult, calculateDelay, getShouldRetry, diff --git a/x-pack/plugins/alerting/server/alerts_service/create_resource_installation_helper.ts b/x-pack/plugins/alerting/server/alerts_service/create_resource_installation_helper.ts index 3e62dad46606c..07be499e08c30 100644 --- a/x-pack/plugins/alerting/server/alerts_service/create_resource_installation_helper.ts +++ b/x-pack/plugins/alerting/server/alerts_service/create_resource_installation_helper.ts @@ -6,8 +6,8 @@ */ import { DEFAULT_NAMESPACE_STRING } from '@kbn/core-saved-objects-utils-server'; -import { Logger } from '@kbn/core/server'; -import { IRuleTypeAlerts } from '../types'; +import type { Logger } from '@kbn/core/server'; +import type { IRuleTypeAlerts } from '../types'; export interface InitializationPromise { result: boolean; diff --git a/x-pack/plugins/alerting/server/alerts_service/default_lifecycle_policy.ts b/x-pack/plugins/alerting/server/alerts_service/default_lifecycle_policy.ts index 67230f1c35da0..b694b594cf31a 100644 --- a/x-pack/plugins/alerting/server/alerts_service/default_lifecycle_policy.ts +++ b/x-pack/plugins/alerting/server/alerts_service/default_lifecycle_policy.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IlmPolicy } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { IlmPolicy } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; /** * Default alert index ILM policy diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/create_concrete_write_index.test.ts b/x-pack/plugins/alerting/server/alerts_service/lib/create_concrete_write_index.test.ts index f8e2f8c089529..6f5bd3a60fd85 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/create_concrete_write_index.test.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/create_concrete_write_index.test.ts @@ -6,7 +6,7 @@ */ import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mocks'; import { errors as EsErrors } from '@elastic/elasticsearch'; -import { IndicesGetDataStreamResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { IndicesGetDataStreamResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { createConcreteWriteIndex, setConcreteWriteIndex } from './create_concrete_write_index'; import { getDataStreamAdapter } from './data_stream_adapter'; diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/create_concrete_write_index.ts b/x-pack/plugins/alerting/server/alerts_service/lib/create_concrete_write_index.ts index cc298ed3cd7d2..dffb1283d8cb3 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/create_concrete_write_index.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/create_concrete_write_index.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { IndicesSimulateIndexTemplateResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { Logger, ElasticsearchClient } from '@kbn/core/server'; +import type { IndicesSimulateIndexTemplateResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { Logger, ElasticsearchClient } from '@kbn/core/server'; import { get, sortBy } from 'lodash'; -import { IIndexPatternString } from '../resource_installer_utils'; +import type { IIndexPatternString } from '../resource_installer_utils'; import { retryTransientEsErrors } from './retry_transient_es_errors'; -import { DataStreamAdapter } from './data_stream_adapter'; +import type { DataStreamAdapter } from './data_stream_adapter'; export interface ConcreteIndexInfo { index: string; @@ -49,7 +49,6 @@ const updateTotalFieldLimitSetting = async ({ }), { logger } ); - return; } catch (err) { logger.error( `Failed to PUT index.mapping.total_fields.limit settings for ${alias}: ${err.message}` @@ -93,8 +92,6 @@ const updateUnderlyingMapping = async ({ () => esClient.indices.putMapping({ index, body: simulatedMapping }), { logger } ); - - return; } catch (err) { logger.error(`Failed to PUT mapping for ${alias}: ${err.message}`); throw err; diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_component_template.ts b/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_component_template.ts index 118ad5de97198..924037c205f64 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_component_template.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_component_template.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { +import type { ClusterPutComponentTemplateRequest, IndicesGetIndexTemplateIndexTemplateItem, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { Logger, ElasticsearchClient } from '@kbn/core/server'; +import type { Logger, ElasticsearchClient } from '@kbn/core/server'; import { asyncForEach } from '@kbn/std'; import { retryTransientEsErrors } from './retry_transient_es_errors'; diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_ilm_policy.ts b/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_ilm_policy.ts index 4ba14dbe3956b..3b6b85028bfa1 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_ilm_policy.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_ilm_policy.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { IlmPolicy } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { Logger, ElasticsearchClient } from '@kbn/core/server'; +import type { IlmPolicy } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { Logger, ElasticsearchClient } from '@kbn/core/server'; import { retryTransientEsErrors } from './retry_transient_es_errors'; -import { DataStreamAdapter } from './data_stream_adapter'; +import type { DataStreamAdapter } from './data_stream_adapter'; interface CreateOrUpdateIlmPolicyOpts { logger: Logger; diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_index_template.test.ts b/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_index_template.test.ts index 85113b768860a..638cedc2dbb75 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_index_template.test.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_index_template.test.ts @@ -8,7 +8,7 @@ import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mo import { errors as EsErrors } from '@elastic/elasticsearch'; import { getIndexTemplate, createOrUpdateIndexTemplate } from './create_or_update_index_template'; import { createDataStreamAdapterMock } from './data_stream_adapter.mock'; -import { DataStreamAdapter } from './data_stream_adapter'; +import type { DataStreamAdapter } from './data_stream_adapter'; const randomDelayMultiplier = 0.01; const logger = loggingSystemMock.createLogger(); diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_index_template.ts b/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_index_template.ts index 503e3848fa658..c01ef9ba5350d 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_index_template.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/create_or_update_index_template.ts @@ -5,16 +5,16 @@ * 2.0. */ -import { +import type { IndicesPutIndexTemplateRequest, MappingTypeMapping, Metadata, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { Logger, ElasticsearchClient } from '@kbn/core/server'; +import type { Logger, ElasticsearchClient } from '@kbn/core/server'; import { isEmpty } from 'lodash'; -import { IIndexPatternString } from '../resource_installer_utils'; +import type { IIndexPatternString } from '../resource_installer_utils'; import { retryTransientEsErrors } from './retry_transient_es_errors'; -import { DataStreamAdapter } from './data_stream_adapter'; +import type { DataStreamAdapter } from './data_stream_adapter'; interface GetIndexTemplateOpts { componentTemplateRefs: string[]; diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/data_stream_adapter.mock.ts b/x-pack/plugins/alerting/server/alerts_service/lib/data_stream_adapter.mock.ts index 8de9f7bcc1731..5a767044c90ea 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/data_stream_adapter.mock.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/data_stream_adapter.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { DataStreamAdapter, GetDataStreamAdapterOpts } from './data_stream_adapter'; +import type { DataStreamAdapter, GetDataStreamAdapterOpts } from './data_stream_adapter'; export function createDataStreamAdapterMock(opts?: GetDataStreamAdapterOpts): DataStreamAdapter { return { diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/data_stream_adapter.ts b/x-pack/plugins/alerting/server/alerts_service/lib/data_stream_adapter.ts index 98cd0b67ff05a..01a1c177ddf8f 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/data_stream_adapter.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/data_stream_adapter.ts @@ -6,12 +6,11 @@ */ // eslint-disable-next-line max-classes-per-file -import { +import type { CreateConcreteWriteIndexOpts, ConcreteIndexInfo, - updateIndexMappings, - setConcreteWriteIndex, } from './create_concrete_write_index'; +import { updateIndexMappings, setConcreteWriteIndex } from './create_concrete_write_index'; import { retryTransientEsErrors } from './retry_transient_es_errors'; export interface DataStreamAdapter { diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/install_with_timeout.test.ts b/x-pack/plugins/alerting/server/alerts_service/lib/install_with_timeout.test.ts index 83961c1c8fbfd..57d0be00e0bf6 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/install_with_timeout.test.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/install_with_timeout.test.ts @@ -7,7 +7,8 @@ import { loggerMock } from '@kbn/logging-mocks'; import { installWithTimeout } from './install_with_timeout'; -import { ReplaySubject, Subject } from 'rxjs'; +import type { Subject } from 'rxjs'; +import { ReplaySubject } from 'rxjs'; const logger = loggerMock.create(); diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/install_with_timeout.ts b/x-pack/plugins/alerting/server/alerts_service/lib/install_with_timeout.ts index e93dcf2e09f34..35d95f1e1edd9 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/install_with_timeout.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/install_with_timeout.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { firstValueFrom, Observable } from 'rxjs'; -import { Logger } from '@kbn/core/server'; +import type { Observable } from 'rxjs'; +import { firstValueFrom } from 'rxjs'; +import type { Logger } from '@kbn/core/server'; const INSTALLATION_TIMEOUT = 20 * 60 * 1000; // 20 minutes diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/retry_transient_es_errors.ts b/x-pack/plugins/alerting/server/alerts_service/lib/retry_transient_es_errors.ts index 2df03e65690f1..519ac21d3af30 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/retry_transient_es_errors.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/retry_transient_es_errors.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; import { errors as EsErrors } from '@elastic/elasticsearch'; const MAX_ATTEMPTS = 3; diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/set_alerts_to_untracked.test.ts b/x-pack/plugins/alerting/server/alerts_service/lib/set_alerts_to_untracked.test.ts index 54376012aa767..08353ceb1e596 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/set_alerts_to_untracked.test.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/set_alerts_to_untracked.test.ts @@ -4,11 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { - ElasticsearchClientMock, - elasticsearchServiceMock, - loggingSystemMock, -} from '@kbn/core/server/mocks'; +import type { ElasticsearchClientMock } from '@kbn/core/server/mocks'; +import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mocks'; import { ALERT_RULE_UUID, ALERT_UUID } from '@kbn/rule-data-utils'; import { setAlertsToUntracked } from './set_alerts_to_untracked'; diff --git a/x-pack/plugins/alerting/server/alerts_service/lib/set_alerts_to_untracked.ts b/x-pack/plugins/alerting/server/alerts_service/lib/set_alerts_to_untracked.ts index ed0c2cb21e06b..58d38d217524d 100644 --- a/x-pack/plugins/alerting/server/alerts_service/lib/set_alerts_to_untracked.ts +++ b/x-pack/plugins/alerting/server/alerts_service/lib/set_alerts_to_untracked.ts @@ -6,8 +6,9 @@ */ import { isEmpty } from 'lodash'; -import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; -import { Logger } from '@kbn/logging'; +import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; +import type { Logger } from '@kbn/logging'; +import type { AlertStatus } from '@kbn/rule-data-utils'; import { ALERT_END, ALERT_RULE_CONSUMER, @@ -18,7 +19,6 @@ import { ALERT_STATUS_UNTRACKED, ALERT_TIME_RANGE, ALERT_UUID, - AlertStatus, } from '@kbn/rule-data-utils'; import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { AlertingAuthorizationEntity } from '../../authorization/alerting_authorization'; diff --git a/x-pack/plugins/alerting/server/alerts_service/resource_installer_utils.ts b/x-pack/plugins/alerting/server/alerts_service/resource_installer_utils.ts index d1c2c2c6e734e..9ee05d8959b65 100644 --- a/x-pack/plugins/alerting/server/alerts_service/resource_installer_utils.ts +++ b/x-pack/plugins/alerting/server/alerts_service/resource_installer_utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ClusterPutComponentTemplateRequest } from '@elastic/elasticsearch/lib/api/types'; +import type { ClusterPutComponentTemplateRequest } from '@elastic/elasticsearch/lib/api/types'; import type { FieldMap } from '@kbn/alerts-as-data-utils'; import { getComponentTemplateFromFieldMap } from '../../common'; diff --git a/x-pack/plugins/alerting/server/application/alerts_filter_query/types/alerts_filter_query.ts b/x-pack/plugins/alerting/server/application/alerts_filter_query/types/alerts_filter_query.ts index 926d27e89fa94..ad8a64318a4bf 100644 --- a/x-pack/plugins/alerting/server/application/alerts_filter_query/types/alerts_filter_query.ts +++ b/x-pack/plugins/alerting/server/application/alerts_filter_query/types/alerts_filter_query.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { alertsFilterQuerySchema } from '../schemas/alerts_filter_query_schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { alertsFilterQuerySchema } from '../schemas/alerts_filter_query_schemas'; export type AlertsFilterQuery = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/backfill/methods/delete/delete_backfill.test.ts b/x-pack/plugins/alerting/server/application/backfill/methods/delete/delete_backfill.test.ts index b0879613d069f..36037acf85634 100644 --- a/x-pack/plugins/alerting/server/application/backfill/methods/delete/delete_backfill.test.ts +++ b/x-pack/plugins/alerting/server/application/backfill/methods/delete/delete_backfill.test.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; import { RULE_SAVED_OBJECT_TYPE } from '../../../..'; -import { AlertingAuthorization } from '../../../../authorization'; +import type { AlertingAuthorization } from '../../../../authorization'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; @@ -21,12 +21,13 @@ import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { ConstructorOptions, RulesClient } from '../../../../rules_client'; +import type { ConstructorOptions } from '../../../../rules_client'; +import { RulesClient } from '../../../../rules_client'; import { adHocRunStatus } from '../../../../../common/constants'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { SavedObject } from '@kbn/core-saved-objects-api-server'; -import { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; +import type { SavedObject } from '@kbn/core-saved-objects-api-server'; +import type { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; import { SavedObjectsErrorHelpers } from '@kbn/core/server'; const kibanaVersion = 'v8.0.0'; diff --git a/x-pack/plugins/alerting/server/application/backfill/methods/delete/delete_backfill.ts b/x-pack/plugins/alerting/server/application/backfill/methods/delete/delete_backfill.ts index d223f944305c7..545fd6f3b24d4 100644 --- a/x-pack/plugins/alerting/server/application/backfill/methods/delete/delete_backfill.ts +++ b/x-pack/plugins/alerting/server/application/backfill/methods/delete/delete_backfill.ts @@ -7,9 +7,9 @@ import Boom from '@hapi/boom'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; -import { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; +import type { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { RulesClientContext } from '../../../../rules_client'; +import type { RulesClientContext } from '../../../../rules_client'; import { AlertingAuthorizationEntity, WriteOperations } from '../../../../authorization'; import { AdHocRunAuditAction, diff --git a/x-pack/plugins/alerting/server/application/backfill/methods/find/find_backfill.test.ts b/x-pack/plugins/alerting/server/application/backfill/methods/find/find_backfill.test.ts index dab9d5f38f036..f9e94773aa9d6 100644 --- a/x-pack/plugins/alerting/server/application/backfill/methods/find/find_backfill.test.ts +++ b/x-pack/plugins/alerting/server/application/backfill/methods/find/find_backfill.test.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; import { RULE_SAVED_OBJECT_TYPE } from '../../../..'; -import { AlertingAuthorization } from '../../../../authorization'; +import type { AlertingAuthorization } from '../../../../authorization'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; @@ -22,11 +22,12 @@ import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/s import { fromKueryExpression } from '@kbn/es-query'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { ConstructorOptions, RulesClient } from '../../../../rules_client'; +import type { ConstructorOptions } from '../../../../rules_client'; +import { RulesClient } from '../../../../rules_client'; import { adHocRunStatus } from '../../../../../common/constants'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; -import { SavedObject } from '@kbn/core/server'; -import { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; +import type { SavedObject } from '@kbn/core/server'; +import type { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { transformAdHocRunToBackfillResult } from '../../transforms'; diff --git a/x-pack/plugins/alerting/server/application/backfill/methods/find/find_backfill.ts b/x-pack/plugins/alerting/server/application/backfill/methods/find/find_backfill.ts index 522128d0385f8..814426d3f5dab 100644 --- a/x-pack/plugins/alerting/server/application/backfill/methods/find/find_backfill.ts +++ b/x-pack/plugins/alerting/server/application/backfill/methods/find/find_backfill.ts @@ -6,11 +6,12 @@ */ import Boom from '@hapi/boom'; -import { KueryNode, nodeBuilder } from '@kbn/es-query'; -import { SavedObject, SavedObjectsFindOptionsReference } from '@kbn/core/server'; +import type { KueryNode } from '@kbn/es-query'; +import { nodeBuilder } from '@kbn/es-query'; +import type { SavedObject, SavedObjectsFindOptionsReference } from '@kbn/core/server'; import { buildKueryNodeFilter } from '../../../../rules_client/common'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE, RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { RulesClientContext } from '../../../../rules_client'; +import type { RulesClientContext } from '../../../../rules_client'; import { AlertingAuthorizationEntity, AlertingAuthorizationFilterType, @@ -21,9 +22,9 @@ import { } from '../../../../rules_client/common/audit_events'; import type { FindBackfillParams, FindBackfillResult } from './types'; import { findBackfillQuerySchema } from './schemas'; -import { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; +import type { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; import { transformAdHocRunToBackfillResult } from '../../transforms'; -import { Backfill } from '../../result/types'; +import type { Backfill } from '../../result/types'; export async function findBackfill( context: RulesClientContext, diff --git a/x-pack/plugins/alerting/server/application/backfill/methods/find/types/index.ts b/x-pack/plugins/alerting/server/application/backfill/methods/find/types/index.ts index 8d88732bcad0d..3d8b3a494be91 100644 --- a/x-pack/plugins/alerting/server/application/backfill/methods/find/types/index.ts +++ b/x-pack/plugins/alerting/server/application/backfill/methods/find/types/index.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { findBackfillQuerySchema, findBackfillResultSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { findBackfillQuerySchema, findBackfillResultSchema } from '../schemas'; export type FindBackfillParams = TypeOf; export type FindBackfillResult = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/backfill/methods/get/get_backfill.test.ts b/x-pack/plugins/alerting/server/application/backfill/methods/get/get_backfill.test.ts index cbf516bfd446e..945c231a03d62 100644 --- a/x-pack/plugins/alerting/server/application/backfill/methods/get/get_backfill.test.ts +++ b/x-pack/plugins/alerting/server/application/backfill/methods/get/get_backfill.test.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; import { RULE_SAVED_OBJECT_TYPE } from '../../../..'; -import { AlertingAuthorization } from '../../../../authorization'; +import type { AlertingAuthorization } from '../../../../authorization'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; @@ -21,13 +21,14 @@ import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { ConstructorOptions, RulesClient } from '../../../../rules_client'; +import type { ConstructorOptions } from '../../../../rules_client'; +import { RulesClient } from '../../../../rules_client'; import { adHocRunStatus } from '../../../../../common/constants'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { transformAdHocRunToBackfillResult } from '../../transforms'; -import { SavedObject } from '@kbn/core-saved-objects-api-server'; -import { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; +import type { SavedObject } from '@kbn/core-saved-objects-api-server'; +import type { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; const kibanaVersion = 'v8.0.0'; const taskManager = taskManagerMock.createStart(); diff --git a/x-pack/plugins/alerting/server/application/backfill/methods/get/get_backfill.ts b/x-pack/plugins/alerting/server/application/backfill/methods/get/get_backfill.ts index 6f14dba88684c..565ca9e4c8181 100644 --- a/x-pack/plugins/alerting/server/application/backfill/methods/get/get_backfill.ts +++ b/x-pack/plugins/alerting/server/application/backfill/methods/get/get_backfill.ts @@ -6,15 +6,15 @@ */ import Boom from '@hapi/boom'; -import { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; +import type { AdHocRunSO } from '../../../../data/ad_hoc_run/types'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { RulesClientContext } from '../../../../rules_client'; +import type { RulesClientContext } from '../../../../rules_client'; import { ReadOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { AdHocRunAuditAction, adHocRunAuditEvent, } from '../../../../rules_client/common/audit_events'; -import { Backfill } from '../../result/types'; +import type { Backfill } from '../../result/types'; import { transformAdHocRunToBackfillResult } from '../../transforms'; export async function getBackfill(context: RulesClientContext, id: string): Promise { diff --git a/x-pack/plugins/alerting/server/application/backfill/methods/schedule/schedule_backfill.test.ts b/x-pack/plugins/alerting/server/application/backfill/methods/schedule/schedule_backfill.test.ts index b8f1e5af9c869..d6c96935cd1ae 100644 --- a/x-pack/plugins/alerting/server/application/backfill/methods/schedule/schedule_backfill.test.ts +++ b/x-pack/plugins/alerting/server/application/backfill/methods/schedule/schedule_backfill.test.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; import { RULE_SAVED_OBJECT_TYPE } from '../../../..'; -import { AlertingAuthorization } from '../../../../authorization'; +import type { AlertingAuthorization } from '../../../../authorization'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; @@ -24,8 +24,9 @@ import { fromKueryExpression } from '@kbn/es-query'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { asyncForEach } from '@kbn/std'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { ConstructorOptions, RulesClient } from '../../../../rules_client'; -import { ScheduleBackfillParam } from './types'; +import type { ConstructorOptions } from '../../../../rules_client'; +import { RulesClient } from '../../../../rules_client'; +import type { ScheduleBackfillParam } from './types'; import { adHocRunStatus } from '../../../../../common/constants'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/application/backfill/methods/schedule/schedule_backfill.ts b/x-pack/plugins/alerting/server/application/backfill/methods/schedule/schedule_backfill.ts index 534262aa31c31..67f629d4be274 100644 --- a/x-pack/plugins/alerting/server/application/backfill/methods/schedule/schedule_backfill.ts +++ b/x-pack/plugins/alerting/server/application/backfill/methods/schedule/schedule_backfill.ts @@ -7,8 +7,9 @@ import pMap from 'p-map'; import Boom from '@hapi/boom'; -import { KueryNode, nodeBuilder } from '@kbn/es-query'; -import { SavedObjectsFindResult } from '@kbn/core/server'; +import type { KueryNode } from '@kbn/es-query'; +import { nodeBuilder } from '@kbn/es-query'; +import type { SavedObjectsFindResult } from '@kbn/core/server'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { findRulesSo } from '../../../../data/rule'; import { @@ -16,7 +17,7 @@ import { RULE_TYPE_CHECKS_CONCURRENCY, } from '../../../../rules_client/common/constants'; import { convertRuleIdsToKueryNode } from '../../../../lib'; -import { RuleBulkOperationAggregation, RulesClientContext } from '../../../../rules_client'; +import type { RuleBulkOperationAggregation, RulesClientContext } from '../../../../rules_client'; import { AlertingAuthorizationEntity, WriteOperations } from '../../../../authorization'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; import type { @@ -26,7 +27,7 @@ import type { } from './types'; import { scheduleBackfillParamsSchema } from './schemas'; import { transformRuleAttributesToRuleDomain } from '../../../rule/transforms'; -import { RawRule } from '../../../../types'; +import type { RawRule } from '../../../../types'; export async function scheduleBackfill( context: RulesClientContext, diff --git a/x-pack/plugins/alerting/server/application/backfill/methods/schedule/types/index.ts b/x-pack/plugins/alerting/server/application/backfill/methods/schedule/types/index.ts index bd7f3e4e371ae..5c94bcb923ab3 100644 --- a/x-pack/plugins/alerting/server/application/backfill/methods/schedule/types/index.ts +++ b/x-pack/plugins/alerting/server/application/backfill/methods/schedule/types/index.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { +import type { TypeOf } from '@kbn/config-schema'; +import type { scheduleBackfillErrorSchema, scheduleBackfillParamSchema, scheduleBackfillParamsSchema, diff --git a/x-pack/plugins/alerting/server/application/backfill/result/types/index.ts b/x-pack/plugins/alerting/server/application/backfill/result/types/index.ts index f62663894ca89..7b8b3ae3f31a3 100644 --- a/x-pack/plugins/alerting/server/application/backfill/result/types/index.ts +++ b/x-pack/plugins/alerting/server/application/backfill/result/types/index.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { backfillSchema, backfillScheduleSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { backfillSchema, backfillScheduleSchema } from '../schemas'; export type BackfillSchedule = TypeOf; export type Backfill = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/backfill/transforms/transform_ad_hoc_run_to_backfill_result.test.ts b/x-pack/plugins/alerting/server/application/backfill/transforms/transform_ad_hoc_run_to_backfill_result.test.ts index 995240cbbd023..5d7ada3c154e0 100644 --- a/x-pack/plugins/alerting/server/application/backfill/transforms/transform_ad_hoc_run_to_backfill_result.test.ts +++ b/x-pack/plugins/alerting/server/application/backfill/transforms/transform_ad_hoc_run_to_backfill_result.test.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { AdHocRunSO } from '../../../data/ad_hoc_run/types'; -import { SavedObject } from '@kbn/core/server'; +import type { AdHocRunSO } from '../../../data/ad_hoc_run/types'; +import type { SavedObject } from '@kbn/core/server'; import { adHocRunStatus } from '../../../../common/constants'; import { transformAdHocRunToBackfillResult } from './transform_ad_hoc_run_to_backfill_result'; diff --git a/x-pack/plugins/alerting/server/application/backfill/transforms/transform_ad_hoc_run_to_backfill_result.ts b/x-pack/plugins/alerting/server/application/backfill/transforms/transform_ad_hoc_run_to_backfill_result.ts index 13257742b7005..2fb5934e784e0 100644 --- a/x-pack/plugins/alerting/server/application/backfill/transforms/transform_ad_hoc_run_to_backfill_result.ts +++ b/x-pack/plugins/alerting/server/application/backfill/transforms/transform_ad_hoc_run_to_backfill_result.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObject, SavedObjectsBulkCreateObject } from '@kbn/core/server'; -import { AdHocRunSO } from '../../../data/ad_hoc_run/types'; +import type { SavedObject, SavedObjectsBulkCreateObject } from '@kbn/core/server'; +import type { AdHocRunSO } from '../../../data/ad_hoc_run/types'; import { createBackfillError } from '../../../backfill_client/lib'; -import { ScheduleBackfillResult } from '../methods/schedule/types'; +import type { ScheduleBackfillResult } from '../methods/schedule/types'; export const transformAdHocRunToBackfillResult = ( { id, attributes, references, error }: SavedObject, diff --git a/x-pack/plugins/alerting/server/application/backfill/transforms/transform_backfill_param_to_ad_hoc_run.test.ts b/x-pack/plugins/alerting/server/application/backfill/transforms/transform_backfill_param_to_ad_hoc_run.test.ts index 0dd1995e05b98..211048cd1b208 100644 --- a/x-pack/plugins/alerting/server/application/backfill/transforms/transform_backfill_param_to_ad_hoc_run.test.ts +++ b/x-pack/plugins/alerting/server/application/backfill/transforms/transform_backfill_param_to_ad_hoc_run.test.ts @@ -6,8 +6,8 @@ */ import { adHocRunStatus } from '../../../../common/constants'; -import { RuleDomain } from '../../rule/types'; -import { ScheduleBackfillParam } from '../methods/schedule/types'; +import type { RuleDomain } from '../../rule/types'; +import type { ScheduleBackfillParam } from '../methods/schedule/types'; import { transformBackfillParamToAdHocRun } from './transform_backfill_param_to_ad_hoc_run'; function getMockData(overwrites: Record = {}): ScheduleBackfillParam { diff --git a/x-pack/plugins/alerting/server/application/backfill/transforms/transform_backfill_param_to_ad_hoc_run.ts b/x-pack/plugins/alerting/server/application/backfill/transforms/transform_backfill_param_to_ad_hoc_run.ts index 4dc01a6c8939e..32df9ef2a9738 100644 --- a/x-pack/plugins/alerting/server/application/backfill/transforms/transform_backfill_param_to_ad_hoc_run.ts +++ b/x-pack/plugins/alerting/server/application/backfill/transforms/transform_backfill_param_to_ad_hoc_run.ts @@ -6,11 +6,11 @@ */ import { isString } from 'lodash'; -import { AdHocRunSO } from '../../../data/ad_hoc_run/types'; +import type { AdHocRunSO } from '../../../data/ad_hoc_run/types'; import { calculateSchedule } from '../../../backfill_client/lib'; import { adHocRunStatus } from '../../../../common/constants'; -import { RuleDomain } from '../../rule/types'; -import { ScheduleBackfillParam } from '../methods/schedule/types'; +import type { RuleDomain } from '../../rule/types'; +import type { ScheduleBackfillParam } from '../methods/schedule/types'; export const transformBackfillParamToAdHocRun = ( param: ScheduleBackfillParam, diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/lib/generate_maintenance_window_events.ts b/x-pack/plugins/alerting/server/application/maintenance_window/lib/generate_maintenance_window_events.ts index 78227dab5864a..458d24aef7602 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/lib/generate_maintenance_window_events.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/lib/generate_maintenance_window_events.ts @@ -8,8 +8,8 @@ import _ from 'lodash'; import moment from 'moment-timezone'; import { RRule, Weekday } from '@kbn/rrule'; -import { RRuleParams, DateRange } from '../../../../common'; -import { MaintenanceWindow } from '../types'; +import type { RRuleParams, DateRange } from '../../../../common'; +import type { MaintenanceWindow } from '../types'; export interface GenerateMaintenanceWindowEventsParams { rRule: RRuleParams; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/lib/get_maintenance_window_date_and_status.test.ts b/x-pack/plugins/alerting/server/application/maintenance_window/lib/get_maintenance_window_date_and_status.test.ts index 2ee4e2d8ea20b..56aa5a16ad1a1 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/lib/get_maintenance_window_date_and_status.test.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/lib/get_maintenance_window_date_and_status.test.ts @@ -10,7 +10,8 @@ import { getMaintenanceWindowDateAndStatus, findRecentEventWithStatus, } from './get_maintenance_window_date_and_status'; -import { DateRange, MaintenanceWindowStatus } from '../../../../common'; +import type { DateRange } from '../../../../common'; +import { MaintenanceWindowStatus } from '../../../../common'; const events: DateRange[] = [ { diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/lib/get_maintenance_window_date_and_status.ts b/x-pack/plugins/alerting/server/application/maintenance_window/lib/get_maintenance_window_date_and_status.ts index 877f6f2fe32eb..dd1e7ca26efdf 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/lib/get_maintenance_window_date_and_status.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/lib/get_maintenance_window_date_and_status.ts @@ -5,7 +5,8 @@ * 2.0. */ import moment from 'moment'; -import { DateRange, MaintenanceWindowStatus } from '../../../../common'; +import type { DateRange } from '../../../../common'; +import { MaintenanceWindowStatus } from '../../../../common'; export interface DateSearchResult { event: DateRange; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/archive/archive_maintenance_window.test.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/archive/archive_maintenance_window.test.ts index fb8d1bccd89c1..6140db62ba2ac 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/archive/archive_maintenance_window.test.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/archive/archive_maintenance_window.test.ts @@ -13,11 +13,9 @@ import { loggingSystemMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { SavedObjectsUpdateResponse, SavedObject } from '@kbn/core/server'; -import { - MaintenanceWindowClientContext, - MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE, -} from '../../../../../common'; +import type { SavedObjectsUpdateResponse, SavedObject } from '@kbn/core/server'; +import type { MaintenanceWindowClientContext } from '../../../../../common'; +import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../../common'; import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/test_helpers'; import type { MaintenanceWindow } from '../../types'; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/archive/types/archive_maintenance_window_params.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/archive/types/archive_maintenance_window_params.ts index 81ad31de9c6a9..532baead46f7c 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/archive/types/archive_maintenance_window_params.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/archive/types/archive_maintenance_window_params.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { archiveMaintenanceWindowParamsSchema } from '../schemas'; +import type { archiveMaintenanceWindowParamsSchema } from '../schemas'; export type ArchiveMaintenanceWindowParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/bulk_get_maintenance_windows.test.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/bulk_get_maintenance_windows.test.ts index 86eee6b564b80..e66a54a4e04aa 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/bulk_get_maintenance_windows.test.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/bulk_get_maintenance_windows.test.ts @@ -11,11 +11,9 @@ import { loggingSystemMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { SavedObject } from '@kbn/core/server'; -import { - MaintenanceWindowClientContext, - MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE, -} from '../../../../../common'; +import type { SavedObject } from '@kbn/core/server'; +import type { MaintenanceWindowClientContext } from '../../../../../common'; +import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../../common'; import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/test_helpers'; const savedObjectsClient = savedObjectsClientMock.create(); diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/types/bulk_get_maintenance_window_params.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/types/bulk_get_maintenance_window_params.ts index 7b0a155880926..86ee4543295dd 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/types/bulk_get_maintenance_window_params.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/types/bulk_get_maintenance_window_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { bulkGetMaintenanceWindowsParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { bulkGetMaintenanceWindowsParamsSchema } from '../schemas'; export type BulkGetMaintenanceWindowsParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/types/bulk_get_maintenance_window_result.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/types/bulk_get_maintenance_window_result.ts index 7f640342bf651..5788c74ad4a9a 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/types/bulk_get_maintenance_window_result.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/bulk_get/types/bulk_get_maintenance_window_result.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { +import type { TypeOf } from '@kbn/config-schema'; +import type { bulkGetMaintenanceWindowsErrorSchema, bulkGetMaintenanceWindowsResultSchema, } from '../schemas'; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/create_maintenance_window.test.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/create_maintenance_window.test.ts index 57f7153bd0231..1c39ad50a4ac6 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/create_maintenance_window.test.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/create_maintenance_window.test.ts @@ -7,17 +7,15 @@ import moment from 'moment-timezone'; import { createMaintenanceWindow } from './create_maintenance_window'; -import { CreateMaintenanceWindowParams } from './types'; +import type { CreateMaintenanceWindowParams } from './types'; import { savedObjectsClientMock, loggingSystemMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { SavedObject } from '@kbn/core/server'; -import { - MaintenanceWindowClientContext, - MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE, -} from '../../../../../common'; +import type { SavedObject } from '@kbn/core/server'; +import type { MaintenanceWindowClientContext } from '../../../../../common'; +import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../../common'; import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/test_helpers'; import type { MaintenanceWindow } from '../../types'; import { FilterStateStore } from '@kbn/es-query'; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/create_maintenance_window.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/create_maintenance_window.ts index 97bf8747ffc90..f9b801e9cd1bd 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/create_maintenance_window.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/create_maintenance_window.ts @@ -8,7 +8,8 @@ import moment from 'moment'; import Boom from '@hapi/boom'; import { SavedObjectsUtils } from '@kbn/core/server'; -import { buildEsQuery, Filter } from '@kbn/es-query'; +import type { Filter } from '@kbn/es-query'; +import { buildEsQuery } from '@kbn/es-query'; import { getEsQueryConfig } from '../../../../lib/get_es_query_config'; import { generateMaintenanceWindowEvents } from '../../lib/generate_maintenance_window_events'; import type { MaintenanceWindowClientContext } from '../../../../../common'; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/types/create_maintenance_window_params.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/types/create_maintenance_window_params.ts index 66f9070f24277..6cae14b535784 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/types/create_maintenance_window_params.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/create/types/create_maintenance_window_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { createMaintenanceWindowParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { createMaintenanceWindowParamsSchema } from '../schemas'; export type CreateMaintenanceWindowParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/delete/delete_maintenance_window.test.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/delete/delete_maintenance_window.test.ts index 50e1307bf257b..a757a9c89d41c 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/delete/delete_maintenance_window.test.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/delete/delete_maintenance_window.test.ts @@ -11,10 +11,8 @@ import { loggingSystemMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { - MaintenanceWindowClientContext, - MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE, -} from '../../../../../common'; +import type { MaintenanceWindowClientContext } from '../../../../../common'; +import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../../common'; const savedObjectsClient = savedObjectsClientMock.create(); const uiSettings = uiSettingsServiceMock.createClient(); diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/delete/types/delete_maintenance_window_params.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/delete/types/delete_maintenance_window_params.ts index e241528ec2011..cf470262ca5df 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/delete/types/delete_maintenance_window_params.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/delete/types/delete_maintenance_window_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { deleteMaintenanceWindowParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { deleteMaintenanceWindowParamsSchema } from '../schemas'; export type DeleteMaintenanceWindowParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/find_maintenance_windows.test.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/find_maintenance_windows.test.ts index 35c15ebb57c61..36d9ca051482b 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/find_maintenance_windows.test.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/find_maintenance_windows.test.ts @@ -11,11 +11,9 @@ import { loggingSystemMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { SavedObjectsFindResponse } from '@kbn/core/server'; -import { - MaintenanceWindowClientContext, - MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE, -} from '../../../../../common'; +import type { SavedObjectsFindResponse } from '@kbn/core/server'; +import type { MaintenanceWindowClientContext } from '../../../../../common'; +import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../../common'; import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/test_helpers'; import { findMaintenanceWindowsParamsSchema } from './schemas'; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/find_maintenance_windows.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/find_maintenance_windows.ts index 5cb1e01c1f1a0..719258b0fa8a4 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/find_maintenance_windows.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/find_maintenance_windows.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { MaintenanceWindowClientContext } from '../../../../../common'; +import type { MaintenanceWindowClientContext } from '../../../../../common'; import { transformMaintenanceWindowAttributesToMaintenanceWindow } from '../../transforms'; import { findMaintenanceWindowSo } from '../../../../data/maintenance_window'; import type { FindMaintenanceWindowsResult, FindMaintenanceWindowsParams } from './types'; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/types/find_maintenance_window_params.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/types/find_maintenance_window_params.ts index 878d5168c7e55..04d550cca4062 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/types/find_maintenance_window_params.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/types/find_maintenance_window_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { findMaintenanceWindowsParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { findMaintenanceWindowsParamsSchema } from '../schemas'; export type FindMaintenanceWindowsParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/types/find_maintenance_window_result.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/types/find_maintenance_window_result.ts index 6a16366cd8f29..4c98d93f453f5 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/types/find_maintenance_window_result.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/find/types/find_maintenance_window_result.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { findMaintenanceWindowsResultSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { findMaintenanceWindowsResultSchema } from '../schemas'; export type FindMaintenanceWindowsResult = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/finish_maintenance_window.test.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/finish_maintenance_window.test.ts index 6fa79cdb20fcf..ff026876bcbb8 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/finish_maintenance_window.test.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/finish_maintenance_window.test.ts @@ -13,11 +13,9 @@ import { loggingSystemMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { SavedObjectsUpdateResponse, SavedObject } from '@kbn/core/server'; -import { - MaintenanceWindowClientContext, - MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE, -} from '../../../../../common'; +import type { SavedObjectsUpdateResponse, SavedObject } from '@kbn/core/server'; +import type { MaintenanceWindowClientContext } from '../../../../../common'; +import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../../common'; import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/test_helpers'; import type { MaintenanceWindow } from '../../types'; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/finish_maintenance_window.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/finish_maintenance_window.ts index e318971993542..e7ef970ba4c0b 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/finish_maintenance_window.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/finish_maintenance_window.ts @@ -12,11 +12,8 @@ import { mergeEvents, } from '../../lib/generate_maintenance_window_events'; import { getMaintenanceWindowDateAndStatus } from '../../lib/get_maintenance_window_date_and_status'; -import { - DateRange, - MaintenanceWindowClientContext, - MaintenanceWindowStatus, -} from '../../../../../common'; +import type { DateRange, MaintenanceWindowClientContext } from '../../../../../common'; +import { MaintenanceWindowStatus } from '../../../../../common'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { getMaintenanceWindowSo, diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/types/finish_maintenance_window_params.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/types/finish_maintenance_window_params.ts index 7356042f758fa..d605cc37b7ec9 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/types/finish_maintenance_window_params.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/finish/types/finish_maintenance_window_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { finishMaintenanceWindowParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { finishMaintenanceWindowParamsSchema } from '../schemas'; export type FinishMaintenanceWindowParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/get/get_maintenance_window.test.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/get/get_maintenance_window.test.ts index 54724c6cdfdc7..0f6af91df9234 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/get/get_maintenance_window.test.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/get/get_maintenance_window.test.ts @@ -11,11 +11,9 @@ import { loggingSystemMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { SavedObject } from '@kbn/core/server'; -import { - MaintenanceWindowClientContext, - MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE, -} from '../../../../../common'; +import type { SavedObject } from '@kbn/core/server'; +import type { MaintenanceWindowClientContext } from '../../../../../common'; +import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../../common'; import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/test_helpers'; const savedObjectsClient = savedObjectsClientMock.create(); diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/get/types/get_maintenance_window_params.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/get/types/get_maintenance_window_params.ts index e9bf4c7f3d1c4..aefdef05fd37f 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/get/types/get_maintenance_window_params.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/get/types/get_maintenance_window_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { getMaintenanceWindowParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { getMaintenanceWindowParamsSchema } from '../schemas'; export type GetMaintenanceWindowParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/get_active/get_active_maintenance_windows.test.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/get_active/get_active_maintenance_windows.test.ts index b26af5a9c2349..1ab812bf2a959 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/get_active/get_active_maintenance_windows.test.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/get_active/get_active_maintenance_windows.test.ts @@ -12,11 +12,9 @@ import { loggingSystemMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { SavedObjectsFindResponse } from '@kbn/core/server'; -import { - MaintenanceWindowClientContext, - MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE, -} from '../../../../../common'; +import type { SavedObjectsFindResponse } from '@kbn/core/server'; +import type { MaintenanceWindowClientContext } from '../../../../../common'; +import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../../common'; import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/test_helpers'; const savedObjectsClient = savedObjectsClientMock.create(); diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/get_active/get_active_maintenance_windows.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/get_active/get_active_maintenance_windows.ts index 4d42cb0f23688..fcce48b0e8674 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/get_active/get_active_maintenance_windows.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/get_active/get_active_maintenance_windows.ts @@ -6,7 +6,8 @@ */ import Boom from '@hapi/boom'; -import { KueryNode, nodeBuilder } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; +import { nodeBuilder } from '@kbn/es-query'; import type { MaintenanceWindowClientContext } from '../../../../../common'; import type { MaintenanceWindow } from '../../types'; import { transformMaintenanceWindowAttributesToMaintenanceWindow } from '../../transforms'; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/types/update_maintenance_window_params.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/types/update_maintenance_window_params.ts index a8497347a52b7..e66457405320b 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/types/update_maintenance_window_params.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/types/update_maintenance_window_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { updateMaintenanceWindowParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { updateMaintenanceWindowParamsSchema } from '../schemas'; export type UpdateMaintenanceWindowParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/update_maintenance_window.test.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/update_maintenance_window.test.ts index e377fb3209d63..99d08923c4271 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/update_maintenance_window.test.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/update_maintenance_window.test.ts @@ -8,17 +8,15 @@ import moment from 'moment-timezone'; import { Frequency } from '@kbn/rrule'; import { updateMaintenanceWindow } from './update_maintenance_window'; -import { UpdateMaintenanceWindowParams } from './types'; +import type { UpdateMaintenanceWindowParams } from './types'; import { savedObjectsClientMock, loggingSystemMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { SavedObject } from '@kbn/core/server'; -import { - MaintenanceWindowClientContext, - MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE, -} from '../../../../../common'; +import type { SavedObject } from '@kbn/core/server'; +import type { MaintenanceWindowClientContext } from '../../../../../common'; +import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../../common'; import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/test_helpers'; import type { MaintenanceWindow } from '../../types'; import { FilterStateStore } from '@kbn/es-query'; diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/update_maintenance_window.ts b/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/update_maintenance_window.ts index 6c8fd65b6988f..09fa2efe36075 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/update_maintenance_window.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/methods/update/update_maintenance_window.ts @@ -7,7 +7,8 @@ import moment from 'moment'; import Boom from '@hapi/boom'; -import { buildEsQuery, Filter } from '@kbn/es-query'; +import type { Filter } from '@kbn/es-query'; +import { buildEsQuery } from '@kbn/es-query'; import type { MaintenanceWindowClientContext } from '../../../../../common'; import { getScopedQueryErrorMessage } from '../../../../../common'; import { getEsQueryConfig } from '../../../../lib/get_es_query_config'; @@ -26,7 +27,7 @@ import { getMaintenanceWindowSo, createMaintenanceWindowSo, } from '../../../../data/maintenance_window'; -import { UpdateMaintenanceWindowParams } from './types'; +import type { UpdateMaintenanceWindowParams } from './types'; import { updateMaintenanceWindowParamsSchema } from './schemas'; export async function updateMaintenanceWindow( diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/transforms/transform_maintenance_window_attributes_to_maintenance_window.ts b/x-pack/plugins/alerting/server/application/maintenance_window/transforms/transform_maintenance_window_attributes_to_maintenance_window.ts index 6a2f25ce18dd9..2dfc4645ca120 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/transforms/transform_maintenance_window_attributes_to_maintenance_window.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/transforms/transform_maintenance_window_attributes_to_maintenance_window.ts @@ -4,8 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { MaintenanceWindow } from '../types'; -import { MaintenanceWindowAttributes } from '../../../data/maintenance_window/types'; +import type { MaintenanceWindow } from '../types'; +import type { MaintenanceWindowAttributes } from '../../../data/maintenance_window/types'; import { getMaintenanceWindowDateAndStatus } from '../lib'; export interface TransformMaintenanceWindowAttributesMaintenanceWindowParams { diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/transforms/transform_maintenance_window_to_maintenance_window_attributes.ts b/x-pack/plugins/alerting/server/application/maintenance_window/transforms/transform_maintenance_window_to_maintenance_window_attributes.ts index b6c0e22d04bc4..afb6eaff5593d 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/transforms/transform_maintenance_window_to_maintenance_window_attributes.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/transforms/transform_maintenance_window_to_maintenance_window_attributes.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { MaintenanceWindowWithoutComputedProperties } from '../types'; -import { MaintenanceWindowAttributes } from '../../../data/maintenance_window/types'; +import type { MaintenanceWindowWithoutComputedProperties } from '../types'; +import type { MaintenanceWindowAttributes } from '../../../data/maintenance_window/types'; export const transformMaintenanceWindowToMaintenanceWindowAttributes = ( maintenanceWindow: MaintenanceWindowWithoutComputedProperties diff --git a/x-pack/plugins/alerting/server/application/maintenance_window/types/maintenance_window.ts b/x-pack/plugins/alerting/server/application/maintenance_window/types/maintenance_window.ts index 55fc8888a497b..95c7ebcbac40a 100644 --- a/x-pack/plugins/alerting/server/application/maintenance_window/types/maintenance_window.ts +++ b/x-pack/plugins/alerting/server/application/maintenance_window/types/maintenance_window.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { maintenanceWindowStatus } from '../constants'; -import { maintenanceWindowSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { maintenanceWindowStatus } from '../constants'; +import type { maintenanceWindowSchema } from '../schemas'; export type MaintenanceWindow = TypeOf; export type MaintenanceWindowStatus = diff --git a/x-pack/plugins/alerting/server/application/r_rule/types/r_rule.ts b/x-pack/plugins/alerting/server/application/r_rule/types/r_rule.ts index 57700ea1b57d2..c4e2d7aaeb835 100644 --- a/x-pack/plugins/alerting/server/application/r_rule/types/r_rule.ts +++ b/x-pack/plugins/alerting/server/application/r_rule/types/r_rule.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { rRuleSchema } from '../schemas/r_rule_schema'; +import type { TypeOf } from '@kbn/config-schema'; +import type { rRuleSchema } from '../schemas/r_rule_schema'; export type RRule = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/r_rule/types/r_rule_request.ts b/x-pack/plugins/alerting/server/application/r_rule/types/r_rule_request.ts index 4f90eae946935..ae0e1d05ea9e2 100644 --- a/x-pack/plugins/alerting/server/application/r_rule/types/r_rule_request.ts +++ b/x-pack/plugins/alerting/server/application/r_rule/types/r_rule_request.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { rRuleRequestSchema } from '../schemas/r_rule_request_schema'; +import type { TypeOf } from '@kbn/config-schema'; +import type { rRuleRequestSchema } from '../schemas/r_rule_request_schema'; export type RRuleRequest = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/r_rule/validation/validate_end_date.ts b/x-pack/plugins/alerting/server/application/r_rule/validation/validate_end_date.ts index 895c1aeea4dfb..7c5ee6d187264 100644 --- a/x-pack/plugins/alerting/server/application/r_rule/validation/validate_end_date.ts +++ b/x-pack/plugins/alerting/server/application/r_rule/validation/validate_end_date.ts @@ -9,5 +9,4 @@ export const validateEndDate = (date: string) => { const parsedValue = Date.parse(date); if (isNaN(parsedValue)) return `Invalid date: ${date}`; if (parsedValue <= Date.now()) return `Invalid snooze date as it is in the past: ${date}`; - return; }; diff --git a/x-pack/plugins/alerting/server/application/r_rule/validation/validate_start_date.ts b/x-pack/plugins/alerting/server/application/r_rule/validation/validate_start_date.ts index 3cbc0da0af1b5..a40153e0ea324 100644 --- a/x-pack/plugins/alerting/server/application/r_rule/validation/validate_start_date.ts +++ b/x-pack/plugins/alerting/server/application/r_rule/validation/validate_start_date.ts @@ -8,5 +8,4 @@ export const validateStartDate = (date: string) => { const parsedValue = Date.parse(date); if (isNaN(parsedValue)) return `Invalid date: ${date}`; - return; }; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/aggregate/aggregate_rules.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/aggregate/aggregate_rules.test.ts index 57fb2bf8f48a4..15102c2798767 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/aggregate/aggregate_rules.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/aggregate/aggregate_rules.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../../../../rules_client'; +import type { ConstructorOptions } from '../../../../rules_client'; +import { RulesClient } from '../../../../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -17,15 +18,15 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; -import { RegistryRuleType } from '../../../../rule_type_registry'; +import type { RegistryRuleType } from '../../../../rule_type_registry'; import { fromKueryExpression, nodeTypes } from '@kbn/es-query'; import { RecoveredActionGroup } from '../../../../../common'; -import { DefaultRuleAggregationResult } from '../../../../routes/rule/apis/aggregate/types'; +import type { DefaultRuleAggregationResult } from '../../../../routes/rule/apis/aggregate/types'; import { defaultRuleAggregationFactory } from '.'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/aggregate/aggregate_rules.ts b/x-pack/plugins/alerting/server/application/rule/methods/aggregate/aggregate_rules.ts index 9011b971e629a..2da369f4da6e9 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/aggregate/aggregate_rules.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/aggregate/aggregate_rules.ts @@ -5,14 +5,15 @@ * 2.0. */ -import { KueryNode, nodeBuilder } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; +import { nodeBuilder } from '@kbn/es-query'; import { isEmpty } from 'lodash'; import { findRulesSo } from '../../../../data/rule'; import { AlertingAuthorizationEntity } from '../../../../authorization'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; import { buildKueryNodeFilter } from '../../../../rules_client/common'; import { alertingAuthorizationFilterOpts } from '../../../../rules_client/common/constants'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { aggregateOptionsSchema } from './schemas'; import type { AggregateParams } from './types'; import { validateRuleAggregationFields } from './validation'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/aggregate/factories/default_rule_aggregation_factory/v1.ts b/x-pack/plugins/alerting/server/application/rule/methods/aggregate/factories/default_rule_aggregation_factory/v1.ts index 371c12c1fada3..4cbd64281634c 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/aggregate/factories/default_rule_aggregation_factory/v1.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/aggregate/factories/default_rule_aggregation_factory/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { AggregationsAggregationContainer } from '@elastic/elasticsearch/lib/api/types'; -import { DefaultRuleAggregationParams } from '../../types'; +import type { AggregationsAggregationContainer } from '@elastic/elasticsearch/lib/api/types'; +import type { DefaultRuleAggregationParams } from '../../types'; export const defaultRuleAggregationFactory = ( params?: DefaultRuleAggregationParams diff --git a/x-pack/plugins/alerting/server/application/rule/methods/aggregate/types/index.ts b/x-pack/plugins/alerting/server/application/rule/methods/aggregate/types/index.ts index 2156fb91e8778..2dd1bbb9dbe76 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/aggregate/types/index.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/aggregate/types/index.ts @@ -5,9 +5,9 @@ * 2.0. */ import type { AggregationsAggregationContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { TypeOf } from '@kbn/config-schema'; -import { KueryNode } from '@kbn/es-query'; -import { aggregateOptionsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { KueryNode } from '@kbn/es-query'; +import type { aggregateOptionsSchema } from '../schemas'; type AggregateOptionsSchemaTypes = TypeOf; export type AggregateOptions = TypeOf & { diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/bulk_delete_rules.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/bulk_delete_rules.test.ts index 366b98fc31714..9fd1709d5f5ff 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/bulk_delete_rules.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/bulk_delete_rules.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, savedObjectsRepositoryMock, @@ -15,14 +16,14 @@ import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; import { schema } from '@kbn/config-schema'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { loggerMock } from '@kbn/logging-mocks'; -import { ActionsClient } from '@kbn/actions-plugin/server'; +import type { ActionsClient } from '@kbn/actions-plugin/server'; import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { RecoveredActionGroup } from '../../../../../common'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; import { bulkMarkApiKeysForInvalidation } from '../../../../invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation'; import { diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/bulk_delete_rules.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/bulk_delete_rules.ts index 0c1fa9a3fe1e9..c7899a60d014f 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/bulk_delete_rules.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/bulk_delete_rules.ts @@ -6,8 +6,9 @@ */ import pMap from 'p-map'; import Boom from '@hapi/boom'; -import { KueryNode, nodeBuilder } from '@kbn/es-query'; -import { SavedObjectsBulkUpdateObject } from '@kbn/core/server'; +import type { KueryNode } from '@kbn/es-query'; +import { nodeBuilder } from '@kbn/es-query'; +import type { SavedObjectsBulkUpdateObject } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { convertRuleIdsToKueryNode } from '../../../../lib'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/types/index.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/types/index.ts index d7075638a5027..f78a41ac49b7c 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/types/index.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/types/index.ts @@ -5,7 +5,7 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { bulkDeleteRulesRequestBodySchema } from '../schemas'; +import type { bulkDeleteRulesRequestBodySchema } from '../schemas'; import type { SanitizedRule } from '../../../../../types'; import type { RuleParams } from '../../../types'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/validation/index.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/validation/index.ts index 746802899efc4..0c333755a2d82 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/validation/index.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_delete/validation/index.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { BulkDeleteRulesRequestBody } from '../types'; +import type { BulkDeleteRulesRequestBody } from '../types'; export const validateBulkDeleteRulesBody = (options: BulkDeleteRulesRequestBody) => { const filter = options.filter; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/bulk_disable_rules.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/bulk_disable_rules.test.ts index 949bf35361dc0..3a18fafce2783 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/bulk_disable_rules.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/bulk_disable_rules.test.ts @@ -5,7 +5,8 @@ * 2.0. */ import { AlertConsumers } from '@kbn/rule-data-utils'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, savedObjectsRepositoryMock, @@ -17,12 +18,12 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; import { loggerMock } from '@kbn/logging-mocks'; -import { BulkUpdateTaskResult } from '@kbn/task-manager-plugin/server/task_scheduling'; +import type { BulkUpdateTaskResult } from '@kbn/task-manager-plugin/server/task_scheduling'; import { eventLoggerMock } from '@kbn/event-log-plugin/server/mocks'; import { enabledRule1, @@ -44,7 +45,7 @@ import { } from '../../../../rules_client/tests/test_helpers'; import { migrateLegacyActions } from '../../../../rules_client/lib'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; -import { ActionsClient } from '@kbn/actions-plugin/server'; +import type { ActionsClient } from '@kbn/actions-plugin/server'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/bulk_disable_rules.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/bulk_disable_rules.ts index 1e56be531b0ca..27138456456e8 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/bulk_disable_rules.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/bulk_disable_rules.ts @@ -4,13 +4,14 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { KueryNode, nodeBuilder } from '@kbn/es-query'; -import { SavedObjectsBulkUpdateObject, SavedObjectsBulkCreateObject } from '@kbn/core/server'; +import type { KueryNode } from '@kbn/es-query'; +import { nodeBuilder } from '@kbn/es-query'; +import type { SavedObjectsBulkUpdateObject, SavedObjectsBulkCreateObject } from '@kbn/core/server'; import Boom from '@hapi/boom'; import { withSpan } from '@kbn/apm-utils'; import pMap from 'p-map'; -import { Logger } from '@kbn/core/server'; -import { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; +import type { Logger } from '@kbn/core/server'; +import type { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import type { RawRule, SanitizedRule, RawRuleAction } from '../../../../types'; import { convertRuleIdsToKueryNode } from '../../../../lib'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/types/index.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/types/index.ts index 9966fefdd921f..52b54d0172de5 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/types/index.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/types/index.ts @@ -5,7 +5,7 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { bulkDisableRulesRequestBodySchema } from '../schemas'; +import type { bulkDisableRulesRequestBodySchema } from '../schemas'; import type { SanitizedRule } from '../../../../../types'; import type { RuleParams } from '../../../types'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/validation/index.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/validation/index.ts index a162a510e9fa2..14a13eb5880ff 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/validation/index.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_disable/validation/index.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { BulkDisableRulesRequestBody } from '../types'; +import type { BulkDisableRulesRequestBody } from '../types'; export const validateBulkDisableRulesBody = (options: BulkDisableRulesRequestBody) => { const filter = options.filter; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/bulk_edit_rules.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/bulk_edit_rules.test.ts index 61d38c2c37c19..c0ebac41a7831 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/bulk_edit_rules.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/bulk_edit_rules.test.ts @@ -9,7 +9,8 @@ import { schema } from '@kbn/config-schema'; import { omit } from 'lodash'; import { v4 as uuidv4 } from 'uuid'; import { AlertConsumers } from '@kbn/rule-data-utils'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -19,11 +20,12 @@ import { import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; -import { RecoveredActionGroup, RuleTypeParams } from '../../../../../common'; +import type { RuleTypeParams } from '../../../../../common'; +import { RecoveredActionGroup } from '../../../../../common'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization, ActionsClient } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization, ActionsClient } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; import { bulkMarkApiKeysForInvalidation } from '../../../../invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation'; @@ -36,12 +38,12 @@ import { import { migrateLegacyActions } from '../../../../rules_client/lib'; import { migrateLegacyActionsMock } from '../../../../rules_client/lib/siem_legacy_actions/retrieve_migrated_legacy_actions.mock'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; -import { ConnectorAdapter } from '../../../../connector_adapters/types'; -import { SavedObject } from '@kbn/core/server'; +import type { ConnectorAdapter } from '../../../../connector_adapters/types'; +import type { SavedObject } from '@kbn/core/server'; import { bulkEditOperationsSchema } from './schemas'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; -import { RawRule } from '../../../../types'; +import type { RawRule } from '../../../../types'; jest.mock('../../../../rules_client/lib/siem_legacy_actions/migrate_legacy_actions', () => { return { diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/bulk_edit_rules.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/bulk_edit_rules.ts index 8868065fa43a5..7683c4017a468 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/bulk_edit_rules.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/bulk_edit_rules.ts @@ -8,18 +8,19 @@ import pMap from 'p-map'; import Boom from '@hapi/boom'; import { cloneDeep } from 'lodash'; -import { KueryNode, nodeBuilder } from '@kbn/es-query'; -import { +import type { KueryNode } from '@kbn/es-query'; +import { nodeBuilder } from '@kbn/es-query'; +import type { SavedObjectsBulkUpdateObject, SavedObjectsBulkCreateObject, SavedObjectsFindResult, SavedObjectsUpdateResponse, } from '@kbn/core/server'; import { validateAndAuthorizeSystemActions } from '../../../../lib/validate_authorize_system_actions'; -import { Rule, RuleAction, RuleSystemAction } from '../../../../../common'; +import type { Rule, RuleAction, RuleSystemAction } from '../../../../../common'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { BulkActionSkipResult } from '../../../../../common/bulk_edit'; -import { RuleTypeRegistry } from '../../../../types'; +import type { BulkActionSkipResult } from '../../../../../common/bulk_edit'; +import type { RuleTypeRegistry } from '../../../../types'; import { validateRuleTypeParams, getRuleNotifyWhenType, @@ -53,7 +54,7 @@ import { addGeneratedActionValues, createNewAPIKeySet, } from '../../../../rules_client/lib'; -import { +import type { BulkOperationError, RuleBulkOperationAggregation, RulesClientContext, @@ -61,7 +62,7 @@ import { NormalizedAlertAction, } from '../../../../rules_client/types'; import { migrateLegacyActions } from '../../../../rules_client/lib'; -import { +import type { BulkEditFields, BulkEditOperation, BulkEditOptionsFilter, @@ -69,17 +70,18 @@ import { ParamsModifier, ShouldIncrementRevision, } from './types'; -import { RawRuleAction, RawRule, SanitizedRule } from '../../../../types'; +import type { RawRuleAction, RawRule, SanitizedRule } from '../../../../types'; import { ruleNotifyWhen } from '../../constants'; import { actionRequestSchema, ruleDomainSchema, systemActionRequestSchema } from '../../schemas'; -import { RuleParams, RuleDomain, RuleSnoozeSchedule } from '../../types'; +import type { RuleParams, RuleDomain, RuleSnoozeSchedule } from '../../types'; import { findRulesSo, bulkCreateRulesSo } from '../../../../data/rule'; import { transformRuleAttributesToRuleDomain, transformRuleDomainToRuleAttributes, transformRuleDomainToRule, } from '../../transforms'; -import { validateScheduleLimit, ValidateScheduleLimitResult } from '../get_schedule_frequency'; +import type { ValidateScheduleLimitResult } from '../get_schedule_frequency'; +import { validateScheduleLimit } from '../get_schedule_frequency'; const isValidInterval = (interval: string | undefined): interval is string => { return interval !== undefined; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/types/bulk_edit_rules_options.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/types/bulk_edit_rules_options.ts index 7c30f6583865e..5a3620e5327f5 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/types/bulk_edit_rules_options.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/types/bulk_edit_rules_options.ts @@ -6,14 +6,14 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { KueryNode } from '@kbn/es-query'; -import { +import type { KueryNode } from '@kbn/es-query'; +import type { bulkEditRuleSnoozeScheduleSchema, bulkEditOperationsSchema, bulkEditOperationSchema, } from '../schemas'; -import { RuleParams, RuleDomain } from '../../../types'; -import { Rule } from '../../../../../../common'; +import type { RuleParams, RuleDomain } from '../../../types'; +import type { Rule } from '../../../../../../common'; export type BulkEditRuleSnoozeSchedule = TypeOf; export type BulkEditOperation = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/validation/validate_snooze_schedule.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/validation/validate_snooze_schedule.ts index 16fd324cfcb7c..37c83e1d5deab 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/validation/validate_snooze_schedule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_edit/validation/validate_snooze_schedule.ts @@ -7,7 +7,7 @@ import { Frequency } from '@kbn/rrule'; import moment from 'moment'; -import { BulkEditRuleSnoozeSchedule } from '../types'; +import type { BulkEditRuleSnoozeSchedule } from '../types'; export const validateSnoozeSchedule = (schedule: BulkEditRuleSnoozeSchedule) => { const intervalIsDaily = schedule.rRule.freq === Frequency.DAILY; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/bulk_enable_rules.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/bulk_enable_rules.test.ts index 7138c2cb3a318..9c7723a3c550f 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/bulk_enable_rules.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/bulk_enable_rules.test.ts @@ -5,7 +5,8 @@ * 2.0. */ import { AlertConsumers } from '@kbn/rule-data-utils'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, savedObjectsRepositoryMock, @@ -16,13 +17,13 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; import { loggerMock } from '@kbn/logging-mocks'; -import { BulkUpdateTaskResult } from '@kbn/task-manager-plugin/server/task_scheduling'; -import { ActionsClient } from '@kbn/actions-plugin/server'; +import type { BulkUpdateTaskResult } from '@kbn/task-manager-plugin/server/task_scheduling'; +import type { ActionsClient } from '@kbn/actions-plugin/server'; import { disabledRule1, disabledRule2, diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/bulk_enable_rules.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/bulk_enable_rules.ts index ac7510c2a5a9c..c351fe21ed66e 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/bulk_enable_rules.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/bulk_enable_rules.ts @@ -7,19 +7,21 @@ import pMap from 'p-map'; import Boom from '@hapi/boom'; -import { KueryNode, nodeBuilder } from '@kbn/es-query'; -import { +import type { KueryNode } from '@kbn/es-query'; +import { nodeBuilder } from '@kbn/es-query'; +import type { SavedObjectsBulkCreateObject, SavedObjectsBulkUpdateObject, SavedObjectsFindResult, } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; -import { Logger } from '@kbn/core/server'; -import { TaskManagerStartContract, TaskStatus } from '@kbn/task-manager-plugin/server'; -import { TaskInstanceWithDeprecatedFields } from '@kbn/task-manager-plugin/server/task'; +import type { Logger } from '@kbn/core/server'; +import type { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; +import { TaskStatus } from '@kbn/task-manager-plugin/server'; +import type { TaskInstanceWithDeprecatedFields } from '@kbn/task-manager-plugin/server/task'; import { bulkCreateRulesSo } from '../../../../data/rule'; -import { RawRule } from '../../../../types'; -import { RuleDomain, RuleParams } from '../../types'; +import type { RawRule } from '../../../../types'; +import type { RuleDomain, RuleParams } from '../../types'; import { convertRuleIdsToKueryNode } from '../../../../lib'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; import { @@ -27,7 +29,8 @@ import { buildKueryNodeFilter, getAndValidateCommonBulkOptions, } from '../../../../rules_client/common'; -import { getRuleCircuitBreakerErrorMessage, SanitizedRule } from '../../../../../common'; +import type { SanitizedRule } from '../../../../../common'; +import { getRuleCircuitBreakerErrorMessage } from '../../../../../common'; import { getAuthorizationFilter, checkAuthorizationAndGetTotal, @@ -35,10 +38,10 @@ import { migrateLegacyActions, updateMetaAttributes, } from '../../../../rules_client/lib'; -import { RulesClientContext, BulkOperationError } from '../../../../rules_client/types'; +import type { RulesClientContext, BulkOperationError } from '../../../../rules_client/types'; import { validateScheduleLimit } from '../get_schedule_frequency'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { BulkEnableRulesParams, BulkEnableRulesResult } from './types'; +import type { BulkEnableRulesParams, BulkEnableRulesResult } from './types'; import { bulkEnableRulesParamsSchema } from './schemas'; import { transformRuleAttributesToRuleDomain, transformRuleDomainToRule } from '../../transforms'; import { ruleDomainSchema } from '../../schemas'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/types/bulk_enable_rules_types.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/types/bulk_enable_rules_types.ts index c33e2ef964915..c93394366f061 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/types/bulk_enable_rules_types.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_enable/types/bulk_enable_rules_types.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RuleParams } from '../../../types/rule'; -import { SanitizedRule } from '../../../../../types'; +import type { RuleParams } from '../../../types/rule'; +import type { SanitizedRule } from '../../../../../types'; export interface BulkEnableRulesParams { filter?: string; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/bulk_untrack_alerts.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/bulk_untrack_alerts.test.ts index befd240286a06..811ed968c036b 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/bulk_untrack_alerts.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/bulk_untrack_alerts.test.ts @@ -4,7 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, savedObjectsRepositoryMock, @@ -13,15 +14,16 @@ import { import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { loggerMock } from '@kbn/logging-mocks'; import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; import { alertsServiceMock } from '../../../../alerts_service/alerts_service.mock'; import { ALERT_RULE_UUID, ALERT_UUID } from '@kbn/rule-data-utils'; -import { ConcreteTaskInstance, TaskStatus } from '@kbn/task-manager-plugin/server'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { TaskStatus } from '@kbn/task-manager-plugin/server'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/bulk_untrack_alerts.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/bulk_untrack_alerts.ts index 304037782f6d3..c34d3c8e7835b 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/bulk_untrack_alerts.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/bulk_untrack_alerts.ts @@ -9,13 +9,13 @@ import { omitBy } from 'lodash'; import Boom from '@hapi/boom'; import { withSpan } from '@kbn/apm-utils'; import { ALERT_RULE_UUID, ALERT_UUID } from '@kbn/rule-data-utils'; -import { AuditLogger } from '@kbn/core-security-server'; +import type { AuditLogger } from '@kbn/core-security-server'; import { bulkUntrackBodySchema } from './schemas'; import type { BulkUntrackBody } from './types'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; export type { BulkUntrackBody }; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/types/bulk_untrack_body.ts b/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/types/bulk_untrack_body.ts index f515314b2ef50..40cfa7a484a76 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/types/bulk_untrack_body.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/bulk_untrack/types/bulk_untrack_body.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { bulkUntrackBodySchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { bulkUntrackBodySchema } from '../schemas'; export type BulkUntrackBody = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/clone/clone_rule.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/clone/clone_rule.test.ts index 336224b4f40c1..e7a80eda8e38d 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/clone/clone_rule.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/clone/clone_rule.test.ts @@ -16,14 +16,15 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { getBeforeSetup } from '../../../../rules_client/tests/lib'; -import { RuleDomain } from '../../types'; -import { ConstructorOptions, RulesClient } from '../../../../rules_client/rules_client'; +import type { RuleDomain } from '../../types'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; describe('clone', () => { diff --git a/x-pack/plugins/alerting/server/application/rule/methods/clone/clone_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/clone/clone_rule.ts index 9383a32b7c60a..eb5bf0b09bd29 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/clone/clone_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/clone/clone_rule.ts @@ -8,9 +8,10 @@ import Semver from 'semver'; import Boom from '@hapi/boom'; import { AlertConsumers } from '@kbn/rule-data-utils'; -import { SavedObject, SavedObjectsUtils } from '@kbn/core/server'; +import type { SavedObject } from '@kbn/core/server'; +import { SavedObjectsUtils } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; -import { SanitizedRule, RawRule } from '../../../../types'; +import type { SanitizedRule, RawRule } from '../../../../types'; import { getDefaultMonitoring } from '../../../../lib'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { parseDuration } from '../../../../../common/parse_duration'; @@ -18,10 +19,10 @@ import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common import { getRuleExecutionStatusPendingAttributes } from '../../../../lib/rule_execution_status'; import { isDetectionEngineAADRuleType } from '../../../../saved_objects/migrations/utils'; import { createNewAPIKeySet, createRuleSavedObject } from '../../../../rules_client/lib'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { CloneRuleParams } from './types'; -import { RuleDomain, RuleParams } from '../../types'; +import type { CloneRuleParams } from './types'; +import type { RuleDomain, RuleParams } from '../../types'; import { getDecryptedRuleSo, getRuleSo } from '../../../../data/rule'; import { transformRuleAttributesToRuleDomain, transformRuleDomainToRule } from '../../transforms'; import { ruleDomainSchema } from '../../schemas'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/clone/types/clone_rule_params.ts b/x-pack/plugins/alerting/server/application/rule/methods/clone/types/clone_rule_params.ts index 349b3b3b538f0..2aab498ec00d0 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/clone/types/clone_rule_params.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/clone/types/clone_rule_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { cloneRuleParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { cloneRuleParamsSchema } from '../schemas'; export type CloneRuleParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.test.ts index 61a2c8aad9442..9411c08b5d3e2 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.test.ts @@ -6,8 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { CreateRuleParams } from './create_rule'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client'; +import type { CreateRuleParams } from './create_rule'; +import type { ConstructorOptions } from '../../../../rules_client'; +import { RulesClient } from '../../../../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -19,8 +20,8 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization, ActionsClient } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization, ActionsClient } from '@kbn/actions-plugin/server'; import { ruleNotifyWhen } from '../../constants'; import { TaskStatus } from '@kbn/task-manager-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; @@ -29,9 +30,9 @@ import { RecoveredActionGroup } from '../../../../../common'; import { bulkMarkApiKeysForInvalidation } from '../../../../invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation'; import { getRuleExecutionStatusPending, getDefaultMonitoring } from '../../../../lib'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; -import { ConnectorAdapter } from '../../../../connector_adapters/types'; -import { RuleDomain } from '../../types'; -import { RuleSystemAction } from '../../../../types'; +import type { ConnectorAdapter } from '../../../../connector_adapters/types'; +import type { RuleDomain } from '../../types'; +import type { RuleSystemAction } from '../../../../types'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.ts index 34e13b65d76c5..8d932a885b5df 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/create/create_rule.ts @@ -6,7 +6,8 @@ */ import Semver from 'semver'; import Boom from '@hapi/boom'; -import { SavedObject, SavedObjectsUtils } from '@kbn/core/server'; +import type { SavedObject } from '@kbn/core/server'; +import { SavedObjectsUtils } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; import { validateAndAuthorizeSystemActions } from '../../../../lib/validate_authorize_system_actions'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; @@ -25,9 +26,9 @@ import { } from '../../../../rules_client/lib'; import { generateAPIKeyName, apiKeyAsRuleDomainProperties } from '../../../../rules_client/common'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { RulesClientContext } from '../../../../rules_client/types'; -import { RuleDomain, RuleParams } from '../../types'; -import { RawRule, SanitizedRule } from '../../../../types'; +import type { RulesClientContext } from '../../../../rules_client/types'; +import type { RuleDomain, RuleParams } from '../../types'; +import type { RawRule, SanitizedRule } from '../../../../types'; import { transformRuleAttributesToRuleDomain, transformRuleDomainToRuleAttributes, @@ -37,7 +38,8 @@ import { ruleDomainSchema } from '../../schemas'; import type { CreateRuleData } from './types'; import { createRuleDataSchema } from './schemas'; import { createRuleSavedObject } from '../../../../rules_client/lib'; -import { validateScheduleLimit, ValidateScheduleLimitResult } from '../get_schedule_frequency'; +import type { ValidateScheduleLimitResult } from '../get_schedule_frequency'; +import { validateScheduleLimit } from '../get_schedule_frequency'; export interface CreateRuleOptions { id?: string; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/create/types/create_rule_data.ts b/x-pack/plugins/alerting/server/application/rule/methods/create/types/create_rule_data.ts index 0c7a14b9f9727..0fd75188fd6cb 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/create/types/create_rule_data.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/create/types/create_rule_data.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { createRuleDataSchema } from '../schemas'; -import { RuleParams } from '../../../types'; +import type { TypeOf } from '@kbn/config-schema'; +import type { createRuleDataSchema } from '../schemas'; +import type { RuleParams } from '../../../types'; type CreateRuleDataType = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/delete/delete_rule.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/delete/delete_rule.test.ts index 7491df9d3df19..9ddc962c261d1 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/delete/delete_rule.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/delete/delete_rule.test.ts @@ -7,7 +7,8 @@ import { AlertConsumers } from '@kbn/rule-data-utils'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -19,8 +20,8 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup } from '../../../../rules_client/tests/lib'; import { bulkMarkApiKeysForInvalidation } from '../../../../invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/delete/delete_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/delete/delete_rule.ts index dd3aaf5e82f78..2e92665f5fb2f 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/delete/delete_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/delete/delete_rule.ts @@ -7,15 +7,15 @@ import Boom from '@hapi/boom'; import { AlertConsumers } from '@kbn/rule-data-utils'; -import { RawRule } from '../../../../types'; +import type { RawRule } from '../../../../types'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { bulkMarkApiKeysForInvalidation } from '../../../../invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { untrackRuleAlerts, migrateLegacyActions } from '../../../../rules_client/lib'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { DeleteRuleParams } from './types'; +import type { DeleteRuleParams } from './types'; import { deleteRuleParamsSchema } from './schemas'; import { deleteRuleSo, getDecryptedRuleSo, getRuleSo } from '../../../../data/rule'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/delete/types/delete_rule_params.ts b/x-pack/plugins/alerting/server/application/rule/methods/delete/types/delete_rule_params.ts index 69d54b9387f72..d2da0885db088 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/delete/types/delete_rule_params.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/delete/types/delete_rule_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { deleteRuleParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { deleteRuleParamsSchema } from '../schemas'; export type DeleteRuleParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/disable/disable_rule.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/disable/disable_rule.test.ts index 62608ed8271da..200032812ceb1 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/disable/disable_rule.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/disable/disable_rule.test.ts @@ -6,7 +6,8 @@ */ import { AlertConsumers } from '@kbn/rule-data-utils'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -18,8 +19,8 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; import { eventLoggerMock } from '@kbn/event-log-plugin/server/event_logger.mock'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/disable/disable_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/disable/disable_rule.ts index f1865f123484b..03dae00237f5f 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/disable/disable_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/disable/disable_rule.ts @@ -7,14 +7,14 @@ import type { SavedObjectReference } from '@kbn/core/server'; import Boom from '@hapi/boom'; -import { RawRule } from '../../../../types'; +import type { RawRule } from '../../../../types'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { untrackRuleAlerts, updateMeta, migrateLegacyActions } from '../../../../rules_client/lib'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { DisableRuleParams } from './types'; +import type { DisableRuleParams } from './types'; import { disableRuleParamsSchema } from './schemas'; export async function disableRule( diff --git a/x-pack/plugins/alerting/server/application/rule/methods/disable/types/index.ts b/x-pack/plugins/alerting/server/application/rule/methods/disable/types/index.ts index 19b12bc91c2e8..10902eece3be5 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/disable/types/index.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/disable/types/index.ts @@ -5,6 +5,6 @@ * 2.0. */ import type { TypeOf } from '@kbn/config-schema'; -import { disableRuleParamsSchema } from '../schemas'; +import type { disableRuleParamsSchema } from '../schemas'; export type DisableRuleParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/enable_rule.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/enable_rule.test.ts index fd4536db38946..90f1bdef9155f 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/enable_rule.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/enable_rule.test.ts @@ -6,7 +6,8 @@ */ import { AlertConsumers } from '@kbn/rule-data-utils'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -18,8 +19,8 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { TaskStatus } from '@kbn/task-manager-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/enable_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/enable_rule.ts index d4c2e91787aef..4daafd6cf53d6 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/enable_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/enable_rule.ts @@ -7,12 +7,12 @@ import Boom from '@hapi/boom'; import type { SavedObjectReference } from '@kbn/core/server'; import { TaskStatus } from '@kbn/task-manager-plugin/server'; -import { RawRule, IntervalSchedule } from '../../../../types'; +import type { RawRule, IntervalSchedule } from '../../../../types'; import { resetMonitoringLastRun, getNextRun } from '../../../../lib'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { updateMeta, createNewAPIKeySet, @@ -22,7 +22,7 @@ import { import { validateScheduleLimit } from '../get_schedule_frequency'; import { getRuleCircuitBreakerErrorMessage } from '../../../../../common'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { EnableRuleParams } from './types'; +import type { EnableRuleParams } from './types'; import { enableRuleParamsSchema } from './schemas'; export async function enableRule( diff --git a/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/types/enable_rule_types.ts b/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/types/enable_rule_types.ts index d1291a05307a1..a54f785438ca6 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/types/enable_rule_types.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/enable_rule/types/enable_rule_types.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { enableRuleParamsSchema } from '../schemas'; +import type { enableRuleParamsSchema } from '../schemas'; export type EnableRuleParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/find/find_rules.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/find/find_rules.test.ts index e6bfd3408a538..90d87b2b13891 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/find/find_rules.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/find/find_rules.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -18,12 +19,12 @@ import { alertingAuthorizationMock } from '../../../../authorization/alerting_au import { nodeTypes, fromKueryExpression } from '@kbn/es-query'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; import { RecoveredActionGroup } from '../../../../../common'; -import { RegistryRuleType } from '../../../../rule_type_registry'; +import type { RegistryRuleType } from '../../../../rule_type_registry'; import { schema } from '@kbn/config-schema'; import { enabledRule1, diff --git a/x-pack/plugins/alerting/server/application/rule/methods/find/find_rules.ts b/x-pack/plugins/alerting/server/application/rule/methods/find/find_rules.ts index 7e4efb2665f6b..5cd6fdb40ac4a 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/find/find_rules.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/find/find_rules.ts @@ -7,9 +7,10 @@ import Boom from '@hapi/boom'; import { isEmpty, pick } from 'lodash'; -import { KueryNode, nodeBuilder } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; +import { nodeBuilder } from '@kbn/es-query'; import { AlertConsumers } from '@kbn/rule-data-utils'; -import { SanitizedRule, Rule as DeprecatedRule, RawRule } from '../../../../types'; +import type { SanitizedRule, Rule as DeprecatedRule, RawRule } from '../../../../types'; import { AlertingAuthorizationEntity } from '../../../../authorization'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; import { @@ -30,7 +31,7 @@ import { formatLegacyActions, getAlertFromRaw } from '../../../../rules_client/l import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import type { FindRulesParams } from './types'; import { findRulesParamsSchema } from './schemas'; -import { Rule, RuleParams } from '../../types'; +import type { Rule, RuleParams } from '../../types'; import { findRulesSo } from '../../../../data/rule'; export interface FindResult { diff --git a/x-pack/plugins/alerting/server/application/rule/methods/find/types/find_rules_types.ts b/x-pack/plugins/alerting/server/application/rule/methods/find/types/find_rules_types.ts index 615a5b5db8672..f91fa18e1d9fb 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/find/types/find_rules_types.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/find/types/find_rules_types.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { findRulesOptionsSchema, findRulesParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { findRulesOptionsSchema, findRulesParamsSchema } from '../schemas'; export type FindRulesOptions = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/get/get_rule.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/get/get_rule.test.ts index 6c51b7e25f288..91f8fefad14eb 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/get/get_rule.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/get/get_rule.test.ts @@ -6,7 +6,8 @@ */ import { AlertConsumers } from '@kbn/rule-data-utils'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -18,8 +19,8 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; import { RecoveredActionGroup } from '../../../../../common'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/get/get_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/get/get_rule.ts index 548e25fad87c6..cd7868b9243d7 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/get/get_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/get/get_rule.ts @@ -7,21 +7,21 @@ import Boom from '@hapi/boom'; import { AlertConsumers } from '@kbn/rule-data-utils'; -import { +import type { SanitizedRule, SanitizedRuleWithLegacyId, Rule as DeprecatedRule, } from '../../../../types'; import { ReadOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { formatLegacyActions } from '../../../../rules_client/lib'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { GetRuleParams } from './types'; +import type { GetRuleParams } from './types'; import { getRuleParamsSchema } from './schemas'; import { getRuleSo } from '../../../../data/rule'; import { transformRuleAttributesToRuleDomain, transformRuleDomainToRule } from '../../transforms'; -import { RuleParams } from '../../types'; +import type { RuleParams } from '../../types'; import { ruleDomainSchema } from '../../schemas'; export async function getRule( diff --git a/x-pack/plugins/alerting/server/application/rule/methods/get/types/get_rule_params.ts b/x-pack/plugins/alerting/server/application/rule/methods/get/types/get_rule_params.ts index 63f6724829f28..8c6b3ee785c44 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/get/types/get_rule_params.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/get/types/get_rule_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { getRuleParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { getRuleParamsSchema } from '../schemas'; export type GetRuleParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/get_schedule_frequency.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/get_schedule_frequency.test.ts index f7f8e069e9822..7cf8554419934 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/get_schedule_frequency.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/get_schedule_frequency.test.ts @@ -6,7 +6,8 @@ */ import { validateScheduleLimit } from './get_schedule_frequency'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client'; +import type { ConstructorOptions } from '../../../../rules_client'; +import { RulesClient } from '../../../../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -18,8 +19,8 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/get_schedule_frequency.ts b/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/get_schedule_frequency.ts index d30d172113248..b0e6d7ee50fcf 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/get_schedule_frequency.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/get_schedule_frequency.ts @@ -5,10 +5,10 @@ * 2.0. */ import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { RulesClientContext } from '../../../../rules_client/types'; -import { RuleDomain } from '../../types'; +import type { RulesClientContext } from '../../../../rules_client/types'; +import type { RuleDomain } from '../../types'; import { convertDurationToFrequency } from '../../../../../common/parse_duration'; -import { GetScheduleFrequencyResult } from './types'; +import type { GetScheduleFrequencyResult } from './types'; import { getSchemaFrequencyResultSchema } from './schema'; export interface SchedulesIntervalAggregationResult { diff --git a/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/types/get_schedule_frequency_result.ts b/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/types/get_schedule_frequency_result.ts index 4f53ea2e82810..d485889da3209 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/types/get_schedule_frequency_result.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/get_schedule_frequency/types/get_schedule_frequency_result.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { getSchemaFrequencyResultSchema } from '../schema'; +import type { TypeOf } from '@kbn/config-schema'; +import type { getSchemaFrequencyResultSchema } from '../schema'; export type GetScheduleFrequencyResult = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/mute_alert/mute_instance.ts b/x-pack/plugins/alerting/server/application/rule/methods/mute_alert/mute_instance.ts index 62283bf6e111a..72dde6e74fb7a 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/mute_alert/mute_instance.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/mute_alert/mute_instance.ts @@ -10,11 +10,11 @@ import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { updateRuleSo } from '../../../../data/rule/methods/update_rule_so'; import { muteAlertParamsSchema } from './schemas'; import type { MuteAlertParams } from './types'; -import { Rule } from '../../../../types'; +import type { Rule } from '../../../../types'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { updateMeta } from '../../../../rules_client/lib'; export async function muteInstance( diff --git a/x-pack/plugins/alerting/server/application/rule/methods/mute_alert/types/mute_alert_params.ts b/x-pack/plugins/alerting/server/application/rule/methods/mute_alert/types/mute_alert_params.ts index f94f454f1f78c..9138b451cbbcb 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/mute_alert/types/mute_alert_params.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/mute_alert/types/mute_alert_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { muteAlertParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { muteAlertParamsSchema } from '../schemas'; export type MuteAlertParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/mute_all/mute_all.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/mute_all/mute_all.test.ts index eba9fc4cbf7d4..176eb54540c00 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/mute_all/mute_all.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/mute_all/mute_all.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RulesClientContext } from '../../../../rules_client'; +import type { RulesClientContext } from '../../../../rules_client'; import { muteAll } from './mute_all'; import { savedObjectsRepositoryMock } from '@kbn/core-saved-objects-api-server-mocks'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/mute_all/mute_all.ts b/x-pack/plugins/alerting/server/application/rule/methods/mute_all/mute_all.ts index d0d2c186ba126..a9b92699acec8 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/mute_all/mute_all.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/mute_all/mute_all.ts @@ -6,15 +6,15 @@ */ import Boom from '@hapi/boom'; -import { RawRule } from '../../../../types'; +import type { RawRule } from '../../../../types'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { partiallyUpdateRule, RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { updateMetaAttributes } from '../../../../rules_client/lib'; import { clearUnscheduledSnoozeAttributes } from '../../../../rules_client/common'; -import { MuteAllRuleParams } from './types'; +import type { MuteAllRuleParams } from './types'; import { muteAllRuleParamsSchema } from './schemas'; export async function muteAll( diff --git a/x-pack/plugins/alerting/server/application/rule/methods/mute_all/types/mute_all_rule_types.ts b/x-pack/plugins/alerting/server/application/rule/methods/mute_all/types/mute_all_rule_types.ts index 4f4ad36dbc23a..7187951e441f8 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/mute_all/types/mute_all_rule_types.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/mute_all/types/mute_all_rule_types.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { muteAllRuleParamsSchema } from '../schemas'; +import type { muteAllRuleParamsSchema } from '../schemas'; export type MuteAllRuleParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/resolve/resolve.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/resolve/resolve.test.ts index d1706a890c8e8..d8e38dc6b5f5c 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/resolve/resolve.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/resolve/resolve.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { ConstructorOptions, RulesClient } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -17,8 +18,8 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/resolve/resolve_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/resolve/resolve_rule.ts index fd9ae07d7ebd2..78b0a3177e72f 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/resolve/resolve_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/resolve/resolve_rule.ts @@ -10,12 +10,12 @@ import { AlertConsumers } from '@kbn/rule-data-utils'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { resolveRuleSavedObject } from '../../../../rules_client/lib'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { RuleTypeParams } from '../../../../types'; +import type { RuleTypeParams } from '../../../../types'; import { ReadOperations, AlertingAuthorizationEntity } from '../../../../authorization'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { formatLegacyActions } from '../../../../rules_client/lib'; import { transformRuleAttributesToRuleDomain, transformRuleDomainToRule } from '../../transforms'; -import { Rule } from '../../types'; +import type { Rule } from '../../types'; import { ruleSchema } from '../../schemas'; import { resolveRuleParamsSchema } from './schemas'; import type { ResolvedSanitizedRule } from '../../../../types'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/rule_types/rule_types.ts b/x-pack/plugins/alerting/server/application/rule/methods/rule_types/rule_types.ts index 66256b4b7d7eb..9f51f0651462a 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/rule_types/rule_types.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/rule_types/rule_types.ts @@ -10,7 +10,7 @@ import { ReadOperations, AlertingAuthorizationEntity, } from '../../../../authorization'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; export async function listRuleTypes(context: RulesClientContext) { return await context.authorization.filterByRuleTypeAuthorization( diff --git a/x-pack/plugins/alerting/server/application/rule/methods/snooze/snooze_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/snooze/snooze_rule.ts index d736cf5227e4c..e79b67285f09e 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/snooze/snooze_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/snooze/snooze_rule.ts @@ -14,7 +14,7 @@ import { WriteOperations, AlertingAuthorizationEntity } from '../../../../author import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { validateSnoozeStartDate } from '../../../../lib/validate_snooze_date'; import { RuleMutedError } from '../../../../lib/errors/rule_muted'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { getSnoozeAttributes, verifySnoozeAttributeScheduleLimit, diff --git a/x-pack/plugins/alerting/server/application/rule/methods/snooze/types/snooze_rule_options.ts b/x-pack/plugins/alerting/server/application/rule/methods/snooze/types/snooze_rule_options.ts index 77d077b6ee0e5..805b42bb82432 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/snooze/types/snooze_rule_options.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/snooze/types/snooze_rule_options.ts @@ -4,8 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { ruleSnoozeScheduleSchema as ruleSnoozeScheduleRequestSchema } from '../../../../../../common/routes/rule/request'; +import type { TypeOf } from '@kbn/config-schema'; +import type { ruleSnoozeScheduleSchema as ruleSnoozeScheduleRequestSchema } from '../../../../../../common/routes/rule/request'; export interface SnoozeRuleOptions { id: string; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/tags/get_rule_tags.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/tags/get_rule_tags.test.ts index de356c3a2e2b9..d4c365d862a30 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/tags/get_rule_tags.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/tags/get_rule_tags.test.ts @@ -5,7 +5,8 @@ * 2.0. */ import { v4 } from 'uuid'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -17,12 +18,12 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup } from '../../../../rules_client/tests/lib'; import { RecoveredActionGroup } from '../../../../../common'; -import { RegistryRuleType } from '../../../../rule_type_registry'; +import type { RegistryRuleType } from '../../../../rule_type_registry'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/tags/get_rule_tags.ts b/x-pack/plugins/alerting/server/application/rule/methods/tags/get_rule_tags.ts index c26fae42ce324..de8198f7c37df 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/tags/get_rule_tags.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/tags/get_rule_tags.ts @@ -5,12 +5,14 @@ * 2.0. */ import Boom from '@hapi/boom'; -import { KueryNode, nodeBuilder, nodeTypes } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; +import { nodeBuilder, nodeTypes } from '@kbn/es-query'; import { findRulesSo } from '../../../../data/rule/methods/find_rules_so'; -import { ruleTagsParamsSchema, RuleTagsParams, RuleTagsAggregationResult } from '.'; +import type { RuleTagsParams, RuleTagsAggregationResult } from '.'; +import { ruleTagsParamsSchema } from '.'; import type { RuleTagsFormattedResponse } from '../../../../../common/routes/rule/apis/tags'; import { DEFAULT_TAGS_PER_PAGE } from '../../../../../common/routes/rule/apis/tags/constants/latest'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { AlertingAuthorizationEntity } from '../../../../authorization'; import { alertingAuthorizationFilterOpts } from '../../../../rules_client/common/constants'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/tags/types/rule_tags_aggregation_result.ts b/x-pack/plugins/alerting/server/application/rule/methods/tags/types/rule_tags_aggregation_result.ts index 4dabbc9393ea2..c90a123821c9a 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/tags/types/rule_tags_aggregation_result.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/tags/types/rule_tags_aggregation_result.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { ruleTagsAggregationResultSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { ruleTagsAggregationResultSchema } from '../schemas'; export type RuleTagsAggregationResult = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/tags/types/rule_tags_params.ts b/x-pack/plugins/alerting/server/application/rule/methods/tags/types/rule_tags_params.ts index c5142616ed56b..436875dc67761 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/tags/types/rule_tags_params.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/tags/types/rule_tags_params.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { ruleTagsParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { ruleTagsParamsSchema } from '../schemas'; export type RuleTagsParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/unmute_alert/types/unmute_alert_params.ts b/x-pack/plugins/alerting/server/application/rule/methods/unmute_alert/types/unmute_alert_params.ts index ae83c5b6d4b7e..26ebd723458c0 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/unmute_alert/types/unmute_alert_params.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/unmute_alert/types/unmute_alert_params.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { unmuteAlertParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { unmuteAlertParamsSchema } from '../schemas'; export type UnmuteAlertParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/unmute_alert/unmute_instance.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/unmute_alert/unmute_instance.test.ts index 31d0e997b7ffe..3f041799f248b 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/unmute_alert/unmute_instance.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/unmute_alert/unmute_instance.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -17,8 +18,8 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/types/unmute_all_rule_types.ts b/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/types/unmute_all_rule_types.ts index 3e82d8901dc01..dd4a662619fba 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/types/unmute_all_rule_types.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/types/unmute_all_rule_types.ts @@ -6,6 +6,6 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { unmuteAllRuleParamsSchema } from '../schemas'; +import type { unmuteAllRuleParamsSchema } from '../schemas'; export type UnmuteAllRuleParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/unmute_all.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/unmute_all.test.ts index 531b157a66899..fb48e80ef26e5 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/unmute_all.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/unmute_all.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RulesClientContext } from '../../../../rules_client'; +import type { RulesClientContext } from '../../../../rules_client'; import { unmuteAll } from './unmute_all'; import { savedObjectsRepositoryMock } from '@kbn/core-saved-objects-api-server-mocks'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/unmute_all.ts b/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/unmute_all.ts index bc70f7206fbb4..556a2614c77f5 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/unmute_all.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/unmute_all/unmute_all.ts @@ -6,15 +6,15 @@ */ import Boom from '@hapi/boom'; -import { RawRule } from '../../../../types'; +import type { RawRule } from '../../../../types'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { partiallyUpdateRule, RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { updateMetaAttributes } from '../../../../rules_client/lib'; import { clearUnscheduledSnoozeAttributes } from '../../../../rules_client/common'; -import { UnmuteAllRuleParams } from './types'; +import type { UnmuteAllRuleParams } from './types'; import { unmuteAllRuleParamsSchema } from './schemas'; export async function unmuteAll( diff --git a/x-pack/plugins/alerting/server/application/rule/methods/unsnooze/unsnooze_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/unsnooze/unsnooze_rule.ts index 13a9a96b53ad4..e1e1ae723d97c 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/unsnooze/unsnooze_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/unsnooze/unsnooze_rule.ts @@ -12,7 +12,7 @@ import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common import { getRuleSavedObject } from '../../../../rules_client/lib'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { getUnsnoozeAttributes } from '../../../../rules_client/common'; import { updateRuleSo } from '../../../../data/rule'; import { updateMetaAttributes } from '../../../../rules_client/lib/update_meta_attributes'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/update/types/update_rule_data.ts b/x-pack/plugins/alerting/server/application/rule/methods/update/types/update_rule_data.ts index cfde60b91c1f3..34ae35ac4c0f9 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/update/types/update_rule_data.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/update/types/update_rule_data.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { updateRuleDataSchema } from '../schemas'; -import { RuleParams } from '../../../types'; +import type { TypeOf } from '@kbn/config-schema'; +import type { updateRuleDataSchema } from '../schemas'; +import type { RuleParams } from '../../../types'; type UpdateRuleDataType = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/update/update_rule.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/update/update_rule.test.ts index 4031d0b3175cf..b72adfb187049 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/update/update_rule.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/update/update_rule.test.ts @@ -8,7 +8,8 @@ import { v4 as uuidv4 } from 'uuid'; import { schema } from '@kbn/config-schema'; import { AlertConsumers } from '@kbn/rule-data-utils'; -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -18,12 +19,13 @@ import { import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; -import { IntervalSchedule, RuleNotifyWhen } from '../../../../types'; +import type { IntervalSchedule } from '../../../../types'; +import { RuleNotifyWhen } from '../../../../types'; import { RecoveredActionGroup } from '../../../../../common'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization, ActionsClient } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization, ActionsClient } from '@kbn/actions-plugin/server'; import { TaskStatus } from '@kbn/task-manager-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; @@ -31,7 +33,7 @@ import { bulkMarkApiKeysForInvalidation } from '../../../../invalidate_pending_a import { migrateLegacyActions } from '../../../../rules_client/lib'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { ConnectorAdapterRegistry } from '../../../../connector_adapters/connector_adapter_registry'; -import { RuleDomain } from '../../types'; +import type { RuleDomain } from '../../types'; import { backfillClientMock } from '../../../../backfill_client/backfill_client.mock'; jest.mock('../../../../rules_client/lib/siem_legacy_actions/migrate_legacy_actions', () => { diff --git a/x-pack/plugins/alerting/server/application/rule/methods/update/update_rule.ts b/x-pack/plugins/alerting/server/application/rule/methods/update/update_rule.ts index 25759e8e06c70..8cd814f155ddb 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/update/update_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/update/update_rule.ts @@ -7,8 +7,8 @@ import Boom from '@hapi/boom'; import { isEqual, omit } from 'lodash'; -import { SavedObject } from '@kbn/core/server'; -import { SanitizedRule, RawRule } from '../../../../types'; +import type { SavedObject } from '@kbn/core/server'; +import type { SanitizedRule, RawRule } from '../../../../types'; import { validateRuleTypeParams, getRuleNotifyWhenType } from '../../../../lib'; import { validateAndAuthorizeSystemActions } from '../../../../lib/validate_authorize_system_actions'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; @@ -17,7 +17,7 @@ import { getMappedParams } from '../../../../rules_client/common/mapped_params_u import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { bulkMarkApiKeysForInvalidation } from '../../../../invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; -import { +import type { RulesClientContext, NormalizedAlertActionWithGeneratedValues, } from '../../../../rules_client/types'; @@ -30,11 +30,12 @@ import { migrateLegacyActions, updateMetaAttributes, } from '../../../../rules_client/lib'; -import { RuleParams } from '../../types'; +import type { RuleParams } from '../../types'; import type { UpdateRuleData } from './types'; import { createRuleSo, getDecryptedRuleSo, getRuleSo } from '../../../../data/rule'; -import { validateScheduleLimit, ValidateScheduleLimitResult } from '../get_schedule_frequency'; +import type { ValidateScheduleLimitResult } from '../get_schedule_frequency'; +import { validateScheduleLimit } from '../get_schedule_frequency'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; import { updateRuleDataSchema } from './schemas'; import { transformRuleAttributesToRuleDomain, transformRuleDomainToRule } from '../../transforms'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/types/update_rule_api_key_types.ts b/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/types/update_rule_api_key_types.ts index 07dffdc3124b8..5b09282ae4dce 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/types/update_rule_api_key_types.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/types/update_rule_api_key_types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { updateApiKeyParamsSchema } from '../schemas'; +import type { TypeOf } from '@kbn/config-schema'; +import type { updateApiKeyParamsSchema } from '../schemas'; export type UpdateApiKeyParams = TypeOf; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/update_rule_api_key.test.ts b/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/update_rule_api_key.test.ts index 003bae5da67bc..a486ae5bbabe4 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/update_rule_api_key.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/update_rule_api_key.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../../../../rules_client/rules_client'; +import type { ConstructorOptions } from '../../../../rules_client/rules_client'; +import { RulesClient } from '../../../../rules_client/rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -17,8 +18,8 @@ import { ruleTypeRegistryMock } from '../../../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from '../../../../rules_client/tests/lib'; import { bulkMarkApiKeysForInvalidation } from '../../../../invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation'; diff --git a/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/update_rule_api_key.ts b/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/update_rule_api_key.ts index 955109c05bde7..7f37583019ada 100644 --- a/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/update_rule_api_key.ts +++ b/x-pack/plugins/alerting/server/application/rule/methods/update_api_key/update_rule_api_key.ts @@ -6,15 +6,15 @@ */ import Boom from '@hapi/boom'; -import { RawRule } from '../../../../types'; +import type { RawRule } from '../../../../types'; import { WriteOperations, AlertingAuthorizationEntity } from '../../../../authorization'; import { retryIfConflicts } from '../../../../lib/retry_if_conflicts'; import { bulkMarkApiKeysForInvalidation } from '../../../../invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation'; import { ruleAuditEvent, RuleAuditAction } from '../../../../rules_client/common/audit_events'; import { createNewAPIKeySet, updateMeta } from '../../../../rules_client/lib'; -import { RulesClientContext } from '../../../../rules_client/types'; +import type { RulesClientContext } from '../../../../rules_client/types'; import { RULE_SAVED_OBJECT_TYPE } from '../../../../saved_objects'; -import { UpdateApiKeyParams } from './types'; +import type { UpdateApiKeyParams } from './types'; import { updateApiKeyParamsSchema } from './schemas'; export async function updateRuleApiKey( diff --git a/x-pack/plugins/alerting/server/application/rule/transforms/transform_raw_actions_to_domain_actions.test.ts b/x-pack/plugins/alerting/server/application/rule/transforms/transform_raw_actions_to_domain_actions.test.ts index 7b25ebf45ce8d..5e091d330dd0a 100644 --- a/x-pack/plugins/alerting/server/application/rule/transforms/transform_raw_actions_to_domain_actions.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/transforms/transform_raw_actions_to_domain_actions.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RawRuleAction } from '../../../types'; +import type { RawRuleAction } from '../../../types'; import { transformRawActionsToDomainActions, transformRawActionsToDomainSystemActions, diff --git a/x-pack/plugins/alerting/server/application/rule/transforms/transform_raw_actions_to_domain_actions.ts b/x-pack/plugins/alerting/server/application/rule/transforms/transform_raw_actions_to_domain_actions.ts index 7242f4bb1c716..9cde36d1c5583 100644 --- a/x-pack/plugins/alerting/server/application/rule/transforms/transform_raw_actions_to_domain_actions.ts +++ b/x-pack/plugins/alerting/server/application/rule/transforms/transform_raw_actions_to_domain_actions.ts @@ -6,10 +6,10 @@ */ import { omit } from 'lodash'; -import { SavedObjectReference } from '@kbn/core/server'; +import type { SavedObjectReference } from '@kbn/core/server'; import { injectReferencesIntoActions } from '../../../rules_client/common'; -import { RawRule } from '../../../types'; -import { RuleDomain } from '../types'; +import type { RawRule } from '../../../types'; +import type { RuleDomain } from '../types'; interface Args { ruleId: string; diff --git a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_attributes_to_rule_domain.test.ts b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_attributes_to_rule_domain.test.ts index a96fbcceaffba..f9da684baa9e8 100644 --- a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_attributes_to_rule_domain.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_attributes_to_rule_domain.test.ts @@ -8,8 +8,8 @@ import { RecoveredActionGroup } from '../../../../common'; import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { transformRuleAttributesToRuleDomain } from './transform_rule_attributes_to_rule_domain'; -import { UntypedNormalizedRuleType } from '../../../rule_type_registry'; -import { RawRuleAction } from '../../../types'; +import type { UntypedNormalizedRuleType } from '../../../rule_type_registry'; +import type { RawRuleAction } from '../../../types'; const ruleType: jest.Mocked = { id: 'test.rule-type', diff --git a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_attributes_to_rule_domain.ts b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_attributes_to_rule_domain.ts index 8d71e43130647..885538ee81ee8 100644 --- a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_attributes_to_rule_domain.ts +++ b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_attributes_to_rule_domain.ts @@ -5,13 +5,13 @@ * 2.0. */ import { isEmpty } from 'lodash'; -import { Logger } from '@kbn/core/server'; -import { SavedObjectReference } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; +import type { SavedObjectReference } from '@kbn/core/server'; import { ruleExecutionStatusValues } from '../constants'; import { getRuleSnoozeEndTime } from '../../../lib'; -import { RuleDomain, Monitoring, RuleParams } from '../types'; -import { PartialRule, RawRule, RawRuleExecutionStatus, SanitizedRule } from '../../../types'; -import { UntypedNormalizedRuleType } from '../../../rule_type_registry'; +import type { RuleDomain, Monitoring, RuleParams } from '../types'; +import type { PartialRule, RawRule, RawRuleExecutionStatus, SanitizedRule } from '../../../types'; +import type { UntypedNormalizedRuleType } from '../../../rule_type_registry'; import { injectReferencesIntoParams } from '../../../rules_client/common'; import { getActiveScheduledSnoozes } from '../../../lib/is_rule_snoozed'; import { diff --git a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule.test.ts b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule.test.ts index dba50d17612ad..e80b526cca349 100644 --- a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule.test.ts @@ -6,7 +6,7 @@ */ import { transformRuleDomainToRule } from './transform_rule_domain_to_rule'; -import { RuleDomain } from '../types'; +import type { RuleDomain } from '../types'; describe('transformRuleDomainToRule', () => { const MOCK_API_KEY = Buffer.from('123:abc').toString('base64'); diff --git a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule.ts b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule.ts index db9f63a5d0338..3373052d67b2e 100644 --- a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RuleDomain, Rule, RuleParams } from '../types'; +import type { RuleDomain, Rule, RuleParams } from '../types'; interface TransformRuleDomainToRuleOptions { isPublic?: boolean; diff --git a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule_attributes.test.ts b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule_attributes.test.ts index 73c39532b9ab9..52246dde4f647 100644 --- a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule_attributes.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule_attributes.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RuleDomain } from '../types'; +import type { RuleDomain } from '../types'; import { transformRuleDomainToRuleAttributes } from './transform_rule_domain_to_rule_attributes'; describe('transformRuleDomainToRuleAttributes', () => { diff --git a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule_attributes.ts b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule_attributes.ts index f3769f48e8110..07f6d1c50deaa 100644 --- a/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule_attributes.ts +++ b/x-pack/plugins/alerting/server/application/rule/transforms/transform_rule_domain_to_rule_attributes.ts @@ -4,10 +4,10 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { RawRule } from '../../../types'; -import { RuleDomain } from '../types'; +import type { RawRule } from '../../../types'; +import type { RuleDomain } from '../types'; import { getMappedParams } from '../../../rules_client/common'; -import { DenormalizedAction } from '../../../rules_client'; +import type { DenormalizedAction } from '../../../rules_client'; interface TransformRuleToEsParams { legacyId: RawRule['legacyId']; diff --git a/x-pack/plugins/alerting/server/application/rule/types/action.ts b/x-pack/plugins/alerting/server/application/rule/types/action.ts index 559b708dd9038..979c8b21916eb 100644 --- a/x-pack/plugins/alerting/server/application/rule/types/action.ts +++ b/x-pack/plugins/alerting/server/application/rule/types/action.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { +import type { TypeOf } from '@kbn/config-schema'; +import type { actionSchema, actionRequestSchema, systemActionSchema, diff --git a/x-pack/plugins/alerting/server/application/rule/types/rule.ts b/x-pack/plugins/alerting/server/application/rule/types/rule.ts index 2e5cad45cf92f..103b397caefb5 100644 --- a/x-pack/plugins/alerting/server/application/rule/types/rule.ts +++ b/x-pack/plugins/alerting/server/application/rule/types/rule.ts @@ -5,16 +5,16 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { ruleParamsSchema } from '@kbn/response-ops-rule-params'; -import { +import type { TypeOf } from '@kbn/config-schema'; +import type { ruleParamsSchema } from '@kbn/response-ops-rule-params'; +import type { ruleNotifyWhen, ruleLastRunOutcomeValues, ruleExecutionStatusValues, ruleExecutionStatusErrorReason, ruleExecutionStatusWarningReason, } from '../constants'; -import { +import type { snoozeScheduleSchema, ruleExecutionStatusSchema, ruleLastRunSchema, diff --git a/x-pack/plugins/alerting/server/application/rule/validation/validate_duration.ts b/x-pack/plugins/alerting/server/application/rule/validation/validate_duration.ts index d07d710687cc0..6e2b1b7db64bc 100644 --- a/x-pack/plugins/alerting/server/application/rule/validation/validate_duration.ts +++ b/x-pack/plugins/alerting/server/application/rule/validation/validate_duration.ts @@ -23,5 +23,5 @@ export function validateDuration(duration: string) { if (duration.match(DAYS_REGEX)) { return; } - return 'string is not a valid duration: ' + duration; + return `string is not a valid duration: ${duration}`; } diff --git a/x-pack/plugins/alerting/server/authorization/alerting_authorization.mock.ts b/x-pack/plugins/alerting/server/authorization/alerting_authorization.mock.ts index e51a5c9b12c79..2a900c37eeb1b 100644 --- a/x-pack/plugins/alerting/server/authorization/alerting_authorization.mock.ts +++ b/x-pack/plugins/alerting/server/authorization/alerting_authorization.mock.ts @@ -6,7 +6,7 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { AlertingAuthorization } from './alerting_authorization'; +import type { AlertingAuthorization } from './alerting_authorization'; type Schema = PublicMethodsOf; export type AlertingAuthorizationMock = jest.Mocked; diff --git a/x-pack/plugins/alerting/server/authorization/alerting_authorization.test.ts b/x-pack/plugins/alerting/server/authorization/alerting_authorization.test.ts index f1cfb99a6daaa..dc439bebf1710 100644 --- a/x-pack/plugins/alerting/server/authorization/alerting_authorization.test.ts +++ b/x-pack/plugins/alerting/server/authorization/alerting_authorization.test.ts @@ -5,14 +5,13 @@ * 2.0. */ -import { KueryNode, fromKueryExpression, toKqlExpression } from '@kbn/es-query'; -import { KibanaRequest } from '@kbn/core/server'; +import type { KueryNode } from '@kbn/es-query'; +import { fromKueryExpression, toKqlExpression } from '@kbn/es-query'; +import type { KibanaRequest } from '@kbn/core/server'; import { ruleTypeRegistryMock } from '../rule_type_registry.mock'; import { securityMock } from '@kbn/security-plugin/server/mocks'; -import { - FeaturesPluginStart as FeaturesStartContract, - KibanaFeature, -} from '@kbn/features-plugin/server'; +import type { FeaturesPluginStart as FeaturesStartContract } from '@kbn/features-plugin/server'; +import { KibanaFeature } from '@kbn/features-plugin/server'; import { featuresPluginMock } from '@kbn/features-plugin/server/mocks'; import { AlertingAuthorization, @@ -22,7 +21,7 @@ import { } from './alerting_authorization'; import { v4 as uuidv4 } from 'uuid'; import { RecoveredActionGroup } from '../../common'; -import { NormalizedRuleType, RegistryRuleType } from '../rule_type_registry'; +import type { NormalizedRuleType, RegistryRuleType } from '../rule_type_registry'; import { AlertingAuthorizationFilterType } from './alerting_authorization_kuery'; import { schema } from '@kbn/config-schema'; diff --git a/x-pack/plugins/alerting/server/authorization/alerting_authorization.ts b/x-pack/plugins/alerting/server/authorization/alerting_authorization.ts index 6b24f2f5de9a4..d2e30e778ae67 100644 --- a/x-pack/plugins/alerting/server/authorization/alerting_authorization.ts +++ b/x-pack/plugins/alerting/server/authorization/alerting_authorization.ts @@ -7,20 +7,18 @@ import Boom from '@hapi/boom'; import { has, isEmpty } from 'lodash'; -import { KibanaRequest } from '@kbn/core/server'; -import { JsonObject } from '@kbn/utility-types'; -import { KueryNode } from '@kbn/es-query'; -import { SecurityPluginSetup } from '@kbn/security-plugin/server'; -import { FeaturesPluginStart } from '@kbn/features-plugin/server'; -import { Space } from '@kbn/spaces-plugin/server'; +import type { KibanaRequest } from '@kbn/core/server'; +import type { JsonObject } from '@kbn/utility-types'; +import type { KueryNode } from '@kbn/es-query'; +import type { SecurityPluginSetup } from '@kbn/security-plugin/server'; +import type { FeaturesPluginStart } from '@kbn/features-plugin/server'; +import type { Space } from '@kbn/spaces-plugin/server'; import { STACK_ALERTS_FEATURE_ID } from '@kbn/rule-data-utils'; -import { RegistryRuleType } from '../rule_type_registry'; -import { ALERTING_FEATURE_ID, RuleTypeRegistry } from '../types'; -import { - asFiltersByRuleTypeAndConsumer, - asFiltersBySpaceId, - AlertingAuthorizationFilterOpts, -} from './alerting_authorization_kuery'; +import type { RegistryRuleType } from '../rule_type_registry'; +import type { RuleTypeRegistry } from '../types'; +import { ALERTING_FEATURE_ID } from '../types'; +import type { AlertingAuthorizationFilterOpts } from './alerting_authorization_kuery'; +import { asFiltersByRuleTypeAndConsumer, asFiltersBySpaceId } from './alerting_authorization_kuery'; export enum AlertingAuthorizationEntity { Rule = 'rule', diff --git a/x-pack/plugins/alerting/server/authorization/alerting_authorization_kuery.ts b/x-pack/plugins/alerting/server/authorization/alerting_authorization_kuery.ts index 01e30dfb38327..f5a98316e9253 100644 --- a/x-pack/plugins/alerting/server/authorization/alerting_authorization_kuery.ts +++ b/x-pack/plugins/alerting/server/authorization/alerting_authorization_kuery.ts @@ -6,10 +6,11 @@ */ import { remove } from 'lodash'; -import { EsQueryConfig, nodeBuilder, toElasticsearchQuery, KueryNode } from '@kbn/es-query'; +import type { EsQueryConfig, KueryNode } from '@kbn/es-query'; +import { nodeBuilder, toElasticsearchQuery } from '@kbn/es-query'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { RegistryAlertTypeWithAuth } from './alerting_authorization'; +import type { RegistryAlertTypeWithAuth } from './alerting_authorization'; export enum AlertingAuthorizationFilterType { KQL = 'kql', diff --git a/x-pack/plugins/alerting/server/backfill_client/backfill_client.test.ts b/x-pack/plugins/alerting/server/backfill_client/backfill_client.test.ts index 771f5a4db34b9..f6acda88b0fa9 100644 --- a/x-pack/plugins/alerting/server/backfill_client/backfill_client.test.ts +++ b/x-pack/plugins/alerting/server/backfill_client/backfill_client.test.ts @@ -7,21 +7,21 @@ import { adHocRunStatus } from '../../common/constants'; import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; -import { SavedObject, SavedObjectsBulkResponse } from '@kbn/core/server'; +import type { SavedObject, SavedObjectsBulkResponse } from '@kbn/core/server'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; -import { ScheduleBackfillParam } from '../application/backfill/methods/schedule/types'; -import { RuleDomain } from '../application/rule/types'; +import type { ScheduleBackfillParam } from '../application/backfill/methods/schedule/types'; +import type { RuleDomain } from '../application/rule/types'; import { ruleTypeRegistryMock } from '../rule_type_registry.mock'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE, RULE_SAVED_OBJECT_TYPE } from '../saved_objects'; import { BackfillClient } from './backfill_client'; -import { AdHocRunSO } from '../data/ad_hoc_run/types'; +import type { AdHocRunSO } from '../data/ad_hoc_run/types'; import { transformAdHocRunToBackfillResult } from '../application/backfill/transforms'; import { RecoveredActionGroup } from '@kbn/alerting-types'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; import { TaskRunnerFactory } from '../task_runner'; import { TaskPriority } from '@kbn/task-manager-plugin/server'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; const logger = loggingSystemMock.create().get(); const taskManagerSetup = taskManagerMock.createSetup(); diff --git a/x-pack/plugins/alerting/server/backfill_client/backfill_client.ts b/x-pack/plugins/alerting/server/backfill_client/backfill_client.ts index 48b5e49c428c0..4326b37c6f19e 100644 --- a/x-pack/plugins/alerting/server/backfill_client/backfill_client.ts +++ b/x-pack/plugins/alerting/server/backfill_client/backfill_client.ts @@ -5,42 +5,42 @@ * 2.0. */ -import { +import type { Logger, SavedObject, SavedObjectReference, SavedObjectsBulkCreateObject, SavedObjectsClientContract, - SavedObjectsErrorHelpers, SavedObjectsFindResult, } from '@kbn/core/server'; -import { AuditLogger } from '@kbn/security-plugin/server'; -import { +import { SavedObjectsErrorHelpers } from '@kbn/core/server'; +import type { AuditLogger } from '@kbn/security-plugin/server'; +import type { RunContext, TaskInstance, TaskManagerSetupContract, TaskManagerStartContract, - TaskPriority, } from '@kbn/task-manager-plugin/server'; +import { TaskPriority } from '@kbn/task-manager-plugin/server'; import { isNumber } from 'lodash'; -import { +import type { ScheduleBackfillError, ScheduleBackfillParam, ScheduleBackfillParams, ScheduleBackfillResult, ScheduleBackfillResults, } from '../application/backfill/methods/schedule/types'; -import { Backfill } from '../application/backfill/result/types'; +import type { Backfill } from '../application/backfill/result/types'; import { transformBackfillParamToAdHocRun, transformAdHocRunToBackfillResult, } from '../application/backfill/transforms'; -import { RuleDomain } from '../application/rule/types'; -import { AdHocRunSO } from '../data/ad_hoc_run/types'; +import type { RuleDomain } from '../application/rule/types'; +import type { AdHocRunSO } from '../data/ad_hoc_run/types'; import { AdHocRunAuditAction, adHocRunAuditEvent } from '../rules_client/common/audit_events'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE, RULE_SAVED_OBJECT_TYPE } from '../saved_objects'; -import { TaskRunnerFactory } from '../task_runner'; -import { RuleTypeRegistry } from '../types'; +import type { TaskRunnerFactory } from '../task_runner'; +import type { RuleTypeRegistry } from '../types'; import { createBackfillError } from './lib'; export const BACKFILL_TASK_TYPE = 'ad_hoc_run-backfill'; diff --git a/x-pack/plugins/alerting/server/backfill_client/lib/calculate_schedule.ts b/x-pack/plugins/alerting/server/backfill_client/lib/calculate_schedule.ts index f86738c296218..ccc681e805ed2 100644 --- a/x-pack/plugins/alerting/server/backfill_client/lib/calculate_schedule.ts +++ b/x-pack/plugins/alerting/server/backfill_client/lib/calculate_schedule.ts @@ -7,7 +7,7 @@ import { adHocRunStatus } from '../../../common/constants'; import { parseDuration } from '../../../common'; -import { AdHocRunSchedule } from '../../data/ad_hoc_run/types'; +import type { AdHocRunSchedule } from '../../data/ad_hoc_run/types'; export function calculateSchedule( start: string, diff --git a/x-pack/plugins/alerting/server/backfill_client/lib/create_backfill_error.ts b/x-pack/plugins/alerting/server/backfill_client/lib/create_backfill_error.ts index 917e9edd0e208..e08b0cebbb262 100644 --- a/x-pack/plugins/alerting/server/backfill_client/lib/create_backfill_error.ts +++ b/x-pack/plugins/alerting/server/backfill_client/lib/create_backfill_error.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ScheduleBackfillError } from '../../application/backfill/methods/schedule/types'; +import type { ScheduleBackfillError } from '../../application/backfill/methods/schedule/types'; export function createBackfillError( message: string, diff --git a/x-pack/plugins/alerting/server/config.ts b/x-pack/plugins/alerting/server/config.ts index be7790cd81888..a368f4a55fa75 100644 --- a/x-pack/plugins/alerting/server/config.ts +++ b/x-pack/plugins/alerting/server/config.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import type { TypeOf } from '@kbn/config-schema'; +import { schema } from '@kbn/config-schema'; import { validateDurationSchema, parseDuration } from './lib'; import { DEFAULT_CACHE_INTERVAL_MS } from './rules_settings'; diff --git a/x-pack/plugins/alerting/server/connector_adapters/connector_adapter_registry.ts b/x-pack/plugins/alerting/server/connector_adapters/connector_adapter_registry.ts index 4558ca5a2d3ee..9adad4a4c9273 100644 --- a/x-pack/plugins/alerting/server/connector_adapters/connector_adapter_registry.ts +++ b/x-pack/plugins/alerting/server/connector_adapters/connector_adapter_registry.ts @@ -8,7 +8,7 @@ import Boom from '@hapi/boom'; import { i18n } from '@kbn/i18n'; -import { ConnectorAdapter, ConnectorAdapterParams } from './types'; +import type { ConnectorAdapter, ConnectorAdapterParams } from './types'; export class ConnectorAdapterRegistry { private readonly connectorAdapters: Map = new Map(); diff --git a/x-pack/plugins/alerting/server/connector_adapters/get_system_action_kibana_privileges.ts b/x-pack/plugins/alerting/server/connector_adapters/get_system_action_kibana_privileges.ts index 0dd06e7776ba7..b7ffbc94f4e0f 100644 --- a/x-pack/plugins/alerting/server/connector_adapters/get_system_action_kibana_privileges.ts +++ b/x-pack/plugins/alerting/server/connector_adapters/get_system_action_kibana_privileges.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RuleSystemAction } from '../types'; -import { ConnectorAdapterRegistry } from './connector_adapter_registry'; +import type { RuleSystemAction } from '../types'; +import type { ConnectorAdapterRegistry } from './connector_adapter_registry'; interface Args { connectorAdapterRegistry: ConnectorAdapterRegistry; diff --git a/x-pack/plugins/alerting/server/connector_adapters/types.ts b/x-pack/plugins/alerting/server/connector_adapters/types.ts index e189c53cfecfe..2130f6107796d 100644 --- a/x-pack/plugins/alerting/server/connector_adapters/types.ts +++ b/x-pack/plugins/alerting/server/connector_adapters/types.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { ObjectType } from '@kbn/config-schema'; +import type { ObjectType } from '@kbn/config-schema'; import type { RuleTypeParams, SanitizedRule } from '../../common'; -import { CombinedSummarizedAlerts } from '../types'; +import type { CombinedSummarizedAlerts } from '../types'; type Rule = Pick, 'id' | 'name' | 'tags' | 'consumer'> & { producer: string; diff --git a/x-pack/plugins/alerting/server/connector_adapters/validate_rule_action_params.ts b/x-pack/plugins/alerting/server/connector_adapters/validate_rule_action_params.ts index abfd56f0e9079..6cc37200002de 100644 --- a/x-pack/plugins/alerting/server/connector_adapters/validate_rule_action_params.ts +++ b/x-pack/plugins/alerting/server/connector_adapters/validate_rule_action_params.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { ConnectorAdapterRegistry } from './connector_adapter_registry'; +import type { ConnectorAdapterRegistry } from './connector_adapter_registry'; interface ValidateSchemaArgs { connectorAdapterRegistry: ConnectorAdapterRegistry; diff --git a/x-pack/plugins/alerting/server/data/ad_hoc_run/types/ad_hoc_run.ts b/x-pack/plugins/alerting/server/data/ad_hoc_run/types/ad_hoc_run.ts index be03f45749c5d..5b03fd501be8c 100644 --- a/x-pack/plugins/alerting/server/data/ad_hoc_run/types/ad_hoc_run.ts +++ b/x-pack/plugins/alerting/server/data/ad_hoc_run/types/ad_hoc_run.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RuleDomain } from '../../../application/rule/types'; -import { AdHocRunStatus } from '../../../../common/constants'; +import type { RuleDomain } from '../../../application/rule/types'; +import type { AdHocRunStatus } from '../../../../common/constants'; export interface AdHocRunSchedule extends Record { interval: string; diff --git a/x-pack/plugins/alerting/server/data/alerts_filter_query/types/alerts_filter_query_attributes.ts b/x-pack/plugins/alerting/server/data/alerts_filter_query/types/alerts_filter_query_attributes.ts index 33742f81daa77..47d98ab8df9b1 100644 --- a/x-pack/plugins/alerting/server/data/alerts_filter_query/types/alerts_filter_query_attributes.ts +++ b/x-pack/plugins/alerting/server/data/alerts_filter_query/types/alerts_filter_query_attributes.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FilterStateStore } from '@kbn/es-query'; +import type { FilterStateStore } from '@kbn/es-query'; export interface AlertsFilterAttributes { query?: Record; diff --git a/x-pack/plugins/alerting/server/data/maintenance_window/methods/bulk_get_maintenance_window_so.ts b/x-pack/plugins/alerting/server/data/maintenance_window/methods/bulk_get_maintenance_window_so.ts index 4023948caf7ad..23c0b0c09dde6 100644 --- a/x-pack/plugins/alerting/server/data/maintenance_window/methods/bulk_get_maintenance_window_so.ts +++ b/x-pack/plugins/alerting/server/data/maintenance_window/methods/bulk_get_maintenance_window_so.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { SavedObjectsClientContract, SavedObjectsBulkResponse } from '@kbn/core/server'; -import { MaintenanceWindowAttributes } from '../types'; +import type { SavedObjectsClientContract, SavedObjectsBulkResponse } from '@kbn/core/server'; +import type { MaintenanceWindowAttributes } from '../types'; import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../common'; export interface BulkGetMaintenanceWindowObject { diff --git a/x-pack/plugins/alerting/server/data/maintenance_window/methods/create_maintenance_window_so.ts b/x-pack/plugins/alerting/server/data/maintenance_window/methods/create_maintenance_window_so.ts index 6beee4db0d9e8..c26f142e62f01 100644 --- a/x-pack/plugins/alerting/server/data/maintenance_window/methods/create_maintenance_window_so.ts +++ b/x-pack/plugins/alerting/server/data/maintenance_window/methods/create_maintenance_window_so.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { +import type { SavedObjectsClientContract, SavedObjectsCreateOptions, SavedObject, } from '@kbn/core/server'; -import { MaintenanceWindowAttributes } from '../types'; +import type { MaintenanceWindowAttributes } from '../types'; import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../common'; export interface CreateMaintenanceWindowSoParams { diff --git a/x-pack/plugins/alerting/server/data/maintenance_window/methods/delete_maintenance_window_so.ts b/x-pack/plugins/alerting/server/data/maintenance_window/methods/delete_maintenance_window_so.ts index 18725da8dbd5a..7dd7b80091981 100644 --- a/x-pack/plugins/alerting/server/data/maintenance_window/methods/delete_maintenance_window_so.ts +++ b/x-pack/plugins/alerting/server/data/maintenance_window/methods/delete_maintenance_window_so.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsClientContract, SavedObjectsDeleteOptions } from '@kbn/core/server'; +import type { SavedObjectsClientContract, SavedObjectsDeleteOptions } from '@kbn/core/server'; import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../common'; export interface DeleteMaintenanceWindowSoParams { diff --git a/x-pack/plugins/alerting/server/data/maintenance_window/methods/find_maintenance_window_so.ts b/x-pack/plugins/alerting/server/data/maintenance_window/methods/find_maintenance_window_so.ts index d08a3c360cbb0..d5790585828b0 100644 --- a/x-pack/plugins/alerting/server/data/maintenance_window/methods/find_maintenance_window_so.ts +++ b/x-pack/plugins/alerting/server/data/maintenance_window/methods/find_maintenance_window_so.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { +import type { SavedObjectsClientContract, SavedObjectsFindOptions, SavedObjectsFindResponse, } from '@kbn/core/server'; -import { MaintenanceWindowAttributes } from '../types'; +import type { MaintenanceWindowAttributes } from '../types'; import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../common'; export interface FindMaintenanceWindowSoParams { diff --git a/x-pack/plugins/alerting/server/data/maintenance_window/methods/get_maintenance_window_so.ts b/x-pack/plugins/alerting/server/data/maintenance_window/methods/get_maintenance_window_so.ts index 9dfb11ee7ee0b..d86c213c43c34 100644 --- a/x-pack/plugins/alerting/server/data/maintenance_window/methods/get_maintenance_window_so.ts +++ b/x-pack/plugins/alerting/server/data/maintenance_window/methods/get_maintenance_window_so.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { SavedObjectsClientContract, SavedObject } from '@kbn/core/server'; -import { MaintenanceWindowAttributes } from '../types'; +import type { SavedObjectsClientContract, SavedObject } from '@kbn/core/server'; +import type { MaintenanceWindowAttributes } from '../types'; import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../common'; export interface GetMaintenanceWindowSoParams { diff --git a/x-pack/plugins/alerting/server/data/maintenance_window/methods/update_maintenance_window_so.ts b/x-pack/plugins/alerting/server/data/maintenance_window/methods/update_maintenance_window_so.ts index b65516da3c726..d5fc46294398b 100644 --- a/x-pack/plugins/alerting/server/data/maintenance_window/methods/update_maintenance_window_so.ts +++ b/x-pack/plugins/alerting/server/data/maintenance_window/methods/update_maintenance_window_so.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { +import type { SavedObjectsClientContract, SavedObjectsUpdateOptions, SavedObjectsUpdateResponse, } from '@kbn/core/server'; -import { MaintenanceWindowAttributes } from '../types'; +import type { MaintenanceWindowAttributes } from '../types'; import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../../common'; export interface UpdateMaintenanceWindowSoParams { diff --git a/x-pack/plugins/alerting/server/data/maintenance_window/test_helpers.ts b/x-pack/plugins/alerting/server/data/maintenance_window/test_helpers.ts index 2d18b736fdc14..c3afc28f00851 100644 --- a/x-pack/plugins/alerting/server/data/maintenance_window/test_helpers.ts +++ b/x-pack/plugins/alerting/server/data/maintenance_window/test_helpers.ts @@ -6,7 +6,7 @@ */ import { Frequency } from '@kbn/rrule'; -import { MaintenanceWindowAttributes } from './types'; +import type { MaintenanceWindowAttributes } from './types'; export const getMockMaintenanceWindow = ( overwrites?: Partial diff --git a/x-pack/plugins/alerting/server/data/maintenance_window/types/maintenance_window_attributes.ts b/x-pack/plugins/alerting/server/data/maintenance_window/types/maintenance_window_attributes.ts index afb217abaf139..cadadb37913d2 100644 --- a/x-pack/plugins/alerting/server/data/maintenance_window/types/maintenance_window_attributes.ts +++ b/x-pack/plugins/alerting/server/data/maintenance_window/types/maintenance_window_attributes.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { RRuleAttributes } from '../../r_rule/types'; +import type { RRuleAttributes } from '../../r_rule/types'; import type { MaintenanceWindowCategoryIdTypes } from '../constants'; -import { AlertsFilterQueryAttributes } from '../../alerts_filter_query/types'; +import type { AlertsFilterQueryAttributes } from '../../alerts_filter_query/types'; export interface MaintenanceWindowEventAttributes { gte: string; diff --git a/x-pack/plugins/alerting/server/data/rule/methods/bulk_create_rule_so.ts b/x-pack/plugins/alerting/server/data/rule/methods/bulk_create_rule_so.ts index 057e44446030f..2690579cdd80b 100644 --- a/x-pack/plugins/alerting/server/data/rule/methods/bulk_create_rule_so.ts +++ b/x-pack/plugins/alerting/server/data/rule/methods/bulk_create_rule_so.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { +import type { SavedObjectsClientContract, SavedObjectsCreateOptions, SavedObjectsBulkCreateObject, SavedObjectsBulkResponse, } from '@kbn/core/server'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; export interface BulkCreateRulesSoParams { savedObjectsClient: SavedObjectsClientContract; diff --git a/x-pack/plugins/alerting/server/data/rule/methods/bulk_delete_rules_so.ts b/x-pack/plugins/alerting/server/data/rule/methods/bulk_delete_rules_so.ts index 15449dc003cd2..d9b3908494bf9 100644 --- a/x-pack/plugins/alerting/server/data/rule/methods/bulk_delete_rules_so.ts +++ b/x-pack/plugins/alerting/server/data/rule/methods/bulk_delete_rules_so.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { +import type { SavedObjectsClientContract, SavedObjectsBulkDeleteOptions, SavedObjectsBulkDeleteResponse, diff --git a/x-pack/plugins/alerting/server/data/rule/methods/bulk_disable_rules_so.ts b/x-pack/plugins/alerting/server/data/rule/methods/bulk_disable_rules_so.ts index a32e38f255c3e..711d051f45a2e 100644 --- a/x-pack/plugins/alerting/server/data/rule/methods/bulk_disable_rules_so.ts +++ b/x-pack/plugins/alerting/server/data/rule/methods/bulk_disable_rules_so.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { +import type { SavedObjectsClientContract, SavedObjectsCreateOptions, SavedObjectsBulkCreateObject, SavedObjectsBulkResponse, } from '@kbn/core/server'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; export interface BulkDisableRulesSoParams { savedObjectsClient: SavedObjectsClientContract; diff --git a/x-pack/plugins/alerting/server/data/rule/methods/create_rule_so.ts b/x-pack/plugins/alerting/server/data/rule/methods/create_rule_so.ts index e5a45ee9f386e..6677931968670 100644 --- a/x-pack/plugins/alerting/server/data/rule/methods/create_rule_so.ts +++ b/x-pack/plugins/alerting/server/data/rule/methods/create_rule_so.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { +import type { SavedObjectsClientContract, SavedObjectsCreateOptions, SavedObject, } from '@kbn/core/server'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; import { RULE_SAVED_OBJECT_TYPE } from '../../../saved_objects'; export interface CreateRuleSoParams { diff --git a/x-pack/plugins/alerting/server/data/rule/methods/delete_rule_so.ts b/x-pack/plugins/alerting/server/data/rule/methods/delete_rule_so.ts index 7c15fd847303f..a7f4f90a3683a 100644 --- a/x-pack/plugins/alerting/server/data/rule/methods/delete_rule_so.ts +++ b/x-pack/plugins/alerting/server/data/rule/methods/delete_rule_so.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsClientContract, SavedObjectsDeleteOptions } from '@kbn/core/server'; +import type { SavedObjectsClientContract, SavedObjectsDeleteOptions } from '@kbn/core/server'; import { RULE_SAVED_OBJECT_TYPE } from '../../../saved_objects'; export interface DeleteRuleSoParams { diff --git a/x-pack/plugins/alerting/server/data/rule/methods/find_rules_so.ts b/x-pack/plugins/alerting/server/data/rule/methods/find_rules_so.ts index 1e73d52aba955..61753a0394fe7 100644 --- a/x-pack/plugins/alerting/server/data/rule/methods/find_rules_so.ts +++ b/x-pack/plugins/alerting/server/data/rule/methods/find_rules_so.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { +import type { SavedObjectsClientContract, SavedObjectsFindOptions, SavedObjectsFindResponse, } from '@kbn/core/server'; import { RULE_SAVED_OBJECT_TYPE } from '../../../saved_objects'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; export interface FindRulesSoParams { savedObjectsClient: SavedObjectsClientContract; diff --git a/x-pack/plugins/alerting/server/data/rule/methods/get_decrypted_rule_so.ts b/x-pack/plugins/alerting/server/data/rule/methods/get_decrypted_rule_so.ts index 1171e53abda6f..fa5831620af05 100644 --- a/x-pack/plugins/alerting/server/data/rule/methods/get_decrypted_rule_so.ts +++ b/x-pack/plugins/alerting/server/data/rule/methods/get_decrypted_rule_so.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObject } from '@kbn/core/server'; -import { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server'; -import { SavedObjectsGetOptions } from '@kbn/core-saved-objects-api-server'; -import { RawRule } from '../../../types'; +import type { SavedObject } from '@kbn/core/server'; +import type { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { SavedObjectsGetOptions } from '@kbn/core-saved-objects-api-server'; +import type { RawRule } from '../../../types'; import { RULE_SAVED_OBJECT_TYPE } from '../../../saved_objects'; export interface GetDecryptedRuleSoParams { diff --git a/x-pack/plugins/alerting/server/data/rule/methods/get_rule_so.ts b/x-pack/plugins/alerting/server/data/rule/methods/get_rule_so.ts index e02813d855ce9..5fb608ada6898 100644 --- a/x-pack/plugins/alerting/server/data/rule/methods/get_rule_so.ts +++ b/x-pack/plugins/alerting/server/data/rule/methods/get_rule_so.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { SavedObjectsClientContract, SavedObject } from '@kbn/core/server'; -import { SavedObjectsGetOptions } from '@kbn/core-saved-objects-api-server'; -import { RawRule } from '../../../types'; +import type { SavedObjectsClientContract, SavedObject } from '@kbn/core/server'; +import type { SavedObjectsGetOptions } from '@kbn/core-saved-objects-api-server'; +import type { RawRule } from '../../../types'; import { RULE_SAVED_OBJECT_TYPE } from '../../../saved_objects'; export interface GetRuleSoParams { diff --git a/x-pack/plugins/alerting/server/data/rule/methods/resolve_rule_so.ts b/x-pack/plugins/alerting/server/data/rule/methods/resolve_rule_so.ts index 0c8e876dac540..e07305a05c58d 100644 --- a/x-pack/plugins/alerting/server/data/rule/methods/resolve_rule_so.ts +++ b/x-pack/plugins/alerting/server/data/rule/methods/resolve_rule_so.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObjectsClientContract, SavedObjectsResolveResponse } from '@kbn/core/server'; -import { SavedObjectsResolveOptions } from '@kbn/core-saved-objects-api-server'; +import type { SavedObjectsClientContract, SavedObjectsResolveResponse } from '@kbn/core/server'; +import type { SavedObjectsResolveOptions } from '@kbn/core-saved-objects-api-server'; import { RULE_SAVED_OBJECT_TYPE } from '../../../saved_objects'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; export interface ResolveRuleSoParams { savedObjectsClient: SavedObjectsClientContract; diff --git a/x-pack/plugins/alerting/server/data/rule/methods/update_rule_so.ts b/x-pack/plugins/alerting/server/data/rule/methods/update_rule_so.ts index 7358cf609d3c3..a8cc2b37e1283 100644 --- a/x-pack/plugins/alerting/server/data/rule/methods/update_rule_so.ts +++ b/x-pack/plugins/alerting/server/data/rule/methods/update_rule_so.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { +import type { SavedObjectsClientContract, SavedObjectsUpdateOptions, SavedObjectsUpdateResponse, } from '@kbn/core/server'; import { RULE_SAVED_OBJECT_TYPE } from '../../../saved_objects'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; export interface UpdateRuleSoParams { savedObjectsClient: SavedObjectsClientContract; diff --git a/x-pack/plugins/alerting/server/health/get_health.ts b/x-pack/plugins/alerting/server/health/get_health.ts index f29a88dec6489..ba814ee01bf91 100644 --- a/x-pack/plugins/alerting/server/health/get_health.ts +++ b/x-pack/plugins/alerting/server/health/get_health.ts @@ -5,10 +5,12 @@ * 2.0. */ -import { ISavedObjectsRepository, SavedObjectsServiceStart } from '@kbn/core/server'; -import { AlertsHealth, HealthStatus } from '@kbn/alerting-types'; +import type { ISavedObjectsRepository, SavedObjectsServiceStart } from '@kbn/core/server'; +import type { AlertsHealth } from '@kbn/alerting-types'; +import { HealthStatus } from '@kbn/alerting-types'; import { RULE_SAVED_OBJECT_TYPE } from '../saved_objects'; -import { RawRule, RuleExecutionStatusErrorReasons } from '../types'; +import type { RawRule } from '../types'; +import { RuleExecutionStatusErrorReasons } from '../types'; import type { LatestTaskStateSchema } from './task_state'; export const getHealth = async ( diff --git a/x-pack/plugins/alerting/server/health/task.ts b/x-pack/plugins/alerting/server/health/task.ts index fb22fcf63c3fe..045775b92c70d 100644 --- a/x-pack/plugins/alerting/server/health/task.ts +++ b/x-pack/plugins/alerting/server/health/task.ts @@ -5,15 +5,15 @@ * 2.0. */ -import { CoreStart, Logger } from '@kbn/core/server'; -import { +import type { CoreStart, Logger } from '@kbn/core/server'; +import type { RunContext, TaskManagerSetupContract, TaskManagerStartContract, } from '@kbn/task-manager-plugin/server'; import { HealthStatus } from '@kbn/alerting-types'; -import { AlertingConfig } from '../config'; -import { AlertingPluginsStart } from '../plugin'; +import type { AlertingConfig } from '../config'; +import type { AlertingPluginsStart } from '../plugin'; import { getAlertingHealthStatus } from './get_health'; import { stateSchemaByVersion, emptyState, type LatestTaskStateSchema } from './task_state'; diff --git a/x-pack/plugins/alerting/server/health/task_state.ts b/x-pack/plugins/alerting/server/health/task_state.ts index fcb950f59d2c7..68b756da6d1f5 100644 --- a/x-pack/plugins/alerting/server/health/task_state.ts +++ b/x-pack/plugins/alerting/server/health/task_state.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import type { TypeOf } from '@kbn/config-schema'; +import { schema } from '@kbn/config-schema'; import { HealthStatus } from '@kbn/alerting-types'; /** diff --git a/x-pack/plugins/alerting/server/index.ts b/x-pack/plugins/alerting/server/index.ts index 2f5cd3994e436..e4f086984817a 100644 --- a/x-pack/plugins/alerting/server/index.ts +++ b/x-pack/plugins/alerting/server/index.ts @@ -5,9 +5,10 @@ * 2.0. */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { PluginConfigDescriptor, PluginInitializerContext } from '@kbn/core/server'; -import { RulesClient as RulesClientClass } from './rules_client'; -import { AlertingConfig, configSchema } from './config'; +import type { PluginConfigDescriptor, PluginInitializerContext } from '@kbn/core/server'; +import type { RulesClient as RulesClientClass } from './rules_client'; +import type { AlertingConfig } from './config'; +import { configSchema } from './config'; export type RulesClient = PublicMethodsOf; diff --git a/x-pack/plugins/alerting/server/integration_tests/serverless_upgrade_and_rollback_checks.test.ts b/x-pack/plugins/alerting/server/integration_tests/serverless_upgrade_and_rollback_checks.test.ts index 07abf88d32221..91d514da76a38 100644 --- a/x-pack/plugins/alerting/server/integration_tests/serverless_upgrade_and_rollback_checks.test.ts +++ b/x-pack/plugins/alerting/server/integration_tests/serverless_upgrade_and_rollback_checks.test.ts @@ -101,7 +101,7 @@ describe('Serverless upgrade and rollback checks', () => { test(`detect param changes to review for: ${ruleTypeId}`, async () => { const ruleType = ruleTypeRegistry.get(ruleTypeId); if (!ruleType?.schemas?.params) { - throw new Error('schema.params is required for rule type:' + ruleTypeId); + throw new Error(`schema.params is required for rule type:${ruleTypeId}`); } const schemaType = ruleType.schemas.params.type; if (schemaType === 'config-schema') { diff --git a/x-pack/plugins/alerting/server/invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation.ts b/x-pack/plugins/alerting/server/invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation.ts index bde9cd8aa2131..6c060f2e64518 100644 --- a/x-pack/plugins/alerting/server/invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation.ts +++ b/x-pack/plugins/alerting/server/invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Logger, SavedObjectsClientContract } from '@kbn/core/server'; +import type { Logger, SavedObjectsClientContract } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; import { API_KEY_PENDING_INVALIDATION_TYPE } from '..'; diff --git a/x-pack/plugins/alerting/server/invalidate_pending_api_keys/task.ts b/x-pack/plugins/alerting/server/invalidate_pending_api_keys/task.ts index 48eea48246c78..5257490552814 100644 --- a/x-pack/plugins/alerting/server/invalidate_pending_api_keys/task.ts +++ b/x-pack/plugins/alerting/server/invalidate_pending_api_keys/task.ts @@ -5,32 +5,32 @@ * 2.0. */ -import { +import type { Logger, CoreStart, SavedObjectsFindResponse, SavedObjectsClientContract, } from '@kbn/core/server'; -import { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server'; -import { InvalidateAPIKeysParams, SecurityPluginStart } from '@kbn/security-plugin/server'; -import { +import type { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { InvalidateAPIKeysParams, SecurityPluginStart } from '@kbn/security-plugin/server'; +import type { RunContext, TaskManagerSetupContract, TaskManagerStartContract, } from '@kbn/task-manager-plugin/server'; -import { +import type { AggregationsStringTermsBucketKeys, AggregationsTermsAggregateBase, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { InvalidateAPIKeyResult } from '../rules_client'; -import { AlertingConfig } from '../config'; +import type { InvalidateAPIKeyResult } from '../rules_client'; +import type { AlertingConfig } from '../config'; import { timePeriodBeforeDate } from '../lib/get_cadence'; -import { AlertingPluginsStart } from '../plugin'; -import { InvalidatePendingApiKey } from '../types'; +import type { AlertingPluginsStart } from '../plugin'; +import type { InvalidatePendingApiKey } from '../types'; import { stateSchemaByVersion, emptyState, type LatestTaskStateSchema } from './task_state'; import { API_KEY_PENDING_INVALIDATION_TYPE } from '..'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE } from '../saved_objects'; -import { AdHocRunSO } from '../data/ad_hoc_run/types'; +import type { AdHocRunSO } from '../data/ad_hoc_run/types'; const TASK_TYPE = 'alerts_invalidate_api_keys'; const PAGE_SIZE = 100; diff --git a/x-pack/plugins/alerting/server/invalidate_pending_api_keys/task_state.ts b/x-pack/plugins/alerting/server/invalidate_pending_api_keys/task_state.ts index 81f873412f8b9..cdad9ffe6c361 100644 --- a/x-pack/plugins/alerting/server/invalidate_pending_api_keys/task_state.ts +++ b/x-pack/plugins/alerting/server/invalidate_pending_api_keys/task_state.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import type { TypeOf } from '@kbn/config-schema'; +import { schema } from '@kbn/config-schema'; /** * WARNING: Do not modify the existing versioned schema(s) below, instead define a new version (ex: 2, 3, 4). diff --git a/x-pack/plugins/alerting/server/lib/alert_summary_from_event_log.test.ts b/x-pack/plugins/alerting/server/lib/alert_summary_from_event_log.test.ts index a4bdc2f88bfa0..b5c47cae3d596 100644 --- a/x-pack/plugins/alerting/server/lib/alert_summary_from_event_log.test.ts +++ b/x-pack/plugins/alerting/server/lib/alert_summary_from_event_log.test.ts @@ -6,8 +6,9 @@ */ import { random, mean } from 'lodash'; -import { SanitizedRule, AlertSummary } from '../types'; -import { IValidatedEvent, millisToNanos, nanosToMillis } from '@kbn/event-log-plugin/server'; +import type { SanitizedRule, AlertSummary } from '../types'; +import type { IValidatedEvent } from '@kbn/event-log-plugin/server'; +import { millisToNanos, nanosToMillis } from '@kbn/event-log-plugin/server'; import { EVENT_LOG_ACTIONS, EVENT_LOG_PROVIDER, LEGACY_EVENT_LOG_ACTIONS } from '../plugin'; import { alertSummaryFromEventLog } from './alert_summary_from_event_log'; diff --git a/x-pack/plugins/alerting/server/lib/alert_summary_from_event_log.ts b/x-pack/plugins/alerting/server/lib/alert_summary_from_event_log.ts index e20b92370bbc6..b74970146e316 100644 --- a/x-pack/plugins/alerting/server/lib/alert_summary_from_event_log.ts +++ b/x-pack/plugins/alerting/server/lib/alert_summary_from_event_log.ts @@ -6,8 +6,9 @@ */ import { mean } from 'lodash'; -import { IEvent, nanosToMillis } from '@kbn/event-log-plugin/server'; -import { SanitizedRule, AlertSummary, AlertStatus } from '../types'; +import type { IEvent } from '@kbn/event-log-plugin/server'; +import { nanosToMillis } from '@kbn/event-log-plugin/server'; +import type { SanitizedRule, AlertSummary, AlertStatus } from '../types'; import { EVENT_LOG_ACTIONS, EVENT_LOG_PROVIDER, LEGACY_EVENT_LOG_ACTIONS } from '../plugin'; export interface AlertSummaryFromEventLogParams { diff --git a/x-pack/plugins/alerting/server/lib/alerting_event_logger/alerting_event_logger.test.ts b/x-pack/plugins/alerting/server/lib/alerting_event_logger/alerting_event_logger.test.ts index 082d5ea6381df..ae1cfd6953651 100644 --- a/x-pack/plugins/alerting/server/lib/alerting_event_logger/alerting_event_logger.test.ts +++ b/x-pack/plugins/alerting/server/lib/alerting_event_logger/alerting_event_logger.test.ts @@ -6,13 +6,12 @@ */ import { eventLoggerMock } from '@kbn/event-log-plugin/server/event_logger.mock'; -import { IEvent, SAVED_OBJECT_REL_PRIMARY } from '@kbn/event-log-plugin/server'; +import type { IEvent } from '@kbn/event-log-plugin/server'; +import { SAVED_OBJECT_REL_PRIMARY } from '@kbn/event-log-plugin/server'; import { ActionsCompletion } from '@kbn/alerting-state-types'; +import type { ContextOpts, Context, RuleContext, SavedObjects } from './alerting_event_logger'; import { AlertingEventLogger, - ContextOpts, - Context, - RuleContext, initializeExecuteRecord, createExecuteTimeoutRecord, createAlertRecord, @@ -20,16 +19,15 @@ import { updateEvent, executionType, initializeExecuteBackfillRecord, - SavedObjects, updateEventWithRuleData, } from './alerting_event_logger'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; import { RecoveredActionGroup, RuleExecutionStatusErrorReasons, RuleExecutionStatusWarningReasons, } from '../../types'; -import { RuleRunMetrics } from '../rule_run_metrics_store'; +import type { RuleRunMetrics } from '../rule_run_metrics_store'; import { EVENT_LOG_ACTIONS } from '../../plugin'; import { TaskRunnerTimerSpan } from '../../task_runner/task_runner_timer'; import { schema } from '@kbn/config-schema'; diff --git a/x-pack/plugins/alerting/server/lib/alerting_event_logger/alerting_event_logger.ts b/x-pack/plugins/alerting/server/lib/alerting_event_logger/alerting_event_logger.ts index 1607f6090b10c..690e0d3a55f9c 100644 --- a/x-pack/plugins/alerting/server/lib/alerting_event_logger/alerting_event_logger.ts +++ b/x-pack/plugins/alerting/server/lib/alerting_event_logger/alerting_event_logger.ts @@ -5,19 +5,15 @@ * 2.0. */ -import { - IEvent, - IEventLogger, - millisToNanos, - SAVED_OBJECT_REL_PRIMARY, -} from '@kbn/event-log-plugin/server'; +import type { IEvent, IEventLogger } from '@kbn/event-log-plugin/server'; +import { millisToNanos, SAVED_OBJECT_REL_PRIMARY } from '@kbn/event-log-plugin/server'; import { EVENT_LOG_ACTIONS } from '../../plugin'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; -import { TaskRunnerTimings } from '../../task_runner/task_runner_timer'; -import { AlertInstanceState, RuleExecutionStatus } from '../../types'; +import type { TaskRunnerTimings } from '../../task_runner/task_runner_timer'; +import type { AlertInstanceState, RuleExecutionStatus } from '../../types'; import { createAlertEventLogRecordObject } from '../create_alert_event_log_record_object'; -import { RuleRunMetrics } from '../rule_run_metrics_store'; +import type { RuleRunMetrics } from '../rule_run_metrics_store'; // 1,000,000 nanoseconds in 1 millisecond const Millis2Nanos = 1000 * 1000; diff --git a/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.test.ts b/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.test.ts index 2936df04c9cdb..e1faceff8319a 100644 --- a/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.test.ts +++ b/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.test.ts @@ -6,7 +6,7 @@ */ import { createAlertEventLogRecordObject } from './create_alert_event_log_record_object'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; import { RecoveredActionGroup } from '../types'; import { schema } from '@kbn/config-schema'; diff --git a/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.ts b/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.ts index 8231faa43c74d..83f098c8364b9 100644 --- a/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.ts +++ b/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { IEvent } from '@kbn/event-log-plugin/server'; -import { AlertInstanceState } from '../types'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { IEvent } from '@kbn/event-log-plugin/server'; +import type { AlertInstanceState } from '../types'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; export type Event = Exclude; diff --git a/x-pack/plugins/alerting/server/lib/create_get_alert_indices_alias.test.ts b/x-pack/plugins/alerting/server/lib/create_get_alert_indices_alias.test.ts index 9a8109977962c..b749a426fb446 100644 --- a/x-pack/plugins/alerting/server/lib/create_get_alert_indices_alias.test.ts +++ b/x-pack/plugins/alerting/server/lib/create_get_alert_indices_alias.test.ts @@ -9,13 +9,14 @@ import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; import { licensingMock } from '@kbn/licensing-plugin/server/mocks'; import { inMemoryMetricsMock } from '../monitoring/in_memory_metrics.mock'; -import { ConstructorOptions, RuleTypeRegistry } from '../rule_type_registry'; +import type { ConstructorOptions } from '../rule_type_registry'; +import { RuleTypeRegistry } from '../rule_type_registry'; import { TaskRunnerFactory } from '../task_runner/task_runner_factory'; -import { ILicenseState } from './license_state'; +import type { ILicenseState } from './license_state'; import { licenseStateMock } from './license_state.mock'; import { schema } from '@kbn/config-schema'; import { createGetAlertIndicesAliasFn } from './create_get_alert_indices_alias'; -import { AlertingConfig } from '../config'; +import type { AlertingConfig } from '../config'; describe('createGetAlertIndicesAliasFn', () => { const logger = loggingSystemMock.create().get(); diff --git a/x-pack/plugins/alerting/server/lib/create_get_alert_indices_alias.ts b/x-pack/plugins/alerting/server/lib/create_get_alert_indices_alias.ts index f6c08c4793fb2..28f872c2828fb 100644 --- a/x-pack/plugins/alerting/server/lib/create_get_alert_indices_alias.ts +++ b/x-pack/plugins/alerting/server/lib/create_get_alert_indices_alias.ts @@ -7,7 +7,7 @@ import { DEFAULT_NAMESPACE_STRING } from '@kbn/core-saved-objects-utils-server'; import { getIndexTemplateAndPattern } from '../alerts_service/resource_installer_utils'; -import { RuleTypeRegistry } from '../rule_type_registry'; +import type { RuleTypeRegistry } from '../rule_type_registry'; export type GetAlertIndicesAlias = (rulesTypes: string[], spaceId?: string) => string[]; diff --git a/x-pack/plugins/alerting/server/lib/determine_alerts_to_return.ts b/x-pack/plugins/alerting/server/lib/determine_alerts_to_return.ts index 2449c48ca83f7..bcc49fc99e189 100644 --- a/x-pack/plugins/alerting/server/lib/determine_alerts_to_return.ts +++ b/x-pack/plugins/alerting/server/lib/determine_alerts_to_return.ts @@ -6,8 +6,8 @@ */ import { keys } from 'lodash'; -import { Alert } from '../alert'; -import { AlertInstanceState, AlertInstanceContext, RawAlertInstance } from '../types'; +import type { Alert } from '../alert'; +import type { AlertInstanceState, AlertInstanceContext, RawAlertInstance } from '../types'; // determines which alerts to return in the state export function determineAlertsToReturn< diff --git a/x-pack/plugins/alerting/server/lib/errors/es_error_parser.ts b/x-pack/plugins/alerting/server/lib/errors/es_error_parser.ts index f26fa22f8d730..a8cf017daad93 100644 --- a/x-pack/plugins/alerting/server/lib/errors/es_error_parser.ts +++ b/x-pack/plugins/alerting/server/lib/errors/es_error_parser.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ElasticsearchError, ElasticsearchErrorCausedByObject } from './types'; +import type { ElasticsearchError, ElasticsearchErrorCausedByObject } from './types'; const getEsCause = ( obj: ElasticsearchErrorCausedByObject = {}, diff --git a/x-pack/plugins/alerting/server/lib/errors/index.ts b/x-pack/plugins/alerting/server/lib/errors/index.ts index a2dcd45bbb63b..cd6a62a7863b2 100644 --- a/x-pack/plugins/alerting/server/lib/errors/index.ts +++ b/x-pack/plugins/alerting/server/lib/errors/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ErrorThatHandlesItsOwnResponse, ElasticsearchError } from './types'; +import type { ErrorThatHandlesItsOwnResponse, ElasticsearchError } from './types'; import { getEsErrorMessage } from './es_error_parser'; export function isErrorThatHandlesItsOwnResponse( diff --git a/x-pack/plugins/alerting/server/lib/errors/rule_muted.ts b/x-pack/plugins/alerting/server/lib/errors/rule_muted.ts index c95fbb2e0b34c..13c04df0be045 100644 --- a/x-pack/plugins/alerting/server/lib/errors/rule_muted.ts +++ b/x-pack/plugins/alerting/server/lib/errors/rule_muted.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { KibanaResponseFactory } from '@kbn/core/server'; -import { ErrorThatHandlesItsOwnResponse } from './types'; +import type { KibanaResponseFactory } from '@kbn/core/server'; +import type { ErrorThatHandlesItsOwnResponse } from './types'; export class RuleMutedError extends Error implements ErrorThatHandlesItsOwnResponse { constructor(message: string) { diff --git a/x-pack/plugins/alerting/server/lib/errors/rule_type_disabled.ts b/x-pack/plugins/alerting/server/lib/errors/rule_type_disabled.ts index 387f48fdaefcb..03ed39e6fbb56 100644 --- a/x-pack/plugins/alerting/server/lib/errors/rule_type_disabled.ts +++ b/x-pack/plugins/alerting/server/lib/errors/rule_type_disabled.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { KibanaResponseFactory } from '@kbn/core/server'; -import { ErrorThatHandlesItsOwnResponse } from './types'; +import type { KibanaResponseFactory } from '@kbn/core/server'; +import type { ErrorThatHandlesItsOwnResponse } from './types'; export type RuleTypeDisabledReason = | 'config' diff --git a/x-pack/plugins/alerting/server/lib/errors/types.ts b/x-pack/plugins/alerting/server/lib/errors/types.ts index 78b114d71c511..2b864dbb8cbd1 100644 --- a/x-pack/plugins/alerting/server/lib/errors/types.ts +++ b/x-pack/plugins/alerting/server/lib/errors/types.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { KibanaResponseFactory, IKibanaResponse } from '@kbn/core/server'; +import type { KibanaResponseFactory, IKibanaResponse } from '@kbn/core/server'; export interface ErrorThatHandlesItsOwnResponse extends Error { sendResponse(res: KibanaResponseFactory): IKibanaResponse; diff --git a/x-pack/plugins/alerting/server/lib/flapping_utils.ts b/x-pack/plugins/alerting/server/lib/flapping_utils.ts index 9c0f1c231f17f..3315dea8e0b81 100644 --- a/x-pack/plugins/alerting/server/lib/flapping_utils.ts +++ b/x-pack/plugins/alerting/server/lib/flapping_utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RulesSettingsFlappingProperties } from '../../common/rules_settings'; +import type { RulesSettingsFlappingProperties } from '../../common/rules_settings'; export function updateFlappingHistory( flappingSettings: RulesSettingsFlappingProperties, diff --git a/x-pack/plugins/alerting/server/lib/format_execution_log_errors.test.ts b/x-pack/plugins/alerting/server/lib/format_execution_log_errors.test.ts index 4665194b7a4cc..e6d5b904adf12 100644 --- a/x-pack/plugins/alerting/server/lib/format_execution_log_errors.test.ts +++ b/x-pack/plugins/alerting/server/lib/format_execution_log_errors.test.ts @@ -6,7 +6,7 @@ */ import { formatExecutionErrorsResult } from './format_execution_log_errors'; -import { QueryEventsBySavedObjectResult } from '@kbn/event-log-plugin/server'; +import type { QueryEventsBySavedObjectResult } from '@kbn/event-log-plugin/server'; describe('formatExecutionErrorsResult', () => { test('should return empty results if data is undefined', () => { diff --git a/x-pack/plugins/alerting/server/lib/format_execution_log_errors.ts b/x-pack/plugins/alerting/server/lib/format_execution_log_errors.ts index 34970350b1461..195f8cbcfc107 100644 --- a/x-pack/plugins/alerting/server/lib/format_execution_log_errors.ts +++ b/x-pack/plugins/alerting/server/lib/format_execution_log_errors.ts @@ -6,8 +6,8 @@ */ import { get } from 'lodash'; -import { QueryEventsBySavedObjectResult, IValidatedEvent } from '@kbn/event-log-plugin/server'; -import { IExecutionErrors, IExecutionErrorsResult } from '../../common'; +import type { QueryEventsBySavedObjectResult, IValidatedEvent } from '@kbn/event-log-plugin/server'; +import type { IExecutionErrors, IExecutionErrorsResult } from '../../common'; const EXECUTION_UUID_FIELD = 'kibana.alert.rule.execution.uuid'; const TIMESTAMP_FIELD = '@timestamp'; diff --git a/x-pack/plugins/alerting/server/lib/get_actions_config_map.ts b/x-pack/plugins/alerting/server/lib/get_actions_config_map.ts index 2ef7c97814648..b640c7d2281de 100644 --- a/x-pack/plugins/alerting/server/lib/get_actions_config_map.ts +++ b/x-pack/plugins/alerting/server/lib/get_actions_config_map.ts @@ -6,7 +6,7 @@ */ import { omit } from 'lodash'; -import { ActionsConfig, ActionTypeConfig } from '../config'; +import type { ActionsConfig, ActionTypeConfig } from '../config'; export interface ActionsConfigMap { default: ActionTypeConfig; diff --git a/x-pack/plugins/alerting/server/lib/get_alerts_for_notification.ts b/x-pack/plugins/alerting/server/lib/get_alerts_for_notification.ts index 5761ab68c8205..9ed147922e385 100644 --- a/x-pack/plugins/alerting/server/lib/get_alerts_for_notification.ts +++ b/x-pack/plugins/alerting/server/lib/get_alerts_for_notification.ts @@ -6,9 +6,9 @@ */ import { keys } from 'lodash'; -import { RulesSettingsFlappingProperties } from '../../common/rules_settings'; +import type { RulesSettingsFlappingProperties } from '../../common/rules_settings'; import { Alert } from '../alert'; -import { AlertInstanceState, AlertInstanceContext } from '../types'; +import type { AlertInstanceState, AlertInstanceContext } from '../types'; export function getAlertsForNotification< State extends AlertInstanceState, diff --git a/x-pack/plugins/alerting/server/lib/get_es_query_config.ts b/x-pack/plugins/alerting/server/lib/get_es_query_config.ts index 2c0668371a4de..8ad3581c67ca2 100644 --- a/x-pack/plugins/alerting/server/lib/get_es_query_config.ts +++ b/x-pack/plugins/alerting/server/lib/get_es_query_config.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IUiSettingsClient } from '@kbn/core/server'; +import type { IUiSettingsClient } from '@kbn/core/server'; import { UI_SETTINGS } from '@kbn/data-plugin/server'; export async function getEsQueryConfig(uiSettings: IUiSettingsClient) { diff --git a/x-pack/plugins/alerting/server/lib/get_es_request_timeout.ts b/x-pack/plugins/alerting/server/lib/get_es_request_timeout.ts index 7fb82f55993fc..1c69cdf21dc6d 100644 --- a/x-pack/plugins/alerting/server/lib/get_es_request_timeout.ts +++ b/x-pack/plugins/alerting/server/lib/get_es_request_timeout.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; import { parseDuration } from '../../common'; import { DEFAULT_EXECUTION_TIMEOUT } from './get_rule_task_timeout'; diff --git a/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.test.ts b/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.test.ts index 88263ff495b9a..c57fb601cb059 100644 --- a/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.test.ts +++ b/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.test.ts @@ -5,15 +5,15 @@ * 2.0. */ -import { estypes } from '@elastic/elasticsearch'; +import type { estypes } from '@elastic/elasticsearch'; import { fromKueryExpression } from '@kbn/es-query'; +import type { ExecutionUuidAggResult } from './get_execution_log_aggregation'; import { getNumExecutions, getExecutionLogAggregation, formatExecutionLogResult, formatSortForBucketSort, formatSortForTermSort, - ExecutionUuidAggResult, getExecutionKPIAggregation, formatExecutionKPIResult, } from './get_execution_log_aggregation'; diff --git a/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.ts b/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.ts index 30f495efbf087..70fd5db470c6a 100644 --- a/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.ts +++ b/x-pack/plugins/alerting/server/lib/get_execution_log_aggregation.ts @@ -6,14 +6,15 @@ */ import { i18n } from '@kbn/i18n'; -import { KueryNode } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import Boom from '@hapi/boom'; import { flatMap, get, isEmpty } from 'lodash'; -import { AggregateEventsBySavedObjectResult } from '@kbn/event-log-plugin/server'; +import type { AggregateEventsBySavedObjectResult } from '@kbn/event-log-plugin/server'; import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; import { parseDuration } from '.'; -import { IExecutionLog, IExecutionLogResult, EMPTY_EXECUTION_KPI_RESULT } from '../../common'; +import type { IExecutionLog, IExecutionLogResult } from '../../common'; +import { EMPTY_EXECUTION_KPI_RESULT } from '../../common'; const DEFAULT_MAX_BUCKETS_LIMIT = 10000; // do not retrieve more than this number of executions. UI limits 1000 to display, but we need to fetch all 10000 to accurately reflect the KPIs const DEFAULT_MAX_KPI_BUCKETS_LIMIT = 10000; diff --git a/x-pack/plugins/alerting/server/lib/get_rule_notify_when_type.ts b/x-pack/plugins/alerting/server/lib/get_rule_notify_when_type.ts index 2ee07a3db4a29..d1b7acd5936fb 100644 --- a/x-pack/plugins/alerting/server/lib/get_rule_notify_when_type.ts +++ b/x-pack/plugins/alerting/server/lib/get_rule_notify_when_type.ts @@ -6,7 +6,7 @@ */ import { ruleNotifyWhen } from '../application/rule/constants'; -import { RuleNotifyWhen } from '../application/rule/types'; +import type { RuleNotifyWhen } from '../application/rule/types'; export function getRuleNotifyWhenType( notifyWhen: RuleNotifyWhen | null, diff --git a/x-pack/plugins/alerting/server/lib/get_rule_task_timeout.test.ts b/x-pack/plugins/alerting/server/lib/get_rule_task_timeout.test.ts index 59d4260261ebb..391ae566a0536 100644 --- a/x-pack/plugins/alerting/server/lib/get_rule_task_timeout.test.ts +++ b/x-pack/plugins/alerting/server/lib/get_rule_task_timeout.test.ts @@ -6,7 +6,7 @@ */ import { getRuleTaskTimeout } from './get_rule_task_timeout'; -import { RulesConfig } from '../config'; +import type { RulesConfig } from '../config'; const ruleTypeId = 'test-rule-type-id'; const config = { diff --git a/x-pack/plugins/alerting/server/lib/get_rule_task_timeout.ts b/x-pack/plugins/alerting/server/lib/get_rule_task_timeout.ts index 52919bd54de0b..a6e61590fa61f 100644 --- a/x-pack/plugins/alerting/server/lib/get_rule_task_timeout.ts +++ b/x-pack/plugins/alerting/server/lib/get_rule_task_timeout.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RulesConfig } from '../config'; +import type { RulesConfig } from '../config'; export const DEFAULT_EXECUTION_TIMEOUT = '5m'; diff --git a/x-pack/plugins/alerting/server/lib/get_time_range.ts b/x-pack/plugins/alerting/server/lib/get_time_range.ts index 405d194da8a47..4fa056a1dc1e8 100644 --- a/x-pack/plugins/alerting/server/lib/get_time_range.ts +++ b/x-pack/plugins/alerting/server/lib/get_time_range.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { Logger } from '@kbn/logging'; +import type { Logger } from '@kbn/logging'; import { parseDuration } from '../../common'; export interface GetTimeRangeResult { diff --git a/x-pack/plugins/alerting/server/lib/is_rule_snoozed.test.ts b/x-pack/plugins/alerting/server/lib/is_rule_snoozed.test.ts index 74baec92aa430..5a8d10797d045 100644 --- a/x-pack/plugins/alerting/server/lib/is_rule_snoozed.test.ts +++ b/x-pack/plugins/alerting/server/lib/is_rule_snoozed.test.ts @@ -9,7 +9,7 @@ import sinon from 'sinon'; import moment from 'moment-timezone'; import { Frequency } from '@kbn/rrule'; import { isRuleSnoozed } from './is_rule_snoozed'; -import { RRuleRecord } from '../types'; +import type { RRuleRecord } from '../types'; const DATE_9999 = '9999-12-31T12:34:56.789Z'; const DATE_1970 = '1970-01-01T00:00:00.000Z'; diff --git a/x-pack/plugins/alerting/server/lib/is_rule_snoozed.ts b/x-pack/plugins/alerting/server/lib/is_rule_snoozed.ts index c3b48f65f825c..c72545564c756 100644 --- a/x-pack/plugins/alerting/server/lib/is_rule_snoozed.ts +++ b/x-pack/plugins/alerting/server/lib/is_rule_snoozed.ts @@ -6,7 +6,7 @@ */ import { first, isEmpty } from 'lodash'; -import { SanitizedRule, RuleTypeParams } from '../../common/rule'; +import type { SanitizedRule, RuleTypeParams } from '../../common/rule'; import { isSnoozeActive } from './snooze/is_snooze_active'; type RuleSnoozeProps = Pick, 'muteAll' | 'snoozeSchedule'>; diff --git a/x-pack/plugins/alerting/server/lib/last_run_status.test.ts b/x-pack/plugins/alerting/server/lib/last_run_status.test.ts index 954054fa46c0c..41957c628b88f 100644 --- a/x-pack/plugins/alerting/server/lib/last_run_status.test.ts +++ b/x-pack/plugins/alerting/server/lib/last_run_status.test.ts @@ -7,8 +7,9 @@ import { ActionsCompletion } from '@kbn/alerting-state-types'; import { lastRunFromState } from './last_run_status'; -import { RuleRunMetrics } from './rule_run_metrics_store'; -import { RuleResultServiceResults, RuleResultService } from '../monitoring/rule_result_service'; +import type { RuleRunMetrics } from './rule_run_metrics_store'; +import type { RuleResultServiceResults } from '../monitoring/rule_result_service'; +import { RuleResultService } from '../monitoring/rule_result_service'; const getMetrics = ({ hasReachedAlertLimit = false, diff --git a/x-pack/plugins/alerting/server/lib/last_run_status.ts b/x-pack/plugins/alerting/server/lib/last_run_status.ts index dedee9a658360..5fe7dfeb3e222 100644 --- a/x-pack/plugins/alerting/server/lib/last_run_status.ts +++ b/x-pack/plugins/alerting/server/lib/last_run_status.ts @@ -6,19 +6,16 @@ */ import { ActionsCompletion } from '@kbn/alerting-state-types'; -import { RuleTaskStateAndMetrics } from '../task_runner/types'; +import type { RuleTaskStateAndMetrics } from '../task_runner/types'; import { getReasonFromError } from './error_with_reason'; import { getEsErrorMessage } from './errors'; -import { RuleLastRunOutcomeOrderMap, RuleLastRunOutcomes } from '../../common'; -import { - RuleLastRunOutcomeValues, - RuleExecutionStatusWarningReasons, - RawRuleLastRun, - RuleLastRun, -} from '../types'; +import type { RuleLastRunOutcomes } from '../../common'; +import { RuleLastRunOutcomeOrderMap } from '../../common'; +import type { RawRuleLastRun, RuleLastRun } from '../types'; +import { RuleLastRunOutcomeValues, RuleExecutionStatusWarningReasons } from '../types'; import { translations } from '../constants/translations'; -import { RuleRunMetrics } from './rule_run_metrics_store'; -import { RuleResultService } from '../monitoring/rule_result_service'; +import type { RuleRunMetrics } from './rule_run_metrics_store'; +import type { RuleResultService } from '../monitoring/rule_result_service'; export interface ILastRun { lastRun: RuleLastRun; diff --git a/x-pack/plugins/alerting/server/lib/license_api_access.ts b/x-pack/plugins/alerting/server/lib/license_api_access.ts index 7076918498b00..77571f584593f 100644 --- a/x-pack/plugins/alerting/server/lib/license_api_access.ts +++ b/x-pack/plugins/alerting/server/lib/license_api_access.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { ILicenseState } from './license_state'; +import type { ILicenseState } from './license_state'; export function verifyApiAccess(licenseState: ILicenseState) { const licenseCheckResults = licenseState.getLicenseInformation(); diff --git a/x-pack/plugins/alerting/server/lib/license_state.mock.ts b/x-pack/plugins/alerting/server/lib/license_state.mock.ts index f76dfad16c6e7..d127a4e815ceb 100644 --- a/x-pack/plugins/alerting/server/lib/license_state.mock.ts +++ b/x-pack/plugins/alerting/server/lib/license_state.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ILicenseState } from './license_state'; +import type { ILicenseState } from './license_state'; export const createLicenseStateMock = () => { const licenseState: jest.Mocked = { diff --git a/x-pack/plugins/alerting/server/lib/license_state.test.ts b/x-pack/plugins/alerting/server/lib/license_state.test.ts index ff1fc0a835396..c6a6bf4fd6b87 100644 --- a/x-pack/plugins/alerting/server/lib/license_state.test.ts +++ b/x-pack/plugins/alerting/server/lib/license_state.test.ts @@ -5,11 +5,12 @@ * 2.0. */ -import { RuleType } from '../types'; +import type { RuleType } from '../types'; import { Subject } from 'rxjs'; -import { LicenseState, ILicenseState } from './license_state'; +import type { ILicenseState } from './license_state'; +import { LicenseState } from './license_state'; import { licensingMock } from '@kbn/licensing-plugin/server/mocks'; -import { ILicense } from '@kbn/licensing-plugin/server'; +import type { ILicense } from '@kbn/licensing-plugin/server'; describe('checkLicense()', () => { const getRawLicense = jest.fn(); diff --git a/x-pack/plugins/alerting/server/lib/license_state.ts b/x-pack/plugins/alerting/server/lib/license_state.ts index 99be775f7c3c6..455a0c7baac85 100644 --- a/x-pack/plugins/alerting/server/lib/license_state.ts +++ b/x-pack/plugins/alerting/server/lib/license_state.ts @@ -10,12 +10,12 @@ import { i18n } from '@kbn/i18n'; import type { PublicMethodsOf } from '@kbn/utility-types'; import { assertNever } from '@kbn/std'; import { capitalize } from 'lodash'; -import { Observable, Subscription } from 'rxjs'; -import { LicensingPluginStart } from '@kbn/licensing-plugin/server'; -import { ILicense, LicenseType } from '@kbn/licensing-plugin/common/types'; +import type { Observable, Subscription } from 'rxjs'; +import type { LicensingPluginStart } from '@kbn/licensing-plugin/server'; +import type { ILicense, LicenseType } from '@kbn/licensing-plugin/common/types'; import { PLUGIN } from '../../common/constants/plugin'; import { getRuleTypeFeatureUsageName } from './get_rule_type_feature_usage_name'; -import { +import type { RuleType, RuleTypeParams, RuleTypeState, diff --git a/x-pack/plugins/alerting/server/lib/monitoring.test.ts b/x-pack/plugins/alerting/server/lib/monitoring.test.ts index 5d417c2735681..e09dee5a7420a 100644 --- a/x-pack/plugins/alerting/server/lib/monitoring.test.ts +++ b/x-pack/plugins/alerting/server/lib/monitoring.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RuleMonitoring, RuleMonitoringHistory } from '../types'; +import type { RuleMonitoring, RuleMonitoringHistory } from '../types'; import { getExecutionDurationPercentiles, updateMonitoring, diff --git a/x-pack/plugins/alerting/server/lib/monitoring.ts b/x-pack/plugins/alerting/server/lib/monitoring.ts index bff533cfc591f..75a058b768272 100644 --- a/x-pack/plugins/alerting/server/lib/monitoring.ts +++ b/x-pack/plugins/alerting/server/lib/monitoring.ts @@ -4,15 +4,15 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; import stats from 'stats-lite'; -import { +import type { RuleMonitoring, RawRuleMonitoring, RuleMonitoringHistory, RuleMonitoringLastRunMetrics, } from '../types'; -import { RuleDomain } from '../application/rule/types'; +import type { RuleDomain } from '../application/rule/types'; const INITIAL_LAST_RUN_METRICS: RuleMonitoringLastRunMetrics = { duration: 0, diff --git a/x-pack/plugins/alerting/server/lib/process_alerts.test.ts b/x-pack/plugins/alerting/server/lib/process_alerts.test.ts index 9cfc7fe14f8ba..bebf759ef2210 100644 --- a/x-pack/plugins/alerting/server/lib/process_alerts.test.ts +++ b/x-pack/plugins/alerting/server/lib/process_alerts.test.ts @@ -9,7 +9,7 @@ import sinon from 'sinon'; import { cloneDeep } from 'lodash'; import { processAlerts, updateAlertFlappingHistory } from './process_alerts'; import { Alert } from '../alert'; -import { AlertInstanceState, AlertInstanceContext } from '../types'; +import type { AlertInstanceState, AlertInstanceContext } from '../types'; import { DEFAULT_FLAPPING_SETTINGS, DISABLE_FLAPPING_SETTINGS } from '../../common/rules_settings'; describe('processAlerts', () => { diff --git a/x-pack/plugins/alerting/server/lib/process_alerts.ts b/x-pack/plugins/alerting/server/lib/process_alerts.ts index 5f145e97f66a5..56b9e78ef5a70 100644 --- a/x-pack/plugins/alerting/server/lib/process_alerts.ts +++ b/x-pack/plugins/alerting/server/lib/process_alerts.ts @@ -7,10 +7,10 @@ import { millisToNanos } from '@kbn/event-log-plugin/server'; import { cloneDeep } from 'lodash'; -import { Alert } from '../alert'; -import { AlertInstanceState, AlertInstanceContext } from '../types'; +import type { Alert } from '../alert'; +import type { AlertInstanceState, AlertInstanceContext } from '../types'; import { updateFlappingHistory } from './flapping_utils'; -import { RulesSettingsFlappingProperties } from '../../common/rules_settings'; +import type { RulesSettingsFlappingProperties } from '../../common/rules_settings'; interface ProcessAlertsOpts< State extends AlertInstanceState, diff --git a/x-pack/plugins/alerting/server/lib/retry_if_conflicts.ts b/x-pack/plugins/alerting/server/lib/retry_if_conflicts.ts index 0f9377e83ee6c..7327d2b9d1952 100644 --- a/x-pack/plugins/alerting/server/lib/retry_if_conflicts.ts +++ b/x-pack/plugins/alerting/server/lib/retry_if_conflicts.ts @@ -11,7 +11,8 @@ // have the caller make explicit conflict checks, where the conflict was // caused by a background update. -import { Logger, SavedObjectsErrorHelpers } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; +import { SavedObjectsErrorHelpers } from '@kbn/core/server'; type RetryableForConflicts = () => Promise; diff --git a/x-pack/plugins/alerting/server/lib/rule_execution_status.test.ts b/x-pack/plugins/alerting/server/lib/rule_execution_status.test.ts index bad1ba413f782..45afe9ab76f69 100644 --- a/x-pack/plugins/alerting/server/lib/rule_execution_status.test.ts +++ b/x-pack/plugins/alerting/server/lib/rule_execution_status.test.ts @@ -16,7 +16,8 @@ import { } from './rule_execution_status'; import { ErrorWithReason } from './error_with_reason'; import { translations } from '../constants/translations'; -import { RuleRunMetrics, RuleRunMetricsStore } from './rule_run_metrics_store'; +import type { RuleRunMetrics } from './rule_run_metrics_store'; +import { RuleRunMetricsStore } from './rule_run_metrics_store'; import { RuleResultService } from '../monitoring/rule_result_service'; const MockLogger = loggingSystemMock.create().get(); diff --git a/x-pack/plugins/alerting/server/lib/rule_execution_status.ts b/x-pack/plugins/alerting/server/lib/rule_execution_status.ts index 5ad7b8992a1ac..537c14216e245 100644 --- a/x-pack/plugins/alerting/server/lib/rule_execution_status.ts +++ b/x-pack/plugins/alerting/server/lib/rule_execution_status.ts @@ -5,24 +5,21 @@ * 2.0. */ -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; import { ActionsCompletion } from '@kbn/alerting-state-types'; -import { RuleResultService } from '../monitoring/rule_result_service'; +import type { RuleResultService } from '../monitoring/rule_result_service'; +import type { RuleExecutionStatus, RawRuleExecutionStatus, RawRule, Rule } from '../types'; import { - RuleExecutionStatus, RuleExecutionStatusValues, RuleExecutionStatusWarningReasons, - RawRuleExecutionStatus, - RawRule, - Rule, RuleExecutionStatusErrorReasons, } from '../types'; import { getReasonFromError } from './error_with_reason'; import { getEsErrorMessage } from './errors'; -import { RuleExecutionStatuses } from '../../common'; +import type { RuleExecutionStatuses } from '../../common'; import { translations } from '../constants/translations'; -import { RuleTaskStateAndMetrics } from '../task_runner/types'; -import { RuleRunMetrics } from './rule_run_metrics_store'; +import type { RuleTaskStateAndMetrics } from '../task_runner/types'; +import type { RuleRunMetrics } from './rule_run_metrics_store'; export interface IExecutionStatusAndMetrics { status: RuleExecutionStatus; diff --git a/x-pack/plugins/alerting/server/lib/rule_run_metrics_store.ts b/x-pack/plugins/alerting/server/lib/rule_run_metrics_store.ts index e088586136eab..0d0a83d9c9468 100644 --- a/x-pack/plugins/alerting/server/lib/rule_run_metrics_store.ts +++ b/x-pack/plugins/alerting/server/lib/rule_run_metrics_store.ts @@ -7,8 +7,8 @@ import { set } from '@kbn/safer-lodash-set'; import { ActionsCompletion } from '@kbn/alerting-state-types'; -import { ActionsConfigMap } from './get_actions_config_map'; -import { SearchMetrics } from './types'; +import type { ActionsConfigMap } from './get_actions_config_map'; +import type { SearchMetrics } from './types'; interface State { numSearches: number; diff --git a/x-pack/plugins/alerting/server/lib/set_flapping.test.ts b/x-pack/plugins/alerting/server/lib/set_flapping.test.ts index 87d26bc15198a..614721e9dc829 100644 --- a/x-pack/plugins/alerting/server/lib/set_flapping.test.ts +++ b/x-pack/plugins/alerting/server/lib/set_flapping.test.ts @@ -7,7 +7,7 @@ import { pick } from 'lodash'; import { Alert } from '../alert'; -import { AlertInstanceState, AlertInstanceContext, DefaultActionGroupId } from '../../common'; +import type { AlertInstanceState, AlertInstanceContext, DefaultActionGroupId } from '../../common'; import { setFlapping, isAlertFlapping } from './set_flapping'; import { DEFAULT_FLAPPING_SETTINGS, DISABLE_FLAPPING_SETTINGS } from '../../common/rules_settings'; diff --git a/x-pack/plugins/alerting/server/lib/set_flapping.ts b/x-pack/plugins/alerting/server/lib/set_flapping.ts index ee5871fba9657..8f6697e3d0a1d 100644 --- a/x-pack/plugins/alerting/server/lib/set_flapping.ts +++ b/x-pack/plugins/alerting/server/lib/set_flapping.ts @@ -6,10 +6,10 @@ */ import { keys } from 'lodash'; -import { Alert } from '../alert'; -import { AlertInstanceState, AlertInstanceContext } from '../types'; +import type { Alert } from '../alert'; +import type { AlertInstanceState, AlertInstanceContext } from '../types'; import { isFlapping } from './flapping_utils'; -import { RulesSettingsFlappingProperties } from '../../common/rules_settings'; +import type { RulesSettingsFlappingProperties } from '../../common/rules_settings'; export function setFlapping< State extends AlertInstanceState, diff --git a/x-pack/plugins/alerting/server/lib/snooze/is_snooze_active.test.ts b/x-pack/plugins/alerting/server/lib/snooze/is_snooze_active.test.ts index 9fdce331a7da9..8eaef9d29b608 100644 --- a/x-pack/plugins/alerting/server/lib/snooze/is_snooze_active.test.ts +++ b/x-pack/plugins/alerting/server/lib/snooze/is_snooze_active.test.ts @@ -8,7 +8,7 @@ import moment from 'moment'; import { Frequency } from '@kbn/rrule'; import sinon from 'sinon'; -import { RRuleRecord } from '../../types'; +import type { RRuleRecord } from '../../types'; import { isSnoozeActive } from './is_snooze_active'; let fakeTimer: sinon.SinonFakeTimers; diff --git a/x-pack/plugins/alerting/server/lib/snooze/is_snooze_active.ts b/x-pack/plugins/alerting/server/lib/snooze/is_snooze_active.ts index 0af968c52e206..02745623c5805 100644 --- a/x-pack/plugins/alerting/server/lib/snooze/is_snooze_active.ts +++ b/x-pack/plugins/alerting/server/lib/snooze/is_snooze_active.ts @@ -6,7 +6,7 @@ */ import { RRule, Weekday } from '@kbn/rrule'; -import { RuleSnoozeSchedule } from '../../types'; +import type { RuleSnoozeSchedule } from '../../types'; const MAX_TIMESTAMP = 8640000000000000; diff --git a/x-pack/plugins/alerting/server/lib/snooze/is_snooze_expired.test.ts b/x-pack/plugins/alerting/server/lib/snooze/is_snooze_expired.test.ts index f0a516e855aab..8494c1c6c5975 100644 --- a/x-pack/plugins/alerting/server/lib/snooze/is_snooze_expired.test.ts +++ b/x-pack/plugins/alerting/server/lib/snooze/is_snooze_expired.test.ts @@ -8,7 +8,7 @@ import sinon from 'sinon'; import { Frequency } from '@kbn/rrule'; import { isSnoozeExpired } from './is_snooze_expired'; -import { RRuleRecord } from '../../types'; +import type { RRuleRecord } from '../../types'; const DATE_9999 = '9999-12-31T12:34:56.789Z'; const DATE_1970 = '1970-01-01T00:00:00.000Z'; diff --git a/x-pack/plugins/alerting/server/lib/snooze/is_snooze_expired.ts b/x-pack/plugins/alerting/server/lib/snooze/is_snooze_expired.ts index f9dd80f9b2024..00b42e65a3cd3 100644 --- a/x-pack/plugins/alerting/server/lib/snooze/is_snooze_expired.ts +++ b/x-pack/plugins/alerting/server/lib/snooze/is_snooze_expired.ts @@ -6,7 +6,7 @@ */ import { RRule, Weekday } from '@kbn/rrule'; -import { RuleSnoozeSchedule } from '../../types'; +import type { RuleSnoozeSchedule } from '../../types'; import { isSnoozeActive } from './is_snooze_active'; export function isSnoozeExpired(snooze: RuleSnoozeSchedule) { diff --git a/x-pack/plugins/alerting/server/lib/track_deprecated_route_usage.ts b/x-pack/plugins/alerting/server/lib/track_deprecated_route_usage.ts index aa163d5cd409a..47b2813cd85fe 100644 --- a/x-pack/plugins/alerting/server/lib/track_deprecated_route_usage.ts +++ b/x-pack/plugins/alerting/server/lib/track_deprecated_route_usage.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; export function trackDeprecatedRouteUsage(route: string, usageCounter?: UsageCounter) { if (usageCounter) { diff --git a/x-pack/plugins/alerting/server/lib/track_legacy_route_usage.ts b/x-pack/plugins/alerting/server/lib/track_legacy_route_usage.ts index 2d33322630ef4..e0484031b10e4 100644 --- a/x-pack/plugins/alerting/server/lib/track_legacy_route_usage.ts +++ b/x-pack/plugins/alerting/server/lib/track_legacy_route_usage.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; export function trackLegacyRouteUsage(route: string, usageCounter?: UsageCounter) { if (usageCounter) { diff --git a/x-pack/plugins/alerting/server/lib/trim_recovered_alerts.ts b/x-pack/plugins/alerting/server/lib/trim_recovered_alerts.ts index 779bf0023a3c3..5909bbf2bf81c 100644 --- a/x-pack/plugins/alerting/server/lib/trim_recovered_alerts.ts +++ b/x-pack/plugins/alerting/server/lib/trim_recovered_alerts.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { Logger } from '@kbn/logging'; +import type { Logger } from '@kbn/logging'; import { map } from 'lodash'; -import { Alert } from '../alert'; -import { AlertInstanceState, AlertInstanceContext } from '../types'; +import type { Alert } from '../alert'; +import type { AlertInstanceState, AlertInstanceContext } from '../types'; interface TrimmedRecoveredAlertsResult< State extends AlertInstanceState, diff --git a/x-pack/plugins/alerting/server/lib/types.ts b/x-pack/plugins/alerting/server/lib/types.ts index aa5c13c3fb564..4cce74aa090ef 100644 --- a/x-pack/plugins/alerting/server/lib/types.ts +++ b/x-pack/plugins/alerting/server/lib/types.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { Rule } from '../types'; -import { RuleRunMetrics } from './rule_run_metrics_store'; +import type { Rule } from '../types'; +import type { RuleRunMetrics } from './rule_run_metrics_store'; export type RuleInfo = Pick & { spaceId: string }; diff --git a/x-pack/plugins/alerting/server/lib/validate_authorize_system_actions.test.ts b/x-pack/plugins/alerting/server/lib/validate_authorize_system_actions.test.ts index d5aeaa3f02bbe..22b7148b40d50 100644 --- a/x-pack/plugins/alerting/server/lib/validate_authorize_system_actions.test.ts +++ b/x-pack/plugins/alerting/server/lib/validate_authorize_system_actions.test.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { ActionsAuthorization, ActionsClient } from '@kbn/actions-plugin/server'; +import type { ActionsAuthorization, ActionsClient } from '@kbn/actions-plugin/server'; import { actionsAuthorizationMock, actionsClientMock } from '@kbn/actions-plugin/server/mocks'; import { schema } from '@kbn/config-schema'; import { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; -import { ConnectorAdapter } from '../connector_adapters/types'; -import { NormalizedSystemAction } from '../rules_client'; -import { RuleSystemAction } from '../types'; +import type { ConnectorAdapter } from '../connector_adapters/types'; +import type { NormalizedSystemAction } from '../rules_client'; +import type { RuleSystemAction } from '../types'; import { validateAndAuthorizeSystemActions } from './validate_authorize_system_actions'; describe('validateAndAuthorizeSystemActions', () => { diff --git a/x-pack/plugins/alerting/server/lib/validate_authorize_system_actions.ts b/x-pack/plugins/alerting/server/lib/validate_authorize_system_actions.ts index 3c88797581ef1..8ef3374352abf 100644 --- a/x-pack/plugins/alerting/server/lib/validate_authorize_system_actions.ts +++ b/x-pack/plugins/alerting/server/lib/validate_authorize_system_actions.ts @@ -6,12 +6,12 @@ */ import Boom from '@hapi/boom'; -import { ActionsAuthorization, ActionsClient } from '@kbn/actions-plugin/server'; -import { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; +import type { ActionsAuthorization, ActionsClient } from '@kbn/actions-plugin/server'; +import type { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; import { getSystemActionKibanaPrivileges } from '../connector_adapters/get_system_action_kibana_privileges'; import { bulkValidateConnectorAdapterActionParams } from '../connector_adapters/validate_rule_action_params'; -import { NormalizedSystemAction } from '../rules_client'; -import { RuleSystemAction } from '../types'; +import type { NormalizedSystemAction } from '../rules_client'; +import type { RuleSystemAction } from '../types'; interface Params { actionsClient: ActionsClient; actionsAuthorization: ActionsAuthorization; diff --git a/x-pack/plugins/alerting/server/lib/validate_mutated_rule_type_params.ts b/x-pack/plugins/alerting/server/lib/validate_mutated_rule_type_params.ts index 52d7b768137b2..aa66e3d8d9841 100644 --- a/x-pack/plugins/alerting/server/lib/validate_mutated_rule_type_params.ts +++ b/x-pack/plugins/alerting/server/lib/validate_mutated_rule_type_params.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { RuleTypeParams, RuleTypeParamsValidator } from '../types'; +import type { RuleTypeParams, RuleTypeParamsValidator } from '../types'; export function validateMutatedRuleTypeParams( mutatedParams: Params, diff --git a/x-pack/plugins/alerting/server/lib/validate_rrule_by.ts b/x-pack/plugins/alerting/server/lib/validate_rrule_by.ts index eabbffbe3717e..dae9e64b83e0e 100644 --- a/x-pack/plugins/alerting/server/lib/validate_rrule_by.ts +++ b/x-pack/plugins/alerting/server/lib/validate_rrule_by.ts @@ -7,5 +7,4 @@ export const createValidateRruleBy = (propName: string) => (array: unknown[]) => { if (array.length === 0) return `rRule ${propName} cannot be empty`; - return; }; diff --git a/x-pack/plugins/alerting/server/lib/validate_rule_type_params.ts b/x-pack/plugins/alerting/server/lib/validate_rule_type_params.ts index 0f152bb6f641b..c9608d3bb8a99 100644 --- a/x-pack/plugins/alerting/server/lib/validate_rule_type_params.ts +++ b/x-pack/plugins/alerting/server/lib/validate_rule_type_params.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { RuleTypeParams, RuleTypeParamsValidator } from '../types'; +import type { RuleTypeParams, RuleTypeParamsValidator } from '../types'; export function validateRuleTypeParams( params: Record, diff --git a/x-pack/plugins/alerting/server/lib/validate_snooze_date.ts b/x-pack/plugins/alerting/server/lib/validate_snooze_date.ts index 91d8a2943d394..0a26815821250 100644 --- a/x-pack/plugins/alerting/server/lib/validate_snooze_date.ts +++ b/x-pack/plugins/alerting/server/lib/validate_snooze_date.ts @@ -9,11 +9,9 @@ export const validateSnoozeEndDate = (date: string) => { const parsedValue = Date.parse(date); if (isNaN(parsedValue)) return `Invalid date: ${date}`; if (parsedValue <= Date.now()) return `Invalid snooze date as it is in the past: ${date}`; - return; }; export const validateSnoozeStartDate = (date: string) => { const parsedValue = Date.parse(date); if (isNaN(parsedValue)) return `Invalid date: ${date}`; - return; }; diff --git a/x-pack/plugins/alerting/server/lib/validate_snooze_schedule.ts b/x-pack/plugins/alerting/server/lib/validate_snooze_schedule.ts index a6e9059be9857..6940a9d64fbfb 100644 --- a/x-pack/plugins/alerting/server/lib/validate_snooze_schedule.ts +++ b/x-pack/plugins/alerting/server/lib/validate_snooze_schedule.ts @@ -7,7 +7,7 @@ import { Frequency } from '@kbn/rrule'; import moment from 'moment'; -import { RuleSnoozeSchedule } from '../types'; +import type { RuleSnoozeSchedule } from '../types'; export const validateSnoozeSchedule = (schedule: RuleSnoozeSchedule) => { const intervalIsDaily = schedule.rRule.freq === Frequency.DAILY; diff --git a/x-pack/plugins/alerting/server/lib/wrap_scoped_cluster_client.test.ts b/x-pack/plugins/alerting/server/lib/wrap_scoped_cluster_client.test.ts index e287712104949..a3d3ab7294e2b 100644 --- a/x-pack/plugins/alerting/server/lib/wrap_scoped_cluster_client.test.ts +++ b/x-pack/plugins/alerting/server/lib/wrap_scoped_cluster_client.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Client } from '@elastic/elasticsearch'; +import type { Client } from '@elastic/elasticsearch'; import { loggingSystemMock } from '@kbn/core/server/mocks'; import { elasticsearchServiceMock } from '@kbn/core/server/mocks'; import { createWrappedScopedClusterClientFactory } from './wrap_scoped_cluster_client'; diff --git a/x-pack/plugins/alerting/server/lib/wrap_scoped_cluster_client.ts b/x-pack/plugins/alerting/server/lib/wrap_scoped_cluster_client.ts index 3bf87b3653c5a..39784c364bca4 100644 --- a/x-pack/plugins/alerting/server/lib/wrap_scoped_cluster_client.ts +++ b/x-pack/plugins/alerting/server/lib/wrap_scoped_cluster_client.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { +import type { TransportRequestOptions, TransportResult, TransportRequestOptionsWithMeta, @@ -25,7 +25,7 @@ import type { EqlSearchRequest as EqlSearchRequestWithBody, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import type { IScopedClusterClient, ElasticsearchClient, Logger } from '@kbn/core/server'; -import { SearchMetrics, RuleInfo } from './types'; +import type { SearchMetrics, RuleInfo } from './types'; interface WrapScopedClusterClientFactoryOpts { scopedClusterClient: IScopedClusterClient; diff --git a/x-pack/plugins/alerting/server/lib/wrap_search_source_client.test.ts b/x-pack/plugins/alerting/server/lib/wrap_search_source_client.test.ts index 2eb51cfd06f7a..c1603c6c98055 100644 --- a/x-pack/plugins/alerting/server/lib/wrap_search_source_client.test.ts +++ b/x-pack/plugins/alerting/server/lib/wrap_search_source_client.test.ts @@ -6,7 +6,7 @@ */ import { loggingSystemMock } from '@kbn/core/server/mocks'; -import { ISearchStartSearchSource } from '@kbn/data-plugin/common'; +import type { ISearchStartSearchSource } from '@kbn/data-plugin/common'; import { createSearchSourceMock } from '@kbn/data-plugin/common/search/search_source/mocks'; import { of, throwError } from 'rxjs'; import { wrapSearchSourceClient } from './wrap_search_source_client'; diff --git a/x-pack/plugins/alerting/server/lib/wrap_search_source_client.ts b/x-pack/plugins/alerting/server/lib/wrap_search_source_client.ts index e1cf3cba0bd24..696c66d99763d 100644 --- a/x-pack/plugins/alerting/server/lib/wrap_search_source_client.ts +++ b/x-pack/plugins/alerting/server/lib/wrap_search_source_client.ts @@ -5,16 +5,16 @@ * 2.0. */ -import { Logger } from '@kbn/core/server'; -import { ISearchOptions } from '@kbn/search-types'; -import { +import type { Logger } from '@kbn/core/server'; +import type { ISearchOptions } from '@kbn/search-types'; +import type { ISearchSource, ISearchStartSearchSource, SearchSource, SerializedSearchSourceFields, } from '@kbn/data-plugin/common'; import { catchError, tap, throwError } from 'rxjs'; -import { LogSearchMetricsOpts, RuleInfo, SearchMetrics } from './types'; +import type { LogSearchMetricsOpts, RuleInfo, SearchMetrics } from './types'; interface Props { logger: Logger; diff --git a/x-pack/plugins/alerting/server/maintenance_window_client.mock.ts b/x-pack/plugins/alerting/server/maintenance_window_client.mock.ts index f7b8d685d73bc..a42c2fdc1ffbd 100644 --- a/x-pack/plugins/alerting/server/maintenance_window_client.mock.ts +++ b/x-pack/plugins/alerting/server/maintenance_window_client.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { MaintenanceWindowClientApi } from './types'; +import type { MaintenanceWindowClientApi } from './types'; type Schema = MaintenanceWindowClientApi; export type MaintenanceWindowClientMock = jest.Mocked; diff --git a/x-pack/plugins/alerting/server/maintenance_window_client/maintenance_window_client.ts b/x-pack/plugins/alerting/server/maintenance_window_client/maintenance_window_client.ts index dba7ae0800ede..f80496cd479ce 100644 --- a/x-pack/plugins/alerting/server/maintenance_window_client/maintenance_window_client.ts +++ b/x-pack/plugins/alerting/server/maintenance_window_client/maintenance_window_client.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { IUiSettingsClient, Logger, SavedObjectsClientContract } from '@kbn/core/server'; +import type { IUiSettingsClient, Logger, SavedObjectsClientContract } from '@kbn/core/server'; import { createMaintenanceWindow } from '../application/maintenance_window/methods/create/create_maintenance_window'; import type { CreateMaintenanceWindowParams } from '../application/maintenance_window/methods/create/types'; @@ -29,7 +29,7 @@ import type { BulkGetMaintenanceWindowsParams, BulkGetMaintenanceWindowsResult, } from '../application/maintenance_window/methods/bulk_get/types'; -import { +import type { MaintenanceWindowModificationMetadata, MaintenanceWindowClientContext, } from '../../common'; diff --git a/x-pack/plugins/alerting/server/maintenance_window_client_factory.test.ts b/x-pack/plugins/alerting/server/maintenance_window_client_factory.test.ts index 85ac758da1737..8f2fb3b177667 100644 --- a/x-pack/plugins/alerting/server/maintenance_window_client_factory.test.ts +++ b/x-pack/plugins/alerting/server/maintenance_window_client_factory.test.ts @@ -5,10 +5,8 @@ * 2.0. */ import { mockRouter } from '@kbn/core-http-router-server-mocks'; -import { - MaintenanceWindowClientFactory, - MaintenanceWindowClientFactoryOpts, -} from './maintenance_window_client_factory'; +import type { MaintenanceWindowClientFactoryOpts } from './maintenance_window_client_factory'; +import { MaintenanceWindowClientFactory } from './maintenance_window_client_factory'; import { savedObjectsClientMock, savedObjectsServiceMock, @@ -16,7 +14,7 @@ import { uiSettingsServiceMock, securityServiceMock, } from '@kbn/core/server/mocks'; -import { AuthenticatedUser } from '@kbn/security-plugin/common'; +import type { AuthenticatedUser } from '@kbn/security-plugin/common'; import { SECURITY_EXTENSION_ID } from '@kbn/core-saved-objects-server'; import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../common'; diff --git a/x-pack/plugins/alerting/server/maintenance_window_client_factory.ts b/x-pack/plugins/alerting/server/maintenance_window_client_factory.ts index 5cd013784637c..b9dc22ded1480 100644 --- a/x-pack/plugins/alerting/server/maintenance_window_client_factory.ts +++ b/x-pack/plugins/alerting/server/maintenance_window_client_factory.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { +import type { KibanaRequest, Logger, SavedObjectsServiceStart, - SECURITY_EXTENSION_ID, SecurityServiceStart, UiSettingsServiceStart, } from '@kbn/core/server'; +import { SECURITY_EXTENSION_ID } from '@kbn/core/server'; import { MaintenanceWindowClient } from './maintenance_window_client'; import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../common'; diff --git a/x-pack/plugins/alerting/server/maintenance_window_feature.ts b/x-pack/plugins/alerting/server/maintenance_window_feature.ts index 1ae24c1c45f09..6395d05387d84 100644 --- a/x-pack/plugins/alerting/server/maintenance_window_feature.ts +++ b/x-pack/plugins/alerting/server/maintenance_window_feature.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { KibanaFeatureConfig } from '@kbn/features-plugin/common'; +import type { KibanaFeatureConfig } from '@kbn/features-plugin/common'; import { DEFAULT_APP_CATEGORIES } from '@kbn/core/server'; import { KibanaFeatureScope } from '@kbn/features-plugin/common'; import { diff --git a/x-pack/plugins/alerting/server/mocks.ts b/x-pack/plugins/alerting/server/mocks.ts index 33cbccbaf8c0c..ced1ec583ec39 100644 --- a/x-pack/plugins/alerting/server/mocks.ts +++ b/x-pack/plugins/alerting/server/mocks.ts @@ -12,11 +12,11 @@ import { } from '@kbn/core/server/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { searchSourceCommonMock } from '@kbn/data-plugin/common/search/search_source/mocks'; -import { SharePluginStart } from '@kbn/share-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; import { rulesClientMock } from './rules_client.mock'; -import { PluginSetupContract, PluginStartContract } from './plugin'; -import { Alert, AlertFactoryDoneUtils } from './alert'; -import { +import type { PluginSetupContract, PluginStartContract } from './plugin'; +import type { Alert, AlertFactoryDoneUtils } from './alert'; +import type { AlertInstanceContext, AlertInstanceState, PublicRuleResultService, diff --git a/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.ts b/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.ts index a2d0425da1427..9c8ef9809a1b0 100644 --- a/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.ts +++ b/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Logger } from '@kbn/logging'; +import type { Logger } from '@kbn/logging'; export enum IN_MEMORY_METRICS { RULE_EXECUTIONS = 'ruleExecutions', diff --git a/x-pack/plugins/alerting/server/monitoring/register_cluster_collector.test.ts b/x-pack/plugins/alerting/server/monitoring/register_cluster_collector.test.ts index 0fac6df62330f..2a5e47e3f1c01 100644 --- a/x-pack/plugins/alerting/server/monitoring/register_cluster_collector.test.ts +++ b/x-pack/plugins/alerting/server/monitoring/register_cluster_collector.test.ts @@ -5,12 +5,12 @@ * 2.0. */ import { coreMock } from '@kbn/core/public/mocks'; -import { CoreSetup } from '@kbn/core/server'; +import type { CoreSetup } from '@kbn/core/server'; import { monitoringCollectionMock } from '@kbn/monitoring-collection-plugin/server/mocks'; -import { Metric } from '@kbn/monitoring-collection-plugin/server'; +import type { Metric } from '@kbn/monitoring-collection-plugin/server'; import { registerClusterCollector } from './register_cluster_collector'; -import { AlertingPluginsStart } from '../plugin'; -import { ClusterRulesMetric } from './types'; +import type { AlertingPluginsStart } from '../plugin'; +import type { ClusterRulesMetric } from './types'; jest.useFakeTimers(); jest.setSystemTime(new Date('2020-03-09').getTime()); diff --git a/x-pack/plugins/alerting/server/monitoring/register_cluster_collector.ts b/x-pack/plugins/alerting/server/monitoring/register_cluster_collector.ts index 11832a5e5d00d..8a4bcaef04220 100644 --- a/x-pack/plugins/alerting/server/monitoring/register_cluster_collector.ts +++ b/x-pack/plugins/alerting/server/monitoring/register_cluster_collector.ts @@ -8,11 +8,12 @@ import type { AggregationsKeyedPercentiles, AggregationsPercentilesAggregateBase, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { MonitoringCollectionSetup } from '@kbn/monitoring-collection-plugin/server'; +import type { MonitoringCollectionSetup } from '@kbn/monitoring-collection-plugin/server'; import { aggregateTaskOverduePercentilesForType } from '@kbn/task-manager-plugin/server'; -import { CoreSetup } from '@kbn/core/server'; -import { AlertingPluginsStart } from '../plugin'; -import { ClusterRulesMetric, EMPTY_CLUSTER_RULES_METRICS } from './types'; +import type { CoreSetup } from '@kbn/core/server'; +import type { AlertingPluginsStart } from '../plugin'; +import type { ClusterRulesMetric } from './types'; +import { EMPTY_CLUSTER_RULES_METRICS } from './types'; export function registerClusterCollector({ monitoringCollection, diff --git a/x-pack/plugins/alerting/server/monitoring/register_node_collector.test.ts b/x-pack/plugins/alerting/server/monitoring/register_node_collector.test.ts index a17cf5b47020b..06173531612f8 100644 --- a/x-pack/plugins/alerting/server/monitoring/register_node_collector.test.ts +++ b/x-pack/plugins/alerting/server/monitoring/register_node_collector.test.ts @@ -6,9 +6,9 @@ */ import { monitoringCollectionMock } from '@kbn/monitoring-collection-plugin/server/mocks'; import { loggingSystemMock } from '@kbn/core/server/mocks'; -import { Metric } from '@kbn/monitoring-collection-plugin/server'; +import type { Metric } from '@kbn/monitoring-collection-plugin/server'; import { registerNodeCollector } from './register_node_collector'; -import { NodeRulesMetric } from './types'; +import type { NodeRulesMetric } from './types'; import { InMemoryMetrics, IN_MEMORY_METRICS } from '.'; jest.mock('./in_memory_metrics'); diff --git a/x-pack/plugins/alerting/server/monitoring/register_node_collector.ts b/x-pack/plugins/alerting/server/monitoring/register_node_collector.ts index 839787c6e78fc..172a17cc1794a 100644 --- a/x-pack/plugins/alerting/server/monitoring/register_node_collector.ts +++ b/x-pack/plugins/alerting/server/monitoring/register_node_collector.ts @@ -4,9 +4,9 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { MonitoringCollectionSetup } from '@kbn/monitoring-collection-plugin/server'; +import type { MonitoringCollectionSetup } from '@kbn/monitoring-collection-plugin/server'; import { IN_MEMORY_METRICS } from '.'; -import { InMemoryMetrics } from './in_memory_metrics'; +import type { InMemoryMetrics } from './in_memory_metrics'; export function registerNodeCollector({ monitoringCollection, diff --git a/x-pack/plugins/alerting/server/monitoring/rule_monitoring_service.ts b/x-pack/plugins/alerting/server/monitoring/rule_monitoring_service.ts index 0043f47c51633..d1faadb161b8e 100644 --- a/x-pack/plugins/alerting/server/monitoring/rule_monitoring_service.ts +++ b/x-pack/plugins/alerting/server/monitoring/rule_monitoring_service.ts @@ -6,7 +6,7 @@ */ import { getDefaultMonitoring, getExecutionDurationPercentiles } from '../lib/monitoring'; -import { RuleMonitoring, RuleMonitoringHistory, PublicRuleMonitoringService } from '../types'; +import type { RuleMonitoring, RuleMonitoringHistory, PublicRuleMonitoringService } from '../types'; export class RuleMonitoringService { private monitoring: RuleMonitoring = getDefaultMonitoring(new Date().toISOString()); diff --git a/x-pack/plugins/alerting/server/monitoring/rule_result_service.test.ts b/x-pack/plugins/alerting/server/monitoring/rule_result_service.test.ts index bb4168b7d162a..4f2c52c06083f 100644 --- a/x-pack/plugins/alerting/server/monitoring/rule_result_service.test.ts +++ b/x-pack/plugins/alerting/server/monitoring/rule_result_service.test.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { PublicLastRunSetters } from '../types'; -import { RuleResultServiceResults, RuleResultService } from './rule_result_service'; +import type { PublicLastRunSetters } from '../types'; +import type { RuleResultServiceResults } from './rule_result_service'; +import { RuleResultService } from './rule_result_service'; describe('RuleResultService', () => { let ruleResultService: RuleResultService; diff --git a/x-pack/plugins/alerting/server/monitoring/rule_result_service.ts b/x-pack/plugins/alerting/server/monitoring/rule_result_service.ts index 1646efb29797a..3becb1bd832fc 100644 --- a/x-pack/plugins/alerting/server/monitoring/rule_result_service.ts +++ b/x-pack/plugins/alerting/server/monitoring/rule_result_service.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { PublicLastRunSetters } from '../types'; +import type { PublicLastRunSetters } from '../types'; export interface RuleResultServiceResults { errors: LastRunError[]; diff --git a/x-pack/plugins/alerting/server/monitoring/types.ts b/x-pack/plugins/alerting/server/monitoring/types.ts index ae469733a1f07..e8f4a2f2904e1 100644 --- a/x-pack/plugins/alerting/server/monitoring/types.ts +++ b/x-pack/plugins/alerting/server/monitoring/types.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { MetricResult } from '@kbn/monitoring-collection-plugin/server'; +import type { MetricResult } from '@kbn/monitoring-collection-plugin/server'; export const EMPTY_CLUSTER_RULES_METRICS: ClusterRulesMetric = { overdue: { diff --git a/x-pack/plugins/alerting/server/plugin.test.ts b/x-pack/plugins/alerting/server/plugin.test.ts index 37175ac960412..5fac6ac171d87 100644 --- a/x-pack/plugins/alerting/server/plugin.test.ts +++ b/x-pack/plugins/alerting/server/plugin.test.ts @@ -5,24 +5,25 @@ * 2.0. */ -import { AlertingPlugin, PluginSetupContract } from './plugin'; +import type { PluginSetupContract } from './plugin'; +import { AlertingPlugin } from './plugin'; import { createUsageCollectionSetupMock } from '@kbn/usage-collection-plugin/server/mocks'; import { coreMock, statusServiceMock } from '@kbn/core/server/mocks'; import { licensingMock } from '@kbn/licensing-plugin/server/mocks'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; import { eventLogServiceMock } from '@kbn/event-log-plugin/server/event_log_service.mock'; -import { KibanaRequest } from '@kbn/core/server'; +import type { KibanaRequest } from '@kbn/core/server'; import { featuresPluginMock } from '@kbn/features-plugin/server/mocks'; import { KibanaFeature } from '@kbn/features-plugin/server'; -import { AlertingConfig } from './config'; -import { RuleType } from './types'; +import type { AlertingConfig } from './config'; +import type { RuleType } from './types'; import { eventLogMock } from '@kbn/event-log-plugin/server/mocks'; import { actionsMock } from '@kbn/actions-plugin/server/mocks'; import { dataPluginMock } from '@kbn/data-plugin/server/mocks'; import { dataPluginMock as autocompletePluginMock } from '@kbn/unified-search-plugin/server/mocks'; import { monitoringCollectionMock } from '@kbn/monitoring-collection-plugin/server/mocks'; -import { +import type { DataViewsServerPluginStart, PluginSetup as DataPluginSetup, } from '@kbn/data-plugin/server'; @@ -36,7 +37,7 @@ const mockAlertService = alertsServiceMock.create(); jest.mock('./alerts_service/alerts_service', () => ({ AlertsService: jest.fn().mockImplementation(() => mockAlertService), })); -import { SharePluginStart } from '@kbn/share-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { generateAlertingConfig } from './test_utils'; diff --git a/x-pack/plugins/alerting/server/plugin.ts b/x-pack/plugins/alerting/server/plugin.ts index bf1f02d3a4910..2dc103ddb6127 100644 --- a/x-pack/plugins/alerting/server/plugin.ts +++ b/x-pack/plugins/alerting/server/plugin.ts @@ -6,30 +6,24 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { - BehaviorSubject, - ReplaySubject, - Subject, - Observable, - map, - distinctUntilChanged, -} from 'rxjs'; +import type { Subject, Observable } from 'rxjs'; +import { BehaviorSubject, ReplaySubject, map, distinctUntilChanged } from 'rxjs'; import { pick } from 'lodash'; -import { UsageCollectionSetup, UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server'; -import { PluginSetup as DataPluginSetup } from '@kbn/data-plugin/server'; -import { PluginStart as DataViewsPluginStart } from '@kbn/data-views-plugin/server'; -import { +import type { UsageCollectionSetup, UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server'; +import type { PluginSetup as DataPluginSetup } from '@kbn/data-plugin/server'; +import type { PluginStart as DataViewsPluginStart } from '@kbn/data-views-plugin/server'; +import type { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart, } from '@kbn/encrypted-saved-objects-plugin/server'; -import { +import type { TaskManagerSetupContract, TaskManagerStartContract, } from '@kbn/task-manager-plugin/server'; import { DEFAULT_SPACE_ID } from '@kbn/spaces-plugin/common'; -import { SpacesPluginStart } from '@kbn/spaces-plugin/server'; -import { +import type { SpacesPluginStart } from '@kbn/spaces-plugin/server'; +import type { KibanaRequest, Logger, PluginInitializerContext, @@ -39,29 +33,26 @@ import { StatusServiceSetup, ServiceStatus, SavedObjectsBulkGetObject, - ServiceStatusLevels, CoreStatus, } from '@kbn/core/server'; -import { - LICENSE_TYPE, - LicensingPluginSetup, - LicensingPluginStart, -} from '@kbn/licensing-plugin/server'; -import { +import { ServiceStatusLevels } from '@kbn/core/server'; +import type { LicensingPluginSetup, LicensingPluginStart } from '@kbn/licensing-plugin/server'; +import { LICENSE_TYPE } from '@kbn/licensing-plugin/server'; +import type { PluginSetupContract as ActionsPluginSetupContract, PluginStartContract as ActionsPluginStartContract, } from '@kbn/actions-plugin/server'; -import { +import type { IEventLogger, IEventLogService, IEventLogClientService, } from '@kbn/event-log-plugin/server'; -import { FeaturesPluginStart, FeaturesPluginSetup } from '@kbn/features-plugin/server'; +import type { FeaturesPluginStart, FeaturesPluginSetup } from '@kbn/features-plugin/server'; import type { PluginSetup as UnifiedSearchServerPluginSetup } from '@kbn/unified-search-plugin/server'; -import { PluginStart as DataPluginStart } from '@kbn/data-plugin/server'; -import { MonitoringCollectionSetup } from '@kbn/monitoring-collection-plugin/server'; -import { SharePluginStart } from '@kbn/share-plugin/server'; -import { ServerlessPluginSetup } from '@kbn/serverless/server'; +import type { PluginStart as DataPluginStart } from '@kbn/data-plugin/server'; +import type { MonitoringCollectionSetup } from '@kbn/monitoring-collection-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; +import type { ServerlessPluginSetup } from '@kbn/serverless/server'; import { RuleTypeRegistry } from './rule_type_registry'; import { TaskRunnerFactory } from './task_runner'; @@ -72,10 +63,12 @@ import { getRulesSettingsFeature, } from './rules_settings'; import { MaintenanceWindowClientFactory } from './maintenance_window_client_factory'; -import { ILicenseState, LicenseState } from './lib/license_state'; -import { AlertingRequestHandlerContext, ALERTING_FEATURE_ID, RuleAlertData } from './types'; +import type { ILicenseState } from './lib/license_state'; +import { LicenseState } from './lib/license_state'; +import type { AlertingRequestHandlerContext, RuleAlertData } from './types'; +import { ALERTING_FEATURE_ID } from './types'; import { defineRoutes } from './routes'; -import { +import type { AlertInstanceContext, AlertInstanceState, AlertsHealth, @@ -96,11 +89,12 @@ import { scheduleApiKeyInvalidatorTask, } from './invalidate_pending_api_keys/task'; import { scheduleAlertingHealthCheck, initializeAlertingHealth } from './health'; -import { AlertingConfig, AlertingRulesConfig } from './config'; +import type { AlertingConfig, AlertingRulesConfig } from './config'; import { getHealth } from './health/get_health'; import { AlertingAuthorizationClientFactory } from './alerting_authorization_client_factory'; -import { AlertingAuthorization } from './authorization'; -import { getSecurityHealth, SecurityHealth } from './lib/get_security_health'; +import type { AlertingAuthorization } from './authorization'; +import type { SecurityHealth } from './lib/get_security_health'; +import { getSecurityHealth } from './lib/get_security_health'; import { registerNodeCollector, registerClusterCollector, InMemoryMetrics } from './monitoring'; import { getRuleTaskTimeout } from './lib/get_rule_task_timeout'; import { getActionsConfigMap } from './lib/get_actions_config_map'; @@ -112,9 +106,11 @@ import { } from './alerts_service'; import { maintenanceWindowFeature } from './maintenance_window_feature'; import { ConnectorAdapterRegistry } from './connector_adapters/connector_adapter_registry'; -import { ConnectorAdapter, ConnectorAdapterParams } from './connector_adapters/types'; -import { DataStreamAdapter, getDataStreamAdapter } from './alerts_service/lib/data_stream_adapter'; -import { createGetAlertIndicesAliasFn, GetAlertIndicesAlias } from './lib'; +import type { ConnectorAdapter, ConnectorAdapterParams } from './connector_adapters/types'; +import type { DataStreamAdapter } from './alerts_service/lib/data_stream_adapter'; +import { getDataStreamAdapter } from './alerts_service/lib/data_stream_adapter'; +import type { GetAlertIndicesAlias } from './lib'; +import { createGetAlertIndicesAliasFn } from './lib'; import { BackfillClient } from './backfill_client/backfill_client'; import { MaintenanceWindowsService } from './task_runner/maintenance_windows'; diff --git a/x-pack/plugins/alerting/server/routes/_mock_handler_arguments.ts b/x-pack/plugins/alerting/server/routes/_mock_handler_arguments.ts index b2f25d349ec7f..2d5459b4a35bf 100644 --- a/x-pack/plugins/alerting/server/routes/_mock_handler_arguments.ts +++ b/x-pack/plugins/alerting/server/routes/_mock_handler_arguments.ts @@ -5,22 +5,19 @@ * 2.0. */ -import { KibanaRequest, KibanaResponseFactory } from '@kbn/core/server'; +import type { KibanaRequest, KibanaResponseFactory } from '@kbn/core/server'; import { identity } from 'lodash'; import type { MethodKeysOf } from '@kbn/utility-types'; import { httpServerMock } from '@kbn/core/server/mocks'; import { actionsClientMock } from '@kbn/actions-plugin/server/mocks'; import type { ActionsClientMock } from '@kbn/actions-plugin/server/mocks'; -import { rulesClientMock, RulesClientMock } from '../rules_client.mock'; -import { - rulesSettingsClientMock, - RulesSettingsClientMock, -} from '../rules_settings/rules_settings_client.mock'; -import { - maintenanceWindowClientMock, - MaintenanceWindowClientMock, -} from '../maintenance_window_client.mock'; -import { AlertsHealth, RuleType } from '../../common'; +import type { RulesClientMock } from '../rules_client.mock'; +import { rulesClientMock } from '../rules_client.mock'; +import type { RulesSettingsClientMock } from '../rules_settings/rules_settings_client.mock'; +import { rulesSettingsClientMock } from '../rules_settings/rules_settings_client.mock'; +import type { MaintenanceWindowClientMock } from '../maintenance_window_client.mock'; +import { maintenanceWindowClientMock } from '../maintenance_window_client.mock'; +import type { AlertsHealth, RuleType } from '../../common'; import type { AlertingRequestHandlerContext } from '../types'; export function mockHandlerArguments( diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/delete/delete_backfill_route.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/delete/delete_backfill_route.ts index 6c343ac125188..a63e7adef24cc 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/delete/delete_backfill_route.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/delete/delete_backfill_route.ts @@ -4,14 +4,13 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { - deleteParamsSchemaV1, - DeleteBackfillRequestParamsV1, -} from '../../../../../common/routes/backfill/apis/delete'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { DeleteBackfillRequestParamsV1 } from '../../../../../common/routes/backfill/apis/delete'; +import { deleteParamsSchemaV1 } from '../../../../../common/routes/backfill/apis/delete'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; export const deleteBackfillRoute = ( router: IRouter, diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/find/find_backfill_route.test.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/find/find_backfill_route.test.ts index a8a0a210c8817..c0f01907a27c5 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/find/find_backfill_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/find/find_backfill_route.test.ts @@ -12,7 +12,7 @@ import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { transformRequestV1, transformResponseV1 } from './transforms'; import { rulesClientMock } from '../../../../rules_client.mock'; import { findBackfillRoute } from './find_backfill_route'; -import { FindBackfillResult } from '../../../../application/backfill/methods/find/types'; +import type { FindBackfillResult } from '../../../../application/backfill/methods/find/types'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/find/find_backfill_route.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/find/find_backfill_route.ts index fea2925c0983b..f8d9ab77ce51c 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/find/find_backfill_route.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/find/find_backfill_route.ts @@ -4,18 +4,16 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { - findQuerySchemaV1, +import type { IRouter } from '@kbn/core/server'; +import type { FindBackfillRequestQueryV1, FindBackfillResponseV1, } from '../../../../../common/routes/backfill/apis/find'; -import { ILicenseState } from '../../../../lib'; +import { findQuerySchemaV1 } from '../../../../../common/routes/backfill/apis/find'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_BACKFILL_FIND_API_PATH, -} from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_BACKFILL_FIND_API_PATH } from '../../../../types'; import { transformRequestV1, transformResponseV1 } from './transforms'; export const findBackfillRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/find/transforms/transform_request/v1.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/find/transforms/transform_request/v1.ts index 3425f5dea83f4..d3781651ea338 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/find/transforms/transform_request/v1.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/find/transforms/transform_request/v1.ts @@ -6,8 +6,8 @@ */ /* eslint-disable @typescript-eslint/naming-convention */ -import { FindBackfillRequestQueryV1 } from '../../../../../../../common/routes/backfill/apis/find'; -import { FindBackfillParams } from '../../../../../../application/backfill/methods/find/types'; +import type { FindBackfillRequestQueryV1 } from '../../../../../../../common/routes/backfill/apis/find'; +import type { FindBackfillParams } from '../../../../../../application/backfill/methods/find/types'; export const transformRequest = ({ end, diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/find/transforms/transform_response/v1.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/find/transforms/transform_response/v1.ts index ce959b92d963b..8ac884ff60086 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/find/transforms/transform_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/find/transforms/transform_response/v1.ts @@ -6,7 +6,7 @@ */ import type { FindBackfillResult } from '../../../../../../application/backfill/methods/find/types'; -import { FindBackfillResponseBodyV1 } from '../../../../../../../common/routes/backfill/apis/find'; +import type { FindBackfillResponseBodyV1 } from '../../../../../../../common/routes/backfill/apis/find'; import { transformBackfillToBackfillResponseV1 } from '../../../../transforms'; export const transformResponse = ({ diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/get/get_backfill_route.test.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/get/get_backfill_route.test.ts index 79ac8df1ed4b5..9d7f4a99501cd 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/get/get_backfill_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/get/get_backfill_route.test.ts @@ -11,7 +11,7 @@ import { verifyApiAccess } from '../../../../lib/license_api_access'; import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { rulesClientMock } from '../../../../rules_client.mock'; import { getBackfillRoute } from './get_backfill_route'; -import { Backfill } from '../../../../application/backfill/result/types'; +import type { Backfill } from '../../../../application/backfill/result/types'; import { transformBackfillToBackfillResponseV1 } from '../../transforms'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/get/get_backfill_route.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/get/get_backfill_route.ts index bfb178d875c8b..e8487b6d7ccb0 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/get/get_backfill_route.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/get/get_backfill_route.ts @@ -4,15 +4,16 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { - getParamsSchemaV1, +import type { IRouter } from '@kbn/core/server'; +import type { GetBackfillRequestParamsV1, GetBackfillResponseV1, } from '../../../../../common/routes/backfill/apis/get'; -import { ILicenseState } from '../../../../lib'; +import { getParamsSchemaV1 } from '../../../../../common/routes/backfill/apis/get'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { transformBackfillToBackfillResponseV1 } from '../../transforms'; export const getBackfillRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/schedule_backfill_route.test.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/schedule_backfill_route.test.ts index c08cca6dfe683..4efb6ff90f539 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/schedule_backfill_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/schedule_backfill_route.test.ts @@ -12,7 +12,7 @@ import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { transformRequestV1, transformResponseV1 } from './transforms'; import { rulesClientMock } from '../../../../rules_client.mock'; import { scheduleBackfillRoute } from './schedule_backfill_route'; -import { ScheduleBackfillResults } from '../../../../application/backfill/methods/schedule/types'; +import type { ScheduleBackfillResults } from '../../../../application/backfill/methods/schedule/types'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/schedule_backfill_route.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/schedule_backfill_route.ts index 466c69b2b6aa5..b7f55e6caf0c5 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/schedule_backfill_route.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/schedule_backfill_route.ts @@ -4,15 +4,16 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { - scheduleBodySchemaV1, +import type { IRouter } from '@kbn/core/server'; +import type { ScheduleBackfillRequestBodyV1, ScheduleBackfillResponseV1, } from '../../../../../common/routes/backfill/apis/schedule'; -import { ILicenseState } from '../../../../lib'; +import { scheduleBodySchemaV1 } from '../../../../../common/routes/backfill/apis/schedule'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { transformRequestV1, transformResponseV1 } from './transforms'; export const scheduleBackfillRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/transforms/transform_request/v1.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/transforms/transform_request/v1.ts index 170d85c4f862b..6cecb4541f879 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/transforms/transform_request/v1.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/transforms/transform_request/v1.ts @@ -6,8 +6,8 @@ */ /* eslint-disable @typescript-eslint/naming-convention */ -import { ScheduleBackfillRequestBodyV1 } from '../../../../../../../common/routes/backfill/apis/schedule'; -import { ScheduleBackfillParams } from '../../../../../../application/backfill/methods/schedule/types'; +import type { ScheduleBackfillRequestBodyV1 } from '../../../../../../../common/routes/backfill/apis/schedule'; +import type { ScheduleBackfillParams } from '../../../../../../application/backfill/methods/schedule/types'; export const transformRequest = (request: ScheduleBackfillRequestBodyV1): ScheduleBackfillParams => request.map(({ rule_id, start, end }) => ({ ruleId: rule_id, start, end })); diff --git a/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/transforms/transform_response/v1.ts b/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/transforms/transform_response/v1.ts index 697169277e75f..f2845ebaaaa9c 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/transforms/transform_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/apis/schedule/transforms/transform_response/v1.ts @@ -11,7 +11,7 @@ import type { ScheduleBackfillResult, ScheduleBackfillResults, } from '../../../../../../application/backfill/methods/schedule/types'; -import { ScheduleBackfillResponseBodyV1 } from '../../../../../../../common/routes/backfill/apis/schedule'; +import type { ScheduleBackfillResponseBodyV1 } from '../../../../../../../common/routes/backfill/apis/schedule'; import { transformBackfillToBackfillResponseV1 } from '../../../../transforms'; export const transformResponse = ( diff --git a/x-pack/plugins/alerting/server/routes/backfill/transforms/transform_backfill_to_backfill_response/v1.test.ts b/x-pack/plugins/alerting/server/routes/backfill/transforms/transform_backfill_to_backfill_response/v1.test.ts index 88582bea15b92..d66da8ae2e5c6 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/transforms/transform_backfill_to_backfill_response/v1.test.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/transforms/transform_backfill_to_backfill_response/v1.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Backfill } from '../../../../application/backfill/result/types'; +import type { Backfill } from '../../../../application/backfill/result/types'; import { transformBackfillToBackfillResponse } from './v1'; describe('transformBackfillToBackfillResponse', () => { diff --git a/x-pack/plugins/alerting/server/routes/backfill/transforms/transform_backfill_to_backfill_response/v1.ts b/x-pack/plugins/alerting/server/routes/backfill/transforms/transform_backfill_to_backfill_response/v1.ts index c1c0a3aa53cd1..3f8d264b0fc13 100644 --- a/x-pack/plugins/alerting/server/routes/backfill/transforms/transform_backfill_to_backfill_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/backfill/transforms/transform_backfill_to_backfill_response/v1.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Backfill } from '../../../../application/backfill/result/types'; +import type { Backfill } from '../../../../application/backfill/result/types'; export const transformBackfillToBackfillResponse = (backfill: Backfill) => { const { createdAt, rule, spaceId, schedule, ...rest } = backfill; diff --git a/x-pack/plugins/alerting/server/routes/framework/apis/health/health.test.ts b/x-pack/plugins/alerting/server/routes/framework/apis/health/health.test.ts index f726073ed0844..55bb4ef375851 100644 --- a/x-pack/plugins/alerting/server/routes/framework/apis/health/health.test.ts +++ b/x-pack/plugins/alerting/server/routes/framework/apis/health/health.test.ts @@ -15,7 +15,7 @@ import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/s import { rulesClientMock } from '../../../../rules_client.mock'; import { alertsMock } from '../../../../mocks'; import { RecoveredActionGroup } from '../../../../../common'; -import { RegistryAlertTypeWithAuth } from '../../../../authorization'; +import type { RegistryAlertTypeWithAuth } from '../../../../authorization'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/framework/apis/health/health.ts b/x-pack/plugins/alerting/server/routes/framework/apis/health/health.ts index 34ef56a51daaa..a3e04993823da 100644 --- a/x-pack/plugins/alerting/server/routes/framework/apis/health/health.ts +++ b/x-pack/plugins/alerting/server/routes/framework/apis/health/health.ts @@ -5,16 +5,13 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { IRouter } from '@kbn/core/server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { healthFrameworkResponseSchemaV1 } from '../../../../../common/routes/framework/apis/health'; -import { ILicenseState } from '../../../../lib'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - BASE_ALERTING_API_PATH, - AlertingFrameworkHealth, -} from '../../../../types'; +import type { AlertingRequestHandlerContext, AlertingFrameworkHealth } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; import { getSecurityHealth } from '../../../../lib/get_security_health'; import { transformHealthBodyResponse } from './transforms/transform_health_response/v1'; diff --git a/x-pack/plugins/alerting/server/routes/framework/apis/health/transforms/transform_health_response/v1.ts b/x-pack/plugins/alerting/server/routes/framework/apis/health/transforms/transform_health_response/v1.ts index 76c4a46aee5d1..cf9ea5adeea7a 100644 --- a/x-pack/plugins/alerting/server/routes/framework/apis/health/transforms/transform_health_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/framework/apis/health/transforms/transform_health_response/v1.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AlertingFrameworkHealth } from '../../../../../../types'; +import type { AlertingFrameworkHealth } from '../../../../../../types'; import type { HealthFrameworkResponseBodyV1 } from '../../../../../../../common/routes/framework/apis/health'; export const transformHealthBodyResponse = ( diff --git a/x-pack/plugins/alerting/server/routes/get_action_error_log.ts b/x-pack/plugins/alerting/server/routes/get_action_error_log.ts index 5da2189c1d43d..685e7fa783fb9 100644 --- a/x-pack/plugins/alerting/server/routes/get_action_error_log.ts +++ b/x-pack/plugins/alerting/server/routes/get_action_error_log.ts @@ -5,12 +5,14 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { schema } from '@kbn/config-schema'; -import { ILicenseState } from '../lib'; -import { GetActionErrorLogByIdParams } from '../rules_client'; -import { RewriteRequestCase, verifyAccessAndContext } from './lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../types'; +import type { ILicenseState } from '../lib'; +import type { GetActionErrorLogByIdParams } from '../rules_client'; +import type { RewriteRequestCase } from './lib'; +import { verifyAccessAndContext } from './lib'; +import type { AlertingRequestHandlerContext } from '../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../types'; const paramSchema = schema.object({ id: schema.string(), diff --git a/x-pack/plugins/alerting/server/routes/get_flapping_settings.test.ts b/x-pack/plugins/alerting/server/routes/get_flapping_settings.test.ts index 9ab3c5b41ec80..930b115a7ae4e 100644 --- a/x-pack/plugins/alerting/server/routes/get_flapping_settings.test.ts +++ b/x-pack/plugins/alerting/server/routes/get_flapping_settings.test.ts @@ -8,10 +8,8 @@ import { httpServiceMock } from '@kbn/core/server/mocks'; import { licenseStateMock } from '../lib/license_state.mock'; import { mockHandlerArguments } from './_mock_handler_arguments'; -import { - rulesSettingsClientMock, - RulesSettingsClientMock, -} from '../rules_settings/rules_settings_client.mock'; +import type { RulesSettingsClientMock } from '../rules_settings/rules_settings_client.mock'; +import { rulesSettingsClientMock } from '../rules_settings/rules_settings_client.mock'; import { getFlappingSettingsRoute } from './get_flapping_settings'; let rulesSettingsClient: RulesSettingsClientMock; diff --git a/x-pack/plugins/alerting/server/routes/get_flapping_settings.ts b/x-pack/plugins/alerting/server/routes/get_flapping_settings.ts index a8638c32e5a5c..b68929f149bba 100644 --- a/x-pack/plugins/alerting/server/routes/get_flapping_settings.ts +++ b/x-pack/plugins/alerting/server/routes/get_flapping_settings.ts @@ -5,11 +5,14 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../types'; -import { verifyAccessAndContext, RewriteResponseCase } from './lib'; -import { API_PRIVILEGES, RulesSettingsFlapping } from '../../common'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../lib'; +import type { AlertingRequestHandlerContext } from '../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../types'; +import type { RewriteResponseCase } from './lib'; +import { verifyAccessAndContext } from './lib'; +import type { RulesSettingsFlapping } from '../../common'; +import { API_PRIVILEGES } from '../../common'; const rewriteBodyRes: RewriteResponseCase = ({ lookBackWindow, diff --git a/x-pack/plugins/alerting/server/routes/get_global_execution_kpi.ts b/x-pack/plugins/alerting/server/routes/get_global_execution_kpi.ts index 795b473dc8c66..c444cd6a12f80 100644 --- a/x-pack/plugins/alerting/server/routes/get_global_execution_kpi.ts +++ b/x-pack/plugins/alerting/server/routes/get_global_execution_kpi.ts @@ -4,12 +4,14 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { schema } from '@kbn/config-schema'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../types'; -import { RewriteRequestCase, verifyAccessAndContext, rewriteNamespaces } from './lib'; -import { GetGlobalExecutionKPIParams } from '../rules_client'; -import { ILicenseState } from '../lib'; +import type { AlertingRequestHandlerContext } from '../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../types'; +import type { RewriteRequestCase } from './lib'; +import { verifyAccessAndContext, rewriteNamespaces } from './lib'; +import type { GetGlobalExecutionKPIParams } from '../rules_client'; +import type { ILicenseState } from '../lib'; const querySchema = schema.object({ date_start: schema.string(), diff --git a/x-pack/plugins/alerting/server/routes/get_global_execution_logs.test.ts b/x-pack/plugins/alerting/server/routes/get_global_execution_logs.test.ts index f6e1c3417a42f..2c16d3e2c9e8f 100644 --- a/x-pack/plugins/alerting/server/routes/get_global_execution_logs.test.ts +++ b/x-pack/plugins/alerting/server/routes/get_global_execution_logs.test.ts @@ -10,7 +10,7 @@ import { httpServiceMock } from '@kbn/core/server/mocks'; import { licenseStateMock } from '../lib/license_state.mock'; import { mockHandlerArguments } from './_mock_handler_arguments'; import { rulesClientMock } from '../rules_client.mock'; -import { IExecutionLogResult } from '../../common'; +import type { IExecutionLogResult } from '../../common'; const rulesClient = rulesClientMock.create(); jest.mock('../lib/license_api_access', () => ({ diff --git a/x-pack/plugins/alerting/server/routes/get_global_execution_logs.ts b/x-pack/plugins/alerting/server/routes/get_global_execution_logs.ts index 9c9e09e81bd45..9e3321a2ddc41 100644 --- a/x-pack/plugins/alerting/server/routes/get_global_execution_logs.ts +++ b/x-pack/plugins/alerting/server/routes/get_global_execution_logs.ts @@ -5,12 +5,14 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { schema } from '@kbn/config-schema'; -import { ILicenseState } from '../lib'; -import { GetGlobalExecutionLogParams } from '../rules_client'; -import { RewriteRequestCase, verifyAccessAndContext, rewriteNamespaces } from './lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../types'; +import type { ILicenseState } from '../lib'; +import type { GetGlobalExecutionLogParams } from '../rules_client'; +import type { RewriteRequestCase } from './lib'; +import { verifyAccessAndContext, rewriteNamespaces } from './lib'; +import type { AlertingRequestHandlerContext } from '../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../types'; const sortOrderSchema = schema.oneOf([schema.literal('asc'), schema.literal('desc')]); diff --git a/x-pack/plugins/alerting/server/routes/get_rule_alert_summary.test.ts b/x-pack/plugins/alerting/server/routes/get_rule_alert_summary.test.ts index 319de59a01bfd..cf799713deca6 100644 --- a/x-pack/plugins/alerting/server/routes/get_rule_alert_summary.test.ts +++ b/x-pack/plugins/alerting/server/routes/get_rule_alert_summary.test.ts @@ -11,7 +11,7 @@ import { licenseStateMock } from '../lib/license_state.mock'; import { mockHandlerArguments } from './_mock_handler_arguments'; import { SavedObjectsErrorHelpers } from '@kbn/core/server'; import { rulesClientMock } from '../rules_client.mock'; -import { AlertSummary } from '../types'; +import type { AlertSummary } from '../types'; import { RULE_SAVED_OBJECT_TYPE } from '../saved_objects'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/get_rule_alert_summary.ts b/x-pack/plugins/alerting/server/routes/get_rule_alert_summary.ts index 7eaf5d4645ecb..7218bc26b905f 100644 --- a/x-pack/plugins/alerting/server/routes/get_rule_alert_summary.ts +++ b/x-pack/plugins/alerting/server/routes/get_rule_alert_summary.ts @@ -5,16 +5,14 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { schema } from '@kbn/config-schema'; -import { ILicenseState } from '../lib'; -import { GetAlertSummaryParams } from '../rules_client'; -import { RewriteRequestCase, RewriteResponseCase, verifyAccessAndContext } from './lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_BASE_ALERTING_API_PATH, - AlertSummary, -} from '../types'; +import type { ILicenseState } from '../lib'; +import type { GetAlertSummaryParams } from '../rules_client'; +import type { RewriteRequestCase, RewriteResponseCase } from './lib'; +import { verifyAccessAndContext } from './lib'; +import type { AlertingRequestHandlerContext, AlertSummary } from '../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../types'; const paramSchema = schema.object({ id: schema.string(), diff --git a/x-pack/plugins/alerting/server/routes/get_rule_execution_kpi.ts b/x-pack/plugins/alerting/server/routes/get_rule_execution_kpi.ts index af15520d3c32f..7228ecd87e62e 100644 --- a/x-pack/plugins/alerting/server/routes/get_rule_execution_kpi.ts +++ b/x-pack/plugins/alerting/server/routes/get_rule_execution_kpi.ts @@ -4,12 +4,14 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { schema } from '@kbn/config-schema'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../types'; -import { RewriteRequestCase, verifyAccessAndContext } from './lib'; -import { GetRuleExecutionKPIParams } from '../rules_client'; -import { ILicenseState } from '../lib'; +import type { AlertingRequestHandlerContext } from '../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../types'; +import type { RewriteRequestCase } from './lib'; +import { verifyAccessAndContext } from './lib'; +import type { GetRuleExecutionKPIParams } from '../rules_client'; +import type { ILicenseState } from '../lib'; const paramSchema = schema.object({ id: schema.string(), diff --git a/x-pack/plugins/alerting/server/routes/get_rule_execution_log.test.ts b/x-pack/plugins/alerting/server/routes/get_rule_execution_log.test.ts index 3b1f950fb45c6..97b8740569938 100644 --- a/x-pack/plugins/alerting/server/routes/get_rule_execution_log.test.ts +++ b/x-pack/plugins/alerting/server/routes/get_rule_execution_log.test.ts @@ -11,7 +11,7 @@ import { licenseStateMock } from '../lib/license_state.mock'; import { mockHandlerArguments } from './_mock_handler_arguments'; import { SavedObjectsErrorHelpers } from '@kbn/core/server'; import { rulesClientMock } from '../rules_client.mock'; -import { IExecutionLogResult } from '../../common'; +import type { IExecutionLogResult } from '../../common'; const rulesClient = rulesClientMock.create(); jest.mock('../lib/license_api_access', () => ({ diff --git a/x-pack/plugins/alerting/server/routes/get_rule_execution_log.ts b/x-pack/plugins/alerting/server/routes/get_rule_execution_log.ts index 619bc82bd6378..d085418b43f3e 100644 --- a/x-pack/plugins/alerting/server/routes/get_rule_execution_log.ts +++ b/x-pack/plugins/alerting/server/routes/get_rule_execution_log.ts @@ -5,12 +5,14 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { schema } from '@kbn/config-schema'; -import { ILicenseState } from '../lib'; -import { GetExecutionLogByIdParams } from '../rules_client'; -import { RewriteRequestCase, verifyAccessAndContext } from './lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../types'; +import type { ILicenseState } from '../lib'; +import type { GetExecutionLogByIdParams } from '../rules_client'; +import type { RewriteRequestCase } from './lib'; +import { verifyAccessAndContext } from './lib'; +import type { AlertingRequestHandlerContext } from '../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../types'; const paramSchema = schema.object({ id: schema.string(), diff --git a/x-pack/plugins/alerting/server/routes/get_rule_state.ts b/x-pack/plugins/alerting/server/routes/get_rule_state.ts index 7530f1d4964cd..d801be36960e9 100644 --- a/x-pack/plugins/alerting/server/routes/get_rule_state.ts +++ b/x-pack/plugins/alerting/server/routes/get_rule_state.ts @@ -5,15 +5,13 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { schema } from '@kbn/config-schema'; -import { ILicenseState } from '../lib'; -import { RewriteResponseCase, verifyAccessAndContext } from './lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_BASE_ALERTING_API_PATH, - RuleTaskState, -} from '../types'; +import type { ILicenseState } from '../lib'; +import type { RewriteResponseCase } from './lib'; +import { verifyAccessAndContext } from './lib'; +import type { AlertingRequestHandlerContext, RuleTaskState } from '../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../types'; const paramSchema = schema.object({ id: schema.string(), diff --git a/x-pack/plugins/alerting/server/routes/index.ts b/x-pack/plugins/alerting/server/routes/index.ts index 1a274692cefe4..d500c1c8f8b1b 100644 --- a/x-pack/plugins/alerting/server/routes/index.ts +++ b/x-pack/plugins/alerting/server/routes/index.ts @@ -5,14 +5,14 @@ * 2.0. */ -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 { IRouter } from '@kbn/core/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import type { ConfigSchema } from '@kbn/unified-search-plugin/server/config'; -import { Observable } from 'rxjs'; -import { GetAlertIndicesAlias, ILicenseState } from '../lib'; +import type { Observable } from 'rxjs'; +import type { GetAlertIndicesAlias, ILicenseState } from '../lib'; import { defineLegacyRoutes } from './legacy'; -import { AlertingRequestHandlerContext } from '../types'; +import type { AlertingRequestHandlerContext } from '../types'; import { createRuleRoute } from './rule/apis/create'; import { getRuleRoute, getInternalRuleRoute } from './rule/apis/get/get_rule_route'; import { updateRuleRoute } from './rule/apis/update/update_rule_route'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/create.test.ts b/x-pack/plugins/alerting/server/routes/legacy/create.test.ts index 52917ad5f3023..1df407b10f01c 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/create.test.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/create.test.ts @@ -12,7 +12,7 @@ import { licenseStateMock } from '../../lib/license_state.mock'; import { verifyApiAccess } from '../../lib/license_api_access'; import { mockHandlerArguments } from '../_mock_handler_arguments'; import { rulesClientMock } from '../../rules_client.mock'; -import { Rule, RuleSystemAction } from '../../../common/rule'; +import type { Rule, RuleSystemAction } from '../../../common/rule'; import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/create.ts b/x-pack/plugins/alerting/server/routes/legacy/create.ts index 333877b7df49e..07cc4b17abe10 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/create.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/create.ts @@ -9,15 +9,10 @@ import { schema } from '@kbn/config-schema'; import { verifyApiAccess } from '../../lib/license_api_access'; import { validateDurationSchema } from '../../lib'; import { handleDisabledApiKeysError } from '../lib/error_handler'; -import { - SanitizedRule, - RuleNotifyWhenType, - RuleTypeParams, - LEGACY_BASE_ALERT_API_PATH, - validateNotifyWhenType, -} from '../../types'; +import type { SanitizedRule, RuleNotifyWhenType, RuleTypeParams } from '../../types'; +import { LEGACY_BASE_ALERT_API_PATH, validateNotifyWhenType } from '../../types'; import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { RouteOptions } from '..'; +import type { RouteOptions } from '..'; import { countUsageOfPredefinedIds } from '../lib'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/delete.ts b/x-pack/plugins/alerting/server/routes/legacy/delete.ts index 2b63de9e4ee73..428629199e73f 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/delete.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/delete.ts @@ -6,9 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/disable.ts b/x-pack/plugins/alerting/server/routes/legacy/disable.ts index 0c6f3cf062a0c..58fe59fa01ff0 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/disable.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/disable.ts @@ -6,9 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/enable.ts b/x-pack/plugins/alerting/server/routes/legacy/enable.ts index d52eaa784f670..ca5782cb20a7d 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/enable.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/enable.ts @@ -6,9 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { handleDisabledApiKeysError } from '../lib/error_handler'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/find.ts b/x-pack/plugins/alerting/server/routes/legacy/find.ts index fa309ae51f2e4..7d1b84e14ee11 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/find.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/find.ts @@ -6,16 +6,16 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { estypes } from '@elastic/elasticsearch'; -import { KueryNode } from '@kbn/es-query'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { estypes } from '@elastic/elasticsearch'; +import type { KueryNode } from '@kbn/es-query'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { renameKeys } from '../lib/rename_keys'; -import { IndexType } from '../../rules_client'; +import type { IndexType } from '../../rules_client'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; import { trackLegacyTerminology } from '../lib/track_legacy_terminology'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/get.test.ts b/x-pack/plugins/alerting/server/routes/legacy/get.test.ts index f27210c773878..0402a6b6f1505 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/get.test.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/get.test.ts @@ -12,7 +12,7 @@ import { licenseStateMock } from '../../lib/license_state.mock'; import { verifyApiAccess } from '../../lib/license_api_access'; import { mockHandlerArguments } from '../_mock_handler_arguments'; import { rulesClientMock } from '../../rules_client.mock'; -import { Rule, RuleSystemAction } from '../../../common'; +import type { Rule, RuleSystemAction } from '../../../common'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/legacy/get.ts b/x-pack/plugins/alerting/server/routes/legacy/get.ts index e5eff52bf02d6..3ec904a3c862e 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/get.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/get.ts @@ -6,8 +6,8 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { ILicenseState } from '../../lib/license_state'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import type { AlertingRouter } from '../../types'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.test.ts b/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.test.ts index 4ecc085c3bb40..e6318b658736e 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.test.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.test.ts @@ -11,7 +11,7 @@ import { licenseStateMock } from '../../lib/license_state.mock'; import { mockHandlerArguments } from '../_mock_handler_arguments'; import { SavedObjectsErrorHelpers } from '@kbn/core/server'; import { rulesClientMock } from '../../rules_client.mock'; -import { AlertSummary } from '../../types'; +import type { AlertSummary } from '../../types'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts b/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts index 58a75dd68dce7..c7d56963ea8d3 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts @@ -6,11 +6,12 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; -import { AlertSummary, LEGACY_BASE_ALERT_API_PATH } from '../../../common'; +import type { AlertSummary } from '../../../common'; +import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; const paramSchema = schema.object({ diff --git a/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts b/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts index e952ef8719667..953ea16afa2fa 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts @@ -6,9 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/health.test.ts b/x-pack/plugins/alerting/server/routes/legacy/health.test.ts index 6c0b3ae6f67a4..3a0bf82f13875 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/health.test.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/health.test.ts @@ -15,7 +15,7 @@ import { rulesClientMock } from '../../rules_client.mock'; import { RecoveredActionGroup } from '../../types'; import { alertsMock } from '../../mocks'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { RegistryAlertTypeWithAuth } from '../../authorization'; +import type { RegistryAlertTypeWithAuth } from '../../authorization'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/legacy/health.ts b/x-pack/plugins/alerting/server/routes/legacy/health.ts index 8f67767941fd2..5eceb48845993 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/health.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/health.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; -import { AlertingFrameworkHealth } from '../../types'; +import type { AlertingFrameworkHealth } from '../../types'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; import { getSecurityHealth } from '../../lib/get_security_health'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/index.ts b/x-pack/plugins/alerting/server/routes/legacy/index.ts index 99220106d5ac1..2a8b3759ed62c 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/index.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/index.ts @@ -21,7 +21,7 @@ import { unmuteAlertInstanceRoute } from './unmute_instance'; import { muteAllAlertRoute } from './mute_all'; import { unmuteAllAlertRoute } from './unmute_all'; import { healthRoute } from './health'; -import { RouteOptions } from '..'; +import type { RouteOptions } from '..'; export function defineLegacyRoutes(opts: RouteOptions) { const { router, licenseState, encryptedSavedObjects, usageCounter, isServerless } = opts; diff --git a/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.test.ts b/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.test.ts index 80298f7fd288e..a799b885ed73a 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.test.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.test.ts @@ -13,7 +13,7 @@ import { verifyApiAccess } from '../../lib/license_api_access'; import { mockHandlerArguments } from '../_mock_handler_arguments'; import { rulesClientMock } from '../../rules_client.mock'; import { RecoveredActionGroup } from '../../../common'; -import { RegistryAlertTypeWithAuth } from '../../authorization'; +import type { RegistryAlertTypeWithAuth } from '../../authorization'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts b/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts index 35d6a7efeeee3..abf64c4b2559e 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts @@ -4,9 +4,9 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts b/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts index 5c4fc1542ef5b..acd5833a2825e 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts @@ -6,9 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts b/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts index ab0b52d41de29..daa1d85bb8bbb 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts @@ -6,13 +6,13 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { renameKeys } from '../lib/rename_keys'; -import { MuteOptions } from '../../rules_client'; +import type { MuteOptions } from '../../rules_client'; import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts b/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts index 0681e7d2cf01e..e1885ce892611 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts @@ -6,9 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts b/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts index 1101a2b5092e7..53970be39d70b 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts @@ -6,9 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; diff --git a/x-pack/plugins/alerting/server/routes/legacy/update.test.ts b/x-pack/plugins/alerting/server/routes/legacy/update.test.ts index fc4a814c26a27..9cb3c9191b4d1 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/update.test.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/update.test.ts @@ -13,7 +13,8 @@ import { verifyApiAccess } from '../../lib/license_api_access'; import { mockHandlerArguments } from '../_mock_handler_arguments'; import { rulesClientMock } from '../../rules_client.mock'; import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { RuleNotifyWhen, SanitizedRule, RuleSystemAction } from '../../../common'; +import type { SanitizedRule, RuleSystemAction } from '../../../common'; +import { RuleNotifyWhen } from '../../../common'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/legacy/update.ts b/x-pack/plugins/alerting/server/routes/legacy/update.ts index 01adeb5c634dc..ea41f310cd5f6 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/update.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/update.ts @@ -6,19 +6,16 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { validateDurationSchema } from '../../lib'; import { handleDisabledApiKeysError } from '../lib/error_handler'; import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { - RuleNotifyWhenType, - LEGACY_BASE_ALERT_API_PATH, - validateNotifyWhenType, -} from '../../../common'; +import type { RuleNotifyWhenType } from '../../../common'; +import { LEGACY_BASE_ALERT_API_PATH, validateNotifyWhenType } from '../../../common'; const paramSchema = schema.object({ id: schema.string(), diff --git a/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts b/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts index 30c51d3cdcf5c..b2e3b8f4483b3 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts @@ -6,9 +6,9 @@ */ import { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; +import type { ILicenseState } from '../../lib/license_state'; import { verifyApiAccess } from '../../lib/license_api_access'; import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; import { handleDisabledApiKeysError } from '../lib/error_handler'; diff --git a/x-pack/plugins/alerting/server/routes/lib/count_usage_of_predefined_ids.ts b/x-pack/plugins/alerting/server/routes/lib/count_usage_of_predefined_ids.ts index 8955e321c3fe5..532148b0503ae 100644 --- a/x-pack/plugins/alerting/server/routes/lib/count_usage_of_predefined_ids.ts +++ b/x-pack/plugins/alerting/server/routes/lib/count_usage_of_predefined_ids.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; export interface CountUsageOfPredefinedIdsOptions { predefinedId?: string; diff --git a/x-pack/plugins/alerting/server/routes/lib/error_handler.ts b/x-pack/plugins/alerting/server/routes/lib/error_handler.ts index 7e8243e7d501c..1f6e7a3554c8a 100644 --- a/x-pack/plugins/alerting/server/routes/lib/error_handler.ts +++ b/x-pack/plugins/alerting/server/routes/lib/error_handler.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { RequestHandlerWrapper } from '@kbn/core/server'; +import type { RequestHandlerWrapper } from '@kbn/core/server'; export const handleDisabledApiKeysError: RequestHandlerWrapper = (handler) => { return async (context, request, response) => { diff --git a/x-pack/plugins/alerting/server/routes/lib/rewrite_actions.ts b/x-pack/plugins/alerting/server/routes/lib/rewrite_actions.ts index 00cd7cbd45c3f..04eab9d77a66b 100644 --- a/x-pack/plugins/alerting/server/routes/lib/rewrite_actions.ts +++ b/x-pack/plugins/alerting/server/routes/lib/rewrite_actions.ts @@ -4,10 +4,10 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { TypeOf } from '@kbn/config-schema/src/types/object_type'; +import type { TypeOf } from '@kbn/config-schema/src/types/object_type'; import { omit } from 'lodash'; -import { NormalizedAlertAction, NormalizedSystemAction } from '../../rules_client'; -import { actionsSchema, systemActionsSchema } from './actions_schema'; +import type { NormalizedAlertAction, NormalizedSystemAction } from '../../rules_client'; +import type { actionsSchema, systemActionsSchema } from './actions_schema'; export const rewriteActionsReq = ( actions: TypeOf diff --git a/x-pack/plugins/alerting/server/routes/lib/rewrite_maintenance_window.ts b/x-pack/plugins/alerting/server/routes/lib/rewrite_maintenance_window.ts index 54f29f4e34a3b..553605457c139 100644 --- a/x-pack/plugins/alerting/server/routes/lib/rewrite_maintenance_window.ts +++ b/x-pack/plugins/alerting/server/routes/lib/rewrite_maintenance_window.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RewriteResponseCase } from '.'; -import { MaintenanceWindow } from '../../../common'; +import type { RewriteResponseCase } from '.'; +import type { MaintenanceWindow } from '../../../common'; export const rewriteMaintenanceWindowRes: RewriteResponseCase = ({ expirationDate, diff --git a/x-pack/plugins/alerting/server/routes/lib/rewrite_request_case.ts b/x-pack/plugins/alerting/server/routes/lib/rewrite_request_case.ts index bd11ab9771ad2..74dae01b07769 100644 --- a/x-pack/plugins/alerting/server/routes/lib/rewrite_request_case.ts +++ b/x-pack/plugins/alerting/server/routes/lib/rewrite_request_case.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { JsonValue } from '@kbn/utility-types'; +import type { JsonValue } from '@kbn/utility-types'; type RenameAlertToRule = K extends `alertTypeId` ? `ruleTypeId` diff --git a/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.test.ts b/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.test.ts index 854d6cc4294a5..82770f59a3c3d 100644 --- a/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.test.ts +++ b/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.test.ts @@ -5,7 +5,7 @@ * 2.0. */ import { rewriteRule } from './rewrite_rule'; -import { RuleTypeParams, SanitizedRule } from '../../types'; +import type { RuleTypeParams, SanitizedRule } from '../../types'; import { isPlainObject } from 'lodash'; const DATE_2020 = new Date('1/1/2020'); diff --git a/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.ts b/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.ts index a95e477d55ae1..4ad7ef6922543 100644 --- a/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.ts +++ b/x-pack/plugins/alerting/server/routes/lib/rewrite_rule.ts @@ -6,7 +6,7 @@ */ import { omit } from 'lodash'; -import { RuleTypeParams, SanitizedRule, RuleLastRun } from '../../types'; +import type { RuleTypeParams, SanitizedRule, RuleLastRun } from '../../types'; export const rewriteRuleLastRun = (lastRun: RuleLastRun) => { const { outcomeMsg, outcomeOrder, alertsCount, ...rest } = lastRun; diff --git a/x-pack/plugins/alerting/server/routes/lib/track_legacy_terminology.ts b/x-pack/plugins/alerting/server/routes/lib/track_legacy_terminology.ts index c0c1fd155b7fd..2e013251c7390 100644 --- a/x-pack/plugins/alerting/server/routes/lib/track_legacy_terminology.ts +++ b/x-pack/plugins/alerting/server/routes/lib/track_legacy_terminology.ts @@ -5,7 +5,7 @@ * 2.0. */ import { flatten } from 'lodash'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; export const LEGACY_TERMS = ['alertTypeId', 'actionTypeId']; diff --git a/x-pack/plugins/alerting/server/routes/lib/validate_hours.ts b/x-pack/plugins/alerting/server/routes/lib/validate_hours.ts index 5c4fcd264ca04..aeed75d7584d2 100644 --- a/x-pack/plugins/alerting/server/routes/lib/validate_hours.ts +++ b/x-pack/plugins/alerting/server/routes/lib/validate_hours.ts @@ -9,5 +9,5 @@ export function validateHours(time: string) { if (/^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/.test(time)) { return; } - return 'string is not a valid time in HH:mm format ' + time; + return `string is not a valid time in HH:mm format ${time}`; } diff --git a/x-pack/plugins/alerting/server/routes/lib/validate_timezone.ts b/x-pack/plugins/alerting/server/routes/lib/validate_timezone.ts index 68b095f4378d0..7e58d32846295 100644 --- a/x-pack/plugins/alerting/server/routes/lib/validate_timezone.ts +++ b/x-pack/plugins/alerting/server/routes/lib/validate_timezone.ts @@ -11,5 +11,5 @@ export function validateTimezone(timezone: string) { if (moment.tz.names().includes(timezone)) { return; } - return 'string is not a valid timezone: ' + timezone; + return `string is not a valid timezone: ${timezone}`; } diff --git a/x-pack/plugins/alerting/server/routes/lib/verify_access_and_context.ts b/x-pack/plugins/alerting/server/routes/lib/verify_access_and_context.ts index 09930a4b59165..a06430f678ec3 100644 --- a/x-pack/plugins/alerting/server/routes/lib/verify_access_and_context.ts +++ b/x-pack/plugins/alerting/server/routes/lib/verify_access_and_context.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { RequestHandler } from '@kbn/core/server'; -import { ILicenseState, isErrorThatHandlesItsOwnResponse, verifyApiAccess } from '../../lib'; -import { AlertingRequestHandlerContext } from '../../types'; +import type { RequestHandler } from '@kbn/core/server'; +import type { ILicenseState } from '../../lib'; +import { isErrorThatHandlesItsOwnResponse, verifyApiAccess } from '../../lib'; +import type { AlertingRequestHandlerContext } from '../../types'; type AlertingRequestHandlerWrapper = ( licenseState: ILicenseState, diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/archive/archive_maintenance_window_route.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/archive/archive_maintenance_window_route.ts index b4ac718489103..623efe3224bfc 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/archive/archive_maintenance_window_route.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/archive/archive_maintenance_window_route.ts @@ -5,22 +5,22 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH, -} from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH } from '../../../../types'; import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common'; -import { MaintenanceWindow } from '../../../../application/maintenance_window/types'; -import { - archiveBodySchemaV1, - archiveParamsSchemaV1, +import type { MaintenanceWindow } from '../../../../application/maintenance_window/types'; +import type { ArchiveMaintenanceWindowRequestBodyV1, ArchiveMaintenanceWindowRequestParamsV1, ArchiveMaintenanceWindowResponseV1, } from '../../../../../common/routes/maintenance_window/apis/archive'; +import { + archiveBodySchemaV1, + archiveParamsSchemaV1, +} from '../../../../../common/routes/maintenance_window/apis/archive'; import { transformMaintenanceWindowToResponseV1 } from '../../transforms'; export const archiveMaintenanceWindowRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/bulk_get/bulk_get_maintenance_windows_route.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/bulk_get/bulk_get_maintenance_windows_route.ts index e4796a76639ac..da998c731771a 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/bulk_get/bulk_get_maintenance_windows_route.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/bulk_get/bulk_get_maintenance_windows_route.ts @@ -5,20 +5,18 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH, -} from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH } from '../../../../types'; import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common'; -import { BulkGetMaintenanceWindowsResult } from '../../../../application/maintenance_window/methods/bulk_get/types'; -import { - bulkGetBodySchemaV1, +import type { BulkGetMaintenanceWindowsResult } from '../../../../application/maintenance_window/methods/bulk_get/types'; +import type { BulkGetMaintenanceWindowsRequestBodyV1, BulkGetMaintenanceWindowsResponseV1, } from '../../../../../common/routes/maintenance_window/apis/bulk_get'; +import { bulkGetBodySchemaV1 } from '../../../../../common/routes/maintenance_window/apis/bulk_get'; import { transformBulkGetResultToResponseV1 } from './transforms'; export const bulkGetMaintenanceWindowRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/bulk_get/transforms/transform_bulk_get_response/v1.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/bulk_get/transforms/transform_bulk_get_response/v1.ts index 5e791e0d917e9..22b8ad99f1cbd 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/bulk_get/transforms/transform_bulk_get_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/bulk_get/transforms/transform_bulk_get_response/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { BulkGetMaintenanceWindowsResponseBodyV1 } from '../../../../../../../common/routes/maintenance_window/apis/bulk_get'; -import { BulkGetMaintenanceWindowsResult } from '../../../../../../application/maintenance_window/methods/bulk_get/types'; +import type { BulkGetMaintenanceWindowsResponseBodyV1 } from '../../../../../../../common/routes/maintenance_window/apis/bulk_get'; +import type { BulkGetMaintenanceWindowsResult } from '../../../../../../application/maintenance_window/methods/bulk_get/types'; import { transformMaintenanceWindowToResponseV1 } from '../../../../transforms'; export const transformBulkGetResultToResponse = ( diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/create_maintenance_window_route.test.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/create_maintenance_window_route.test.ts index 171734233c746..8a4376b4cd609 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/create_maintenance_window_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/create_maintenance_window_route.test.ts @@ -14,8 +14,8 @@ import { createMaintenanceWindowRoute } from './create_maintenance_window_route' import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/test_helpers'; import { MaintenanceWindowStatus } from '../../../../../common'; -import { MaintenanceWindow } from '../../../../application/maintenance_window/types'; -import { CreateMaintenanceWindowRequestBody } from '../../../../../common/routes/maintenance_window/apis/create'; +import type { MaintenanceWindow } from '../../../../application/maintenance_window/types'; +import type { CreateMaintenanceWindowRequestBody } from '../../../../../common/routes/maintenance_window/apis/create'; import { transformCreateBody } from './transforms'; import { transformMaintenanceWindowToResponse } from '../../transforms'; diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/create_maintenance_window_route.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/create_maintenance_window_route.ts index 652eb94126225..5767d090ae3c8 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/create_maintenance_window_route.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/create_maintenance_window_route.ts @@ -5,20 +5,18 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH, -} from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH } from '../../../../types'; import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common'; -import { MaintenanceWindow } from '../../../../application/maintenance_window/types'; -import { - createBodySchemaV1, +import type { MaintenanceWindow } from '../../../../application/maintenance_window/types'; +import type { CreateMaintenanceWindowRequestBodyV1, CreateMaintenanceWindowResponseV1, } from '../../../../../common/routes/maintenance_window/apis/create'; +import { createBodySchemaV1 } from '../../../../../common/routes/maintenance_window/apis/create'; import { transformCreateBodyV1 } from './transforms'; import { transformMaintenanceWindowToResponseV1 } from '../../transforms'; diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/transforms/transform_create_body/v1.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/transforms/transform_create_body/v1.ts index 6eaa77fc78624..0b0c35c8048bc 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/transforms/transform_create_body/v1.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/create/transforms/transform_create_body/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { CreateMaintenanceWindowRequestBodyV1 } from '../../../../../../../common/routes/maintenance_window/apis/create'; -import { CreateMaintenanceWindowParams } from '../../../../../../application/maintenance_window/methods/create/types'; +import type { CreateMaintenanceWindowRequestBodyV1 } from '../../../../../../../common/routes/maintenance_window/apis/create'; +import type { CreateMaintenanceWindowParams } from '../../../../../../application/maintenance_window/methods/create/types'; export const transformCreateBody = ( createBody: CreateMaintenanceWindowRequestBodyV1 diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/delete/delete_maintenance_window_route.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/delete/delete_maintenance_window_route.ts index 9d3facaf41f8b..2d844df07630f 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/delete/delete_maintenance_window_route.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/delete/delete_maintenance_window_route.ts @@ -5,19 +5,15 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH, -} from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH } from '../../../../types'; import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common'; -import { - deleteParamsSchemaV1, - DeleteMaintenanceWindowRequestParamsV1, -} from '../../../../../common/routes/maintenance_window/apis/delete'; +import type { DeleteMaintenanceWindowRequestParamsV1 } from '../../../../../common/routes/maintenance_window/apis/delete'; +import { deleteParamsSchemaV1 } from '../../../../../common/routes/maintenance_window/apis/delete'; export const deleteMaintenanceWindowRoute = ( router: IRouter, diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/find/find_maintenance_windows_route.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/find/find_maintenance_windows_route.ts index 1aa4653e3d8d3..959c6bb4ab196 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/find/find_maintenance_windows_route.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/find/find_maintenance_windows_route.ts @@ -5,13 +5,11 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH, -} from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH } from '../../../../types'; import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common'; import type { FindMaintenanceWindowsResult } from '../../../../application/maintenance_window/methods/find/types'; import type { FindMaintenanceWindowsResponseV1 } from '../../../../../common/routes/maintenance_window/apis/find'; diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/find/transforms/transform_find_maintenance_window_params/v1.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/find/transforms/transform_find_maintenance_window_params/v1.ts index c59f5d189716e..4a6e0a06d676e 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/find/transforms/transform_find_maintenance_window_params/v1.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/find/transforms/transform_find_maintenance_window_params/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { FindMaintenanceWindowsRequestQuery } from '../../../../../../../common/routes/maintenance_window/apis/find'; -import { FindMaintenanceWindowsParams } from '../../../../../../application/maintenance_window/methods/find/types'; +import type { FindMaintenanceWindowsRequestQuery } from '../../../../../../../common/routes/maintenance_window/apis/find'; +import type { FindMaintenanceWindowsParams } from '../../../../../../application/maintenance_window/methods/find/types'; export const transformFindMaintenanceWindowParams = ( params: FindMaintenanceWindowsRequestQuery diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/finish/finish_maintenance_window_route.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/finish/finish_maintenance_window_route.ts index 73b5834afd278..6ca2a5af6980f 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/finish/finish_maintenance_window_route.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/finish/finish_maintenance_window_route.ts @@ -5,19 +5,17 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH, -} from '../../../../types'; -import { MaintenanceWindow } from '../../../../application/maintenance_window/types'; -import { - finishParamsSchemaV1, +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH } from '../../../../types'; +import type { MaintenanceWindow } from '../../../../application/maintenance_window/types'; +import type { FinishMaintenanceWindowRequestParamsV1, FinishMaintenanceWindowResponseV1, } from '../../../../../common/routes/maintenance_window/apis/finish'; +import { finishParamsSchemaV1 } from '../../../../../common/routes/maintenance_window/apis/finish'; import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common'; import { transformMaintenanceWindowToResponseV1 } from '../../transforms'; diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/get/get_maintenance_window_route.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/get/get_maintenance_window_route.ts index 155dc70c2843e..60de327c48a8d 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/get/get_maintenance_window_route.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/get/get_maintenance_window_route.ts @@ -5,20 +5,18 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH, -} from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH } from '../../../../types'; import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common'; -import { MaintenanceWindow } from '../../../../application/maintenance_window/types'; -import { - getParamsSchemaV1, +import type { MaintenanceWindow } from '../../../../application/maintenance_window/types'; +import type { GetMaintenanceWindowRequestParamsV1, GetMaintenanceWindowResponseV1, } from '../../../../../common/routes/maintenance_window/apis/get'; +import { getParamsSchemaV1 } from '../../../../../common/routes/maintenance_window/apis/get'; import { transformMaintenanceWindowToResponseV1 } from '../../transforms'; export const getMaintenanceWindowRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/get_active/get_active_maintenance_windows_route.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/get_active/get_active_maintenance_windows_route.ts index 4b487babb0e0d..e1e010dbd2f9a 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/get_active/get_active_maintenance_windows_route.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/get_active/get_active_maintenance_windows_route.ts @@ -5,17 +5,15 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_API_GET_ACTIVE_MAINTENANCE_WINDOWS_PATH, -} from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_API_GET_ACTIVE_MAINTENANCE_WINDOWS_PATH } from '../../../../types'; import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common'; -import { MaintenanceWindow } from '../../../../application/maintenance_window/types'; -import { GetActiveMaintenanceWindowsResponseV1 } from '../../../../../common/routes/maintenance_window/apis/get_active'; +import type { MaintenanceWindow } from '../../../../application/maintenance_window/types'; +import type { GetActiveMaintenanceWindowsResponseV1 } from '../../../../../common/routes/maintenance_window/apis/get_active'; import { transformMaintenanceWindowToResponseV1 } from '../../transforms'; export const getActiveMaintenanceWindowsRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/transforms/transform_update_body/v1.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/transforms/transform_update_body/v1.ts index 96c4e92d4934e..ca8d9f460e694 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/transforms/transform_update_body/v1.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/transforms/transform_update_body/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { UpdateMaintenanceWindowRequestBodyV1 } from '../../../../../../../common/routes/maintenance_window/apis/update'; -import { UpdateMaintenanceWindowParams } from '../../../../../../application/maintenance_window/methods/update/types'; +import type { UpdateMaintenanceWindowRequestBodyV1 } from '../../../../../../../common/routes/maintenance_window/apis/update'; +import type { UpdateMaintenanceWindowParams } from '../../../../../../application/maintenance_window/methods/update/types'; export const transformUpdateBody = ( updateBody: UpdateMaintenanceWindowRequestBodyV1 diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/update_maintenance_window_route.test.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/update_maintenance_window_route.test.ts index 194366c8b76d0..af83404f6affa 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/update_maintenance_window_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/update_maintenance_window_route.test.ts @@ -14,7 +14,7 @@ import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/te import { MaintenanceWindowStatus } from '../../../../../common'; import { transformUpdateBody } from './transforms'; import { rewritePartialMaintenanceBodyRes } from '../../../lib'; -import { UpdateMaintenanceWindowRequestBody } from '../../../../../common/routes/maintenance_window/apis/update'; +import type { UpdateMaintenanceWindowRequestBody } from '../../../../../common/routes/maintenance_window/apis/update'; const maintenanceWindowClient = maintenanceWindowClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/update_maintenance_window_route.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/update_maintenance_window_route.ts index 44fb680eabc42..bd028c2056a35 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/update_maintenance_window_route.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/apis/update/update_maintenance_window_route.ts @@ -5,22 +5,22 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH, -} from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH } from '../../../../types'; import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common'; -import { MaintenanceWindow } from '../../../../application/maintenance_window/types'; -import { - updateBodySchemaV1, - updateParamsSchemaV1, +import type { MaintenanceWindow } from '../../../../application/maintenance_window/types'; +import type { UpdateMaintenanceWindowRequestBodyV1, UpdateMaintenanceWindowRequestParamsV1, UpdateMaintenanceWindowResponseV1, } from '../../../../../common/routes/maintenance_window/apis/update'; +import { + updateBodySchemaV1, + updateParamsSchemaV1, +} from '../../../../../common/routes/maintenance_window/apis/update'; import { transformUpdateBodyV1 } from './transforms'; import { transformMaintenanceWindowToResponseV1 } from '../../transforms'; diff --git a/x-pack/plugins/alerting/server/routes/maintenance_window/transforms/transform_maintenance_window_to_response/v1.ts b/x-pack/plugins/alerting/server/routes/maintenance_window/transforms/transform_maintenance_window_to_response/v1.ts index 2d21576773c29..d1a4b4877d4e5 100644 --- a/x-pack/plugins/alerting/server/routes/maintenance_window/transforms/transform_maintenance_window_to_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/maintenance_window/transforms/transform_maintenance_window_to_response/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { MaintenanceWindowResponseV1 } from '../../../../../common/routes/maintenance_window/response'; -import { MaintenanceWindow } from '../../../../application/maintenance_window/types'; +import type { MaintenanceWindowResponseV1 } from '../../../../../common/routes/maintenance_window/response'; +import type { MaintenanceWindow } from '../../../../application/maintenance_window/types'; export const transformMaintenanceWindowToResponse = ( maintenanceWindow: MaintenanceWindow diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/aggregate_rules_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/aggregate_rules_route.ts index 9b595858793f8..161e0afc59187 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/aggregate_rules_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/aggregate_rules_route.ts @@ -5,22 +5,23 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { IRouter } from '@kbn/core/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import { defaultRuleAggregationFactoryV1 } from '../../../../application/rule/methods/aggregate'; -import { ILicenseState } from '../../../../lib'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { trackLegacyTerminology } from '../../../lib/track_legacy_terminology'; -import { - aggregateRulesRequestBodySchemaV1, +import type { AggregateRulesRequestBodyV1, AggregateRulesResponseV1, } from '../../../../../common/routes/rule/apis/aggregate'; +import { aggregateRulesRequestBodySchemaV1 } from '../../../../../common/routes/rule/apis/aggregate'; import { formatDefaultAggregationResult } from './transforms'; import { transformAggregateQueryRequestV1, transformAggregateBodyResponseV1 } from './transforms'; -import { DefaultRuleAggregationResult } from './types'; +import type { DefaultRuleAggregationResult } from './types'; export const aggregateRulesRoute = ( router: IRouter, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/format_default_aggregation_result/index.ts b/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/format_default_aggregation_result/index.ts index 1f8635e9351e6..def99b1f7ed7c 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/format_default_aggregation_result/index.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/format_default_aggregation_result/index.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { RuleAggregationFormattedResult } from '../../../../../../application/rule/methods/aggregate/types'; +import type { RuleAggregationFormattedResult } from '../../../../../../application/rule/methods/aggregate/types'; import { RuleExecutionStatusValues, RuleLastRunOutcomeValues } from '../../../../../../../common'; -import { DefaultRuleAggregationResult } from '../../types'; +import type { DefaultRuleAggregationResult } from '../../types'; export const formatDefaultAggregationResult = ( aggregations: DefaultRuleAggregationResult diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/transform_aggregate_body_response/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/transform_aggregate_body_response/v1.ts index 87bd99af3a665..edf914a687932 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/transform_aggregate_body_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/transform_aggregate_body_response/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RuleAggregationFormattedResult } from '../../../../../../application/rule/methods/aggregate/types'; -import { AggregateRulesResponseBodyV1 } from '../../../../../../../common/routes/rule/apis/aggregate'; +import type { RuleAggregationFormattedResult } from '../../../../../../application/rule/methods/aggregate/types'; +import type { AggregateRulesResponseBodyV1 } from '../../../../../../../common/routes/rule/apis/aggregate'; export const transformAggregateBodyResponse = ({ ruleExecutionStatus, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/transform_aggregate_query_request/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/transform_aggregate_query_request/v1.ts index baa6b9bb46f9c..19de9b31b7dcc 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/transform_aggregate_query_request/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/aggregate/transforms/transform_aggregate_query_request/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RewriteRequestCase } from '@kbn/actions-plugin/common'; -import { AggregateOptions } from '../../../../../../application/rule/methods/aggregate/types'; +import type { RewriteRequestCase } from '@kbn/actions-plugin/common'; +import type { AggregateOptions } from '../../../../../../application/rule/methods/aggregate/types'; export const transformAggregateQueryRequest: RewriteRequestCase = ({ search, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_delete/bulk_delete_rules_route.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_delete/bulk_delete_rules_route.test.ts index 90a13ba09a4cf..df715bf03d594 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_delete/bulk_delete_rules_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_delete/bulk_delete_rules_route.test.ts @@ -13,7 +13,7 @@ import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { rulesClientMock } from '../../../../rules_client.mock'; import { RuleTypeDisabledError } from '../../../../lib/errors/rule_type_disabled'; import { verifyApiAccess } from '../../../../lib/license_api_access'; -import { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; +import type { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_delete/bulk_delete_rules_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_delete/bulk_delete_rules_route.ts index 8bd6f7fc19916..83dbf13776a73 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_delete/bulk_delete_rules_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_delete/bulk_delete_rules_route.ts @@ -5,18 +5,20 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { verifyAccessAndContext, handleDisabledApiKeysError } from '../../../lib'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; -import { - bulkDeleteRulesRequestBodySchemaV1, +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { BulkDeleteRulesRequestBodyV1, BulkDeleteRulesResponseV1, } from '../../../../../common/routes/rule/apis/bulk_delete'; +import { bulkDeleteRulesRequestBodySchemaV1 } from '../../../../../common/routes/rule/apis/bulk_delete'; import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; import { transformRuleToRuleResponseV1 } from '../../transforms'; -import { Rule } from '../../../../application/rule/types'; +import type { Rule } from '../../../../application/rule/types'; export const bulkDeleteRulesRoute = ({ router, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_disable/bulk_disable_rules_route.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_disable/bulk_disable_rules_route.test.ts index 0dc0793118c23..76a570e020d44 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_disable/bulk_disable_rules_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_disable/bulk_disable_rules_route.test.ts @@ -14,7 +14,7 @@ import { rulesClientMock } from '../../../../rules_client.mock'; import { RuleTypeDisabledError } from '../../../../lib/errors/rule_type_disabled'; import { verifyApiAccess } from '../../../../lib/license_api_access'; import { actionsClientMock } from '@kbn/actions-plugin/server/mocks'; -import { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; +import type { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_disable/bulk_disable_rules_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_disable/bulk_disable_rules_route.ts index 724eda3ae7b87..077946ba7e023 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_disable/bulk_disable_rules_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_disable/bulk_disable_rules_route.ts @@ -5,18 +5,20 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { handleDisabledApiKeysError, verifyAccessAndContext } from '../../../lib'; -import { - bulkDisableRulesRequestBodySchemaV1, +import type { BulkDisableRulesRequestBodyV1, BulkDisableRulesResponseV1, } from '../../../../../common/routes/rule/apis/bulk_disable'; +import { bulkDisableRulesRequestBodySchemaV1 } from '../../../../../common/routes/rule/apis/bulk_disable'; import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; -import { Rule } from '../../../../application/rule/types'; +import type { Rule } from '../../../../application/rule/types'; import { transformRuleToRuleResponseV1 } from '../../transforms'; export const bulkDisableRulesRoute = ({ diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/bulk_edit_rules_route.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/bulk_edit_rules_route.test.ts index 295299db3a117..2ad62e422f0b3 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/bulk_edit_rules_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/bulk_edit_rules_route.test.ts @@ -13,7 +13,7 @@ import { verifyApiAccess } from '../../../../lib/license_api_access'; import { RuleTypeDisabledError } from '../../../../lib/errors/rule_type_disabled'; import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { rulesClientMock } from '../../../../rules_client.mock'; -import { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; +import type { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; import { actionsClientMock } from '@kbn/actions-plugin/server/mocks'; import { omit } from 'lodash'; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/bulk_edit_rules_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/bulk_edit_rules_route.ts index 4c853beeec250..8f9dcd09bc1ea 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/bulk_edit_rules_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/bulk_edit_rules_route.ts @@ -5,19 +5,21 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { handleDisabledApiKeysError, verifyAccessAndContext } from '../../../lib'; -import { - bulkEditRulesRequestBodySchemaV1, +import type { BulkEditRulesRequestBodyV1, BulkEditRulesResponseV1, } from '../../../../../common/routes/rule/apis/bulk_edit'; +import { bulkEditRulesRequestBodySchemaV1 } from '../../../../../common/routes/rule/apis/bulk_edit'; import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; -import { Rule } from '../../../../application/rule/types'; +import type { Rule } from '../../../../application/rule/types'; import { transformRuleToRuleResponseV1 } from '../../transforms'; import { validateRequiredGroupInDefaultActionsV1 } from '../../validation'; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/transforms/transform_operations/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/transforms/transform_operations/v1.ts index 844617ab2700f..138f53bee2d26 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/transforms/transform_operations/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_edit/transforms/transform_operations/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { BulkEditOperation } from '../../../../../../application/rule/methods/bulk_edit'; -import { BulkEditRulesRequestBodyV1 } from '../../../../../../../common/routes/rule/apis/bulk_edit'; +import type { BulkEditOperation } from '../../../../../../application/rule/methods/bulk_edit'; +import type { BulkEditRulesRequestBodyV1 } from '../../../../../../../common/routes/rule/apis/bulk_edit'; export const transformOperations = ({ operations, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/bulk_enable_rules_route.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/bulk_enable_rules_route.test.ts index 272d91997a9f5..bc7dcb7811622 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/bulk_enable_rules_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/bulk_enable_rules_route.test.ts @@ -8,14 +8,14 @@ import { httpServiceMock } from '@kbn/core/server/mocks'; import { actionsClientMock } from '@kbn/actions-plugin/server/mocks'; import { bulkEnableRulesRoute } from './bulk_enable_rules_route'; -import { BulkEnableRulesResult } from '../../../../application/rule/methods/bulk_enable'; +import type { BulkEnableRulesResult } from '../../../../application/rule/methods/bulk_enable'; import { licenseStateMock } from '../../../../lib/license_state.mock'; import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { rulesClientMock } from '../../../../rules_client.mock'; import { RuleTypeDisabledError } from '../../../../lib/errors/rule_type_disabled'; import { verifyApiAccess } from '../../../../lib/license_api_access'; -import { RuleAction, RuleSystemAction } from '../../../../types'; -import { Rule, RuleParams } from '../../../../application/rule/types'; +import type { RuleAction, RuleSystemAction } from '../../../../types'; +import type { Rule, RuleParams } from '../../../../application/rule/types'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/bulk_enable_rules_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/bulk_enable_rules_route.ts index da97949fd0feb..82f73334c251e 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/bulk_enable_rules_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/bulk_enable_rules_route.ts @@ -5,16 +5,18 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { verifyAccessAndContext, handleDisabledApiKeysError } from '../../../lib'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; -import { - bulkEnableBodySchemaV1, +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { BulkEnableRulesRequestBodyV1, BulkEnableRulesResponseV1, } from '../../../../../common/routes/rule/apis/bulk_enable'; -import { RuleParamsV1 } from '../../../../../common/routes/rule/response'; +import { bulkEnableBodySchemaV1 } from '../../../../../common/routes/rule/apis/bulk_enable'; +import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; import { transformBulkEnableResponseV1 } from './transforms'; export const bulkEnableRulesRoute = ({ diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/transforms/transform_bulk_enable_response/v1.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/transforms/transform_bulk_enable_response/v1.test.ts index a4acab93ba387..aa204c39e90ef 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/transforms/transform_bulk_enable_response/v1.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/transforms/transform_bulk_enable_response/v1.test.ts @@ -6,7 +6,7 @@ */ import { transformBulkEnableResponse } from './v1'; -import { RuleAction, RuleSystemAction } from '../../../../../../../common'; +import type { RuleAction, RuleSystemAction } from '../../../../../../../common'; describe('transformBulkEnableResponse', () => { const defaultAction: RuleAction = { diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/transforms/transform_bulk_enable_response/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/transforms/transform_bulk_enable_response/v1.ts index 5d0498f751be1..e88383a86fa93 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/transforms/transform_bulk_enable_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_enable/transforms/transform_bulk_enable_response/v1.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { BulkEnableRulesResponseV1 } from '../../../../../../../common/routes/rule/apis/bulk_enable'; -import { RuleParamsV1 } from '../../../../../../../common/routes/rule/response'; -import { BulkEnableRulesResult } from '../../../../../../application/rule/methods/bulk_enable/types'; +import type { BulkEnableRulesResponseV1 } from '../../../../../../../common/routes/rule/apis/bulk_enable'; +import type { RuleParamsV1 } from '../../../../../../../common/routes/rule/response'; +import type { BulkEnableRulesResult } from '../../../../../../application/rule/methods/bulk_enable/types'; import { transformRuleToRuleResponseV1 } from '../../../../transforms'; -import { Rule, RuleParams } from '../../../../../../application/rule/types'; +import type { Rule, RuleParams } from '../../../../../../application/rule/types'; export const transformBulkEnableResponse = ( response: BulkEnableRulesResult diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_untrack/bulk_untrack_alerts_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_untrack/bulk_untrack_alerts_route.ts index 622218705b510..90515eeb0ce5e 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_untrack/bulk_untrack_alerts_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_untrack/bulk_untrack_alerts_route.ts @@ -4,15 +4,15 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { - BulkUntrackRequestBodyV1, - bulkUntrackBodySchemaV1, -} from '../../../../../common/routes/rule/apis/bulk_untrack'; +import type { IRouter } from '@kbn/core/server'; +import type { BulkUntrackRequestBodyV1 } from '../../../../../common/routes/rule/apis/bulk_untrack'; +import { bulkUntrackBodySchemaV1 } from '../../../../../common/routes/rule/apis/bulk_untrack'; import { transformBulkUntrackAlertsBodyV1 } from './transforms'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; export const bulkUntrackAlertsRoute = ( router: IRouter, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_untrack_by_query/bulk_untrack_alerts_by_query_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_untrack_by_query/bulk_untrack_alerts_by_query_route.ts index 5cebdb8c6e7f4..80c4d80169925 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/bulk_untrack_by_query/bulk_untrack_alerts_by_query_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/bulk_untrack_by_query/bulk_untrack_alerts_by_query_route.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { - BulkUntrackByQueryRequestBodyV1, - bulkUntrackByQueryBodySchemaV1, -} from '../../../../../common/routes/rule/apis/bulk_untrack_by_query'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { BulkUntrackByQueryRequestBodyV1 } from '../../../../../common/routes/rule/apis/bulk_untrack_by_query'; +import { bulkUntrackByQueryBodySchemaV1 } from '../../../../../common/routes/rule/apis/bulk_untrack_by_query'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { transformBulkUntrackAlertsByQueryBodyV1 } from './transforms'; export const bulkUntrackAlertsByQueryRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/clone/clone_rule_route.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/clone/clone_rule_route.test.ts index 13c6a69087635..9529cb2fd5667 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/clone/clone_rule_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/clone/clone_rule_route.test.ts @@ -13,7 +13,7 @@ import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { rulesClientMock } from '../../../../rules_client.mock'; import { RuleTypeDisabledError } from '../../../../lib/errors/rule_type_disabled'; import { cloneRuleRoute } from './clone_rule_route'; -import { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; +import type { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; const rulesClient = rulesClientMock.create(); jest.mock('../../../../lib/license_api_access', () => ({ diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/clone/clone_rule_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/clone/clone_rule_route.ts index ea6460dfb9463..b2a21e7644a2b 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/clone/clone_rule_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/clone/clone_rule_route.ts @@ -5,17 +5,19 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; import { verifyAccessAndContext, handleDisabledApiKeysError } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; -import { - cloneRuleRequestParamsSchemaV1, +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { CloneRuleRequestParamsV1, CloneRuleResponseV1, } from '../../../../../common/routes/rule/apis/clone'; +import { cloneRuleRequestParamsSchemaV1 } from '../../../../../common/routes/rule/apis/clone'; import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; -import { Rule } from '../../../../application/rule/types'; +import type { Rule } from '../../../../application/rule/types'; import { transformRuleToRuleResponseV1 } from '../../transforms'; export const cloneRuleRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.test.ts index cab3956161613..9ce7dec7222a4 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.test.ts @@ -14,7 +14,7 @@ import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import type { CreateRuleRequestBodyV1 } from '../../../../../common/routes/rule/apis/create'; import { rulesClientMock } from '../../../../rules_client.mock'; import { RuleTypeDisabledError } from '../../../../lib'; -import { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; +import type { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; import { actionsClientMock } from '@kbn/actions-plugin/server/mocks'; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.ts index 45341fb48e9bd..bf5c01e208bea 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RouteOptions } from '../../..'; +import type { RouteOptions } from '../../..'; import type { CreateRuleRequestBodyV1, CreateRuleRequestParamsV1, @@ -15,8 +15,9 @@ import { createBodySchemaV1, createParamsSchemaV1, } from '../../../../../common/routes/rule/apis/create'; -import { RuleParamsV1, ruleResponseSchemaV1 } from '../../../../../common/routes/rule/response'; -import { Rule } from '../../../../application/rule/types'; +import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; +import { ruleResponseSchemaV1 } from '../../../../../common/routes/rule/response'; +import type { Rule } from '../../../../application/rule/types'; import { RuleTypeDisabledError } from '../../../../lib'; import { BASE_ALERTING_API_PATH } from '../../../../types'; import { diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/create/transforms/transform_create_body/v1.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/create/transforms/transform_create_body/v1.test.ts index fed6c30f043d9..e2639e5035a3d 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/create/transforms/transform_create_body/v1.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/create/transforms/transform_create_body/v1.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { +import type { CreateRuleAction, CreateRuleRequestBodyV1, } from '../../../../../../../common/routes/rule/apis/create'; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/delete/delete_rule_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/delete/delete_rule_route.ts index 0452de7f7becd..11080bd6881c5 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/delete/delete_rule_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/delete/delete_rule_route.ts @@ -5,14 +5,13 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { - deleteRuleRequestParamsSchemaV1, - DeleteRuleRequestParamsV1, -} from '../../../../../common/routes/rule/apis/delete'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; +import type { DeleteRuleRequestParamsV1 } from '../../../../../common/routes/rule/apis/delete'; +import { deleteRuleRequestParamsSchemaV1 } from '../../../../../common/routes/rule/apis/delete'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; export const deleteRuleRoute = ( router: IRouter, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/disable/disable_rule_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/disable/disable_rule_route.ts index cae82e80be869..9ec62f81ac7cd 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/disable/disable_rule_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/disable/disable_rule_route.ts @@ -5,15 +5,19 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { +import type { IRouter } from '@kbn/core/server'; +import type { DisableRuleRequestBodyV1, DisableRuleRequestParamsV1, +} from '../../../../../common/routes/rule/apis/disable'; +import { disableRuleRequestBodySchemaV1, disableRuleRequestParamsSchemaV1, } from '../../../../../common/routes/rule/apis/disable'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; import { verifyAccessAndContext } from '../../../lib'; export const disableRuleRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/enable/enable_rule_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/enable/enable_rule_route.ts index 4843ed932374d..f546394384aeb 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/enable/enable_rule_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/enable/enable_rule_route.ts @@ -5,15 +5,15 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; import { verifyAccessAndContext } from '../../../lib'; -import { - EnableRuleRequestParamsV1, - enableRuleRequestParamsSchemaV1, -} from '../../../../../common/routes/rule/apis/enable'; +import type { EnableRuleRequestParamsV1 } from '../../../../../common/routes/rule/apis/enable'; +import { enableRuleRequestParamsSchemaV1 } from '../../../../../common/routes/rule/apis/enable'; export const enableRuleRoute = ( router: IRouter, licenseState: ILicenseState diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/find/find_internal_rules_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/find/find_internal_rules_route.ts index 8ff8ce59192cf..38945445cf3b7 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/find/find_internal_rules_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/find/find_internal_rules_route.ts @@ -5,19 +5,17 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { IRouter } from '@kbn/core/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { FindRulesRequestQueryV1, FindRulesResponseV1, } from '../../../../../common/routes/rule/apis/find'; import { findRulesRequestQuerySchemaV1 } from '../../../../../common/routes/rule/apis/find'; -import { RuleParamsV1 } from '../../../../../common/routes/rule/response'; -import { ILicenseState } from '../../../../lib'; -import { - AlertingRequestHandlerContext, - INTERNAL_ALERTING_API_FIND_RULES_PATH, -} from '../../../../types'; +import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; +import type { ILicenseState } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_API_FIND_RULES_PATH } from '../../../../types'; import { verifyAccessAndContext } from '../../../lib'; import { trackLegacyTerminology } from '../../../lib/track_legacy_terminology'; import { transformFindRulesBodyV1, transformFindRulesResponseV1 } from './transforms'; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/find/find_rules_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/find/find_rules_route.ts index 90afde8f20813..05dfc9d4604ae 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/find/find_rules_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/find/find_rules_route.ts @@ -5,16 +5,18 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { IRouter } from '@kbn/core/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { FindRulesRequestQueryV1, FindRulesResponseV1, } from '../../../../../common/routes/rule/apis/find'; import { findRulesRequestQuerySchemaV1 } from '../../../../../common/routes/rule/apis/find'; -import { RuleParamsV1, ruleResponseSchemaV1 } from '../../../../../common/routes/rule/response'; -import { ILicenseState } from '../../../../lib'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; +import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; +import { ruleResponseSchemaV1 } from '../../../../../common/routes/rule/response'; +import type { ILicenseState } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; import { verifyAccessAndContext } from '../../../lib'; import { trackLegacyTerminology } from '../../../lib/track_legacy_terminology'; import { transformFindRulesBodyV1, transformFindRulesResponseV1 } from './transforms'; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/find/transforms/transform_find_rules_body/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/find/transforms/transform_find_rules_body/v1.ts index a2f9d3c99b00d..ecb5774f859f5 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/find/transforms/transform_find_rules_body/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/find/transforms/transform_find_rules_body/v1.ts @@ -6,7 +6,7 @@ */ import type { FindRulesRequestQueryV1 } from '../../../../../../../common/routes/rule/apis/find'; -import { FindRulesOptions } from '../../../../../../application/rule/methods/find'; +import type { FindRulesOptions } from '../../../../../../application/rule/methods/find'; export const transformFindRulesBody = (params: FindRulesRequestQueryV1): FindRulesOptions => { const { diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/find/transforms/transform_find_rules_response/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/find/transforms/transform_find_rules_response/v1.ts index e80ea1604cde1..80729ae13b6c0 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/find/transforms/transform_find_rules_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/find/transforms/transform_find_rules_response/v1.ts @@ -11,7 +11,7 @@ import type { RuleParamsV1, } from '../../../../../../../common/routes/rule/response'; import type { FindResult } from '../../../../../../application/rule/methods/find'; -import { Rule, RuleParams } from '../../../../../../application/rule/types'; +import type { Rule, RuleParams } from '../../../../../../application/rule/types'; import { transformRuleActionsV1, transformMonitoringV1, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/get/get_rule_route.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/get/get_rule_route.test.ts index a9ae97e521ef5..18e0df217612c 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/get/get_rule_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/get/get_rule_route.test.ts @@ -12,7 +12,7 @@ import { licenseStateMock } from '../../../../lib/license_state.mock'; import { verifyApiAccess } from '../../../../lib/license_api_access'; import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { rulesClientMock } from '../../../../rules_client.mock'; -import { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; +import type { RuleAction, RuleSystemAction, SanitizedRule } from '../../../../types'; const rulesClient = rulesClientMock.create(); jest.mock('../../../../lib/license_api_access', () => ({ diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/get/get_rule_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/get/get_rule_route.ts index 0c19d0c9c4f70..c687c0a6b70c0 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/get/get_rule_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/get/get_rule_route.ts @@ -5,16 +5,14 @@ * 2.0. */ -import { IRouter, RouteConfigOptions, RouteMethod } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter, RouteConfigOptions, RouteMethod } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { RuleParamsV1, ruleResponseSchemaV1 } from '../../../../../common/routes/rule/response'; -import { Rule } from '../../../../application/rule/types'; -import { - AlertingRequestHandlerContext, - BASE_ALERTING_API_PATH, - INTERNAL_BASE_ALERTING_API_PATH, -} from '../../../../types'; +import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; +import { ruleResponseSchemaV1 } from '../../../../../common/routes/rule/response'; +import type { Rule } from '../../../../application/rule/types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { transformRuleToRuleResponseV1 } from '../../transforms'; import type { diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/get_schedule_frequency/get_schedule_frequency_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/get_schedule_frequency/get_schedule_frequency_route.ts index e130679a78437..5bd0517c2ab2c 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/get_schedule_frequency/get_schedule_frequency_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/get_schedule_frequency/get_schedule_frequency_route.ts @@ -5,11 +5,12 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; -import { GetScheduleFrequencyResponseV1 } from '../../../../../common/routes/rule/apis/get_schedule_frequency'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { GetScheduleFrequencyResponseV1 } from '../../../../../common/routes/rule/apis/get_schedule_frequency'; import { transformGetScheduleFrequencyResultV1 } from './transforms'; export const getScheduleFrequencyRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/list_types/rule_types.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/list_types/rule_types.test.ts index e6293a589743b..bb5220b254184 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/list_types/rule_types.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/list_types/rule_types.test.ts @@ -12,8 +12,8 @@ import { verifyApiAccess } from '../../../../lib/license_api_access'; import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { rulesClientMock } from '../../../../rules_client.mock'; import { RecoveredActionGroup } from '../../../../../common'; -import { RegistryAlertTypeWithAuth } from '../../../../authorization'; -import { AsApiContract } from '../../../lib'; +import type { RegistryAlertTypeWithAuth } from '../../../../authorization'; +import type { AsApiContract } from '../../../lib'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/list_types/rule_types.ts b/x-pack/plugins/alerting/server/routes/rule/apis/list_types/rule_types.ts index da9c62ab5f3f2..61ff8525ab732 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/list_types/rule_types.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/list_types/rule_types.ts @@ -5,14 +5,13 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { - TypesRulesResponseBodyV1, - typesRulesResponseSchemaV1, -} from '../../../../../common/routes/rule/apis/list_types'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { TypesRulesResponseBodyV1 } from '../../../../../common/routes/rule/apis/list_types'; +import { typesRulesResponseSchemaV1 } from '../../../../../common/routes/rule/apis/list_types'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; import { transformRuleTypesResponseV1 } from './transforms'; export const ruleTypesRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/list_types/transforms/transform_rule_types_response/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/list_types/transforms/transform_rule_types_response/v1.ts index 54a5874331c86..3ad2bd96a846f 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/list_types/transforms/transform_rule_types_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/list_types/transforms/transform_rule_types_response/v1.ts @@ -6,7 +6,7 @@ */ import { isBoolean } from 'lodash/fp'; -import { RegistryAlertTypeWithAuth } from '../../../../../../authorization'; +import type { RegistryAlertTypeWithAuth } from '../../../../../../authorization'; import type { TypesRulesResponseBodyV1 } from '../../../../../../../common/routes/rule/apis/list_types'; export const transformRuleTypesResponse = ( diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/mute_alert/mute_alert.ts b/x-pack/plugins/alerting/server/routes/rule/apis/mute_alert/mute_alert.ts index 5ce924b445ca7..cb747cb140e6e 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/mute_alert/mute_alert.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/mute_alert/mute_alert.ts @@ -4,15 +4,15 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { transformRequestParamsToApplicationV1 } from './transforms'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; -import { - muteAlertParamsSchemaV1, - MuteAlertRequestParamsV1, -} from '../../../../../common/routes/rule/apis/mute_alert'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; +import type { MuteAlertRequestParamsV1 } from '../../../../../common/routes/rule/apis/mute_alert'; +import { muteAlertParamsSchemaV1 } from '../../../../../common/routes/rule/apis/mute_alert'; export const muteAlertRoute = ( router: IRouter, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/mute_alert/transforms/transform_request_params_to_application/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/mute_alert/transforms/transform_request_params_to_application/v1.ts index 37966060dba02..9dc55bb9e52f3 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/mute_alert/transforms/transform_request_params_to_application/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/mute_alert/transforms/transform_request_params_to_application/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { MuteAlertParams } from '../../../../../../application/rule/methods/mute_alert/types'; -import { RewriteRequestCase } from '../../../../../lib'; +import type { MuteAlertParams } from '../../../../../../application/rule/methods/mute_alert/types'; +import type { RewriteRequestCase } from '../../../../../lib'; export const transformRequestParamsToApplication: RewriteRequestCase = ({ rule_id: alertId, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/mute_all/mute_all_rule.ts b/x-pack/plugins/alerting/server/routes/rule/apis/mute_all/mute_all_rule.ts index e9aa0e42a046f..f7f5367ea0bbe 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/mute_all/mute_all_rule.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/mute_all/mute_all_rule.ts @@ -5,16 +5,16 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; import { trackDeprecatedRouteUsage } from '../../../../lib/track_deprecated_route_usage'; -import { - muteAllRuleRequestParamsSchemaV1, - MuteAllRuleRequestParamsV1, -} from '../../../../../common/routes/rule/apis/mute_all'; +import type { MuteAllRuleRequestParamsV1 } from '../../../../../common/routes/rule/apis/mute_all'; +import { muteAllRuleRequestParamsSchemaV1 } from '../../../../../common/routes/rule/apis/mute_all'; export const muteAllRuleRoute = ( router: IRouter, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/resolve/resolve_rule_route.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/resolve/resolve_rule_route.test.ts index 7b7d871007060..417651b7cc113 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/resolve/resolve_rule_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/resolve/resolve_rule_route.test.ts @@ -12,8 +12,8 @@ import { licenseStateMock } from '../../../../lib/license_state.mock'; import { verifyApiAccess } from '../../../../lib/license_api_access'; import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { rulesClientMock } from '../../../../rules_client.mock'; -import { ResolvedRule } from '../../../../application/rule/methods/resolve/types'; -import { ResolvedSanitizedRule, RuleAction, RuleSystemAction } from '../../../../../common'; +import type { ResolvedRule } from '../../../../application/rule/methods/resolve/types'; +import type { ResolvedSanitizedRule, RuleAction, RuleSystemAction } from '../../../../../common'; import { actionsClientMock } from '@kbn/actions-plugin/server/mocks'; const rulesClient = rulesClientMock.create(); diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/resolve/resolve_rule_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/resolve/resolve_rule_route.ts index f67485279edc5..c41be2f0fafe4 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/resolve/resolve_rule_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/resolve/resolve_rule_route.ts @@ -5,17 +5,16 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { IRouter } from '@kbn/core/server'; -import { RuleParamsV1 } from '../../../../../common/routes/rule/response'; -import { ResolvedRule } from '../../../../application/rule/methods/resolve/types'; -import { - resolveParamsSchemaV1, - ResolveRuleResponseV1, -} from '../../../../../common/routes/rule/apis/resolve'; -import { ILicenseState } from '../../../../lib'; +import type { TypeOf } from '@kbn/config-schema'; +import type { IRouter } from '@kbn/core/server'; +import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; +import type { ResolvedRule } from '../../../../application/rule/methods/resolve/types'; +import type { ResolveRuleResponseV1 } from '../../../../../common/routes/rule/apis/resolve'; +import { resolveParamsSchemaV1 } from '../../../../../common/routes/rule/apis/resolve'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { transformResolveResponseV1 } from './transforms'; export type ResolveRuleRequestParamsV1 = TypeOf; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/resolve/transforms/transform_resolve_response/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/resolve/transforms/transform_resolve_response/v1.ts index 060f6892403f4..bd40c8535d1b9 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/resolve/transforms/transform_resolve_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/resolve/transforms/transform_resolve_response/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { ResolvedRule } from '../../../../../../application/rule/methods/resolve/types'; -import { RuleParams } from '../../../../../../application/rule/types'; +import type { ResolvedRule } from '../../../../../../application/rule/methods/resolve/types'; +import type { RuleParams } from '../../../../../../application/rule/types'; import { transformRuleToRuleResponseV1 } from '../../../../transforms'; export const transformResolveResponse = ( diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/snooze/snooze_rule_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/snooze/snooze_rule_route.ts index 1de46fd784905..c760d5f374867 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/snooze/snooze_rule_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/snooze/snooze_rule_route.ts @@ -5,15 +5,17 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { IRouter } from '@kbn/core/server'; +import type { TypeOf } from '@kbn/config-schema'; +import type { IRouter } from '@kbn/core/server'; import { snoozeBodySchema, snoozeParamsSchema, } from '../../../../../common/routes/rule/apis/snooze'; -import { ILicenseState, RuleMutedError } from '../../../../lib'; +import type { ILicenseState } from '../../../../lib'; +import { RuleMutedError } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_ALERTING_SNOOZE_RULE } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_ALERTING_SNOOZE_RULE } from '../../../../types'; import { transformSnoozeBodyV1 } from './transforms'; export type SnoozeRuleRequestParamsV1 = TypeOf; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/snooze/transforms/transform_snooze_body/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/snooze/transforms/transform_snooze_body/v1.ts index ff7c890ef9cbd..3937045725c1e 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/snooze/transforms/transform_snooze_body/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/snooze/transforms/transform_snooze_body/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { snoozeBodySchemaV1 } from '../../../../../../../common/routes/rule/apis/snooze'; +import type { TypeOf } from '@kbn/config-schema'; +import type { snoozeBodySchemaV1 } from '../../../../../../../common/routes/rule/apis/snooze'; type SnoozeBodySchema = TypeOf; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/tags/get_rule_tags.ts b/x-pack/plugins/alerting/server/routes/rule/apis/tags/get_rule_tags.ts index c66bf0d61009a..b89ac8a2cec90 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/tags/get_rule_tags.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/tags/get_rule_tags.ts @@ -4,15 +4,14 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { transformRuleTagsBodyResponseV1 } from './transforms'; import { transformRuleTagsQueryRequestV1 } from './transforms'; -import { - ruleTagsRequestQuerySchemaV1, - RuleTagsRequestQueryV1, -} from '../../../../../common/routes/rule/apis/tags'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; -import { ILicenseState } from '../../../../lib'; +import type { RuleTagsRequestQueryV1 } from '../../../../../common/routes/rule/apis/tags'; +import { ruleTagsRequestQuerySchemaV1 } from '../../../../../common/routes/rule/apis/tags'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; export const getRuleTagsRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/tags/transforms/transform_rule_tags_body_response/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/tags/transforms/transform_rule_tags_body_response/v1.ts index dc6a1c3e1bade..38cdd9c8e1d73 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/tags/transforms/transform_rule_tags_body_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/tags/transforms/transform_rule_tags_body_response/v1.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { RewriteResponseCase } from '@kbn/actions-plugin/common'; +import type { RewriteResponseCase } from '@kbn/actions-plugin/common'; import type { RuleTagsFormattedResponse } from '../../../../../../../common/routes/rule/apis/tags'; export const transformRuleTagsBodyResponse: RewriteResponseCase = ({ diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/tags/transforms/transform_rule_tags_query_request/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/tags/transforms/transform_rule_tags_query_request/v1.ts index 3fbd52521a9d5..65b3caecde3f9 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/tags/transforms/transform_rule_tags_query_request/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/tags/transforms/transform_rule_tags_query_request/v1.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RewriteRequestCase } from '@kbn/actions-plugin/common'; +import type { RewriteRequestCase } from '@kbn/actions-plugin/common'; import type { RuleTagsParams } from '../../../../../../application/rule/methods/tags'; export const transformRuleTagsQueryRequest: RewriteRequestCase = ({ diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/unmute_alert/transforms/transform_request_params_to_application/v1.ts b/x-pack/plugins/alerting/server/routes/rule/apis/unmute_alert/transforms/transform_request_params_to_application/v1.ts index 227b57ba67717..bbddf2fd8d52c 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/unmute_alert/transforms/transform_request_params_to_application/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/unmute_alert/transforms/transform_request_params_to_application/v1.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { UnmuteAlertParams } from '../../../../../../application/rule/methods/unmute_alert/types'; -import { RewriteRequestCase } from '../../../../../lib'; -import { UnmuteAlertRequestParamsV1 } from '../../../../../../../common/routes/rule/apis/unmute_alert'; +import type { UnmuteAlertParams } from '../../../../../../application/rule/methods/unmute_alert/types'; +import type { RewriteRequestCase } from '../../../../../lib'; +import type { UnmuteAlertRequestParamsV1 } from '../../../../../../../common/routes/rule/apis/unmute_alert'; export const transformRequestParamsToApplication: RewriteRequestCase = ({ rule_id: alertId, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/unmute_alert/unmute_alert_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/unmute_alert/unmute_alert_route.ts index 63560e354dc1b..8e313c6a6b6c5 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/unmute_alert/unmute_alert_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/unmute_alert/unmute_alert_route.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { - UnmuteAlertRequestParamsV1, - unmuteAlertParamsSchemaV1, -} from '../../../../../common/routes/rule/apis/unmute_alert'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; +import type { IRouter } from '@kbn/core/server'; +import type { UnmuteAlertRequestParamsV1 } from '../../../../../common/routes/rule/apis/unmute_alert'; +import { unmuteAlertParamsSchemaV1 } from '../../../../../common/routes/rule/apis/unmute_alert'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; import { verifyAccessAndContext } from '../../../lib'; import { transformRequestParamsToApplicationV1 } from './transforms'; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/unmute_all/unmute_all_rule.ts b/x-pack/plugins/alerting/server/routes/rule/apis/unmute_all/unmute_all_rule.ts index 8409128da6241..c6dc520731ce5 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/unmute_all/unmute_all_rule.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/unmute_all/unmute_all_rule.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; -import { - unmuteAllRuleRequestParamsSchemaV1, - UnmuteAllRuleRequestParamsV1, -} from '../../../../../common/routes/rule/apis/unmute_all'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; +import type { UnmuteAllRuleRequestParamsV1 } from '../../../../../common/routes/rule/apis/unmute_all'; +import { unmuteAllRuleRequestParamsSchemaV1 } from '../../../../../common/routes/rule/apis/unmute_all'; export const unmuteAllRuleRoute = ( router: IRouter, diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/unsnooze/unsnooze_rule_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/unsnooze/unsnooze_rule_route.ts index 69e4c91eeaf35..dd9f22907f431 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/unsnooze/unsnooze_rule_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/unsnooze/unsnooze_rule_route.ts @@ -5,15 +5,17 @@ * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; -import { IRouter } from '@kbn/core/server'; +import type { TypeOf } from '@kbn/config-schema'; +import type { IRouter } from '@kbn/core/server'; import { unsnoozeBodySchema, unsnoozeParamsSchema, } from '../../../../../common/routes/rule/apis/unsnooze'; -import { ILicenseState, RuleMutedError } from '../../../../lib'; +import type { ILicenseState } from '../../../../lib'; +import { RuleMutedError } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { transformUnsnoozeBodyV1 } from './transforms'; export type UnsnoozeRuleRequestParamsV1 = TypeOf; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/update/update_rule_route.test.ts b/x-pack/plugins/alerting/server/routes/rule/apis/update/update_rule_route.test.ts index e26e9705fa7f4..a2644438f86b6 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/update/update_rule_route.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/update/update_rule_route.test.ts @@ -13,7 +13,8 @@ import { verifyApiAccess } from '../../../../lib/license_api_access'; import { mockHandlerArguments } from '../../../_mock_handler_arguments'; import { rulesClientMock } from '../../../../rules_client.mock'; import { RuleTypeDisabledError } from '../../../../lib/errors/rule_type_disabled'; -import { RuleNotifyWhen, SanitizedRule } from '../../../../../common'; +import type { SanitizedRule } from '../../../../../common'; +import { RuleNotifyWhen } from '../../../../../common'; const rulesClient = rulesClientMock.create(); jest.mock('../../../../lib/license_api_access', () => ({ diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/update/update_rule_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/update/update_rule_route.ts index 5c925b05bace3..b14c32392cf9f 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/update/update_rule_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/update/update_rule_route.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import type { UpdateRuleRequestBodyV1, UpdateRuleRequestParamsV1, @@ -15,10 +15,13 @@ import { updateBodySchemaV1, updateParamsSchemaV1, } from '../../../../../common/routes/rule/apis/update'; -import { RuleParamsV1, ruleResponseSchemaV1 } from '../../../../../common/routes/rule/response'; -import { Rule } from '../../../../application/rule/types'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; +import type { RuleParamsV1 } from '../../../../../common/routes/rule/response'; +import { ruleResponseSchemaV1 } from '../../../../../common/routes/rule/response'; +import type { Rule } from '../../../../application/rule/types'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; import { handleDisabledApiKeysError, verifyAccessAndContext } from '../../../lib'; import { transformRuleToRuleResponseV1 } from '../../transforms'; import { validateRequiredGroupInDefaultActionsV1 } from '../../validation'; diff --git a/x-pack/plugins/alerting/server/routes/rule/apis/update_api_key/update_rule_api_key_route.ts b/x-pack/plugins/alerting/server/routes/rule/apis/update_api_key/update_rule_api_key_route.ts index 7ba8589412357..84dfba573bc50 100644 --- a/x-pack/plugins/alerting/server/routes/rule/apis/update_api_key/update_rule_api_key_route.ts +++ b/x-pack/plugins/alerting/server/routes/rule/apis/update_api_key/update_rule_api_key_route.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { - UpdateApiKeyParamsV1, - updateApiKeyParamsSchemaV1, -} from '../../../../../common/routes/rule/apis/update_api_key'; -import { ILicenseState, RuleTypeDisabledError } from '../../../../lib'; -import { AlertingRequestHandlerContext, BASE_ALERTING_API_PATH } from '../../../../types'; +import type { IRouter } from '@kbn/core/server'; +import type { UpdateApiKeyParamsV1 } from '../../../../../common/routes/rule/apis/update_api_key'; +import { updateApiKeyParamsSchemaV1 } from '../../../../../common/routes/rule/apis/update_api_key'; +import type { ILicenseState } from '../../../../lib'; +import { RuleTypeDisabledError } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { BASE_ALERTING_API_PATH } from '../../../../types'; import { verifyAccessAndContext } from '../../../lib'; export const updateRuleApiKeyRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/rule/transforms/transform_rule_to_rule_response/v1.test.ts b/x-pack/plugins/alerting/server/routes/rule/transforms/transform_rule_to_rule_response/v1.test.ts index 2a5b2e77f313e..8a1e011331924 100644 --- a/x-pack/plugins/alerting/server/routes/rule/transforms/transform_rule_to_rule_response/v1.test.ts +++ b/x-pack/plugins/alerting/server/routes/rule/transforms/transform_rule_to_rule_response/v1.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RuleAction, RuleSystemAction } from '../../../../../common'; +import type { RuleAction, RuleSystemAction } from '../../../../../common'; import { transformRuleToRuleResponse } from './v1'; describe('transformRuleToRuleResponse', () => { diff --git a/x-pack/plugins/alerting/server/routes/rule/transforms/transform_rule_to_rule_response/v1.ts b/x-pack/plugins/alerting/server/routes/rule/transforms/transform_rule_to_rule_response/v1.ts index c1ef6af4f36b0..de3e99fe092fc 100644 --- a/x-pack/plugins/alerting/server/routes/rule/transforms/transform_rule_to_rule_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rule/transforms/transform_rule_to_rule_response/v1.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { +import type { RuleResponseV1, RuleParamsV1, RuleLastRunV1, MonitoringV1, } from '../../../../../common/routes/rule/response'; -import { Rule, RuleLastRun, RuleParams, Monitoring } from '../../../../application/rule/types'; +import type { Rule, RuleLastRun, RuleParams, Monitoring } from '../../../../application/rule/types'; export const transformRuleLastRun = (lastRun: RuleLastRun): RuleLastRunV1 => { return { diff --git a/x-pack/plugins/alerting/server/routes/rules_settings/apis/get/get_query_delay_settings.test.ts b/x-pack/plugins/alerting/server/routes/rules_settings/apis/get/get_query_delay_settings.test.ts index dc6474fe50a35..6b64df4221689 100644 --- a/x-pack/plugins/alerting/server/routes/rules_settings/apis/get/get_query_delay_settings.test.ts +++ b/x-pack/plugins/alerting/server/routes/rules_settings/apis/get/get_query_delay_settings.test.ts @@ -8,10 +8,8 @@ import { httpServiceMock } from '@kbn/core/server/mocks'; import { licenseStateMock } from '../../../../lib/license_state.mock'; import { mockHandlerArguments } from '../../../_mock_handler_arguments'; -import { - rulesSettingsClientMock, - RulesSettingsClientMock, -} from '../../../../rules_settings/rules_settings_client.mock'; +import type { RulesSettingsClientMock } from '../../../../rules_settings/rules_settings_client.mock'; +import { rulesSettingsClientMock } from '../../../../rules_settings/rules_settings_client.mock'; import { getQueryDelaySettingsRoute } from './get_query_delay_settings'; let rulesSettingsClient: RulesSettingsClientMock; diff --git a/x-pack/plugins/alerting/server/routes/rules_settings/apis/get/get_query_delay_settings.ts b/x-pack/plugins/alerting/server/routes/rules_settings/apis/get/get_query_delay_settings.ts index 542af574d4459..5429f8626f210 100644 --- a/x-pack/plugins/alerting/server/routes/rules_settings/apis/get/get_query_delay_settings.ts +++ b/x-pack/plugins/alerting/server/routes/rules_settings/apis/get/get_query_delay_settings.ts @@ -5,13 +5,14 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { verifyAccessAndContext } from '../../../lib'; import { API_PRIVILEGES } from '../../../../../common'; import { transformQueryDelaySettingsToResponseV1 } from '../../transforms'; -import { GetQueryDelaySettingsResponseV1 } from '../../../../../common/routes/rules_settings/apis/get'; +import type { GetQueryDelaySettingsResponseV1 } from '../../../../../common/routes/rules_settings/apis/get'; export const getQueryDelaySettingsRoute = ( router: IRouter, diff --git a/x-pack/plugins/alerting/server/routes/rules_settings/apis/update/update_query_delay_settings.test.ts b/x-pack/plugins/alerting/server/routes/rules_settings/apis/update/update_query_delay_settings.test.ts index c912a4ff4dec9..1e1e6fc911b2d 100644 --- a/x-pack/plugins/alerting/server/routes/rules_settings/apis/update/update_query_delay_settings.test.ts +++ b/x-pack/plugins/alerting/server/routes/rules_settings/apis/update/update_query_delay_settings.test.ts @@ -8,10 +8,8 @@ import { httpServiceMock } from '@kbn/core/server/mocks'; import { licenseStateMock } from '../../../../lib/license_state.mock'; import { mockHandlerArguments } from '../../../_mock_handler_arguments'; -import { - rulesSettingsClientMock, - RulesSettingsClientMock, -} from '../../../../rules_settings/rules_settings_client.mock'; +import type { RulesSettingsClientMock } from '../../../../rules_settings/rules_settings_client.mock'; +import { rulesSettingsClientMock } from '../../../../rules_settings/rules_settings_client.mock'; import { updateQueryDelaySettingsRoute } from './update_query_delay_settings'; let rulesSettingsClient: RulesSettingsClientMock; diff --git a/x-pack/plugins/alerting/server/routes/rules_settings/apis/update/update_query_delay_settings.ts b/x-pack/plugins/alerting/server/routes/rules_settings/apis/update/update_query_delay_settings.ts index 4d3107f2c9568..a4f00e91edf4a 100644 --- a/x-pack/plugins/alerting/server/routes/rules_settings/apis/update/update_query_delay_settings.ts +++ b/x-pack/plugins/alerting/server/routes/rules_settings/apis/update/update_query_delay_settings.ts @@ -5,16 +5,17 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; -import { ILicenseState } from '../../../../lib'; +import type { IRouter } from '@kbn/core/server'; +import type { ILicenseState } from '../../../../lib'; import { verifyAccessAndContext } from '../../../lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; +import type { AlertingRequestHandlerContext } from '../../../../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types'; import { API_PRIVILEGES } from '../../../../../common'; -import { - updateQueryDelaySettingsBodySchemaV1, +import type { UpdateQueryDelaySettingsRequestBodyV1, UpdateQueryDelaySettingsResponseV1, } from '../../../../../common/routes/rules_settings/apis/update'; +import { updateQueryDelaySettingsBodySchemaV1 } from '../../../../../common/routes/rules_settings/apis/update'; import { transformQueryDelaySettingsToResponseV1 } from '../../transforms'; export const updateQueryDelaySettingsRoute = ( diff --git a/x-pack/plugins/alerting/server/routes/rules_settings/transforms/transform_query_delay_settings_to_response/v1.ts b/x-pack/plugins/alerting/server/routes/rules_settings/transforms/transform_query_delay_settings_to_response/v1.ts index 926b702bdbf9c..7528bc29d2387 100644 --- a/x-pack/plugins/alerting/server/routes/rules_settings/transforms/transform_query_delay_settings_to_response/v1.ts +++ b/x-pack/plugins/alerting/server/routes/rules_settings/transforms/transform_query_delay_settings_to_response/v1.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RulesSettingsQueryDelay } from '../../../../../common'; -import { QueryDelaySettingsResponseV1 } from '../../../../../common/routes/rules_settings/response'; +import type { RulesSettingsQueryDelay } from '../../../../../common'; +import type { QueryDelaySettingsResponseV1 } from '../../../../../common/routes/rules_settings/response'; export const transformQueryDelaySettingsToResponse = ( settings: RulesSettingsQueryDelay diff --git a/x-pack/plugins/alerting/server/routes/run_soon.ts b/x-pack/plugins/alerting/server/routes/run_soon.ts index 589724ab57b06..b103a0869284b 100644 --- a/x-pack/plugins/alerting/server/routes/run_soon.ts +++ b/x-pack/plugins/alerting/server/routes/run_soon.ts @@ -5,11 +5,12 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { schema } from '@kbn/config-schema'; -import { ILicenseState } from '../lib'; +import type { ILicenseState } from '../lib'; import { verifyAccessAndContext } from './lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../types'; +import type { AlertingRequestHandlerContext } from '../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../types'; const paramSchema = schema.object({ id: schema.string(), diff --git a/x-pack/plugins/alerting/server/routes/suggestions/fields_rules.ts b/x-pack/plugins/alerting/server/routes/suggestions/fields_rules.ts index f3201d961e684..fa82941a52091 100644 --- a/x-pack/plugins/alerting/server/routes/suggestions/fields_rules.ts +++ b/x-pack/plugins/alerting/server/routes/suggestions/fields_rules.ts @@ -13,14 +13,14 @@ */ import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; -import { IRouter } from '@kbn/core/server'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { IRouter } from '@kbn/core/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import { ALERTING_CASES_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server/src/saved_objects_index_pattern'; import { IndexPatternsFetcher } from '@kbn/data-plugin/server'; import { verifyAccessAndContext } from '../lib'; -import { ILicenseState } from '../../lib'; -import { AlertingRequestHandlerContext } from '../../types'; +import type { ILicenseState } from '../../lib'; +import type { AlertingRequestHandlerContext } from '../../types'; export function registerFieldsRoute( router: IRouter, 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 205e90c5e8425..70fdf49bbc5c9 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 @@ -9,7 +9,7 @@ import { httpServerMock, httpServiceMock } from '@kbn/core-http-server-mocks'; 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'; +import type { Observable } from 'rxjs'; import { licenseStateMock } from '../../lib/license_state.mock'; import { rulesClientMock } from '../../rules_client.mock'; import { mockHandlerArguments } from '../_mock_handler_arguments'; 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 f39615efa7e8d..0e2ee22a85d7a 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 @@ -6,12 +6,13 @@ */ import { schema } from '@kbn/config-schema'; -import { IRouter } from '@kbn/core/server'; -import { firstValueFrom, Observable } from 'rxjs'; +import type { IRouter } from '@kbn/core/server'; +import type { Observable } from 'rxjs'; +import { firstValueFrom } 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/server/config'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { 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'; import { @@ -23,13 +24,10 @@ import { import { verifyAccessAndContext } from '../lib'; import { RuleAuditAction, ruleAuditEvent } from '../../rules_client/common/audit_events'; -import { - AlertingAuthorizationEntity, - AlertingAuthorizationFilterOpts, - AlertingAuthorizationFilterType, -} from '../../authorization'; -import { AlertingRequestHandlerContext } from '../../types'; -import { GetAlertIndicesAlias, ILicenseState } from '../../lib'; +import type { AlertingAuthorizationFilterOpts } from '../../authorization'; +import { AlertingAuthorizationEntity, AlertingAuthorizationFilterType } from '../../authorization'; +import type { AlertingRequestHandlerContext } from '../../types'; +import type { GetAlertIndicesAlias, ILicenseState } from '../../lib'; const alertingAuthorizationFilterOpts: AlertingAuthorizationFilterOpts = { type: AlertingAuthorizationFilterType.ESDSL, 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 42211d3a0f6e5..3c4fe19fcb2a4 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 @@ -9,7 +9,7 @@ import { httpServerMock, httpServiceMock } from '@kbn/core-http-server-mocks'; 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'; +import type { Observable } from 'rxjs'; import { licenseStateMock } from '../../lib/license_state.mock'; import { rulesClientMock } from '../../rules_client.mock'; import { mockHandlerArguments } from '../_mock_handler_arguments'; 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 6ada2378b3096..65d29d5e2b0b4 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 @@ -6,24 +6,22 @@ */ import { schema } from '@kbn/config-schema'; -import { IRouter } from '@kbn/core/server'; -import { firstValueFrom, Observable } from 'rxjs'; +import type { IRouter } from '@kbn/core/server'; +import type { Observable } from 'rxjs'; +import { firstValueFrom } 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/server/config'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { 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'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { verifyAccessAndContext } from '../lib'; -import { ILicenseState } from '../../lib'; -import { AlertingRequestHandlerContext } from '../../types'; -import { - AlertingAuthorizationEntity, - AlertingAuthorizationFilterOpts, - AlertingAuthorizationFilterType, -} from '../../authorization'; +import type { ILicenseState } from '../../lib'; +import type { AlertingRequestHandlerContext } from '../../types'; +import type { AlertingAuthorizationFilterOpts } from '../../authorization'; +import { AlertingAuthorizationEntity, AlertingAuthorizationFilterType } from '../../authorization'; import { RuleAuditAction, ruleAuditEvent } from '../../rules_client/common/audit_events'; const alertingAuthorizationFilterOpts: AlertingAuthorizationFilterOpts = { diff --git a/x-pack/plugins/alerting/server/routes/update_flapping_settings.test.ts b/x-pack/plugins/alerting/server/routes/update_flapping_settings.test.ts index 05563afb85176..2c6fcef31ac2c 100644 --- a/x-pack/plugins/alerting/server/routes/update_flapping_settings.test.ts +++ b/x-pack/plugins/alerting/server/routes/update_flapping_settings.test.ts @@ -8,10 +8,8 @@ import { httpServiceMock } from '@kbn/core/server/mocks'; import { licenseStateMock } from '../lib/license_state.mock'; import { mockHandlerArguments } from './_mock_handler_arguments'; -import { - rulesSettingsClientMock, - RulesSettingsClientMock, -} from '../rules_settings/rules_settings_client.mock'; +import type { RulesSettingsClientMock } from '../rules_settings/rules_settings_client.mock'; +import { rulesSettingsClientMock } from '../rules_settings/rules_settings_client.mock'; import { updateFlappingSettingsRoute } from './update_flapping_settings'; let rulesSettingsClient: RulesSettingsClientMock; diff --git a/x-pack/plugins/alerting/server/routes/update_flapping_settings.ts b/x-pack/plugins/alerting/server/routes/update_flapping_settings.ts index d12f185d47e07..f46baa84ec754 100644 --- a/x-pack/plugins/alerting/server/routes/update_flapping_settings.ts +++ b/x-pack/plugins/alerting/server/routes/update_flapping_settings.ts @@ -5,16 +5,15 @@ * 2.0. */ -import { IRouter } from '@kbn/core/server'; +import type { IRouter } from '@kbn/core/server'; import { schema } from '@kbn/config-schema'; -import { ILicenseState } from '../lib'; -import { verifyAccessAndContext, RewriteResponseCase, RewriteRequestCase } from './lib'; -import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../types'; -import { - API_PRIVILEGES, - RulesSettingsFlapping, - RulesSettingsFlappingProperties, -} from '../../common'; +import type { ILicenseState } from '../lib'; +import type { RewriteResponseCase, RewriteRequestCase } from './lib'; +import { verifyAccessAndContext } from './lib'; +import type { AlertingRequestHandlerContext } from '../types'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../types'; +import type { RulesSettingsFlapping, RulesSettingsFlappingProperties } from '../../common'; +import { API_PRIVILEGES } from '../../common'; const bodySchema = schema.object({ enabled: schema.boolean(), diff --git a/x-pack/plugins/alerting/server/rule_type_registry.mock.ts b/x-pack/plugins/alerting/server/rule_type_registry.mock.ts index 706484fdd92f6..f48b10b2b0de0 100644 --- a/x-pack/plugins/alerting/server/rule_type_registry.mock.ts +++ b/x-pack/plugins/alerting/server/rule_type_registry.mock.ts @@ -6,7 +6,7 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { RuleTypeRegistry } from './rule_type_registry'; +import type { RuleTypeRegistry } from './rule_type_registry'; type Schema = PublicMethodsOf; diff --git a/x-pack/plugins/alerting/server/rule_type_registry.test.ts b/x-pack/plugins/alerting/server/rule_type_registry.test.ts index e678228660e51..c802b02a0a27a 100644 --- a/x-pack/plugins/alerting/server/rule_type_registry.test.ts +++ b/x-pack/plugins/alerting/server/rule_type_registry.test.ts @@ -6,18 +6,19 @@ */ import { TaskRunnerFactory } from './task_runner'; -import { RuleTypeRegistry, ConstructorOptions } from './rule_type_registry'; -import { ActionGroup, RuleType } from './types'; +import type { ConstructorOptions } from './rule_type_registry'; +import { RuleTypeRegistry } from './rule_type_registry'; +import type { ActionGroup, RuleType } from './types'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { ILicenseState } from './lib/license_state'; +import type { ILicenseState } from './lib/license_state'; import { licenseStateMock } from './lib/license_state.mock'; import { licensingMock } from '@kbn/licensing-plugin/server/mocks'; import { loggingSystemMock } from '@kbn/core/server/mocks'; import { inMemoryMetricsMock } from './monitoring/in_memory_metrics.mock'; import { alertsServiceMock } from './alerts_service/alerts_service.mock'; import { schema } from '@kbn/config-schema'; -import { RecoveredActionGroupId } from '../common'; -import { AlertingConfig } from './config'; +import type { RecoveredActionGroupId } from '../common'; +import type { AlertingConfig } from './config'; const logger = loggingSystemMock.create().get(); let mockedLicenseState: jest.Mocked; diff --git a/x-pack/plugins/alerting/server/rule_type_registry.ts b/x-pack/plugins/alerting/server/rule_type_registry.ts index 7562942f0262d..9dd985b864d5b 100644 --- a/x-pack/plugins/alerting/server/rule_type_registry.ts +++ b/x-pack/plugins/alerting/server/rule_type_registry.ts @@ -10,13 +10,13 @@ import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; import typeDetect from 'type-detect'; import { intersection } from 'lodash'; -import { Logger } from '@kbn/core/server'; -import { LicensingPluginSetup } from '@kbn/licensing-plugin/server'; -import { RunContext, TaskManagerSetupContract } from '@kbn/task-manager-plugin/server'; +import type { Logger } from '@kbn/core/server'; +import type { LicensingPluginSetup } from '@kbn/licensing-plugin/server'; +import type { RunContext, TaskManagerSetupContract } from '@kbn/task-manager-plugin/server'; import { stateSchemaByVersion } from '@kbn/alerting-state-types'; import { TaskCost } from '@kbn/task-manager-plugin/server/task'; -import { TaskRunnerFactory } from './task_runner'; -import { +import type { TaskRunnerFactory } from './task_runner'; +import type { RuleType, RuleTypeParams, RuleTypeState, @@ -24,22 +24,20 @@ import { AlertInstanceContext, IRuleTypeAlerts, } from './types'; +import type { RecoveredActionGroupId, ActionGroup, RuleAlertData } from '../common'; import { RecoveredActionGroup, getBuiltinActionGroups, - RecoveredActionGroupId, - ActionGroup, validateDurationSchema, parseDuration, - RuleAlertData, } from '../common'; -import { ILicenseState } from './lib/license_state'; +import type { ILicenseState } from './lib/license_state'; import { getRuleTypeFeatureUsageName } from './lib/get_rule_type_feature_usage_name'; -import { InMemoryMetrics } from './monitoring'; -import { AlertingRulesConfig } from '.'; -import { AlertsService } from './alerts_service/alerts_service'; +import type { InMemoryMetrics } from './monitoring'; +import type { AlertingRulesConfig } from '.'; +import type { AlertsService } from './alerts_service/alerts_service'; import { getRuleTypeIdValidLegacyConsumers } from './rule_type_registry_deprecated_consumers'; -import { AlertingConfig } from './config'; +import type { AlertingConfig } from './config'; const RULE_TYPES_WITH_CUSTOM_COST: Record = { 'siem.indicatorRule': TaskCost.ExtraLarge, @@ -518,7 +516,7 @@ function augmentActionGroupsWithReserved< const activeActionGroupSeverities = new Set(); actionGroups.forEach((actionGroup) => { - if (!!actionGroup.severity) { + if (actionGroup.severity) { if (activeActionGroupSeverities.has(actionGroup.severity.level)) { throw new Error( i18n.translate( diff --git a/x-pack/plugins/alerting/server/rules_client.mock.ts b/x-pack/plugins/alerting/server/rules_client.mock.ts index 0616591cbe565..7a531acf60b5e 100644 --- a/x-pack/plugins/alerting/server/rules_client.mock.ts +++ b/x-pack/plugins/alerting/server/rules_client.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RulesClientApi } from './types'; +import type { RulesClientApi } from './types'; type Schema = RulesClientApi; export type RulesClientMock = jest.Mocked; diff --git a/x-pack/plugins/alerting/server/rules_client/common/api_key_as_alert_attributes.ts b/x-pack/plugins/alerting/server/rules_client/common/api_key_as_alert_attributes.ts index c1941a8d0fa4b..a18ff3c9ba08d 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/api_key_as_alert_attributes.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/api_key_as_alert_attributes.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { RawRule } from '../../types'; -import { CreateAPIKeyResult } from '../types'; -import { RuleDomain } from '../../application/rule/types'; +import type { RawRule } from '../../types'; +import type { CreateAPIKeyResult } from '../types'; +import type { RuleDomain } from '../../application/rule/types'; /** * @deprecated TODO (http-versioning) make sure this is deprecated diff --git a/x-pack/plugins/alerting/server/rules_client/common/apply_bulk_edit_operation.test.ts b/x-pack/plugins/alerting/server/rules_client/common/apply_bulk_edit_operation.test.ts index d88ff3ef2b024..a00b05b3aacd5 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/apply_bulk_edit_operation.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/apply_bulk_edit_operation.test.ts @@ -6,7 +6,7 @@ */ import { applyBulkEditOperation } from './apply_bulk_edit_operation'; -import { Rule } from '../../types'; +import type { Rule } from '../../types'; describe('applyBulkEditOperation', () => { describe('tags operations', () => { diff --git a/x-pack/plugins/alerting/server/rules_client/common/audit_events.ts b/x-pack/plugins/alerting/server/rules_client/common/audit_events.ts index 66bba16c2805c..2e77c3b1bc172 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/audit_events.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/audit_events.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { EcsEvent } from '@kbn/core/server'; -import { AuditEvent } from '@kbn/security-plugin/server'; -import { ArrayElement } from '@kbn/utility-types'; +import type { EcsEvent } from '@kbn/core/server'; +import type { AuditEvent } from '@kbn/security-plugin/server'; +import type { ArrayElement } from '@kbn/utility-types'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE } from '../../saved_objects'; export enum RuleAuditAction { diff --git a/x-pack/plugins/alerting/server/rules_client/common/build_kuery_node_filter.ts b/x-pack/plugins/alerting/server/rules_client/common/build_kuery_node_filter.ts index f8d06637b7836..973bb7d2cbd29 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/build_kuery_node_filter.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/build_kuery_node_filter.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { fromKueryExpression, KueryNode } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; +import { fromKueryExpression } from '@kbn/es-query'; export const buildKueryNodeFilter = (filter?: string | KueryNode | null): KueryNode | null => { let optionsFilter: KueryNode | string | null = filter ?? null; diff --git a/x-pack/plugins/alerting/server/rules_client/common/constants.ts b/x-pack/plugins/alerting/server/rules_client/common/constants.ts index c89da2bbd6481..321bb2eb18029 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/constants.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/constants.ts @@ -5,10 +5,8 @@ * 2.0. */ -import { - AlertingAuthorizationFilterType, - AlertingAuthorizationFilterOpts, -} from '../../authorization'; +import type { AlertingAuthorizationFilterOpts } from '../../authorization'; +import { AlertingAuthorizationFilterType } from '../../authorization'; export { systemConnectorActionRefPrefix, diff --git a/x-pack/plugins/alerting/server/rules_client/common/get_and_validate_common_bulk_options.ts b/x-pack/plugins/alerting/server/rules_client/common/get_and_validate_common_bulk_options.ts index e4497cce1e30b..299ea9860c25b 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/get_and_validate_common_bulk_options.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/get_and_validate_common_bulk_options.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { BulkOptions, BulkOptionsFilter, BulkOptionsIds } from '../types'; +import type { BulkOptions, BulkOptionsFilter, BulkOptionsIds } from '../types'; export const getAndValidateCommonBulkOptions = (options: BulkOptions) => { const filter = (options as BulkOptionsFilter).filter; diff --git a/x-pack/plugins/alerting/server/rules_client/common/inject_references.ts b/x-pack/plugins/alerting/server/rules_client/common/inject_references.ts index 867a6d7044c39..9e956c634ade9 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/inject_references.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/inject_references.ts @@ -7,9 +7,9 @@ import Boom from '@hapi/boom'; import { omit } from 'lodash'; -import { SavedObjectReference, SavedObjectAttributes } from '@kbn/core/server'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; -import { RawRule, RuleTypeParams } from '../../types'; +import type { SavedObjectReference, SavedObjectAttributes } from '@kbn/core/server'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { RawRule, RuleTypeParams } from '../../types'; import { preconfiguredConnectorActionRefPrefix, extractedSavedObjectParamReferenceNamePrefix, diff --git a/x-pack/plugins/alerting/server/rules_client/common/mapped_params_utils.ts b/x-pack/plugins/alerting/server/rules_client/common/mapped_params_utils.ts index 3479ca374e596..0f94c06e208c2 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/mapped_params_utils.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/mapped_params_utils.ts @@ -6,14 +6,10 @@ */ import { snakeCase } from 'lodash'; -import { SavedObjectAttribute } from '@kbn/core/server'; -import { RuleTypeParams, MappedParams, MappedParamsProperties } from '../../types'; -import { - iterateFilterKureyNode, - IterateFilterKureyNodeParams, - IterateActionProps, - getFieldNameAttribute, -} from './validate_attributes'; +import type { SavedObjectAttribute } from '@kbn/core/server'; +import type { RuleTypeParams, MappedParams, MappedParamsProperties } from '../../types'; +import type { IterateFilterKureyNodeParams, IterateActionProps } from './validate_attributes'; +import { iterateFilterKureyNode, getFieldNameAttribute } from './validate_attributes'; export const MAPPED_PARAMS_PROPERTIES: Array = [ 'risk_score', diff --git a/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_edit_conflicts.test.ts b/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_edit_conflicts.test.ts index d099ba8693c3f..6d65443622945 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_edit_conflicts.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_edit_conflicts.test.ts @@ -4,12 +4,12 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { KueryNode } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; import { retryIfBulkEditConflicts } from './retry_if_bulk_edit_conflicts'; import { RETRY_IF_CONFLICTS_ATTEMPTS } from './wait_before_next_retry'; import { loggingSystemMock } from '@kbn/core/server/mocks'; -import { BulkEditSkipReason } from '../../../common/bulk_edit'; +import type { BulkEditSkipReason } from '../../../common/bulk_edit'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; const mockFilter: KueryNode = { diff --git a/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_edit_conflicts.ts b/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_edit_conflicts.ts index 20f32e483890d..6f2888e9206b5 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_edit_conflicts.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_edit_conflicts.ts @@ -7,14 +7,18 @@ import pMap from 'p-map'; import { chunk } from 'lodash'; -import { KueryNode } from '@kbn/es-query'; -import { Logger, SavedObjectsBulkUpdateObject, SavedObjectsUpdateResponse } from '@kbn/core/server'; -import { BulkActionSkipResult } from '../../../common/bulk_edit'; +import type { KueryNode } from '@kbn/es-query'; +import type { + Logger, + SavedObjectsBulkUpdateObject, + SavedObjectsUpdateResponse, +} from '@kbn/core/server'; +import type { BulkActionSkipResult } from '../../../common/bulk_edit'; import { convertRuleIdsToKueryNode } from '../../lib'; -import { BulkOperationError } from '../types'; +import type { BulkOperationError } from '../types'; import { waitBeforeNextRetry, RETRY_IF_CONFLICTS_ATTEMPTS } from './wait_before_next_retry'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; -import { RawRule } from '../../types'; +import type { RawRule } from '../../types'; // max number of failed SO ids in one retry filter const MaxIdsNumberInRetryFilter = 1000; diff --git a/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_operation_conflicts.test.ts b/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_operation_conflicts.test.ts index 554363e23e40f..b5c4390e444b2 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_operation_conflicts.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_operation_conflicts.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KueryNode } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; import { loggingSystemMock } from '@kbn/core/server/mocks'; import { retryIfBulkOperationConflicts } from './retry_if_bulk_operation_conflicts'; diff --git a/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_operation_conflicts.ts b/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_operation_conflicts.ts index 428f43a0dcfa6..8e36ef10f5fd2 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_operation_conflicts.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/retry_if_bulk_operation_conflicts.ts @@ -7,13 +7,13 @@ import pMap from 'p-map'; import { chunk } from 'lodash'; -import { KueryNode } from '@kbn/es-query'; -import { Logger, SavedObjectsBulkUpdateObject } from '@kbn/core/server'; +import type { KueryNode } from '@kbn/es-query'; +import type { Logger, SavedObjectsBulkUpdateObject } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; import { convertRuleIdsToKueryNode } from '../../lib'; -import { BulkOperationError } from '../types'; +import type { BulkOperationError } from '../types'; import { waitBeforeNextRetry, RETRY_IF_CONFLICTS_ATTEMPTS } from './wait_before_next_retry'; -import { RawRule } from '../../types'; +import type { RawRule } from '../../types'; const MAX_RULES_IDS_IN_RETRY = 1000; diff --git a/x-pack/plugins/alerting/server/rules_client/common/snooze_utils.ts b/x-pack/plugins/alerting/server/rules_client/common/snooze_utils.ts index 6e8e08bb3827f..9c2d872923065 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/snooze_utils.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/snooze_utils.ts @@ -6,14 +6,14 @@ */ import { i18n } from '@kbn/i18n'; -import { +import type { Rule, RuleDomain, RuleParams, RuleSnoozeSchedule as RuleDomainSnoozeSchedule, } from '../../application/rule/types'; import { getActiveScheduledSnoozes } from '../../lib/is_rule_snoozed'; -import { RawRule } from '../../types'; +import type { RawRule } from '../../types'; export function getSnoozeAttributes(attributes: RawRule, snoozeSchedule: RuleDomainSnoozeSchedule) { // If duration is -1, instead mute all diff --git a/x-pack/plugins/alerting/server/rules_client/common/try_to_remove_tasks.ts b/x-pack/plugins/alerting/server/rules_client/common/try_to_remove_tasks.ts index 962f68bf5d959..230d95c585ae5 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/try_to_remove_tasks.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/try_to_remove_tasks.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; -import { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; +import type { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; export const tryToRemoveTasks = async ({ taskIdsToDelete, diff --git a/x-pack/plugins/alerting/server/rules_client/common/validate_attributes.ts b/x-pack/plugins/alerting/server/rules_client/common/validate_attributes.ts index b58cc453d5800..7298b24e71cf5 100644 --- a/x-pack/plugins/alerting/server/rules_client/common/validate_attributes.ts +++ b/x-pack/plugins/alerting/server/rules_client/common/validate_attributes.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KueryNode } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; import { get, isEmpty } from 'lodash'; import { alertMappings } from '../../../common/saved_objects/rules/mappings'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; @@ -92,7 +92,7 @@ export const iterateFilterKureyNode = ({ localNestedKeys = ast.value; } else if (ast.type === 'literal' && ast.value && typeof ast.value === 'string') { const key = ast.value.replace('.attributes', ''); - const mappingKey = 'properties.' + key.split('.').join('.properties.'); + const mappingKey = `properties.${key.split('.').join('.properties.')}`; const field = get(alertMappings, mappingKey); if (field != null && field.type === 'nested') { localNestedKeys = ast.value; diff --git a/x-pack/plugins/alerting/server/rules_client/lib/add_generated_action_values.test.ts b/x-pack/plugins/alerting/server/rules_client/lib/add_generated_action_values.test.ts index 9c6dda227b078..e34972fa1a1b1 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/add_generated_action_values.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/add_generated_action_values.test.ts @@ -6,8 +6,8 @@ */ import { addGeneratedActionValues } from './add_generated_action_values'; -import { RuleAction, RuleSystemAction } from '../../../common'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { RuleAction, RuleSystemAction } from '../../../common'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { @@ -17,10 +17,10 @@ import { import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization'; +import type { AlertingAuthorization } from '../../authorization'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; -import { ConstructorOptions } from '../rules_client'; +import type { ConstructorOptions } from '../rules_client'; import { backfillClientMock } from '../../backfill_client/backfill_client.mock'; import { ConnectorAdapterRegistry } from '../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/rules_client/lib/add_generated_action_values.ts b/x-pack/plugins/alerting/server/rules_client/lib/add_generated_action_values.ts index 31e97df2d1705..77051c7330d7a 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/add_generated_action_values.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/add_generated_action_values.ts @@ -6,9 +6,10 @@ */ import { v4 } from 'uuid'; -import { buildEsQuery, Filter } from '@kbn/es-query'; +import type { Filter } from '@kbn/es-query'; +import { buildEsQuery } from '@kbn/es-query'; import Boom from '@hapi/boom'; -import { +import type { NormalizedAlertAction, NormalizedAlertDefaultActionWithGeneratedValues, NormalizedAlertSystemActionWithGeneratedValues, diff --git a/x-pack/plugins/alerting/server/rules_client/lib/check_authorization_and_get_total.ts b/x-pack/plugins/alerting/server/rules_client/lib/check_authorization_and_get_total.ts index 47987868d3ca8..761de9765d5d8 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/check_authorization_and_get_total.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/check_authorization_and_get_total.ts @@ -7,16 +7,17 @@ import pMap from 'p-map'; import Boom from '@hapi/boom'; -import { KueryNode } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; import { withSpan } from '@kbn/apm-utils'; -import { RawRule } from '../../types'; -import { WriteOperations, ReadOperations, AlertingAuthorizationEntity } from '../../authorization'; -import { BulkAction, RuleBulkOperationAggregation } from '../types'; +import type { RawRule } from '../../types'; +import type { ReadOperations } from '../../authorization'; +import { WriteOperations, AlertingAuthorizationEntity } from '../../authorization'; +import type { BulkAction, RuleBulkOperationAggregation } from '../types'; import { MAX_RULES_NUMBER_FOR_BULK_OPERATION, RULE_TYPE_CHECKS_CONCURRENCY, } from '../common/constants'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { ruleAuditEvent, RuleAuditAction } from '../common/audit_events'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/rules_client/lib/create_new_api_key_set.test.ts b/x-pack/plugins/alerting/server/rules_client/lib/create_new_api_key_set.test.ts index d9800cb35a68e..1016089fd035d 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/create_new_api_key_set.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/create_new_api_key_set.test.ts @@ -16,12 +16,12 @@ import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; -import { RawRule } from '../../types'; +import type { AlertingAuthorization } from '../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { RawRule } from '../../types'; import { getBeforeSetup, mockedDateString } from '../tests/lib'; import { createNewAPIKeySet } from './create_new_api_key_set'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { backfillClientMock } from '../../backfill_client/backfill_client.mock'; import { ConnectorAdapterRegistry } from '../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/rules_client/lib/create_new_api_key_set.ts b/x-pack/plugins/alerting/server/rules_client/lib/create_new_api_key_set.ts index a9d0a7ba9674a..5ba9144e438a1 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/create_new_api_key_set.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/create_new_api_key_set.ts @@ -6,9 +6,9 @@ */ import Boom from '@hapi/boom'; -import { RawRule } from '../../types'; +import type { RawRule } from '../../types'; import { generateAPIKeyName, apiKeyAsAlertAttributes } from '../common'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; export async function createNewAPIKeySet( context: RulesClientContext, diff --git a/x-pack/plugins/alerting/server/rules_client/lib/create_rule_saved_object.ts b/x-pack/plugins/alerting/server/rules_client/lib/create_rule_saved_object.ts index 12a81c742f242..1f17067fa12e2 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/create_rule_saved_object.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/create_rule_saved_object.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { SavedObjectReference, SavedObject } from '@kbn/core/server'; +import type { SavedObjectReference, SavedObject } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; -import { Rule, RuleWithLegacyId, RawRule, RuleTypeParams } from '../../types'; +import type { Rule, RuleWithLegacyId, RawRule, RuleTypeParams } from '../../types'; import { bulkMarkApiKeysForInvalidation } from '../../invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation'; import { ruleAuditEvent, RuleAuditAction } from '../common/audit_events'; -import { SavedObjectOptions } from '../types'; -import { RulesClientContext } from '../types'; +import type { SavedObjectOptions } from '../types'; +import type { RulesClientContext } from '../types'; import { updateMeta } from './update_meta'; import { scheduleTask } from './schedule_task'; import { getAlertFromRaw } from './get_alert_from_raw'; diff --git a/x-pack/plugins/alerting/server/rules_client/lib/denormalize_actions.ts b/x-pack/plugins/alerting/server/rules_client/lib/denormalize_actions.ts index 3cd1113a13628..a3e9009ffbc2a 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/denormalize_actions.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/denormalize_actions.ts @@ -4,12 +4,12 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { SavedObjectReference } from '@kbn/core/server'; +import type { SavedObjectReference } from '@kbn/core/server'; import { preconfiguredConnectorActionRefPrefix, systemConnectorActionRefPrefix, } from '../common/constants'; -import { +import type { DenormalizedAction, NormalizedAlertActionWithGeneratedValues, RulesClientContext, diff --git a/x-pack/plugins/alerting/server/rules_client/lib/extract_references.ts b/x-pack/plugins/alerting/server/rules_client/lib/extract_references.ts index 9dfca0897ca08..ef6eb7857e637 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/extract_references.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/extract_references.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { SavedObjectReference } from '@kbn/core/server'; -import { RuleTypeParams } from '../../types'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; -import { DenormalizedAction, NormalizedAlertActionWithGeneratedValues } from '../types'; +import type { SavedObjectReference } from '@kbn/core/server'; +import type { RuleTypeParams } from '../../types'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { DenormalizedAction, NormalizedAlertActionWithGeneratedValues } from '../types'; import { extractedSavedObjectParamReferenceNamePrefix } from '../common/constants'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { denormalizeActions } from './denormalize_actions'; export async function extractReferences< diff --git a/x-pack/plugins/alerting/server/rules_client/lib/get_alert_from_raw.ts b/x-pack/plugins/alerting/server/rules_client/lib/get_alert_from_raw.ts index ed7155770d7f8..3100f922dbe8c 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/get_alert_from_raw.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/get_alert_from_raw.ts @@ -6,8 +6,8 @@ */ import { omit, isEmpty } from 'lodash'; -import { Logger, SavedObjectReference } from '@kbn/core/server'; -import { +import type { Logger, SavedObjectReference } from '@kbn/core/server'; +import type { Rule, PartialRule, RawRule, @@ -22,7 +22,7 @@ import { convertMonitoringFromRawAndVerify, getRuleSnoozeEndTime, } from '../../lib'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; import { getActiveScheduledSnoozes } from '../../lib/is_rule_snoozed'; import { injectReferencesIntoParams } from '../common'; import { diff --git a/x-pack/plugins/alerting/server/rules_client/lib/get_authorization_filter.ts b/x-pack/plugins/alerting/server/rules_client/lib/get_authorization_filter.ts index b9cc41a0fd7c4..33d68f6244d00 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/get_authorization_filter.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/get_authorization_filter.ts @@ -8,9 +8,9 @@ import { withSpan } from '@kbn/apm-utils'; import { AlertingAuthorizationEntity } from '../../authorization'; import { ruleAuditEvent, RuleAuditAction } from '../common/audit_events'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { alertingAuthorizationFilterOpts } from '../common/constants'; -import { BulkAction } from '../types'; +import type { BulkAction } from '../types'; export const getAuthorizationFilter = async ( context: RulesClientContext, diff --git a/x-pack/plugins/alerting/server/rules_client/lib/get_rule_saved_object.ts b/x-pack/plugins/alerting/server/rules_client/lib/get_rule_saved_object.ts index 81952cfc938e1..19c0cc265dcce 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/get_rule_saved_object.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/get_rule_saved_object.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { SavedObject } from '@kbn/core/server'; +import type { SavedObject } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; import { ruleAuditEvent, RuleAuditAction } from '../common/audit_events'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { getRuleSo } from '../../data/rule'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; -import { RawRule } from '../../types'; +import type { RawRule } from '../../types'; interface GetRuleSavedObjectParams { ruleId: string; diff --git a/x-pack/plugins/alerting/server/rules_client/lib/increment_revision.test.ts b/x-pack/plugins/alerting/server/rules_client/lib/increment_revision.test.ts index 766bbdf267652..3bbe1369e5acb 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/increment_revision.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/increment_revision.test.ts @@ -7,10 +7,10 @@ import { mockedDateString } from '../tests/lib'; import { incrementRevision } from './increment_revision'; -import { SavedObject } from '@kbn/core/server'; -import { RawRule, RuleTypeParams } from '../../types'; +import type { SavedObject } from '@kbn/core/server'; +import type { RawRule, RuleTypeParams } from '../../types'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; -import { UpdateRuleData } from '../../application/rule/methods/update'; +import type { UpdateRuleData } from '../../application/rule/methods/update'; describe('incrementRevision', () => { const currentRule: SavedObject = { diff --git a/x-pack/plugins/alerting/server/rules_client/lib/increment_revision.ts b/x-pack/plugins/alerting/server/rules_client/lib/increment_revision.ts index e26d719d59127..06ec885dfabbc 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/increment_revision.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/increment_revision.ts @@ -6,9 +6,9 @@ */ import { get, isEqual } from 'lodash'; -import { RuleTypeParams, RawRule } from '../../types'; +import type { RuleTypeParams, RawRule } from '../../types'; import { fieldsToExcludeFromRevisionUpdates } from '..'; -import { UpdateRuleData } from '../../application/rule/methods/update'; +import type { UpdateRuleData } from '../../application/rule/methods/update'; export function incrementRevision({ originalRule, diff --git a/x-pack/plugins/alerting/server/rules_client/lib/resolve_rule_saved_object.ts b/x-pack/plugins/alerting/server/rules_client/lib/resolve_rule_saved_object.ts index a32f86926c400..fa4da7ace29e3 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/resolve_rule_saved_object.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/resolve_rule_saved_object.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { SavedObjectsResolveResponse } from '@kbn/core/server'; +import type { SavedObjectsResolveResponse } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; import { ruleAuditEvent, RuleAuditAction } from '../common/audit_events'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { resolveRuleSo } from '../../data/rule'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; -import { RawRule } from '../../types'; +import type { RawRule } from '../../types'; interface ResolveRuleSavedObjectParams { ruleId: string; diff --git a/x-pack/plugins/alerting/server/rules_client/lib/schedule_task.ts b/x-pack/plugins/alerting/server/rules_client/lib/schedule_task.ts index c868a2d944075..ab19bba0372d9 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/schedule_task.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/schedule_task.ts @@ -6,8 +6,8 @@ */ import { withSpan } from '@kbn/apm-utils'; -import { RulesClientContext } from '../types'; -import { ScheduleTaskOptions } from '../types'; +import type { RulesClientContext } from '../types'; +import type { ScheduleTaskOptions } from '../types'; export async function scheduleTask(context: RulesClientContext, opts: ScheduleTaskOptions) { const { id, consumer, ruleTypeId, schedule, throwOnConflict } = opts; diff --git a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/format_legacy_actions.test.ts b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/format_legacy_actions.test.ts index 8830ce96a6c43..f06cacb146cc0 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/format_legacy_actions.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/format_legacy_actions.test.ts @@ -10,13 +10,10 @@ import type { SavedObjectsFindResult, SavedObjectAttribute } from '@kbn/core/ser import { loggingSystemMock, savedObjectsClientMock } from '@kbn/core/server/mocks'; -import { Rule } from '../../../types'; +import type { Rule } from '../../../types'; -import { - legacyGetBulkRuleActionsSavedObject, - LegacyActionsObj, - formatLegacyActions, -} from './format_legacy_actions'; +import type { LegacyActionsObj } from './format_legacy_actions'; +import { legacyGetBulkRuleActionsSavedObject, formatLegacyActions } from './format_legacy_actions'; import { legacyRuleActionsSavedObjectType } from './types'; describe('legacyGetBulkRuleActionsSavedObject', () => { diff --git a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/format_legacy_actions.ts b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/format_legacy_actions.ts index 68c6a73b098d6..40da22e9e7aca 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/format_legacy_actions.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/format_legacy_actions.ts @@ -9,12 +9,13 @@ import { chunk } from 'lodash'; import type { SavedObjectsFindOptionsReference, Logger } from '@kbn/core/server'; import pMap from 'p-map'; import { RULE_SAVED_OBJECT_TYPE } from '../../../saved_objects'; -import { RuleAction, Rule } from '../../../types'; +import type { RuleAction, Rule } from '../../../types'; import type { RuleExecutorServices } from '../../..'; import { injectReferencesIntoActions } from '../../common'; import { transformToNotifyWhen } from './transform_to_notify_when'; import { transformFromLegacyActions } from './transform_legacy_actions'; -import { LegacyIRuleActionsAttributes, legacyRuleActionsSavedObjectType } from './types'; +import type { LegacyIRuleActionsAttributes } from './types'; +import { legacyRuleActionsSavedObjectType } from './types'; import { transformToAlertThrottle } from './transform_to_alert_throttle'; /** diff --git a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/migrate_legacy_actions.test.ts b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/migrate_legacy_actions.test.ts index 2dc0d79833229..cf2fd9a029ccf 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/migrate_legacy_actions.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/migrate_legacy_actions.test.ts @@ -13,10 +13,10 @@ import { retrieveMigratedLegacyActions } from './retrieve_migrated_legacy_action import { injectReferencesIntoActions } from '../../common'; import { validateActions } from '../validate_actions'; -import { RulesClientContext } from '../..'; -import { RawRuleAction, RawRule } from '../../../types'; +import type { RulesClientContext } from '../..'; +import type { RawRuleAction, RawRule } from '../../../types'; -import { UntypedNormalizedRuleType } from '../../../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../../../rule_type_registry'; import { RecoveredActionGroup } from '../../../../common'; jest.mock('./retrieve_migrated_legacy_actions', () => ({ diff --git a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/migrate_legacy_actions.ts b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/migrate_legacy_actions.ts index da14fe60e47fb..1bfca0d9ff417 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/migrate_legacy_actions.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/migrate_legacy_actions.ts @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { AlertConsumers } from '@kbn/rule-data-utils'; import type { SavedObjectReference } from '@kbn/core/server'; import type { RulesClientContext } from '../..'; -import { RawRuleAction, RawRule } from '../../../types'; +import type { RawRuleAction, RawRule } from '../../../types'; import { validateActions } from '../validate_actions'; import { retrieveMigratedLegacyActions } from './retrieve_migrated_legacy_actions'; import { transformRawActionsToDomainActions } from '../../../application/rule/transforms/transform_raw_actions_to_domain_actions'; diff --git a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/retrieve_migrated_legacy_actions.ts b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/retrieve_migrated_legacy_actions.ts index d11e679fd1f56..dc69af9bf1110 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/retrieve_migrated_legacy_actions.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/retrieve_migrated_legacy_actions.ts @@ -8,10 +8,11 @@ import type { SavedObjectReference } from '@kbn/core/server'; import { RULE_SAVED_OBJECT_TYPE } from '../../../saved_objects'; import type { RulesClientContext } from '../..'; -import { RawRuleAction } from '../../../types'; +import type { RawRuleAction } from '../../../types'; import { findRules } from '../../../application/rule/methods/find/find_rules'; import { deleteRule } from '../../../application/rule/methods/delete/delete_rule'; -import { LegacyIRuleActionsAttributes, legacyRuleActionsSavedObjectType } from './types'; +import type { LegacyIRuleActionsAttributes } from './types'; +import { legacyRuleActionsSavedObjectType } from './types'; import { transformFromLegacyActions } from './transform_legacy_actions'; type RetrieveMigratedLegacyActions = ( diff --git a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_legacy_actions.test.ts b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_legacy_actions.test.ts index f7d9a70a3c53c..d76a145a6d8a2 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_legacy_actions.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_legacy_actions.test.ts @@ -10,7 +10,7 @@ import type { SavedObjectReference } from '@kbn/core/server'; import { transformFromLegacyActions } from './transform_legacy_actions'; import { transformToNotifyWhen } from './transform_to_notify_when'; -import { LegacyIRuleActionsAttributes } from './types'; +import type { LegacyIRuleActionsAttributes } from './types'; jest.mock('./transform_to_notify_when', () => ({ transformToNotifyWhen: jest.fn(), diff --git a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_legacy_actions.ts b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_legacy_actions.ts index 1218e96a8dfd7..1ad19e9958611 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_legacy_actions.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_legacy_actions.ts @@ -8,9 +8,9 @@ import { v4 } from 'uuid'; import { isEmpty } from 'lodash/fp'; import type { SavedObjectReference } from '@kbn/core/server'; -import { RawRuleAction } from '../../../types'; +import type { RawRuleAction } from '../../../types'; import { transformToNotifyWhen } from './transform_to_notify_when'; -import { LegacyIRuleActionsAttributes } from './types'; +import type { LegacyIRuleActionsAttributes } from './types'; import { transformToAlertThrottle } from './transform_to_alert_throttle'; /** diff --git a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_to_notify_when.ts b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_to_notify_when.ts index 76c43617adc22..3f21909a90a02 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_to_notify_when.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/transform_to_notify_when.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { RuleNotifyWhenType } from '../../../../common'; +import type { RuleNotifyWhenType } from '../../../../common'; /** * Given a throttle from a "security_solution" rule this will transform it into an "alerting" notifyWhen diff --git a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/types.ts b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/types.ts index 487f18807d35b..d696239c8c0ea 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/types.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/siem_legacy_actions/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RuleActionParams } from '../../../types'; +import type { RuleActionParams } from '../../../types'; import type { RuleTypeParams } from '../../..'; import type { Rule } from '../../../../common'; diff --git a/x-pack/plugins/alerting/server/rules_client/lib/untrack_rule_alerts.ts b/x-pack/plugins/alerting/server/rules_client/lib/untrack_rule_alerts.ts index 0e2063a3738ad..de4ef0c156ec2 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/untrack_rule_alerts.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/untrack_rule_alerts.ts @@ -8,12 +8,12 @@ import { mapValues } from 'lodash'; import { SAVED_OBJECT_REL_PRIMARY } from '@kbn/event-log-plugin/server'; import { withSpan } from '@kbn/apm-utils'; -import { SanitizedRule, RawAlertInstance as RawAlert, RawRule } from '../../types'; +import type { SanitizedRule, RawAlertInstance as RawAlert, RawRule } from '../../types'; import { taskInstanceToAlertTaskInstance } from '../../task_runner/alert_task_instance'; import { Alert } from '../../alert'; import { EVENT_LOG_ACTIONS } from '../../plugin'; import { createAlertEventLogRecordObject } from '../../lib/create_alert_event_log_record_object'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; export const untrackRuleAlerts = async ( diff --git a/x-pack/plugins/alerting/server/rules_client/lib/update_meta.ts b/x-pack/plugins/alerting/server/rules_client/lib/update_meta.ts index 1f87dd0e2d6ee..be5a096ec69ef 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/update_meta.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/update_meta.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RawRule } from '../../types'; -import { RulesClientContext } from '../types'; +import type { RawRule } from '../../types'; +import type { RulesClientContext } from '../types'; /** * @deprecated Use updateMetaAttributes instead diff --git a/x-pack/plugins/alerting/server/rules_client/lib/update_meta_attributes.ts b/x-pack/plugins/alerting/server/rules_client/lib/update_meta_attributes.ts index f3c5ed48839ce..7f117ed9c20ed 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/update_meta_attributes.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/update_meta_attributes.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RawRule } from '../../types'; -import { RulesClientContext } from '../types'; +import type { RawRule } from '../../types'; +import type { RulesClientContext } from '../types'; export function updateMetaAttributes>( context: RulesClientContext, diff --git a/x-pack/plugins/alerting/server/rules_client/lib/validate_actions.test.ts b/x-pack/plugins/alerting/server/rules_client/lib/validate_actions.test.ts index e565f8b1b51ed..49dcad216ccd0 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/validate_actions.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/validate_actions.test.ts @@ -5,10 +5,12 @@ * 2.0. */ -import { validateActions, ValidateActionsData } from './validate_actions'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; -import { AlertsFilter, RecoveredActionGroup, RuleAction, RuleNotifyWhen } from '../../../common'; -import { NormalizedAlertAction, NormalizedSystemAction, RulesClientContext } from '..'; +import type { ValidateActionsData } from './validate_actions'; +import { validateActions } from './validate_actions'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { AlertsFilter, RuleAction } from '../../../common'; +import { RecoveredActionGroup, RuleNotifyWhen } from '../../../common'; +import type { NormalizedAlertAction, NormalizedSystemAction, RulesClientContext } from '..'; describe('validateActions', () => { const loggerErrorMock = jest.fn(); diff --git a/x-pack/plugins/alerting/server/rules_client/lib/validate_actions.ts b/x-pack/plugins/alerting/server/rules_client/lib/validate_actions.ts index 4f5be980bae89..ce359711e81dd 100644 --- a/x-pack/plugins/alerting/server/rules_client/lib/validate_actions.ts +++ b/x-pack/plugins/alerting/server/rules_client/lib/validate_actions.ts @@ -9,10 +9,11 @@ import Boom from '@hapi/boom'; import { map } from 'lodash'; import { i18n } from '@kbn/i18n'; import { validateHours } from '../../routes/lib/validate_hours'; -import { RawRule, RuleNotifyWhen } from '../../types'; -import { UntypedNormalizedRuleType } from '../../rule_type_registry'; -import { NormalizedAlertAction, NormalizedSystemAction } from '../types'; -import { RulesClientContext } from '../types'; +import type { RawRule } from '../../types'; +import { RuleNotifyWhen } from '../../types'; +import type { UntypedNormalizedRuleType } from '../../rule_type_registry'; +import type { NormalizedAlertAction, NormalizedSystemAction } from '../types'; +import type { RulesClientContext } from '../types'; import { parseDuration } from '../../lib'; export type ValidateActionsData = Pick & { diff --git a/x-pack/plugins/alerting/server/rules_client/methods/get_action_error_log.ts b/x-pack/plugins/alerting/server/rules_client/methods/get_action_error_log.ts index a7d60fc8f8ca4..c77ab61f9c61f 100644 --- a/x-pack/plugins/alerting/server/rules_client/methods/get_action_error_log.ts +++ b/x-pack/plugins/alerting/server/rules_client/methods/get_action_error_log.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { KueryNode } from '@kbn/es-query'; +import type { KueryNode } from '@kbn/es-query'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { SanitizedRuleWithLegacyId } from '../../types'; +import type { SanitizedRuleWithLegacyId } from '../../types'; import { convertEsSortToEventLogSort } from '../../lib'; import { ReadOperations, @@ -15,10 +15,10 @@ import { AlertingAuthorizationFilterType, } from '../../authorization'; import { ruleAuditEvent, RuleAuditAction } from '../common/audit_events'; -import { IExecutionErrorsResult } from '../../../common'; +import type { IExecutionErrorsResult } from '../../../common'; import { formatExecutionErrorsResult } from '../../lib/format_execution_log_errors'; import { parseDate } from '../common'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { getRule } from '../../application/rule/methods/get/get_rule'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/rules_client/methods/get_alert_state.ts b/x-pack/plugins/alerting/server/rules_client/methods/get_alert_state.ts index d9121fef0be4c..eaf0ac661651b 100644 --- a/x-pack/plugins/alerting/server/rules_client/methods/get_alert_state.ts +++ b/x-pack/plugins/alerting/server/rules_client/methods/get_alert_state.ts @@ -6,10 +6,10 @@ */ import { SavedObjectsErrorHelpers } from '@kbn/core-saved-objects-server'; -import { RuleTaskState } from '../../types'; +import type { RuleTaskState } from '../../types'; import { taskInstanceToAlertTaskInstance } from '../../task_runner/alert_task_instance'; import { ReadOperations, AlertingAuthorizationEntity } from '../../authorization'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { getRule } from '../../application/rule/methods/get/get_rule'; export interface GetAlertStateParams { diff --git a/x-pack/plugins/alerting/server/rules_client/methods/get_alert_summary.ts b/x-pack/plugins/alerting/server/rules_client/methods/get_alert_summary.ts index 27af513ae663c..579e5a5710494 100644 --- a/x-pack/plugins/alerting/server/rules_client/methods/get_alert_summary.ts +++ b/x-pack/plugins/alerting/server/rules_client/methods/get_alert_summary.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { IEvent } from '@kbn/event-log-plugin/server'; -import { AlertSummary, SanitizedRuleWithLegacyId } from '../../types'; +import type { IEvent } from '@kbn/event-log-plugin/server'; +import type { AlertSummary, SanitizedRuleWithLegacyId } from '../../types'; import { ReadOperations, AlertingAuthorizationEntity } from '../../authorization'; import { alertSummaryFromEventLog } from '../../lib/alert_summary_from_event_log'; import { parseDuration } from '../../../common/parse_duration'; import { parseDate } from '../common'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { getRule } from '../../application/rule/methods/get/get_rule'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/rules_client/methods/get_execution_kpi.ts b/x-pack/plugins/alerting/server/rules_client/methods/get_execution_kpi.ts index fc2c1298f69ac..2213527d582dc 100644 --- a/x-pack/plugins/alerting/server/rules_client/methods/get_execution_kpi.ts +++ b/x-pack/plugins/alerting/server/rules_client/methods/get_execution_kpi.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { KueryNode } from '@kbn/es-query'; -import { SanitizedRuleWithLegacyId } from '../../types'; +import type { KueryNode } from '@kbn/es-query'; +import type { SanitizedRuleWithLegacyId } from '../../types'; import { ReadOperations, AlertingAuthorizationEntity, @@ -17,7 +17,7 @@ import { formatExecutionKPIResult, getExecutionKPIAggregation, } from '../../lib/get_execution_log_aggregation'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { parseDate } from '../common'; import { getRule } from '../../application/rule/methods/get/get_rule'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/rules_client/methods/get_execution_log.ts b/x-pack/plugins/alerting/server/rules_client/methods/get_execution_log.ts index 18d65c28fc9bb..8a2cbe1dda638 100644 --- a/x-pack/plugins/alerting/server/rules_client/methods/get_execution_log.ts +++ b/x-pack/plugins/alerting/server/rules_client/methods/get_execution_log.ts @@ -6,8 +6,8 @@ */ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { KueryNode } from '@kbn/es-query'; -import { SanitizedRuleWithLegacyId } from '../../types'; +import type { KueryNode } from '@kbn/es-query'; +import type { SanitizedRuleWithLegacyId } from '../../types'; import { ReadOperations, AlertingAuthorizationEntity, @@ -18,9 +18,9 @@ import { formatExecutionLogResult, getExecutionLogAggregation, } from '../../lib/get_execution_log_aggregation'; -import { IExecutionLogResult } from '../../../common'; +import type { IExecutionLogResult } from '../../../common'; import { parseDate } from '../common'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { getRule } from '../../application/rule/methods/get/get_rule'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/rules_client/methods/run_soon.ts b/x-pack/plugins/alerting/server/rules_client/methods/run_soon.ts index 9a7907178fc83..7f4d655fe51d9 100644 --- a/x-pack/plugins/alerting/server/rules_client/methods/run_soon.ts +++ b/x-pack/plugins/alerting/server/rules_client/methods/run_soon.ts @@ -6,11 +6,12 @@ */ import { i18n } from '@kbn/i18n'; -import { ConcreteTaskInstance, TaskStatus } from '@kbn/task-manager-plugin/server'; -import { Rule } from '../../types'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { TaskStatus } from '@kbn/task-manager-plugin/server'; +import type { Rule } from '../../types'; import { WriteOperations, AlertingAuthorizationEntity } from '../../authorization'; import { ruleAuditEvent, RuleAuditAction } from '../common/audit_events'; -import { RulesClientContext } from '../types'; +import type { RulesClientContext } from '../types'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; export async function runSoon(context: RulesClientContext, { id }: { id: string }) { diff --git a/x-pack/plugins/alerting/server/rules_client/rules_client.ts b/x-pack/plugins/alerting/server/rules_client/rules_client.ts index 4c86469f11a29..d76259cc32f25 100644 --- a/x-pack/plugins/alerting/server/rules_client/rules_client.ts +++ b/x-pack/plugins/alerting/server/rules_client/rules_client.ts @@ -5,55 +5,57 @@ * 2.0. */ -import { UnmuteAlertParams } from '../application/rule/methods/unmute_alert/types'; -import { getRuleTags, RuleTagsParams } from '../application/rule/methods/tags'; -import { MuteAlertParams } from '../application/rule/methods/mute_alert/types'; -import { SanitizedRule, RuleTypeParams } from '../types'; +import type { UnmuteAlertParams } from '../application/rule/methods/unmute_alert/types'; +import type { RuleTagsParams } from '../application/rule/methods/tags'; +import { getRuleTags } from '../application/rule/methods/tags'; +import type { MuteAlertParams } from '../application/rule/methods/mute_alert/types'; +import type { SanitizedRule, RuleTypeParams } from '../types'; import { parseDuration } from '../../common/parse_duration'; -import { RulesClientContext } from './types'; -import { cloneRule, CloneRuleParams } from '../application/rule/methods/clone'; -import { createRule, CreateRuleParams } from '../application/rule/methods/create'; -import { updateRule, UpdateRuleParams } from '../application/rule/methods/update'; -import { snoozeRule, SnoozeRuleOptions } from '../application/rule/methods/snooze'; -import { unsnoozeRule, UnsnoozeParams } from '../application/rule/methods/unsnooze'; -import { getRule, GetRuleParams } from '../application/rule/methods/get'; -import { resolveRule, ResolveParams } from '../application/rule/methods/resolve'; -import { getAlertState, GetAlertStateParams } from './methods/get_alert_state'; -import { getAlertSummary, GetAlertSummaryParams } from './methods/get_alert_summary'; -import { +import type { RulesClientContext } from './types'; +import type { CloneRuleParams } from '../application/rule/methods/clone'; +import { cloneRule } from '../application/rule/methods/clone'; +import type { CreateRuleParams } from '../application/rule/methods/create'; +import { createRule } from '../application/rule/methods/create'; +import type { UpdateRuleParams } from '../application/rule/methods/update'; +import { updateRule } from '../application/rule/methods/update'; +import type { SnoozeRuleOptions } from '../application/rule/methods/snooze'; +import { snoozeRule } from '../application/rule/methods/snooze'; +import type { UnsnoozeParams } from '../application/rule/methods/unsnooze'; +import { unsnoozeRule } from '../application/rule/methods/unsnooze'; +import type { GetRuleParams } from '../application/rule/methods/get'; +import { getRule } from '../application/rule/methods/get'; +import type { ResolveParams } from '../application/rule/methods/resolve'; +import { resolveRule } from '../application/rule/methods/resolve'; +import type { GetAlertStateParams } from './methods/get_alert_state'; +import { getAlertState } from './methods/get_alert_state'; +import type { GetAlertSummaryParams } from './methods/get_alert_summary'; +import { getAlertSummary } from './methods/get_alert_summary'; +import type { GetExecutionLogByIdParams, - getExecutionLogForRule, GetGlobalExecutionLogParams, - getGlobalExecutionLogWithAuth, } from './methods/get_execution_log'; -import { - getActionErrorLog, - GetActionErrorLogByIdParams, - getActionErrorLogWithAuth, -} from './methods/get_action_error_log'; -import { +import { getExecutionLogForRule, getGlobalExecutionLogWithAuth } from './methods/get_execution_log'; +import type { GetActionErrorLogByIdParams } from './methods/get_action_error_log'; +import { getActionErrorLog, getActionErrorLogWithAuth } from './methods/get_action_error_log'; +import type { GetGlobalExecutionKPIParams, - getGlobalExecutionKpiWithAuth, - getRuleExecutionKPI, GetRuleExecutionKPIParams, } from './methods/get_execution_kpi'; -import { findRules, FindRulesParams } from '../application/rule/methods/find'; -import { AggregateParams } from '../application/rule/methods/aggregate/types'; +import { getGlobalExecutionKpiWithAuth, getRuleExecutionKPI } from './methods/get_execution_kpi'; +import type { FindRulesParams } from '../application/rule/methods/find'; +import { findRules } from '../application/rule/methods/find'; +import type { AggregateParams } from '../application/rule/methods/aggregate/types'; import { aggregateRules } from '../application/rule/methods/aggregate'; -import { deleteRule, DeleteRuleParams } from '../application/rule/methods/delete'; -import { - bulkDeleteRules, - BulkDeleteRulesRequestBody, -} from '../application/rule/methods/bulk_delete'; -import { - bulkDisableRules, - BulkDisableRulesRequestBody, -} from '../application/rule/methods/bulk_disable'; -import { - bulkEditRules, - BulkEditOptions, -} from '../application/rule/methods/bulk_edit/bulk_edit_rules'; -import { bulkEnableRules, BulkEnableRulesParams } from '../application/rule/methods/bulk_enable'; +import type { DeleteRuleParams } from '../application/rule/methods/delete'; +import { deleteRule } from '../application/rule/methods/delete'; +import type { BulkDeleteRulesRequestBody } from '../application/rule/methods/bulk_delete'; +import { bulkDeleteRules } from '../application/rule/methods/bulk_delete'; +import type { BulkDisableRulesRequestBody } from '../application/rule/methods/bulk_disable'; +import { bulkDisableRules } from '../application/rule/methods/bulk_disable'; +import type { BulkEditOptions } from '../application/rule/methods/bulk_edit/bulk_edit_rules'; +import { bulkEditRules } from '../application/rule/methods/bulk_edit/bulk_edit_rules'; +import type { BulkEnableRulesParams } from '../application/rule/methods/bulk_enable'; +import { bulkEnableRules } from '../application/rule/methods/bulk_enable'; import { enableRule } from '../application/rule/methods/enable_rule/enable_rule'; import { updateRuleApiKey } from '../application/rule/methods/update_api_key/update_rule_api_key'; import { disableRule } from '../application/rule/methods/disable/disable_rule'; @@ -64,18 +66,16 @@ import { unmuteInstance } from '../application/rule/methods/unmute_alert/unmute_ import { runSoon } from './methods/run_soon'; import { listRuleTypes } from '../application/rule/methods/rule_types/rule_types'; import { getScheduleFrequency } from '../application/rule/methods/get_schedule_frequency/get_schedule_frequency'; -import { - bulkUntrackAlerts, - BulkUntrackBody, -} from '../application/rule/methods/bulk_untrack/bulk_untrack_alerts'; -import { ScheduleBackfillParams } from '../application/backfill/methods/schedule/types'; +import type { BulkUntrackBody } from '../application/rule/methods/bulk_untrack/bulk_untrack_alerts'; +import { bulkUntrackAlerts } from '../application/rule/methods/bulk_untrack/bulk_untrack_alerts'; +import type { ScheduleBackfillParams } from '../application/backfill/methods/schedule/types'; import { scheduleBackfill } from '../application/backfill/methods/schedule'; import { getBackfill } from '../application/backfill/methods/get'; import { findBackfill } from '../application/backfill/methods/find'; import { deleteBackfill } from '../application/backfill/methods/delete'; -import { FindBackfillParams } from '../application/backfill/methods/find/types'; -import { DisableRuleParams } from '../application/rule/methods/disable'; -import { EnableRuleParams } from '../application/rule/methods/enable_rule'; +import type { FindBackfillParams } from '../application/backfill/methods/find/types'; +import type { DisableRuleParams } from '../application/rule/methods/disable'; +import type { EnableRuleParams } from '../application/rule/methods/enable_rule'; export type ConstructorOptions = Omit< RulesClientContext, diff --git a/x-pack/plugins/alerting/server/rules_client/tests/get_action_error_log.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/get_action_error_log.test.ts index 152474ee9fb48..118b03301306b 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/get_action_error_log.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/get_action_error_log.test.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../rules_client'; -import { GetActionErrorLogByIdParams } from '../methods/get_action_error_log'; +import type { ConstructorOptions } from '../rules_client'; +import { RulesClient } from '../rules_client'; +import type { GetActionErrorLogByIdParams } from '../methods/get_action_error_log'; import { savedObjectsClientMock, loggingSystemMock, @@ -19,11 +20,11 @@ import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { eventLogClientMock } from '@kbn/event-log-plugin/server/mocks'; -import { SavedObject } from '@kbn/core/server'; -import { RawRule } from '../../types'; +import type { SavedObject } from '@kbn/core/server'; +import type { RawRule } from '../../types'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, mockedDateString, setGlobalDate } from './lib'; import { ConnectorAdapterRegistry } from '../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/rules_client/tests/get_alert_state.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/get_alert_state.test.ts index c1a1824066efe..bdac7b07dd1af 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/get_alert_state.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/get_alert_state.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../rules_client'; +import type { ConstructorOptions } from '../rules_client'; +import { RulesClient } from '../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -18,8 +19,8 @@ import { alertingAuthorizationMock } from '../../authorization/alerting_authoriz import { TaskStatus } from '@kbn/task-manager-plugin/server'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { getBeforeSetup } from './lib'; import { ConnectorAdapterRegistry } from '../../connector_adapters/connector_adapter_registry'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/rules_client/tests/get_alert_summary.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/get_alert_summary.test.ts index 77e3d19a37540..08dd2b47ed6f5 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/get_alert_summary.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/get_alert_summary.test.ts @@ -6,7 +6,8 @@ */ import { omit, mean } from 'lodash'; -import { RulesClient, ConstructorOptions } from '../rules_client'; +import type { ConstructorOptions } from '../rules_client'; +import { RulesClient } from '../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -18,13 +19,13 @@ import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { eventLogClientMock } from '@kbn/event-log-plugin/server/mocks'; -import { QueryEventsBySavedObjectResult } from '@kbn/event-log-plugin/server'; -import { SavedObject } from '@kbn/core/server'; +import type { QueryEventsBySavedObjectResult } from '@kbn/event-log-plugin/server'; +import type { SavedObject } from '@kbn/core/server'; import { EventsFactory } from '../../lib/alert_summary_from_event_log.test'; -import { RawRule } from '../../types'; +import type { RawRule } from '../../types'; import { getBeforeSetup, mockedDateString, setGlobalDate } from './lib'; import { ConnectorAdapterRegistry } from '../../connector_adapters/connector_adapter_registry'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/rules_client/tests/get_execution_log.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/get_execution_log.test.ts index 3a3f801dd9085..728509e70eec5 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/get_execution_log.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/get_execution_log.test.ts @@ -6,7 +6,8 @@ */ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { RulesClient, ConstructorOptions } from '../rules_client'; +import type { ConstructorOptions } from '../rules_client'; +import { RulesClient } from '../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -18,11 +19,11 @@ import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { eventLogClientMock } from '@kbn/event-log-plugin/server/mocks'; -import { SavedObject } from '@kbn/core/server'; -import { RawRule } from '../../types'; +import type { SavedObject } from '@kbn/core/server'; +import type { RawRule } from '../../types'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, mockedDateString, setGlobalDate } from './lib'; import { getExecutionLogAggregation } from '../../lib/get_execution_log_aggregation'; diff --git a/x-pack/plugins/alerting/server/rules_client/tests/lib.ts b/x-pack/plugins/alerting/server/rules_client/tests/lib.ts index 386cfe8f41eec..bfc386763ba7d 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/lib.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/lib.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { IEventLogClient } from '@kbn/event-log-plugin/server'; +import type { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; +import type { IEventLogClient } from '@kbn/event-log-plugin/server'; import { actionsClientMock } from '@kbn/actions-plugin/server/mocks'; import { eventLogClientMock } from '@kbn/event-log-plugin/server/mocks'; import { TaskStatus } from '@kbn/task-manager-plugin/server'; import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks'; -import { ConstructorOptions } from '../rules_client'; -import { RuleTypeRegistry } from '../../rule_type_registry'; +import type { ConstructorOptions } from '../rules_client'; +import type { RuleTypeRegistry } from '../../rule_type_registry'; import { RecoveredActionGroup } from '../../../common'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/rules_client/tests/list_rule_types.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/list_rule_types.test.ts index b096ec1c75f7d..063b9de65019f 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/list_rule_types.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/list_rule_types.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../rules_client'; +import type { ConstructorOptions } from '../rules_client'; +import { RulesClient } from '../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -17,14 +18,14 @@ import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { +import type { AlertingAuthorization, RegistryAlertTypeWithAuth, } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { getBeforeSetup } from './lib'; import { RecoveredActionGroup } from '../../../common'; -import { RegistryRuleType } from '../../rule_type_registry'; +import type { RegistryRuleType } from '../../rule_type_registry'; import { backfillClientMock } from '../../backfill_client/backfill_client.mock'; import { ConnectorAdapterRegistry } from '../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/rules_client/tests/mute_all.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/mute_all.test.ts index c79df2a4986c8..c02bf3913c650 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/mute_all.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/mute_all.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../rules_client'; +import type { ConstructorOptions } from '../rules_client'; +import { RulesClient } from '../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -17,8 +18,8 @@ import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from './lib'; import { ConnectorAdapterRegistry } from '../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/rules_client/tests/mute_instance.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/mute_instance.test.ts index 1ae6f38a400d4..b736c067c50f4 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/mute_instance.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/mute_instance.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../rules_client'; +import type { ConstructorOptions } from '../rules_client'; +import { RulesClient } from '../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -17,8 +18,8 @@ import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from './lib'; import { ConnectorAdapterRegistry } from '../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/rules_client/tests/resolve.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/resolve.test.ts index b69878fc5ae99..97159059dcd90 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/resolve.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/resolve.test.ts @@ -6,7 +6,8 @@ */ import { AlertConsumers } from '@kbn/rule-data-utils'; -import { RulesClient, ConstructorOptions } from '../rules_client'; +import type { ConstructorOptions } from '../rules_client'; +import { RulesClient } from '../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -18,8 +19,8 @@ import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from './lib'; import { RecoveredActionGroup } from '../../../common'; diff --git a/x-pack/plugins/alerting/server/rules_client/tests/run_soon.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/run_soon.test.ts index bc77cc424df8e..aab017e64389e 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/run_soon.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/run_soon.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../rules_client'; +import type { ConstructorOptions } from '../rules_client'; +import { RulesClient } from '../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -17,8 +18,8 @@ import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { TaskStatus } from '@kbn/task-manager-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from './lib'; diff --git a/x-pack/plugins/alerting/server/rules_client/tests/unmute_all.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/unmute_all.test.ts index d4cdb4b1b851b..f2000b0021f98 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/unmute_all.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/unmute_all.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClient, ConstructorOptions } from '../rules_client'; +import type { ConstructorOptions } from '../rules_client'; +import { RulesClient } from '../rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -17,8 +18,8 @@ import { ruleTypeRegistryMock } from '../../rule_type_registry.mock'; import { alertingAuthorizationMock } from '../../authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from '../../authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from '../../authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; import { getBeforeSetup, setGlobalDate } from './lib'; import { ConnectorAdapterRegistry } from '../../connector_adapters/connector_adapter_registry'; diff --git a/x-pack/plugins/alerting/server/rules_client/types.ts b/x-pack/plugins/alerting/server/rules_client/types.ts index 9a701e1c95c81..7fb9f39208245 100644 --- a/x-pack/plugins/alerting/server/rules_client/types.ts +++ b/x-pack/plugins/alerting/server/rules_client/types.ts @@ -5,26 +5,26 @@ * 2.0. */ -import { KueryNode } from '@kbn/es-query'; -import { +import type { KueryNode } from '@kbn/es-query'; +import type { Logger, SavedObjectsClientContract, PluginInitializerContext, ISavedObjectsRepository, UiSettingsServiceStart, } from '@kbn/core/server'; -import { ActionsClient, ActionsAuthorization } from '@kbn/actions-plugin/server'; -import { +import type { ActionsClient, ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { GrantAPIKeyResult as SecurityPluginGrantAPIKeyResult, InvalidateAPIKeyResult as SecurityPluginInvalidateAPIKeyResult, } from '@kbn/security-plugin/server'; -import { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server'; -import { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; -import { IEventLogClient, IEventLogger } from '@kbn/event-log-plugin/server'; -import { AuditLogger } from '@kbn/security-plugin/server'; -import { DistributiveOmit } from '@elastic/eui'; -import { RegistryRuleType } from '../rule_type_registry'; -import { +import type { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; +import type { IEventLogClient, IEventLogger } from '@kbn/event-log-plugin/server'; +import type { AuditLogger } from '@kbn/security-plugin/server'; +import type { DistributiveOmit } from '@elastic/eui'; +import type { RegistryRuleType } from '../rule_type_registry'; +import type { RuleTypeRegistry, IntervalSchedule, SanitizedRule, @@ -33,12 +33,12 @@ import { RuleSystemAction, RuleAction, } from '../types'; -import { AlertingAuthorization } from '../authorization'; -import { AlertingRulesConfig } from '../config'; -import { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; -import { GetAlertIndicesAlias } from '../lib'; -import { AlertsService } from '../alerts_service'; -import { BackfillClient } from '../backfill_client/backfill_client'; +import type { AlertingAuthorization } from '../authorization'; +import type { AlertingRulesConfig } from '../config'; +import type { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; +import type { GetAlertIndicesAlias } from '../lib'; +import type { AlertsService } from '../alerts_service'; +import type { BackfillClient } from '../backfill_client/backfill_client'; export type { BulkEditOperation, diff --git a/x-pack/plugins/alerting/server/rules_client_conflict_retries.test.ts b/x-pack/plugins/alerting/server/rules_client_conflict_retries.test.ts index 6bf8d7a5b9fb3..0a958466bd854 100644 --- a/x-pack/plugins/alerting/server/rules_client_conflict_retries.test.ts +++ b/x-pack/plugins/alerting/server/rules_client_conflict_retries.test.ts @@ -7,7 +7,8 @@ import { cloneDeep } from 'lodash'; -import { RulesClient, ConstructorOptions } from './rules_client'; +import type { ConstructorOptions } from './rules_client'; +import { RulesClient } from './rules_client'; import { savedObjectsClientMock, loggingSystemMock, @@ -19,8 +20,8 @@ import { ruleTypeRegistryMock } from './rule_type_registry.mock'; import { alertingAuthorizationMock } from './authorization/alerting_authorization.mock'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { actionsClientMock, actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; -import { AlertingAuthorization } from './authorization/alerting_authorization'; -import { ActionsAuthorization } from '@kbn/actions-plugin/server'; +import type { AlertingAuthorization } from './authorization/alerting_authorization'; +import type { ActionsAuthorization } from '@kbn/actions-plugin/server'; import { SavedObjectsErrorHelpers } from '@kbn/core/server'; import { RetryForConflictsAttempts } from './lib/retry_if_conflicts'; import { TaskStatus } from '@kbn/task-manager-plugin/server/task'; diff --git a/x-pack/plugins/alerting/server/rules_client_factory.test.ts b/x-pack/plugins/alerting/server/rules_client_factory.test.ts index 4cd7ffbcf0c6c..6af66b44494a1 100644 --- a/x-pack/plugins/alerting/server/rules_client_factory.test.ts +++ b/x-pack/plugins/alerting/server/rules_client_factory.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { RulesClientFactory, RulesClientFactoryOpts } from './rules_client_factory'; +import type { RulesClientFactoryOpts } from './rules_client_factory'; +import { RulesClientFactory } from './rules_client_factory'; import { ruleTypeRegistryMock } from './rule_type_registry.mock'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; import { @@ -17,15 +18,15 @@ import { securityServiceMock, } from '@kbn/core/server/mocks'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; -import { AuthenticatedUser } from '@kbn/security-plugin/common'; +import type { AuthenticatedUser } from '@kbn/security-plugin/common'; import { securityMock } from '@kbn/security-plugin/server/mocks'; -import { PluginStartContract as ActionsStartContract } from '@kbn/actions-plugin/server'; +import type { PluginStartContract as ActionsStartContract } from '@kbn/actions-plugin/server'; import { actionsMock, actionsAuthorizationMock } from '@kbn/actions-plugin/server/mocks'; import { eventLogMock } from '@kbn/event-log-plugin/server/mocks'; import { alertingAuthorizationMock } from './authorization/alerting_authorization.mock'; import { alertingAuthorizationClientFactoryMock } from './alerting_authorization_client_factory.mock'; -import { AlertingAuthorization } from './authorization'; -import { AlertingAuthorizationClientFactory } from './alerting_authorization_client_factory'; +import type { AlertingAuthorization } from './authorization'; +import type { AlertingAuthorizationClientFactory } from './alerting_authorization_client_factory'; import { SECURITY_EXTENSION_ID } from '@kbn/core-saved-objects-server'; import { mockRouter } from '@kbn/core-http-router-server-mocks'; import { diff --git a/x-pack/plugins/alerting/server/rules_client_factory.ts b/x-pack/plugins/alerting/server/rules_client_factory.ts index f28170b277ac4..f275442fc829c 100644 --- a/x-pack/plugins/alerting/server/rules_client_factory.ts +++ b/x-pack/plugins/alerting/server/rules_client_factory.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { +import type { KibanaRequest, Logger, SavedObjectsServiceStart, @@ -13,29 +13,26 @@ import { ISavedObjectsRepository, CoreStart, } from '@kbn/core/server'; -import { PluginStartContract as ActionsPluginStartContract } from '@kbn/actions-plugin/server'; -import { - HTTPAuthorizationHeader, - SecurityPluginSetup, - SecurityPluginStart, -} from '@kbn/security-plugin/server'; -import { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server'; -import { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; -import { IEventLogClientService, IEventLogger } from '@kbn/event-log-plugin/server'; +import type { PluginStartContract as ActionsPluginStartContract } from '@kbn/actions-plugin/server'; +import type { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server'; +import { HTTPAuthorizationHeader } from '@kbn/security-plugin/server'; +import type { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; +import type { IEventLogClientService, IEventLogger } from '@kbn/event-log-plugin/server'; import { SECURITY_EXTENSION_ID } from '@kbn/core-saved-objects-server'; -import { RuleTypeRegistry, SpaceIdToNamespaceFunction } from './types'; +import type { RuleTypeRegistry, SpaceIdToNamespaceFunction } from './types'; import { RulesClient } from './rules_client'; -import { AlertingAuthorizationClientFactory } from './alerting_authorization_client_factory'; -import { AlertingRulesConfig } from './config'; -import { GetAlertIndicesAlias } from './lib'; -import { AlertsService } from './alerts_service/alerts_service'; -import { BackfillClient } from './backfill_client/backfill_client'; +import type { AlertingAuthorizationClientFactory } from './alerting_authorization_client_factory'; +import type { AlertingRulesConfig } from './config'; +import type { GetAlertIndicesAlias } from './lib'; +import type { AlertsService } from './alerts_service/alerts_service'; +import type { BackfillClient } from './backfill_client/backfill_client'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE, API_KEY_PENDING_INVALIDATION_TYPE, RULE_SAVED_OBJECT_TYPE, } from './saved_objects'; -import { ConnectorAdapterRegistry } from './connector_adapters/connector_adapter_registry'; +import type { ConnectorAdapterRegistry } from './connector_adapters/connector_adapter_registry'; export interface RulesClientFactoryOpts { logger: Logger; taskManager: TaskManagerStartContract; diff --git a/x-pack/plugins/alerting/server/rules_settings/flapping/rules_settings_flapping_client.test.ts b/x-pack/plugins/alerting/server/rules_settings/flapping/rules_settings_flapping_client.test.ts index 213d1a94a38eb..4175fc2ecb420 100644 --- a/x-pack/plugins/alerting/server/rules_settings/flapping/rules_settings_flapping_client.test.ts +++ b/x-pack/plugins/alerting/server/rules_settings/flapping/rules_settings_flapping_client.test.ts @@ -5,17 +5,15 @@ * 2.0. */ -import { - RulesSettingsFlappingClient, - RulesSettingsFlappingClientConstructorOptions, -} from './rules_settings_flapping_client'; +import type { RulesSettingsFlappingClientConstructorOptions } from './rules_settings_flapping_client'; +import { RulesSettingsFlappingClient } from './rules_settings_flapping_client'; import { savedObjectsClientMock, loggingSystemMock } from '@kbn/core/server/mocks'; +import type { RulesSettings } from '../../../common'; import { RULES_SETTINGS_FEATURE_ID, RULES_SETTINGS_SAVED_OBJECT_TYPE, RULES_SETTINGS_FLAPPING_SAVED_OBJECT_ID, DEFAULT_FLAPPING_SETTINGS, - RulesSettings, } from '../../../common'; import { SavedObjectsErrorHelpers } from '@kbn/core-saved-objects-server'; diff --git a/x-pack/plugins/alerting/server/rules_settings/flapping/rules_settings_flapping_client.ts b/x-pack/plugins/alerting/server/rules_settings/flapping/rules_settings_flapping_client.ts index b9cfbe550af79..3f78bfa6f51b0 100644 --- a/x-pack/plugins/alerting/server/rules_settings/flapping/rules_settings_flapping_client.ts +++ b/x-pack/plugins/alerting/server/rules_settings/flapping/rules_settings_flapping_client.ts @@ -6,23 +6,21 @@ */ import Boom from '@hapi/boom'; -import { - Logger, - SavedObjectsClientContract, - SavedObject, - SavedObjectsErrorHelpers, -} from '@kbn/core/server'; +import type { Logger, SavedObjectsClientContract, SavedObject } from '@kbn/core/server'; +import { SavedObjectsErrorHelpers } from '@kbn/core/server'; import { MAX_LOOK_BACK_WINDOW, MAX_STATUS_CHANGE_THRESHOLD, MIN_LOOK_BACK_WINDOW, MIN_STATUS_CHANGE_THRESHOLD, } from '@kbn/alerting-types/flapping/latest'; -import { +import type { RulesSettings, RulesSettingsFlapping, RulesSettingsFlappingProperties, RulesSettingsModificationMetadata, +} from '../../../common'; +import { RULES_SETTINGS_SAVED_OBJECT_TYPE, RULES_SETTINGS_FLAPPING_SAVED_OBJECT_ID, DEFAULT_FLAPPING_SETTINGS, diff --git a/x-pack/plugins/alerting/server/rules_settings/query_delay/rules_settings_query_delay_client.test.ts b/x-pack/plugins/alerting/server/rules_settings/query_delay/rules_settings_query_delay_client.test.ts index 84d707d388a44..65194eab600ed 100644 --- a/x-pack/plugins/alerting/server/rules_settings/query_delay/rules_settings_query_delay_client.test.ts +++ b/x-pack/plugins/alerting/server/rules_settings/query_delay/rules_settings_query_delay_client.test.ts @@ -7,17 +7,15 @@ import { SavedObjectsErrorHelpers } from '@kbn/core-saved-objects-server'; import { savedObjectsClientMock, loggingSystemMock } from '@kbn/core/server/mocks'; +import type { RulesSettings } from '../../../common'; import { RULES_SETTINGS_FEATURE_ID, RULES_SETTINGS_SAVED_OBJECT_TYPE, RULES_SETTINGS_QUERY_DELAY_SAVED_OBJECT_ID, - RulesSettings, DEFAULT_QUERY_DELAY_SETTINGS, } from '../../../common'; -import { - RulesSettingsQueryDelayClient, - RulesSettingsQueryDelayClientConstructorOptions, -} from './rules_settings_query_delay_client'; +import type { RulesSettingsQueryDelayClientConstructorOptions } from './rules_settings_query_delay_client'; +import { RulesSettingsQueryDelayClient } from './rules_settings_query_delay_client'; const mockDateString = '2019-02-12T21:01:22.479Z'; diff --git a/x-pack/plugins/alerting/server/rules_settings/query_delay/rules_settings_query_delay_client.ts b/x-pack/plugins/alerting/server/rules_settings/query_delay/rules_settings_query_delay_client.ts index c8dc863a02920..7ffee39284d46 100644 --- a/x-pack/plugins/alerting/server/rules_settings/query_delay/rules_settings_query_delay_client.ts +++ b/x-pack/plugins/alerting/server/rules_settings/query_delay/rules_settings_query_delay_client.ts @@ -6,21 +6,19 @@ */ import Boom from '@hapi/boom'; -import { - Logger, - SavedObjectsClientContract, - SavedObject, - SavedObjectsErrorHelpers, -} from '@kbn/core/server'; -import { +import type { Logger, SavedObjectsClientContract, SavedObject } from '@kbn/core/server'; +import { SavedObjectsErrorHelpers } from '@kbn/core/server'; +import type { RulesSettings, RulesSettingsModificationMetadata, + RulesSettingsQueryDelayProperties, + RulesSettingsQueryDelay, +} from '../../../common'; +import { RULES_SETTINGS_SAVED_OBJECT_TYPE, RULES_SETTINGS_QUERY_DELAY_SAVED_OBJECT_ID, - RulesSettingsQueryDelayProperties, MIN_QUERY_DELAY, MAX_QUERY_DELAY, - RulesSettingsQueryDelay, DEFAULT_SERVERLESS_QUERY_DELAY_SETTINGS, DEFAULT_QUERY_DELAY_SETTINGS, } from '../../../common'; diff --git a/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.mock.ts b/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.mock.ts index 3b75ed1900448..9ea763a591e16 100644 --- a/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.mock.ts +++ b/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.mock.ts @@ -5,14 +5,13 @@ * 2.0. */ -import { +import type { RulesSettingsClientApi, RulesSettingsFlappingClientApi, RulesSettingsQueryDelayClientApi, - DEFAULT_FLAPPING_SETTINGS, - DEFAULT_QUERY_DELAY_SETTINGS, RulesSettingsFlappingProperties, } from '../types'; +import { DEFAULT_FLAPPING_SETTINGS, DEFAULT_QUERY_DELAY_SETTINGS } from '../types'; export type RulesSettingsClientMock = jest.Mocked; export type RulesSettingsFlappingClientMock = jest.Mocked; diff --git a/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.test.ts b/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.test.ts index 314e28cd6f245..ae0e21e6e9751 100644 --- a/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.test.ts +++ b/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.test.ts @@ -5,10 +5,8 @@ * 2.0. */ -import { - RulesSettingsClient, - RulesSettingsClientConstructorOptions, -} from './rules_settings_client'; +import type { RulesSettingsClientConstructorOptions } from './rules_settings_client'; +import { RulesSettingsClient } from './rules_settings_client'; import { RulesSettingsFlappingClient } from './flapping/rules_settings_flapping_client'; import { savedObjectsClientMock, loggingSystemMock } from '@kbn/core/server/mocks'; import { RulesSettingsQueryDelayClient } from './query_delay/rules_settings_query_delay_client'; diff --git a/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.ts b/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.ts index 50e7650f42ff5..971a558e508eb 100644 --- a/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.ts +++ b/x-pack/plugins/alerting/server/rules_settings/rules_settings_client.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Logger, SavedObjectsClientContract } from '@kbn/core/server'; +import type { Logger, SavedObjectsClientContract } from '@kbn/core/server'; import { RulesSettingsFlappingClient } from './flapping/rules_settings_flapping_client'; import { RulesSettingsQueryDelayClient } from './query_delay/rules_settings_query_delay_client'; diff --git a/x-pack/plugins/alerting/server/rules_settings/rules_settings_client_factory.test.ts b/x-pack/plugins/alerting/server/rules_settings/rules_settings_client_factory.test.ts index 8942fb31acd32..a7977c266a27b 100644 --- a/x-pack/plugins/alerting/server/rules_settings/rules_settings_client_factory.test.ts +++ b/x-pack/plugins/alerting/server/rules_settings/rules_settings_client_factory.test.ts @@ -6,17 +6,15 @@ */ import { mockRouter } from '@kbn/core-http-router-server-mocks'; -import { - RulesSettingsClientFactory, - RulesSettingsClientFactoryOpts, -} from './rules_settings_client_factory'; +import type { RulesSettingsClientFactoryOpts } from './rules_settings_client_factory'; +import { RulesSettingsClientFactory } from './rules_settings_client_factory'; import { savedObjectsClientMock, savedObjectsServiceMock, loggingSystemMock, securityServiceMock, } from '@kbn/core/server/mocks'; -import { AuthenticatedUser } from '@kbn/security-plugin/common'; +import type { AuthenticatedUser } from '@kbn/security-plugin/common'; import { SECURITY_EXTENSION_ID } from '@kbn/core-saved-objects-server'; import { RULES_SETTINGS_SAVED_OBJECT_TYPE } from '../../common'; diff --git a/x-pack/plugins/alerting/server/rules_settings/rules_settings_client_factory.ts b/x-pack/plugins/alerting/server/rules_settings/rules_settings_client_factory.ts index a55529f995783..6a0f0fea83d60 100644 --- a/x-pack/plugins/alerting/server/rules_settings/rules_settings_client_factory.ts +++ b/x-pack/plugins/alerting/server/rules_settings/rules_settings_client_factory.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { +import type { KibanaRequest, Logger, SavedObjectsServiceStart, - SECURITY_EXTENSION_ID, SecurityServiceStart, } from '@kbn/core/server'; +import { SECURITY_EXTENSION_ID } from '@kbn/core/server'; import { RulesSettingsClient } from './rules_settings_client'; import { RULES_SETTINGS_SAVED_OBJECT_TYPE } from '../../common'; diff --git a/x-pack/plugins/alerting/server/rules_settings/rules_settings_feature.ts b/x-pack/plugins/alerting/server/rules_settings/rules_settings_feature.ts index 57a4e333c0b56..576d409dd733c 100644 --- a/x-pack/plugins/alerting/server/rules_settings/rules_settings_feature.ts +++ b/x-pack/plugins/alerting/server/rules_settings/rules_settings_feature.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { KibanaFeatureConfig } from '@kbn/features-plugin/common'; +import type { KibanaFeatureConfig } from '@kbn/features-plugin/common'; import { DEFAULT_APP_CATEGORIES } from '@kbn/core/server'; import { KibanaFeatureScope } from '@kbn/features-plugin/common'; import { diff --git a/x-pack/plugins/alerting/server/rules_settings/rules_settings_service.test.ts b/x-pack/plugins/alerting/server/rules_settings/rules_settings_service.test.ts index 7a42b2d9b92cc..6ec6d595f08e6 100644 --- a/x-pack/plugins/alerting/server/rules_settings/rules_settings_service.test.ts +++ b/x-pack/plugins/alerting/server/rules_settings/rules_settings_service.test.ts @@ -7,7 +7,7 @@ import sinon from 'sinon'; import { loggingSystemMock } from '@kbn/core/server/mocks'; -import { KibanaRequest } from '@kbn/core/server'; +import type { KibanaRequest } from '@kbn/core/server'; import { rulesSettingsClientMock } from './rules_settings_client.mock'; import { RulesSettingsService } from './rules_settings_service'; import { DEFAULT_QUERY_DELAY_SETTINGS, DEFAULT_SERVERLESS_QUERY_DELAY_SETTINGS } from '../types'; diff --git a/x-pack/plugins/alerting/server/rules_settings/rules_settings_service.ts b/x-pack/plugins/alerting/server/rules_settings/rules_settings_service.ts index 2dd264e5d9a69..d7a16ea74d724 100644 --- a/x-pack/plugins/alerting/server/rules_settings/rules_settings_service.ts +++ b/x-pack/plugins/alerting/server/rules_settings/rules_settings_service.ts @@ -5,14 +5,16 @@ * 2.0. */ -import { KibanaRequest, Logger } from '@kbn/core/server'; +import type { KibanaRequest, Logger } from '@kbn/core/server'; +import type { + RulesSettingsClientApi, + RulesSettingsFlappingProperties, + RulesSettingsQueryDelayProperties, +} from '../types'; import { DEFAULT_FLAPPING_SETTINGS, DEFAULT_QUERY_DELAY_SETTINGS, DEFAULT_SERVERLESS_QUERY_DELAY_SETTINGS, - RulesSettingsClientApi, - RulesSettingsFlappingProperties, - RulesSettingsQueryDelayProperties, } from '../types'; import { withAlertingSpan } from '../task_runner/lib'; diff --git a/x-pack/plugins/alerting/server/saved_objects/geo_containment/migrations.ts b/x-pack/plugins/alerting/server/saved_objects/geo_containment/migrations.ts index 7ad94643f47cf..d8d8f4399b08d 100644 --- a/x-pack/plugins/alerting/server/saved_objects/geo_containment/migrations.ts +++ b/x-pack/plugins/alerting/server/saved_objects/geo_containment/migrations.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { +import type { SavedObjectAttributes, SavedObjectReference, SavedObjectUnsanitizedDoc, } from '@kbn/core/server'; -import { Query } from '@kbn/data-plugin/common/query'; -import { RuleTypeParams } from '../..'; -import { RawRule } from '../../types'; +import type { Query } from '@kbn/data-plugin/common/query'; +import type { RuleTypeParams } from '../..'; +import type { RawRule } from '../../types'; // These definitions are dupes of the SO-types in stack_alerts/geo_containment // There are not exported to avoid deep imports from stack_alerts plugins into here diff --git a/x-pack/plugins/alerting/server/saved_objects/get_import_warnings.test.ts b/x-pack/plugins/alerting/server/saved_objects/get_import_warnings.test.ts index 85c35693b2b6a..f64e7dcd3df14 100644 --- a/x-pack/plugins/alerting/server/saved_objects/get_import_warnings.test.ts +++ b/x-pack/plugins/alerting/server/saved_objects/get_import_warnings.test.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { SavedObject } from '@kbn/core/server'; +import type { SavedObject } from '@kbn/core/server'; import { RULE_SAVED_OBJECT_TYPE } from '.'; -import { RawRule } from '../types'; +import type { RawRule } from '../types'; import { getImportWarnings } from './get_import_warnings'; describe('getImportWarnings', () => { diff --git a/x-pack/plugins/alerting/server/saved_objects/get_import_warnings.ts b/x-pack/plugins/alerting/server/saved_objects/get_import_warnings.ts index 6bd7feacb635d..d59dc4cd67fae 100644 --- a/x-pack/plugins/alerting/server/saved_objects/get_import_warnings.ts +++ b/x-pack/plugins/alerting/server/saved_objects/get_import_warnings.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { SavedObject, SavedObjectsImportWarning } from '@kbn/core/server'; +import type { SavedObject, SavedObjectsImportWarning } from '@kbn/core/server'; export function getImportWarnings( rulesSavedObjects: Array> diff --git a/x-pack/plugins/alerting/server/saved_objects/index.ts b/x-pack/plugins/alerting/server/saved_objects/index.ts index 8e76f28ff7fb8..a090e25d87e01 100644 --- a/x-pack/plugins/alerting/server/saved_objects/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/index.ts @@ -11,18 +11,18 @@ import type { SavedObjectsExportTransformContext, SavedObjectsServiceSetup, } from '@kbn/core/server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; -import { MigrateFunctionsObject } from '@kbn/kibana-utils-plugin/common'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { MigrateFunctionsObject } from '@kbn/kibana-utils-plugin/common'; import { ALERTING_CASES_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server'; import { alertMappings } from '../../common/saved_objects/rules/mappings'; import { rulesSettingsMappings } from './rules_settings_mappings'; import { maintenanceWindowMappings } from './maintenance_window_mapping'; import { getMigrations } from './migrations'; import { transformRulesForExport } from './transform_rule_for_export'; -import { RawRule } from '../types'; +import type { RawRule } from '../types'; import { getImportWarnings } from './get_import_warnings'; import { isRuleExportable } from './is_rule_exportable'; -import { RuleTypeRegistry } from '../rule_type_registry'; +import type { RuleTypeRegistry } from '../rule_type_registry'; export { partiallyUpdateRule, partiallyUpdateRuleWithEs } from './partially_update_rule'; import { RULES_SETTINGS_SAVED_OBJECT_TYPE, diff --git a/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.test.ts b/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.test.ts index 27145ecfe072f..ba5e11c9287b7 100644 --- a/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.test.ts +++ b/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.test.ts @@ -5,17 +5,19 @@ * 2.0. */ -import { MockedLogger, loggerMock } from '@kbn/logging-mocks'; +import type { MockedLogger } from '@kbn/logging-mocks'; +import { loggerMock } from '@kbn/logging-mocks'; import { TaskRunnerFactory } from '../task_runner'; -import { RuleTypeRegistry, ConstructorOptions } from '../rule_type_registry'; +import type { ConstructorOptions } from '../rule_type_registry'; +import { RuleTypeRegistry } from '../rule_type_registry'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { ILicenseState } from '../lib/license_state'; +import type { ILicenseState } from '../lib/license_state'; import { licenseStateMock } from '../lib/license_state.mock'; import { licensingMock } from '@kbn/licensing-plugin/server/mocks'; import { isRuleExportable } from './is_rule_exportable'; import { inMemoryMetricsMock } from '../monitoring/in_memory_metrics.mock'; import { loggingSystemMock } from '@kbn/core/server/mocks'; -import { AlertingConfig } from '../config'; +import type { AlertingConfig } from '../config'; import { RULE_SAVED_OBJECT_TYPE } from '.'; let ruleTypeRegistryParams: ConstructorOptions; diff --git a/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.ts b/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.ts index 34339a1fdb388..91e304174c9b7 100644 --- a/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.ts +++ b/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { Logger, SavedObject } from '@kbn/core/server'; -import { RawRule } from '../types'; -import { RuleTypeRegistry } from '../rule_type_registry'; +import type { Logger, SavedObject } from '@kbn/core/server'; +import type { RawRule } from '../types'; +import type { RuleTypeRegistry } from '../rule_type_registry'; export function isRuleExportable( rule: SavedObject, diff --git a/x-pack/plugins/alerting/server/saved_objects/maintenance_window_mapping.ts b/x-pack/plugins/alerting/server/saved_objects/maintenance_window_mapping.ts index 48bf1ab83dcc8..58303014034a0 100644 --- a/x-pack/plugins/alerting/server/saved_objects/maintenance_window_mapping.ts +++ b/x-pack/plugins/alerting/server/saved_objects/maintenance_window_mapping.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsTypeMappingDefinition } from '@kbn/core/server'; +import type { SavedObjectsTypeMappingDefinition } from '@kbn/core/server'; export const maintenanceWindowMappings: SavedObjectsTypeMappingDefinition = { dynamic: false, diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/7.10/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/7.10/index.ts index b432ff01618df..984a80c2332c2 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/7.10/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/7.10/index.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; -import { RawRule, RawRuleExecutionStatus } from '../../../types'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { RawRule, RawRuleExecutionStatus } from '../../../types'; import { LEGACY_LAST_MODIFIED_VERSION, SIEM_APP_ID, SIEM_SERVER_APP_ID } from '../constants'; import { createEsoMigration, pipeMigrations } from '../utils'; diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/7.11/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/7.11/index.ts index 29d86b2b2d860..287230971935d 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/7.11/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/7.11/index.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObjectAttributes } from '@kbn/core-saved-objects-server'; -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; -import { RawRule, RawRuleAction } from '../../../types'; +import type { SavedObjectAttributes } from '@kbn/core-saved-objects-server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { RawRule, RawRuleAction } from '../../../types'; import { createEsoMigration, pipeMigrations } from '../utils'; const SUPPORT_INCIDENTS_ACTION_TYPES = ['.servicenow', '.jira', '.resilient']; diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/7.13/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/7.13/index.ts index 75848e1a304c4..ace8e075a8090 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/7.13/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/7.13/index.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObjectAttribute } from '@kbn/core-saved-objects-server'; -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; -import { RawRule } from '../../../types'; +import type { SavedObjectAttribute } from '@kbn/core-saved-objects-server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { RawRule } from '../../../types'; import { createEsoMigration, isSiemSignalsRuleType, pipeMigrations } from '../utils'; function convertNullToUndefined(attribute: SavedObjectAttribute) { diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/7.14/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/7.14/index.ts index 8a4aa555127ce..f95ddb7650f40 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/7.14/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/7.14/index.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; -import { RawRule } from '../../../types'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { RawRule } from '../../../types'; import { createEsoMigration, isSiemSignalsRuleType, pipeMigrations } from '../utils'; /** diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/7.15/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/7.15/index.ts index e972f7e754f0f..b1ba8a695030f 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/7.15/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/7.15/index.ts @@ -5,15 +5,15 @@ * 2.0. */ -import { +import type { SavedObjectAttribute, SavedObjectAttributes, SavedObjectReference, } from '@kbn/core-saved-objects-server'; -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { isString } from 'lodash/fp'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; import { createEsoMigration, isSiemSignalsRuleType, pipeMigrations } from '../utils'; /** diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/7.16/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/7.16/index.ts index 992fe8bfa17a9..d3f5181d0cf43 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/7.16/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/7.16/index.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { SavedObjectReference } from '@kbn/core-saved-objects-server'; -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { SavedObjectReference } from '@kbn/core-saved-objects-server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { isString } from 'lodash/fp'; import { RULE_SAVED_OBJECT_TYPE } from '../..'; -import { RawRule, RawRuleAction } from '../../../types'; +import type { RawRule, RawRuleAction } from '../../../types'; import { extractRefsFromGeoContainmentAlert } from '../../geo_containment/migrations'; import { createEsoMigration, isSecuritySolutionLegacyNotification, pipeMigrations } from '../utils'; diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/8.0/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/8.0/index.ts index 5d8efd4585af7..7bd612702044b 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/8.0/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/8.0/index.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { isRuleType, ruleTypeMappings } from '@kbn/securitysolution-rules'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; import { FILEBEAT_7X_INDICATOR_PATH } from '../constants'; import { createEsoMigration, diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/8.2/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/8.2/index.ts index 9a8967c9556ab..7e817eb8736b9 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/8.2/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/8.2/index.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { getMappedParams } from '../../../rules_client/common'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; import { createEsoMigration, pipeMigrations } from '../utils'; function addMappedParams( diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/8.3/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/8.3/index.ts index ba083773e5a9a..24ab5300b242f 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/8.3/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/8.3/index.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { omit } from 'lodash'; import moment from 'moment-timezone'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; import { createEsoMigration, isDetectionEngineAADRuleType, diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/8.4/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/8.4/index.ts index 3a02425a7c194..10eab7bc27df6 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/8.4/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/8.4/index.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { omit } from 'lodash'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; import { createEsoMigration, pipeMigrations } from '../utils'; function removeIsSnoozedUntil( diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/8.5/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/8.5/index.ts index a40bcafd0bf35..b317c5e161e30 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/8.5/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/8.5/index.ts @@ -5,16 +5,16 @@ * 2.0. */ -import { +import type { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc, } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { isSerializedSearchSource } from '@kbn/data-plugin/common'; import { pick } from 'lodash'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; import { createEsoMigration, isEsQueryRuleType, pipeMigrations } from '../utils'; -import { AlertLogMeta } from '../types'; +import type { AlertLogMeta } from '../types'; function stripOutRuntimeFieldsInOldESQuery( doc: SavedObjectUnsanitizedDoc, diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/8.6/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/8.6/index.ts index b3d362fc4dd77..3a119d2d1c35b 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/8.6/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/8.6/index.ts @@ -5,10 +5,11 @@ * 2.0. */ -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { createEsoMigration, pipeMigrations } from '../utils'; -import { RawRule, RuleLastRunOutcomeValues } from '../../../types'; +import type { RawRule } from '../../../types'; +import { RuleLastRunOutcomeValues } from '../../../types'; import { getDefaultMonitoring } from '../../../lib/monitoring'; const succeededStatus = ['ok', 'active', 'succeeded']; diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/8.7/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/8.7/index.ts index 1b49f606cb6b5..2f7e59ddc9d41 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/8.7/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/8.7/index.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { extractedSavedObjectParamReferenceNamePrefix } from '../../../rules_client/common/constants'; import { createEsoMigration, @@ -14,7 +14,8 @@ import { isLogThresholdRuleType, pipeMigrations, } from '../utils'; -import { RawRule, RuleLastRunOutcomeOrderMap } from '../../../types'; +import type { RawRule } from '../../../types'; +import { RuleLastRunOutcomeOrderMap } from '../../../types'; function addGroupByToEsQueryRule( doc: SavedObjectUnsanitizedDoc diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/8.8/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/8.8/index.ts index 24629a3a146bd..cc08202ced852 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/8.8/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/8.8/index.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { v4 as uuidv4 } from 'uuid'; import { createEsoMigration, isDetectionEngineAADRuleType, pipeMigrations } from '../utils'; -import { RawRule } from '../../../types'; +import type { RawRule } from '../../../types'; import { transformToAlertThrottle } from '../../../rules_client/lib/siem_legacy_actions/transform_to_alert_throttle'; import { transformToNotifyWhen } from '../../../rules_client/lib/siem_legacy_actions/transform_to_notify_when'; diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/index.test.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/index.test.ts index 566911f00171d..211328d8654b7 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/index.test.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/index.test.ts @@ -8,12 +8,13 @@ import sinon from 'sinon'; import { v4 as uuidv4 } from 'uuid'; import { getMigrations } from '.'; -import { RawRule, RawRuleAction } from '../../types'; -import { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc } from '@kbn/core/server'; +import type { RawRule, RawRuleAction } from '../../types'; +import type { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc } from '@kbn/core/server'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { migrationMocks } from '@kbn/core/server/mocks'; import { SavedObjectsUtils } from '@kbn/core-saved-objects-utils-server'; -import { RuleType, ruleTypeMappings } from '@kbn/securitysolution-rules'; +import type { RuleType } from '@kbn/securitysolution-rules'; +import { ruleTypeMappings } from '@kbn/securitysolution-rules'; import { isAnyActionSupportIncidents } from './7.11'; import { RULE_SAVED_OBJECT_TYPE } from '..'; diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/index.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/index.ts index 613feffa062d1..d2c7107412b52 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/index.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/index.ts @@ -6,18 +6,19 @@ */ import { gte } from 'semver'; -import { +import type { SavedObjectMigrationMap, SavedObjectUnsanitizedDoc, SavedObjectMigrationFn, SavedObjectMigrationContext, } from '@kbn/core/server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; -import { MigrateFunctionsObject, MigrateFunction } from '@kbn/kibana-utils-plugin/common'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { MigrateFunctionsObject, MigrateFunction } from '@kbn/kibana-utils-plugin/common'; import { mergeSavedObjectMigrationMaps } from '@kbn/core/server'; -import { isSerializedSearchSource, SerializedSearchSourceFields } from '@kbn/data-plugin/common'; -import { Serializable } from '@kbn/utility-types'; -import { RawRule } from '../../types'; +import type { SerializedSearchSourceFields } from '@kbn/data-plugin/common'; +import { isSerializedSearchSource } from '@kbn/data-plugin/common'; +import type { Serializable } from '@kbn/utility-types'; +import type { RawRule } from '../../types'; import { getMigrations7100 } from './7.10'; import { getMigrations7110, getMigrations7112 } from './7.11'; import { getMigrations7130 } from './7.13'; @@ -32,7 +33,7 @@ import { getMigrations850 } from './8.5'; import { getMigrations860 } from './8.6'; import { getMigrations870 } from './8.7'; import { getMigrations880 } from './8.8'; -import { AlertLogMeta, AlertMigration } from './types'; +import type { AlertLogMeta, AlertMigration } from './types'; import { MINIMUM_SS_MIGRATION_VERSION } from './constants'; import { createEsoMigration, isEsQueryRuleType, pipeMigrations } from './utils'; diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/types.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/types.ts index 6d657e168187e..1bb6e6244e31c 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/types.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/types.ts @@ -5,8 +5,12 @@ * 2.0. */ -import { LogMeta, SavedObjectMigrationContext, SavedObjectUnsanitizedDoc } from '@kbn/core/server'; -import { RawRule } from '../../types'; +import type { + LogMeta, + SavedObjectMigrationContext, + SavedObjectUnsanitizedDoc, +} from '@kbn/core/server'; +import type { RawRule } from '../../types'; export interface AlertLogMeta extends LogMeta { migrations: { alertDocument: SavedObjectUnsanitizedDoc }; diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations/utils.ts b/x-pack/plugins/alerting/server/saved_objects/migrations/utils.ts index e21868b9631f0..e6b9d8a9b2895 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations/utils.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations/utils.ts @@ -6,14 +6,14 @@ */ import { ruleTypeMappings } from '@kbn/securitysolution-rules'; -import { +import type { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc, } from '@kbn/core-saved-objects-server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import type { IsMigrationNeededPredicate } from '@kbn/encrypted-saved-objects-plugin/server'; -import { RawRule } from '../../types'; +import type { RawRule } from '../../types'; type AlertMigration = ( doc: SavedObjectUnsanitizedDoc, diff --git a/x-pack/plugins/alerting/server/saved_objects/model_versions/ad_hoc_run_params_model_versions.ts b/x-pack/plugins/alerting/server/saved_objects/model_versions/ad_hoc_run_params_model_versions.ts index 95f544be5c8e2..4701cec282578 100644 --- a/x-pack/plugins/alerting/server/saved_objects/model_versions/ad_hoc_run_params_model_versions.ts +++ b/x-pack/plugins/alerting/server/saved_objects/model_versions/ad_hoc_run_params_model_versions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; +import type { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; import { rawAdHocRunParamsSchemaV1 } from '../schemas/raw_ad_hoc_run_params'; export const adHocRunParamsModelVersions: SavedObjectsModelVersionMap = { diff --git a/x-pack/plugins/alerting/server/saved_objects/model_versions/api_key_pending_invalidation_model_versions.ts b/x-pack/plugins/alerting/server/saved_objects/model_versions/api_key_pending_invalidation_model_versions.ts index 0d6456a9b155a..e08fe9c16e384 100644 --- a/x-pack/plugins/alerting/server/saved_objects/model_versions/api_key_pending_invalidation_model_versions.ts +++ b/x-pack/plugins/alerting/server/saved_objects/model_versions/api_key_pending_invalidation_model_versions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; +import type { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; import { rawApiKeyPendingInvalidationSchemaV1 } from '../schemas/raw_api_key_pending_invalidation'; export const apiKeyPendingInvalidationModelVersions: SavedObjectsModelVersionMap = { diff --git a/x-pack/plugins/alerting/server/saved_objects/model_versions/maintenance_window_model_versions.ts b/x-pack/plugins/alerting/server/saved_objects/model_versions/maintenance_window_model_versions.ts index dbfda11dc85fc..0570d0efe8545 100644 --- a/x-pack/plugins/alerting/server/saved_objects/model_versions/maintenance_window_model_versions.ts +++ b/x-pack/plugins/alerting/server/saved_objects/model_versions/maintenance_window_model_versions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; +import type { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; import { rawMaintenanceWindowSchemaV1 } from '../schemas/raw_maintenance_window'; export const maintenanceWindowModelVersions: SavedObjectsModelVersionMap = { diff --git a/x-pack/plugins/alerting/server/saved_objects/model_versions/rule_model_versions.ts b/x-pack/plugins/alerting/server/saved_objects/model_versions/rule_model_versions.ts index 33b1bfd315769..45cab5b78a85f 100644 --- a/x-pack/plugins/alerting/server/saved_objects/model_versions/rule_model_versions.ts +++ b/x-pack/plugins/alerting/server/saved_objects/model_versions/rule_model_versions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; +import type { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; import { rawRuleSchemaV1, rawRuleSchemaV2, rawRuleSchemaV3 } from '../schemas/raw_rule'; export const ruleModelVersions: SavedObjectsModelVersionMap = { diff --git a/x-pack/plugins/alerting/server/saved_objects/model_versions/rules_settings_model_versions.ts b/x-pack/plugins/alerting/server/saved_objects/model_versions/rules_settings_model_versions.ts index 323238c43c01c..e2a17bde76295 100644 --- a/x-pack/plugins/alerting/server/saved_objects/model_versions/rules_settings_model_versions.ts +++ b/x-pack/plugins/alerting/server/saved_objects/model_versions/rules_settings_model_versions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; +import type { SavedObjectsModelVersionMap } from '@kbn/core-saved-objects-server'; import { rawRulesSettingsSchemaV1 } from '../schemas/raw_rules_settings'; export const rulesSettingsModelVersions: SavedObjectsModelVersionMap = { diff --git a/x-pack/plugins/alerting/server/saved_objects/partially_update_rule.test.ts b/x-pack/plugins/alerting/server/saved_objects/partially_update_rule.test.ts index 1bbf7aa448fd4..1983415f39b23 100644 --- a/x-pack/plugins/alerting/server/saved_objects/partially_update_rule.test.ts +++ b/x-pack/plugins/alerting/server/saved_objects/partially_update_rule.test.ts @@ -5,21 +5,15 @@ * 2.0. */ -import { - SavedObjectsClientContract, - ISavedObjectsRepository, - SavedObjectsErrorHelpers, -} from '@kbn/core/server'; -import { - PartiallyUpdateableRuleAttributes, - partiallyUpdateRule, - partiallyUpdateRuleWithEs, -} from './partially_update_rule'; +import type { SavedObjectsClientContract, ISavedObjectsRepository } from '@kbn/core/server'; +import { SavedObjectsErrorHelpers } from '@kbn/core/server'; +import type { PartiallyUpdateableRuleAttributes } from './partially_update_rule'; +import { partiallyUpdateRule, partiallyUpdateRuleWithEs } from './partially_update_rule'; import { elasticsearchServiceMock, savedObjectsClientMock } from '@kbn/core/server/mocks'; import { RULE_SAVED_OBJECT_TYPE } from '.'; import { ALERTING_CASES_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server'; -import { estypes } from '@elastic/elasticsearch'; -import { RuleExecutionStatuses } from '@kbn/alerting-types'; +import type { estypes } from '@elastic/elasticsearch'; +import type { RuleExecutionStatuses } from '@kbn/alerting-types'; const MockSavedObjectsClientContract = savedObjectsClientMock.create(); const MockISavedObjectsRepository = diff --git a/x-pack/plugins/alerting/server/saved_objects/partially_update_rule.ts b/x-pack/plugins/alerting/server/saved_objects/partially_update_rule.ts index 4ef0779707536..a52ec70c74755 100644 --- a/x-pack/plugins/alerting/server/saved_objects/partially_update_rule.ts +++ b/x-pack/plugins/alerting/server/saved_objects/partially_update_rule.ts @@ -6,22 +6,18 @@ */ import { omit, pick } from 'lodash'; -import { +import type { ElasticsearchClient, SavedObjectsClient, - SavedObjectsErrorHelpers, SavedObjectsUpdateOptions, } from '@kbn/core/server'; +import { SavedObjectsErrorHelpers } from '@kbn/core/server'; import { decodeRequestVersion } from '@kbn/core-saved-objects-base-server-internal'; import { ALERTING_CASES_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server'; -import { RawRule } from '../types'; +import type { RawRule } from '../types'; -import { - RuleAttributesToEncrypt, - RuleAttributesIncludedInAAD, - RuleAttributesNotPartiallyUpdatable, - RULE_SAVED_OBJECT_TYPE, -} from '.'; +import type { RuleAttributesNotPartiallyUpdatable } from '.'; +import { RuleAttributesToEncrypt, RuleAttributesIncludedInAAD, RULE_SAVED_OBJECT_TYPE } from '.'; export type PartiallyUpdateableRuleAttributes = Partial< Omit diff --git a/x-pack/plugins/alerting/server/saved_objects/rrule_mappings_field.ts b/x-pack/plugins/alerting/server/saved_objects/rrule_mappings_field.ts index 5e9d7414a432d..20624fdf42773 100644 --- a/x-pack/plugins/alerting/server/saved_objects/rrule_mappings_field.ts +++ b/x-pack/plugins/alerting/server/saved_objects/rrule_mappings_field.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsFieldMapping } from '@kbn/core/server'; +import type { SavedObjectsFieldMapping } from '@kbn/core/server'; export const rRuleMappingsField: SavedObjectsFieldMapping = { type: 'nested', diff --git a/x-pack/plugins/alerting/server/saved_objects/rules_settings_mappings.ts b/x-pack/plugins/alerting/server/saved_objects/rules_settings_mappings.ts index 3f363a39e35fa..1b8a7519a25d1 100644 --- a/x-pack/plugins/alerting/server/saved_objects/rules_settings_mappings.ts +++ b/x-pack/plugins/alerting/server/saved_objects/rules_settings_mappings.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsTypeMappingDefinition } from '@kbn/core/server'; +import type { SavedObjectsTypeMappingDefinition } from '@kbn/core/server'; export const rulesSettingsMappings: SavedObjectsTypeMappingDefinition = { dynamic: false, diff --git a/x-pack/plugins/alerting/server/saved_objects/schemas/raw_rule/latest.ts b/x-pack/plugins/alerting/server/saved_objects/schemas/raw_rule/latest.ts index dded0a98f6d53..cce260e4839c9 100644 --- a/x-pack/plugins/alerting/server/saved_objects/schemas/raw_rule/latest.ts +++ b/x-pack/plugins/alerting/server/saved_objects/schemas/raw_rule/latest.ts @@ -4,9 +4,9 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { TypeOf } from '@kbn/config-schema'; +import type { TypeOf } from '@kbn/config-schema'; -import { +import type { rawRuleExecutionStatusSchema, rawRuleActionSchema, rawRuleAlertsFilterSchema, diff --git a/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.ts b/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.ts index 9e1c78cbe04cf..73ad71fb013c9 100644 --- a/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.ts +++ b/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { SavedObject } from '@kbn/core/server'; +import type { SavedObject } from '@kbn/core/server'; import { getRuleExecutionStatusPendingAttributes } from '../lib/rule_execution_status'; -import { RawRule } from '../types'; +import type { RawRule } from '../types'; export function transformRulesForExport(rules: SavedObject[]): Array> { const exportDate = new Date().toISOString(); diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/action_scheduler.test.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/action_scheduler.test.ts index 00f1a87aefd71..64bed42b78d9e 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/action_scheduler.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/action_scheduler.test.ts @@ -14,11 +14,13 @@ import { } from '@kbn/actions-plugin/server/mocks'; import { ActionsCompletion } from '@kbn/alerting-state-types'; import { ALERT_UUID } from '@kbn/rule-data-utils'; -import { InjectActionParamsOpts, injectActionParams } from '../inject_action_params'; -import { RuleTypeParams, SanitizedRule, GetViewInAppRelativeUrlFnOpts } from '../../types'; +import type { InjectActionParamsOpts } from '../inject_action_params'; +import { injectActionParams } from '../inject_action_params'; +import type { RuleTypeParams, SanitizedRule, GetViewInAppRelativeUrlFnOpts } from '../../types'; import { RuleRunMetricsStore } from '../../lib/rule_run_metrics_store'; import { alertingEventLoggerMock } from '../../lib/alerting_event_logger/alerting_event_logger.mock'; -import { ConcreteTaskInstance, TaskErrorSource } from '@kbn/task-manager-plugin/server'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { TaskErrorSource } from '@kbn/task-manager-plugin/server'; import { RuleNotifyWhen } from '../../../common'; import { asSavedObjectExecutionSource } from '@kbn/actions-plugin/server'; import sinon from 'sinon'; diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/action_scheduler.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/action_scheduler.ts index fa16cfcabb094..25fb39f60315a 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/action_scheduler.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/action_scheduler.ts @@ -10,17 +10,17 @@ import { isEphemeralTaskRejectedDueToCapacityError, TaskErrorSource, } from '@kbn/task-manager-plugin/server'; -import { +import type { ExecuteOptions as EnqueueExecutionOptions, ExecutionResponseItem, - ExecutionResponseType, } from '@kbn/actions-plugin/server/create_execute_function'; +import { ExecutionResponseType } from '@kbn/actions-plugin/server/create_execute_function'; import { ActionsCompletion } from '@kbn/alerting-state-types'; import { chunk } from 'lodash'; -import { ThrottledActions } from '../../types'; -import { ActionSchedulerOptions, ActionsToSchedule, IActionScheduler } from './types'; -import { Alert } from '../../alert'; -import { +import type { ThrottledActions } from '../../types'; +import type { ActionSchedulerOptions, ActionsToSchedule, IActionScheduler } from './types'; +import type { Alert } from '../../alert'; +import type { AlertInstanceContext, AlertInstanceState, RuleTypeParams, @@ -112,7 +112,7 @@ export class ActionScheduler< let bulkScheduleResponse: ExecutionResponseItem[] = []; - if (!!bulkScheduleRequest.length) { + if (bulkScheduleRequest.length) { for (const c of chunk(bulkScheduleRequest, BULK_SCHEDULE_CHUNK_SIZE)) { let enqueueResponse; try { @@ -136,7 +136,7 @@ export class ActionScheduler< } const actionsToNotLog: string[] = []; - if (!!bulkScheduleResponse.length) { + if (bulkScheduleResponse.length) { for (const r of bulkScheduleResponse) { if (r.response === ExecutionResponseType.QUEUED_ACTIONS_LIMIT_ERROR) { this.context.ruleRunMetricsStore.setHasReachedQueuedActionsLimit(true); @@ -167,7 +167,7 @@ export class ActionScheduler< (result) => result.actionToLog.uuid && !actionsToNotLog.includes(result.actionToLog.uuid) ); - if (!!actionsToLog.length) { + if (actionsToLog.length) { for (const action of actionsToLog) { this.context.alertingEventLogger.logAction(action.actionToLog); } diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/build_rule_url.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/build_rule_url.ts index 3df27a512c7f9..e0c05e23e3681 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/build_rule_url.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/build_rule_url.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { Logger } from '@kbn/logging'; -import { RuleTypeParams, SanitizedRule } from '@kbn/alerting-types'; +import type { Logger } from '@kbn/logging'; +import type { RuleTypeParams, SanitizedRule } from '@kbn/alerting-types'; import { getRuleDetailsRoute, triggersActionsRoute } from '@kbn/rule-data-utils'; -import { GetViewInAppRelativeUrlFn } from '../../../types'; +import type { GetViewInAppRelativeUrlFn } from '../../../types'; interface BuildRuleUrlOpts { end?: number; @@ -60,6 +60,5 @@ export const buildRuleUrl = ( opts.logger.debug( `Rule "${opts.rule.id}" encountered an error while constructing the rule.url variable: ${error.message}` ); - return; } }; diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/format_action_to_enqueue.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/format_action_to_enqueue.ts index af560a19ab9be..bbe8c7eb17f58 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/format_action_to_enqueue.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/format_action_to_enqueue.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RuleAction, RuleSystemAction } from '@kbn/alerting-types'; +import type { RuleAction, RuleSystemAction } from '@kbn/alerting-types'; import { asSavedObjectExecutionSource } from '@kbn/actions-plugin/server'; import { RULE_SAVED_OBJECT_TYPE } from '../../..'; diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/get_summarized_alerts.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/get_summarized_alerts.ts index 56d9c08c8b98f..9832952692005 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/get_summarized_alerts.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/get_summarized_alerts.ts @@ -7,8 +7,8 @@ import { ALERT_UUID } from '@kbn/rule-data-utils'; import { createTaskRunError, TaskErrorSource } from '@kbn/task-manager-plugin/server'; -import { GetSummarizedAlertsParams, IAlertsClient } from '../../../alerts_client/types'; -import { +import type { GetSummarizedAlertsParams, IAlertsClient } from '../../../alerts_client/types'; +import type { AlertInstanceContext, AlertInstanceState, CombinedSummarizedAlerts, diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/rule_action_helper.test.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/rule_action_helper.test.ts index 1adb68a951351..07b3b39985e7f 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/rule_action_helper.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/rule_action_helper.test.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { Logger } from '@kbn/logging'; +import type { Logger } from '@kbn/logging'; import { loggingSystemMock } from '@kbn/core/server/mocks'; -import { RuleAction } from '../../../types'; +import type { RuleAction } from '../../../types'; import { generateActionHash, getSummaryActionsFromTaskState, diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/rule_action_helper.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/rule_action_helper.ts index c3ef79b3086d8..672d5ca7042ad 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/rule_action_helper.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/rule_action_helper.ts @@ -5,14 +5,9 @@ * 2.0. */ -import { Logger } from '@kbn/logging'; -import { - IntervalSchedule, - parseDuration, - RuleAction, - RuleNotifyWhenTypeValues, - ThrottledActions, -} from '../../../../common'; +import type { Logger } from '@kbn/logging'; +import type { IntervalSchedule, RuleAction, ThrottledActions } from '../../../../common'; +import { parseDuration, RuleNotifyWhenTypeValues } from '../../../../common'; export const isSummaryAction = (action?: RuleAction) => { return action?.frequency?.summary ?? false; diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/should_schedule_action.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/should_schedule_action.ts index 99fa3c42ad3df..e27963109f444 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/should_schedule_action.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/lib/should_schedule_action.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { Logger } from '@kbn/logging'; +import type { Logger } from '@kbn/logging'; import { ActionsCompletion } from '@kbn/alerting-state-types'; -import { RuleAction, RuleSystemAction } from '@kbn/alerting-types'; -import { RuleRunMetricsStore } from '../../../lib/rule_run_metrics_store'; -import { ActionsConfigMap } from '../../../lib/get_actions_config_map'; +import type { RuleAction, RuleSystemAction } from '@kbn/alerting-types'; +import type { RuleRunMetricsStore } from '../../../lib/rule_run_metrics_store'; +import type { ActionsConfigMap } from '../../../lib/get_actions_config_map'; interface ShouldScheduleActionOpts { action: RuleAction | RuleSystemAction; diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/per_alert_action_scheduler.test.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/per_alert_action_scheduler.test.ts index 62e501f6963af..fb8245a69f1fd 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/per_alert_action_scheduler.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/per_alert_action_scheduler.test.ts @@ -14,14 +14,11 @@ import { RuleRunMetricsStore } from '../../../lib/rule_run_metrics_store'; import { mockAAD } from '../../fixtures'; import { PerAlertActionScheduler } from './per_alert_action_scheduler'; import { getRule, getRuleType, getDefaultSchedulerContext, generateAlert } from '../test_fixtures'; -import { SanitizedRuleAction } from '@kbn/alerting-types'; +import type { SanitizedRuleAction } from '@kbn/alerting-types'; import { ALERT_UUID } from '@kbn/rule-data-utils'; import { Alert } from '../../../alert'; -import { - ActionsCompletion, - AlertInstanceContext, - AlertInstanceState, -} from '@kbn/alerting-state-types'; +import type { AlertInstanceContext, AlertInstanceState } from '@kbn/alerting-state-types'; +import { ActionsCompletion } from '@kbn/alerting-state-types'; const alertingEventLogger = alertingEventLoggerMock.create(); const actionsClient = actionsClientMock.create(); diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/per_alert_action_scheduler.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/per_alert_action_scheduler.ts index 28b35d885b3d2..29daada974117 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/per_alert_action_scheduler.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/per_alert_action_scheduler.ts @@ -5,13 +5,15 @@ * 2.0. */ -import { AlertInstanceState, AlertInstanceContext } from '@kbn/alerting-state-types'; -import { RuleAction, RuleNotifyWhen, RuleTypeParams } from '@kbn/alerting-types'; +import type { AlertInstanceState, AlertInstanceContext } from '@kbn/alerting-state-types'; +import type { RuleAction, RuleTypeParams } from '@kbn/alerting-types'; +import { RuleNotifyWhen } from '@kbn/alerting-types'; import { compact } from 'lodash'; -import { RuleTypeState, RuleAlertData, parseDuration } from '../../../../common'; -import { GetSummarizedAlertsParams } from '../../../alerts_client/types'; -import { AlertHit } from '../../../types'; -import { Alert } from '../../../alert'; +import type { RuleTypeState, RuleAlertData } from '../../../../common'; +import { parseDuration } from '../../../../common'; +import type { GetSummarizedAlertsParams } from '../../../alerts_client/types'; +import type { AlertHit } from '../../../types'; +import type { Alert } from '../../../alert'; import { buildRuleUrl, formatActionToEnqueue, @@ -22,7 +24,7 @@ import { logNumberOfFilteredAlerts, shouldScheduleAction, } from '../lib'; -import { +import type { ActionSchedulerOptions, ActionsToSchedule, AddSummarizedAlertsOpts, @@ -32,7 +34,8 @@ import { IsExecutableActiveAlertOpts, IsExecutableAlertOpts, } from '../types'; -import { TransformActionParamsOptions, transformActionParams } from '../../transform_action_params'; +import type { TransformActionParamsOptions } from '../../transform_action_params'; +import { transformActionParams } from '../../transform_action_params'; import { injectActionParams } from '../../inject_action_params'; enum Reasons { diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/summary_action_scheduler.test.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/summary_action_scheduler.test.ts index cb19cb781ae3e..afef223de1732 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/summary_action_scheduler.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/summary_action_scheduler.test.ts @@ -20,13 +20,13 @@ import { generateAlert, generateRecoveredAlert, } from '../test_fixtures'; -import { RuleAction } from '@kbn/alerting-types'; +import type { RuleAction } from '@kbn/alerting-types'; import { ALERT_UUID } from '@kbn/rule-data-utils'; import { getErrorSource, TaskErrorSource, } from '@kbn/task-manager-plugin/server/task_running/errors'; -import { CombinedSummarizedAlerts } from '../../../types'; +import type { CombinedSummarizedAlerts } from '../../../types'; import { ActionsCompletion } from '@kbn/alerting-state-types'; const alertingEventLogger = alertingEventLoggerMock.create(); diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/summary_action_scheduler.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/summary_action_scheduler.ts index db53f15be2180..e6e1a374ca063 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/summary_action_scheduler.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/summary_action_scheduler.ts @@ -5,12 +5,13 @@ * 2.0. */ -import { AlertInstanceState, AlertInstanceContext } from '@kbn/alerting-state-types'; -import { RuleAction, RuleTypeParams } from '@kbn/alerting-types'; +import type { AlertInstanceState, AlertInstanceContext } from '@kbn/alerting-state-types'; +import type { RuleAction, RuleTypeParams } from '@kbn/alerting-types'; import { compact } from 'lodash'; -import { CombinedSummarizedAlerts } from '../../../types'; -import { RuleTypeState, RuleAlertData, parseDuration } from '../../../../common'; -import { GetSummarizedAlertsParams } from '../../../alerts_client/types'; +import type { CombinedSummarizedAlerts } from '../../../types'; +import type { RuleTypeState, RuleAlertData } from '../../../../common'; +import { parseDuration } from '../../../../common'; +import type { GetSummarizedAlertsParams } from '../../../alerts_client/types'; import { buildRuleUrl, formatActionToEnqueue, @@ -22,7 +23,7 @@ import { logNumberOfFilteredAlerts, shouldScheduleAction, } from '../lib'; -import { +import type { ActionSchedulerOptions, ActionsToSchedule, GetActionsToScheduleOpts, diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/system_action_scheduler.test.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/system_action_scheduler.test.ts index 71a7584c7280b..edcc34c2a48c2 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/system_action_scheduler.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/system_action_scheduler.test.ts @@ -12,12 +12,9 @@ import { alertsClientMock } from '../../../alerts_client/alerts_client.mock'; import { alertingEventLoggerMock } from '../../../lib/alerting_event_logger/alerting_event_logger.mock'; import { RuleRunMetricsStore } from '../../../lib/rule_run_metrics_store'; import { mockAAD } from '../../fixtures'; -import { Alert } from '../../../alert'; -import { - ActionsCompletion, - AlertInstanceContext, - AlertInstanceState, -} from '@kbn/alerting-state-types'; +import type { Alert } from '../../../alert'; +import type { AlertInstanceContext, AlertInstanceState } from '@kbn/alerting-state-types'; +import { ActionsCompletion } from '@kbn/alerting-state-types'; import { getRule, getRuleType, getDefaultSchedulerContext, generateAlert } from '../test_fixtures'; import { SystemActionScheduler } from './system_action_scheduler'; import { ALERT_UUID } from '@kbn/rule-data-utils'; @@ -25,7 +22,7 @@ import { getErrorSource, TaskErrorSource, } from '@kbn/task-manager-plugin/server/task_running/errors'; -import { CombinedSummarizedAlerts } from '../../../types'; +import type { CombinedSummarizedAlerts } from '../../../types'; import { schema } from '@kbn/config-schema'; const alertingEventLogger = alertingEventLoggerMock.create(); diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/system_action_scheduler.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/system_action_scheduler.ts index 0c5cceb0f0a52..be0b4982efc62 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/system_action_scheduler.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/schedulers/system_action_scheduler.ts @@ -5,18 +5,18 @@ * 2.0. */ -import { AlertInstanceState, AlertInstanceContext } from '@kbn/alerting-state-types'; -import { RuleSystemAction, RuleTypeParams } from '@kbn/alerting-types'; -import { CombinedSummarizedAlerts } from '../../../types'; -import { RuleTypeState, RuleAlertData } from '../../../../common'; -import { GetSummarizedAlertsParams } from '../../../alerts_client/types'; +import type { AlertInstanceState, AlertInstanceContext } from '@kbn/alerting-state-types'; +import type { RuleSystemAction, RuleTypeParams } from '@kbn/alerting-types'; +import type { CombinedSummarizedAlerts } from '../../../types'; +import type { RuleTypeState, RuleAlertData } from '../../../../common'; +import type { GetSummarizedAlertsParams } from '../../../alerts_client/types'; import { buildRuleUrl, formatActionToEnqueue, getSummarizedAlerts, shouldScheduleAction, } from '../lib'; -import { +import type { ActionSchedulerOptions, ActionsToSchedule, GetActionsToScheduleOpts, diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/test_fixtures.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/test_fixtures.ts index 5d56e03d0a462..09b72b4e1f406 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/test_fixtures.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/test_fixtures.ts @@ -6,22 +6,22 @@ */ import type { Logger } from '@kbn/core/server'; -import { +import type { AlertInstanceState, AlertInstanceContext, ThrottledActions, } from '@kbn/alerting-state-types'; -import { RuleTypeParams, SanitizedRule } from '@kbn/alerting-types'; +import type { RuleTypeParams, SanitizedRule } from '@kbn/alerting-types'; import { schema } from '@kbn/config-schema'; -import { KibanaRequest } from '@kbn/core-http-server'; -import { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; -import { ActionsClient, PluginStartContract } from '@kbn/actions-plugin/server'; -import { PublicMethodsOf } from '@kbn/utility-types'; -import { RuleAlertData, RuleTypeState } from '../../../common'; +import type { KibanaRequest } from '@kbn/core-http-server'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import type { ActionsClient, PluginStartContract } from '@kbn/actions-plugin/server'; +import type { PublicMethodsOf } from '@kbn/utility-types'; +import type { RuleAlertData, RuleTypeState } from '../../../common'; import { ConnectorAdapterRegistry } from '../../connector_adapters/connector_adapter_registry'; -import { NormalizedRuleType } from '../../rule_type_registry'; -import { TaskRunnerContext } from '../types'; -import { AlertingEventLogger } from '../../lib/alerting_event_logger/alerting_event_logger'; +import type { NormalizedRuleType } from '../../rule_type_registry'; +import type { TaskRunnerContext } from '../types'; +import type { AlertingEventLogger } from '../../lib/alerting_event_logger/alerting_event_logger'; import { Alert } from '../../alert'; const apiKey = Buffer.from('123:abc').toString('base64'); diff --git a/x-pack/plugins/alerting/server/task_runner/action_scheduler/types.ts b/x-pack/plugins/alerting/server/task_runner/action_scheduler/types.ts index 02b9647f91866..2b2dcf3d8e85f 100644 --- a/x-pack/plugins/alerting/server/task_runner/action_scheduler/types.ts +++ b/x-pack/plugins/alerting/server/task_runner/action_scheduler/types.ts @@ -6,12 +6,12 @@ */ import type { Logger } from '@kbn/core/server'; -import { PublicMethodsOf } from '@kbn/utility-types'; -import { ActionsClient } from '@kbn/actions-plugin/server/actions_client'; -import { ExecuteOptions as EnqueueExecutionOptions } from '@kbn/actions-plugin/server/create_execute_function'; -import { IAlertsClient } from '../../alerts_client/types'; -import { Alert } from '../../alert'; -import { +import type { PublicMethodsOf } from '@kbn/utility-types'; +import type { ActionsClient } from '@kbn/actions-plugin/server/actions_client'; +import type { ExecuteOptions as EnqueueExecutionOptions } from '@kbn/actions-plugin/server/create_execute_function'; +import type { IAlertsClient } from '../../alerts_client/types'; +import type { Alert } from '../../alert'; +import type { AlertInstanceContext, AlertInstanceState, RuleTypeParams, @@ -22,14 +22,14 @@ import { RuleSystemAction, ThrottledActions, } from '../../../common'; -import { NormalizedRuleType } from '../../rule_type_registry'; -import { CombinedSummarizedAlerts, RawRule } from '../../types'; -import { RuleRunMetricsStore } from '../../lib/rule_run_metrics_store'; -import { +import type { NormalizedRuleType } from '../../rule_type_registry'; +import type { CombinedSummarizedAlerts, RawRule } from '../../types'; +import type { RuleRunMetricsStore } from '../../lib/rule_run_metrics_store'; +import type { ActionOpts, AlertingEventLogger, } from '../../lib/alerting_event_logger/alerting_event_logger'; -import { RuleTaskInstance, TaskRunnerContext } from '../types'; +import type { RuleTaskInstance, TaskRunnerContext } from '../types'; export interface ActionSchedulerOptions< Params extends RuleTypeParams, diff --git a/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_runner.test.ts b/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_runner.test.ts index 0e0d7983e59ff..63629966c81bb 100644 --- a/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_runner.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_runner.test.ts @@ -6,9 +6,9 @@ */ import sinon from 'sinon'; -import { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server'; +import type { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server'; import { actionsMock } from '@kbn/actions-plugin/server/mocks'; -import { SavedObject } from '@kbn/core/server'; +import type { SavedObject } from '@kbn/core/server'; import { elasticsearchServiceMock, executionContextServiceMock, @@ -20,41 +20,42 @@ import { } from '@kbn/core/server/mocks'; import { dataPluginMock } from '@kbn/data-plugin/server/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; -import { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; +import type { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; -import { IEventLogger } from '@kbn/event-log-plugin/server'; +import type { IEventLogger } from '@kbn/event-log-plugin/server'; import { eventLoggerMock } from '@kbn/event-log-plugin/server/mocks'; -import { SharePluginStart } from '@kbn/share-plugin/server'; -import { ConcreteTaskInstance, TaskStatus } from '@kbn/task-manager-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { TaskStatus } from '@kbn/task-manager-plugin/server'; import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; import { AdHocTaskRunner } from './ad_hoc_task_runner'; -import { TaskRunnerContext } from './types'; +import type { TaskRunnerContext } from './types'; import { backfillClientMock } from '../backfill_client/backfill_client.mock'; import { ruleTypeRegistryMock } from '../rule_type_registry.mock'; +import type { ContextOpts } from '../lib/alerting_event_logger/alerting_event_logger'; import { AlertingEventLogger, executionType, - ContextOpts, } from '../lib/alerting_event_logger/alerting_event_logger'; -import { AdHocRunSchedule, AdHocRunSO } from '../data/ad_hoc_run/types'; +import type { AdHocRunSchedule, AdHocRunSO } from '../data/ad_hoc_run/types'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE, RULE_SAVED_OBJECT_TYPE } from '../saved_objects'; import { adHocRunStatus } from '../../common/constants'; import { DATE_1970, ruleType } from './fixtures'; import { alertingEventLoggerMock } from '../lib/alerting_event_logger/alerting_event_logger.mock'; import { alertsMock } from '../mocks'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; import { AlertsService } from '../alerts_service'; import { of, ReplaySubject } from 'rxjs'; import { getDataStreamAdapter } from '../alerts_service/lib/data_stream_adapter'; -import { +import type { AlertInstanceContext, AlertInstanceState, - DEFAULT_FLAPPING_SETTINGS, RuleAlertData, RuleExecutorOptions, RuleTypeParams, RuleTypeState, } from '../types'; +import { DEFAULT_FLAPPING_SETTINGS } from '../types'; import { TIMESTAMP, EVENT_ACTION, diff --git a/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_runner.ts b/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_runner.ts index d126151030672..0cd67d873ae97 100644 --- a/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_runner.ts +++ b/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_runner.ts @@ -7,35 +7,32 @@ import apm from 'elastic-apm-node'; import { v4 as uuidv4 } from 'uuid'; -import { - ISavedObjectsRepository, - KibanaRequest, - Logger, - SavedObject, - SavedObjectsErrorHelpers, -} from '@kbn/core/server'; -import { - ConcreteTaskInstance, - createTaskRunError, - TaskErrorSource, -} from '@kbn/task-manager-plugin/server'; +import type { ISavedObjectsRepository, KibanaRequest, Logger, SavedObject } from '@kbn/core/server'; +import { SavedObjectsErrorHelpers } from '@kbn/core/server'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { createTaskRunError, TaskErrorSource } from '@kbn/task-manager-plugin/server'; import { nanosToMillis } from '@kbn/event-log-plugin/common'; -import { CancellableTask, RunResult } from '@kbn/task-manager-plugin/server/task'; -import { AdHocRunStatus, adHocRunStatus } from '../../common/constants'; -import { RuleRunnerErrorStackTraceLog, RuleTaskStateAndMetrics, TaskRunnerContext } from './types'; +import type { CancellableTask, RunResult } from '@kbn/task-manager-plugin/server/task'; +import type { AdHocRunStatus } from '../../common/constants'; +import { adHocRunStatus } from '../../common/constants'; +import type { + RuleRunnerErrorStackTraceLog, + RuleTaskStateAndMetrics, + TaskRunnerContext, +} from './types'; import { getExecutorServices } from './get_executor_services'; import { ErrorWithReason, validateRuleTypeParams } from '../lib'; -import { +import type { AlertInstanceContext, AlertInstanceState, RuleAlertData, - RuleExecutionStatusErrorReasons, RuleTypeParams, RuleTypeRegistry, RuleTypeState, } from '../types'; +import { RuleExecutionStatusErrorReasons } from '../types'; import { TaskRunnerTimer, TaskRunnerTimerSpan } from './task_runner_timer'; -import { AdHocRun, AdHocRunSchedule, AdHocRunSO } from '../data/ad_hoc_run/types'; +import type { AdHocRun, AdHocRunSchedule, AdHocRunSO } from '../data/ad_hoc_run/types'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE } from '../saved_objects'; import { RuleMonitoringService } from '../monitoring/rule_monitoring_service'; import { AdHocTaskRunningHandler } from './ad_hoc_task_running_handler'; @@ -44,14 +41,16 @@ import { RuleResultService } from '../monitoring/rule_result_service'; import { RuleTypeRunner } from './rule_type_runner'; import { initializeAlertsClient } from '../alerts_client'; import { partiallyUpdateAdHocRun, processRunResults } from './lib'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; import { AlertingEventLogger, executionType, } from '../lib/alerting_event_logger/alerting_event_logger'; -import { RuleRunMetrics, RuleRunMetricsStore } from '../lib/rule_run_metrics_store'; +import type { RuleRunMetrics } from '../lib/rule_run_metrics_store'; +import { RuleRunMetricsStore } from '../lib/rule_run_metrics_store'; import { getEsErrorMessage } from '../lib/errors'; -import { Result, isOk, asOk, asErr } from '../lib/result_type'; +import type { Result } from '../lib/result_type'; +import { isOk, asOk, asErr } from '../lib/result_type'; interface ConstructorParams { context: TaskRunnerContext; diff --git a/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_running_handler.test.ts b/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_running_handler.test.ts index 62e64e02cbecd..0812c1de2a3fa 100644 --- a/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_running_handler.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_running_handler.test.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { ISavedObjectsRepository, Logger } from '@kbn/core/server'; +import type { ISavedObjectsRepository, Logger } from '@kbn/core/server'; import { partiallyUpdateAdHocRun } from './lib'; import { AdHocTaskRunningHandler } from './ad_hoc_task_running_handler'; diff --git a/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_running_handler.ts b/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_running_handler.ts index 1ef4279a328aa..2c8eb20c10c83 100644 --- a/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_running_handler.ts +++ b/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_running_handler.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { ISavedObjectsRepository, Logger } from '@kbn/core/server'; +import type { ISavedObjectsRepository, Logger } from '@kbn/core/server'; import { adHocRunStatus } from '../../common/constants'; -import { AdHocRunSchedule } from '../data/ad_hoc_run/types'; +import type { AdHocRunSchedule } from '../data/ad_hoc_run/types'; import { partiallyUpdateAdHocRun } from './lib'; const TIME_TO_WAIT = 2000; diff --git a/x-pack/plugins/alerting/server/task_runner/alert_task_instance.test.ts b/x-pack/plugins/alerting/server/task_runner/alert_task_instance.test.ts index 93bb08a55c7d0..f11f57a87579b 100644 --- a/x-pack/plugins/alerting/server/task_runner/alert_task_instance.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/alert_task_instance.test.ts @@ -5,10 +5,12 @@ * 2.0. */ -import { ConcreteTaskInstance, TaskStatus } from '@kbn/task-manager-plugin/server'; -import { AlertTaskInstance, taskInstanceToAlertTaskInstance } from './alert_task_instance'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { TaskStatus } from '@kbn/task-manager-plugin/server'; +import type { AlertTaskInstance } from './alert_task_instance'; +import { taskInstanceToAlertTaskInstance } from './alert_task_instance'; import { v4 as uuidv4 } from 'uuid'; -import { SanitizedRule } from '../types'; +import type { SanitizedRule } from '../types'; const alert: SanitizedRule<{ bar: boolean; diff --git a/x-pack/plugins/alerting/server/task_runner/alert_task_instance.ts b/x-pack/plugins/alerting/server/task_runner/alert_task_instance.ts index adcf228dde783..986e793c169cd 100644 --- a/x-pack/plugins/alerting/server/task_runner/alert_task_instance.ts +++ b/x-pack/plugins/alerting/server/task_runner/alert_task_instance.ts @@ -8,9 +8,9 @@ import * as t from 'io-ts'; import { pipe } from 'fp-ts/lib/pipeable'; import { fold } from 'fp-ts/lib/Either'; -import { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; import { ruleParamsSchema } from '@kbn/alerting-state-types'; -import { SanitizedRule, RuleTaskState, RuleTaskParams, RuleTypeParams } from '../../common'; +import type { SanitizedRule, RuleTaskState, RuleTaskParams, RuleTypeParams } from '../../common'; export interface AlertTaskInstance extends ConcreteTaskInstance { state: RuleTaskState; diff --git a/x-pack/plugins/alerting/server/task_runner/fixtures.ts b/x-pack/plugins/alerting/server/task_runner/fixtures.ts index d820f2690caeb..a63c6170df62a 100644 --- a/x-pack/plugins/alerting/server/task_runner/fixtures.ts +++ b/x-pack/plugins/alerting/server/task_runner/fixtures.ts @@ -6,22 +6,21 @@ */ import { TaskStatus } from '@kbn/task-manager-plugin/server'; -import { SavedObject } from '@kbn/core/server'; +import type { SavedObject } from '@kbn/core/server'; import { ALERTING_CASES_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server'; -import { +import type { Rule, RuleTypeParams, - RecoveredActionGroup, RuleMonitoring, - RuleLastRunOutcomeOrderMap, RuleLastRunOutcomes, SanitizedRule, SanitizedRuleAction, } from '../../common'; +import { RecoveredActionGroup, RuleLastRunOutcomeOrderMap } from '../../common'; import { getDefaultMonitoring } from '../lib/monitoring'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; import { EVENT_LOG_ACTIONS } from '../plugin'; -import { AlertHit, RawRule } from '../types'; +import type { AlertHit, RawRule } from '../types'; import { RULE_SAVED_OBJECT_TYPE } from '../saved_objects'; interface GeneratorParams { diff --git a/x-pack/plugins/alerting/server/task_runner/get_executor_services.ts b/x-pack/plugins/alerting/server/task_runner/get_executor_services.ts index 08bf3297fef06..86ff494b8206f 100644 --- a/x-pack/plugins/alerting/server/task_runner/get_executor_services.ts +++ b/x-pack/plugins/alerting/server/task_runner/get_executor_services.ts @@ -5,28 +5,24 @@ * 2.0. */ -import { +import type { IUiSettingsClient, KibanaRequest, Logger, SavedObjectsClientContract, } from '@kbn/core/server'; -import { DataViewsContract } from '@kbn/data-views-plugin/common'; +import type { DataViewsContract } from '@kbn/data-views-plugin/common'; import { RULE_SAVED_OBJECT_TYPE } from '..'; import { getEsRequestTimeout } from '../lib'; -import { - createWrappedScopedClusterClientFactory, - WrappedScopedClusterClient, -} from '../lib/wrap_scoped_cluster_client'; -import { - WrappedSearchSourceClient, - wrapSearchSourceClient, -} from '../lib/wrap_search_source_client'; -import { RuleMonitoringService } from '../monitoring/rule_monitoring_service'; -import { RuleResultService } from '../monitoring/rule_result_service'; -import { PublicRuleMonitoringService, PublicRuleResultService } from '../types'; +import type { WrappedScopedClusterClient } from '../lib/wrap_scoped_cluster_client'; +import { createWrappedScopedClusterClientFactory } from '../lib/wrap_scoped_cluster_client'; +import type { WrappedSearchSourceClient } from '../lib/wrap_search_source_client'; +import { wrapSearchSourceClient } from '../lib/wrap_search_source_client'; +import type { RuleMonitoringService } from '../monitoring/rule_monitoring_service'; +import type { RuleResultService } from '../monitoring/rule_result_service'; +import type { PublicRuleMonitoringService, PublicRuleResultService } from '../types'; import { withAlertingSpan } from './lib'; -import { TaskRunnerContext } from './types'; +import type { TaskRunnerContext } from './types'; interface GetExecutorServicesOpts { context: TaskRunnerContext; diff --git a/x-pack/plugins/alerting/server/task_runner/inject_action_params.ts b/x-pack/plugins/alerting/server/task_runner/inject_action_params.ts index 421796c08bbff..73d07f50f9243 100644 --- a/x-pack/plugins/alerting/server/task_runner/inject_action_params.ts +++ b/x-pack/plugins/alerting/server/task_runner/inject_action_params.ts @@ -6,8 +6,8 @@ */ import { i18n } from '@kbn/i18n'; -import { RuleActionParams } from '../types'; -import { RuleUrl } from './action_scheduler'; +import type { RuleActionParams } from '../types'; +import type { RuleUrl } from './action_scheduler'; export interface InjectActionParamsOpts { actionTypeId: string; diff --git a/x-pack/plugins/alerting/server/task_runner/lib/clear_expired_snoozes.test.ts b/x-pack/plugins/alerting/server/task_runner/lib/clear_expired_snoozes.test.ts index 756af0349fb6a..59c52e0abf4f7 100644 --- a/x-pack/plugins/alerting/server/task_runner/lib/clear_expired_snoozes.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/lib/clear_expired_snoozes.test.ts @@ -7,9 +7,9 @@ import moment from 'moment'; import sinon from 'sinon'; -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mocks'; -import { RuleSnooze } from '../../types'; +import type { RuleSnooze } from '../../types'; import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; import { clearExpiredSnoozes } from './clear_expired_snoozes'; import { ALERTING_CASES_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server'; diff --git a/x-pack/plugins/alerting/server/task_runner/lib/clear_expired_snoozes.ts b/x-pack/plugins/alerting/server/task_runner/lib/clear_expired_snoozes.ts index 3850f99fde005..4bd9fd895f372 100644 --- a/x-pack/plugins/alerting/server/task_runner/lib/clear_expired_snoozes.ts +++ b/x-pack/plugins/alerting/server/task_runner/lib/clear_expired_snoozes.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RuleTypeParams, SanitizedRule } from '@kbn/alerting-types'; -import { ElasticsearchClient, Logger } from '@kbn/core/server'; +import type { RuleTypeParams, SanitizedRule } from '@kbn/alerting-types'; +import type { ElasticsearchClient, Logger } from '@kbn/core/server'; import { isSnoozeExpired } from '../../lib'; import { partiallyUpdateRuleWithEs } from '../../saved_objects'; diff --git a/x-pack/plugins/alerting/server/task_runner/lib/partially_update_ad_hoc_run.test.ts b/x-pack/plugins/alerting/server/task_runner/lib/partially_update_ad_hoc_run.test.ts index 4e6e772693442..ed5e905a90b22 100644 --- a/x-pack/plugins/alerting/server/task_runner/lib/partially_update_ad_hoc_run.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/lib/partially_update_ad_hoc_run.test.ts @@ -5,15 +5,10 @@ * 2.0. */ -import { - SavedObjectsClientContract, - ISavedObjectsRepository, - SavedObjectsErrorHelpers, -} from '@kbn/core/server'; -import { - PartiallyUpdateableAdHocRunAttributes, - partiallyUpdateAdHocRun, -} from './partially_update_ad_hoc_run'; +import type { SavedObjectsClientContract, ISavedObjectsRepository } from '@kbn/core/server'; +import { SavedObjectsErrorHelpers } from '@kbn/core/server'; +import type { PartiallyUpdateableAdHocRunAttributes } from './partially_update_ad_hoc_run'; +import { partiallyUpdateAdHocRun } from './partially_update_ad_hoc_run'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE } from '../../saved_objects'; import { adHocRunStatus } from '../../../common/constants'; diff --git a/x-pack/plugins/alerting/server/task_runner/lib/partially_update_ad_hoc_run.ts b/x-pack/plugins/alerting/server/task_runner/lib/partially_update_ad_hoc_run.ts index dad89a829c531..bcf9b31205677 100644 --- a/x-pack/plugins/alerting/server/task_runner/lib/partially_update_ad_hoc_run.ts +++ b/x-pack/plugins/alerting/server/task_runner/lib/partially_update_ad_hoc_run.ts @@ -5,15 +5,12 @@ * 2.0. */ -import { - SavedObjectsClient, - SavedObjectsErrorHelpers, - SavedObjectsUpdateOptions, -} from '@kbn/core/server'; +import type { SavedObjectsClient, SavedObjectsUpdateOptions } from '@kbn/core/server'; +import { SavedObjectsErrorHelpers } from '@kbn/core/server'; import { omit, pick } from 'lodash'; -import { AdHocRunSO } from '../../data/ad_hoc_run/types'; +import type { AdHocRunSO } from '../../data/ad_hoc_run/types'; +import type { AdHocRunAttributesNotPartiallyUpdatable } from '../../saved_objects'; import { - AdHocRunAttributesNotPartiallyUpdatable, AdHocRunAttributesToEncrypt, AdHocRunAttributesIncludedInAAD, AD_HOC_RUN_SAVED_OBJECT_TYPE, diff --git a/x-pack/plugins/alerting/server/task_runner/lib/process_run_result.ts b/x-pack/plugins/alerting/server/task_runner/lib/process_run_result.ts index b1d898b1ec074..1e7ca47bc1bb1 100644 --- a/x-pack/plugins/alerting/server/task_runner/lib/process_run_result.ts +++ b/x-pack/plugins/alerting/server/task_runner/lib/process_run_result.ts @@ -5,20 +5,22 @@ * 2.0. */ -import { Logger } from '@kbn/core/server'; -import { Outcome } from 'elastic-apm-node'; -import { RuleExecutionStatus, RuleLastRun } from '../../../common'; -import { ElasticsearchError } from '../../lib'; -import { ILastRun, lastRunFromError, lastRunFromState } from '../../lib/last_run_status'; -import { map, Result } from '../../lib/result_type'; +import type { Logger } from '@kbn/core/server'; +import type { Outcome } from 'elastic-apm-node'; +import type { RuleExecutionStatus, RuleLastRun } from '../../../common'; +import type { ElasticsearchError } from '../../lib'; +import type { ILastRun } from '../../lib/last_run_status'; +import { lastRunFromError, lastRunFromState } from '../../lib/last_run_status'; +import type { Result } from '../../lib/result_type'; +import { map } from '../../lib/result_type'; +import type { IExecutionStatusAndMetrics } from '../../lib/rule_execution_status'; import { executionStatusFromError, executionStatusFromState, - IExecutionStatusAndMetrics, } from '../../lib/rule_execution_status'; -import { RuleRunMetrics } from '../../lib/rule_run_metrics_store'; -import { RuleResultService } from '../../monitoring/rule_result_service'; -import { RuleTaskStateAndMetrics } from '../types'; +import type { RuleRunMetrics } from '../../lib/rule_run_metrics_store'; +import type { RuleResultService } from '../../monitoring/rule_result_service'; +import type { RuleTaskStateAndMetrics } from '../types'; interface ProcessRuleRunOpts { logger?: Logger; diff --git a/x-pack/plugins/alerting/server/task_runner/lib/task_runner_logger.test.ts b/x-pack/plugins/alerting/server/task_runner/lib/task_runner_logger.test.ts index 96a75d53cb402..6ec423298bab0 100644 --- a/x-pack/plugins/alerting/server/task_runner/lib/task_runner_logger.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/lib/task_runner_logger.test.ts @@ -6,7 +6,8 @@ */ import { loggingSystemMock } from '@kbn/core/server/mocks'; -import { LogLevel, LogRecord } from '@kbn/logging'; +import type { LogRecord } from '@kbn/logging'; +import { LogLevel } from '@kbn/logging'; import { createTaskRunnerLogger } from './task_runner_logger'; describe('createTaskRunnerLogger', () => { diff --git a/x-pack/plugins/alerting/server/task_runner/lib/task_runner_logger.ts b/x-pack/plugins/alerting/server/task_runner/lib/task_runner_logger.ts index c99b4ac88b86b..e5f251981b748 100644 --- a/x-pack/plugins/alerting/server/task_runner/lib/task_runner_logger.ts +++ b/x-pack/plugins/alerting/server/task_runner/lib/task_runner_logger.ts @@ -6,7 +6,7 @@ */ import type { Logger, LogMeta } from '@kbn/core/server'; -import { LogLevelId, LogMessageSource, LogRecord } from '@kbn/logging'; +import type { LogLevelId, LogMessageSource, LogRecord } from '@kbn/logging'; interface TaskRunnerLoggerOpts { logger: Logger; diff --git a/x-pack/plugins/alerting/server/task_runner/log_alerts.test.ts b/x-pack/plugins/alerting/server/task_runner/log_alerts.test.ts index aabd657289e75..c9b03a203e606 100644 --- a/x-pack/plugins/alerting/server/task_runner/log_alerts.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/log_alerts.test.ts @@ -16,7 +16,7 @@ import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { Alert } from '../alert'; import { alertingEventLoggerMock } from '../lib/alerting_event_logger/alerting_event_logger.mock'; import { RuleRunMetricsStore } from '../lib/rule_run_metrics_store'; -import { DefaultActionGroupId } from '../types'; +import type { DefaultActionGroupId } from '../types'; import { logAlerts } from './log_alerts'; const logger: ReturnType = loggingSystemMock.createLogger(); diff --git a/x-pack/plugins/alerting/server/task_runner/log_alerts.ts b/x-pack/plugins/alerting/server/task_runner/log_alerts.ts index a83f8ebb74ac4..9b814b6d9f992 100644 --- a/x-pack/plugins/alerting/server/task_runner/log_alerts.ts +++ b/x-pack/plugins/alerting/server/task_runner/log_alerts.ts @@ -6,12 +6,12 @@ */ import apm from 'elastic-apm-node'; -import { Logger } from '@kbn/core/server'; -import { Alert } from '../alert'; +import type { Logger } from '@kbn/core/server'; +import type { Alert } from '../alert'; import { EVENT_LOG_ACTIONS } from '../plugin'; -import { AlertInstanceContext, AlertInstanceState } from '../types'; -import { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; -import { RuleRunMetricsStore } from '../lib/rule_run_metrics_store'; +import type { AlertInstanceContext, AlertInstanceState } from '../types'; +import type { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; +import type { RuleRunMetricsStore } from '../lib/rule_run_metrics_store'; export interface LogAlertsParams< State extends AlertInstanceState, diff --git a/x-pack/plugins/alerting/server/task_runner/maintenance_windows/get_maintenance_windows.test.ts b/x-pack/plugins/alerting/server/task_runner/maintenance_windows/get_maintenance_windows.test.ts index a6479fba828f4..0a0c005c402c3 100644 --- a/x-pack/plugins/alerting/server/task_runner/maintenance_windows/get_maintenance_windows.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/maintenance_windows/get_maintenance_windows.test.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { CoreKibanaRequest } from '@kbn/core-http-router-server-internal'; +import type { CoreKibanaRequest } from '@kbn/core-http-router-server-internal'; import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { maintenanceWindowCategoryIdTypes } from '../../application/maintenance_window/constants'; import { getMockMaintenanceWindow } from '../../data/maintenance_window/test_helpers'; import { maintenanceWindowClientMock } from '../../maintenance_window_client.mock'; import { MaintenanceWindowStatus } from '../../types'; -import { MaintenanceWindow } from '../../application/maintenance_window/types'; +import type { MaintenanceWindow } from '../../application/maintenance_window/types'; import { mockedRawRuleSO, mockedRule } from '../fixtures'; import { filterMaintenanceWindows, @@ -19,7 +19,7 @@ import { getMaintenanceWindows, } from './get_maintenance_windows'; import { getFakeKibanaRequest } from '../rule_loader'; -import { TaskRunnerContext } from '../types'; +import type { TaskRunnerContext } from '../types'; import { FilterStateStore } from '@kbn/es-query'; const logger = loggingSystemMock.create().get(); diff --git a/x-pack/plugins/alerting/server/task_runner/maintenance_windows/get_maintenance_windows.ts b/x-pack/plugins/alerting/server/task_runner/maintenance_windows/get_maintenance_windows.ts index ffc880f5475ae..279d883f79a0c 100644 --- a/x-pack/plugins/alerting/server/task_runner/maintenance_windows/get_maintenance_windows.ts +++ b/x-pack/plugins/alerting/server/task_runner/maintenance_windows/get_maintenance_windows.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { KibanaRequest, Logger } from '@kbn/core/server'; -import { MaintenanceWindow } from '../../application/maintenance_window/types'; -import { MaintenanceWindowClientApi } from '../../types'; +import type { KibanaRequest, Logger } from '@kbn/core/server'; +import type { MaintenanceWindow } from '../../application/maintenance_window/types'; +import type { MaintenanceWindowClientApi } from '../../types'; import { withAlertingSpan } from '../lib'; interface GetMaintenanceWindowsOpts { diff --git a/x-pack/plugins/alerting/server/task_runner/maintenance_windows/maintenance_windows_service.test.ts b/x-pack/plugins/alerting/server/task_runner/maintenance_windows/maintenance_windows_service.test.ts index e768eb8ec6efe..5453d91f8c09b 100644 --- a/x-pack/plugins/alerting/server/task_runner/maintenance_windows/maintenance_windows_service.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/maintenance_windows/maintenance_windows_service.test.ts @@ -6,14 +6,14 @@ */ import sinon from 'sinon'; -import { KibanaRequest } from '@kbn/core/server'; +import type { KibanaRequest } from '@kbn/core/server'; import { loggingSystemMock } from '@kbn/core/server/mocks'; import { alertingEventLoggerMock } from '../../lib/alerting_event_logger/alerting_event_logger.mock'; import { MaintenanceWindowsService } from './maintenance_windows_service'; import { maintenanceWindowClientMock } from '../../maintenance_window_client.mock'; import { getMockMaintenanceWindow } from '../../data/maintenance_window/test_helpers'; import { MaintenanceWindowStatus } from '../../../common'; -import { MaintenanceWindowCategoryIds } from '../../../common/routes/maintenance_window/shared'; +import type { MaintenanceWindowCategoryIds } from '../../../common/routes/maintenance_window/shared'; import { FilterStateStore } from '@kbn/es-query'; const alertingEventLogger = alertingEventLoggerMock.create(); diff --git a/x-pack/plugins/alerting/server/task_runner/maintenance_windows/maintenance_windows_service.ts b/x-pack/plugins/alerting/server/task_runner/maintenance_windows/maintenance_windows_service.ts index 4f1b62a61f88f..c8bfa96ad2818 100644 --- a/x-pack/plugins/alerting/server/task_runner/maintenance_windows/maintenance_windows_service.ts +++ b/x-pack/plugins/alerting/server/task_runner/maintenance_windows/maintenance_windows_service.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { KibanaRequest, Logger } from '@kbn/core/server'; -import { MaintenanceWindow } from '../../application/maintenance_window/types'; +import type { KibanaRequest, Logger } from '@kbn/core/server'; +import type { MaintenanceWindow } from '../../application/maintenance_window/types'; import { filterMaintenanceWindowsIds } from './get_maintenance_windows'; -import { MaintenanceWindowClientApi } from '../../types'; -import { AlertingEventLogger } from '../../lib/alerting_event_logger/alerting_event_logger'; +import type { MaintenanceWindowClientApi } from '../../types'; +import type { AlertingEventLogger } from '../../lib/alerting_event_logger/alerting_event_logger'; import { withAlertingSpan } from '../lib'; export const DEFAULT_CACHE_INTERVAL_MS = 60000; // 1 minute cache diff --git a/x-pack/plugins/alerting/server/task_runner/rule_loader.test.ts b/x-pack/plugins/alerting/server/task_runner/rule_loader.test.ts index 1d4741f84749c..c7ec13a619d3b 100644 --- a/x-pack/plugins/alerting/server/task_runner/rule_loader.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/rule_loader.test.ts @@ -8,7 +8,7 @@ import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { CoreKibanaRequest, SavedObjectsErrorHelpers } from '@kbn/core/server'; import { schema } from '@kbn/config-schema'; -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; import { loggingSystemMock } from '@kbn/core/server/mocks'; import { @@ -16,9 +16,9 @@ import { getFakeKibanaRequest, validateRuleAndCreateFakeRequest, } from './rule_loader'; -import { TaskRunnerContext } from './types'; +import type { TaskRunnerContext } from './types'; import { ruleTypeRegistryMock } from '../rule_type_registry.mock'; -import { Rule } from '../types'; +import type { Rule } from '../types'; import { MONITORING_HISTORY_LIMIT, RuleExecutionStatusErrorReasons } from '../../common'; import { getReasonFromError } from '../lib/error_with_reason'; import { mockedRawRuleSO, mockedRule } from './fixtures'; diff --git a/x-pack/plugins/alerting/server/task_runner/rule_loader.ts b/x-pack/plugins/alerting/server/task_runner/rule_loader.ts index 3dd0dc8c53a55..ce73e85633c16 100644 --- a/x-pack/plugins/alerting/server/task_runner/rule_loader.ts +++ b/x-pack/plugins/alerting/server/task_runner/rule_loader.ts @@ -6,25 +6,21 @@ */ import { addSpaceIdToPath } from '@kbn/spaces-plugin/server'; -import { - CoreKibanaRequest, +import type { FakeRawRequest, Headers, Logger, SavedObject, SavedObjectReference, - SavedObjectsErrorHelpers, } from '@kbn/core/server'; +import { CoreKibanaRequest, SavedObjectsErrorHelpers } from '@kbn/core/server'; import { createTaskRunError, TaskErrorSource } from '@kbn/task-manager-plugin/server'; -import { RunRuleParams, TaskRunnerContext } from './types'; +import type { RunRuleParams, TaskRunnerContext } from './types'; import { ErrorWithReason, validateRuleTypeParams } from '../lib'; -import { - RuleExecutionStatusErrorReasons, - RawRule, - RuleTypeRegistry, - RuleTypeParamsValidator, -} from '../types'; -import { MONITORING_HISTORY_LIMIT, RuleTypeParams } from '../../common'; +import type { RawRule, RuleTypeRegistry, RuleTypeParamsValidator } from '../types'; +import { RuleExecutionStatusErrorReasons } from '../types'; +import type { RuleTypeParams } from '../../common'; +import { MONITORING_HISTORY_LIMIT } from '../../common'; import { RULE_SAVED_OBJECT_TYPE } from '../saved_objects'; import { getAlertFromRaw } from '../rules_client/lib'; diff --git a/x-pack/plugins/alerting/server/task_runner/rule_running_handler.test.ts b/x-pack/plugins/alerting/server/task_runner/rule_running_handler.test.ts index 08c1e0c7292ee..76a6523217796 100644 --- a/x-pack/plugins/alerting/server/task_runner/rule_running_handler.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/rule_running_handler.test.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { ISavedObjectsRepository, Logger } from '@kbn/core/server'; +import type { ISavedObjectsRepository, Logger } from '@kbn/core/server'; import { partiallyUpdateRule } from '../saved_objects/partially_update_rule'; import { RuleRunningHandler } from './rule_running_handler'; diff --git a/x-pack/plugins/alerting/server/task_runner/rule_running_handler.ts b/x-pack/plugins/alerting/server/task_runner/rule_running_handler.ts index 3794937343f26..61df7c1d76571 100644 --- a/x-pack/plugins/alerting/server/task_runner/rule_running_handler.ts +++ b/x-pack/plugins/alerting/server/task_runner/rule_running_handler.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ISavedObjectsRepository, Logger } from '@kbn/core/server'; +import type { ISavedObjectsRepository, Logger } from '@kbn/core/server'; import { partiallyUpdateRule } from '../saved_objects/partially_update_rule'; const TIME_TO_WAIT = 2000; diff --git a/x-pack/plugins/alerting/server/task_runner/rule_type_runner.test.ts b/x-pack/plugins/alerting/server/task_runner/rule_type_runner.test.ts index 1d218e50f927b..9ca62f3536704 100644 --- a/x-pack/plugins/alerting/server/task_runner/rule_type_runner.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/rule_type_runner.test.ts @@ -10,27 +10,24 @@ import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { DATE_1970, mockTaskInstance, RULE_ID, RULE_NAME, RULE_TYPE_ID } from './fixtures'; import { alertingEventLoggerMock } from '../lib/alerting_event_logger/alerting_event_logger.mock'; import { ruleRunMetricsStoreMock } from '../lib/rule_run_metrics_store.mock'; -import { RuleTypeRunner, RuleData } from './rule_type_runner'; +import type { RuleData } from './rule_type_runner'; +import { RuleTypeRunner } from './rule_type_runner'; import { TaskRunnerTimer } from './task_runner_timer'; import { DEFAULT_FLAPPING_SETTINGS, RecoveredActionGroup } from '../types'; -import { TaskRunnerContext } from './types'; +import type { TaskRunnerContext } from './types'; import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks'; -import { SharePluginStart } from '@kbn/share-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; import { alertsClientMock } from '../alerts_client/alerts_client.mock'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { publicRuleMonitoringServiceMock } from '../monitoring/rule_monitoring_service.mock'; import { publicRuleResultServiceMock } from '../monitoring/rule_result_service.mock'; import { wrappedScopedClusterClientMock } from '../lib/wrap_scoped_cluster_client.mock'; -import { NormalizedRuleType } from '../rule_type_registry'; -import { - ConcreteTaskInstance, - createTaskRunError, - TaskErrorSource, - TaskStatus, -} from '@kbn/task-manager-plugin/server'; +import type { NormalizedRuleType } from '../rule_type_registry'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { createTaskRunError, TaskErrorSource, TaskStatus } from '@kbn/task-manager-plugin/server'; import { getErrorSource } from '@kbn/task-manager-plugin/server/task_running'; import { maintenanceWindowsServiceMock } from './maintenance_windows/maintenance_windows_service.mock'; -import { KibanaRequest } from '@kbn/core/server'; +import type { KibanaRequest } from '@kbn/core/server'; const alertingEventLogger = alertingEventLoggerMock.create(); const alertsClient = alertsClientMock.create(); diff --git a/x-pack/plugins/alerting/server/task_runner/rule_type_runner.ts b/x-pack/plugins/alerting/server/task_runner/rule_type_runner.ts index c10871613ea20..71c248afaf2d8 100644 --- a/x-pack/plugins/alerting/server/task_runner/rule_type_runner.ts +++ b/x-pack/plugins/alerting/server/task_runner/rule_type_runner.ts @@ -5,32 +5,32 @@ * 2.0. */ -import { AlertInstanceContext, AlertInstanceState, RuleTaskState } from '@kbn/alerting-state-types'; +import type { + AlertInstanceContext, + AlertInstanceState, + RuleTaskState, +} from '@kbn/alerting-state-types'; import { DEFAULT_NAMESPACE_STRING } from '@kbn/core-saved-objects-utils-server'; -import { Logger } from '@kbn/core/server'; -import { - ConcreteTaskInstance, - createTaskRunError, - TaskErrorSource, -} from '@kbn/task-manager-plugin/server'; +import type { Logger } from '@kbn/core/server'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { createTaskRunError, TaskErrorSource } from '@kbn/task-manager-plugin/server'; import { getErrorSource } from '@kbn/task-manager-plugin/server/task_running'; -import { IAlertsClient } from '../alerts_client/types'; +import type { IAlertsClient } from '../alerts_client/types'; import { ErrorWithReason } from '../lib'; import { getTimeRange } from '../lib/get_time_range'; -import { NormalizedRuleType } from '../rule_type_registry'; -import { - DEFAULT_FLAPPING_SETTINGS, - RuleAlertData, - RuleExecutionStatusErrorReasons, - RuleTypeParams, - RuleTypeState, - SanitizedRule, -} from '../types'; -import { ExecutorServices } from './get_executor_services'; -import { TaskRunnerTimer, TaskRunnerTimerSpan } from './task_runner_timer'; -import { RuleRunnerErrorStackTraceLog, RuleTypeRunnerContext, TaskRunnerContext } from './types'; +import type { NormalizedRuleType } from '../rule_type_registry'; +import type { RuleAlertData, RuleTypeParams, RuleTypeState, SanitizedRule } from '../types'; +import { DEFAULT_FLAPPING_SETTINGS, RuleExecutionStatusErrorReasons } from '../types'; +import type { ExecutorServices } from './get_executor_services'; +import type { TaskRunnerTimer } from './task_runner_timer'; +import { TaskRunnerTimerSpan } from './task_runner_timer'; +import type { + RuleRunnerErrorStackTraceLog, + RuleTypeRunnerContext, + TaskRunnerContext, +} from './types'; import { withAlertingSpan } from './lib'; -import { WrappedSearchSourceClient } from '../lib/wrap_search_source_client'; +import type { WrappedSearchSourceClient } from '../lib/wrap_search_source_client'; interface ConstructorOpts< Params extends RuleTypeParams, diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts index a79dfe8f59c73..3ba8ebc78c5e6 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts @@ -7,26 +7,28 @@ import sinon from 'sinon'; import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { +import type { RuleExecutorOptions, RuleTypeParams, RuleTypeState, AlertInstanceState, AlertInstanceContext, - RuleExecutionStatusWarningReasons, Rule, RuleAction, RuleAlertData, +} from '../types'; +import { + RuleExecutionStatusWarningReasons, DEFAULT_FLAPPING_SETTINGS, DEFAULT_QUERY_DELAY_SETTINGS, } from '../types'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; import { - ConcreteTaskInstance, createTaskRunError, isUnrecoverableError, TaskErrorSource, } from '@kbn/task-manager-plugin/server'; -import { TaskRunnerContext } from './types'; +import type { TaskRunnerContext } from './types'; import { TaskRunner } from './task_runner'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { @@ -38,11 +40,11 @@ import { elasticsearchServiceMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server'; +import type { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server'; import { actionsMock, actionsClientMock } from '@kbn/actions-plugin/server/mocks'; import { alertsMock } from '../mocks'; import { eventLoggerMock } from '@kbn/event-log-plugin/server/event_logger.mock'; -import { IEventLogger } from '@kbn/event-log-plugin/server'; +import type { IEventLogger } from '@kbn/event-log-plugin/server'; import { SavedObjectsErrorHelpers } from '@kbn/core/server'; import { omit } from 'lodash'; import { ruleTypeRegistryMock } from '../rule_type_registry.mock'; @@ -75,15 +77,13 @@ import { EVENT_LOG_ACTIONS } from '../plugin'; import { IN_MEMORY_METRICS } from '../monitoring'; import { translations } from '../constants/translations'; import { dataPluginMock } from '@kbn/data-plugin/server/mocks'; -import { - AlertingEventLogger, - ContextOpts, -} from '../lib/alerting_event_logger/alerting_event_logger'; +import type { ContextOpts } from '../lib/alerting_event_logger/alerting_event_logger'; +import { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; import { getAlertFromRaw } from '../rules_client/lib/get_alert_from_raw'; import { alertingEventLoggerMock } from '../lib/alerting_event_logger/alerting_event_logger.mock'; -import { SharePluginStart } from '@kbn/share-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; -import { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; +import type { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; import { alertsServiceMock } from '../alerts_service/alerts_service.mock'; import { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; import { getMockMaintenanceWindow } from '../data/maintenance_window/test_helpers'; @@ -93,11 +93,11 @@ import { getErrorSource } from '@kbn/task-manager-plugin/server/task_running'; import { RuleResultService } from '../monitoring/rule_result_service'; import { ruleResultServiceMock } from '../monitoring/rule_result_service.mock'; import { backfillClientMock } from '../backfill_client/backfill_client.mock'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; import * as getExecutorServicesModule from './get_executor_services'; import { rulesSettingsServiceMock } from '../rules_settings/rules_settings_service.mock'; import { maintenanceWindowsServiceMock } from './maintenance_windows/maintenance_windows_service.mock'; -import { MaintenanceWindow } from '../application/maintenance_window/types'; +import type { MaintenanceWindow } from '../application/maintenance_window/types'; jest.mock('uuid', () => ({ v4: () => '5f6aa57d-3e22-484e-bae8-cbed868f4d28', diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.ts index 89432e1822029..629ed3178dafe 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner.ts @@ -7,11 +7,11 @@ import apm from 'elastic-apm-node'; import { omit } from 'lodash'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import { v4 as uuidv4 } from 'uuid'; -import { ISavedObjectsRepository, Logger } from '@kbn/core/server'; +import type { ISavedObjectsRepository, Logger } from '@kbn/core/server'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; import { - ConcreteTaskInstance, createTaskRunError, TaskErrorSource, throwUnrecoverableError, @@ -19,7 +19,7 @@ import { import { nanosToMillis } from '@kbn/event-log-plugin/server'; import { getErrorSource, isUserError } from '@kbn/task-manager-plugin/server/task_running'; import { ActionScheduler, type RunResult } from './action_scheduler'; -import { +import type { RuleRunnerErrorStackTraceLog, RuleTaskInstance, RuleTaskRunResult, @@ -28,34 +28,36 @@ import { TaskRunnerContext, } from './types'; import { getExecutorServices } from './get_executor_services'; -import { ElasticsearchError, getNextRun, isRuleSnoozed, ruleExecutionStatusToRaw } from '../lib'; -import { +import type { ElasticsearchError } from '../lib'; +import { getNextRun, isRuleSnoozed, ruleExecutionStatusToRaw } from '../lib'; +import type { IntervalSchedule, RawRuleExecutionStatus, RawRuleLastRun, RawRuleMonitoring, RuleExecutionStatus, - RuleExecutionStatusErrorReasons, RuleTaskState, RuleTypeRegistry, } from '../types'; -import { asErr, asOk, isErr, isOk, map, resolveErr, Result } from '../lib/result_type'; +import { RuleExecutionStatusErrorReasons } from '../types'; +import type { Result } from '../lib/result_type'; +import { asErr, asOk, isErr, isOk, map, resolveErr } from '../lib/result_type'; import { taskInstanceToAlertTaskInstance } from './alert_task_instance'; import { isAlertSavedObjectNotFoundError, isEsUnavailableError } from '../lib/is_alerting_error'; import { partiallyUpdateRuleWithEs, RULE_SAVED_OBJECT_TYPE } from '../saved_objects'; -import { +import type { AlertInstanceContext, AlertInstanceState, - parseDuration, RawAlertInstance, RuleAlertData, - RuleLastRunOutcomeOrderMap, RuleTypeParams, RuleTypeState, } from '../../common'; -import { NormalizedRuleType, UntypedNormalizedRuleType } from '../rule_type_registry'; +import { parseDuration, RuleLastRunOutcomeOrderMap } from '../../common'; +import type { NormalizedRuleType, UntypedNormalizedRuleType } from '../rule_type_registry'; import { getEsErrorMessage } from '../lib/errors'; -import { IN_MEMORY_METRICS, InMemoryMetrics } from '../monitoring'; +import type { InMemoryMetrics } from '../monitoring'; +import { IN_MEMORY_METRICS } from '../monitoring'; import { RuleRunMetricsStore } from '../lib/rule_run_metrics_store'; import { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; import { getDecryptedRule, validateRuleAndCreateFakeRequest } from './rule_loader'; diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner_alerts_client.test.ts b/x-pack/plugins/alerting/server/task_runner/task_runner_alerts_client.test.ts index 958ecaf8d270d..885c9a8371cd3 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner_alerts_client.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner_alerts_client.test.ts @@ -7,7 +7,7 @@ import sinon from 'sinon'; import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { +import type { RuleExecutorOptions, RuleTypeParams, RuleTypeState, @@ -16,12 +16,14 @@ import { Rule, RuleAlertData, RawRule, +} from '../types'; +import { MaintenanceWindowStatus, DEFAULT_FLAPPING_SETTINGS, DEFAULT_QUERY_DELAY_SETTINGS, } from '../types'; -import { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; -import { TaskRunnerContext } from './types'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import type { TaskRunnerContext } from './types'; import { TaskRunner } from './task_runner'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { @@ -33,11 +35,11 @@ import { elasticsearchServiceMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server'; +import type { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server'; import { actionsMock, actionsClientMock } from '@kbn/actions-plugin/server/mocks'; import { alertsMock } from '../mocks'; import { eventLoggerMock } from '@kbn/event-log-plugin/server/event_logger.mock'; -import { IEventLogger } from '@kbn/event-log-plugin/server'; +import type { IEventLogger } from '@kbn/event-log-plugin/server'; import { ruleTypeRegistryMock } from '../rule_type_registry.mock'; import { inMemoryMetricsMock } from '../monitoring/in_memory_metrics.mock'; import { @@ -57,11 +59,11 @@ import { getAlertFromRaw } from '../rules_client/lib/get_alert_from_raw'; import { dataPluginMock } from '@kbn/data-plugin/server/mocks'; import { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; import { alertingEventLoggerMock } from '../lib/alerting_event_logger/alerting_event_logger.mock'; -import { SharePluginStart } from '@kbn/share-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; -import { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; +import type { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; import { alertsServiceMock } from '../alerts_service/alerts_service.mock'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; import { alertsClientMock } from '../alerts_client/alerts_client.mock'; import * as LegacyAlertsClientModule from '../alerts_client/legacy_alerts_client'; import * as RuleRunMetricsStoreModule from '../lib/rule_run_metrics_store'; @@ -69,7 +71,7 @@ import { legacyAlertsClientMock } from '../alerts_client/legacy_alerts_client.mo import { ruleRunMetricsStoreMock } from '../lib/rule_run_metrics_store.mock'; import { AlertsService } from '../alerts_service'; import { ReplaySubject, Subject } from 'rxjs'; -import { IAlertsClient } from '../alerts_client/types'; +import type { IAlertsClient } from '../alerts_client/types'; import { getDataStreamAdapter } from '../alerts_service/lib/data_stream_adapter'; import { TIMESTAMP, @@ -106,7 +108,7 @@ import { import { backfillClientMock } from '../backfill_client/backfill_client.mock'; import { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; import { createTaskRunnerLogger } from './lib'; -import { SavedObject } from '@kbn/core/server'; +import type { SavedObject } from '@kbn/core/server'; import { maintenanceWindowsServiceMock } from './maintenance_windows/maintenance_windows_service.mock'; import { getMockMaintenanceWindow } from '../data/maintenance_window/test_helpers'; import { rulesSettingsServiceMock } from '../rules_settings/rules_settings_service.mock'; diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner_cancel.test.ts b/x-pack/plugins/alerting/server/task_runner/task_runner_cancel.test.ts index c96a3f95c636e..6c6f0674cf241 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner_cancel.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner_cancel.test.ts @@ -7,7 +7,7 @@ import sinon from 'sinon'; import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { +import type { RuleExecutorOptions, RuleTypeParams, RuleTypeState, @@ -15,10 +15,9 @@ import { AlertInstanceContext, Rule, RuleAlertData, - DEFAULT_FLAPPING_SETTINGS, - DEFAULT_QUERY_DELAY_SETTINGS, } from '../types'; -import { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { DEFAULT_FLAPPING_SETTINGS, DEFAULT_QUERY_DELAY_SETTINGS } from '../types'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; import { TaskRunner } from './task_runner'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { @@ -30,19 +29,17 @@ import { elasticsearchServiceMock, uiSettingsServiceMock, } from '@kbn/core/server/mocks'; -import { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server'; +import type { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server'; import { actionsMock, actionsClientMock } from '@kbn/actions-plugin/server/mocks'; import { alertsMock } from '../mocks'; import { eventLoggerMock } from '@kbn/event-log-plugin/server/event_logger.mock'; -import { IEventLogger } from '@kbn/event-log-plugin/server'; +import type { IEventLogger } from '@kbn/event-log-plugin/server'; import { ruleTypeRegistryMock } from '../rule_type_registry.mock'; import { dataPluginMock } from '@kbn/data-plugin/server/mocks'; import { inMemoryMetricsMock } from '../monitoring/in_memory_metrics.mock'; import { getAlertFromRaw } from '../rules_client/lib/get_alert_from_raw'; -import { - AlertingEventLogger, - ContextOpts, -} from '../lib/alerting_event_logger/alerting_event_logger'; +import type { ContextOpts } from '../lib/alerting_event_logger/alerting_event_logger'; +import { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; import { alertingEventLoggerMock } from '../lib/alerting_event_logger/alerting_event_logger.mock'; import { mockTaskInstance, @@ -54,15 +51,15 @@ import { mockedRawRuleSO, } from './fixtures'; import { EVENT_LOG_ACTIONS } from '../plugin'; -import { SharePluginStart } from '@kbn/share-plugin/server'; -import { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; +import type { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { alertsServiceMock } from '../alerts_service/alerts_service.mock'; import { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; import { RULE_SAVED_OBJECT_TYPE } from '../saved_objects'; -import { TaskRunnerContext } from './types'; +import type { TaskRunnerContext } from './types'; import { backfillClientMock } from '../backfill_client/backfill_client.mock'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; import { rulesSettingsServiceMock } from '../rules_settings/rules_settings_service.mock'; import { ALERTING_CASES_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server'; import { maintenanceWindowsServiceMock } from './maintenance_windows/maintenance_windows_service.mock'; diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner_factory.test.ts b/x-pack/plugins/alerting/server/task_runner/task_runner_factory.test.ts index ed4b5a0802232..628666ae3bc62 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner_factory.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner_factory.test.ts @@ -7,7 +7,8 @@ import sinon from 'sinon'; import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { ConcreteTaskInstance, TaskStatus } from '@kbn/task-manager-plugin/server'; +import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { TaskStatus } from '@kbn/task-manager-plugin/server'; import { TaskRunnerFactory } from './task_runner_factory'; import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; import { @@ -19,18 +20,18 @@ import { } from '@kbn/core/server/mocks'; import { actionsMock } from '@kbn/actions-plugin/server/mocks'; import { eventLoggerMock } from '@kbn/event-log-plugin/server/event_logger.mock'; -import { UntypedNormalizedRuleType } from '../rule_type_registry'; +import type { UntypedNormalizedRuleType } from '../rule_type_registry'; import { ruleTypeRegistryMock } from '../rule_type_registry.mock'; import { executionContextServiceMock } from '@kbn/core/server/mocks'; import { dataPluginMock } from '@kbn/data-plugin/server/mocks'; import { inMemoryMetricsMock } from '../monitoring/in_memory_metrics.mock'; -import { SharePluginStart } from '@kbn/share-plugin/server'; -import { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; +import type { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { alertsServiceMock } from '../alerts_service/alerts_service.mock'; import { schema } from '@kbn/config-schema'; import { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; -import { TaskRunnerContext } from './types'; +import type { TaskRunnerContext } from './types'; import { backfillClientMock } from '../backfill_client/backfill_client.mock'; import { rulesSettingsServiceMock } from '../rules_settings/rules_settings_service.mock'; import { maintenanceWindowsServiceMock } from './maintenance_windows/maintenance_windows_service.mock'; diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner_factory.ts b/x-pack/plugins/alerting/server/task_runner/task_runner_factory.ts index 1b91cce30edb9..728cb62bc7ff4 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner_factory.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner_factory.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RunContext } from '@kbn/task-manager-plugin/server'; -import { +import type { RunContext } from '@kbn/task-manager-plugin/server'; +import type { RuleAlertData, RuleTypeParams, RuleTypeState, @@ -14,9 +14,9 @@ import { AlertInstanceContext, } from '../types'; import { TaskRunner } from './task_runner'; -import { NormalizedRuleType } from '../rule_type_registry'; -import { InMemoryMetrics } from '../monitoring'; -import { TaskRunnerContext } from './types'; +import type { NormalizedRuleType } from '../rule_type_registry'; +import type { InMemoryMetrics } from '../monitoring'; +import type { TaskRunnerContext } from './types'; import { AD_HOC_RUN_SAVED_OBJECT_TYPE, RULE_SAVED_OBJECT_TYPE } from '../saved_objects'; import { AdHocTaskRunner } from './ad_hoc_task_runner'; diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner_timer.test.ts b/x-pack/plugins/alerting/server/task_runner/task_runner_timer.test.ts index 3cabaa1fe0450..d1a3c9134101b 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner_timer.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner_timer.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; import { loggingSystemMock } from '@kbn/core/server/mocks'; import { TaskRunnerTimer, TaskRunnerTimerSpan } from './task_runner_timer'; diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner_timer.ts b/x-pack/plugins/alerting/server/task_runner/task_runner_timer.ts index bcf07834acb66..146d4eabf4252 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner_timer.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner_timer.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Logger } from '@kbn/core/server'; +import type { Logger } from '@kbn/core/server'; export enum TaskRunnerTimerSpan { StartTaskRun = 'claim_to_start_duration_ms', diff --git a/x-pack/plugins/alerting/server/task_runner/transform_action_params.test.ts b/x-pack/plugins/alerting/server/task_runner/transform_action_params.test.ts index c343411d494b7..85830faf72f72 100644 --- a/x-pack/plugins/alerting/server/task_runner/transform_action_params.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/transform_action_params.test.ts @@ -10,7 +10,7 @@ import { actionsMock, renderActionParameterTemplatesDefault, } from '@kbn/actions-plugin/server/mocks'; -import { SanitizedRule } from '../types'; +import type { SanitizedRule } from '../types'; import { mockAAD } from './fixtures'; const actionsPlugin = actionsMock.createStart(); diff --git a/x-pack/plugins/alerting/server/task_runner/transform_action_params.ts b/x-pack/plugins/alerting/server/task_runner/transform_action_params.ts index fb934db0ffb7d..1774fb5fd85ef 100644 --- a/x-pack/plugins/alerting/server/task_runner/transform_action_params.ts +++ b/x-pack/plugins/alerting/server/task_runner/transform_action_params.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { PluginStartContract as ActionsPluginStartContract } from '@kbn/actions-plugin/server'; -import { ActionContextVariables, SummaryActionContextVariables } from '@kbn/alerting-types'; -import { AADAlert } from '@kbn/alerts-as-data-utils'; +import type { PluginStartContract as ActionsPluginStartContract } from '@kbn/actions-plugin/server'; +import type { ActionContextVariables, SummaryActionContextVariables } from '@kbn/alerting-types'; +import type { AADAlert } from '@kbn/alerts-as-data-utils'; import { mapKeys, snakeCase } from 'lodash/fp'; -import { +import type { RuleActionParams, AlertInstanceState, AlertInstanceContext, diff --git a/x-pack/plugins/alerting/server/task_runner/types.ts b/x-pack/plugins/alerting/server/task_runner/types.ts index a92ee2a89d654..f581e7afd2dca 100644 --- a/x-pack/plugins/alerting/server/task_runner/types.ts +++ b/x-pack/plugins/alerting/server/task_runner/types.ts @@ -14,20 +14,20 @@ import type { ElasticsearchServiceStart, UiSettingsServiceStart, } from '@kbn/core/server'; -import { ConcreteTaskInstance, DecoratedError } from '@kbn/task-manager-plugin/server'; -import { PublicMethodsOf } from '@kbn/utility-types'; -import { PluginStartContract as ActionsPluginStartContract } from '@kbn/actions-plugin/server'; -import { ActionsClient } from '@kbn/actions-plugin/server/actions_client'; -import { PluginStart as DataPluginStart } from '@kbn/data-plugin/server'; -import { PluginStart as DataViewsPluginStart } from '@kbn/data-views-plugin/server'; -import { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server'; -import { IEventLogger } from '@kbn/event-log-plugin/server'; -import { SharePluginStart } from '@kbn/share-plugin/server'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { IAlertsClient } from '../alerts_client/types'; -import { Alert } from '../alert'; -import { AlertsService } from '../alerts_service/alerts_service'; -import { +import type { ConcreteTaskInstance, DecoratedError } from '@kbn/task-manager-plugin/server'; +import type { PublicMethodsOf } from '@kbn/utility-types'; +import type { PluginStartContract as ActionsPluginStartContract } from '@kbn/actions-plugin/server'; +import type { ActionsClient } from '@kbn/actions-plugin/server/actions_client'; +import type { PluginStart as DataPluginStart } from '@kbn/data-plugin/server'; +import type { PluginStart as DataViewsPluginStart } from '@kbn/data-views-plugin/server'; +import type { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server'; +import type { IEventLogger } from '@kbn/event-log-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; +import type { IAlertsClient } from '../alerts_client/types'; +import type { Alert } from '../alert'; +import type { AlertsService } from '../alerts_service/alerts_service'; +import type { AlertInstanceContext, AlertInstanceState, RuleTypeParams, @@ -41,21 +41,21 @@ import { RuleSystemAction, RulesSettingsFlappingProperties, } from '../../common'; -import { ActionsConfigMap } from '../lib/get_actions_config_map'; -import { NormalizedRuleType } from '../rule_type_registry'; -import { +import type { ActionsConfigMap } from '../lib/get_actions_config_map'; +import type { NormalizedRuleType } from '../rule_type_registry'; +import type { CombinedSummarizedAlerts, RawRule, RuleTypeRegistry, SpaceIdToNamespaceFunction, } from '../types'; -import { RuleRunMetrics, RuleRunMetricsStore } from '../lib/rule_run_metrics_store'; -import { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; -import { BackfillClient } from '../backfill_client/backfill_client'; -import { ElasticsearchError } from '../lib'; -import { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; -import { RulesSettingsService } from '../rules_settings'; -import { MaintenanceWindowsService } from './maintenance_windows'; +import type { RuleRunMetrics, RuleRunMetricsStore } from '../lib/rule_run_metrics_store'; +import type { AlertingEventLogger } from '../lib/alerting_event_logger/alerting_event_logger'; +import type { BackfillClient } from '../backfill_client/backfill_client'; +import type { ElasticsearchError } from '../lib'; +import type { ConnectorAdapterRegistry } from '../connector_adapters/connector_adapter_registry'; +import type { RulesSettingsService } from '../rules_settings'; +import type { MaintenanceWindowsService } from './maintenance_windows'; export interface RuleTaskRunResult { state: RuleTaskState; diff --git a/x-pack/plugins/alerting/server/test_utils/index.ts b/x-pack/plugins/alerting/server/test_utils/index.ts index 036454f2f80c6..f9f2e29aae878 100644 --- a/x-pack/plugins/alerting/server/test_utils/index.ts +++ b/x-pack/plugins/alerting/server/test_utils/index.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RawAlertInstance } from '../../common'; -import { AlertingConfig } from '../config'; +import type { RawAlertInstance } from '../../common'; +import type { AlertingConfig } from '../config'; interface Resolvable { resolve: (arg: T) => void; diff --git a/x-pack/plugins/alerting/server/types.ts b/x-pack/plugins/alerting/server/types.ts index b660d348b9e06..457566d4d5d39 100644 --- a/x-pack/plugins/alerting/server/types.ts +++ b/x-pack/plugins/alerting/server/types.ts @@ -11,11 +11,11 @@ import type { SavedObjectReference, IUiSettingsClient, } from '@kbn/core/server'; -import { z } from '@kbn/zod'; -import { DataViewsContract } from '@kbn/data-views-plugin/common'; -import { ISearchStartSearchSource } from '@kbn/data-plugin/common'; -import { LicenseType } from '@kbn/licensing-plugin/server'; -import { +import type { z } from '@kbn/zod'; +import type { DataViewsContract } from '@kbn/data-views-plugin/common'; +import type { ISearchStartSearchSource } from '@kbn/data-plugin/common'; +import type { LicenseType } from '@kbn/licensing-plugin/server'; +import type { IScopedClusterClient, SavedObjectAttributes, SavedObjectsClientContract, @@ -23,22 +23,22 @@ import { } from '@kbn/core/server'; import type { ObjectType } from '@kbn/config-schema'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { SharePluginStart } from '@kbn/share-plugin/server'; +import type { SharePluginStart } from '@kbn/share-plugin/server'; import type { DefaultAlert, FieldMap } from '@kbn/alerts-as-data-utils'; -import { Alert } from '@kbn/alerts-as-data-utils'; -import { ActionsApiRequestHandlerContext } from '@kbn/actions-plugin/server'; -import { AlertsHealth } from '@kbn/alerting-types'; -import { RuleTypeRegistry as OrigruleTypeRegistry } from './rule_type_registry'; -import { PluginSetupContract, PluginStartContract } from './plugin'; -import { RulesClient } from './rules_client'; -import { +import type { Alert } from '@kbn/alerts-as-data-utils'; +import type { ActionsApiRequestHandlerContext } from '@kbn/actions-plugin/server'; +import type { AlertsHealth } from '@kbn/alerting-types'; +import type { RuleTypeRegistry as OrigruleTypeRegistry } from './rule_type_registry'; +import type { PluginSetupContract, PluginStartContract } from './plugin'; +import type { RulesClient } from './rules_client'; +import type { RulesSettingsClient, RulesSettingsFlappingClient, RulesSettingsQueryDelayClient, } from './rules_settings'; -import { MaintenanceWindowClient } from './maintenance_window_client'; +import type { MaintenanceWindowClient } from './maintenance_window_client'; export * from '../common'; -import { +import type { Rule, RuleTypeParams, RuleTypeState, @@ -51,10 +51,10 @@ import { SanitizedRule, RuleAlertData, } from '../common'; -import { PublicAlertFactory } from './alert/create_alert_factory'; -import { RulesSettingsFlappingProperties } from '../common/rules_settings'; -import { PublicAlertsClient } from './alerts_client/types'; -import { GetTimeRangeResult } from './lib/get_time_range'; +import type { PublicAlertFactory } from './alert/create_alert_factory'; +import type { RulesSettingsFlappingProperties } from '../common/rules_settings'; +import type { PublicAlertsClient } from './alerts_client/types'; +import type { GetTimeRangeResult } from './lib/get_time_range'; export type WithoutQueryAndParams = Pick>; export type SpaceIdToNamespaceFunction = (spaceId?: string) => string | undefined; export type { RuleTypeParams }; diff --git a/x-pack/plugins/alerting/server/usage/alerting_usage_collector.test.ts b/x-pack/plugins/alerting/server/usage/alerting_usage_collector.test.ts index b13e678ce4402..b7dd55207447f 100644 --- a/x-pack/plugins/alerting/server/usage/alerting_usage_collector.test.ts +++ b/x-pack/plugins/alerting/server/usage/alerting_usage_collector.test.ts @@ -5,10 +5,13 @@ * 2.0. */ -import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; +import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; import { registerAlertingUsageCollector } from './alerting_usage_collector'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { ConcreteTaskInstance, TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; +import type { + ConcreteTaskInstance, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; const taskManagerStart = taskManagerMock.createStart(); beforeEach(() => jest.resetAllMocks()); diff --git a/x-pack/plugins/alerting/server/usage/alerting_usage_collector.ts b/x-pack/plugins/alerting/server/usage/alerting_usage_collector.ts index 18c33051e4740..19b805b8bb763 100644 --- a/x-pack/plugins/alerting/server/usage/alerting_usage_collector.ts +++ b/x-pack/plugins/alerting/server/usage/alerting_usage_collector.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { MakeSchemaFrom, UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; +import type { MakeSchemaFrom, UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; import { get } from 'lodash'; -import { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; -import { AlertingUsage } from './types'; +import type { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; +import type { AlertingUsage } from './types'; const byTypeSchema: MakeSchemaFrom['count_by_type'] = { // TODO: Find out an automated way to populate the keys or reformat these into an array (and change the Remote Telemetry indexer accordingly) diff --git a/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_alerts.ts b/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_alerts.ts index f5537687fd3dd..4a15ae40bf8ed 100644 --- a/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_alerts.ts +++ b/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_alerts.ts @@ -9,11 +9,11 @@ import type { AggregationsTermsAggregateBase, AggregationsStringTermsBucketKeys, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { ElasticsearchClient, Logger } from '@kbn/core/server'; +import type { ElasticsearchClient, Logger } from '@kbn/core/server'; import { NUM_ALERTING_RULE_TYPES } from '../alerting_usage_collector'; import { parseSimpleRuleTypeBucket } from './parse_simple_rule_type_bucket'; -import { AlertingUsage } from '../types'; +import type { AlertingUsage } from '../types'; interface Opts { esClient: ElasticsearchClient; diff --git a/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_event_log.ts b/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_event_log.ts index df76929ca5d50..16b4e6ac6348c 100644 --- a/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_event_log.ts +++ b/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_event_log.ts @@ -15,7 +15,7 @@ import type { AggregationsStringTermsBucketKeys, AggregationsBuckets, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { ElasticsearchClient, Logger } from '@kbn/core/server'; +import type { ElasticsearchClient, Logger } from '@kbn/core/server'; import { NUM_ALERTING_RULE_TYPES, NUM_ALERTING_EXECUTION_FAILURE_REASON_TYPES, diff --git a/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_kibana.test.ts b/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_kibana.test.ts index 7c06e9867dae3..9a30a46c0708f 100644 --- a/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_kibana.test.ts +++ b/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_kibana.test.ts @@ -13,7 +13,7 @@ import { } from './get_telemetry_from_kibana'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../common'; -import { ISavedObjectsRepository } from '@kbn/core/server'; +import type { ISavedObjectsRepository } from '@kbn/core/server'; const elasticsearch = elasticsearchServiceMock.createStart(); const esClient = elasticsearch.client.asInternalUser; diff --git a/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_kibana.ts b/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_kibana.ts index 756512815d901..62ac7e366dbc8 100644 --- a/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_kibana.ts +++ b/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_kibana.ts @@ -11,20 +11,18 @@ import type { AggregationsTermsAggregateBase, AggregationsStringTermsBucketKeys, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { ElasticsearchClient, Logger, ISavedObjectsRepository } from '@kbn/core/server'; +import type { ElasticsearchClient, Logger, ISavedObjectsRepository } from '@kbn/core/server'; -import { - ConnectorsByConsumersBucket, - groupConnectorsByConsumers, -} from './group_connectors_by_consumers'; +import type { ConnectorsByConsumersBucket } from './group_connectors_by_consumers'; +import { groupConnectorsByConsumers } from './group_connectors_by_consumers'; import { groupRulesByNotifyWhen } from './group_rules_by_notify_when'; import { groupRulesByStatus } from './group_rules_by_status'; -import { AlertingUsage } from '../types'; +import type { AlertingUsage } from '../types'; import { NUM_ALERTING_RULE_TYPES } from '../alerting_usage_collector'; import { parseSimpleRuleTypeBucket } from './parse_simple_rule_type_bucket'; import { groupRulesBySearchType } from './group_rules_by_search_type'; import { MAINTENANCE_WINDOW_SAVED_OBJECT_TYPE } from '../../../common'; -import { MaintenanceWindowAttributes } from '../../data/maintenance_window/types'; +import type { MaintenanceWindowAttributes } from '../../data/maintenance_window/types'; interface Opts { esClient: ElasticsearchClient; diff --git a/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_task_manager.ts b/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_task_manager.ts index f3741a086bf9b..863e69072d8aa 100644 --- a/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_task_manager.ts +++ b/x-pack/plugins/alerting/server/usage/lib/get_telemetry_from_task_manager.ts @@ -11,7 +11,7 @@ import type { AggregationsStringTermsBucketKeys, AggregationsBuckets, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { ElasticsearchClient, Logger } from '@kbn/core/server'; +import type { ElasticsearchClient, Logger } from '@kbn/core/server'; import { replaceDotSymbols } from './replace_dots_with_underscores'; import { NUM_ALERTING_RULE_TYPES } from '../alerting_usage_collector'; diff --git a/x-pack/plugins/alerting/server/usage/lib/group_connectors_by_consumers.ts b/x-pack/plugins/alerting/server/usage/lib/group_connectors_by_consumers.ts index 3c29f31f0eb9f..ab961653e6a0c 100644 --- a/x-pack/plugins/alerting/server/usage/lib/group_connectors_by_consumers.ts +++ b/x-pack/plugins/alerting/server/usage/lib/group_connectors_by_consumers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AggregationsBuckets } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { AggregationsBuckets } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { replaceDotSymbols } from './replace_dots_with_underscores'; export interface ConnectorsByConsumersBucket { diff --git a/x-pack/plugins/alerting/server/usage/lib/group_rules_by_notify_when.ts b/x-pack/plugins/alerting/server/usage/lib/group_rules_by_notify_when.ts index 3adc9c73f9a72..3ce8e072d1f40 100644 --- a/x-pack/plugins/alerting/server/usage/lib/group_rules_by_notify_when.ts +++ b/x-pack/plugins/alerting/server/usage/lib/group_rules_by_notify_when.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AlertingUsage } from '../types'; +import type { AlertingUsage } from '../types'; export function groupRulesByNotifyWhen( rulesByNotifyWhen: Record diff --git a/x-pack/plugins/alerting/server/usage/lib/group_rules_by_search_type.ts b/x-pack/plugins/alerting/server/usage/lib/group_rules_by_search_type.ts index b97ac049c2374..e1cb542486d20 100644 --- a/x-pack/plugins/alerting/server/usage/lib/group_rules_by_search_type.ts +++ b/x-pack/plugins/alerting/server/usage/lib/group_rules_by_search_type.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AlertingUsage } from '../types'; +import type { AlertingUsage } from '../types'; export function groupRulesBySearchType( rulesBySearchType: Record diff --git a/x-pack/plugins/alerting/server/usage/lib/group_rules_by_status.ts b/x-pack/plugins/alerting/server/usage/lib/group_rules_by_status.ts index a4b114b0cb85f..7996e0254903f 100644 --- a/x-pack/plugins/alerting/server/usage/lib/group_rules_by_status.ts +++ b/x-pack/plugins/alerting/server/usage/lib/group_rules_by_status.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AlertingUsage } from '../types'; +import type { AlertingUsage } from '../types'; export function groupRulesByStatus( rulesByStatus: Record diff --git a/x-pack/plugins/alerting/server/usage/lib/parse_simple_rule_type_bucket.ts b/x-pack/plugins/alerting/server/usage/lib/parse_simple_rule_type_bucket.ts index f3d3007061365..54ff7f74ed17f 100644 --- a/x-pack/plugins/alerting/server/usage/lib/parse_simple_rule_type_bucket.ts +++ b/x-pack/plugins/alerting/server/usage/lib/parse_simple_rule_type_bucket.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { +import type { AggregationsBuckets, AggregationsStringTermsBucketKeys, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; diff --git a/x-pack/plugins/alerting/server/usage/task.ts b/x-pack/plugins/alerting/server/usage/task.ts index 9767574cab0a0..0be49ffd48356 100644 --- a/x-pack/plugins/alerting/server/usage/task.ts +++ b/x-pack/plugins/alerting/server/usage/task.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { Logger, CoreSetup } from '@kbn/core/server'; -import { +import type { Logger, CoreSetup } from '@kbn/core/server'; +import type { RunContext, TaskManagerSetupContract, TaskManagerStartContract, diff --git a/x-pack/plugins/alerting/server/usage/task_state.ts b/x-pack/plugins/alerting/server/usage/task_state.ts index 3b33e540914ce..ee4e0377f1ec4 100644 --- a/x-pack/plugins/alerting/server/usage/task_state.ts +++ b/x-pack/plugins/alerting/server/usage/task_state.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import type { TypeOf } from '@kbn/config-schema'; +import { schema } from '@kbn/config-schema'; /** * WARNING: Do not modify the existing versioned schema(s) below, instead define a new version (ex: 2, 3, 4). diff --git a/x-pack/plugins/integration_assistant/server/__mocks__/mock_server.ts b/x-pack/plugins/integration_assistant/server/__mocks__/mock_server.ts index d2ece6e91ead6..7536c5e4e9536 100644 --- a/x-pack/plugins/integration_assistant/server/__mocks__/mock_server.ts +++ b/x-pack/plugins/integration_assistant/server/__mocks__/mock_server.ts @@ -105,7 +105,6 @@ class MockServer { return getRoute(this.router, request); } - // eslint-disable-next-line @typescript-eslint/no-explicit-any private maybeValidate(part: any, validator?: any): any { return typeof validator === 'function' ? validator(part, this.resultMock) : part; } diff --git a/x-pack/plugins/integration_assistant/server/__mocks__/test_adapters.ts b/x-pack/plugins/integration_assistant/server/__mocks__/test_adapters.ts index 61fbf03e4c14d..4490c0a52498c 100644 --- a/x-pack/plugins/integration_assistant/server/__mocks__/test_adapters.ts +++ b/x-pack/plugins/integration_assistant/server/__mocks__/test_adapters.ts @@ -10,10 +10,10 @@ import type { responseMock } from './response'; type ResponseMock = ReturnType; type Method = keyof ResponseMock; -type MockCall = any; // eslint-disable-line @typescript-eslint/no-explicit-any +type MockCall = any; interface ResponseCall { - body: any; // eslint-disable-line @typescript-eslint/no-explicit-any + body: any; status: number; } diff --git a/x-pack/plugins/integration_assistant/server/graphs/ecs/chunk.ts b/x-pack/plugins/integration_assistant/server/graphs/ecs/chunk.ts index ca114f114e518..0c22cd19c090f 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/ecs/chunk.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/ecs/chunk.ts @@ -4,7 +4,6 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { merge } from '../../util/samples'; diff --git a/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts b/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts index b5a6e23000d32..ae52a4e491f97 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/ecs/pipeline.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -/* eslint-disable @typescript-eslint/no-explicit-any */ + import { load } from 'js-yaml'; import { Environment, FileSystemLoader } from 'nunjucks'; import { join as joinPath } from 'path'; diff --git a/x-pack/plugins/integration_assistant/server/graphs/ecs/validate.ts b/x-pack/plugins/integration_assistant/server/graphs/ecs/validate.ts index 033c6651982ea..233b32f54e85c 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/ecs/validate.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/ecs/validate.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -/* eslint-disable @typescript-eslint/no-explicit-any */ + import { EcsFields, ECS_FULL } from '../../../common/ecs'; import { mergeSamples } from '../../util/samples'; import { ECS_RESERVED } from './constants'; diff --git a/x-pack/plugins/integration_assistant/server/lib/errors/unsupported_error.ts b/x-pack/plugins/integration_assistant/server/lib/errors/unsupported_error.ts index 7ab4e0569ca83..8413bf3abf26e 100644 --- a/x-pack/plugins/integration_assistant/server/lib/errors/unsupported_error.ts +++ b/x-pack/plugins/integration_assistant/server/lib/errors/unsupported_error.ts @@ -12,7 +12,6 @@ import { GenerationErrorCode } from '../../../common/constants'; export class UnsupportedLogFormatError extends Error implements ErrorThatHandlesItsOwnResponse { private readonly errorCode: string = GenerationErrorCode.UNSUPPORTED_LOG_SAMPLES_FORMAT; - // eslint-disable-next-line @typescript-eslint/no-useless-constructor constructor(message: string) { super(message); } diff --git a/x-pack/plugins/integration_assistant/server/util/samples.ts b/x-pack/plugins/integration_assistant/server/util/samples.ts index 9f14f20816415..d0bc119f8b645 100644 --- a/x-pack/plugins/integration_assistant/server/util/samples.ts +++ b/x-pack/plugins/integration_assistant/server/util/samples.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -/* eslint-disable @typescript-eslint/no-explicit-any */ + import { dump } from 'js-yaml'; import type { CategorizationState, EcsMappingState, RelatedState } from '../types';