[Cases] enforce type imports for entire cases folder (#143399)

ESLint's --fix did the heavy lifting here
This commit is contained in:
Lion Ralfs 2022-10-17 11:07:46 +02:00 committed by GitHub
parent e962e0ebec
commit e8f88cbcd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
250 changed files with 746 additions and 748 deletions

View file

@ -1113,7 +1113,7 @@ module.exports = {
{
files: [
'x-pack/plugins/security_solution/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/cases/public/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/cases/**/*.{js,mjs,ts,tsx}',
],
rules: {
'@typescript-eslint/consistent-type-imports': 'error',

View file

@ -7,7 +7,8 @@
import * as rt from 'io-ts';
import { CaseAssigneesRt } from '../assignee';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
export const AssigneesUserActionPayloadRt = rt.type({ assignees: CaseAssigneesRt });

View file

@ -7,7 +7,8 @@
import * as rt from 'io-ts';
import { CommentRequestRt } from '../comment';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
export const CommentUserActionPayloadRt = rt.type({ comment: CommentRequestRt });

View file

@ -7,7 +7,8 @@
import * as rt from 'io-ts';
import { CaseUserActionConnectorRt, CaseConnectorRt } from '../../connectors';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
export const ConnectorUserActionPayloadWithoutConnectorIdRt = rt.type({
connector: CaseUserActionConnectorRt,

View file

@ -7,7 +7,8 @@
import * as rt from 'io-ts';
import { AssigneesUserActionPayloadRt } from './assignees';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
import {
ConnectorUserActionPayloadRt,
ConnectorUserActionPayloadWithoutConnectorIdRt,

View file

@ -6,7 +6,8 @@
*/
import * as rt from 'io-ts';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
export const DeleteCaseUserActionRt = rt.type({
type: rt.literal(ActionTypes.delete_case),

View file

@ -6,7 +6,8 @@
*/
import * as rt from 'io-ts';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
export const DescriptionUserActionPayloadRt = rt.type({ description: rt.string });

View file

@ -7,12 +7,8 @@
import * as rt from 'io-ts';
import {
ActionsRt,
UserActionCommonAttributesRt,
CaseUserActionSavedObjectIdsRt,
ActionTypesRt,
} from './common';
import type { ActionsRt, ActionTypesRt } from './common';
import { UserActionCommonAttributesRt, CaseUserActionSavedObjectIdsRt } from './common';
import { CreateCaseUserActionRt } from './create_case';
import { DescriptionUserActionRt } from './description';
import { CommentUserActionRt } from './comment';

View file

@ -7,7 +7,8 @@
import * as rt from 'io-ts';
import { CaseUserActionExternalServiceRt, CaseExternalServiceBasicRt } from '../case';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
export const PushedUserActionPayloadWithoutConnectorIdRt = rt.type({
externalService: CaseUserActionExternalServiceRt,

View file

@ -6,7 +6,8 @@
*/
import * as rt from 'io-ts';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
import { SettingsRt } from '../case';
export const SettingsUserActionPayloadRt = rt.type({ settings: SettingsRt });

View file

@ -7,7 +7,8 @@
import * as rt from 'io-ts';
import { CaseSeverityRt } from '../case';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
export const SeverityUserActionPayloadRt = rt.type({ severity: CaseSeverityRt });

View file

@ -7,7 +7,8 @@
import * as rt from 'io-ts';
import { CaseStatusRt } from '../status';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
export const StatusUserActionPayloadRt = rt.type({ status: CaseStatusRt });

View file

@ -6,7 +6,8 @@
*/
import * as rt from 'io-ts';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
export const TagsUserActionPayloadRt = rt.type({ tags: rt.array(rt.string) });

View file

@ -6,7 +6,8 @@
*/
import * as rt from 'io-ts';
import { ActionTypes, UserActionWithAttributes } from './common';
import type { UserActionWithAttributes } from './common';
import { ActionTypes } from './common';
export const TitleUserActionPayloadRt = rt.type({ title: rt.string });

View file

@ -10,7 +10,7 @@ import { either, fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import { pipe } from 'fp-ts/lib/pipeable';
import { JsonArray, JsonObject, JsonValue } from '@kbn/utility-types';
import type { JsonArray, JsonObject, JsonValue } from '@kbn/utility-types';
import { formatErrors } from '@kbn/securitysolution-io-ts-utils';
type ErrorFactory = (message: string) => Error;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { CASE_VIEW_PAGE_TABS } from './types';
import { CasesFeaturesAllRequired } from './ui/types';
import type { CasesFeaturesAllRequired } from './ui/types';
export const DEFAULT_DATE_FORMAT = 'dateFormat' as const;
export const DEFAULT_DATE_FORMAT_TZ = 'dateFormat:tz' as const;

View file

@ -6,13 +6,13 @@
*/
import type { ResolvedSimpleSavedObject } from '@kbn/core/public';
import {
import type {
CREATE_CASES_CAPABILITY,
DELETE_CASES_CAPABILITY,
READ_CASES_CAPABILITY,
UPDATE_CASES_CAPABILITY,
} from '..';
import {
import type {
CasePatchRequest,
CaseStatuses,
User,
@ -30,8 +30,8 @@ import {
CommentResponseExternalReferenceType,
CommentResponseTypePersistableState,
} from '../api';
import { PUSH_CASES_CAPABILITY } from '../constants';
import { SnakeToCamelCase } from '../types';
import type { PUSH_CASES_CAPABILITY } from '../constants';
import type { SnakeToCamelCase } from '../types';
type DeepRequired<T> = { [K in keyof T]: DeepRequired<T[K]> } & Required<T>;

View file

@ -5,12 +5,12 @@
* 2.0.
*/
import {
import type {
CommentRequest,
CommentRequestExternalReferenceType,
CommentType,
CommentRequestPersistableStateType,
} from '../api';
import { CommentType } from '../api';
/**
* A type narrowing function for external reference attachments.

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { Plugin } from 'unified';
import { RemarkTokenizer } from '@elastic/eui';
import type { Plugin } from 'unified';
import type { RemarkTokenizer } from '@elastic/eui';
import { LENS_ID } from './constants';
export const LensParser: Plugin = function () {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { Plugin } from 'unified';
import type { Plugin } from 'unified';
import type { TimeRange } from '@kbn/es-query';
import { LENS_ID } from './constants';

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { Plugin } from 'unified';
import { RemarkTokenizer } from '@elastic/eui';
import type { Plugin } from 'unified';
import type { RemarkTokenizer } from '@elastic/eui';
import * as i18n from './translations';
export const ID = 'timeline';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { Plugin } from 'unified';
import type { Plugin } from 'unified';
export interface TimelineSerializerProps {
match: string;
}

View file

@ -11,7 +11,7 @@ import markdown from 'remark-parse';
import remarkStringify from 'remark-stringify';
import unified from 'unified';
import { SerializableRecord } from '@kbn/utility-types';
import type { SerializableRecord } from '@kbn/utility-types';
import type { TimeRange } from '@kbn/es-query';
import { LENS_ID, LensParser, LensSerializer } from './lens';
import { TimelineSerializer, TimelineParser } from './timeline';

View file

@ -5,8 +5,7 @@
* 2.0.
*/
import {
ActionTypes,
import type {
CommentUserAction,
ConnectorUserAction,
CreateCaseUserAction,
@ -17,7 +16,8 @@ import {
TitleUserAction,
UserActionTypes,
} from '../api';
import { SnakeToCamelCase } from '../types';
import { ActionTypes } from '../api';
import type { SnakeToCamelCase } from '../types';
type SnakeCaseOrCamelCaseUserAction<
T extends 'snakeCase' | 'camelCase',

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { CaseAssignees } from '../api';
import type { CaseAssignees } from '../api';
import { MAX_ASSIGNEES_PER_CASE } from '../constants';
export const isInvalidTag = (value: string) => value.trim() === '';

View file

@ -6,7 +6,7 @@
*/
import { AttachmentTypeRegistry } from '../../common/registry';
import { ExternalReferenceAttachmentType } from './types';
import type { ExternalReferenceAttachmentType } from './types';
export class ExternalReferenceAttachmentTypeRegistry extends AttachmentTypeRegistry<ExternalReferenceAttachmentType> {
constructor() {

View file

@ -7,15 +7,15 @@
import { omit } from 'lodash';
import { CommentType, SECURITY_SOLUTION_OWNER } from '../../common';
import {
import type {
AttributesTypeExternalReferenceNoSO,
AttributesTypeExternalReferenceSO,
AttributesTypePersistableState,
CommentRequestPersistableStateType,
ExternalReferenceStorageType,
} from '../../common/api';
import { ExternalReferenceStorageType } from '../../common/api';
import { PersistableStateAttachmentTypeRegistry } from './persistable_state_registry';
import { PersistableStateAttachmentTypeSetup, PersistableStateAttachmentState } from './types';
import type { PersistableStateAttachmentTypeSetup, PersistableStateAttachmentState } from './types';
export const getPersistableAttachment = (): PersistableStateAttachmentTypeSetup => ({
id: '.test',

View file

@ -7,7 +7,7 @@
import { identity } from 'lodash';
import { AttachmentTypeRegistry } from '../../common/registry';
import { PersistableStateAttachmentType, PersistableStateAttachmentTypeSetup } from './types';
import type { PersistableStateAttachmentType, PersistableStateAttachmentTypeSetup } from './types';
export class PersistableStateAttachmentTypeRegistry extends AttachmentTypeRegistry<PersistableStateAttachmentType> {
constructor() {

View file

@ -5,10 +5,10 @@
* 2.0.
*/
import { SavedObjectReference } from '@kbn/core/types';
import type { SavedObjectReference } from '@kbn/core/types';
import { isCommentRequestTypePersistableState } from '../../common/utils/attachments';
import { CommentRequest, CommentRequestPersistableStateType } from '../../common/api';
import { PersistableStateAttachmentTypeRegistry } from './persistable_state_registry';
import type { CommentRequest, CommentRequestPersistableStateType } from '../../common/api';
import type { PersistableStateAttachmentTypeRegistry } from './persistable_state_registry';
interface SavedObjectAttributesAndReferences {
state: CommentRequestPersistableStateType;

View file

@ -6,7 +6,7 @@
*/
import type { PersistableState, PersistableStateDefinition } from '@kbn/kibana-utils-plugin/common';
import { CommentRequestPersistableStateType } from '../../common/api';
import type { CommentRequestPersistableStateType } from '../../common/api';
export type PersistableStateAttachmentState = Pick<
CommentRequestPersistableStateType,

View file

@ -8,7 +8,7 @@
import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks';
import { Operations } from '.';
import { AuthorizationAuditLogger } from './audit_logger';
import { ReadOperations } from './types';
import type { ReadOperations } from './types';
describe('audit_logger', () => {
it('creates a failure message without any owners', () => {

View file

@ -5,10 +5,11 @@
* 2.0.
*/
import { EcsEventOutcome } from '@kbn/core/server';
import { AuditEvent, AuditLogger } from '@kbn/security-plugin/server';
import { DATABASE_CATEGORY, ECS_OUTCOMES, isWriteOperation, OperationDetails } from '.';
import { OwnerEntity } from './types';
import type { EcsEventOutcome } from '@kbn/core/server';
import type { AuditEvent, AuditLogger } from '@kbn/security-plugin/server';
import type { OperationDetails } from '.';
import { DATABASE_CATEGORY, ECS_OUTCOMES, isWriteOperation } from '.';
import type { OwnerEntity } from './types';
interface CreateAuditMsgParams {
operation: OperationDetails;

View file

@ -9,14 +9,14 @@ import { securityMock } from '@kbn/security-plugin/server/mocks';
import { httpServerMock, loggingSystemMock } from '@kbn/core/server/mocks';
import { featuresPluginMock } from '@kbn/features-plugin/server/mocks';
import { Authorization, Operations } from '.';
import { Space, SpacesPluginStart } from '@kbn/spaces-plugin/server';
import type { Space, SpacesPluginStart } from '@kbn/spaces-plugin/server';
import { spacesMock } from '@kbn/spaces-plugin/server/mocks';
import { AuthorizationAuditLogger } from './audit_logger';
import { KibanaRequest } from '@kbn/core/server';
import { KibanaFeature } from '@kbn/features-plugin/common';
import { AuditLogger, SecurityPluginStart } from '@kbn/security-plugin/server';
import type { KibanaRequest } from '@kbn/core/server';
import type { KibanaFeature } from '@kbn/features-plugin/common';
import type { AuditLogger, SecurityPluginStart } from '@kbn/security-plugin/server';
import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks';
import { PluginStartContract as FeaturesPluginStart } from '@kbn/features-plugin/server';
import type { PluginStartContract as FeaturesPluginStart } from '@kbn/features-plugin/server';
const createSpacesDisabledFeaturesMock = (disabledFeatures: string[] = []) => {
const spacesStart: jest.Mocked<SpacesPluginStart> = spacesMock.createStart();

View file

@ -5,14 +5,15 @@
* 2.0.
*/
import { KibanaRequest, Logger } from '@kbn/core/server';
import type { KibanaRequest, Logger } from '@kbn/core/server';
import Boom from '@hapi/boom';
import { SecurityPluginStart } from '@kbn/security-plugin/server';
import { PluginStartContract as FeaturesPluginStart } from '@kbn/features-plugin/server';
import { Space, SpacesPluginStart } from '@kbn/spaces-plugin/server';
import { AuthFilterHelpers, OwnerEntity } from './types';
import type { SecurityPluginStart } from '@kbn/security-plugin/server';
import type { PluginStartContract as FeaturesPluginStart } from '@kbn/features-plugin/server';
import type { Space, SpacesPluginStart } from '@kbn/spaces-plugin/server';
import type { AuthFilterHelpers, OwnerEntity } from './types';
import { getOwnersFilter } from './utils';
import { AuthorizationAuditLogger, OperationDetails } from '.';
import type { OperationDetails } from '.';
import { AuthorizationAuditLogger } from '.';
import { createCaseError } from '../common/error';
/**

View file

@ -6,7 +6,7 @@
*/
import { isWriteOperation, Operations } from '.';
import { OperationDetails } from './types';
import type { OperationDetails } from './types';
describe('index tests', () => {
it('should identify a write operation', () => {

View file

@ -5,15 +5,16 @@
* 2.0.
*/
import { EcsEventCategory, EcsEventOutcome, EcsEventType } from '@kbn/core/server';
import { CasesSupportedOperations } from '@kbn/security-plugin/server';
import type { EcsEventCategory, EcsEventOutcome, EcsEventType } from '@kbn/core/server';
import type { CasesSupportedOperations } from '@kbn/security-plugin/server';
import {
CASE_COMMENT_SAVED_OBJECT,
CASE_CONFIGURE_SAVED_OBJECT,
CASE_SAVED_OBJECT,
CASE_USER_ACTION_SAVED_OBJECT,
} from '../../common/constants';
import { Verbs, ReadOperations, WriteOperations, OperationDetails } from './types';
import type { Verbs, OperationDetails } from './types';
import { ReadOperations, WriteOperations } from './types';
export * from './authorization';
export * from './audit_logger';

View file

@ -6,7 +6,7 @@
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
import { Authorization } from './authorization';
import type { Authorization } from './authorization';
type Schema = PublicMethodsOf<Authorization>;
export type AuthorizationMock = jest.Mocked<Schema>;

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { EcsEventType } from '@kbn/core/server';
import type { EcsEventType } from '@kbn/core/server';
import type { KueryNode } from '@kbn/es-query';
import { CasesSupportedOperations } from '@kbn/security-plugin/server';
import type { CasesSupportedOperations } from '@kbn/security-plugin/server';
/**
* The tenses for describing the action performed by a API route

View file

@ -6,7 +6,8 @@
*/
import { remove, uniq } from 'lodash';
import { nodeBuilder, KueryNode } from '@kbn/es-query';
import type { KueryNode } from '@kbn/es-query';
import { nodeBuilder } from '@kbn/es-query';
import { OWNER_FIELD } from '../../common/api';
export const getOwnersFilter = (

View file

@ -7,7 +7,7 @@
import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mocks';
import { AlertService } from '../../services';
import { CasesClientArgs } from '../types';
import type { CasesClientArgs } from '../types';
import { getAlerts } from './get';
describe('getAlerts', () => {

View file

@ -5,11 +5,11 @@
* 2.0.
*/
import { MgetResponseItem, GetGetResult } from '@elastic/elasticsearch/lib/api/types';
import { CasesClientGetAlertsResponse } from './types';
import { CasesClientArgs } from '..';
import { AlertInfo } from '../../common/types';
import { Alert } from '../../services/alerts';
import type { MgetResponseItem, GetGetResult } from '@elastic/elasticsearch/lib/api/types';
import type { CasesClientGetAlertsResponse } from './types';
import type { CasesClientArgs } from '..';
import type { AlertInfo } from '../../common/types';
import type { Alert } from '../../services/alerts';
function isAlert(
doc?: MgetResponseItem<unknown>

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { CaseStatuses } from '../../../common/api';
import { AlertInfo } from '../../common/types';
import type { CaseStatuses } from '../../../common/api';
import type { AlertInfo } from '../../common/types';
interface Alert {
id: string;

View file

@ -16,11 +16,12 @@ import {
isCommentRequestTypeExternalReference,
isCommentRequestTypePersistableState,
} from '../../../common/utils/attachments';
import { CaseResponse, CommentRequest, CommentRequestRt, throwErrors } from '../../../common/api';
import type { CaseResponse, CommentRequest } from '../../../common/api';
import { CommentRequestRt, throwErrors } from '../../../common/api';
import { CaseCommentModel } from '../../common/models';
import { createCaseError } from '../../common/error';
import { CasesClientArgs } from '..';
import type { CasesClientArgs } from '..';
import { decodeCommentRequest } from '../utils';
import { Operations } from '../../authorization';

View file

@ -12,20 +12,16 @@ import { identity } from 'fp-ts/lib/function';
import { SavedObjectsUtils } from '@kbn/core/server';
import {
BulkCreateCommentRequest,
BulkCreateCommentRequestRt,
CaseResponse,
CommentRequest,
throwErrors,
} from '../../../common/api';
import type { BulkCreateCommentRequest, CaseResponse, CommentRequest } from '../../../common/api';
import { BulkCreateCommentRequestRt, throwErrors } from '../../../common/api';
import { CaseCommentModel } from '../../common/models';
import { createCaseError } from '../../common/error';
import { CasesClientArgs } from '..';
import type { CasesClientArgs } from '..';
import { decodeCommentRequest } from '../utils';
import { Operations, OwnerEntity } from '../../authorization';
import type { OwnerEntity } from '../../authorization';
import { Operations } from '../../authorization';
export interface BulkCreateArgs {
caseId: string;

View file

@ -5,26 +5,22 @@
* 2.0.
*/
import { AlertResponse, CommentResponse } from '../../../common/api';
import { CasesClient } from '../client';
import type { AlertResponse, CommentResponse } from '../../../common/api';
import type { CasesClient } from '../client';
import { CasesClientInternal } from '../client_internal';
import { IAllCommentsResponse, ICaseResponse, ICommentsResponse } from '../typedoc_interfaces';
import { CasesClientArgs } from '../types';
import { AddArgs, addComment } from './add';
import { bulkCreate, BulkCreateArgs } from './bulk_create';
import { DeleteAllArgs, deleteAll, DeleteArgs, deleteComment } from './delete';
import {
find,
FindArgs,
get,
getAll,
getAllAlertsAttachToCase,
GetAllAlertsAttachToCase,
GetAllArgs,
GetArgs,
} from './get';
import { update, UpdateArgs } from './update';
import type { CasesClientInternal } from '../client_internal';
import type { IAllCommentsResponse, ICaseResponse, ICommentsResponse } from '../typedoc_interfaces';
import type { CasesClientArgs } from '../types';
import type { AddArgs } from './add';
import { addComment } from './add';
import type { BulkCreateArgs } from './bulk_create';
import { bulkCreate } from './bulk_create';
import type { DeleteAllArgs, DeleteArgs } from './delete';
import { deleteAll, deleteComment } from './delete';
import type { FindArgs, GetAllAlertsAttachToCase, GetAllArgs, GetArgs } from './get';
import { find, get, getAll, getAllAlertsAttachToCase } from './get';
import type { UpdateArgs } from './update';
import { update } from './update';
/**
* API for interacting with the attachments to a case.

View file

@ -8,10 +8,11 @@
import Boom from '@hapi/boom';
import pMap from 'p-map';
import { SavedObject } from '@kbn/core/server';
import { Actions, ActionTypes, CommentAttributes } from '../../../common/api';
import type { SavedObject } from '@kbn/core/server';
import type { CommentAttributes } from '../../../common/api';
import { Actions, ActionTypes } from '../../../common/api';
import { CASE_SAVED_OBJECT, MAX_CONCURRENT_SEARCHES } from '../../../common/constants';
import { CasesClientArgs } from '../types';
import type { CasesClientArgs } from '../types';
import { createCaseError } from '../../common/error';
import { Operations } from '../../authorization';

View file

@ -4,19 +4,17 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { SavedObject } from '@kbn/core/server';
import type { SavedObject } from '@kbn/core/server';
import {
import type {
AlertResponse,
AllCommentsResponse,
AllCommentsResponseRt,
AttributesTypeAlerts,
CommentResponse,
CommentResponseRt,
CommentsResponse,
CommentsResponseRt,
FindQueryParams,
} from '../../../common/api';
import { AllCommentsResponseRt, CommentResponseRt, CommentsResponseRt } from '../../../common/api';
import {
defaultSortField,
transformComments,
@ -26,11 +24,11 @@ import {
} from '../../common/utils';
import { createCaseError } from '../../common/error';
import { DEFAULT_PAGE, DEFAULT_PER_PAGE } from '../../routes/api';
import { CasesClientArgs } from '../types';
import type { CasesClientArgs } from '../types';
import { combineFilters, stringToKueryNode } from '../utils';
import { Operations } from '../../authorization';
import { includeFieldsRequiredForAuthentication } from '../../authorization/utils';
import { CasesClient } from '../client';
import type { CasesClient } from '../client';
/**
* Parameters for finding attachments of a case

View file

@ -10,9 +10,9 @@ import Boom from '@hapi/boom';
import { CaseCommentModel } from '../../common/models';
import { createCaseError } from '../../common/error';
import { isCommentRequestTypeExternalReference } from '../../../common/utils/attachments';
import { CaseResponse, CommentPatchRequest } from '../../../common/api';
import type { CaseResponse, CommentPatchRequest } from '../../../common/api';
import { CASE_SAVED_OBJECT } from '../../../common/constants';
import { CasesClientArgs } from '..';
import type { CasesClientArgs } from '..';
import { decodeCommentRequest } from '../utils';
import { Operations } from '../../authorization';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import {
import type {
CasePostRequest,
CasesPatchRequest,
CasesFindRequest,
@ -14,9 +14,9 @@ import {
AllReportersFindRequest,
CasesByAlertId,
} from '../../../common/api';
import { CasesClient } from '../client';
import { CasesClientInternal } from '../client_internal';
import {
import type { CasesClient } from '../client';
import type { CasesClientInternal } from '../client_internal';
import type {
ICasePostRequest,
ICaseResolveResponse,
ICaseResponse,
@ -25,20 +25,14 @@ import {
ICasesPatchRequest,
ICasesResponse,
} from '../typedoc_interfaces';
import { CasesClientArgs } from '../types';
import type { CasesClientArgs } from '../types';
import { create } from './create';
import { deleteCases } from './delete';
import { find } from './find';
import {
CasesByAlertIDParams,
get,
resolve,
getCasesByAlertID,
GetParams,
getReporters,
getTags,
} from './get';
import { push, PushParams } from './push';
import type { CasesByAlertIDParams, GetParams } from './get';
import { get, resolve, getCasesByAlertID, getReporters, getTags } from './get';
import type { PushParams } from './push';
import { push } from './push';
import { update } from './update';
/**

View file

@ -12,11 +12,10 @@ import { identity } from 'fp-ts/lib/function';
import { SavedObjectsUtils } from '@kbn/core/server';
import type { CaseResponse, CasePostRequest } from '../../../common/api';
import {
throwErrors,
CaseResponseRt,
CaseResponse,
CasePostRequest,
ActionTypes,
CasePostRequestRt,
excess,
@ -28,7 +27,7 @@ import { isInvalidTag, areTotalAssigneesInvalid } from '../../../common/utils/va
import { Operations } from '../../authorization';
import { createCaseError } from '../../common/error';
import { flattenCaseSavedObject, transformNewCase } from '../../common/utils';
import { CasesClientArgs } from '..';
import type { CasesClientArgs } from '..';
import { LICENSING_CASE_ASSIGNMENT_FEATURE } from '../../common/constants';
/**

View file

@ -7,12 +7,13 @@
import pMap from 'p-map';
import { Boom } from '@hapi/boom';
import { SavedObjectsFindResponse } from '@kbn/core/server';
import { CommentAttributes } from '../../../common/api';
import type { SavedObjectsFindResponse } from '@kbn/core/server';
import type { CommentAttributes } from '../../../common/api';
import { MAX_CONCURRENT_SEARCHES } from '../../../common/constants';
import { CasesClientArgs } from '..';
import type { CasesClientArgs } from '..';
import { createCaseError } from '../../common/error';
import { Operations, OwnerEntity } from '../../authorization';
import type { OwnerEntity } from '../../authorization';
import { Operations } from '../../authorization';
/**
* Deletes the specified cases and their attachments.

View file

@ -11,22 +11,16 @@ import { pipe } from 'fp-ts/lib/pipeable';
import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import {
CasesFindResponse,
CasesFindRequest,
CasesFindRequestRt,
throwErrors,
CasesFindResponseRt,
excess,
} from '../../../common/api';
import type { CasesFindResponse, CasesFindRequest } from '../../../common/api';
import { CasesFindRequestRt, throwErrors, CasesFindResponseRt, excess } from '../../../common/api';
import { createCaseError } from '../../common/error';
import { asArray, transformCases } from '../../common/utils';
import { constructQueryOptions } from '../utils';
import { includeFieldsRequiredForAuthentication } from '../../authorization/utils';
import { Operations } from '../../authorization';
import { CasesClientArgs } from '..';
import { ConstructQueryParams } from '../types';
import type { CasesClientArgs } from '..';
import type { ConstructQueryParams } from '../types';
import { LICENSING_CASE_ASSIGNMENT_FEATURE } from '../../common/constants';
/**

View file

@ -9,28 +9,30 @@ import { pipe } from 'fp-ts/lib/pipeable';
import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import { SavedObject, SavedObjectsResolveResponse } from '@kbn/core/server';
import {
CaseResponseRt,
import type { SavedObject, SavedObjectsResolveResponse } from '@kbn/core/server';
import type {
CaseResponse,
CaseResolveResponseRt,
CaseResolveResponse,
User,
AllTagsFindRequest,
AllReportersFindRequest,
CasesByAlertIDRequest,
CasesByAlertId,
CaseAttributes,
} from '../../../common/api';
import {
CaseResponseRt,
CaseResolveResponseRt,
AllTagsFindRequestRt,
excess,
throwErrors,
AllReportersFindRequestRt,
AllReportersFindRequest,
CasesByAlertIDRequest,
CasesByAlertIDRequestRt,
CasesByAlertId,
CasesByAlertIdRt,
CaseAttributes,
} from '../../../common/api';
import { createCaseError } from '../../common/error';
import { countAlertsForID, flattenCaseSavedObject } from '../../common/utils';
import { CasesClientArgs } from '..';
import type { CasesClientArgs } from '..';
import { Operations } from '../../authorization';
import { combineAuthorizedAndOwnerFilter } from '../utils';
import { CasesService } from '../../services';

View file

@ -5,14 +5,16 @@
* 2.0.
*/
import {
import type {
CommentResponse,
CommentType,
CaseUserActionsResponse,
CommentResponseAlertsType,
ConnectorMappingsAttributes,
} from '../../../common/api';
import {
CommentType,
ConnectorTypes,
Actions,
ConnectorMappingsAttributes,
ExternalReferenceStorageType,
} from '../../../common/api';
import { SECURITY_SOLUTION_OWNER } from '../../../common/constants';

View file

@ -7,22 +7,24 @@
import Boom from '@hapi/boom';
import { nodeBuilder } from '@kbn/es-query';
import { SavedObjectsFindResponse } from '@kbn/core/server';
import type { SavedObjectsFindResponse } from '@kbn/core/server';
import { UserProfile } from '@kbn/security-plugin/common';
import { SecurityPluginStart } from '@kbn/security-plugin/server';
import {
import type { UserProfile } from '@kbn/security-plugin/common';
import type { SecurityPluginStart } from '@kbn/security-plugin/server';
import type {
ActionConnector,
CaseResponseRt,
CaseResponse,
CaseStatuses,
ExternalServiceResponse,
CasesConfigureAttributes,
CommentRequestAlertType,
CommentAttributes,
} from '../../../common/api';
import {
CaseResponseRt,
CaseStatuses,
ActionTypes,
OWNER_FIELD,
CommentType,
CommentRequestAlertType,
CommentAttributes,
} from '../../../common/api';
import { CASE_COMMENT_SAVED_OBJECT } from '../../../common/constants';
@ -33,12 +35,12 @@ import {
flattenCaseSavedObject,
getAlertInfoFromComments,
} from '../../common/utils';
import { CasesClient, CasesClientArgs, CasesClientInternal } from '..';
import type { CasesClient, CasesClientArgs, CasesClientInternal } from '..';
import { Operations } from '../../authorization';
import { casesConnectors } from '../../connectors';
import { getAlerts } from '../alerts/get';
import { buildFilter } from '../utils';
import { ICaseResponse } from '../typedoc_interfaces';
import type { ICaseResponse } from '../typedoc_interfaces';
/**
* Returns true if the case should be closed based on the configuration settings.

View file

@ -10,24 +10,30 @@ import { pipe } from 'fp-ts/lib/pipeable';
import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import { SavedObject, SavedObjectsFindResponse, SavedObjectsFindResult } from '@kbn/core/server';
import type {
SavedObject,
SavedObjectsFindResponse,
SavedObjectsFindResult,
} from '@kbn/core/server';
import { nodeBuilder } from '@kbn/es-query';
import { areTotalAssigneesInvalid } from '../../../common/utils/validators';
import {
import type {
CasePatchRequest,
CasesPatchRequest,
CasesPatchRequestRt,
CasesResponse,
CommentAttributes,
CaseAttributes,
User,
} from '../../../common/api';
import {
CasesPatchRequestRt,
CasesResponseRt,
CaseStatuses,
CommentAttributes,
CommentType,
excess,
throwErrors,
CaseAttributes,
User,
} from '../../../common/api';
import {
CASE_COMMENT_SAVED_OBJECT,
@ -38,19 +44,20 @@ import {
import { getCaseToUpdate } from '../utils';
import { AlertService, CasesService } from '../../services';
import type { AlertService, CasesService } from '../../services';
import { createCaseError } from '../../common/error';
import {
createAlertUpdateRequest,
flattenCaseSavedObject,
isCommentRequestTypeAlert,
} from '../../common/utils';
import { UpdateAlertRequest } from '../alerts/types';
import { CasesClientArgs } from '..';
import { Operations, OwnerEntity } from '../../authorization';
import type { UpdateAlertRequest } from '../alerts/types';
import type { CasesClientArgs } from '..';
import type { OwnerEntity } from '../../authorization';
import { Operations } from '../../authorization';
import { dedupAssignees, getClosedInfoForUpdate, getDurationForUpdate } from './utils';
import { LICENSING_CASE_ASSIGNMENT_FEATURE } from '../../common/constants';
import { LicensingService } from '../../services/licensing';
import type { LicensingService } from '../../services/licensing';
/**
* Throws an error if any of the requests attempt to update the owner of a case.

View file

@ -6,19 +6,16 @@
*/
import { uniqBy, isEmpty } from 'lodash';
import { UserProfile } from '@kbn/security-plugin/common';
import { IBasePath } from '@kbn/core-http-browser';
import type { UserProfile } from '@kbn/security-plugin/common';
import type { IBasePath } from '@kbn/core-http-browser';
import { CASE_VIEW_PAGE_TABS } from '../../../common/types';
import { isPushedUserAction } from '../../../common/utils/user_actions';
import {
import type {
ActionConnector,
CaseFullExternalService,
CaseResponse,
CaseUserActionsResponse,
CommentResponse,
CommentType,
ActionTypes,
CaseStatuses,
User,
CaseAttributes,
CaseAssignees,
@ -26,10 +23,11 @@ import {
CaseField,
ThirdPartyField,
} from '../../../common/api';
import { CasesClientGetAlertsResponse } from '../alerts/types';
import { ExternalServiceComment, ExternalServiceIncident } from './types';
import { CommentType, ActionTypes, CaseStatuses } from '../../../common/api';
import type { CasesClientGetAlertsResponse } from '../alerts/types';
import type { ExternalServiceComment, ExternalServiceIncident } from './types';
import { getAlertIds } from '../utils';
import { CasesConnectorsMap } from '../../connectors';
import type { CasesConnectorsMap } from '../../connectors';
import { getCaseViewPath } from '../../common/utils';
import * as i18n from './translations';

View file

@ -5,13 +5,19 @@
* 2.0.
*/
import { CasesClientArgs } from './types';
import { CasesSubClient, createCasesSubClient } from './cases/client';
import { AttachmentsSubClient, createAttachmentsSubClient } from './attachments/client';
import { UserActionsSubClient, createUserActionsSubClient } from './user_actions/client';
import { CasesClientInternal, createCasesClientInternal } from './client_internal';
import { ConfigureSubClient, createConfigurationSubClient } from './configure/client';
import { createMetricsSubClient, MetricsSubClient } from './metrics/client';
import type { CasesClientArgs } from './types';
import type { CasesSubClient } from './cases/client';
import { createCasesSubClient } from './cases/client';
import type { AttachmentsSubClient } from './attachments/client';
import { createAttachmentsSubClient } from './attachments/client';
import type { UserActionsSubClient } from './user_actions/client';
import { createUserActionsSubClient } from './user_actions/client';
import type { CasesClientInternal } from './client_internal';
import { createCasesClientInternal } from './client_internal';
import type { ConfigureSubClient } from './configure/client';
import { createConfigurationSubClient } from './configure/client';
import type { MetricsSubClient } from './metrics/client';
import { createMetricsSubClient } from './metrics/client';
/**
* Client wrapper that contains accessor methods for individual entities within the cases system.

View file

@ -5,11 +5,9 @@
* 2.0.
*/
import { CasesClientArgs } from './types';
import {
InternalConfigureSubClient,
createInternalConfigurationSubClient,
} from './configure/client';
import type { CasesClientArgs } from './types';
import type { InternalConfigureSubClient } from './configure/client';
import { createInternalConfigurationSubClient } from './configure/client';
export class CasesClientInternal {
private readonly _configuration: InternalConfigureSubClient;

View file

@ -7,7 +7,7 @@
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { actionsClientMock } from '@kbn/actions-plugin/server/mocks';
import { CasesClientArgs } from '../types';
import type { CasesClientArgs } from '../types';
import { getConnectors } from './client';
describe('client', () => {

View file

@ -11,37 +11,41 @@ import { pipe } from 'fp-ts/lib/pipeable';
import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import { SavedObject, SavedObjectsFindResponse, SavedObjectsUtils } from '@kbn/core/server';
import { FindActionResult } from '@kbn/actions-plugin/server/types';
import { ActionType, CasesConnectorFeatureId } from '@kbn/actions-plugin/common';
import {
CaseConfigurationsResponseRt,
CaseConfigureResponseRt,
import type { SavedObject, SavedObjectsFindResponse } from '@kbn/core/server';
import { SavedObjectsUtils } from '@kbn/core/server';
import type { FindActionResult } from '@kbn/actions-plugin/server/types';
import type { ActionType } from '@kbn/actions-plugin/common';
import { CasesConnectorFeatureId } from '@kbn/actions-plugin/common';
import type {
CasesConfigurationsResponse,
CasesConfigureAttributes,
CasesConfigurePatch,
CasesConfigurePatchRt,
CasesConfigureRequest,
CasesConfigureResponse,
ConnectorMappings,
ConnectorMappingsAttributes,
excess,
GetConfigureFindRequest,
} from '../../../common/api';
import {
CaseConfigurationsResponseRt,
CaseConfigureResponseRt,
CasesConfigurePatchRt,
excess,
GetConfigureFindRequestRt,
throwErrors,
} from '../../../common/api';
import { MAX_CONCURRENT_SEARCHES } from '../../../common/constants';
import { createCaseError } from '../../common/error';
import { CasesClientInternal } from '../client_internal';
import { CasesClientArgs } from '../types';
import type { CasesClientInternal } from '../client_internal';
import type { CasesClientArgs } from '../types';
import { getMappings } from './get_mappings';
import { Operations } from '../../authorization';
import { combineAuthorizedAndOwnerFilter } from '../utils';
import { MappingsArgs, CreateMappingsArgs, UpdateMappingsArgs } from './types';
import type { MappingsArgs, CreateMappingsArgs, UpdateMappingsArgs } from './types';
import { createMappings } from './create_mappings';
import { updateMappings } from './update_mappings';
import {
import type {
ICasesConfigurePatch,
ICasesConfigureRequest,
ICasesConfigureResponse,

View file

@ -6,10 +6,10 @@
*/
import { ACTION_SAVED_OBJECT_TYPE } from '@kbn/actions-plugin/server';
import { ConnectorMappingsAttributes } from '../../../common/api';
import type { ConnectorMappingsAttributes } from '../../../common/api';
import { createCaseError } from '../../common/error';
import { CasesClientArgs } from '..';
import { CreateMappingsArgs } from './types';
import type { CasesClientArgs } from '..';
import type { CreateMappingsArgs } from './types';
import { casesConnectors } from '../../connectors';
export const createMappings = async (

View file

@ -5,12 +5,12 @@
* 2.0.
*/
import { SavedObjectsFindResponse } from '@kbn/core/server';
import type { SavedObjectsFindResponse } from '@kbn/core/server';
import { ACTION_SAVED_OBJECT_TYPE } from '@kbn/actions-plugin/server';
import { ConnectorMappings } from '../../../common/api';
import type { ConnectorMappings } from '../../../common/api';
import { createCaseError } from '../../common/error';
import { CasesClientArgs } from '..';
import { MappingsArgs } from './types';
import type { CasesClientArgs } from '..';
import type { MappingsArgs } from './types';
export const getMappings = async (
{ connector }: MappingsArgs,

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { CaseConnector } from '../../../common/api';
import { IndexRefresh } from '../../services/types';
import type { CaseConnector } from '../../../common/api';
import type { IndexRefresh } from '../../services/types';
export interface MappingsArgs {
connector: CaseConnector;

View file

@ -6,10 +6,10 @@
*/
import { ACTION_SAVED_OBJECT_TYPE } from '@kbn/actions-plugin/server';
import { ConnectorMappingsAttributes } from '../../../common/api';
import type { ConnectorMappingsAttributes } from '../../../common/api';
import { createCaseError } from '../../common/error';
import { CasesClientArgs } from '..';
import { UpdateMappingsArgs } from './types';
import type { CasesClientArgs } from '..';
import type { UpdateMappingsArgs } from './types';
import { casesConnectors } from '../../connectors';
export const updateMappings = async (

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import {
import type {
KibanaRequest,
SavedObjectsServiceStart,
Logger,
@ -13,12 +13,12 @@ import {
SavedObjectsClientContract,
IBasePath,
} from '@kbn/core/server';
import { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server';
import { PluginStartContract as FeaturesPluginStart } from '@kbn/features-plugin/server';
import { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server';
import { LensServerPluginSetup } from '@kbn/lens-plugin/server';
import { SpacesPluginStart } from '@kbn/spaces-plugin/server';
import { LicensingPluginStart } from '@kbn/licensing-plugin/server';
import type { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server';
import type { PluginStartContract as FeaturesPluginStart } from '@kbn/features-plugin/server';
import type { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server';
import type { LensServerPluginSetup } from '@kbn/lens-plugin/server';
import type { SpacesPluginStart } from '@kbn/spaces-plugin/server';
import type { LicensingPluginStart } from '@kbn/licensing-plugin/server';
import { SAVED_OBJECT_TYPES } from '../../common/constants';
import { Authorization } from '../authorization/authorization';
import {
@ -31,10 +31,11 @@ import {
} from '../services';
import { AuthorizationAuditLogger } from '../authorization';
import { CasesClient, createCasesClient } from '.';
import { PersistableStateAttachmentTypeRegistry } from '../attachment_framework/persistable_state_registry';
import { ExternalReferenceAttachmentTypeRegistry } from '../attachment_framework/external_reference_registry';
import { CasesServices } from './types';
import type { CasesClient } from '.';
import { createCasesClient } from '.';
import type { PersistableStateAttachmentTypeRegistry } from '../attachment_framework/persistable_state_registry';
import type { ExternalReferenceAttachmentTypeRegistry } from '../attachment_framework/external_reference_registry';
import type { CasesServices } from './types';
import { LicensingService } from '../services/licensing';
interface CasesClientFactoryArgs {

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { CaseResponse } from '../../../../common/api';
import type { CaseResponse } from '../../../../common/api';
import { createCasesClientMock } from '../../mocks';
import { CasesClientArgs } from '../../types';
import type { CasesClientArgs } from '../../types';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { createAttachmentServiceMock } from '../../../services/mocks';

View file

@ -6,11 +6,11 @@
*/
import { merge } from 'lodash';
import { SingleCaseMetricsResponse } from '../../../../common/api';
import type { SingleCaseMetricsResponse } from '../../../../common/api';
import { Operations } from '../../../authorization';
import { createCaseError } from '../../../common/error';
import { SingleCaseAggregationHandler } from '../single_case_aggregation_handler';
import { AggregationBuilder, SingleCaseBaseHandlerCommonOptions } from '../types';
import type { AggregationBuilder, SingleCaseBaseHandlerCommonOptions } from '../types';
import { IsolateHostActions } from './aggregations/isolate_host';
export class Actions extends SingleCaseAggregationHandler {

View file

@ -5,9 +5,10 @@
* 2.0.
*/
import { IsolateHostActionType, SingleCaseMetricsResponse } from '../../../../../common/api';
import type { SingleCaseMetricsResponse } from '../../../../../common/api';
import { IsolateHostActionType } from '../../../../../common/api';
import { CASE_COMMENT_SAVED_OBJECT } from '../../../../../common/constants';
import { AggregationBuilder, AggregationResponse } from '../../types';
import type { AggregationBuilder, AggregationResponse } from '../../types';
interface ActionsAggregation {
actions?: {

View file

@ -7,7 +7,7 @@
import { merge } from 'lodash';
import { BaseHandler } from './base_handler';
import { AggregationBuilder, AggregationResponse, BaseHandlerCommonOptions } from './types';
import type { AggregationBuilder, AggregationResponse, BaseHandlerCommonOptions } from './types';
export abstract class AggregationHandler<R> extends BaseHandler<R> {
protected aggregationBuilders: Array<AggregationBuilder<R>> = [];

View file

@ -8,8 +8,8 @@
import { get } from 'lodash';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { SingleCaseMetricsResponse } from '../../../../../common/api';
import { AggregationBuilder, AggregationResponse } from '../../types';
import type { SingleCaseMetricsResponse } from '../../../../../common/api';
import type { AggregationBuilder, AggregationResponse } from '../../types';
type HostsAggregate = HostsAggregateResponse | undefined;

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { SingleCaseMetricsResponse } from '../../../../../common/api';
import { AggregationBuilder, AggregationResponse } from '../../types';
import type { SingleCaseMetricsResponse } from '../../../../../common/api';
import type { AggregationBuilder, AggregationResponse } from '../../types';
export class AlertUsers implements AggregationBuilder<SingleCaseMetricsResponse> {
constructor(private readonly uniqueValuesLimit: number = 10) {}

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { CaseResponse } from '../../../../common/api';
import type { CaseResponse } from '../../../../common/api';
import { createCasesClientMock } from '../../mocks';
import { CasesClientArgs } from '../../types';
import type { CasesClientArgs } from '../../types';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { createAttachmentServiceMock } from '../../../services/mocks';

View file

@ -5,11 +5,11 @@
* 2.0.
*/
import { SingleCaseMetricsResponse } from '../../../../common/api';
import type { SingleCaseMetricsResponse } from '../../../../common/api';
import { Operations } from '../../../authorization';
import { createCaseError } from '../../../common/error';
import { SingleCaseBaseHandler } from '../single_case_base_handler';
import { SingleCaseBaseHandlerCommonOptions } from '../types';
import type { SingleCaseBaseHandlerCommonOptions } from '../types';
export class AlertsCount extends SingleCaseBaseHandler {
constructor(options: SingleCaseBaseHandlerCommonOptions) {

View file

@ -5,13 +5,14 @@
* 2.0.
*/
import { CasesClientMock, createCasesClientMock } from '../../mocks';
import { CasesClientArgs } from '../../types';
import type { CasesClientMock } from '../../mocks';
import { createCasesClientMock } from '../../mocks';
import type { CasesClientArgs } from '../../types';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { AlertDetails } from './details';
import { mockAlertsService } from '../test_utils/alerts';
import { SingleCaseBaseHandlerCommonOptions } from '../types';
import type { SingleCaseBaseHandlerCommonOptions } from '../types';
describe('AlertDetails', () => {
let client: CasesClientMock;

View file

@ -5,11 +5,11 @@
* 2.0.
*/
import { SingleCaseMetricsResponse } from '../../../../common/api';
import type { SingleCaseMetricsResponse } from '../../../../common/api';
import { createCaseError } from '../../../common/error';
import { SingleCaseAggregationHandler } from '../single_case_aggregation_handler';
import { AggregationBuilder, SingleCaseBaseHandlerCommonOptions } from '../types';
import type { AggregationBuilder, SingleCaseBaseHandlerCommonOptions } from '../types';
import { AlertHosts, AlertUsers } from './aggregations';
export class AlertDetails extends SingleCaseAggregationHandler {

View file

@ -6,8 +6,8 @@
*/
import { CASE_SAVED_OBJECT } from '../../../../../common/constants';
import { CasesMetricsResponse } from '../../../../../common/api';
import { AggregationBuilder, AggregationResponse } from '../../types';
import type { CasesMetricsResponse } from '../../../../../common/api';
import type { AggregationBuilder, AggregationResponse } from '../../types';
export class AverageDuration implements AggregationBuilder<CasesMetricsResponse> {
build() {

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { CaseResponse } from '../../../../common/api';
import type { CaseResponse } from '../../../../common/api';
import { createCasesClientMock } from '../../mocks';
import { CasesClientArgs } from '../../types';
import type { CasesClientArgs } from '../../types';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { createCaseServiceMock } from '../../../services/mocks';

View file

@ -5,12 +5,12 @@
* 2.0.
*/
import { CasesMetricsResponse } from '../../../../common/api';
import type { CasesMetricsResponse } from '../../../../common/api';
import { Operations } from '../../../authorization';
import { createCaseError } from '../../../common/error';
import { constructQueryOptions } from '../../utils';
import { AllCasesAggregationHandler } from '../all_cases_aggregation_handler';
import { AggregationBuilder, AllCasesBaseHandlerCommonOptions } from '../types';
import type { AggregationBuilder, AllCasesBaseHandlerCommonOptions } from '../types';
import { AverageDuration } from './aggregations/avg_duration';
export class MTTR extends AllCasesAggregationHandler {

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { CasesMetricsResponse } from '../../../common/api';
import type { CasesMetricsResponse } from '../../../common/api';
import { AggregationHandler } from './aggregation_handler';
import { AggregationBuilder, AllCasesBaseHandlerCommonOptions } from './types';
import type { AggregationBuilder, AllCasesBaseHandlerCommonOptions } from './types';
export abstract class AllCasesAggregationHandler extends AggregationHandler<CasesMetricsResponse> {
protected readonly from?: string;

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { CasesMetricsResponse } from '../../../common/api';
import type { CasesMetricsResponse } from '../../../common/api';
import { BaseHandler } from './base_handler';
import { AllCasesBaseHandlerCommonOptions } from './types';
import type { AllCasesBaseHandlerCommonOptions } from './types';
export abstract class AllCasesBaseHandler extends BaseHandler<CasesMetricsResponse> {
protected readonly owner?: string | string[];

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { BaseHandlerCommonOptions, MetricsHandler } from './types';
import type { BaseHandlerCommonOptions, MetricsHandler } from './types';
export abstract class BaseHandler<R> implements MetricsHandler<R> {
constructor(

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import {
import type {
SingleCaseMetricsResponse,
CasesMetricsRequest,
CasesStatusRequest,
@ -13,9 +13,9 @@ import {
SingleCaseMetricsRequest,
CasesMetricsResponse,
} from '../../../common/api';
import { CasesClient } from '../client';
import type { CasesClient } from '../client';
import { CasesClientArgs } from '../types';
import type { CasesClientArgs } from '../types';
import { getStatusTotalsByType } from './get_status_totals';
import { getCaseMetrics } from './get_case_metrics';
import { getCasesMetrics } from './get_cases_metrics';

View file

@ -6,7 +6,7 @@
*/
import { createCasesClientMock } from '../mocks';
import { CasesClientArgs } from '../types';
import type { CasesClientArgs } from '../types';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { createUserActionServiceMock } from '../../services/mocks';
import { Connectors } from './connectors';

View file

@ -5,11 +5,11 @@
* 2.0.
*/
import { SingleCaseMetricsResponse } from '../../../common/api';
import type { SingleCaseMetricsResponse } from '../../../common/api';
import { Operations } from '../../authorization';
import { createCaseError } from '../../common/error';
import { SingleCaseBaseHandler } from './single_case_base_handler';
import { SingleCaseBaseHandlerCommonOptions } from './types';
import type { SingleCaseBaseHandlerCommonOptions } from './types';
export class Connectors extends SingleCaseBaseHandler {
constructor(options: SingleCaseBaseHandlerCommonOptions) {

View file

@ -6,12 +6,14 @@
*/
import { loggingSystemMock, savedObjectsClientMock } from '@kbn/core/server/mocks';
import { SavedObject } from '@kbn/core/server';
import type { SavedObject } from '@kbn/core/server';
import { getCaseMetrics } from './get_case_metrics';
import { CaseAttributes, CaseResponse, CaseStatuses } from '../../../common/api';
import { CasesClientMock, createCasesClientMock } from '../mocks';
import { CasesClientArgs } from '../types';
import type { CaseAttributes, CaseResponse } from '../../../common/api';
import { CaseStatuses } from '../../../common/api';
import type { CasesClientMock } from '../mocks';
import { createCasesClientMock } from '../mocks';
import type { CasesClientArgs } from '../types';
import { createAuthorizationMock } from '../../authorization/mock';
import {
createAttachmentServiceMock,

View file

@ -6,15 +6,12 @@
*/
import { merge } from 'lodash';
import {
SingleCaseMetricsRequest,
SingleCaseMetricsResponse,
SingleCaseMetricsResponseRt,
} from '../../../common/api';
import type { SingleCaseMetricsRequest, SingleCaseMetricsResponse } from '../../../common/api';
import { SingleCaseMetricsResponseRt } from '../../../common/api';
import { Operations } from '../../authorization';
import { createCaseError } from '../../common/error';
import { CasesClient } from '../client';
import { CasesClientArgs } from '../types';
import type { CasesClient } from '../client';
import type { CasesClientArgs } from '../types';
import { buildHandlers } from './utils';
export const getCaseMetrics = async (

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { CasesClientMock } from '../mocks';
import type { CasesClientMock } from '../mocks';
import { getCasesMetrics } from './get_cases_metrics';
import { createMockClientArgs, createMockClient } from './test_utils/client';

View file

@ -11,16 +11,11 @@ import { pipe } from 'fp-ts/lib/pipeable';
import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import {
CasesMetricsRequest,
CasesMetricsRequestRt,
CasesMetricsResponse,
CasesMetricsResponseRt,
throwErrors,
} from '../../../common/api';
import type { CasesMetricsRequest, CasesMetricsResponse } from '../../../common/api';
import { CasesMetricsRequestRt, CasesMetricsResponseRt, throwErrors } from '../../../common/api';
import { createCaseError } from '../../common/error';
import { CasesClient } from '../client';
import { CasesClientArgs } from '../types';
import type { CasesClient } from '../client';
import type { CasesClientArgs } from '../types';
import { buildHandlers } from './utils';
export const getCasesMetrics = async (

View file

@ -10,15 +10,14 @@ import { pipe } from 'fp-ts/lib/pipeable';
import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import type { CasesStatusRequest, CasesStatusResponse } from '../../../common/api';
import {
CasesStatusRequest,
CasesStatusResponse,
excess,
CasesStatusRequestRt,
throwErrors,
CasesStatusResponseRt,
} from '../../../common/api';
import { CasesClientArgs } from '../types';
import type { CasesClientArgs } from '../types';
import { Operations } from '../../authorization';
import { constructQueryOptions } from '../utils';
import { createCaseError } from '../../common/error';

View file

@ -5,8 +5,9 @@
* 2.0.
*/
import { SavedObject } from '@kbn/core/server';
import { CaseStatuses, CaseUserActionResponse } from '../../../common/api';
import type { SavedObject } from '@kbn/core/server';
import type { CaseUserActionResponse } from '../../../common/api';
import { CaseStatuses } from '../../../common/api';
import { getStatusInfo } from './lifespan';
describe('lifespan', () => {

View file

@ -5,20 +5,19 @@
* 2.0.
*/
import { SavedObject } from '@kbn/core/server';
import {
CaseStatuses,
import type { SavedObject } from '@kbn/core/server';
import type {
CaseUserActionResponse,
SingleCaseMetricsResponse,
StatusInfo,
StatusUserAction,
StatusUserActionRt,
UserActionWithResponse,
} from '../../../common/api';
import { CaseStatuses, StatusUserActionRt } from '../../../common/api';
import { Operations } from '../../authorization';
import { createCaseError } from '../../common/error';
import { SingleCaseBaseHandler } from './single_case_base_handler';
import { SingleCaseBaseHandlerCommonOptions } from './types';
import type { SingleCaseBaseHandlerCommonOptions } from './types';
export class Lifespan extends SingleCaseBaseHandler {
constructor(options: SingleCaseBaseHandlerCommonOptions) {

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { SingleCaseMetricsResponse } from '../../../common/api';
import type { SingleCaseMetricsResponse } from '../../../common/api';
import { AggregationHandler } from './aggregation_handler';
import { AggregationBuilder, SingleCaseBaseHandlerCommonOptions } from './types';
import type { AggregationBuilder, SingleCaseBaseHandlerCommonOptions } from './types';
export abstract class SingleCaseAggregationHandler extends AggregationHandler<SingleCaseMetricsResponse> {
protected readonly caseId: string;

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { SingleCaseMetricsResponse } from '../../../common/api';
import type { SingleCaseMetricsResponse } from '../../../common/api';
import { BaseHandler } from './base_handler';
import { SingleCaseBaseHandlerCommonOptions } from './types';
import type { SingleCaseBaseHandlerCommonOptions } from './types';
export abstract class SingleCaseBaseHandler extends BaseHandler<SingleCaseMetricsResponse> {
protected readonly caseId: string;

View file

@ -6,7 +6,7 @@
*/
import { createAlertServiceMock } from '../../../services/mocks';
import { AggregationBuilder } from '../types';
import type { AggregationBuilder } from '../types';
import { AlertHosts, AlertUsers } from '../alerts/aggregations';
export function mockAlertsService() {

View file

@ -9,7 +9,7 @@ import { savedObjectsClientMock, loggingSystemMock } from '@kbn/core/server/mock
import { createAuthorizationMock } from '../../../authorization/mock';
import { createCaseServiceMock } from '../../../services/mocks';
import { createCasesClientMock } from '../../mocks';
import { CasesClientArgs } from '../../types';
import type { CasesClientArgs } from '../../types';
export function createMockClient() {
const client = createCasesClientMock();

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { SavedObject } from '@kbn/core/server';
import { CaseStatuses, CaseUserActionResponse } from '../../../../common/api';
import type { SavedObject } from '@kbn/core/server';
import type { CaseStatuses, CaseUserActionResponse } from '../../../../common/api';
export function createStatusChangeSavedObject(
status: CaseStatuses,

View file

@ -6,8 +6,8 @@
*/
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { CasesClient } from '../client';
import { CasesClientArgs } from '../types';
import type { CasesClient } from '../client';
import type { CasesClientArgs } from '../types';
export interface MetricsHandler<R> {
getFeatures(): Set<string>;

View file

@ -6,15 +6,15 @@
*/
import Boom from '@hapi/boom';
import { CasesMetricsRequest, SingleCaseMetricsRequest } from '../../../common/api';
import { CasesClient } from '../client';
import { CasesClientArgs } from '../types';
import type { CasesMetricsRequest, SingleCaseMetricsRequest } from '../../../common/api';
import type { CasesClient } from '../client';
import type { CasesClientArgs } from '../types';
import { AlertsCount } from './alerts/count';
import { AlertDetails } from './alerts/details';
import { Actions } from './actions';
import { Connectors } from './connectors';
import { Lifespan } from './lifespan';
import { MetricsHandler } from './types';
import type { MetricsHandler } from './types';
import { MTTR } from './all_cases/mttr';
const isSingleCaseMetrics = (

View file

@ -5,15 +5,15 @@
* 2.0.
*/
import { PublicContract, PublicMethodsOf } from '@kbn/utility-types';
import type { PublicContract, PublicMethodsOf } from '@kbn/utility-types';
import { CasesClient } from '.';
import { AttachmentsSubClient } from './attachments/client';
import { CasesSubClient } from './cases/client';
import { ConfigureSubClient } from './configure/client';
import { CasesClientFactory } from './factory';
import { MetricsSubClient } from './metrics/client';
import { UserActionsSubClient } from './user_actions/client';
import type { CasesClient } from '.';
import type { AttachmentsSubClient } from './attachments/client';
import type { CasesSubClient } from './cases/client';
import type { ConfigureSubClient } from './configure/client';
import type { CasesClientFactory } from './factory';
import type { MetricsSubClient } from './metrics/client';
import type { UserActionsSubClient } from './user_actions/client';
type CasesSubClientMock = jest.Mocked<CasesSubClient>;

Some files were not shown because too many files have changed in this diff Show more