diff --git a/x-pack/plugins/cases/server/authorization/authorization.ts b/x-pack/plugins/cases/server/authorization/authorization.ts index 3598c5b8956fa..dcf9b451698c5 100644 --- a/x-pack/plugins/cases/server/authorization/authorization.ts +++ b/x-pack/plugins/cases/server/authorization/authorization.ts @@ -12,7 +12,7 @@ import { PluginStartContract as FeaturesPluginStart } from '../../../features/se import { AuthFilterHelpers, GetSpaceFn, OwnerEntity } from './types'; import { getOwnersFilter } from './utils'; import { AuthorizationAuditLogger, OperationDetails } from '.'; -import { createCaseError } from '../common'; +import { createCaseError } from '../common/error'; /** * This class handles ensuring that the user making a request has the correct permissions diff --git a/x-pack/plugins/cases/server/client/alerts/types.ts b/x-pack/plugins/cases/server/client/alerts/types.ts index 95cd9ae33bff9..cba18cc26e8b7 100644 --- a/x-pack/plugins/cases/server/client/alerts/types.ts +++ b/x-pack/plugins/cases/server/client/alerts/types.ts @@ -6,7 +6,7 @@ */ import { CaseStatuses } from '../../../common/api'; -import { AlertInfo } from '../../common'; +import { AlertInfo } from '../../common/types'; interface Alert { id: string; diff --git a/x-pack/plugins/cases/server/client/attachments/add.ts b/x-pack/plugins/cases/server/client/attachments/add.ts index 13a61491b9f0e..15d20a9d3dcb4 100644 --- a/x-pack/plugins/cases/server/client/attachments/add.ts +++ b/x-pack/plugins/cases/server/client/attachments/add.ts @@ -42,12 +42,9 @@ import { } from '../../services/user_actions/helpers'; import { AttachmentService, CasesService, CaseUserActionService } from '../../services'; -import { - createCaseError, - CommentableCase, - createAlertUpdateRequest, - isCommentRequestTypeGenAlert, -} from '../../common'; +import { CommentableCase } from '../../common/models'; +import { createCaseError } from '../../common/error'; +import { createAlertUpdateRequest, isCommentRequestTypeGenAlert } from '../../common/utils'; import { CasesClientArgs, CasesClientInternal } from '..'; import { decodeCommentRequest } from '../utils'; diff --git a/x-pack/plugins/cases/server/client/attachments/delete.ts b/x-pack/plugins/cases/server/client/attachments/delete.ts index aa4d16e41ca52..17fcd2235a034 100644 --- a/x-pack/plugins/cases/server/client/attachments/delete.ts +++ b/x-pack/plugins/cases/server/client/attachments/delete.ts @@ -17,7 +17,8 @@ import { } from '../../../common/constants'; import { CasesClientArgs } from '../types'; import { buildCommentUserActionItem } from '../../services/user_actions/helpers'; -import { createCaseError, checkEnabledCaseConnectorOrThrow } from '../../common'; +import { createCaseError } from '../../common/error'; +import { checkEnabledCaseConnectorOrThrow } from '../../common/utils'; import { Operations } from '../../authorization'; /** diff --git a/x-pack/plugins/cases/server/client/attachments/get.ts b/x-pack/plugins/cases/server/client/attachments/get.ts index 95bee2ce99eb3..bbef0fe0ce348 100644 --- a/x-pack/plugins/cases/server/client/attachments/get.ts +++ b/x-pack/plugins/cases/server/client/attachments/get.ts @@ -22,14 +22,14 @@ import { } from '../../../common/api'; import { ENABLE_CASE_CONNECTOR } from '../../../common/constants'; import { - createCaseError, checkEnabledCaseConnectorOrThrow, defaultSortField, transformComments, flattenCommentSavedObject, flattenCommentSavedObjects, getIDsAndIndicesAsArrays, -} from '../../common'; +} from '../../common/utils'; +import { createCaseError } from '../../common/error'; import { defaultPage, defaultPerPage } from '../../routes/api'; import { CasesClientArgs } from '../types'; import { combineFilters, stringToKueryNode } from '../utils'; diff --git a/x-pack/plugins/cases/server/client/attachments/update.ts b/x-pack/plugins/cases/server/client/attachments/update.ts index 0423a949f3fee..a74e6c140bf4e 100644 --- a/x-pack/plugins/cases/server/client/attachments/update.ts +++ b/x-pack/plugins/cases/server/client/attachments/update.ts @@ -10,7 +10,9 @@ import Boom from '@hapi/boom'; import { SavedObjectsClientContract, Logger } from 'kibana/server'; import { LensServerPluginSetup } from '../../../../lens/server'; -import { checkEnabledCaseConnectorOrThrow, CommentableCase, createCaseError } from '../../common'; +import { CommentableCase } from '../../common/models'; +import { createCaseError } from '../../common/error'; +import { checkEnabledCaseConnectorOrThrow } from '../../common/utils'; import { buildCommentUserActionItem } from '../../services/user_actions/helpers'; import { CaseResponse, CommentPatchRequest, CommentRequest } from '../../../common/api'; import { CASE_SAVED_OBJECT, SUB_CASE_SAVED_OBJECT } from '../../../common/constants'; diff --git a/x-pack/plugins/cases/server/client/cases/create.ts b/x-pack/plugins/cases/server/client/cases/create.ts index cee245aae1306..8a668b7c5db09 100644 --- a/x-pack/plugins/cases/server/client/cases/create.ts +++ b/x-pack/plugins/cases/server/client/cases/create.ts @@ -26,7 +26,8 @@ import { ENABLE_CASE_CONNECTOR, MAX_TITLE_LENGTH } from '../../../common/constan import { buildCaseUserActionItem } from '../../services/user_actions/helpers'; import { Operations } from '../../authorization'; -import { createCaseError, flattenCaseSavedObject, transformNewCase } from '../../common'; +import { createCaseError } from '../../common/error'; +import { flattenCaseSavedObject, transformNewCase } from '../../common/utils'; import { CasesClientArgs } from '..'; /** diff --git a/x-pack/plugins/cases/server/client/cases/delete.ts b/x-pack/plugins/cases/server/client/cases/delete.ts index df202f3fbd6ae..cbe481dd07098 100644 --- a/x-pack/plugins/cases/server/client/cases/delete.ts +++ b/x-pack/plugins/cases/server/client/cases/delete.ts @@ -11,7 +11,7 @@ import { SavedObject, SavedObjectsClientContract, SavedObjectsFindResponse } fro import { CommentAttributes, SubCaseAttributes, OWNER_FIELD } from '../../../common/api'; import { ENABLE_CASE_CONNECTOR, MAX_CONCURRENT_SEARCHES } from '../../../common/constants'; import { CasesClientArgs } from '..'; -import { createCaseError } from '../../common'; +import { createCaseError } from '../../common/error'; import { AttachmentService, CasesService } from '../../services'; import { buildCaseUserActionItem } from '../../services/user_actions/helpers'; import { Operations, OwnerEntity } from '../../authorization'; diff --git a/x-pack/plugins/cases/server/client/cases/find.ts b/x-pack/plugins/cases/server/client/cases/find.ts index b0b7ade7311ef..4257dfce6d5e3 100644 --- a/x-pack/plugins/cases/server/client/cases/find.ts +++ b/x-pack/plugins/cases/server/client/cases/find.ts @@ -20,7 +20,8 @@ import { excess, } from '../../../common/api'; -import { createCaseError, transformCases } from '../../common'; +import { createCaseError } from '../../common/error'; +import { transformCases } from '../../common/utils'; import { constructQueryOptions } from '../utils'; import { includeFieldsRequiredForAuthentication } from '../../authorization/utils'; import { Operations } from '../../authorization'; diff --git a/x-pack/plugins/cases/server/client/cases/get.ts b/x-pack/plugins/cases/server/client/cases/get.ts index 5d061d57bb155..b388abb58e449 100644 --- a/x-pack/plugins/cases/server/client/cases/get.ts +++ b/x-pack/plugins/cases/server/client/cases/get.ts @@ -30,7 +30,8 @@ import { CaseAttributes, } from '../../../common/api'; import { ENABLE_CASE_CONNECTOR } from '../../../common/constants'; -import { countAlertsForID, createCaseError, flattenCaseSavedObject } from '../../common'; +import { createCaseError } from '../../common/error'; +import { countAlertsForID, flattenCaseSavedObject } from '../../common/utils'; import { CasesClientArgs } from '..'; import { Operations } from '../../authorization'; import { combineAuthorizedAndOwnerFilter } from '../utils'; diff --git a/x-pack/plugins/cases/server/client/cases/push.ts b/x-pack/plugins/cases/server/client/cases/push.ts index a2e93b783724a..e9386e8014319 100644 --- a/x-pack/plugins/cases/server/client/cases/push.ts +++ b/x-pack/plugins/cases/server/client/cases/push.ts @@ -22,7 +22,8 @@ import { ENABLE_CASE_CONNECTOR } from '../../../common/constants'; import { buildCaseUserActionItem } from '../../services/user_actions/helpers'; import { createIncident, getCommentContextFromAttributes } from './utils'; -import { createCaseError, flattenCaseSavedObject, getAlertInfoFromComments } from '../../common'; +import { createCaseError } from '../../common/error'; +import { flattenCaseSavedObject, getAlertInfoFromComments } from '../../common/utils'; import { CasesClient, CasesClientArgs, CasesClientInternal } from '..'; import { Operations } from '../../authorization'; import { casesConnectors } from '../../connectors'; diff --git a/x-pack/plugins/cases/server/client/cases/update.ts b/x-pack/plugins/cases/server/client/cases/update.ts index c50a08c1ea763..015fc80fb3413 100644 --- a/x-pack/plugins/cases/server/client/cases/update.ts +++ b/x-pack/plugins/cases/server/client/cases/update.ts @@ -45,14 +45,13 @@ import { } from '../../../common/constants'; import { buildCaseUserActions } from '../../services/user_actions/helpers'; import { getCaseToUpdate } from '../utils'; - +import { createCaseError } from '../../common/error'; import { CasesService } from '../../services'; import { createAlertUpdateRequest, - createCaseError, flattenCaseSavedObject, isCommentRequestTypeAlertOrGenAlert, -} from '../../common'; +} from '../../common/utils'; import { UpdateAlertRequest } from '../alerts/types'; import { CasesClientInternal } from '../client_internal'; import { CasesClientArgs } from '..'; diff --git a/x-pack/plugins/cases/server/client/cases/utils.test.ts b/x-pack/plugins/cases/server/client/cases/utils.test.ts index 0fffa304f6a23..3c9e8e7255e76 100644 --- a/x-pack/plugins/cases/server/client/cases/utils.test.ts +++ b/x-pack/plugins/cases/server/client/cases/utils.test.ts @@ -31,7 +31,7 @@ import { transformers, transformFields, } from './utils'; -import { flattenCaseSavedObject } from '../../common'; +import { flattenCaseSavedObject } from '../../common/utils'; import { SECURITY_SOLUTION_OWNER } from '../../../common/constants'; import { casesConnectors } from '../../connectors'; diff --git a/x-pack/plugins/cases/server/client/configure/client.ts b/x-pack/plugins/cases/server/client/configure/client.ts index 5982e100180f3..c7b94df879142 100644 --- a/x-pack/plugins/cases/server/client/configure/client.ts +++ b/x-pack/plugins/cases/server/client/configure/client.ts @@ -33,7 +33,7 @@ import { throwErrors, } from '../../../common/api'; import { MAX_CONCURRENT_SEARCHES, SUPPORTED_CONNECTORS } from '../../../common/constants'; -import { createCaseError } from '../../common'; +import { createCaseError } from '../../common/error'; import { CasesClientInternal } from '../client_internal'; import { CasesClientArgs } from '../types'; import { getMappings } from './get_mappings'; diff --git a/x-pack/plugins/cases/server/client/configure/create_mappings.ts b/x-pack/plugins/cases/server/client/configure/create_mappings.ts index 58b0f74225cb4..bb4c32ae57071 100644 --- a/x-pack/plugins/cases/server/client/configure/create_mappings.ts +++ b/x-pack/plugins/cases/server/client/configure/create_mappings.ts @@ -7,7 +7,7 @@ import { ConnectorMappingsAttributes } from '../../../common/api'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; -import { createCaseError } from '../../common'; +import { createCaseError } from '../../common/error'; import { CasesClientArgs } from '..'; import { CreateMappingsArgs } from './types'; import { casesConnectors } from '../../connectors'; diff --git a/x-pack/plugins/cases/server/client/configure/get_mappings.ts b/x-pack/plugins/cases/server/client/configure/get_mappings.ts index ab38ccb8f696b..2fa0e8454bacf 100644 --- a/x-pack/plugins/cases/server/client/configure/get_mappings.ts +++ b/x-pack/plugins/cases/server/client/configure/get_mappings.ts @@ -8,7 +8,7 @@ import { SavedObjectsFindResponse } from 'kibana/server'; import { ConnectorMappings } from '../../../common/api'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; -import { createCaseError } from '../../common'; +import { createCaseError } from '../../common/error'; import { CasesClientArgs } from '..'; import { MappingsArgs } from './types'; diff --git a/x-pack/plugins/cases/server/client/configure/update_mappings.ts b/x-pack/plugins/cases/server/client/configure/update_mappings.ts index c7232b26674ad..3d529e51e7561 100644 --- a/x-pack/plugins/cases/server/client/configure/update_mappings.ts +++ b/x-pack/plugins/cases/server/client/configure/update_mappings.ts @@ -7,7 +7,7 @@ import { ConnectorMappingsAttributes } from '../../../common/api'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; -import { createCaseError } from '../../common'; +import { createCaseError } from '../../common/error'; import { CasesClientArgs } from '..'; import { UpdateMappingsArgs } from './types'; import { casesConnectors } from '../../connectors'; diff --git a/x-pack/plugins/cases/server/client/stats/client.ts b/x-pack/plugins/cases/server/client/stats/client.ts index fe97446a4891c..a7716ba7a3da2 100644 --- a/x-pack/plugins/cases/server/client/stats/client.ts +++ b/x-pack/plugins/cases/server/client/stats/client.ts @@ -21,7 +21,7 @@ import { CasesStatusRequestRt, } from '../../../common/api'; import { Operations } from '../../authorization'; -import { createCaseError } from '../../common'; +import { createCaseError } from '../../common/error'; import { constructQueryOptions } from '../utils'; /** diff --git a/x-pack/plugins/cases/server/client/sub_cases/update.ts b/x-pack/plugins/cases/server/client/sub_cases/update.ts index 84e5b3e806d26..9d7233868ae59 100644 --- a/x-pack/plugins/cases/server/client/sub_cases/update.ts +++ b/x-pack/plugins/cases/server/client/sub_cases/update.ts @@ -37,12 +37,12 @@ import { import { CASE_COMMENT_SAVED_OBJECT, SUB_CASE_SAVED_OBJECT } from '../../../common/constants'; import { getCaseToUpdate } from '../utils'; import { buildSubCaseUserActions } from '../../services/user_actions/helpers'; +import { createCaseError } from '../../common/error'; import { createAlertUpdateRequest, - createCaseError, isCommentRequestTypeAlertOrGenAlert, flattenSubCaseSavedObject, -} from '../../common'; +} from '../../common/utils'; import { UpdateAlertRequest } from '../../client/alerts/types'; import { CasesClientArgs } from '../types'; import { CasesClientInternal } from '../client_internal'; diff --git a/x-pack/plugins/cases/server/client/user_actions/get.test.ts b/x-pack/plugins/cases/server/client/user_actions/get.test.ts index 28f427efba443..c735c7d41dfcf 100644 --- a/x-pack/plugins/cases/server/client/user_actions/get.test.ts +++ b/x-pack/plugins/cases/server/client/user_actions/get.test.ts @@ -7,7 +7,7 @@ import { CaseUserActionResponse } from '../../../common/api'; import { SUB_CASE_SAVED_OBJECT } from '../../../common/constants'; -import { SUB_CASE_REF_NAME } from '../../common'; +import { SUB_CASE_REF_NAME } from '../../common/constants'; import { extractAttributesWithoutSubCases } from './get'; describe('get', () => { diff --git a/x-pack/plugins/cases/server/client/user_actions/get.ts b/x-pack/plugins/cases/server/client/user_actions/get.ts index e52c578cefd6d..0d5ee29529f83 100644 --- a/x-pack/plugins/cases/server/client/user_actions/get.ts +++ b/x-pack/plugins/cases/server/client/user_actions/get.ts @@ -12,7 +12,9 @@ import { CaseUserActionResponse, } from '../../../common/api'; import { SUB_CASE_SAVED_OBJECT } from '../../../common/constants'; -import { createCaseError, checkEnabledCaseConnectorOrThrow, SUB_CASE_REF_NAME } from '../../common'; +import { createCaseError } from '../../common/error'; +import { checkEnabledCaseConnectorOrThrow } from '../../common/utils'; +import { SUB_CASE_REF_NAME } from '../../common/constants'; import { CasesClientArgs } from '..'; import { Operations } from '../../authorization'; import { UserActionGet } from './client'; diff --git a/x-pack/plugins/cases/server/client/utils.test.ts b/x-pack/plugins/cases/server/client/utils.test.ts index 45ea6bacb0f51..e4e6777dca524 100644 --- a/x-pack/plugins/cases/server/client/utils.test.ts +++ b/x-pack/plugins/cases/server/client/utils.test.ts @@ -7,7 +7,7 @@ import { CaseConnector, CaseType, ConnectorTypes } from '../../common/api'; import { newCase } from '../routes/api/__mocks__/request_responses'; -import { transformNewCase } from '../common'; +import { transformNewCase } from '../common/utils'; import { sortToSnake } from './utils'; describe('utils', () => { diff --git a/x-pack/plugins/cases/server/client/utils.ts b/x-pack/plugins/cases/server/client/utils.ts index 1b9c7828a910f..a29e52b026a27 100644 --- a/x-pack/plugins/cases/server/client/utils.ts +++ b/x-pack/plugins/cases/server/client/utils.ts @@ -31,8 +31,8 @@ import { isCommentRequestTypeAlertOrGenAlert, isCommentRequestTypeUser, isCommentRequestTypeActions, - SavedObjectFindOptionsKueryNode, -} from '../common'; +} from '../common/utils'; +import { SavedObjectFindOptionsKueryNode } from '../common/types'; export const decodeCommentRequest = (comment: CommentRequest) => { if (isCommentRequestTypeUser(comment)) { diff --git a/x-pack/plugins/cases/server/common/index.ts b/x-pack/plugins/cases/server/common/index.ts index 7a1e905c79a98..18bedd3ebeca8 100644 --- a/x-pack/plugins/cases/server/common/index.ts +++ b/x-pack/plugins/cases/server/common/index.ts @@ -5,11 +5,10 @@ * 2.0. */ -// TODO: https://github.com/elastic/kibana/issues/110896 -/* eslint-disable @kbn/eslint/no_export_all */ +// Careful of exporting anything from this file as any file(s) you export here will cause your functions to be exposed as public. +// If you're using functions/types/etc... internally or within integration tests it's best to import directly from their paths +// than expose the functions/types/etc... here. You should _only_ expose functions/types/etc... that need to be shared with other plugins here. -export * from './models'; -export * from './utils'; -export * from './types'; -export * from './error'; -export * from './constants'; +// When you do have to add things here you might want to consider creating a package such to share with other plugins instead as packages +// are easier to break down. +// See: https://docs.elastic.dev/kibana-dev-docs/key-concepts/platform-intro#public-plugin-api diff --git a/x-pack/plugins/cases/server/common/models/commentable_case.ts b/x-pack/plugins/cases/server/common/models/commentable_case.ts index 38c8aefa034e0..1c6d5ad61000a 100644 --- a/x-pack/plugins/cases/server/common/models/commentable_case.ts +++ b/x-pack/plugins/cases/server/common/models/commentable_case.ts @@ -36,11 +36,15 @@ import { MAX_DOCS_PER_PAGE, SUB_CASE_SAVED_OBJECT, } from '../../../common/constants'; -import { flattenCommentSavedObjects, flattenSubCaseSavedObject, transformNewComment } from '..'; import { AttachmentService, CasesService } from '../../services'; import { createCaseError } from '../error'; -import { countAlertsForID } from '../index'; -import { getOrUpdateLensReferences } from '../utils'; +import { + countAlertsForID, + flattenCommentSavedObjects, + flattenSubCaseSavedObject, + transformNewComment, + getOrUpdateLensReferences, +} from '../utils'; interface UpdateCommentResp { comment: SavedObjectsUpdateResponse; diff --git a/x-pack/plugins/cases/server/common/utils.ts b/x-pack/plugins/cases/server/common/utils.ts index 3e69c031e447d..c2ab01bfa5d3d 100644 --- a/x-pack/plugins/cases/server/common/utils.ts +++ b/x-pack/plugins/cases/server/common/utils.ts @@ -13,7 +13,7 @@ import { SavedObjectReference, } from 'kibana/server'; import { flatMap, uniqWith, isEmpty, xorWith } from 'lodash'; -import { AlertInfo } from '.'; +import { AlertInfo } from './types'; import { LensServerPluginSetup } from '../../../lens/server'; import { diff --git a/x-pack/plugins/cases/server/connectors/case/index.ts b/x-pack/plugins/cases/server/connectors/case/index.ts index 7c8cc9cc71273..f40a04349068e 100644 --- a/x-pack/plugins/cases/server/connectors/case/index.ts +++ b/x-pack/plugins/cases/server/connectors/case/index.ts @@ -25,7 +25,7 @@ import { import * as i18n from './translations'; import { GetActionTypeParams, isCommentGeneratedAlert, separator } from '..'; -import { createCaseError } from '../../common'; +import { createCaseError } from '../../common/error'; import { CasesClient } from '../../client'; const supportedSubActions: string[] = ['create', 'update', 'addComment']; diff --git a/x-pack/plugins/cases/server/routes/api/__fixtures__/authc_mock.ts b/x-pack/plugins/cases/server/routes/api/__fixtures__/authc_mock.ts index a9292229d5eea..3c6bec265e3ea 100644 --- a/x-pack/plugins/cases/server/routes/api/__fixtures__/authc_mock.ts +++ b/x-pack/plugins/cases/server/routes/api/__fixtures__/authc_mock.ts @@ -7,7 +7,7 @@ import { AuthenticatedUser } from '../../../../../security/server'; import { securityMock } from '../../../../../security/server/mocks'; -import { nullUser } from '../../../common'; +import { nullUser } from '../../../common/utils'; function createAuthenticationMock({ currentUser, diff --git a/x-pack/plugins/cases/server/routes/api/utils.ts b/x-pack/plugins/cases/server/routes/api/utils.ts index b2b5417ecae0f..f7a77a5dbf391 100644 --- a/x-pack/plugins/cases/server/routes/api/utils.ts +++ b/x-pack/plugins/cases/server/routes/api/utils.ts @@ -9,7 +9,7 @@ import { Boom, boomify, isBoom } from '@hapi/boom'; import { schema } from '@kbn/config-schema'; import { CustomHttpResponseOptions, ResponseError } from 'kibana/server'; -import { isCaseError } from '../../common'; +import { isCaseError } from '../../common/error'; /** * Transforms an error into the correct format for a kibana response. diff --git a/x-pack/plugins/cases/server/saved_object_types/import_export/export.ts b/x-pack/plugins/cases/server/saved_object_types/import_export/export.ts index b8916c125c42f..2a07d1ee978a0 100644 --- a/x-pack/plugins/cases/server/saved_object_types/import_export/export.ts +++ b/x-pack/plugins/cases/server/saved_object_types/import_export/export.ts @@ -20,7 +20,8 @@ import { MAX_DOCS_PER_PAGE, SAVED_OBJECT_TYPES, } from '../../../common/constants'; -import { createCaseError, defaultSortField } from '../../common'; +import { defaultSortField } from '../../common/utils'; +import { createCaseError } from '../../common/error'; import { ESCaseAttributes } from '../../services/cases/types'; export async function handleExport({ diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/cases.test.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/cases.test.ts index 9c2495cc7d6ad..7bfaec76adf21 100644 --- a/x-pack/plugins/cases/server/saved_object_types/migrations/cases.test.ts +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/cases.test.ts @@ -13,7 +13,7 @@ import { noneConnectorId, } from '../../../common/api'; import { CASE_SAVED_OBJECT } from '../../../common/constants'; -import { getNoneCaseConnector } from '../../common'; +import { getNoneCaseConnector } from '../../common/utils'; import { createExternalService, ESCaseConnectorWithId } from '../../services/test_utils'; import { caseConnectorIdMigration } from './cases'; diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/cases.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/cases.ts index b74e12e630ddc..bc85253270cb0 100644 --- a/x-pack/plugins/cases/server/saved_object_types/migrations/cases.ts +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/cases.ts @@ -18,7 +18,10 @@ import { transformConnectorIdToReference, transformPushConnectorIdToReference, } from '../../services/user_actions/transform'; -import { CONNECTOR_ID_REFERENCE_NAME, PUSH_CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { + CONNECTOR_ID_REFERENCE_NAME, + PUSH_CONNECTOR_ID_REFERENCE_NAME, +} from '../../common/constants'; interface UnsanitizedCaseConnector { connector_id: string; diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.test.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.test.ts index a05fe349412b1..7d9189673079d 100644 --- a/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.test.ts +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.test.ts @@ -9,7 +9,8 @@ import { SavedObjectSanitizedDoc } from 'kibana/server'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; import { ConnectorTypes } from '../../../common/api'; import { CASE_CONFIGURE_SAVED_OBJECT, SECURITY_SOLUTION_OWNER } from '../../../common/constants'; -import { getNoneCaseConnector, CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { CONNECTOR_ID_REFERENCE_NAME } from '../../common/constants'; +import { getNoneCaseConnector } from '../../common/utils'; import { ESCaseConnectorWithId } from '../../services/test_utils'; import { ESCasesConfigureAttributes } from '../../services/configure/types'; import { configureConnectorIdMigration } from './configuration'; diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.ts index b269948427025..6cd9b5455b978 100644 --- a/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.ts +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.ts @@ -14,7 +14,7 @@ import { import { ConnectorTypes } from '../../../common/api'; import { addOwnerToSO, SanitizedCaseOwner } from '.'; import { transformConnectorIdToReference } from '../../services/user_actions/transform'; -import { CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { CONNECTOR_ID_REFERENCE_NAME } from '../../common/constants'; interface UnsanitizedConfigureConnector { connector_id: string; diff --git a/x-pack/plugins/cases/server/services/alerts/index.ts b/x-pack/plugins/cases/server/services/alerts/index.ts index fd3ba50193d90..de7cb35590336 100644 --- a/x-pack/plugins/cases/server/services/alerts/index.ts +++ b/x-pack/plugins/cases/server/services/alerts/index.ts @@ -13,7 +13,8 @@ import type { PublicMethodsOf } from '@kbn/utility-types'; import { ElasticsearchClient, Logger } from 'kibana/server'; import { CaseStatuses } from '../../../common/api'; import { MAX_ALERTS_PER_SUB_CASE, MAX_CONCURRENT_SEARCHES } from '../../../common/constants'; -import { AlertInfo, createCaseError } from '../../common'; +import { createCaseError } from '../../common/error'; +import { AlertInfo } from '../../common/types'; import { UpdateAlertRequest } from '../../client/alerts/types'; import { ALERT_WORKFLOW_STATUS, diff --git a/x-pack/plugins/cases/server/services/cases/index.test.ts b/x-pack/plugins/cases/server/services/cases/index.test.ts index ce632ec0cf8a8..d813a9fc06a66 100644 --- a/x-pack/plugins/cases/server/services/cases/index.test.ts +++ b/x-pack/plugins/cases/server/services/cases/index.test.ts @@ -26,7 +26,8 @@ import { } from 'kibana/server'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; import { loggerMock } from '@kbn/logging/mocks'; -import { getNoneCaseConnector, CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { CONNECTOR_ID_REFERENCE_NAME } from '../../common/constants'; +import { getNoneCaseConnector } from '../../common/utils'; import { CasesService } from '.'; import { createESJiraConnector, diff --git a/x-pack/plugins/cases/server/services/cases/index.ts b/x-pack/plugins/cases/server/services/cases/index.ts index ae0f11a873777..7285761e6558a 100644 --- a/x-pack/plugins/cases/server/services/cases/index.ts +++ b/x-pack/plugins/cases/server/services/cases/index.ts @@ -47,13 +47,13 @@ import { User, CaseAttributes, } from '../../../common/api'; +import { SavedObjectFindOptionsKueryNode } from '../../common/types'; import { defaultSortField, flattenCaseSavedObject, flattenSubCaseSavedObject, groupTotalAlertsByID, - SavedObjectFindOptionsKueryNode, -} from '../../common'; +} from '../../common/utils'; import { defaultPage, defaultPerPage } from '../../routes/api'; import { ClientArgs } from '..'; import { combineFilters } from '../../client/utils'; diff --git a/x-pack/plugins/cases/server/services/cases/transform.test.ts b/x-pack/plugins/cases/server/services/cases/transform.test.ts index 7987823af18a0..b28f364dbd03f 100644 --- a/x-pack/plugins/cases/server/services/cases/transform.test.ts +++ b/x-pack/plugins/cases/server/services/cases/transform.test.ts @@ -19,10 +19,10 @@ import { import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; import { ConnectorTypes } from '../../../common/api'; import { - getNoneCaseConnector, CONNECTOR_ID_REFERENCE_NAME, PUSH_CONNECTOR_ID_REFERENCE_NAME, -} from '../../common'; +} from '../../common/constants'; +import { getNoneCaseConnector } from '../../common/utils'; describe('case transforms', () => { describe('transformUpdateResponseToExternalModel', () => { diff --git a/x-pack/plugins/cases/server/services/cases/transform.ts b/x-pack/plugins/cases/server/services/cases/transform.ts index cdb25a046895e..260847b326a86 100644 --- a/x-pack/plugins/cases/server/services/cases/transform.ts +++ b/x-pack/plugins/cases/server/services/cases/transform.ts @@ -17,7 +17,10 @@ import { } from 'kibana/server'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; import { ESCaseAttributes, ExternalServicesWithoutConnectorId } from './types'; -import { CONNECTOR_ID_REFERENCE_NAME, PUSH_CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { + CONNECTOR_ID_REFERENCE_NAME, + PUSH_CONNECTOR_ID_REFERENCE_NAME, +} from '../../common/constants'; import { CaseAttributes, CaseFullExternalService } from '../../../common/api'; import { findConnectorIdReference, diff --git a/x-pack/plugins/cases/server/services/configure/index.test.ts b/x-pack/plugins/cases/server/services/configure/index.test.ts index e14cdec1353ed..2b30e4d4de628 100644 --- a/x-pack/plugins/cases/server/services/configure/index.test.ts +++ b/x-pack/plugins/cases/server/services/configure/index.test.ts @@ -25,7 +25,8 @@ import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; import { loggerMock } from '@kbn/logging/mocks'; import { CaseConfigureService } from '.'; import { ESCasesConfigureAttributes } from './types'; -import { getNoneCaseConnector, CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { CONNECTOR_ID_REFERENCE_NAME } from '../../common/constants'; +import { getNoneCaseConnector } from '../../common/utils'; import { createESJiraConnector, createJiraConnector, ESCaseConnectorWithId } from '../test_utils'; const basicConfigFields = { diff --git a/x-pack/plugins/cases/server/services/configure/index.ts b/x-pack/plugins/cases/server/services/configure/index.ts index c438c72d9a775..0c22d95a5ee33 100644 --- a/x-pack/plugins/cases/server/services/configure/index.ts +++ b/x-pack/plugins/cases/server/services/configure/index.ts @@ -13,7 +13,8 @@ import { SavedObjectsUpdateResponse, } from 'kibana/server'; -import { SavedObjectFindOptionsKueryNode, CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { SavedObjectFindOptionsKueryNode } from '../../common/types'; +import { CONNECTOR_ID_REFERENCE_NAME } from '../../common/constants'; import { CasesConfigureAttributes, CasesConfigurePatch } from '../../../common/api'; import { CASE_CONFIGURE_SAVED_OBJECT } from '../../../common/constants'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; diff --git a/x-pack/plugins/cases/server/services/connector_mappings/index.ts b/x-pack/plugins/cases/server/services/connector_mappings/index.ts index 19760e73ad65a..46b9f4bac0064 100644 --- a/x-pack/plugins/cases/server/services/connector_mappings/index.ts +++ b/x-pack/plugins/cases/server/services/connector_mappings/index.ts @@ -9,7 +9,7 @@ import { Logger, SavedObjectReference, SavedObjectsClientContract } from 'kibana import { CASE_CONNECTOR_MAPPINGS_SAVED_OBJECT } from '../../../common/constants'; import { ConnectorMappings } from '../../../common/api'; -import { SavedObjectFindOptionsKueryNode } from '../../common'; +import { SavedObjectFindOptionsKueryNode } from '../../common/types'; interface ClientArgs { unsecuredSavedObjectsClient: SavedObjectsClientContract; diff --git a/x-pack/plugins/cases/server/services/test_utils.ts b/x-pack/plugins/cases/server/services/test_utils.ts index 8df217c793f34..c76ad0d83410b 100644 --- a/x-pack/plugins/cases/server/services/test_utils.ts +++ b/x-pack/plugins/cases/server/services/test_utils.ts @@ -7,7 +7,7 @@ import { SavedObject, SavedObjectReference, SavedObjectsFindResult } from 'kibana/server'; import { ESConnectorFields } from '.'; -import { CONNECTOR_ID_REFERENCE_NAME, PUSH_CONNECTOR_ID_REFERENCE_NAME } from '../common'; +import { CONNECTOR_ID_REFERENCE_NAME, PUSH_CONNECTOR_ID_REFERENCE_NAME } from '../common/constants'; import { CaseConnector, CaseFullExternalService, diff --git a/x-pack/plugins/cases/server/services/transform.ts b/x-pack/plugins/cases/server/services/transform.ts index 88511b75483f4..8956bfe42954e 100644 --- a/x-pack/plugins/cases/server/services/transform.ts +++ b/x-pack/plugins/cases/server/services/transform.ts @@ -8,7 +8,7 @@ import { SavedObjectReference } from 'kibana/server'; import { CaseConnector, ConnectorTypeFields } from '../../common/api'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../actions/server'; -import { getNoneCaseConnector } from '../common'; +import { getNoneCaseConnector } from '../common/utils'; import { ESCaseConnector, ESConnectorFields } from '.'; export function findConnectorIdReference( diff --git a/x-pack/plugins/cases/server/services/user_actions/helpers.ts b/x-pack/plugins/cases/server/services/user_actions/helpers.ts index 420df2d1016db..d99c1dbbb29e4 100644 --- a/x-pack/plugins/cases/server/services/user_actions/helpers.ts +++ b/x-pack/plugins/cases/server/services/user_actions/helpers.ts @@ -27,7 +27,7 @@ import { isTwoArraysDifference } from '../../client/utils'; import { UserActionItem } from '.'; import { extractConnectorId } from './transform'; import { UserActionFieldType } from './types'; -import { CASE_REF_NAME, COMMENT_REF_NAME, SUB_CASE_REF_NAME } from '../../common'; +import { CASE_REF_NAME, COMMENT_REF_NAME, SUB_CASE_REF_NAME } from '../../common/constants'; interface BuildCaseUserActionParams { action: UserAction; diff --git a/x-pack/plugins/cases/server/services/user_actions/index.ts b/x-pack/plugins/cases/server/services/user_actions/index.ts index 72a4486c87fea..507c36f866611 100644 --- a/x-pack/plugins/cases/server/services/user_actions/index.ts +++ b/x-pack/plugins/cases/server/services/user_actions/index.ts @@ -23,7 +23,7 @@ import { } from '../../../common/constants'; import { ClientArgs } from '..'; import { UserActionFieldType } from './types'; -import { CASE_REF_NAME, COMMENT_REF_NAME, SUB_CASE_REF_NAME } from '../../common'; +import { CASE_REF_NAME, COMMENT_REF_NAME, SUB_CASE_REF_NAME } from '../../common/constants'; import { ConnectorIdReferenceName, PushConnectorIdReferenceName } from './transform'; import { findConnectorIdReference } from '../transform'; diff --git a/x-pack/plugins/cases/server/services/user_actions/transform.test.ts b/x-pack/plugins/cases/server/services/user_actions/transform.test.ts index 82d491ad96c6e..a75d16c4764b6 100644 --- a/x-pack/plugins/cases/server/services/user_actions/transform.test.ts +++ b/x-pack/plugins/cases/server/services/user_actions/transform.test.ts @@ -8,11 +8,11 @@ import { noneConnectorId } from '../../../common/api'; import { CONNECTOR_ID_REFERENCE_NAME, - getNoneCaseConnector, PUSH_CONNECTOR_ID_REFERENCE_NAME, USER_ACTION_OLD_ID_REF_NAME, USER_ACTION_OLD_PUSH_ID_REF_NAME, -} from '../../common'; +} from '../../common/constants'; +import { getNoneCaseConnector } from '../../common/utils'; import { createConnectorObject, createExternalService, createJiraConnector } from '../test_utils'; import { extractConnectorIdHelper, diff --git a/x-pack/plugins/cases/server/services/user_actions/transform.ts b/x-pack/plugins/cases/server/services/user_actions/transform.ts index a453fec2c9e19..a3ec8a2c115b6 100644 --- a/x-pack/plugins/cases/server/services/user_actions/transform.ts +++ b/x-pack/plugins/cases/server/services/user_actions/transform.ts @@ -21,11 +21,11 @@ import { } from '../../../common/api'; import { CONNECTOR_ID_REFERENCE_NAME, - getNoneCaseConnector, PUSH_CONNECTOR_ID_REFERENCE_NAME, USER_ACTION_OLD_ID_REF_NAME, USER_ACTION_OLD_PUSH_ID_REF_NAME, -} from '../../common'; +} from '../../common/constants'; +import { getNoneCaseConnector } from '../../common/utils'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; import { UserActionFieldType } from './types';