diff --git a/x-pack/plugins/security_solution/server/config.mock.ts b/x-pack/plugins/security_solution/server/config.mock.ts index 1c404104fb3f2..97cd8bcd2e75d 100644 --- a/x-pack/plugins/security_solution/server/config.mock.ts +++ b/x-pack/plugins/security_solution/server/config.mock.ts @@ -10,7 +10,7 @@ import { ExperimentalFeatures, parseExperimentalConfigValue, } from '../common/experimental_features'; -import { ConfigType } from './config'; +import type { ConfigType } from './config'; import { UnderlyingLogClient } from './lib/detection_engine/rule_execution_log/types'; export const createMockConfig = (): ConfigType => { diff --git a/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts b/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts index caea18da75ae4..223cedf7aa8df 100644 --- a/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts +++ b/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts @@ -18,7 +18,7 @@ import { AgentPolicyServiceInterface, PackagePolicyServiceInterface, } from '../../../fleet/server'; -import { PluginStartContract as AlertsPluginStartContract } from '../../../alerting/server'; +import type { PluginStartContract as AlertsPluginStartContract } from '../../../alerting/server'; import { getPackagePolicyCreateCallback, getPackagePolicyUpdateCallback, diff --git a/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts b/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts index a53d5d43de524..e4719efda75a3 100644 --- a/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts +++ b/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts @@ -7,7 +7,7 @@ import { KibanaRequest, Logger, RequestHandlerContext } from 'kibana/server'; import { ExceptionListClient } from '../../../lists/server'; -import { PluginStartContract as AlertsStartContract } from '../../../alerting/server'; +import type { PluginStartContract as AlertsStartContract } from '../../../alerting/server'; import { PostPackagePolicyCreateCallback, PostPackagePolicyDeleteCallback, diff --git a/x-pack/plugins/security_solution/server/fleet_integration/handlers/install_prepackaged_rules.ts b/x-pack/plugins/security_solution/server/fleet_integration/handlers/install_prepackaged_rules.ts index 01368ccb22c62..f598d5426a949 100644 --- a/x-pack/plugins/security_solution/server/fleet_integration/handlers/install_prepackaged_rules.ts +++ b/x-pack/plugins/security_solution/server/fleet_integration/handlers/install_prepackaged_rules.ts @@ -7,7 +7,7 @@ import { KibanaRequest, Logger } from 'kibana/server'; import { ExceptionListClient } from '../../../../lists/server'; -import { PluginStartContract as AlertsStartContract } from '../../../../alerting/server'; +import type { PluginStartContract as AlertsStartContract } from '../../../../alerting/server'; import { createDetectionIndex } from '../../lib/detection_engine/routes/index/create_index_route'; import { createPrepackagedRules } from '../../lib/detection_engine/routes/rules/add_prepackaged_rules_route'; import { SecuritySolutionApiRequestHandlerContext } from '../../types'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_create_notifications.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_create_notifications.ts index 13e4b405ca26b..f52c84932adac 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_create_notifications.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_create_notifications.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SanitizedAlert } from '../../../../../alerting/common'; +import type { SanitizedAlert } from '../../../../../alerting/common'; import { SERVER_APP_ID, LEGACY_NOTIFICATIONS_ID } from '../../../../common/constants'; // eslint-disable-next-line no-restricted-imports import { CreateNotificationParams, LegacyRuleNotificationAlertTypeParams } from './legacy_types'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_find_notifications.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_find_notifications.ts index 51584879a4bd9..1f545ebd01fd2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_find_notifications.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_find_notifications.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AlertTypeParams, FindResult } from '../../../../../alerting/server'; +import type { AlertTypeParams, FindResult } from '../../../../../alerting/server'; import { LEGACY_NOTIFICATIONS_ID } from '../../../../common/constants'; // eslint-disable-next-line no-restricted-imports import { LegacyFindNotificationParams } from './legacy_types'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_read_notifications.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_read_notifications.ts index 9e2fb9515bb82..437af26e10c29 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_read_notifications.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_read_notifications.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AlertTypeParams, SanitizedAlert } from '../../../../../alerting/common'; +import type { AlertTypeParams, SanitizedAlert } from '../../../../../alerting/common'; // eslint-disable-next-line no-restricted-imports import { LegacyReadNotificationParams, legacyIsAlertType } from './legacy_types'; // eslint-disable-next-line no-restricted-imports diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_rules_notification_alert_type.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_rules_notification_alert_type.ts index fa05b1fb5b07a..2840c311f0f3e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_rules_notification_alert_type.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_rules_notification_alert_type.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import { parseScheduleDates } from '@kbn/securitysolution-io-ts-utils'; import { DEFAULT_RULE_NOTIFICATION_QUERY_SIZE, @@ -18,7 +18,7 @@ import { LegacyNotificationAlertTypeDefinition, legacyRulesNotificationParams, } from './legacy_types'; -import { AlertAttributes } from '../signals/types'; +import type { AlertAttributes } from '../signals/types'; import { siemRuleActionGroups } from '../signals/siem_rule_action_groups'; import { scheduleNotificationActions } from './schedule_notification_actions'; import { getNotificationResultsLink } from './utils'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_references.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_references.test.ts index 231451947a1dd..91e35a3be36ac 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_references.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_references.test.ts @@ -7,7 +7,7 @@ import { loggingSystemMock } from 'src/core/server/mocks'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesNotificationParams } from '../legacy_types'; +import type { LegacyRulesNotificationParams } from '../legacy_types'; // eslint-disable-next-line no-restricted-imports import { legacyExtractReferences } from './legacy_extract_references'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_references.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_references.ts index 1461b78ba73a6..aaa7861674c1b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_references.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_references.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { Logger } from 'src/core/server'; -import { RuleParamsAndRefs } from '../../../../../../alerting/server'; +import type { Logger } from 'src/core/server'; +import type { RuleParamsAndRefs } from '../../../../../../alerting/server'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesNotificationParams } from '../legacy_types'; +import type { LegacyRulesNotificationParams } from '../legacy_types'; // eslint-disable-next-line no-restricted-imports import { legacyExtractRuleId } from './legacy_extract_rule_id'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_rule_id.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_rule_id.test.ts index 8e6732727abf2..3c1f886e1236a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_rule_id.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_rule_id.test.ts @@ -7,7 +7,7 @@ import { loggingSystemMock } from 'src/core/server/mocks'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesNotificationParams } from '../legacy_types'; +import type { LegacyRulesNotificationParams } from '../legacy_types'; // eslint-disable-next-line no-restricted-imports import { legacyExtractRuleId } from './legacy_extract_rule_id'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_rule_id.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_rule_id.ts index 1647e213c1e9e..14835537ee46d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_rule_id.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_extract_rule_id.ts @@ -10,7 +10,7 @@ import { Logger, SavedObjectReference } from 'src/core/server'; // eslint-disable-next-line no-restricted-imports import { legacyGetRuleReference } from '../../rule_actions/legacy_utils'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesNotificationParams } from '../legacy_types'; +import type { LegacyRulesNotificationParams } from '../legacy_types'; /** * This extracts the "ruleAlertId" "id" and returns it as a saved object reference. diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_references.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_references.test.ts index ae34479e73534..600960afa6115 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_references.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_references.test.ts @@ -6,10 +6,10 @@ */ import { loggingSystemMock } from 'src/core/server/mocks'; -import { SavedObjectReference } from 'src/core/server'; +import type { SavedObjectReference } from 'src/core/server'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesNotificationParams } from '../legacy_types'; +import type { LegacyRulesNotificationParams } from '../legacy_types'; // eslint-disable-next-line no-restricted-imports import { legacyInjectReferences } from './legacy_inject_references'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_references.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_references.ts index 5a7118d64ba3a..f7a65d0d5e82e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_references.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_references.ts @@ -7,7 +7,7 @@ import { Logger, SavedObjectReference } from 'src/core/server'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesNotificationParams } from '../legacy_types'; +import type { LegacyRulesNotificationParams } from '../legacy_types'; // eslint-disable-next-line no-restricted-imports import { legacyInjectRuleIdReferences } from './legacy_inject_rule_id_references'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_rule_id_references.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_rule_id_references.test.ts index f28d78e5c0304..611cd16ed959e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_rule_id_references.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_rule_id_references.test.ts @@ -6,12 +6,12 @@ */ import { loggingSystemMock } from 'src/core/server/mocks'; -import { SavedObjectReference } from 'src/core/server'; +import type { SavedObjectReference } from 'src/core/server'; // eslint-disable-next-line no-restricted-imports import { legacyInjectRuleIdReferences } from './legacy_inject_rule_id_references'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesNotificationParams } from '../legacy_types'; +import type { LegacyRulesNotificationParams } from '../legacy_types'; describe('legacy_inject_rule_id_references', () => { type FuncReturn = ReturnType; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_rule_id_references.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_rule_id_references.ts index b6ad98eb864ed..24224c5831977 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_rule_id_references.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_saved_object_references/legacy_inject_rule_id_references.ts @@ -7,7 +7,7 @@ import { Logger, SavedObjectReference } from 'src/core/server'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesNotificationParams } from '../legacy_types'; +import type { LegacyRulesNotificationParams } from '../legacy_types'; /** * This injects any legacy "id"'s from saved object reference and returns the "ruleAlertId" using the saved object reference. If for diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_types.ts index 28fa62f28ed2e..6bde3a57824fe 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/legacy_types.ts @@ -7,7 +7,7 @@ import { schema, TypeOf } from '@kbn/config-schema'; -import { +import type { RulesClient, PartialAlert, AlertType, @@ -17,7 +17,7 @@ import { AlertInstanceContext, AlertExecutorOptions, } from '../../../../../alerting/server'; -import { Alert, AlertAction } from '../../../../../alerting/common'; +import type { Alert, AlertAction } from '../../../../../alerting/common'; import { LEGACY_NOTIFICATIONS_ID } from '../../../../common/constants'; /** diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/schedule_notification_actions.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/schedule_notification_actions.ts index 2362a6a392a56..86054ab740f8e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/schedule_notification_actions.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/schedule_notification_actions.ts @@ -6,12 +6,12 @@ */ import { mapKeys, snakeCase } from 'lodash/fp'; -import { AlertInstance } from '../../../../../alerting/server'; +import type { AlertInstance } from '../../../../../alerting/server'; import { expandDottedObject } from '../rule_types/utils'; -import { RuleParams } from '../schemas/rule_schemas'; +import type { RuleParams } from '../schemas/rule_schemas'; import aadFieldConversion from '../routes/index/signal_aad_mapping.json'; import { isRACAlert } from '../signals/utils'; -import { RACAlert } from '../rule_types/types'; +import type { RACAlert } from '../rule_types/types'; export type NotificationRuleTypeParams = RuleParams & { id: string; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/schedule_throttle_notification_actions.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/schedule_throttle_notification_actions.ts index 7b4b314cc8911..a862ecad731ea 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/schedule_throttle_notification_actions.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/schedule_throttle_notification_actions.ts @@ -7,8 +7,8 @@ import { ElasticsearchClient, SavedObject, Logger } from 'src/core/server'; import { parseScheduleDates } from '@kbn/securitysolution-io-ts-utils'; -import { AlertInstance } from '../../../../../alerting/server'; -import { RuleParams } from '../schemas/rule_schemas'; +import type { AlertInstance } from '../../../../../alerting/server'; +import type { RuleParams } from '../schemas/rule_schemas'; import { deconflictSignalsAndResults, getNotificationResultsLink } from '../notifications/utils'; import { DEFAULT_RULE_NOTIFICATION_QUERY_SIZE } from '../../../../common/constants'; import { getSignals } from '../notifications/get_signals'; @@ -16,7 +16,7 @@ import { NotificationRuleTypeParams, scheduleNotificationActions, } from './schedule_notification_actions'; -import { AlertAttributes } from '../signals/types'; +import type { AlertAttributes } from '../signals/types'; interface ScheduleThrottledNotificationActionsOptions { id: SavedObject['id']; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/utils.ts index c8fc6febe4d0f..4aada5c13dfc4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/notifications/utils.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import { APP_PATH } from '../../../../common/constants'; -import { SignalSearchResponse } from '../signals/types'; +import type { SignalSearchResponse } from '../signals/types'; export const getNotificationResultsLink = ({ kibanaSiemAppUrl = APP_PATH, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts index fc88e7b8b2be0..7840a924fd03a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts @@ -8,10 +8,13 @@ import type { MockedKeys } from '@kbn/utility-types/jest'; import { coreMock } from 'src/core/server/mocks'; -import { ActionsApiRequestHandlerContext } from '../../../../../../actions/server'; -import { AlertingApiRequestHandlerContext } from '../../../../../../alerting/server'; +import type { ActionsApiRequestHandlerContext } from '../../../../../../actions/server'; +import type { AlertingApiRequestHandlerContext } from '../../../../../../alerting/server'; import { rulesClientMock } from '../../../../../../alerting/server/mocks'; -import { actionsClientMock } from '../../../../../../actions/server/mocks'; + +// We have to disable this path otherwise we leak memory and cannot directly import from "../../../../../../actions/server/" +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { actionsClientMock } from '../../../../../../actions/server/actions_client.mock'; import { licensingMock } from '../../../../../../licensing/server/mocks'; import { listMock } from '../../../../../../lists/server/mocks'; import { ruleRegistryMocks } from '../../../../../../rule_registry/server/mocks'; @@ -27,7 +30,7 @@ import type { SecuritySolutionRequestHandlerContext, } from '../../../../types'; -const createMockClients = () => { +export const createMockClients = () => { const core = coreMock.createRequestHandlerContext(); const license = licensingMock.createLicenseMock(); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts index 3c1a49c640863..182a7805babd9 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts @@ -9,9 +9,9 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { ALERT_WORKFLOW_STATUS } from '@kbn/rule-data-utils'; import { ruleTypeMappings } from '@kbn/securitysolution-rules'; -import { SavedObjectsFindResponse } from 'src/core/server'; +import type { SavedObjectsFindResponse } from 'src/core/server'; -import { ActionResult } from '../../../../../../actions/server'; +import type { ActionResult } from '../../../../../../actions/server'; import { DETECTION_ENGINE_RULES_URL, DETECTION_ENGINE_SIGNALS_STATUS_URL, @@ -25,21 +25,21 @@ import { DETECTION_ENGINE_RULES_BULK_ACTION, INTERNAL_DETECTION_ENGINE_RULE_STATUS_URL, } from '../../../../../common/constants'; -import { +import type { RuleAlertType, IRuleSavedAttributesSavedObjectAttributes, HapiReadableStream, IRuleStatusSOAttributes, } from '../../rules/types'; import { requestMock } from './request'; -import { QuerySignalsSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/query_signals_index_schema'; -import { SetSignalsStatusSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/set_signal_status_schema'; +import type { QuerySignalsSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/query_signals_index_schema'; +import type { SetSignalsStatusSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/set_signal_status_schema'; import { getCreateRulesSchemaMock } from '../../../../../common/detection_engine/schemas/request/rule_schemas.mock'; import { getFinalizeSignalsMigrationSchemaMock } from '../../../../../common/detection_engine/schemas/request/finalize_signals_migration_schema.mock'; -import { EqlSearchResponse } from '../../../../../common/detection_engine/types'; +import type { EqlSearchResponse } from '../../../../../common/detection_engine/types'; import { getSignalsMigrationStatusSchemaMock } from '../../../../../common/detection_engine/schemas/request/get_signals_migration_status_schema.mock'; -import { RuleParams } from '../../schemas/rule_schemas'; -import { SanitizedAlert, ResolvedSanitizedRule } from '../../../../../../alerting/common'; +import type { RuleParams } from '../../schemas/rule_schemas'; +import type { SanitizedAlert, ResolvedSanitizedRule } from '../../../../../../alerting/common'; import { getQueryRuleParams } from '../../schemas/rule_schemas.mock'; import { getPerformBulkActionSchemaMock } from '../../../../../common/detection_engine/schemas/request/perform_bulk_action_schema.mock'; import { RuleExecutionStatus } from '../../../../../common/detection_engine/schemas/common/schemas'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/read_index_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/read_index_route.ts index 3b1b27176ef88..51ce47ac88d7a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/read_index_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/read_index_route.ts @@ -10,7 +10,7 @@ import type { SecuritySolutionPluginRouter } from '../../../../types'; import { DETECTION_ENGINE_INDEX_URL } from '../../../../../common/constants'; import { buildSiemResponse } from '../utils'; -import { RuleDataPluginService } from '../../../../../../rule_registry/server'; +import type { RuleDataPluginService } from '../../../../../../rule_registry/server'; import { fieldAliasesOutdated } from './check_template_version'; import { getIndexVersion } from './get_index_version'; import { isOutdated } from '../../migrations/helpers'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.test.ts index a094ea84e9bf1..15d058dcc082d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.test.ts @@ -14,10 +14,10 @@ import { getBasicNoShardsSearchResponse, } from '../__mocks__/request_responses'; import { configMock, requestContextMock, serverMock } from '../__mocks__'; -import { AddPrepackagedRulesSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/add_prepackaged_rules_schema'; +import type { AddPrepackagedRulesSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/add_prepackaged_rules_schema'; import { addPrepackedRulesRoute, createPrepackagedRules } from './add_prepackaged_rules_route'; import { listMock } from '../../../../../../lists/server/mocks'; -import { ExceptionListClient } from '../../../../../../lists/server'; +import type { ExceptionListClient } from '../../../../../../lists/server'; import { installPrepackagedTimelines } from '../../../timeline/routes/prepackaged_timelines/install_prepackaged_timelines'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { elasticsearchClientMock } from 'src/core/server/elasticsearch/client/mocks'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.ts index 50766af669ce7..79d7396271cc4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.ts @@ -29,9 +29,9 @@ import { getExistingPrepackagedRules } from '../../rules/get_existing_prepackage import { ruleAssetSavedObjectsClientFactory } from '../../rules/rule_asset/rule_asset_saved_objects_client'; import { buildSiemResponse } from '../utils'; -import { RulesClient } from '../../../../../../alerting/server'; +import type { RulesClient } from '../../../../../../alerting/server'; -import { ExceptionListClient } from '../../../../../../lists/server'; +import type { ExceptionListClient } from '../../../../../../lists/server'; import { installPrepackagedTimelines } from '../../../timeline/routes/prepackaged_timelines/install_prepackaged_timelines'; export const addPrepackedRulesRoute = (router: SecuritySolutionPluginRouter) => { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/create_rules_bulk_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/create_rules_bulk_route.ts index b6e7858854efa..c9d6fd87295f7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/create_rules_bulk_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/create_rules_bulk_route.ts @@ -15,7 +15,7 @@ import { DETECTION_ENGINE_RULES_URL, NOTIFICATION_THROTTLE_NO_ACTIONS, } from '../../../../../common/constants'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { buildMlAuthz } from '../../../machine_learning/authz'; import { throwHttpError } from '../../../machine_learning/validation'; import { readRules } from '../../rules/read_rules'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/create_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/create_rules_route.ts index 71d453809d0fa..44225adb52066 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/create_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/create_rules_route.ts @@ -11,7 +11,7 @@ import { DETECTION_ENGINE_RULES_URL, NOTIFICATION_THROTTLE_NO_ACTIONS, } from '../../../../../common/constants'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import type { SecuritySolutionPluginRouter } from '../../../../types'; import { buildMlAuthz } from '../../../machine_learning/authz'; import { throwHttpError } from '../../../machine_learning/validation'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/export_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/export_rules_route.ts index 277590820850b..905ba308f0acc 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/export_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/export_rules_route.ts @@ -6,7 +6,7 @@ */ import { transformError } from '@kbn/securitysolution-es-utils'; -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import { exportRulesQuerySchema, ExportRulesQuerySchemaDecoded, @@ -16,7 +16,7 @@ import { import { buildRouteValidation } from '../../../../utils/build_validation/route_validation'; import type { SecuritySolutionPluginRouter } from '../../../../types'; import { DETECTION_ENGINE_RULES_URL } from '../../../../../common/constants'; -import { ConfigType } from '../../../../config'; +import type { ConfigType } from '../../../../config'; import { getNonPackagedRulesCount } from '../../rules/get_existing_prepackaged_rules'; import { getExportByObjectIds } from '../../rules/get_export_by_object_ids'; import { getExportAll } from '../../rules/get_export_all'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rule_status_internal_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rule_status_internal_route.test.ts index 285b839cacb9f..52080242cc64e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rule_status_internal_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rule_status_internal_route.test.ts @@ -14,7 +14,7 @@ import { } from '../__mocks__/request_responses'; import { serverMock, requestContextMock, requestMock } from '../__mocks__'; import { findRuleStatusInternalRoute } from './find_rule_status_internal_route'; -import { RuleStatusResponse } from '../../rules/types'; +import type { RuleStatusResponse } from '../../rules/types'; import { AlertExecutionStatusErrorReasons } from '../../../../../../alerting/common'; import { getQueryRuleParams } from '../../schemas/rule_schemas.mock'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.ts index 199ef75e22f25..558a4161aa9a2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.ts @@ -6,7 +6,7 @@ */ import { transformError } from '@kbn/securitysolution-es-utils'; -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import { findRuleValidateTypeDependents } from '../../../../../common/detection_engine/schemas/request/find_rules_type_dependents'; import { findRulesSchema, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_status_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_status_route.test.ts index 2286c010a0a5a..ccdf53b64e02c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_status_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_status_route.test.ts @@ -13,7 +13,7 @@ import { } from '../__mocks__/request_responses'; import { serverMock, requestContextMock, requestMock } from '../__mocks__'; import { findRulesStatusesRoute } from './find_rules_status_route'; -import { RuleStatusResponse } from '../../rules/types'; +import type { RuleStatusResponse } from '../../rules/types'; import { AlertExecutionStatusErrorReasons } from '../../../../../../alerting/common'; import { getQueryRuleParams } from '../../schemas/rule_schemas.mock'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/get_prepackaged_rules_status_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/get_prepackaged_rules_status_route.ts index a18507eea4977..6ddeb3bddcffa 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/get_prepackaged_rules_status_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/get_prepackaged_rules_status_route.ts @@ -22,8 +22,8 @@ import { getLatestPrepackagedRules } from '../../rules/get_prepackaged_rules'; import { getExistingPrepackagedRules } from '../../rules/get_existing_prepackaged_rules'; import { ruleAssetSavedObjectsClientFactory } from '../../rules/rule_asset/rule_asset_saved_objects_client'; import { buildFrameworkRequest } from '../../../timeline/utils/common'; -import { ConfigType } from '../../../../config'; -import { SetupPlugins } from '../../../../plugin'; +import type { ConfigType } from '../../../../config'; +import type { SetupPlugins } from '../../../../plugin'; import { checkTimelinesStatus, checkTimelineStatusRt, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/import_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/import_rules_route.ts index 187de40d33df0..2ebcc6b0c5184 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/import_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/import_rules_route.ts @@ -24,8 +24,8 @@ import { import { isMlRule } from '../../../../../common/machine_learning/helpers'; import type { SecuritySolutionPluginRouter } from '../../../../types'; import { DETECTION_ENGINE_RULES_URL } from '../../../../../common/constants'; -import { ConfigType } from '../../../../config'; -import { SetupPlugins } from '../../../../plugin'; +import type { ConfigType } from '../../../../config'; +import type { SetupPlugins } from '../../../../plugin'; import { buildMlAuthz } from '../../../machine_learning/authz'; import { throwHttpError } from '../../../machine_learning/validation'; import { createRules } from '../../rules/create_rules'; @@ -44,8 +44,8 @@ import { legacyMigrate } from '../../rules/utils'; import { getTupleDuplicateErrorsAndUniqueRules, getInvalidConnectors } from './utils'; import { createRulesStreamFromNdJson } from '../../rules/create_rules_stream_from_ndjson'; import { buildRouteValidation } from '../../../../utils/build_validation/route_validation'; -import { HapiReadableStream } from '../../rules/types'; -import { PartialFilter } from '../../types'; +import type { HapiReadableStream } from '../../rules/types'; +import type { PartialFilter } from '../../types'; type PromiseFromStreams = ImportRulesSchemaDecoded | Error; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/legacy_create_legacy_notification.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/legacy_create_legacy_notification.ts index 5908a9dc6e0f8..9ab55b5133450 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/legacy_create_legacy_notification.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/legacy_create_legacy_notification.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import type { SecuritySolutionPluginRouter } from '../../../../types'; // eslint-disable-next-line no-restricted-imports diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.ts index 838bfe63782c8..d9442a3bf5a29 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.ts @@ -15,7 +15,7 @@ import { buildRouteValidation } from '../../../../utils/build_validation/route_v import { rulesBulkSchema } from '../../../../../common/detection_engine/schemas/response/rules_bulk_schema'; import type { SecuritySolutionPluginRouter } from '../../../../types'; import { DETECTION_ENGINE_RULES_URL } from '../../../../../common/constants'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { buildMlAuthz } from '../../../machine_learning/authz'; import { throwHttpError } from '../../../machine_learning/validation'; import { transformBulkError, buildSiemResponse } from '../utils'; @@ -23,7 +23,7 @@ import { getIdBulkError } from './utils'; import { transformValidateBulkError } from './validate'; import { patchRules } from '../../rules/patch_rules'; import { readRules } from '../../rules/read_rules'; -import { PartialFilter } from '../../types'; +import type { PartialFilter } from '../../types'; import { legacyMigrate } from '../../rules/utils'; export const patchRulesBulkRoute = ( diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.ts index bb9f7e1475247..360064522b2c3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.ts @@ -15,7 +15,7 @@ import { } from '../../../../../common/detection_engine/schemas/request/patch_rules_schema'; import type { SecuritySolutionPluginRouter } from '../../../../types'; import { DETECTION_ENGINE_RULES_URL } from '../../../../../common/constants'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { buildMlAuthz } from '../../../machine_learning/authz'; import { throwHttpError } from '../../../machine_learning/validation'; import { patchRules } from '../../rules/patch_rules'; @@ -25,7 +25,7 @@ import { getIdError } from './utils'; import { transformValidate } from './validate'; import { readRules } from '../../rules/read_rules'; import { legacyMigrate } from '../../rules/utils'; -import { PartialFilter } from '../../types'; +import type { PartialFilter } from '../../types'; export const patchRulesRoute = ( router: SecuritySolutionPluginRouter, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/perform_bulk_action_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/perform_bulk_action_route.ts index 251ff1e6e5f38..7b1b80e12c97e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/perform_bulk_action_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/perform_bulk_action_route.ts @@ -6,12 +6,12 @@ */ import { transformError } from '@kbn/securitysolution-es-utils'; -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import { DETECTION_ENGINE_RULES_BULK_ACTION } from '../../../../../common/constants'; import { BulkAction } from '../../../../../common/detection_engine/schemas/common/schemas'; import { performBulkActionSchema } from '../../../../../common/detection_engine/schemas/request/perform_bulk_action_schema'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import type { SecuritySolutionPluginRouter } from '../../../../types'; import { buildRouteValidation } from '../../../../utils/build_validation/route_validation'; import { buildMlAuthz } from '../../../machine_learning/authz'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts index 882732544dcbb..81d1e8ae3c1a3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts @@ -9,14 +9,14 @@ import uuid from 'uuid'; import { transformError } from '@kbn/securitysolution-es-utils'; import { buildSiemResponse } from '../utils'; import { convertCreateAPIToInternalSchema } from '../../schemas/rule_converters'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { signalRulesAlertType } from '../../signals/signal_rule_alert_type'; import { createWarningsAndErrors } from '../../signals/preview/preview_rule_execution_log_client'; import { parseInterval } from '../../signals/utils'; import { buildMlAuthz } from '../../../machine_learning/authz'; import { throwHttpError } from '../../../machine_learning/validation'; import { buildRouteValidation } from '../../../../utils/build_validation/route_validation'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import type { SecuritySolutionPluginRouter } from '../../../../types'; import { createRuleValidateTypeDependents } from '../../../../../common/detection_engine/schemas/request/create_rules_type_dependents'; import { DETECTION_ENGINE_RULES_PREVIEW } from '../../../../../common/constants'; @@ -30,12 +30,12 @@ import { parseDuration, } from '../../../../../../alerting/common'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { ExecutorType } from '../../../../../../alerting/server/types'; -import { AlertInstance } from '../../../../../../alerting/server'; -import { ConfigType } from '../../../../config'; -import { IEventLogService } from '../../../../../../event_log/server'; +import type { ExecutorType } from '../../../../../../alerting/server/types'; +import type { AlertInstance } from '../../../../../../alerting/server'; +import type { ConfigType } from '../../../../config'; +import type { IEventLogService } from '../../../../../../event_log/server'; import { alertInstanceFactoryStub } from '../../signals/preview/alert_instance_factory_stub'; -import { CreateRuleOptions } from '../../rule_types/types'; +import type { CreateRuleOptions } from '../../rule_types/types'; enum InvocationCount { HOUR = 1, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/read_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/read_rules_route.ts index 06d0b9d8c327a..7a9bd5922afcb 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/read_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/read_rules_route.ts @@ -6,7 +6,7 @@ */ import { transformError } from '@kbn/securitysolution-es-utils'; -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import { queryRuleValidateTypeDependents } from '../../../../../common/detection_engine/schemas/request/query_rules_type_dependents'; import { queryRulesSchema, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_bulk_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_bulk_route.ts index 80b77722e79b0..3f0c0863e14b8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_bulk_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_bulk_route.ts @@ -12,7 +12,7 @@ import { updateRulesBulkSchema } from '../../../../../common/detection_engine/sc import { rulesBulkSchema } from '../../../../../common/detection_engine/schemas/response/rules_bulk_schema'; import type { SecuritySolutionPluginRouter } from '../../../../types'; import { DETECTION_ENGINE_RULES_URL } from '../../../../../common/constants'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { buildMlAuthz } from '../../../machine_learning/authz'; import { throwHttpError } from '../../../machine_learning/validation'; import { getIdBulkError } from './utils'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_route.ts index 1aad28d110bd9..c455becccd4c8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_route.ts @@ -10,7 +10,7 @@ import { updateRulesSchema } from '../../../../../common/detection_engine/schema import { updateRuleValidateTypeDependents } from '../../../../../common/detection_engine/schemas/request/update_rules_type_dependents'; import type { SecuritySolutionPluginRouter } from '../../../../types'; import { DETECTION_ENGINE_RULES_URL } from '../../../../../common/constants'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { buildMlAuthz } from '../../../machine_learning/authz'; import { throwHttpError } from '../../../machine_learning/validation'; import { buildSiemResponse } from '../utils'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.test.ts index 2dfc98fd3ba2f..30101c23a9af3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.test.ts @@ -22,16 +22,16 @@ import { } from './utils'; import { getAlertMock } from '../__mocks__/request_responses'; import { INTERNAL_IDENTIFIER } from '../../../../../common/constants'; -import { PartialFilter } from '../../types'; -import { BulkError } from '../utils'; +import type { PartialFilter } from '../../types'; +import type { BulkError } from '../utils'; import { getOutputRuleAlertForRest } from '../__mocks__/utils'; -import { PartialAlert } from '../../../../../../alerting/server'; +import type { PartialAlert } from '../../../../../../alerting/server'; import { createRulesStreamFromNdJson } from '../../rules/create_rules_stream_from_ndjson'; -import { RuleAlertType } from '../../rules/types'; -import { ImportRulesSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/import_rules_schema'; +import type { RuleAlertType } from '../../rules/types'; +import type { ImportRulesSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/import_rules_schema'; import { getCreateRulesSchemaMock } from '../../../../../common/detection_engine/schemas/request/rule_schemas.mock'; -import { ThreatMapping } from '@kbn/securitysolution-io-ts-alerting-types'; -import { CreateRulesBulkSchema } from '../../../../../common/detection_engine/schemas/request'; +import type { ThreatMapping } from '@kbn/securitysolution-io-ts-alerting-types'; +import type { CreateRulesBulkSchema } from '../../../../../common/detection_engine/schemas/request'; import { getMlRuleParams, getQueryRuleParams, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.ts index e706a3c914974..4c75684ca196f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils.ts @@ -8,11 +8,11 @@ import { countBy } from 'lodash/fp'; import uuid from 'uuid'; -import { RulesSchema } from '../../../../../common/detection_engine/schemas/response/rules_schema'; -import { ImportRulesSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/import_rules_schema'; -import { CreateRulesBulkSchema } from '../../../../../common/detection_engine/schemas/request/create_rules_bulk_schema'; -import { PartialAlert, FindResult } from '../../../../../../alerting/server'; -import { ActionsClient } from '../../../../../../actions/server'; +import type { RulesSchema } from '../../../../../common/detection_engine/schemas/response/rules_schema'; +import type { ImportRulesSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/import_rules_schema'; +import type { CreateRulesBulkSchema } from '../../../../../common/detection_engine/schemas/request/create_rules_bulk_schema'; +import type { PartialAlert, FindResult } from '../../../../../../alerting/server'; +import type { ActionsClient } from '../../../../../../actions/server'; import { INTERNAL_IDENTIFIER } from '../../../../../common/constants'; import { RuleAlertType, @@ -22,10 +22,10 @@ import { } from '../../rules/types'; import { createBulkErrorObject, BulkError, OutputError } from '../utils'; import { internalRuleToAPIResponse } from '../../schemas/rule_converters'; -import { RuleParams } from '../../schemas/rule_schemas'; -import { SanitizedAlert } from '../../../../../../alerting/common'; +import type { RuleParams } from '../../schemas/rule_schemas'; +import type { SanitizedAlert } from '../../../../../../alerting/common'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesActionsSavedObject } from '../../rule_actions/legacy_get_rule_actions_saved_object'; +import type { LegacyRulesActionsSavedObject } from '../../rule_actions/legacy_get_rule_actions_saved_object'; type PromiseFromStreams = ImportRulesSchemaDecoded | Error; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/validate.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/validate.ts index d4bb020cfb672..31371e7be1348 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/validate.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/validate.ts @@ -14,7 +14,7 @@ import { RulesSchema, rulesSchema, } from '../../../../../common/detection_engine/schemas/response/rules_schema'; -import { PartialAlert } from '../../../../../../alerting/server'; +import type { PartialAlert } from '../../../../../../alerting/server'; import { isAlertType, IRuleStatusSOAttributes, @@ -22,7 +22,7 @@ import { } from '../../rules/types'; import { createBulkErrorObject, BulkError } from '../utils'; import { transform, transformAlertToRule } from './utils'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RuleParams } from '../../schemas/rule_schemas'; // eslint-disable-next-line no-restricted-imports import { LegacyRulesActionsSavedObject } from '../../rule_actions/legacy_get_rule_actions_saved_object'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.test.ts index b02d93ef63d1d..ee8b8db284ff3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.test.ts @@ -6,7 +6,7 @@ */ import { requestMock, serverMock } from '../__mocks__'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { SignalsReindexOptions } from '../../../../../common/detection_engine/schemas/request/create_signals_migration_schema'; import { DETECTION_ENGINE_SIGNALS_MIGRATION_URL } from '../../../../../common/constants'; import { getCreateSignalsMigrationSchemaMock } from '../../../../../common/detection_engine/schemas/request/create_signals_migration_schema.mock'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.ts index 8da147d64a6cf..bb04a973de761 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.ts @@ -7,7 +7,7 @@ import { transformError, BadRequestError, getIndexAliases } from '@kbn/securitysolution-es-utils'; import type { SecuritySolutionPluginRouter } from '../../../../types'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { DETECTION_ENGINE_SIGNALS_MIGRATION_URL } from '../../../../../common/constants'; import { createSignalsMigrationSchema } from '../../../../../common/detection_engine/schemas/request/create_signals_migration_schema'; import { buildRouteValidation } from '../../../../utils/build_validation/route_validation'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/delete_signals_migration_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/delete_signals_migration_route.ts index 65ed42a0a166e..c131765f62d2f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/delete_signals_migration_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/delete_signals_migration_route.ts @@ -7,7 +7,7 @@ import { transformError } from '@kbn/securitysolution-es-utils'; import type { SecuritySolutionPluginRouter } from '../../../../types'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { DETECTION_ENGINE_SIGNALS_MIGRATION_URL } from '../../../../../common/constants'; import { deleteSignalsMigrationSchema } from '../../../../../common/detection_engine/schemas/request/delete_signals_migration_schema'; import { buildRouteValidation } from '../../../../utils/build_validation/route_validation'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.test.ts index 84a3a01974710..4f238bf8c428b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.test.ts @@ -6,12 +6,12 @@ */ import { serverMock } from '../__mocks__'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { getFinalizeSignalsMigrationRequest } from '../__mocks__/request_responses'; import { getMigrationSavedObjectsById } from '../../migrations/get_migration_saved_objects_by_id'; import { getSignalsMigrationSavedObjectMock } from '../../migrations/saved_objects_schema.mock'; import { finalizeSignalsMigrationRoute } from './finalize_signals_migration_route'; -import { RuleDataPluginService } from '../../../../../../rule_registry/server'; +import type { RuleDataPluginService } from '../../../../../../rule_registry/server'; import { ruleDataServiceMock } from '../../../../../../rule_registry/server/rule_data_plugin_service/rule_data_plugin_service.mock'; jest.mock('../../migrations/get_migration_saved_objects_by_id'); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.ts index c1dc153896d72..61b40dc85e621 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.ts @@ -7,7 +7,7 @@ import { transformError, BadRequestError } from '@kbn/securitysolution-es-utils'; import type { SecuritySolutionPluginRouter } from '../../../../types'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { DETECTION_ENGINE_SIGNALS_FINALIZE_MIGRATION_URL } from '../../../../../common/constants'; import { finalizeSignalsMigrationSchema } from '../../../../../common/detection_engine/schemas/request/finalize_signals_migration_schema'; import { buildRouteValidation } from '../../../../utils/build_validation/route_validation'; @@ -16,7 +16,7 @@ import { signalsMigrationService } from '../../migrations/migration_service'; import { buildSiemResponse } from '../utils'; import { getMigrationSavedObjectsById } from '../../migrations/get_migration_saved_objects_by_id'; -import { RuleDataPluginService } from '../../../../../../rule_registry/server'; +import type { RuleDataPluginService } from '../../../../../../rule_registry/server'; export const finalizeSignalsMigrationRoute = ( router: SecuritySolutionPluginRouter, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/open_close_signals.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/open_close_signals.test.ts index 39ccf9f158422..d93625aaca6a1 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/open_close_signals.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/open_close_signals.test.ts @@ -15,7 +15,7 @@ import { getSuccessfulSignalUpdateResponse, } from '../__mocks__/request_responses'; import { requestContextMock, serverMock, requestMock } from '../__mocks__'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { createMockTelemetryEventsSender } from '../../../telemetry/__mocks__'; import { setSignalsStatusRoute } from './open_close_signals_route'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/open_close_signals_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/open_close_signals_route.ts index 81dcbd07f4dd3..66e9dda9d673f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/open_close_signals_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/open_close_signals_route.ts @@ -8,7 +8,7 @@ import { get } from 'lodash'; import { transformError } from '@kbn/securitysolution-es-utils'; import { ALERT_WORKFLOW_STATUS } from '@kbn/rule-data-utils'; -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import { setSignalStatusValidateTypeDependents } from '../../../../../common/detection_engine/schemas/request/set_signal_status_type_dependents'; import { SetSignalsStatusSchemaDecoded, @@ -20,9 +20,9 @@ import { DETECTION_ENGINE_SIGNALS_STATUS_URL, } from '../../../../../common/constants'; import { buildSiemResponse } from '../utils'; -import { TelemetryEventsSender } from '../../../telemetry/sender'; +import type { TelemetryEventsSender } from '../../../telemetry/sender'; import { INSIGHTS_CHANNEL } from '../../../telemetry/constants'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; import { buildRouteValidation } from '../../../../utils/build_validation/route_validation'; import { getSessionIDfromKibanaRequest, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.test.ts index 6ddeeaa5ea1c2..8cf5f02593c7e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.test.ts @@ -10,7 +10,10 @@ import Boom from '@hapi/boom'; import { SavedObjectsFindResponse } from 'kibana/server'; import { rulesClientMock } from '../../../../../alerting/server/mocks'; -import { IRuleSavedAttributesSavedObjectAttributes, IRuleStatusSOAttributes } from '../rules/types'; +import type { + IRuleSavedAttributesSavedObjectAttributes, + IRuleStatusSOAttributes, +} from '../rules/types'; import { BadRequestError } from '@kbn/securitysolution-es-utils'; import { transformBulkError, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.ts index a15dc4f176232..ac7daa73b425d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/utils.ts @@ -8,17 +8,17 @@ import Boom from '@hapi/boom'; import { has, snakeCase } from 'lodash/fp'; import { BadRequestError } from '@kbn/securitysolution-es-utils'; -import { SanitizedAlert } from '../../../../../alerting/common'; +import type { SanitizedAlert } from '../../../../../alerting/common'; -import { +import type { RouteValidationFunction, KibanaResponseFactory, CustomHttpResponseOptions, } from '../../../../../../../src/core/server'; -import { RulesClient } from '../../../../../alerting/server'; -import { RuleStatusResponse, IRuleStatusSOAttributes } from '../rules/types'; +import type { RulesClient } from '../../../../../alerting/server'; +import type { RuleStatusResponse, IRuleStatusSOAttributes } from '../rules/types'; -import { RuleParams } from '../schemas/rule_schemas'; +import type { RuleParams } from '../schemas/rule_schemas'; export interface OutputError { message: string; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_create_rule_actions_saved_object.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_create_rule_actions_saved_object.ts index df27a5bcc280d..66365636085aa 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_create_rule_actions_saved_object.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_create_rule_actions_saved_object.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { SavedObjectReference } from 'kibana/server'; -import { AlertServices } from '../../../../../alerting/server'; +import type { SavedObjectReference } from 'kibana/server'; +import type { AlertServices } from '../../../../../alerting/server'; // eslint-disable-next-line no-restricted-imports import { legacyRuleActionsSavedObjectType } from './legacy_saved_object_mappings'; // eslint-disable-next-line no-restricted-imports -import { LegacyIRuleActionsAttributesSavedObjectAttributes } from './legacy_types'; +import type { LegacyIRuleActionsAttributesSavedObjectAttributes } from './legacy_types'; // eslint-disable-next-line no-restricted-imports import { legacyGetActionReference, @@ -18,7 +18,7 @@ import { legacyGetThrottleOptions, legacyTransformActionToReference, } from './legacy_utils'; -import { AlertAction } from '../../../../../alerting/common'; +import type { AlertAction } from '../../../../../alerting/common'; /** * @deprecated Once we are confident all rules relying on side-car actions SO's have been migrated to SO references we should remove this function diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_get_bulk_rule_actions_saved_object.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_get_bulk_rule_actions_saved_object.ts index b0c5dba77ad74..74d4954fdc66d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_get_bulk_rule_actions_saved_object.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_get_bulk_rule_actions_saved_object.ts @@ -5,18 +5,18 @@ * 2.0. */ -import { SavedObjectsFindOptionsReference } from 'kibana/server'; -import { Logger } from 'src/core/server'; +import type { SavedObjectsFindOptionsReference } from 'kibana/server'; +import type { Logger } from 'src/core/server'; -import { AlertServices } from '../../../../../alerting/server'; +import type { AlertServices } from '../../../../../alerting/server'; // eslint-disable-next-line no-restricted-imports import { legacyRuleActionsSavedObjectType } from './legacy_saved_object_mappings'; // eslint-disable-next-line no-restricted-imports -import { LegacyIRuleActionsAttributesSavedObjectAttributes } from './legacy_types'; +import type { LegacyIRuleActionsAttributesSavedObjectAttributes } from './legacy_types'; // eslint-disable-next-line no-restricted-imports import { legacyGetRuleActionsFromSavedObject } from './legacy_utils'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesActionsSavedObject } from './legacy_get_rule_actions_saved_object'; +import type { LegacyRulesActionsSavedObject } from './legacy_get_rule_actions_saved_object'; /** * @deprecated Once we are confident all rules relying on side-car actions SO's have been migrated to SO references we should remove this function diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_get_rule_actions_saved_object.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_get_rule_actions_saved_object.ts index d972c6535b3b6..6dd2e99b8c5c0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_get_rule_actions_saved_object.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_get_rule_actions_saved_object.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { SavedObjectsFindOptionsReference } from 'kibana/server'; -import { Logger } from 'src/core/server'; -import { AlertServices } from '../../../../../alerting/server'; +import type { SavedObjectsFindOptionsReference } from 'kibana/server'; +import type { Logger } from 'src/core/server'; +import type { AlertServices } from '../../../../../alerting/server'; // eslint-disable-next-line no-restricted-imports import { legacyRuleActionsSavedObjectType } from './legacy_saved_object_mappings'; // eslint-disable-next-line no-restricted-imports -import { +import type { LegacyIRuleActionsAttributesSavedObjectAttributes, LegacyRuleAlertAction, } from './legacy_types'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_types.ts index 36f81709b293f..71c9d2d115ee4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_types.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { SavedObjectAttributes } from 'kibana/server'; -import { AlertActionParams } from '../../../../../alerting/common'; +import type { SavedObjectAttributes } from 'kibana/server'; +import type { AlertActionParams } from '../../../../../alerting/common'; /** * This was the pre-7.16 version of LegacyRuleAlertAction and how it was stored on disk pre-7.16. diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_update_or_create_rule_actions_saved_object.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_update_or_create_rule_actions_saved_object.ts index d56d4ff921bd3..2a834b9bc2470 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_update_or_create_rule_actions_saved_object.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_update_or_create_rule_actions_saved_object.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { Logger } from 'src/core/server'; -import { AlertAction } from '../../../../../alerting/common'; -import { AlertServices } from '../../../../../alerting/server'; +import type { Logger } from 'src/core/server'; +import type { AlertAction } from '../../../../../alerting/common'; +import type { AlertServices } from '../../../../../alerting/server'; // eslint-disable-next-line no-restricted-imports import { legacyGetRuleActionsSavedObject } from './legacy_get_rule_actions_saved_object'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_update_rule_actions_saved_object.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_update_rule_actions_saved_object.ts index fbbbda24e48be..556783fa71a04 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_update_rule_actions_saved_object.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_update_rule_actions_saved_object.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { SavedObjectReference } from 'kibana/server'; -import { AlertServices } from '../../../../../alerting/server'; +import type { SavedObjectReference } from 'kibana/server'; +import type { AlertServices } from '../../../../../alerting/server'; // eslint-disable-next-line no-restricted-imports import { legacyRuleActionsSavedObjectType } from './legacy_saved_object_mappings'; // eslint-disable-next-line no-restricted-imports -import { LegacyRulesActionsSavedObject } from './legacy_get_rule_actions_saved_object'; +import type { LegacyRulesActionsSavedObject } from './legacy_get_rule_actions_saved_object'; // eslint-disable-next-line no-restricted-imports import { legacyGetActionReference, @@ -20,8 +20,8 @@ import { legacyTransformLegacyRuleAlertActionToReference, } from './legacy_utils'; // eslint-disable-next-line no-restricted-imports -import { LegacyIRuleActionsAttributesSavedObjectAttributes } from './legacy_types'; -import { AlertAction } from '../../../../../alerting/common'; +import type { LegacyIRuleActionsAttributesSavedObjectAttributes } from './legacy_types'; +import type { AlertAction } from '../../../../../alerting/common'; /** * @deprecated Once we are confident all rules relying on side-car actions SO's have been migrated to SO references we should remove this function diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_utils.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_utils.test.ts index 448548e96884b..a99a5b43c3d90 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_utils.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_utils.test.ts @@ -5,16 +5,16 @@ * 2.0. */ -import { SavedObjectsUpdateResponse } from 'kibana/server'; +import type { SavedObjectsUpdateResponse } from 'kibana/server'; import { loggingSystemMock } from 'src/core/server/mocks'; -import { AlertAction } from '../../../../../alerting/common'; +import type { AlertAction } from '../../../../../alerting/common'; // eslint-disable-next-line no-restricted-imports import { legacyRuleActionsSavedObjectType } from './legacy_saved_object_mappings'; // eslint-disable-next-line no-restricted-imports -import { +import type { LegacyIRuleActionsAttributesSavedObjectAttributes, LegacyRuleAlertAction, } from './legacy_types'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_utils.ts index 78f6c7419ae66..3bc957d1d559a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/legacy_utils.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObjectsUpdateResponse } from 'kibana/server'; -import { Logger } from 'src/core/server'; +import type { SavedObjectsUpdateResponse } from 'kibana/server'; +import type { Logger } from 'src/core/server'; -import { AlertAction } from '../../../../../alerting/common'; +import type { AlertAction } from '../../../../../alerting/common'; // eslint-disable-next-line no-restricted-imports import { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log/types.ts index 88802f9f28822..26e0064d4361b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log/types.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { Duration } from 'moment'; -import { SavedObjectsFindResult } from '../../../../../../../src/core/server'; -import { RuleExecutionStatus } from '../../../../common/detection_engine/schemas/common/schemas'; -import { IRuleStatusSOAttributes } from '../rules/types'; +import type { Duration } from 'moment'; +import type { SavedObjectsFindResult } from '../../../../../../../src/core/server'; +import type { RuleExecutionStatus } from '../../../../common/detection_engine/schemas/common/schemas'; +import type { IRuleStatusSOAttributes } from '../rules/types'; export enum UnderlyingLogClient { 'savedObjects' = 'savedObjects', diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule.ts index 9d72d72e78b16..95caa404d5ff9 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RuleParams } from '../../schemas/rule_schemas'; export const createRuleMock = (params: Partial) => ({ actions: [], diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule_type.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule_type.ts index c6f818f04fc5d..574b979d099d1 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule_type.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule_type.ts @@ -8,19 +8,19 @@ import { of } from 'rxjs'; import { v4 } from 'uuid'; -import { Logger, SavedObject } from 'kibana/server'; +import type { Logger, SavedObject } from 'kibana/server'; import { elasticsearchServiceMock, savedObjectsClientMock } from 'src/core/server/mocks'; import { mlPluginServerMock } from '../../../../../../ml/server/mocks'; import type { IRuleDataClient } from '../../../../../../rule_registry/server'; import { ruleRegistryMocks } from '../../../../../../rule_registry/server/mocks'; import { eventLogServiceMock } from '../../../../../../event_log/server/mocks'; -import { PluginSetupContract as AlertingPluginSetupContract } from '../../../../../../alerting/server'; -import { ConfigType } from '../../../../config'; -import { AlertAttributes } from '../../signals/types'; +import type { PluginSetupContract as AlertingPluginSetupContract } from '../../../../../../alerting/server'; +import type { ConfigType } from '../../../../config'; +import type { AlertAttributes } from '../../signals/types'; import { createRuleMock } from './rule'; import { listMock } from '../../../../../../lists/server/mocks'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RuleParams } from '../../schemas/rule_schemas'; // this is only used in tests // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { createDefaultAlertExecutorOptions } from '../../../../../../rule_registry/server/utils/rule_executor_test_utils'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/bulk_create_factory.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/bulk_create_factory.ts index 0ad88c61bab36..ac60b1022e9e6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/bulk_create_factory.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/bulk_create_factory.ts @@ -8,12 +8,12 @@ import { performance } from 'perf_hooks'; import { countBy, isEmpty } from 'lodash'; -import { Logger } from 'kibana/server'; -import { BaseHit } from '../../../../../common/detection_engine/types'; -import { BuildRuleMessage } from '../../signals/rule_messages'; +import type { Logger } from 'kibana/server'; +import type { BaseHit } from '../../../../../common/detection_engine/types'; +import type { BuildRuleMessage } from '../../signals/rule_messages'; import { errorAggregator, makeFloatString } from '../../signals/utils'; -import { RefreshTypes } from '../../types'; -import { PersistenceAlertService } from '../../../../../../rule_registry/server'; +import type { RefreshTypes } from '../../types'; +import type { PersistenceAlertService } from '../../../../../../rule_registry/server'; export interface GenericBulkCreateResponse { success: boolean; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.test.ts index 86b57b1ed1698..37fc62e82e49f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Logger } from 'kibana/server'; +import type { Logger } from 'kibana/server'; import { ALERT_RULE_CONSUMER } from '@kbn/rule-data-utils'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.ts index 23958451800b0..a1de8cb46135d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.ts @@ -7,19 +7,19 @@ import { ALERT_UUID } from '@kbn/rule-data-utils'; -import { Logger } from 'kibana/server'; +import type { Logger } from 'kibana/server'; import type { ConfigType } from '../../../../../config'; import { buildRuleWithoutOverrides } from '../../../signals/build_rule'; -import { Ancestor, SignalSource, SignalSourceHit } from '../../../signals/types'; -import { RACAlert, WrappedRACAlert } from '../../types'; +import type { Ancestor, SignalSource, SignalSourceHit } from '../../../signals/types'; +import type { RACAlert, WrappedRACAlert } from '../../types'; import { buildAlert, buildAncestors, generateAlertId } from './build_alert'; import { buildBulkBody } from './build_bulk_body'; -import { EqlSequence } from '../../../../../../common/detection_engine/types'; +import type { EqlSequence } from '../../../../../../common/detection_engine/types'; import { generateBuildingBlockIds } from './generate_building_block_ids'; import { objectArrayIntersection } from '../../../signals/build_bulk_body'; -import { BuildReasonMessage } from '../../../signals/reason_formatters'; -import { CompleteRule, RuleParams } from '../../../schemas/rule_schemas'; +import type { BuildReasonMessage } from '../../../signals/reason_formatters'; +import type { CompleteRule, RuleParams } from '../../../schemas/rule_schemas'; import { ALERT_BUILDING_BLOCK_TYPE, ALERT_GROUP_ID, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/wrap_sequences_factory.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/wrap_sequences_factory.ts index 916b7f4801e8e..e082453d25748 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/wrap_sequences_factory.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/wrap_sequences_factory.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { Logger } from 'kibana/server'; +import type { Logger } from 'kibana/server'; -import { WrapSequences } from '../../signals/types'; +import type { WrapSequences } from '../../signals/types'; import { buildAlertGroupFromSequence } from './utils/build_alert_group_from_sequence'; -import { ConfigType } from '../../../../config'; -import { WrappedRACAlert } from '../types'; -import { CompleteRule, RuleParams } from '../../schemas/rule_schemas'; +import type { ConfigType } from '../../../../config'; +import type { WrappedRACAlert } from '../types'; +import type { CompleteRule, RuleParams } from '../../schemas/rule_schemas'; export const wrapSequencesFactory = ({ diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/indicator_match/create_indicator_match_alert_type.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/indicator_match/create_indicator_match_alert_type.test.ts index 89e8e7f70e4aa..5394a588949a3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/indicator_match/create_indicator_match_alert_type.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/indicator_match/create_indicator_match_alert_type.test.ts @@ -14,8 +14,8 @@ import { allowedExperimentalValues } from '../../../../../common/experimental_fe import { createRuleTypeMocks } from '../__mocks__/rule_type'; import { createIndicatorMatchAlertType } from './create_indicator_match_alert_type'; import { sampleDocNoSortId } from '../../signals/__mocks__/es_results'; -import { CountResponse } from 'kibana/server'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { CountResponse } from 'kibana/server'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { createSecurityRuleTypeWrapper } from '../create_security_rule_type_wrapper'; import { createMockConfig } from '../../routes/__mocks__'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/ml/create_ml_alert_type.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/ml/create_ml_alert_type.test.ts index b7a099b10e275..bdd0c2e08904e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/ml/create_ml_alert_type.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/ml/create_ml_alert_type.test.ts @@ -13,7 +13,7 @@ import { bulkCreateMlSignals } from '../../signals/bulk_create_ml_signals'; import { createRuleTypeMocks } from '../__mocks__/rule_type'; import { createMlAlertType } from './create_ml_alert_type'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { createSecurityRuleTypeWrapper } from '../create_security_rule_type_wrapper'; import { createMockConfig } from '../../routes/__mocks__'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts index d5b4d1f1eec77..1e3b70af476f5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts @@ -5,37 +5,37 @@ * 2.0. */ -import { Moment } from 'moment'; +import type { Moment } from 'moment'; -import { SearchHit } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { Logger } from '@kbn/logging'; -import { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; +import type { SearchHit } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { Logger } from '@kbn/logging'; +import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; -import { AlertExecutorOptions, AlertType } from '../../../../../alerting/server'; -import { +import type { AlertExecutorOptions, AlertType } from '../../../../../alerting/server'; +import type { AlertInstanceContext, AlertInstanceState, AlertTypeState, WithoutReservedActionGroups, } from '../../../../../alerting/common'; -import { ListClient } from '../../../../../lists/server'; -import { TechnicalRuleFieldMap } from '../../../../../rule_registry/common/assets/field_maps/technical_rule_field_map'; -import { TypeOfFieldMap } from '../../../../../rule_registry/common/field_map'; -import { PersistenceServices, IRuleDataClient } from '../../../../../rule_registry/server'; -import { BaseHit } from '../../../../common/detection_engine/types'; -import { ConfigType } from '../../../config'; -import { SetupPlugins } from '../../../plugin'; -import { CompleteRule, RuleParams } from '../schemas/rule_schemas'; -import { BuildRuleMessage } from '../signals/rule_messages'; -import { +import type { ListClient } from '../../../../../lists/server'; +import type { TechnicalRuleFieldMap } from '../../../../../rule_registry/common/assets/field_maps/technical_rule_field_map'; +import type { TypeOfFieldMap } from '../../../../../rule_registry/common/field_map'; +import type { PersistenceServices, IRuleDataClient } from '../../../../../rule_registry/server'; +import type { BaseHit } from '../../../../common/detection_engine/types'; +import type { ConfigType } from '../../../config'; +import type { SetupPlugins } from '../../../plugin'; +import type { CompleteRule, RuleParams } from '../schemas/rule_schemas'; +import type { BuildRuleMessage } from '../signals/rule_messages'; +import type { BulkCreate, SearchAfterAndBulkCreateReturnType, WrapHits, WrapSequences, } from '../signals/types'; -import { ExperimentalFeatures } from '../../../../common/experimental_features'; -import { IEventLogService } from '../../../../../event_log/server'; -import { AlertsFieldMap, RulesFieldMap } from '../../../../common/field_maps'; +import type { ExperimentalFeatures } from '../../../../common/experimental_features'; +import type { IEventLogService } from '../../../../../event_log/server'; +import type { AlertsFieldMap, RulesFieldMap } from '../../../../common/field_maps'; export interface SecurityAlertTypeReturnValue { bulkCreateTimes: string[]; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/index.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/index.ts index d60a190f94d19..605a266ad73b1 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/index.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/index.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { AlertTypeState } from '../../../../../../alerting/server'; -import { SecurityAlertTypeReturnValue } from '../types'; +import type { AlertTypeState } from '../../../../../../alerting/server'; +import type { SecurityAlertTypeReturnValue } from '../types'; export const createResultObject = (state: TState) => { const result: SecurityAlertTypeReturnValue = { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.mock.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.mock.ts index 2c25134cc3760..8706f1b071f95 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.mock.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { CreateRulesOptions } from './types'; +import type { CreateRulesOptions } from './types'; import { rulesClientMock } from '../../../../../alerting/server/mocks'; export const getCreateRulesOptionsMock = (isRuleRegistryEnabled: boolean): CreateRulesOptions => ({ diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.ts index 1d0010b38578d..91f0b377b83e5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules.ts @@ -12,11 +12,11 @@ import { normalizeThresholdObject, } from '../../../../common/detection_engine/utils'; import { transformRuleToAlertAction } from '../../../../common/detection_engine/transform_actions'; -import { SanitizedAlert } from '../../../../../alerting/common'; +import type { SanitizedAlert } from '../../../../../alerting/common'; import { NOTIFICATION_THROTTLE_NO_ACTIONS, SERVER_APP_ID } from '../../../../common/constants'; -import { CreateRulesOptions } from './types'; +import type { CreateRulesOptions } from './types'; import { addTags } from './add_tags'; -import { PartialFilter, RuleTypeParams } from '../types'; +import type { PartialFilter, RuleTypeParams } from '../types'; import { transformToAlertThrottle, transformToNotifyWhen } from './utils'; export const createRules = async ({ diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/delete_rules.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/delete_rules.test.ts index 42d7f960beb22..3da593dccf4fb 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/delete_rules.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/delete_rules.test.ts @@ -8,7 +8,7 @@ import { rulesClientMock } from '../../../../../alerting/server/mocks'; import { ruleExecutionLogClientMock } from '../rule_execution_log/__mocks__/rule_execution_log_client'; import { deleteRules } from './delete_rules'; -import { DeleteRuleOptions } from './types'; +import type { DeleteRuleOptions } from './types'; describe('deleteRules', () => { let rulesClient: ReturnType; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/duplicate_rule.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/duplicate_rule.ts index 2ccd5f21366ee..70198453718a5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/duplicate_rule.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/duplicate_rule.ts @@ -10,9 +10,9 @@ import uuid from 'uuid'; import { i18n } from '@kbn/i18n'; import { ruleTypeMappings, SIGNALS_ID } from '@kbn/securitysolution-rules'; -import { SanitizedAlert } from '../../../../../alerting/common'; +import type { SanitizedAlert } from '../../../../../alerting/common'; import { SERVER_APP_ID } from '../../../../common/constants'; -import { InternalRuleCreate, RuleParams } from '../schemas/rule_schemas'; +import type { InternalRuleCreate, RuleParams } from '../schemas/rule_schemas'; import { addTags } from './add_tags'; const DUPLICATE_TITLE = i18n.translate( diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/enable_rule.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/enable_rule.ts index e24da8a2ba0d4..36f7d12dacb3b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/enable_rule.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/enable_rule.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { SanitizedAlert } from '../../../../../alerting/common'; -import { RulesClient } from '../../../../../alerting/server'; +import type { SanitizedAlert } from '../../../../../alerting/common'; +import type { RulesClient } from '../../../../../alerting/server'; import { RuleExecutionStatus } from '../../../../common/detection_engine/schemas/common/schemas'; -import { IRuleExecutionLogClient } from '../rule_execution_log/types'; -import { RuleParams } from '../schemas/rule_schemas'; +import type { IRuleExecutionLogClient } from '../rule_execution_log/types'; +import type { RuleParams } from '../schemas/rule_schemas'; interface EnableRuleArgs { rule: SanitizedAlert; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/find_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/find_rules.ts index ef1b3fbb28b5a..394dd0e64311c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/find_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/find_rules.ts @@ -7,9 +7,9 @@ import { SIGNALS_ID, ruleTypeMappings } from '@kbn/securitysolution-rules'; -import { FindResult } from '../../../../../alerting/server'; -import { RuleParams } from '../schemas/rule_schemas'; -import { FindRuleOptions } from './types'; +import type { FindResult } from '../../../../../alerting/server'; +import type { RuleParams } from '../schemas/rule_schemas'; +import type { FindRuleOptions } from './types'; export const getFilter = ( filter: string | null | undefined, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_existing_prepackaged_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_existing_prepackaged_rules.ts index caa32a809b0a8..f3faf4191866b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_existing_prepackaged_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_existing_prepackaged_rules.ts @@ -6,7 +6,7 @@ */ import { INTERNAL_IMMUTABLE_KEY } from '../../../../common/constants'; -import { RulesClient } from '../../../../../alerting/server'; +import type { RulesClient } from '../../../../../alerting/server'; import { RuleAlertType, isAlertTypes } from './types'; import { findRules } from './find_rules'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_all.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_all.ts index c0389de766ea5..0ac938dc70504 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_all.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_all.ts @@ -7,9 +7,9 @@ import { transformDataToNdjson } from '@kbn/securitysolution-utils'; -import { Logger } from 'src/core/server'; -import { ExceptionListClient } from '../../../../../lists/server'; -import { RulesClient, AlertServices } from '../../../../../alerting/server'; +import type { Logger } from 'src/core/server'; +import type { ExceptionListClient } from '../../../../../lists/server'; +import type { RulesClient, AlertServices } from '../../../../../alerting/server'; import { getNonPackagedRules } from './get_existing_prepackaged_rules'; import { getExportDetailsNdjson } from './get_export_details_ndjson'; import { transformAlertsToRules } from '../routes/rules/utils'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.ts index b8f1467cffe87..537c6a44e9f20 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.ts @@ -8,10 +8,10 @@ import { chunk } from 'lodash'; import { transformDataToNdjson } from '@kbn/securitysolution-utils'; -import { Logger } from 'src/core/server'; -import { ExceptionListClient } from '../../../../../lists/server'; -import { RulesSchema } from '../../../../common/detection_engine/schemas/response/rules_schema'; -import { RulesClient, AlertServices } from '../../../../../alerting/server'; +import type { Logger } from 'src/core/server'; +import type { ExceptionListClient } from '../../../../../lists/server'; +import type { RulesSchema } from '../../../../common/detection_engine/schemas/response/rules_schema'; +import type { RulesClient, AlertServices } from '../../../../../alerting/server'; import { getExportDetailsNdjson } from './get_export_details_ndjson'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/install_prepacked_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/install_prepacked_rules.ts index 3f7191a970020..f6f8399a899ea 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/install_prepacked_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/install_prepacked_rules.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { AddPrepackagedRulesSchemaDecoded } from '../../../../common/detection_engine/schemas/request/add_prepackaged_rules_schema'; -import { SanitizedAlert, AlertTypeParams } from '../../../../../alerting/common'; -import { RulesClient } from '../../../../../alerting/server'; +import type { AddPrepackagedRulesSchemaDecoded } from '../../../../common/detection_engine/schemas/request/add_prepackaged_rules_schema'; +import type { SanitizedAlert, AlertTypeParams } from '../../../../../alerting/common'; +import type { RulesClient } from '../../../../../alerting/server'; import { createRules } from './create_rules'; -import { PartialFilter } from '../types'; +import type { PartialFilter } from '../types'; export const installPrepackagedRules = ( rulesClient: RulesClient, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.mock.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.mock.ts index 3626bcd5f127e..408f3a84b68cd 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.mock.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { PatchRulesOptions } from './types'; +import type { PatchRulesOptions } from './types'; import { rulesClientMock } from '../../../../../alerting/server/mocks'; import { savedObjectsClientMock } from '../../../../../../../src/core/server/mocks'; import { getAlertMock } from '../routes/__mocks__/request_responses'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts index b5580de152fcc..6d69bf0f75f5e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts @@ -7,8 +7,8 @@ import { patchRules } from './patch_rules'; import { getPatchRulesOptionsMock, getPatchMlRulesOptionsMock } from './patch_rules.mock'; -import { PatchRulesOptions } from './types'; -import { RulesClientMock } from '../../../../../alerting/server/rules_client.mock'; +import type { PatchRulesOptions } from './types'; +import type { RulesClientMock } from '../../../../../alerting/server/rules_client.mock'; import { getAlertMock } from '../routes/__mocks__/request_responses'; import { getQueryRuleParams } from '../schemas/rule_schemas.mock'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts index fd48cd4eebc2c..4e4bd493f6ed9 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts @@ -7,7 +7,7 @@ import { validate } from '@kbn/securitysolution-io-ts-utils'; import { defaults } from 'lodash/fp'; -import { PartialAlert } from '../../../../../alerting/server'; +import type { PartialAlert } from '../../../../../alerting/server'; import { transformRuleToAlertAction } from '../../../../common/detection_engine/transform_actions'; import { normalizeMachineLearningJobIds, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/read_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/read_rules.ts index 2571791164b6b..55cb874e59b86 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/read_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/read_rules.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { ResolvedSanitizedRule, SanitizedAlert } from '../../../../../alerting/common'; +import type { ResolvedSanitizedRule, SanitizedAlert } from '../../../../../alerting/common'; import { INTERNAL_RULE_ID_KEY } from '../../../../common/constants'; -import { RuleParams } from '../schemas/rule_schemas'; +import type { RuleParams } from '../schemas/rule_schemas'; import { findRules } from './find_rules'; import { isAlertType, ReadRuleOptions } from './types'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts index ed0f0447ad3b0..7e6c0a48965e4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts @@ -6,9 +6,9 @@ */ import { get } from 'lodash/fp'; -import { Readable } from 'stream'; +import type { Readable } from 'stream'; -import { SavedObject, SavedObjectAttributes, SavedObjectsClientContract } from 'kibana/server'; +import type { SavedObject, SavedObjectAttributes, SavedObjectsClientContract } from 'kibana/server'; import type { MachineLearningJobIdOrUndefined, From, @@ -43,9 +43,9 @@ import type { VersionOrUndefined, Version } from '@kbn/securitysolution-io-ts-ty import { SIGNALS_ID, ruleTypeMappings } from '@kbn/securitysolution-rules'; import type { ListArrayOrUndefined, ListArray } from '@kbn/securitysolution-io-ts-list-types'; -import { UpdateRulesSchema } from '../../../../common/detection_engine/schemas/request'; -import { RuleAlertAction } from '../../../../common/detection_engine/types'; -import { +import type { UpdateRulesSchema } from '../../../../common/detection_engine/schemas/request'; +import type { RuleAlertAction } from '../../../../common/detection_engine/types'; +import type { FalsePositives, RuleId, Immutable, @@ -100,11 +100,11 @@ import { NamespaceOrUndefined, } from '../../../../common/detection_engine/schemas/common/schemas'; -import { RulesClient, PartialAlert } from '../../../../../alerting/server'; -import { SanitizedAlert } from '../../../../../alerting/common'; -import { PartialFilter } from '../types'; -import { RuleParams } from '../schemas/rule_schemas'; -import { IRuleExecutionLogClient } from '../rule_execution_log/types'; +import type { RulesClient, PartialAlert } from '../../../../../alerting/server'; +import type { SanitizedAlert } from '../../../../../alerting/common'; +import type { PartialFilter } from '../types'; +import type { RuleParams } from '../schemas/rule_schemas'; +import type { IRuleExecutionLogClient } from '../rule_execution_log/types'; export type RuleAlertType = SanitizedAlert; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.ts index dcf43d41e8d78..65150ce48174d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.ts @@ -6,14 +6,14 @@ */ import { chunk } from 'lodash/fp'; -import { SavedObjectsClientContract } from 'kibana/server'; -import { AddPrepackagedRulesSchemaDecoded } from '../../../../common/detection_engine/schemas/request/add_prepackaged_rules_schema'; -import { RulesClient, PartialAlert } from '../../../../../alerting/server'; +import type { SavedObjectsClientContract } from 'kibana/server'; +import type { AddPrepackagedRulesSchemaDecoded } from '../../../../common/detection_engine/schemas/request/add_prepackaged_rules_schema'; +import type { RulesClient, PartialAlert } from '../../../../../alerting/server'; import { patchRules } from './patch_rules'; import { readRules } from './read_rules'; -import { PartialFilter } from '../types'; -import { RuleParams } from '../schemas/rule_schemas'; -import { IRuleExecutionLogClient } from '../rule_execution_log/types'; +import type { PartialFilter } from '../types'; +import type { RuleParams } from '../schemas/rule_schemas'; +import type { IRuleExecutionLogClient } from '../rule_execution_log/types'; import { legacyMigrate } from './utils'; /** diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.test.ts index 79371aa6e68b6..e0a556e2ec340 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.test.ts @@ -8,7 +8,7 @@ import { getAlertMock, resolveAlertMock } from '../routes/__mocks__/request_responses'; import { updateRules } from './update_rules'; import { getUpdateRulesOptionsMock, getUpdateMlRulesOptionsMock } from './update_rules.mock'; -import { RulesClientMock } from '../../../../../alerting/server/rules_client.mock'; +import type { RulesClientMock } from '../../../../../alerting/server/rules_client.mock'; import { getMlRuleParams, getQueryRuleParams } from '../schemas/rule_schemas.mock'; // Failing with rule registry enabled diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.ts index ae16d0435e3dc..421b8979a553c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.ts @@ -9,9 +9,9 @@ import { validate } from '@kbn/securitysolution-io-ts-utils'; import { DEFAULT_MAX_SIGNALS } from '../../../../common/constants'; import { transformRuleToAlertAction } from '../../../../common/detection_engine/transform_actions'; -import { PartialAlert } from '../../../../../alerting/server'; +import type { PartialAlert } from '../../../../../alerting/server'; -import { UpdateRulesOptions } from './types'; +import type { UpdateRulesOptions } from './types'; import { addTags } from './add_tags'; import { typeSpecificSnakeToCamel } from '../schemas/rule_converters'; import { internalRuleUpdate, RuleParams } from '../schemas/rule_schemas'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.test.ts index 2cf7e95f3c621..0bdf517784f73 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.test.ts @@ -14,15 +14,15 @@ import { transformFromAlertThrottle, transformActions, } from './utils'; -import { AlertAction, SanitizedAlert } from '../../../../../alerting/common'; -import { RuleParams } from '../schemas/rule_schemas'; +import type { AlertAction, SanitizedAlert } from '../../../../../alerting/common'; +import type { RuleParams } from '../schemas/rule_schemas'; import { NOTIFICATION_THROTTLE_NO_ACTIONS, NOTIFICATION_THROTTLE_RULE, } from '../../../../common/constants'; -import { FullResponseSchema } from '../../../../common/detection_engine/schemas/request'; +import type { FullResponseSchema } from '../../../../common/detection_engine/schemas/request'; // eslint-disable-next-line no-restricted-imports -import { LegacyRuleActions } from '../rule_actions/legacy_types'; +import type { LegacyRuleActions } from '../rule_actions/legacy_types'; describe('utils', () => { describe('#calculateInterval', () => { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.ts index c9e00486dc130..0fb01ecdd31b3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.ts @@ -27,8 +27,12 @@ import type { } from '@kbn/securitysolution-io-ts-alerting-types'; import type { ListArrayOrUndefined } from '@kbn/securitysolution-io-ts-list-types'; import type { VersionOrUndefined } from '@kbn/securitysolution-io-ts-types'; -import { AlertAction, AlertNotifyWhenType, SanitizedAlert } from '../../../../../alerting/common'; -import { +import type { + AlertAction, + AlertNotifyWhenType, + SanitizedAlert, +} from '../../../../../alerting/common'; +import type { DescriptionOrUndefined, AnomalyThresholdOrUndefined, QueryOrUndefined, @@ -54,24 +58,24 @@ import { EventCategoryOverrideOrUndefined, NamespaceOrUndefined, } from '../../../../common/detection_engine/schemas/common/schemas'; -import { PartialFilter } from '../types'; -import { RuleParams } from '../schemas/rule_schemas'; +import type { PartialFilter } from '../types'; +import type { RuleParams } from '../schemas/rule_schemas'; import { NOTIFICATION_THROTTLE_NO_ACTIONS, NOTIFICATION_THROTTLE_RULE, } from '../../../../common/constants'; -import { RulesClient } from '../../../../../alerting/server'; +import type { RulesClient } from '../../../../../alerting/server'; // eslint-disable-next-line no-restricted-imports -import { LegacyRuleActions } from '../rule_actions/legacy_types'; -import { FullResponseSchema } from '../../../../common/detection_engine/schemas/request'; +import type { LegacyRuleActions } from '../rule_actions/legacy_types'; +import type { FullResponseSchema } from '../../../../common/detection_engine/schemas/request'; import { transformAlertToRuleAction, transformRuleToAlertAction, } from '../../../../common/detection_engine/transform_actions'; // eslint-disable-next-line no-restricted-imports import { legacyRuleActionsSavedObjectType } from '../rule_actions/legacy_saved_object_mappings'; -import { LegacyMigrateParams } from './types'; -import { RuleAlertAction } from '../../../../common/detection_engine/types'; +import type { LegacyMigrateParams } from './types'; +import type { RuleAlertAction } from '../../../../common/detection_engine/types'; export const calculateInterval = ( interval: string | undefined, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts index c10aa0bd42ecd..834d5adf9e661 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts @@ -13,25 +13,25 @@ import { normalizeMachineLearningJobIds, normalizeThresholdObject, } from '../../../../common/detection_engine/utils'; -import { +import type { InternalRuleCreate, RuleParams, TypeSpecificRuleParams, BaseRuleParams, } from './rule_schemas'; import { assertUnreachable } from '../../../../common/utility_types'; -import { +import type { CreateRulesSchema, CreateTypeSpecific, FullResponseSchema, ResponseTypeSpecific, } from '../../../../common/detection_engine/schemas/request'; -import { AppClient } from '../../../types'; +import type { AppClient } from '../../../types'; import { addTags } from '../rules/add_tags'; import { DEFAULT_MAX_SIGNALS, SERVER_APP_ID } from '../../../../common/constants'; import { transformRuleToAlertAction } from '../../../../common/detection_engine/transform_actions'; -import { ResolvedSanitizedRule, SanitizedAlert } from '../../../../../alerting/common'; -import { IRuleStatusSOAttributes } from '../rules/types'; +import type { ResolvedSanitizedRule, SanitizedAlert } from '../../../../../alerting/common'; +import type { IRuleStatusSOAttributes } from '../rules/types'; import { transformTags } from '../routes/rules/utils'; import { RuleExecutionStatus } from '../../../../common/detection_engine/schemas/common/schemas'; import { @@ -41,7 +41,7 @@ import { transformActions, } from '../rules/utils'; // eslint-disable-next-line no-restricted-imports -import { LegacyRuleActions } from '../rule_actions/legacy_types'; +import type { LegacyRuleActions } from '../rule_actions/legacy_types'; // These functions provide conversions from the request API schema to the internal rule schema and from the internal rule schema // to the response API schema. This provides static type-check assurances that the internal schema is in sync with the API schema for diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.mock.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.mock.ts index 47b66e7cc3bbb..76cf4a0b5eba0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.mock.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.mock.ts @@ -8,7 +8,7 @@ import { getThreatMock } from '../../../../common/detection_engine/schemas/types/threat.mock'; import { getListArrayMock } from '../../../../common/detection_engine/schemas/types/lists.mock'; import { getThreatMappingMock } from '../signals/threat_mapping/build_threat_mapping_filter.mock'; -import { +import type { BaseRuleParams, CompleteRule, EqlRuleParams, @@ -18,7 +18,7 @@ import { ThreatRuleParams, ThresholdRuleParams, } from './rule_schemas'; -import { SanitizedRuleConfig } from '../../../../../alerting/common'; +import type { SanitizedRuleConfig } from '../../../../../alerting/common'; import { sampleRuleGuid } from '../signals/__mocks__/es_results'; const getBaseRuleParams = (): BaseRuleParams => { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.ts index 201c4b3957914..e36ac1292aec5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_schemas.ts @@ -73,7 +73,7 @@ import { updated_at, } from '../../../../common/detection_engine/schemas/common/schemas'; import { SERVER_APP_ID } from '../../../../common/constants'; -import { SanitizedRuleConfig } from '../../../../../alerting/common'; +import type { SanitizedRuleConfig } from '../../../../../alerting/common'; const nonEqlLanguages = t.keyof({ kuery: null, lucene: null }); export const baseRuleParams = t.exact( diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts index 078d36a99ad17..01b1e51c22122 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts @@ -15,14 +15,14 @@ import type { WrappedSignalHit, AlertAttributes, } from '../types'; -import { SavedObject } from '../../../../../../../../src/core/server'; +import type { SavedObject } from '../../../../../../../../src/core/server'; import { loggingSystemMock } from '../../../../../../../../src/core/server/mocks'; -import { IRuleStatusSOAttributes } from '../../rules/types'; +import type { IRuleStatusSOAttributes } from '../../rules/types'; // eslint-disable-next-line no-restricted-imports import { legacyRuleStatusSavedObjectType } from '../../rules/legacy_rule_status/legacy_rule_status_saved_object_mappings'; import { getListArrayMock } from '../../../../../common/detection_engine/schemas/types/lists.mock'; -import { RulesSchema } from '../../../../../common/detection_engine/schemas/response'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RulesSchema } from '../../../../../common/detection_engine/schemas/response'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { getThreatMock } from '../../../../../common/detection_engine/schemas/types/threat.mock'; import { RuleExecutionStatus } from '../../../../../common/detection_engine/schemas/common/schemas'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.ts index bccd1f498372e..4cc310c1f8195 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.ts @@ -18,11 +18,11 @@ import { import { buildRuleWithoutOverrides, buildRuleWithOverrides } from './build_rule'; import { additionalSignalFields, buildSignal } from './build_signal'; import { buildEventTypeSignal } from './build_event_type_signal'; -import { EqlSequence } from '../../../../common/detection_engine/types'; +import type { EqlSequence } from '../../../../common/detection_engine/types'; import { generateSignalId, wrapBuildingBlocks, wrapSignal } from './utils'; import type { ConfigType } from '../../../config'; -import { BuildReasonMessage } from './reason_formatters'; -import { CompleteRule, RuleParams } from '../schemas/rule_schemas'; +import type { BuildReasonMessage } from './reason_formatters'; +import type { CompleteRule, RuleParams } from '../schemas/rule_schemas'; /** * Formats the search_after result for insertion into the signals index. We first create a diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/bulk_create_ml_signals.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/bulk_create_ml_signals.ts index 2453e92dc3c0a..43cfd35294b04 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/bulk_create_ml_signals.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/bulk_create_ml_signals.ts @@ -8,17 +8,17 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { flow, omit } from 'lodash/fp'; import set from 'set-value'; -import { Logger } from '../../../../../../../src/core/server'; -import { +import type { Logger } from '../../../../../../../src/core/server'; +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../alerting/server'; -import { GenericBulkCreateResponse } from './bulk_create_factory'; -import { AnomalyResults, Anomaly } from '../../machine_learning'; -import { BuildRuleMessage } from './rule_messages'; -import { BulkCreate, WrapHits } from './types'; -import { CompleteRule, MachineLearningRuleParams } from '../schemas/rule_schemas'; +import type { GenericBulkCreateResponse } from './bulk_create_factory'; +import type { AnomalyResults, Anomaly } from '../../machine_learning'; +import type { BuildRuleMessage } from './rule_messages'; +import type { BulkCreate, WrapHits } from './types'; +import type { CompleteRule, MachineLearningRuleParams } from '../schemas/rule_schemas'; import { buildReasonMessageForMlAlert } from './reason_formatters'; interface BulkCreateMlSignalsParams { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/eql.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/eql.test.ts index 2f5aaec5ea43f..66f07bc091664 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/eql.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/eql.test.ts @@ -17,7 +17,7 @@ import { SIGNALS_TEMPLATE_VERSION } from '../../routes/index/get_signals_templat // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { elasticsearchClientMock } from 'src/core/server/elasticsearch/client/mocks'; import { allowedExperimentalValues } from '../../../../../common/experimental_features'; -import { EqlRuleParams } from '../../schemas/rule_schemas'; +import type { EqlRuleParams } from '../../schemas/rule_schemas'; jest.mock('../../routes/index/get_index_version'); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/eql.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/eql.ts index 61a8fb930efed..44da3f83e86da 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/eql.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/eql.ts @@ -8,8 +8,8 @@ import type { TransportResult } from '@elastic/elasticsearch'; import { performance } from 'perf_hooks'; import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; -import { Logger } from 'src/core/server'; -import { +import type { Logger } from 'src/core/server'; +import type { AlertInstanceContext, AlertInstanceState, AlertServices, @@ -21,7 +21,7 @@ import { getIndexVersion } from '../../routes/index/get_index_version'; import { MIN_EQL_RULE_INDEX_VERSION } from '../../routes/index/get_signals_template'; import { getInputIndex } from '../get_input_output_index'; -import { +import type { BulkCreate, WrapHits, WrapSequences, @@ -31,9 +31,9 @@ import { SimpleHit, } from '../types'; import { createSearchAfterReturnType, makeFloatString } from '../utils'; -import { ExperimentalFeatures } from '../../../../../common/experimental_features'; +import type { ExperimentalFeatures } from '../../../../../common/experimental_features'; import { buildReasonMessageForEqlAlert } from '../reason_formatters'; -import { CompleteRule, EqlRuleParams } from '../../schemas/rule_schemas'; +import type { CompleteRule, EqlRuleParams } from '../../schemas/rule_schemas'; export const eqlExecutor = async ({ completeRule, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.test.ts index 9b93ba182785f..d923aea3f2476 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.test.ts @@ -16,7 +16,7 @@ import { getListClientMock } from '../../../../../../lists/server/services/lists import { findMlSignals } from '../find_ml_signals'; import { bulkCreateMlSignals } from '../bulk_create_ml_signals'; import { mlPluginServerMock } from '../../../../../../ml/server/mocks'; -import { MachineLearningRuleParams } from '../../schemas/rule_schemas'; +import type { MachineLearningRuleParams } from '../../schemas/rule_schemas'; jest.mock('../find_ml_signals'); jest.mock('../bulk_create_ml_signals'); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts index 3db8d51ab76ed..69261944bd3fc 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts @@ -7,21 +7,21 @@ import { KibanaRequest, Logger } from 'src/core/server'; import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; -import { +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../../alerting/server'; -import { ListClient } from '../../../../../../lists/server'; +import type { ListClient } from '../../../../../../lists/server'; import { isJobStarted } from '../../../../../common/machine_learning/helpers'; -import { CompleteRule, MachineLearningRuleParams } from '../../schemas/rule_schemas'; +import type { CompleteRule, MachineLearningRuleParams } from '../../schemas/rule_schemas'; import { bulkCreateMlSignals } from '../bulk_create_ml_signals'; import { filterEventsAgainstList } from '../filters/filter_events_against_list'; import { findMlSignals } from '../find_ml_signals'; -import { BuildRuleMessage } from '../rule_messages'; -import { BulkCreate, RuleRangeTuple, WrapHits } from '../types'; +import type { BuildRuleMessage } from '../rule_messages'; +import type { BulkCreate, RuleRangeTuple, WrapHits } from '../types'; import { createErrorsFromShard, createSearchAfterReturnType, mergeReturns } from '../utils'; -import { SetupPlugins } from '../../../../plugin'; +import type { SetupPlugins } from '../../../../plugin'; export const mlExecutor = async ({ completeRule, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/query.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/query.ts index 2bee175f357f3..aeda8a439e4a4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/query.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/query.ts @@ -5,22 +5,26 @@ * 2.0. */ -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; -import { +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../../alerting/server'; -import { ListClient } from '../../../../../../lists/server'; +import type { ListClient } from '../../../../../../lists/server'; import { getFilter } from '../get_filter'; import { getInputIndex } from '../get_input_output_index'; import { searchAfterAndBulkCreate } from '../search_after_bulk_create'; -import { RuleRangeTuple, BulkCreate, WrapHits } from '../types'; -import { TelemetryEventsSender } from '../../../telemetry/sender'; -import { BuildRuleMessage } from '../rule_messages'; -import { CompleteRule, SavedQueryRuleParams, QueryRuleParams } from '../../schemas/rule_schemas'; -import { ExperimentalFeatures } from '../../../../../common/experimental_features'; +import type { RuleRangeTuple, BulkCreate, WrapHits } from '../types'; +import type { TelemetryEventsSender } from '../../../telemetry/sender'; +import type { BuildRuleMessage } from '../rule_messages'; +import type { + CompleteRule, + SavedQueryRuleParams, + QueryRuleParams, +} from '../../schemas/rule_schemas'; +import type { ExperimentalFeatures } from '../../../../../common/experimental_features'; import { buildReasonMessageForQueryAlert } from '../reason_formatters'; export const queryExecutor = async ({ diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threat_match.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threat_match.ts index f2e2590ac1e2d..7c8a79290c4f1 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threat_match.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threat_match.ts @@ -5,21 +5,21 @@ * 2.0. */ -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; -import { +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../../alerting/server'; -import { ListClient } from '../../../../../../lists/server'; +import type { ListClient } from '../../../../../../lists/server'; import { getInputIndex } from '../get_input_output_index'; -import { RuleRangeTuple, BulkCreate, WrapHits } from '../types'; -import { TelemetryEventsSender } from '../../../telemetry/sender'; -import { BuildRuleMessage } from '../rule_messages'; +import type { RuleRangeTuple, BulkCreate, WrapHits } from '../types'; +import type { TelemetryEventsSender } from '../../../telemetry/sender'; +import type { BuildRuleMessage } from '../rule_messages'; import { createThreatSignals } from '../threat_mapping/create_threat_signals'; -import { CompleteRule, ThreatRuleParams } from '../../schemas/rule_schemas'; -import { ExperimentalFeatures } from '../../../../../common/experimental_features'; +import type { CompleteRule, ThreatRuleParams } from '../../schemas/rule_schemas'; +import type { ExperimentalFeatures } from '../../../../../common/experimental_features'; export const threatMatchExecutor = async ({ completeRule, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threshold.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threshold.test.ts index e01e3498c2c7a..a3b873c3d61c6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threshold.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threshold.test.ts @@ -17,7 +17,7 @@ import { getThresholdRuleParams, getCompleteRuleMock } from '../../schemas/rule_ import { buildRuleMessageFactory } from '../rule_messages'; import { sampleEmptyDocSearchResults } from '../__mocks__/es_results'; import { allowedExperimentalValues } from '../../../../../common/experimental_features'; -import { ThresholdRuleParams } from '../../schemas/rule_schemas'; +import type { ThresholdRuleParams } from '../../schemas/rule_schemas'; describe('threshold_executor', () => { const version = '8.0.0'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threshold.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threshold.ts index 2bb5d6880c634..8f7812b7d763a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threshold.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threshold.ts @@ -5,18 +5,18 @@ * 2.0. */ -import { SearchHit } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { SearchHit } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; -import { +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../../alerting/server'; import { hasLargeValueItem } from '../../../../../common/detection_engine/utils'; -import { CompleteRule, ThresholdRuleParams } from '../../schemas/rule_schemas'; +import type { CompleteRule, ThresholdRuleParams } from '../../schemas/rule_schemas'; import { getFilter } from '../get_filter'; import { getInputIndex } from '../get_input_output_index'; import { @@ -25,7 +25,7 @@ import { getThresholdBucketFilters, getThresholdSignalHistory, } from '../threshold'; -import { +import type { BulkCreate, RuleRangeTuple, SearchAfterAndBulkCreateReturnType, @@ -37,8 +37,8 @@ import { createSearchAfterReturnTypeFromResponse, mergeReturns, } from '../utils'; -import { BuildRuleMessage } from '../rule_messages'; -import { ExperimentalFeatures } from '../../../../../common/experimental_features'; +import type { BuildRuleMessage } from '../rule_messages'; +import type { ExperimentalFeatures } from '../../../../../common/experimental_features'; import { buildThresholdSignalHistory } from '../threshold/build_signal_history'; export const thresholdExecutor = async ({ diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/types.ts index 5feb8e8b92c5b..0fe9fff374958 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/types.ts @@ -8,8 +8,8 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { Logger } from 'src/core/server'; import type { Type, ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; -import { ListClient } from '../../../../../../lists/server'; -import { BuildRuleMessage } from '../rule_messages'; +import type { ListClient } from '../../../../../../lists/server'; +import type { BuildRuleMessage } from '../rule_messages'; export interface FilterEventsAgainstListOptions { listClient: ListClient; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/get_filter.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/get_filter.ts index 574020af45c15..8f47f0deffebc 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/get_filter.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/get_filter.ts @@ -6,22 +6,26 @@ */ import { BadRequestError } from '@kbn/securitysolution-es-utils'; -import { Type, LanguageOrUndefined, Language } from '@kbn/securitysolution-io-ts-alerting-types'; +import type { + Type, + LanguageOrUndefined, + Language, +} from '@kbn/securitysolution-io-ts-alerting-types'; import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; import { assertUnreachable } from '../../../../common/utility_types'; import { getQueryFilter } from '../../../../common/detection_engine/get_query_filter'; -import { +import type { QueryOrUndefined, SavedIdOrUndefined, IndexOrUndefined, } from '../../../../common/detection_engine/schemas/common/schemas'; -import { +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../alerting/server'; -import { PartialFilter } from '../types'; -import { QueryFilter } from './types'; +import type { PartialFilter } from '../types'; +import type { QueryFilter } from './types'; interface GetFilterArgs { type: Type; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/get_input_output_index.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/get_input_output_index.ts index d3b60f1e9a281..3604da681b00a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/get_input_output_index.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/get_input_output_index.ts @@ -10,12 +10,12 @@ import { DEFAULT_INDEX_PATTERN, DEFAULT_INDEX_PATTERN_EXPERIMENTAL, } from '../../../../common/constants'; -import { +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../alerting/server'; -import { ExperimentalFeatures } from '../../../../common/experimental_features'; +import type { ExperimentalFeatures } from '../../../../common/experimental_features'; export interface GetInputIndex { experimentalFeatures: ExperimentalFeatures; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/preview/alert_instance_factory_stub.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/preview/alert_instance_factory_stub.ts index d09314312c78d..3e58bfa8b728c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/preview/alert_instance_factory_stub.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/preview/alert_instance_factory_stub.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { RuleParams } from '../../schemas/rule_schemas'; -import { +import type { RuleParams } from '../../schemas/rule_schemas'; +import type { AlertInstanceContext, AlertInstanceState, AlertTypeState, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_exceptions_list.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_exceptions_list.test.ts index e38d1aa774094..adba3e7cc49fe 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_exceptions_list.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_exceptions_list.test.ts @@ -7,7 +7,7 @@ import { extractExceptionsList } from './extract_exceptions_list'; import { loggingSystemMock } from 'src/core/server/mocks'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { EXCEPTION_LIST_NAMESPACE, EXCEPTION_LIST_NAMESPACE_AGNOSTIC, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_exceptions_list.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_exceptions_list.ts index 93deae014005b..37f5e4450082f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_exceptions_list.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_exceptions_list.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { Logger, SavedObjectReference } from 'src/core/server'; +import type { Logger, SavedObjectReference } from 'src/core/server'; import { getSavedObjectType } from '@kbn/securitysolution-list-utils'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { getSavedObjectNamePatternForExceptionsList } from './utils'; /** diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_references.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_references.test.ts index df5fdf4fcead4..dfccecb8fbbb0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_references.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_references.test.ts @@ -7,7 +7,7 @@ import { loggingSystemMock } from 'src/core/server/mocks'; import { extractReferences } from './extract_references'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { EXCEPTION_LIST_NAMESPACE, EXCEPTION_LIST_NAMESPACE_AGNOSTIC, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_references.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_references.ts index 92e689e225764..f55a90fb556c2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_references.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/extract_references.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { Logger } from 'src/core/server'; -import { RuleParamsAndRefs } from '../../../../../../alerting/server'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { Logger } from 'src/core/server'; +import type { RuleParamsAndRefs } from '../../../../../../alerting/server'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { extractExceptionsList } from './extract_exceptions_list'; /** diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_exceptions_list.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_exceptions_list.test.ts index 1212b73a6250e..2973ca3a92384 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_exceptions_list.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_exceptions_list.test.ts @@ -6,10 +6,10 @@ */ import { loggingSystemMock } from 'src/core/server/mocks'; -import { SavedObjectReference } from 'src/core/server'; +import type { SavedObjectReference } from 'src/core/server'; import { EXCEPTION_LIST_NAMESPACE } from '@kbn/securitysolution-list-constants'; import { injectExceptionsReferences } from './inject_exceptions_list'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { EXCEPTIONS_SAVED_OBJECT_REFERENCE_NAME } from './utils/constants'; describe('inject_exceptions_list', () => { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_exceptions_list.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_exceptions_list.ts index baaaa2eb60ce9..eb62b3d522c5d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_exceptions_list.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_exceptions_list.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { Logger, SavedObjectReference } from 'src/core/server'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { Logger, SavedObjectReference } from 'src/core/server'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { getSavedObjectReferenceForExceptionsList, logMissingSavedObjectError } from './utils'; /** diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_references.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_references.test.ts index eae4cb20f7948..8e81ca437e8f3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_references.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_references.test.ts @@ -6,10 +6,10 @@ */ import { loggingSystemMock } from 'src/core/server/mocks'; -import { SavedObjectReference } from 'src/core/server'; +import type { SavedObjectReference } from 'src/core/server'; import { EXCEPTION_LIST_NAMESPACE } from '@kbn/securitysolution-list-constants'; import { injectReferences } from './inject_references'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { EXCEPTIONS_SAVED_OBJECT_REFERENCE_NAME } from './utils/constants'; describe('inject_references', () => { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_references.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_references.ts index dae5e3037b737..c30aee59e9cf7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_references.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/inject_references.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { Logger, SavedObjectReference } from 'src/core/server'; -import { RuleParams } from '../../schemas/rule_schemas'; +import type { Logger, SavedObjectReference } from 'src/core/server'; +import type { RuleParams } from '../../schemas/rule_schemas'; import { injectExceptionsReferences } from './inject_exceptions_list'; /** diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/get_saved_object_reference.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/get_saved_object_reference.test.ts index 70f321eed030e..bfc06f7e4a449 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/get_saved_object_reference.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/get_saved_object_reference.test.ts @@ -6,7 +6,7 @@ */ import { loggingSystemMock } from 'src/core/server/mocks'; -import { SavedObjectReference } from 'src/core/server'; +import type { SavedObjectReference } from 'src/core/server'; import { getSavedObjectReference } from '.'; describe('get_saved_object_reference', () => { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/get_saved_object_reference_for_exceptions_list.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/get_saved_object_reference_for_exceptions_list.test.ts index 9a16037ed7fd5..b26ddbc98138d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/get_saved_object_reference_for_exceptions_list.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/get_saved_object_reference_for_exceptions_list.test.ts @@ -6,7 +6,7 @@ */ import { loggingSystemMock } from 'src/core/server/mocks'; -import { SavedObjectReference } from 'src/core/server'; +import type { SavedObjectReference } from 'src/core/server'; import { EXCEPTIONS_SAVED_OBJECT_REFERENCE_NAME, getSavedObjectReferenceForExceptionsList, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/log_missing_saved_object_error.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/log_missing_saved_object_error.ts index 8d448c3cd10c4..870a96aa42eec 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/log_missing_saved_object_error.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/saved_object_references/utils/log_missing_saved_object_error.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { Logger } from 'src/core/server'; -import { RuleParams } from '../../../schemas/rule_schemas'; +import type { Logger } from 'src/core/server'; +import type { RuleParams } from '../../../schemas/rule_schemas'; /** * This will log a warning that we are missing an object reference. diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts index 62a7e87425d6b..2522e38b1eaa2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts @@ -20,7 +20,7 @@ import { alertsMock, AlertServicesMock } from '../../../../../alerting/server/mo import uuid from 'uuid'; import { listMock } from '../../../../../lists/server/mocks'; import { getExceptionListItemSchemaMock } from '../../../../../lists/common/schemas/response/exception_list_item_schema.mock'; -import { BulkCreate, BulkResponse, RuleRangeTuple, WrapHits } from './types'; +import type { BulkCreate, BulkResponse, RuleRangeTuple, WrapHits } from './types'; import type { SearchListItemArraySchema } from '@kbn/securitysolution-io-ts-list-types'; import { getSearchListItemResponseMock } from '../../../../../lists/common/schemas/response/search_list_item_schema.mock'; import { getRuleRangeTuples } from './utils'; @@ -31,8 +31,8 @@ import { bulkCreateFactory } from './bulk_create_factory'; import { wrapHitsFactory } from './wrap_hits_factory'; import { mockBuildRuleMessage } from './__mocks__/build_rule_message.mock'; import { errors as esErrors } from '@elastic/elasticsearch'; -import { BuildReasonMessage } from './reason_formatters'; -import { QueryRuleParams } from '../schemas/rule_schemas'; +import type { BuildReasonMessage } from './reason_formatters'; +import type { QueryRuleParams } from '../schemas/rule_schemas'; const buildRuleMessage = mockBuildRuleMessage; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.ts index f9a5e4acb3160..290d8a46ae202 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { TelemetryEventsSender } from '../../telemetry/sender'; -import { TelemetryEvent } from '../../telemetry/types'; -import { BuildRuleMessage } from './rule_messages'; -import { SignalSearchResponse, SignalSource } from './types'; -import { Logger } from '../../../../../../../src/core/server'; +import type { TelemetryEventsSender } from '../../telemetry/sender'; +import type { TelemetryEvent } from '../../telemetry/types'; +import type { BuildRuleMessage } from './rule_messages'; +import type { SignalSearchResponse, SignalSource } from './types'; +import type { Logger } from '../../../../../../../src/core/server'; export interface SearchResultWithSource { _source: SignalSource; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/siem_rule_action_groups.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/siem_rule_action_groups.ts index f401e3bd228ce..5f6113da987ab 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/siem_rule_action_groups.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/siem_rule_action_groups.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { ActionGroup } from '../../../../../alerting/common'; +import type { ActionGroup } from '../../../../../alerting/common'; export const siemRuleActionGroups: Array> = [ { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.test.ts index 10a7f38fbf389..1d5eceb7aabb7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.test.ts @@ -18,8 +18,8 @@ import { createSearchAfterReturnType, } from './utils'; import { parseScheduleDates } from '@kbn/securitysolution-io-ts-utils'; -import { RuleExecutorOptions, SearchAfterAndBulkCreateReturnType } from './types'; -import { RuleAlertType } from '../rules/types'; +import type { RuleExecutorOptions, SearchAfterAndBulkCreateReturnType } from './types'; +import type { RuleAlertType } from '../rules/types'; import { listMock } from '../../../../../lists/server/mocks'; import { getListClientMock } from '../../../../../lists/server/services/lists/list_client.mock'; import { getExceptionListClientMock } from '../../../../../lists/server/services/exception_lists/exception_list_client.mock'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts index 85285eed2817a..cad9e95e4e0f5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts @@ -6,7 +6,7 @@ */ /* eslint-disable complexity */ -import { Logger } from 'src/core/server'; +import type { Logger } from 'src/core/server'; import isEmpty from 'lodash/isEmpty'; import * as t from 'io-ts'; @@ -21,7 +21,7 @@ import { isThreatMatchRule, isQueryRule, } from '../../../../common/detection_engine/utils'; -import { SetupPlugins } from '../../../plugin'; +import type { SetupPlugins } from '../../../plugin'; import { getInputIndex } from './get_input_output_index'; import { SignalRuleAlertTypeDefinition, ThresholdAlertState } from './types'; import { @@ -41,7 +41,7 @@ import { } from '../notifications/schedule_notification_actions'; import { buildRuleMessageFactory } from './rule_messages'; import { getNotificationResultsLink } from '../notifications/utils'; -import { TelemetryEventsSender } from '../../telemetry/sender'; +import type { TelemetryEventsSender } from '../../telemetry/sender'; import { eqlExecutor } from './executors/eql'; import { queryExecutor } from './executors/query'; import { threatMatchExecutor } from './executors/threat_match'; @@ -61,8 +61,8 @@ import { import { bulkCreateFactory } from './bulk_create_factory'; import { wrapHitsFactory } from './wrap_hits_factory'; import { wrapSequencesFactory } from './wrap_sequences_factory'; -import { ConfigType } from '../../../config'; -import { ExperimentalFeatures } from '../../../../common/experimental_features'; +import type { ConfigType } from '../../../config'; +import type { ExperimentalFeatures } from '../../../../common/experimental_features'; import { injectReferences, extractReferences } from './saved_object_references'; import { IRuleExecutionLogClient, @@ -71,7 +71,7 @@ import { } from '../rule_execution_log'; import { RuleExecutionStatus } from '../../../../common/detection_engine/schemas/common/schemas'; import { scheduleThrottledNotificationActions } from '../notifications/schedule_throttle_notification_actions'; -import { IEventLogService } from '../../../../../event_log/server'; +import type { IEventLogService } from '../../../../../event_log/server'; export const signalRulesAlertType = ({ logger, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.ts index 2596068848ef0..232a8ff4156b7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.ts @@ -6,17 +6,17 @@ */ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { performance } from 'perf_hooks'; -import { +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../alerting/server'; -import { Logger } from '../../../../../../../src/core/server'; +import type { Logger } from '../../../../../../../src/core/server'; import type { SignalSearchResponse, SignalSource } from './types'; -import { BuildRuleMessage } from './rule_messages'; +import type { BuildRuleMessage } from './rule_messages'; import { buildEventsSearchQuery } from './build_events_query'; import { createErrorsFromShard, makeFloatString } from './utils'; -import { TimestampOverrideOrUndefined } from '../../../../common/detection_engine/schemas/common/schemas'; +import type { TimestampOverrideOrUndefined } from '../../../../common/detection_engine/schemas/common/schemas'; interface SingleSearchAfterParams { aggregations?: Record; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/types.ts index be17682ea4d08..514b14baf01a3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/types.ts @@ -18,15 +18,15 @@ import type { Type, } from '@kbn/securitysolution-io-ts-alerting-types'; import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; -import { ListClient } from '../../../../../../lists/server'; -import { +import type { ListClient } from '../../../../../../lists/server'; +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../../alerting/server'; -import { ElasticsearchClient, Logger } from '../../../../../../../../src/core/server'; -import { TelemetryEventsSender } from '../../../telemetry/sender'; -import { BuildRuleMessage } from '../rule_messages'; +import type { ElasticsearchClient, Logger } from '../../../../../../../../src/core/server'; +import type { TelemetryEventsSender } from '../../../telemetry/sender'; +import type { BuildRuleMessage } from '../rule_messages'; import { BulkCreate, RuleRangeTuple, @@ -34,7 +34,7 @@ import { SignalsEnrichment, WrapHits, } from '../types'; -import { CompleteRule, ThreatRuleParams } from '../../schemas/rule_schemas'; +import type { CompleteRule, ThreatRuleParams } from '../../schemas/rule_schemas'; export type SortOrderOrUndefined = 'asc' | 'desc' | undefined; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.ts index b959f3de47a8a..92867ed9f16ef 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { SearchHit } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { SearchHit } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { ALERT_RULE_THRESHOLD_FIELD, ALERT_ORIGINAL_TIME, } from '../../../../../common/field_maps/field_names'; -import { SimpleHit, ThresholdSignalHistory } from '../types'; +import type { SimpleHit, ThresholdSignalHistory } from '../types'; import { getThresholdTermsHash, isWrappedRACAlert, isWrappedSignalHit } from '../utils'; interface GetThresholdSignalHistoryParams { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/bulk_create_threshold_signals.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/bulk_create_threshold_signals.ts index 4dbe1577365d6..6bd7d53346777 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/bulk_create_threshold_signals.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/bulk_create_threshold_signals.ts @@ -9,19 +9,19 @@ import { TIMESTAMP } from '@kbn/rule-data-utils'; import { get } from 'lodash/fp'; import set from 'set-value'; -import { +import type { ThresholdNormalized, TimestampOverrideOrUndefined, } from '../../../../../common/detection_engine/schemas/common/schemas'; -import { Logger } from '../../../../../../../../src/core/server'; -import { +import type { Logger } from '../../../../../../../../src/core/server'; +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../../alerting/server'; -import { BaseHit } from '../../../../../common/detection_engine/types'; -import { TermAggregationBucket } from '../../../types'; -import { GenericBulkCreateResponse } from '../bulk_create_factory'; +import type { BaseHit } from '../../../../../common/detection_engine/types'; +import type { TermAggregationBucket } from '../../../types'; +import type { GenericBulkCreateResponse } from '../bulk_create_factory'; import { calculateThresholdSignalUuid, getThresholdAggregationParts, @@ -36,7 +36,7 @@ import type { BulkCreate, WrapHits, } from '../types'; -import { CompleteRule, ThresholdRuleParams } from '../../schemas/rule_schemas'; +import type { CompleteRule, ThresholdRuleParams } from '../../schemas/rule_schemas'; interface BulkCreateThresholdSignalsParams { someResult: SignalSearchResponse; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_previous_threshold_signals.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_previous_threshold_signals.ts index 1a2bfbf3a962d..31eeb574deb63 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_previous_threshold_signals.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_previous_threshold_signals.ts @@ -5,16 +5,16 @@ * 2.0. */ -import { TimestampOverrideOrUndefined } from '../../../../../common/detection_engine/schemas/common/schemas'; -import { +import type { TimestampOverrideOrUndefined } from '../../../../../common/detection_engine/schemas/common/schemas'; +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../../alerting/server'; -import { Logger } from '../../../../../../../../src/core/server'; -import { BuildRuleMessage } from '../rule_messages'; +import type { Logger } from '../../../../../../../../src/core/server'; +import type { BuildRuleMessage } from '../rule_messages'; import { singleSearchAfter } from '../single_search_after'; -import { SignalSearchResponse } from '../types'; +import type { SignalSearchResponse } from '../types'; interface FindPreviousThresholdSignalsParams { from: string; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_threshold_signals.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_threshold_signals.ts index ad0ff99c019af..cfc632b345c87 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_threshold_signals.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_threshold_signals.ts @@ -8,17 +8,17 @@ import { set } from '@elastic/safer-lodash-set'; import { TIMESTAMP } from '@kbn/rule-data-utils'; -import { +import type { ThresholdNormalized, TimestampOverrideOrUndefined, } from '../../../../../common/detection_engine/schemas/common/schemas'; -import { +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../../alerting/server'; -import { Logger } from '../../../../../../../../src/core/server'; -import { BuildRuleMessage } from '../rule_messages'; +import type { Logger } from '../../../../../../../../src/core/server'; +import type { BuildRuleMessage } from '../rule_messages'; import { singleSearchAfter } from '../single_search_after'; import type { SignalSearchResponse } from '../types'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/get_threshold_signal_history.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/get_threshold_signal_history.ts index fe8d823fb8c2a..013eb7a84c405 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/get_threshold_signal_history.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/get_threshold_signal_history.ts @@ -5,15 +5,15 @@ * 2.0. */ -import { TimestampOverrideOrUndefined } from '../../../../../common/detection_engine/schemas/common/schemas'; -import { +import type { TimestampOverrideOrUndefined } from '../../../../../common/detection_engine/schemas/common/schemas'; +import type { AlertInstanceContext, AlertInstanceState, AlertServices, } from '../../../../../../alerting/server'; -import { Logger } from '../../../../../../../../src/core/server'; -import { ThresholdSignalHistory } from '../types'; -import { BuildRuleMessage } from '../rule_messages'; +import type { Logger } from '../../../../../../../../src/core/server'; +import type { ThresholdSignalHistory } from '../types'; +import type { BuildRuleMessage } from '../rule_messages'; import { findPreviousThresholdSignals } from './find_previous_threshold_signals'; import { buildThresholdSignalHistory } from './build_signal_history'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts index 1570f9a9adb84..de0df9ae01353 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts @@ -6,12 +6,12 @@ */ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { BoolQuery } from '@kbn/es-query'; +import type { BoolQuery } from '@kbn/es-query'; import moment from 'moment'; import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; -import { Status } from '../../../../common/detection_engine/schemas/common/schemas'; -import { RulesSchema } from '../../../../common/detection_engine/schemas/response/rules_schema'; -import { +import type { Status } from '../../../../common/detection_engine/schemas/common/schemas'; +import type { RulesSchema } from '../../../../common/detection_engine/schemas/response/rules_schema'; +import type { AlertType, AlertTypeState, AlertInstanceState, @@ -19,24 +19,24 @@ import { AlertExecutorOptions, AlertServices, } from '../../../../../alerting/server'; -import { TermAggregationBucket } from '../../types'; -import { +import type { TermAggregationBucket } from '../../types'; +import type { EqlSearchResponse, BaseHit, RuleAlertAction, SearchTypes, EqlSequence, } from '../../../../common/detection_engine/types'; -import { ListClient } from '../../../../../lists/server'; -import { Logger } from '../../../../../../../src/core/server'; -import { BuildRuleMessage } from './rule_messages'; -import { TelemetryEventsSender } from '../../telemetry/sender'; -import { CompleteRule, RuleParams } from '../schemas/rule_schemas'; -import { GenericBulkCreateResponse } from './bulk_create_factory'; -import { EcsFieldMap } from '../../../../../rule_registry/common/assets/field_maps/ecs_field_map'; -import { TypeOfFieldMap } from '../../../../../rule_registry/common/field_map'; -import { BuildReasonMessage } from './reason_formatters'; -import { RACAlert } from '../rule_types/types'; +import type { ListClient } from '../../../../../lists/server'; +import type { Logger } from '../../../../../../../src/core/server'; +import type { BuildRuleMessage } from './rule_messages'; +import type { TelemetryEventsSender } from '../../telemetry/sender'; +import type { CompleteRule, RuleParams } from '../schemas/rule_schemas'; +import type { GenericBulkCreateResponse } from './bulk_create_factory'; +import type { EcsFieldMap } from '../../../../../rule_registry/common/assets/field_maps/ecs_field_map'; +import type { TypeOfFieldMap } from '../../../../../rule_registry/common/field_map'; +import type { BuildReasonMessage } from './reason_formatters'; +import type { RACAlert } from '../rule_types/types'; // used for gap detection code // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts index 8da9267daabac..a8663cf46f1e8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts @@ -7,13 +7,13 @@ import moment from 'moment'; import sinon from 'sinon'; -import { TransportResult } from '@elastic/elasticsearch'; +import type { TransportResult } from '@elastic/elasticsearch'; import { ALERT_UUID } from '@kbn/rule-data-utils'; import { alertsMock, AlertServicesMock } from '../../../../../alerting/server/mocks'; import { listMock } from '../../../../../lists/server/mocks'; import { buildRuleMessageFactory } from './rule_messages'; -import { ExceptionListClient } from '../../../../../lists/server'; +import type { ExceptionListClient } from '../../../../../lists/server'; import { getListArrayMock } from '../../../../common/detection_engine/schemas/types/lists.mock'; import { getExceptionListItemSchemaMock } from '../../../../../lists/common/schemas/response/exception_list_item_schema.mock'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts index 8a59d71fe74ec..779f9b5c6ba19 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts @@ -11,7 +11,7 @@ import uuidv5 from 'uuid/v5'; import dateMath from '@elastic/datemath'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { TransportResult } from '@elastic/elasticsearch'; +import type { TransportResult } from '@elastic/elasticsearch'; import { ALERT_UUID, ALERT_RULE_UUID } from '@kbn/rule-data-utils'; import type { ListArray, ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; import { MAX_EXCEPTION_LIST_SIZE } from '@kbn/securitysolution-list-constants'; @@ -22,19 +22,24 @@ import { Privilege, RuleExecutionStatus, } from '../../../../common/detection_engine/schemas/common/schemas'; -import { + +import type { ElasticsearchClient, Logger, SavedObjectsClientContract, } from '../../../../../../../src/core/server'; -import { + +import type { AlertInstanceContext, AlertInstanceState, AlertServices, - parseDuration, } from '../../../../../alerting/server'; -import { ExceptionListClient, ListClient, ListPluginSetup } from '../../../../../lists/server'; -import { + +// We _must_ import from here and not from "alerting/server" above or we will get a memory leak. See https://github.com/elastic/kibana/issues/117255 +import { parseDuration } from '../../../../../alerting/common/parse_duration'; + +import type { ExceptionListClient, ListClient, ListPluginSetup } from '../../../../../lists/server'; +import type { BulkResponseErrorAggregation, SignalHit, SearchAfterAndBulkCreateReturnType, @@ -47,9 +52,9 @@ import { SimpleHit, WrappedEventHit, } from './types'; -import { BuildRuleMessage } from './rule_messages'; -import { ShardError } from '../../types'; -import { +import type { BuildRuleMessage } from './rule_messages'; +import type { ShardError } from '../../types'; +import type { EqlRuleParams, MachineLearningRuleParams, QueryRuleParams, @@ -58,9 +63,9 @@ import { ThreatRuleParams, ThresholdRuleParams, } from '../schemas/rule_schemas'; -import { RACAlert, WrappedRACAlert } from '../rule_types/types'; -import { SearchTypes } from '../../../../common/detection_engine/types'; -import { IRuleExecutionLogClient } from '../rule_execution_log/types'; +import type { RACAlert, WrappedRACAlert } from '../rule_types/types'; +import type { SearchTypes } from '../../../../common/detection_engine/types'; +import type { IRuleExecutionLogClient } from '../rule_execution_log/types'; interface SortExceptionsReturn { exceptionsWithValueLists: ExceptionListItemSchema[]; exceptionsWithoutValueLists: ExceptionListItemSchema[]; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/tags/read_tags.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/tags/read_tags.ts index 183ac6f777963..8fc1c6bda9621 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/tags/read_tags.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/tags/read_tags.ts @@ -7,7 +7,7 @@ import { has } from 'lodash/fp'; import { INTERNAL_IDENTIFIER } from '../../../../common/constants'; -import { RulesClient } from '../../../../../alerting/server'; +import type { RulesClient } from '../../../../../alerting/server'; import { findRules } from '../rules/find_rules'; export interface TagType { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/types.ts index 9eb160ed2da56..00fc7728972b4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/types.ts @@ -52,8 +52,8 @@ import { EventCategoryOverrideOrUndefined, } from '../../../common/detection_engine/schemas/common/schemas'; -import { Filter } from '../../../../../../src/plugins/data/server'; -import { AlertTypeParams } from '../../../../alerting/common'; +import type { Filter } from '../../../../../../src/plugins/data/server'; +import type { AlertTypeParams } from '../../../../alerting/common'; export type PartialFilter = Partial; diff --git a/x-pack/plugins/security_solution/server/mocks.ts b/x-pack/plugins/security_solution/server/mocks.ts index bc8183666c7f3..fad5686e2e2e3 100644 --- a/x-pack/plugins/security_solution/server/mocks.ts +++ b/x-pack/plugins/security_solution/server/mocks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AppClient } from './types'; +import type { AppClient } from './types'; type AppClientMock = jest.Mocked; const createAppClientMock = (): AppClientMock => diff --git a/x-pack/plugins/security_solution/server/plugin_contract.ts b/x-pack/plugins/security_solution/server/plugin_contract.ts index 0d8666ff169cd..5c967b6426a40 100644 --- a/x-pack/plugins/security_solution/server/plugin_contract.ts +++ b/x-pack/plugins/security_solution/server/plugin_contract.ts @@ -16,7 +16,7 @@ import { PluginStart as DataPluginStart, } from '../../../../src/plugins/data/server'; import { UsageCollectionSetup as UsageCollectionPluginSetup } from '../../../../src/plugins/usage_collection/server'; -import { +import type { PluginSetupContract as AlertingPluginSetup, PluginStartContract as AlertingPluginStart, } from '../../alerting/server';