[SecuritySolution] Decouple timeline SO types from server representation types (#158566)

## Summary

https://github.com/elastic/security-team/issues/6479

In this PR we're separating the types for the `Timeline` saved object
and the type of it's API response equivalent. Doing so will allow us to
make changes to either representations individually which is necessary
for versioning the SO and routes (individually) in the future.

The saved object definition of timeline and its API equivalent now live
in `*/saved_object.ts` and `*/api.ts` respectively. A clean cut of these
two, now distinct types. You will encounter a lot of duplication of
types in these files which is unavoidable. In the future, depending on
how both representations evolve when versioned, these two definitions
will diverge.

You will notice that only few types (and values) defined in
`saved_object.ts` are exported. They are only used for the conversion
logic. They are not exported so they're not accidentally required by
frontend or server code that is not dealing with the conversion. The
exported types all start with `SavedObject*` to clearly mark them as SO
representations.

The conversion files (`convert_saved_object_to_savedtimeline.ts` and
`security_solution/server/lib/timeline/saved_object/timelines/index.ts`)
have been updated to use the new representations and there is no
implicit conversion between them (e.g. through spreading or rest
parameters). In some places, an explicit conversion of fields was
necessary (e.g. to translate between timeline types).

The bulk of the changes are updates of `import` statements to change the
import to `**/api.ts`. If you are on a security team other than the
investigations team, you're most likely only required to look at those
import changes :)


### Checklist


- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Jan Monschke 2023-06-09 09:50:27 +02:00 committed by GitHub
parent 18e04a3d17
commit 95edefb221
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
219 changed files with 1426 additions and 1285 deletions

View file

@ -7,7 +7,7 @@
import { CellActionsProvider } from '@kbn/cell-actions';
import { I18nProvider } from '@kbn/i18n-react';
import { CellValueElementProps } from '@kbn/timelines-plugin/common';
import { DeprecatedCellValueElementProps } from '@kbn/timelines-plugin/common';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import React from 'react';
import { DragDropContext, DropResult, ResponderProvided } from 'react-beautiful-dnd';
@ -37,7 +37,7 @@ interface Props {
cellActions?: Action[];
}
const StoryCellRenderer: React.FC<CellValueElementProps> = ({ columnId, data }) => (
const StoryCellRenderer: React.FC<DeprecatedCellValueElementProps> = ({ columnId, data }) => (
<>
{getMappedNonEcsValue({
data,

View file

@ -18,7 +18,7 @@ import { defaultHeaders } from '../../mock/header';
import { mockGlobalState } from '../../mock/global_state';
import { mockTimelineData } from '../../mock/mock_timeline_data';
import { TestProviders } from '../../mock/test_providers';
import { CellValueElementProps } from '@kbn/timelines-plugin/common';
import { DeprecatedCellValueElementProps } from '@kbn/timelines-plugin/common';
import { mockBrowserFields } from '../../mock/mock_source';
import { getMappedNonEcsValue } from './utils';
@ -65,7 +65,7 @@ window.matchMedia = jest.fn().mockImplementation((query) => {
};
});
export const TestCellRenderer: React.FC<CellValueElementProps> = ({ columnId, data }) => (
export const TestCellRenderer: React.FC<DeprecatedCellValueElementProps> = ({ columnId, data }) => (
<>
{getMappedNonEcsValue({
data,

View file

@ -33,9 +33,9 @@ import type {
import { i18n } from '@kbn/i18n';
import {
BrowserFields,
CellValueElementProps,
DeprecatedCellValueElementProps,
ColumnHeaderOptions,
RowRenderer,
DeprecatedRowRenderer,
TimelineItem,
} from '@kbn/timelines-plugin/common';
import { useDataGridColumnsCellActions } from '@kbn/cell-actions';
@ -84,8 +84,8 @@ interface BaseDataTableProps {
id: string;
leadingControlColumns: EuiDataGridControlColumn[];
loadPage: (newActivePage: number) => void;
renderCellValue: (props: CellValueElementProps) => React.ReactNode;
rowRenderers: RowRenderer[];
renderCellValue: (props: DeprecatedCellValueElementProps) => React.ReactNode;
rowRenderers: DeprecatedRowRenderer[];
hasCrudPermissions?: boolean;
unitCountText: string;
pagination: EuiDataGridPaginationProps;

View file

@ -6,7 +6,7 @@
*/
import { ALERT_STATUS, ALERT_STATUS_ACTIVE, ALERT_STATUS_RECOVERED } from '@kbn/rule-data-utils';
import type { CellValueElementProps } from '@kbn/timelines-plugin/common';
import type { DeprecatedCellValueElementProps } from '@kbn/timelines-plugin/common';
import { createObservabilityRuleTypeRegistryMock } from '../../rules/observability_rule_type_registry_mock';
import { render } from '../../utils/test_helper';
import { getRenderCellValue } from './render_cell_value';
@ -59,7 +59,7 @@ function makeAlertsTableRow({ alertStatus }: AlertsTableRow) {
];
}
const requiredProperties: CellValueElementProps = {
const requiredProperties: DeprecatedCellValueElementProps = {
rowIndex: 0,
colIndex: 0,
columnId: '',

View file

@ -16,7 +16,10 @@ import {
TIMESTAMP,
} from '@kbn/rule-data-utils';
import { isEmpty } from 'lodash';
import type { CellValueElementProps, TimelineNonEcsData } from '@kbn/timelines-plugin/common';
import type {
DeprecatedCellValueElementProps,
TimelineNonEcsData,
} from '@kbn/timelines-plugin/common';
import { asDuration } from '../../../common/utils/formatters';
import { AlertSeverityBadge } from '../alert_severity_badge';
@ -67,7 +70,7 @@ export const getRenderCellValue = ({
setFlyoutAlert: (data: TopAlert) => void;
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry;
}) => {
return ({ columnId, data }: CellValueElementProps) => {
return ({ columnId, data }: DeprecatedCellValueElementProps) => {
if (!data) return null;
const mappedNonEcsValue = getMappedNonEcsValue({
data,

View file

@ -11,7 +11,7 @@ import type {
TimelineType,
TimelineStatus,
RowRendererId,
} from '../../types/timeline';
} from '../../types/timeline/api';
export * from './events';

View file

@ -0,0 +1,656 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import * as runtimeTypes from 'io-ts';
import { PositiveInteger } from '@kbn/securitysolution-io-ts-types';
import { stringEnum, unionWithNullType } from '../../utility_types';
import type { Maybe } from '../../search_strategy';
import { Direction } from '../../search_strategy';
import type { PinnedEvent } from './pinned_event';
import { PinnedEventToReturnSavedObjectRuntimeType } from './pinned_event';
import {
SavedObjectResolveAliasPurpose,
SavedObjectResolveAliasTargetId,
SavedObjectResolveOutcome,
} from '../../detection_engine/rule_schema';
import {
success,
success_count as successCount,
} from '../../detection_engine/schemas/common/schemas';
import { errorSchema } from '../../detection_engine/schemas/response/error_schema';
import type { NoteResult } from './note';
import { NoteSavedObjectToReturnRuntimeType } from './note';
/*
* ColumnHeader Types
*/
const SavedColumnHeaderRuntimeType = runtimeTypes.partial({
aggregatable: unionWithNullType(runtimeTypes.boolean),
category: unionWithNullType(runtimeTypes.string),
columnHeaderType: unionWithNullType(runtimeTypes.string),
description: unionWithNullType(runtimeTypes.string),
example: unionWithNullType(runtimeTypes.string),
indexes: unionWithNullType(runtimeTypes.array(runtimeTypes.string)),
id: unionWithNullType(runtimeTypes.string),
name: unionWithNullType(runtimeTypes.string),
placeholder: unionWithNullType(runtimeTypes.string),
searchable: unionWithNullType(runtimeTypes.boolean),
type: unionWithNullType(runtimeTypes.string),
});
/*
* DataProvider Types
*/
const SavedDataProviderQueryMatchBasicRuntimeType = runtimeTypes.partial({
field: unionWithNullType(runtimeTypes.string),
displayField: unionWithNullType(runtimeTypes.string),
value: runtimeTypes.union([
runtimeTypes.null,
runtimeTypes.string,
runtimeTypes.array(runtimeTypes.string),
]),
displayValue: unionWithNullType(runtimeTypes.string),
operator: unionWithNullType(runtimeTypes.string),
});
const SavedDataProviderQueryMatchRuntimeType = runtimeTypes.partial({
id: unionWithNullType(runtimeTypes.string),
name: unionWithNullType(runtimeTypes.string),
enabled: unionWithNullType(runtimeTypes.boolean),
excluded: unionWithNullType(runtimeTypes.boolean),
kqlQuery: unionWithNullType(runtimeTypes.string),
queryMatch: unionWithNullType(SavedDataProviderQueryMatchBasicRuntimeType),
});
export enum DataProviderType {
default = 'default',
template = 'template',
}
export const DataProviderTypeLiteralRt = runtimeTypes.union([
runtimeTypes.literal(DataProviderType.default),
runtimeTypes.literal(DataProviderType.template),
]);
const SavedDataProviderRuntimeType = runtimeTypes.partial({
id: unionWithNullType(runtimeTypes.string),
name: unionWithNullType(runtimeTypes.string),
enabled: unionWithNullType(runtimeTypes.boolean),
excluded: unionWithNullType(runtimeTypes.boolean),
kqlQuery: unionWithNullType(runtimeTypes.string),
queryMatch: unionWithNullType(SavedDataProviderQueryMatchBasicRuntimeType),
and: unionWithNullType(runtimeTypes.array(SavedDataProviderQueryMatchRuntimeType)),
type: unionWithNullType(DataProviderTypeLiteralRt),
});
/*
* Filters Types
*/
const SavedFilterMetaRuntimeType = runtimeTypes.partial({
alias: unionWithNullType(runtimeTypes.string),
controlledBy: unionWithNullType(runtimeTypes.string),
disabled: unionWithNullType(runtimeTypes.boolean),
field: unionWithNullType(runtimeTypes.string),
formattedValue: unionWithNullType(runtimeTypes.string),
index: unionWithNullType(runtimeTypes.string),
key: unionWithNullType(runtimeTypes.string),
negate: unionWithNullType(runtimeTypes.boolean),
params: unionWithNullType(runtimeTypes.string),
type: unionWithNullType(runtimeTypes.string),
value: unionWithNullType(runtimeTypes.string),
});
const SavedFilterRuntimeType = runtimeTypes.partial({
exists: unionWithNullType(runtimeTypes.string),
meta: unionWithNullType(SavedFilterMetaRuntimeType),
match_all: unionWithNullType(runtimeTypes.string),
missing: unionWithNullType(runtimeTypes.string),
query: unionWithNullType(runtimeTypes.string),
range: unionWithNullType(runtimeTypes.string),
script: unionWithNullType(runtimeTypes.string),
});
/*
* eqlOptionsQuery -> filterQuery Types
*/
const EqlOptionsRuntimeType = runtimeTypes.partial({
eventCategoryField: unionWithNullType(runtimeTypes.string),
query: unionWithNullType(runtimeTypes.string),
tiebreakerField: unionWithNullType(runtimeTypes.string),
timestampField: unionWithNullType(runtimeTypes.string),
size: unionWithNullType(runtimeTypes.union([runtimeTypes.string, runtimeTypes.number])),
});
/*
* kqlQuery -> filterQuery Types
*/
const SavedKueryFilterQueryRuntimeType = runtimeTypes.partial({
kind: unionWithNullType(runtimeTypes.string),
expression: unionWithNullType(runtimeTypes.string),
});
const SavedSerializedFilterQueryQueryRuntimeType = runtimeTypes.partial({
kuery: unionWithNullType(SavedKueryFilterQueryRuntimeType),
serializedQuery: unionWithNullType(runtimeTypes.string),
});
const SavedFilterQueryQueryRuntimeType = runtimeTypes.partial({
filterQuery: unionWithNullType(SavedSerializedFilterQueryQueryRuntimeType),
});
/*
* DatePicker Range Types
*/
const SavedDateRangePickerRuntimeType = runtimeTypes.partial({
/* Before the change of all timestamp to ISO string the values of start and from
* attributes where a number. Specifically UNIX timestamps.
* To support old timeline's saved object we need to add the number io-ts type
*/
start: unionWithNullType(runtimeTypes.union([runtimeTypes.string, runtimeTypes.number])),
end: unionWithNullType(runtimeTypes.union([runtimeTypes.string, runtimeTypes.number])),
});
/*
* Favorite Types
*/
const SavedFavoriteRuntimeType = runtimeTypes.partial({
keySearch: unionWithNullType(runtimeTypes.string),
favoriteDate: unionWithNullType(runtimeTypes.number),
fullName: unionWithNullType(runtimeTypes.string),
userName: unionWithNullType(runtimeTypes.string),
});
/*
* Sort Types
*/
const SavedSortObject = runtimeTypes.partial({
columnId: unionWithNullType(runtimeTypes.string),
columnType: unionWithNullType(runtimeTypes.string),
sortDirection: unionWithNullType(runtimeTypes.string),
});
const SavedSortRuntimeType = runtimeTypes.union([
runtimeTypes.array(SavedSortObject),
SavedSortObject,
]);
export type Sort = runtimeTypes.TypeOf<typeof SavedSortRuntimeType>;
/*
* Timeline Statuses
*/
export enum TimelineStatus {
active = 'active',
draft = 'draft',
immutable = 'immutable',
}
export const TimelineStatusLiteralRt = runtimeTypes.union([
runtimeTypes.literal(TimelineStatus.active),
runtimeTypes.literal(TimelineStatus.draft),
runtimeTypes.literal(TimelineStatus.immutable),
]);
const TimelineStatusLiteralWithNullRt = unionWithNullType(TimelineStatusLiteralRt);
export type TimelineStatusLiteralWithNull = runtimeTypes.TypeOf<
typeof TimelineStatusLiteralWithNullRt
>;
export enum RowRendererId {
/** event.kind: signal */
alert = 'alert',
/** endpoint alerts (created on the endpoint) */
alerts = 'alerts',
auditd = 'auditd',
auditd_file = 'auditd_file',
library = 'library',
netflow = 'netflow',
plain = 'plain',
registry = 'registry',
suricata = 'suricata',
system = 'system',
system_dns = 'system_dns',
system_endgame_process = 'system_endgame_process',
system_file = 'system_file',
system_fim = 'system_fim',
system_security_event = 'system_security_event',
system_socket = 'system_socket',
threat_match = 'threat_match',
zeek = 'zeek',
}
const RowRendererIdRuntimeType = stringEnum(RowRendererId, 'RowRendererId');
/**
* Timeline template type
*/
export enum TemplateTimelineType {
elastic = 'elastic',
custom = 'custom',
}
export const TemplateTimelineTypeLiteralRt = runtimeTypes.union([
runtimeTypes.literal(TemplateTimelineType.elastic),
runtimeTypes.literal(TemplateTimelineType.custom),
]);
export const TemplateTimelineTypeLiteralWithNullRt = unionWithNullType(
TemplateTimelineTypeLiteralRt
);
export type TemplateTimelineTypeLiteral = runtimeTypes.TypeOf<typeof TemplateTimelineTypeLiteralRt>;
export type TemplateTimelineTypeLiteralWithNull = runtimeTypes.TypeOf<
typeof TemplateTimelineTypeLiteralWithNullRt
>;
/*
* Timeline Types
*/
export enum TimelineType {
default = 'default',
template = 'template',
}
export const TimelineTypeLiteralRt = runtimeTypes.union([
runtimeTypes.literal(TimelineType.template),
runtimeTypes.literal(TimelineType.default),
]);
export const TimelineTypeLiteralWithNullRt = unionWithNullType(TimelineTypeLiteralRt);
export type TimelineTypeLiteral = runtimeTypes.TypeOf<typeof TimelineTypeLiteralRt>;
export type TimelineTypeLiteralWithNull = runtimeTypes.TypeOf<typeof TimelineTypeLiteralWithNullRt>;
/**
* This is the response type
*/
export const SavedTimelineRuntimeType = runtimeTypes.partial({
columns: unionWithNullType(runtimeTypes.array(SavedColumnHeaderRuntimeType)),
dataProviders: unionWithNullType(runtimeTypes.array(SavedDataProviderRuntimeType)),
dataViewId: unionWithNullType(runtimeTypes.string),
description: unionWithNullType(runtimeTypes.string),
eqlOptions: unionWithNullType(EqlOptionsRuntimeType),
eventType: unionWithNullType(runtimeTypes.string),
excludedRowRendererIds: unionWithNullType(runtimeTypes.array(RowRendererIdRuntimeType)),
favorite: unionWithNullType(runtimeTypes.array(SavedFavoriteRuntimeType)),
filters: unionWithNullType(runtimeTypes.array(SavedFilterRuntimeType)),
indexNames: unionWithNullType(runtimeTypes.array(runtimeTypes.string)),
kqlMode: unionWithNullType(runtimeTypes.string),
kqlQuery: unionWithNullType(SavedFilterQueryQueryRuntimeType),
title: unionWithNullType(runtimeTypes.string),
templateTimelineId: unionWithNullType(runtimeTypes.string),
templateTimelineVersion: unionWithNullType(runtimeTypes.number),
timelineType: unionWithNullType(TimelineTypeLiteralRt),
dateRange: unionWithNullType(SavedDateRangePickerRuntimeType),
savedQueryId: unionWithNullType(runtimeTypes.string),
sort: unionWithNullType(SavedSortRuntimeType),
status: unionWithNullType(TimelineStatusLiteralRt),
created: unionWithNullType(runtimeTypes.number),
createdBy: unionWithNullType(runtimeTypes.string),
updated: unionWithNullType(runtimeTypes.number),
updatedBy: unionWithNullType(runtimeTypes.string),
});
export type SavedTimeline = runtimeTypes.TypeOf<typeof SavedTimelineRuntimeType>;
export type SavedTimelineWithSavedObjectId = SavedTimeline & {
savedObjectId?: string | null;
};
/**
* This type represents a timeline type stored in a saved object that does not include any fields that reference
* other saved objects.
*/
export type TimelineWithoutExternalRefs = Omit<SavedTimeline, 'dataViewId' | 'savedQueryId'>;
export const TimelineSavedToReturnObjectRuntimeType = runtimeTypes.intersection([
SavedTimelineRuntimeType,
runtimeTypes.type({
savedObjectId: runtimeTypes.string,
version: runtimeTypes.string,
}),
runtimeTypes.partial({
eventIdToNoteIds: runtimeTypes.array(NoteSavedObjectToReturnRuntimeType),
noteIds: runtimeTypes.array(runtimeTypes.string),
notes: runtimeTypes.array(NoteSavedObjectToReturnRuntimeType),
pinnedEventIds: runtimeTypes.array(runtimeTypes.string),
pinnedEventsSaveObject: runtimeTypes.array(PinnedEventToReturnSavedObjectRuntimeType),
}),
]);
export type TimelineSavedObject = runtimeTypes.TypeOf<
typeof TimelineSavedToReturnObjectRuntimeType
>;
export const SingleTimelineResponseType = runtimeTypes.type({
data: runtimeTypes.type({
getOneTimeline: TimelineSavedToReturnObjectRuntimeType,
}),
});
export type SingleTimelineResponse = runtimeTypes.TypeOf<typeof SingleTimelineResponseType>;
/** Resolved Timeline Response */
export const ResolvedTimelineSavedObjectToReturnObjectRuntimeType = runtimeTypes.intersection([
runtimeTypes.type({
timeline: TimelineSavedToReturnObjectRuntimeType,
outcome: SavedObjectResolveOutcome,
}),
runtimeTypes.partial({
alias_target_id: SavedObjectResolveAliasTargetId,
alias_purpose: SavedObjectResolveAliasPurpose,
}),
]);
export type ResolvedTimelineWithOutcomeSavedObject = runtimeTypes.TypeOf<
typeof ResolvedTimelineSavedObjectToReturnObjectRuntimeType
>;
export const ResolvedSingleTimelineResponseType = runtimeTypes.type({
data: ResolvedTimelineSavedObjectToReturnObjectRuntimeType,
});
export type SingleTimelineResolveResponse = runtimeTypes.TypeOf<
typeof ResolvedSingleTimelineResponseType
>;
const responseTimelines = runtimeTypes.type({
timeline: runtimeTypes.array(TimelineSavedToReturnObjectRuntimeType),
totalCount: runtimeTypes.number,
});
export type ResponseTimelines = runtimeTypes.TypeOf<typeof responseTimelines>;
export const allTimelinesResponse = runtimeTypes.intersection([
responseTimelines,
runtimeTypes.type({
defaultTimelineCount: runtimeTypes.number,
templateTimelineCount: runtimeTypes.number,
elasticTemplateTimelineCount: runtimeTypes.number,
customTemplateTimelineCount: runtimeTypes.number,
favoriteCount: runtimeTypes.number,
}),
]);
export type AllTimelinesResponse = runtimeTypes.TypeOf<typeof allTimelinesResponse>;
/**
* All Timeline Saved object type with metadata
*/
export const TimelineResponseType = runtimeTypes.type({
data: runtimeTypes.type({
persistTimeline: runtimeTypes.intersection([
runtimeTypes.partial({
code: unionWithNullType(runtimeTypes.number),
message: unionWithNullType(runtimeTypes.string),
}),
runtimeTypes.type({
timeline: TimelineSavedToReturnObjectRuntimeType,
}),
]),
}),
});
export const TimelineErrorResponseType = runtimeTypes.type({
status_code: runtimeTypes.number,
message: runtimeTypes.string,
});
export type TimelineErrorResponse = runtimeTypes.TypeOf<typeof TimelineErrorResponseType>;
export type TimelineResponse = runtimeTypes.TypeOf<typeof TimelineResponseType>;
export enum SortFieldTimeline {
title = 'title',
description = 'description',
updated = 'updated',
created = 'created',
}
export const sortFieldTimeline = runtimeTypes.union([
runtimeTypes.literal(SortFieldTimeline.title),
runtimeTypes.literal(SortFieldTimeline.description),
runtimeTypes.literal(SortFieldTimeline.updated),
runtimeTypes.literal(SortFieldTimeline.created),
]);
export const direction = runtimeTypes.union([
runtimeTypes.literal(Direction.asc),
runtimeTypes.literal(Direction.desc),
]);
export const sortTimeline = runtimeTypes.type({
sortField: sortFieldTimeline,
sortOrder: direction,
});
/**
* Import/export timelines
*/
export type ExportedGlobalNotes = Array<Exclude<NoteResult, 'eventId'>>;
export type ExportedEventNotes = NoteResult[];
export interface ExportedNotes {
eventNotes: ExportedEventNotes;
globalNotes: ExportedGlobalNotes;
}
export type ExportedTimelines = SavedTimeline &
ExportedNotes & {
pinnedEventIds: string[];
};
export interface ExportTimelineNotFoundError {
statusCode: number;
message: string;
}
export const importTimelineResultSchema = runtimeTypes.exact(
runtimeTypes.type({
success,
success_count: successCount,
timelines_installed: PositiveInteger,
timelines_updated: PositiveInteger,
errors: runtimeTypes.array(errorSchema),
})
);
export type ImportTimelineResultSchema = runtimeTypes.TypeOf<typeof importTimelineResultSchema>;
const favoriteTimelineResult = runtimeTypes.partial({
fullName: unionWithNullType(runtimeTypes.string),
userName: unionWithNullType(runtimeTypes.string),
favoriteDate: unionWithNullType(runtimeTypes.number),
});
export type FavoriteTimelineResult = runtimeTypes.TypeOf<typeof favoriteTimelineResult>;
export const responseFavoriteTimeline = runtimeTypes.partial({
savedObjectId: runtimeTypes.string,
version: runtimeTypes.string,
code: unionWithNullType(runtimeTypes.number),
message: unionWithNullType(runtimeTypes.string),
templateTimelineId: unionWithNullType(runtimeTypes.string),
templateTimelineVersion: unionWithNullType(runtimeTypes.number),
timelineType: unionWithNullType(TimelineTypeLiteralRt),
favorite: unionWithNullType(runtimeTypes.array(favoriteTimelineResult)),
});
export type ResponseFavoriteTimeline = runtimeTypes.TypeOf<typeof responseFavoriteTimeline>;
export const pageInfoTimeline = runtimeTypes.type({
pageIndex: runtimeTypes.number,
pageSize: runtimeTypes.number,
});
export interface PageInfoTimeline {
pageIndex: number;
pageSize: number;
}
export const getTimelinesArgs = runtimeTypes.partial({
onlyUserFavorite: unionWithNullType(runtimeTypes.boolean),
pageInfo: unionWithNullType(pageInfoTimeline),
search: unionWithNullType(runtimeTypes.string),
sort: unionWithNullType(sortTimeline),
status: unionWithNullType(TimelineStatusLiteralRt),
timelineType: unionWithNullType(TimelineTypeLiteralRt),
});
export type GetTimelinesArgs = runtimeTypes.TypeOf<typeof getTimelinesArgs>;
export interface ColumnHeaderResult {
aggregatable?: Maybe<boolean>;
category?: Maybe<string>;
columnHeaderType?: Maybe<string>;
description?: Maybe<string>;
example?: Maybe<string | number>;
indexes?: Maybe<string[]>;
id?: Maybe<string>;
name?: Maybe<string>;
placeholder?: Maybe<string>;
searchable?: Maybe<boolean>;
type?: Maybe<string>;
}
export interface DataProviderResult {
id?: Maybe<string>;
name?: Maybe<string>;
enabled?: Maybe<boolean>;
excluded?: Maybe<boolean>;
kqlQuery?: Maybe<string>;
queryMatch?: Maybe<QueryMatchResult>;
type?: Maybe<DataProviderType>;
and?: Maybe<DataProviderResult[]>;
}
export interface QueryMatchResult {
field?: Maybe<string>;
displayField?: Maybe<string>;
value?: Maybe<string | string[]>;
displayValue?: Maybe<string>;
operator?: Maybe<string>;
}
export interface DateRangePickerResult {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
start?: Maybe<any>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
end?: Maybe<any>;
}
export interface EqlOptionsResult {
eventCategoryField?: Maybe<string>;
tiebreakerField?: Maybe<string>;
timestampField?: Maybe<string>;
query?: Maybe<string>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
size?: Maybe<any>;
}
export interface FilterTimelineResult {
exists?: Maybe<string>;
meta?: Maybe<FilterMetaTimelineResult>;
match_all?: Maybe<string>;
missing?: Maybe<string>;
query?: Maybe<string>;
range?: Maybe<string>;
script?: Maybe<string>;
}
export interface FilterMetaTimelineResult {
alias?: Maybe<string>;
controlledBy?: Maybe<string>;
disabled?: Maybe<boolean>;
field?: Maybe<string>;
formattedValue?: Maybe<string>;
index?: Maybe<string>;
key?: Maybe<string>;
negate?: Maybe<boolean>;
params?: Maybe<string>;
type?: Maybe<string>;
value?: Maybe<string>;
}
export interface SerializedFilterQueryResult {
filterQuery?: Maybe<SerializedKueryQueryResult>;
}
export interface SerializedKueryQueryResult {
kuery?: Maybe<KueryFilterQueryResult>;
serializedQuery?: Maybe<string>;
}
export interface KueryFilterQueryResult {
kind?: Maybe<string>;
expression?: Maybe<string>;
}
export interface TimelineResult {
columns?: Maybe<ColumnHeaderResult[]>;
created?: Maybe<number>;
createdBy?: Maybe<string>;
dataProviders?: Maybe<DataProviderResult[]>;
dataViewId?: Maybe<string>;
dateRange?: Maybe<DateRangePickerResult>;
description?: Maybe<string>;
eqlOptions?: Maybe<EqlOptionsResult>;
eventIdToNoteIds?: Maybe<NoteResult[]>;
eventType?: Maybe<string>;
excludedRowRendererIds?: Maybe<RowRendererId[]>;
favorite?: Maybe<FavoriteTimelineResult[]>;
filters?: Maybe<FilterTimelineResult[]>;
kqlMode?: Maybe<string>;
kqlQuery?: Maybe<SerializedFilterQueryResult>;
indexNames?: Maybe<string[]>;
notes?: Maybe<NoteResult[]>;
noteIds?: Maybe<string[]>;
pinnedEventIds?: Maybe<string[]>;
pinnedEventsSaveObject?: Maybe<PinnedEvent[]>;
savedQueryId?: Maybe<string>;
savedObjectId: string;
sort?: Maybe<Sort>;
status?: Maybe<TimelineStatus>;
title?: Maybe<string>;
templateTimelineId?: Maybe<string>;
templateTimelineVersion?: Maybe<number>;
timelineType?: Maybe<TimelineType>;
updated?: Maybe<number>;
updatedBy?: Maybe<string>;
version: string;
}
export interface ResponseTimeline {
code?: Maybe<number>;
message?: Maybe<string>;
timeline: TimelineResult;
}
export interface SortTimeline {
sortField: SortFieldTimeline;
sortOrder: Direction;
}
export interface ExportTimelineNotFoundError {
statusCode: number;
message: string;
}
export interface GetAllTimelineVariables {
pageInfo: PageInfoTimeline;
search?: Maybe<string>;
sort?: Maybe<SortTimeline>;
onlyUserFavorite?: Maybe<boolean>;
timelineType?: Maybe<TimelineType>;
status?: Maybe<TimelineStatus>;
}

View file

@ -8,7 +8,6 @@ export { IS_OPERATOR, EXISTS_OPERATOR } from '@kbn/timelines-plugin/common';
export type {
QueryOperator,
DataProviderType,
QueryMatch,
DataProvider,
DataProvidersAnd,

View file

@ -5,447 +5,13 @@
* 2.0.
*/
import * as runtimeTypes from 'io-ts';
import { PositiveInteger } from '@kbn/securitysolution-io-ts-types';
import { stringEnum, unionWithNullType } from '../../utility_types';
import type { NoteResult, NoteSavedObject } from './note';
import { NoteSavedObjectToReturnRuntimeType } from './note';
import type { PinnedEvent } from './pinned_event';
import { PinnedEventToReturnSavedObjectRuntimeType } from './pinned_event';
import {
SavedObjectResolveAliasPurpose,
SavedObjectResolveAliasTargetId,
SavedObjectResolveOutcome,
} from '../../detection_engine/rule_schema';
import {
success,
success_count as successCount,
} from '../../detection_engine/schemas/common/schemas';
import { errorSchema } from '../../detection_engine/schemas/response/error_schema';
import type { Maybe } from '../../search_strategy';
import { Direction } from '../../search_strategy';
import type { ExpandedDetailType } from '../detail_panel';
export * from './cells';
export * from './columns';
export * from './data_provider';
export * from './rows';
export * from './store';
/*
* ColumnHeader Types
*/
const SavedColumnHeaderRuntimeType = runtimeTypes.partial({
aggregatable: unionWithNullType(runtimeTypes.boolean),
category: unionWithNullType(runtimeTypes.string),
columnHeaderType: unionWithNullType(runtimeTypes.string),
description: unionWithNullType(runtimeTypes.string),
example: unionWithNullType(runtimeTypes.string),
indexes: unionWithNullType(runtimeTypes.array(runtimeTypes.string)),
id: unionWithNullType(runtimeTypes.string),
name: unionWithNullType(runtimeTypes.string),
placeholder: unionWithNullType(runtimeTypes.string),
searchable: unionWithNullType(runtimeTypes.boolean),
type: unionWithNullType(runtimeTypes.string),
});
/*
* DataProvider Types
*/
const SavedDataProviderQueryMatchBasicRuntimeType = runtimeTypes.partial({
field: unionWithNullType(runtimeTypes.string),
displayField: unionWithNullType(runtimeTypes.string),
value: runtimeTypes.union([
runtimeTypes.null,
runtimeTypes.string,
runtimeTypes.array(runtimeTypes.string),
]),
displayValue: unionWithNullType(runtimeTypes.string),
operator: unionWithNullType(runtimeTypes.string),
});
const SavedDataProviderQueryMatchRuntimeType = runtimeTypes.partial({
id: unionWithNullType(runtimeTypes.string),
name: unionWithNullType(runtimeTypes.string),
enabled: unionWithNullType(runtimeTypes.boolean),
excluded: unionWithNullType(runtimeTypes.boolean),
kqlQuery: unionWithNullType(runtimeTypes.string),
queryMatch: unionWithNullType(SavedDataProviderQueryMatchBasicRuntimeType),
});
export enum DataProviderType {
default = 'default',
template = 'template',
}
export const DataProviderTypeLiteralRt = runtimeTypes.union([
runtimeTypes.literal(DataProviderType.default),
runtimeTypes.literal(DataProviderType.template),
]);
const SavedDataProviderRuntimeType = runtimeTypes.partial({
id: unionWithNullType(runtimeTypes.string),
name: unionWithNullType(runtimeTypes.string),
enabled: unionWithNullType(runtimeTypes.boolean),
excluded: unionWithNullType(runtimeTypes.boolean),
kqlQuery: unionWithNullType(runtimeTypes.string),
queryMatch: unionWithNullType(SavedDataProviderQueryMatchBasicRuntimeType),
and: unionWithNullType(runtimeTypes.array(SavedDataProviderQueryMatchRuntimeType)),
type: unionWithNullType(DataProviderTypeLiteralRt),
});
/*
* Filters Types
*/
const SavedFilterMetaRuntimeType = runtimeTypes.partial({
alias: unionWithNullType(runtimeTypes.string),
controlledBy: unionWithNullType(runtimeTypes.string),
disabled: unionWithNullType(runtimeTypes.boolean),
field: unionWithNullType(runtimeTypes.string),
formattedValue: unionWithNullType(runtimeTypes.string),
index: unionWithNullType(runtimeTypes.string),
key: unionWithNullType(runtimeTypes.string),
negate: unionWithNullType(runtimeTypes.boolean),
params: unionWithNullType(runtimeTypes.string),
type: unionWithNullType(runtimeTypes.string),
value: unionWithNullType(runtimeTypes.string),
});
const SavedFilterRuntimeType = runtimeTypes.partial({
exists: unionWithNullType(runtimeTypes.string),
meta: unionWithNullType(SavedFilterMetaRuntimeType),
match_all: unionWithNullType(runtimeTypes.string),
missing: unionWithNullType(runtimeTypes.string),
query: unionWithNullType(runtimeTypes.string),
range: unionWithNullType(runtimeTypes.string),
script: unionWithNullType(runtimeTypes.string),
});
/*
* eqlOptionsQuery -> filterQuery Types
*/
const EqlOptionsRuntimeType = runtimeTypes.partial({
eventCategoryField: unionWithNullType(runtimeTypes.string),
query: unionWithNullType(runtimeTypes.string),
tiebreakerField: unionWithNullType(runtimeTypes.string),
timestampField: unionWithNullType(runtimeTypes.string),
size: unionWithNullType(runtimeTypes.union([runtimeTypes.string, runtimeTypes.number])),
});
/*
* kqlQuery -> filterQuery Types
*/
const SavedKueryFilterQueryRuntimeType = runtimeTypes.partial({
kind: unionWithNullType(runtimeTypes.string),
expression: unionWithNullType(runtimeTypes.string),
});
const SavedSerializedFilterQueryQueryRuntimeType = runtimeTypes.partial({
kuery: unionWithNullType(SavedKueryFilterQueryRuntimeType),
serializedQuery: unionWithNullType(runtimeTypes.string),
});
const SavedFilterQueryQueryRuntimeType = runtimeTypes.partial({
filterQuery: unionWithNullType(SavedSerializedFilterQueryQueryRuntimeType),
});
/*
* DatePicker Range Types
*/
const SavedDateRangePickerRuntimeType = runtimeTypes.partial({
/* Before the change of all timestamp to ISO string the values of start and from
* attributes where a number. Specifically UNIX timestamps.
* To support old timeline's saved object we need to add the number io-ts type
*/
start: unionWithNullType(runtimeTypes.union([runtimeTypes.string, runtimeTypes.number])),
end: unionWithNullType(runtimeTypes.union([runtimeTypes.string, runtimeTypes.number])),
});
/*
* Favorite Types
*/
const SavedFavoriteRuntimeType = runtimeTypes.partial({
keySearch: unionWithNullType(runtimeTypes.string),
favoriteDate: unionWithNullType(runtimeTypes.number),
fullName: unionWithNullType(runtimeTypes.string),
userName: unionWithNullType(runtimeTypes.string),
});
/*
* Sort Types
*/
const SavedSortObject = runtimeTypes.partial({
columnId: unionWithNullType(runtimeTypes.string),
columnType: unionWithNullType(runtimeTypes.string),
sortDirection: unionWithNullType(runtimeTypes.string),
});
const SavedSortRuntimeType = runtimeTypes.union([
runtimeTypes.array(SavedSortObject),
SavedSortObject,
]);
export type Sort = runtimeTypes.TypeOf<typeof SavedSortRuntimeType>;
/*
* Timeline Statuses
*/
export enum TimelineStatus {
active = 'active',
draft = 'draft',
immutable = 'immutable',
}
export const TimelineStatusLiteralRt = runtimeTypes.union([
runtimeTypes.literal(TimelineStatus.active),
runtimeTypes.literal(TimelineStatus.draft),
runtimeTypes.literal(TimelineStatus.immutable),
]);
const TimelineStatusLiteralWithNullRt = unionWithNullType(TimelineStatusLiteralRt);
export type TimelineStatusLiteralWithNull = runtimeTypes.TypeOf<
typeof TimelineStatusLiteralWithNullRt
>;
export enum RowRendererId {
/** event.kind: signal */
alert = 'alert',
/** endpoint alerts (created on the endpoint) */
alerts = 'alerts',
auditd = 'auditd',
auditd_file = 'auditd_file',
library = 'library',
netflow = 'netflow',
plain = 'plain',
registry = 'registry',
suricata = 'suricata',
system = 'system',
system_dns = 'system_dns',
system_endgame_process = 'system_endgame_process',
system_file = 'system_file',
system_fim = 'system_fim',
system_security_event = 'system_security_event',
system_socket = 'system_socket',
threat_match = 'threat_match',
zeek = 'zeek',
}
export const RowRendererIdRuntimeType = stringEnum(RowRendererId, 'RowRendererId');
/**
* Timeline template type
*/
export enum TemplateTimelineType {
elastic = 'elastic',
custom = 'custom',
}
export const TemplateTimelineTypeLiteralRt = runtimeTypes.union([
runtimeTypes.literal(TemplateTimelineType.elastic),
runtimeTypes.literal(TemplateTimelineType.custom),
]);
export const TemplateTimelineTypeLiteralWithNullRt = unionWithNullType(
TemplateTimelineTypeLiteralRt
);
export type TemplateTimelineTypeLiteral = runtimeTypes.TypeOf<typeof TemplateTimelineTypeLiteralRt>;
export type TemplateTimelineTypeLiteralWithNull = runtimeTypes.TypeOf<
typeof TemplateTimelineTypeLiteralWithNullRt
>;
/*
* Timeline Types
*/
export enum TimelineType {
default = 'default',
template = 'template',
}
export const TimelineTypeLiteralRt = runtimeTypes.union([
runtimeTypes.literal(TimelineType.template),
runtimeTypes.literal(TimelineType.default),
]);
export const TimelineTypeLiteralWithNullRt = unionWithNullType(TimelineTypeLiteralRt);
export type TimelineTypeLiteral = runtimeTypes.TypeOf<typeof TimelineTypeLiteralRt>;
export type TimelineTypeLiteralWithNull = runtimeTypes.TypeOf<typeof TimelineTypeLiteralWithNullRt>;
export const SavedTimelineRuntimeType = runtimeTypes.partial({
columns: unionWithNullType(runtimeTypes.array(SavedColumnHeaderRuntimeType)),
dataProviders: unionWithNullType(runtimeTypes.array(SavedDataProviderRuntimeType)),
dataViewId: unionWithNullType(runtimeTypes.string),
description: unionWithNullType(runtimeTypes.string),
eqlOptions: unionWithNullType(EqlOptionsRuntimeType),
eventType: unionWithNullType(runtimeTypes.string),
excludedRowRendererIds: unionWithNullType(runtimeTypes.array(RowRendererIdRuntimeType)),
favorite: unionWithNullType(runtimeTypes.array(SavedFavoriteRuntimeType)),
filters: unionWithNullType(runtimeTypes.array(SavedFilterRuntimeType)),
indexNames: unionWithNullType(runtimeTypes.array(runtimeTypes.string)),
kqlMode: unionWithNullType(runtimeTypes.string),
kqlQuery: unionWithNullType(SavedFilterQueryQueryRuntimeType),
title: unionWithNullType(runtimeTypes.string),
templateTimelineId: unionWithNullType(runtimeTypes.string),
templateTimelineVersion: unionWithNullType(runtimeTypes.number),
timelineType: unionWithNullType(TimelineTypeLiteralRt),
dateRange: unionWithNullType(SavedDateRangePickerRuntimeType),
savedQueryId: unionWithNullType(runtimeTypes.string),
sort: unionWithNullType(SavedSortRuntimeType),
status: unionWithNullType(TimelineStatusLiteralRt),
created: unionWithNullType(runtimeTypes.number),
createdBy: unionWithNullType(runtimeTypes.string),
updated: unionWithNullType(runtimeTypes.number),
updatedBy: unionWithNullType(runtimeTypes.string),
});
export type SavedTimeline = runtimeTypes.TypeOf<typeof SavedTimelineRuntimeType>;
export type SavedTimelineWithSavedObjectId = SavedTimeline & { savedObjectId?: string | null };
/**
* This type represents a timeline type stored in a saved object that does not include any fields that reference
* other saved objects.
*/
export type TimelineWithoutExternalRefs = Omit<SavedTimeline, 'dataViewId' | 'savedQueryId'>;
/*
* Timeline IDs
*/
export enum TimelineId {
active = 'timeline-1',
casePage = 'timeline-case',
test = 'timeline-test', // Reserved for testing purposes
detectionsAlertDetailsPage = 'detections-alert-details-page',
}
export const TimelineSavedToReturnObjectRuntimeType = runtimeTypes.intersection([
SavedTimelineRuntimeType,
runtimeTypes.type({
savedObjectId: runtimeTypes.string,
version: runtimeTypes.string,
}),
runtimeTypes.partial({
eventIdToNoteIds: runtimeTypes.array(NoteSavedObjectToReturnRuntimeType),
noteIds: runtimeTypes.array(runtimeTypes.string),
notes: runtimeTypes.array(NoteSavedObjectToReturnRuntimeType),
pinnedEventIds: runtimeTypes.array(runtimeTypes.string),
pinnedEventsSaveObject: runtimeTypes.array(PinnedEventToReturnSavedObjectRuntimeType),
}),
]);
export type TimelineSavedObject = runtimeTypes.TypeOf<
typeof TimelineSavedToReturnObjectRuntimeType
>;
export const SingleTimelineResponseType = runtimeTypes.type({
data: runtimeTypes.type({
getOneTimeline: TimelineSavedToReturnObjectRuntimeType,
}),
});
export type SingleTimelineResponse = runtimeTypes.TypeOf<typeof SingleTimelineResponseType>;
/** Resolved Timeline Response */
export const ResolvedTimelineSavedObjectToReturnObjectRuntimeType = runtimeTypes.intersection([
runtimeTypes.type({
timeline: TimelineSavedToReturnObjectRuntimeType,
outcome: SavedObjectResolveOutcome,
}),
runtimeTypes.partial({
alias_target_id: SavedObjectResolveAliasTargetId,
alias_purpose: SavedObjectResolveAliasPurpose,
}),
]);
export type ResolvedTimelineWithOutcomeSavedObject = runtimeTypes.TypeOf<
typeof ResolvedTimelineSavedObjectToReturnObjectRuntimeType
>;
export const ResolvedSingleTimelineResponseType = runtimeTypes.type({
data: ResolvedTimelineSavedObjectToReturnObjectRuntimeType,
});
export type SingleTimelineResolveResponse = runtimeTypes.TypeOf<
typeof ResolvedSingleTimelineResponseType
>;
/**
* All Timeline Saved object type with metadata
*/
export const TimelineResponseType = runtimeTypes.type({
data: runtimeTypes.type({
persistTimeline: runtimeTypes.intersection([
runtimeTypes.partial({
code: unionWithNullType(runtimeTypes.number),
message: unionWithNullType(runtimeTypes.string),
}),
runtimeTypes.type({
timeline: TimelineSavedToReturnObjectRuntimeType,
}),
]),
}),
});
export const TimelineErrorResponseType = runtimeTypes.type({
status_code: runtimeTypes.number,
message: runtimeTypes.string,
});
export type TimelineErrorResponse = runtimeTypes.TypeOf<typeof TimelineErrorResponseType>;
export type TimelineResponse = runtimeTypes.TypeOf<typeof TimelineResponseType>;
/**
* Import/export timelines
*/
export type ExportedGlobalNotes = Array<Exclude<NoteSavedObject, 'eventId'>>;
export type ExportedEventNotes = NoteSavedObject[];
export interface ExportedNotes {
eventNotes: ExportedEventNotes;
globalNotes: ExportedGlobalNotes;
}
export type ExportedTimelines = TimelineSavedObject &
ExportedNotes & {
pinnedEventIds: string[];
};
export interface ExportTimelineNotFoundError {
statusCode: number;
message: string;
}
export const importTimelineResultSchema = runtimeTypes.exact(
runtimeTypes.type({
success,
success_count: successCount,
timelines_installed: PositiveInteger,
timelines_updated: PositiveInteger,
errors: runtimeTypes.array(errorSchema),
})
);
export type ImportTimelineResultSchema = runtimeTypes.TypeOf<typeof importTimelineResultSchema>;
export type TimelineEventsType = 'all' | 'raw' | 'alert' | 'signal' | 'custom' | 'eql';
export enum TimelineTabs {
query = 'query',
graph = 'graph',
notes = 'notes',
pinned = 'pinned',
eql = 'eql',
session = 'session',
securityAssistant = 'securityAssistant',
}
import type { ExpandedDetailType } from '../detail_panel';
/**
* Used for scrolling top inside a tab. Especially when swiching tabs.
@ -463,229 +29,25 @@ export type ToggleDetailPanel = ExpandedDetailType & {
id: string;
};
export const pageInfoTimeline = runtimeTypes.type({
pageIndex: runtimeTypes.number,
pageSize: runtimeTypes.number,
});
export enum SortFieldTimeline {
title = 'title',
description = 'description',
updated = 'updated',
created = 'created',
export enum TimelineTabs {
query = 'query',
graph = 'graph',
notes = 'notes',
pinned = 'pinned',
eql = 'eql',
session = 'session',
securityAssistant = 'securityAssistant',
}
export const sortFieldTimeline = runtimeTypes.union([
runtimeTypes.literal(SortFieldTimeline.title),
runtimeTypes.literal(SortFieldTimeline.description),
runtimeTypes.literal(SortFieldTimeline.updated),
runtimeTypes.literal(SortFieldTimeline.created),
]);
/*
* Timeline IDs
*/
export const direction = runtimeTypes.union([
runtimeTypes.literal(Direction.asc),
runtimeTypes.literal(Direction.desc),
]);
export const sortTimeline = runtimeTypes.type({
sortField: sortFieldTimeline,
sortOrder: direction,
});
const favoriteTimelineResult = runtimeTypes.partial({
fullName: unionWithNullType(runtimeTypes.string),
userName: unionWithNullType(runtimeTypes.string),
favoriteDate: unionWithNullType(runtimeTypes.number),
});
export type FavoriteTimelineResult = runtimeTypes.TypeOf<typeof favoriteTimelineResult>;
export const responseFavoriteTimeline = runtimeTypes.partial({
savedObjectId: runtimeTypes.string,
version: runtimeTypes.string,
code: unionWithNullType(runtimeTypes.number),
message: unionWithNullType(runtimeTypes.string),
templateTimelineId: unionWithNullType(runtimeTypes.string),
templateTimelineVersion: unionWithNullType(runtimeTypes.number),
timelineType: unionWithNullType(TimelineTypeLiteralRt),
favorite: unionWithNullType(runtimeTypes.array(favoriteTimelineResult)),
});
export type ResponseFavoriteTimeline = runtimeTypes.TypeOf<typeof responseFavoriteTimeline>;
export const getTimelinesArgs = runtimeTypes.partial({
onlyUserFavorite: unionWithNullType(runtimeTypes.boolean),
pageInfo: unionWithNullType(pageInfoTimeline),
search: unionWithNullType(runtimeTypes.string),
sort: unionWithNullType(sortTimeline),
status: unionWithNullType(TimelineStatusLiteralRt),
timelineType: unionWithNullType(TimelineTypeLiteralRt),
});
export type GetTimelinesArgs = runtimeTypes.TypeOf<typeof getTimelinesArgs>;
const responseTimelines = runtimeTypes.type({
timeline: runtimeTypes.array(TimelineSavedToReturnObjectRuntimeType),
totalCount: runtimeTypes.number,
});
export type ResponseTimelines = runtimeTypes.TypeOf<typeof responseTimelines>;
export const allTimelinesResponse = runtimeTypes.intersection([
responseTimelines,
runtimeTypes.type({
defaultTimelineCount: runtimeTypes.number,
templateTimelineCount: runtimeTypes.number,
elasticTemplateTimelineCount: runtimeTypes.number,
customTemplateTimelineCount: runtimeTypes.number,
favoriteCount: runtimeTypes.number,
}),
]);
export type AllTimelinesResponse = runtimeTypes.TypeOf<typeof allTimelinesResponse>;
export interface PageInfoTimeline {
pageIndex: number;
pageSize: number;
export enum TimelineId {
active = 'timeline-1',
casePage = 'timeline-case',
test = 'timeline-test', // Reserved for testing purposes
detectionsAlertDetailsPage = 'detections-alert-details-page',
}
export interface ColumnHeaderResult {
aggregatable?: Maybe<boolean>;
category?: Maybe<string>;
columnHeaderType?: Maybe<string>;
description?: Maybe<string>;
example?: Maybe<string | number>;
indexes?: Maybe<string[]>;
id?: Maybe<string>;
name?: Maybe<string>;
placeholder?: Maybe<string>;
searchable?: Maybe<boolean>;
type?: Maybe<string>;
}
export interface DataProviderResult {
id?: Maybe<string>;
name?: Maybe<string>;
enabled?: Maybe<boolean>;
excluded?: Maybe<boolean>;
kqlQuery?: Maybe<string>;
queryMatch?: Maybe<QueryMatchResult>;
type?: Maybe<DataProviderType>;
and?: Maybe<DataProviderResult[]>;
}
export interface QueryMatchResult {
field?: Maybe<string>;
displayField?: Maybe<string>;
value?: Maybe<string | string[]>;
displayValue?: Maybe<string>;
operator?: Maybe<string>;
}
export interface DateRangePickerResult {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
start?: Maybe<any>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
end?: Maybe<any>;
}
export interface EqlOptionsResult {
eventCategoryField?: Maybe<string>;
tiebreakerField?: Maybe<string>;
timestampField?: Maybe<string>;
query?: Maybe<string>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
size?: Maybe<any>;
}
export interface FilterTimelineResult {
exists?: Maybe<string>;
meta?: Maybe<FilterMetaTimelineResult>;
match_all?: Maybe<string>;
missing?: Maybe<string>;
query?: Maybe<string>;
range?: Maybe<string>;
script?: Maybe<string>;
}
export interface FilterMetaTimelineResult {
alias?: Maybe<string>;
controlledBy?: Maybe<string>;
disabled?: Maybe<boolean>;
field?: Maybe<string>;
formattedValue?: Maybe<string>;
index?: Maybe<string>;
key?: Maybe<string>;
negate?: Maybe<boolean>;
params?: Maybe<string>;
type?: Maybe<string>;
value?: Maybe<string>;
}
export interface SerializedFilterQueryResult {
filterQuery?: Maybe<SerializedKueryQueryResult>;
}
export interface SerializedKueryQueryResult {
kuery?: Maybe<KueryFilterQueryResult>;
serializedQuery?: Maybe<string>;
}
export interface KueryFilterQueryResult {
kind?: Maybe<string>;
expression?: Maybe<string>;
}
export interface TimelineResult {
columns?: Maybe<ColumnHeaderResult[]>;
created?: Maybe<number>;
createdBy?: Maybe<string>;
dataProviders?: Maybe<DataProviderResult[]>;
dataViewId?: Maybe<string>;
dateRange?: Maybe<DateRangePickerResult>;
description?: Maybe<string>;
eqlOptions?: Maybe<EqlOptionsResult>;
eventIdToNoteIds?: Maybe<NoteResult[]>;
eventType?: Maybe<string>;
excludedRowRendererIds?: Maybe<RowRendererId[]>;
favorite?: Maybe<FavoriteTimelineResult[]>;
filters?: Maybe<FilterTimelineResult[]>;
kqlMode?: Maybe<string>;
kqlQuery?: Maybe<SerializedFilterQueryResult>;
indexNames?: Maybe<string[]>;
notes?: Maybe<NoteResult[]>;
noteIds?: Maybe<string[]>;
pinnedEventIds?: Maybe<string[]>;
pinnedEventsSaveObject?: Maybe<PinnedEvent[]>;
savedQueryId?: Maybe<string>;
savedObjectId: string;
sort?: Maybe<Sort>;
status?: Maybe<TimelineStatus>;
title?: Maybe<string>;
templateTimelineId?: Maybe<string>;
templateTimelineVersion?: Maybe<number>;
timelineType?: Maybe<TimelineType>;
updated?: Maybe<number>;
updatedBy?: Maybe<string>;
version: string;
}
export interface ResponseTimeline {
code?: Maybe<number>;
message?: Maybe<string>;
timeline: TimelineResult;
}
export interface SortTimeline {
sortField: SortFieldTimeline;
sortOrder: Direction;
}
export interface GetAllTimelineVariables {
pageInfo: PageInfoTimeline;
search?: Maybe<string>;
sort?: Maybe<SortTimeline>;
onlyUserFavorite?: Maybe<boolean>;
timelineType?: Maybe<TimelineType>;
status?: Maybe<TimelineStatus>;
}
export type TimelineEventsType = 'all' | 'raw' | 'alert' | 'signal' | 'custom' | 'eql';

View file

@ -97,6 +97,22 @@ export const sortNoteRt = runtimeTypes.type({
export type SortNote = runtimeTypes.TypeOf<typeof sortNoteRt>;
export const NoteServerRepresentation = runtimeTypes.intersection([
runtimeTypes.type({
timelineId: unionWithNullType(runtimeTypes.string),
}),
runtimeTypes.partial({
eventId: unionWithNullType(runtimeTypes.string),
note: unionWithNullType(runtimeTypes.string),
created: unionWithNullType(runtimeTypes.number),
createdBy: unionWithNullType(runtimeTypes.string),
updated: unionWithNullType(runtimeTypes.number),
updatedBy: unionWithNullType(runtimeTypes.string),
}),
]);
export type NoteServerRepresentationType = runtimeTypes.TypeOf<typeof NoteServerRepresentation>;
export interface NoteResult {
eventId?: Maybe<string>;

View file

@ -4,4 +4,22 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export type { RowRenderer } from '@kbn/timelines-plugin/common';
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
import type { RowRendererId } from '../api';
export interface RowRenderer {
id: RowRendererId;
isInstance: (data: Ecs) => boolean;
renderRow: ({
contextId,
data,
isDraggable,
scopeId,
}: {
contextId?: string;
data: Ecs;
isDraggable: boolean;
scopeId: string;
}) => React.ReactNode;
}

View file

@ -0,0 +1,259 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import * as runtimeTypes from 'io-ts';
import { stringEnum, unionWithNullType } from '../../utility_types';
/*
* ColumnHeader Types
*/
const SavedColumnHeaderRuntimeType = runtimeTypes.partial({
aggregatable: unionWithNullType(runtimeTypes.boolean),
category: unionWithNullType(runtimeTypes.string),
columnHeaderType: unionWithNullType(runtimeTypes.string),
description: unionWithNullType(runtimeTypes.string),
example: unionWithNullType(runtimeTypes.string),
indexes: unionWithNullType(runtimeTypes.array(runtimeTypes.string)),
id: unionWithNullType(runtimeTypes.string),
name: unionWithNullType(runtimeTypes.string),
placeholder: unionWithNullType(runtimeTypes.string),
searchable: unionWithNullType(runtimeTypes.boolean),
type: unionWithNullType(runtimeTypes.string),
});
/*
* DataProvider Types
*/
const SavedDataProviderQueryMatchBasicRuntimeType = runtimeTypes.partial({
field: unionWithNullType(runtimeTypes.string),
displayField: unionWithNullType(runtimeTypes.string),
value: runtimeTypes.union([
runtimeTypes.null,
runtimeTypes.string,
runtimeTypes.array(runtimeTypes.string),
]),
displayValue: unionWithNullType(runtimeTypes.string),
operator: unionWithNullType(runtimeTypes.string),
});
const SavedDataProviderQueryMatchRuntimeType = runtimeTypes.partial({
id: unionWithNullType(runtimeTypes.string),
name: unionWithNullType(runtimeTypes.string),
enabled: unionWithNullType(runtimeTypes.boolean),
excluded: unionWithNullType(runtimeTypes.boolean),
kqlQuery: unionWithNullType(runtimeTypes.string),
queryMatch: unionWithNullType(SavedDataProviderQueryMatchBasicRuntimeType),
});
enum DataProviderType {
default = 'default',
template = 'template',
}
const DataProviderTypeLiteralRt = runtimeTypes.union([
runtimeTypes.literal(DataProviderType.default),
runtimeTypes.literal(DataProviderType.template),
]);
const SavedDataProviderRuntimeType = runtimeTypes.partial({
id: unionWithNullType(runtimeTypes.string),
name: unionWithNullType(runtimeTypes.string),
enabled: unionWithNullType(runtimeTypes.boolean),
excluded: unionWithNullType(runtimeTypes.boolean),
kqlQuery: unionWithNullType(runtimeTypes.string),
queryMatch: unionWithNullType(SavedDataProviderQueryMatchBasicRuntimeType),
and: unionWithNullType(runtimeTypes.array(SavedDataProviderQueryMatchRuntimeType)),
type: unionWithNullType(DataProviderTypeLiteralRt),
});
/*
* Filters Types
*/
const SavedFilterMetaRuntimeType = runtimeTypes.partial({
alias: unionWithNullType(runtimeTypes.string),
controlledBy: unionWithNullType(runtimeTypes.string),
disabled: unionWithNullType(runtimeTypes.boolean),
field: unionWithNullType(runtimeTypes.string),
formattedValue: unionWithNullType(runtimeTypes.string),
index: unionWithNullType(runtimeTypes.string),
key: unionWithNullType(runtimeTypes.string),
negate: unionWithNullType(runtimeTypes.boolean),
params: unionWithNullType(runtimeTypes.string),
type: unionWithNullType(runtimeTypes.string),
value: unionWithNullType(runtimeTypes.string),
});
const SavedFilterRuntimeType = runtimeTypes.partial({
exists: unionWithNullType(runtimeTypes.string),
meta: unionWithNullType(SavedFilterMetaRuntimeType),
match_all: unionWithNullType(runtimeTypes.string),
missing: unionWithNullType(runtimeTypes.string),
query: unionWithNullType(runtimeTypes.string),
range: unionWithNullType(runtimeTypes.string),
script: unionWithNullType(runtimeTypes.string),
});
/*
* eqlOptionsQuery -> filterQuery Types
*/
const EqlOptionsRuntimeType = runtimeTypes.partial({
eventCategoryField: unionWithNullType(runtimeTypes.string),
query: unionWithNullType(runtimeTypes.string),
tiebreakerField: unionWithNullType(runtimeTypes.string),
timestampField: unionWithNullType(runtimeTypes.string),
size: unionWithNullType(runtimeTypes.union([runtimeTypes.string, runtimeTypes.number])),
});
/*
* kqlQuery -> filterQuery Types
*/
const SavedKueryFilterQueryRuntimeType = runtimeTypes.partial({
kind: unionWithNullType(runtimeTypes.string),
expression: unionWithNullType(runtimeTypes.string),
});
const SavedSerializedFilterQueryQueryRuntimeType = runtimeTypes.partial({
kuery: unionWithNullType(SavedKueryFilterQueryRuntimeType),
serializedQuery: unionWithNullType(runtimeTypes.string),
});
const SavedFilterQueryQueryRuntimeType = runtimeTypes.partial({
filterQuery: unionWithNullType(SavedSerializedFilterQueryQueryRuntimeType),
});
/*
* DatePicker Range Types
*/
const SavedDateRangePickerRuntimeType = runtimeTypes.partial({
/* Before the change of all timestamp to ISO string the values of start and from
* attributes where a number. Specifically UNIX timestamps.
* To support old timeline's saved object we need to add the number io-ts type
*/
start: unionWithNullType(runtimeTypes.union([runtimeTypes.string, runtimeTypes.number])),
end: unionWithNullType(runtimeTypes.union([runtimeTypes.string, runtimeTypes.number])),
});
/*
* Favorite Types
*/
const SavedFavoriteRuntimeType = runtimeTypes.partial({
keySearch: unionWithNullType(runtimeTypes.string),
favoriteDate: unionWithNullType(runtimeTypes.number),
fullName: unionWithNullType(runtimeTypes.string),
userName: unionWithNullType(runtimeTypes.string),
});
/*
* Sort Types
*/
const SavedSortObject = runtimeTypes.partial({
columnId: unionWithNullType(runtimeTypes.string),
columnType: unionWithNullType(runtimeTypes.string),
sortDirection: unionWithNullType(runtimeTypes.string),
});
const SavedSortRuntimeType = runtimeTypes.union([
runtimeTypes.array(SavedSortObject),
SavedSortObject,
]);
/*
* Timeline Statuses
*/
export enum SavedObjectTimelineStatus {
active = 'active',
draft = 'draft',
immutable = 'immutable',
}
const TimelineStatusLiteralRt = runtimeTypes.union([
runtimeTypes.literal(SavedObjectTimelineStatus.active),
runtimeTypes.literal(SavedObjectTimelineStatus.draft),
runtimeTypes.literal(SavedObjectTimelineStatus.immutable),
]);
enum RowRendererId {
/** event.kind: signal */
alert = 'alert',
/** endpoint alerts (created on the endpoint) */
alerts = 'alerts',
auditd = 'auditd',
auditd_file = 'auditd_file',
library = 'library',
netflow = 'netflow',
plain = 'plain',
registry = 'registry',
suricata = 'suricata',
system = 'system',
system_dns = 'system_dns',
system_endgame_process = 'system_endgame_process',
system_file = 'system_file',
system_fim = 'system_fim',
system_security_event = 'system_security_event',
system_socket = 'system_socket',
threat_match = 'threat_match',
zeek = 'zeek',
}
const RowRendererIdRuntimeType = stringEnum(RowRendererId, 'RowRendererId');
/*
* Saved Object Timeline Types
*/
export enum SavedObjectTimelineType {
default = 'default',
template = 'template',
}
const SavedObjectTimelineTypeLiteralRt = runtimeTypes.union([
runtimeTypes.literal(SavedObjectTimelineType.template),
runtimeTypes.literal(SavedObjectTimelineType.default),
]);
export const SavedObjectTimelineTypeLiteralWithNullRt = unionWithNullType(
SavedObjectTimelineTypeLiteralRt
);
export const SavedObjectTimelineRuntimeType = runtimeTypes.partial({
columns: unionWithNullType(runtimeTypes.array(SavedColumnHeaderRuntimeType)),
dataProviders: unionWithNullType(runtimeTypes.array(SavedDataProviderRuntimeType)),
dataViewId: unionWithNullType(runtimeTypes.string),
description: unionWithNullType(runtimeTypes.string),
eqlOptions: unionWithNullType(EqlOptionsRuntimeType),
eventType: unionWithNullType(runtimeTypes.string),
excludedRowRendererIds: unionWithNullType(runtimeTypes.array(RowRendererIdRuntimeType)),
favorite: unionWithNullType(runtimeTypes.array(SavedFavoriteRuntimeType)),
filters: unionWithNullType(runtimeTypes.array(SavedFilterRuntimeType)),
indexNames: unionWithNullType(runtimeTypes.array(runtimeTypes.string)),
kqlMode: unionWithNullType(runtimeTypes.string),
kqlQuery: unionWithNullType(SavedFilterQueryQueryRuntimeType),
title: unionWithNullType(runtimeTypes.string),
templateTimelineId: unionWithNullType(runtimeTypes.string),
templateTimelineVersion: unionWithNullType(runtimeTypes.number),
timelineType: unionWithNullType(SavedObjectTimelineTypeLiteralRt),
dateRange: unionWithNullType(SavedDateRangePickerRuntimeType),
savedQueryId: unionWithNullType(runtimeTypes.string),
sort: unionWithNullType(SavedSortRuntimeType),
status: unionWithNullType(TimelineStatusLiteralRt),
created: unionWithNullType(runtimeTypes.number),
createdBy: unionWithNullType(runtimeTypes.string),
updated: unionWithNullType(runtimeTypes.number),
updatedBy: unionWithNullType(runtimeTypes.string),
});
type SavedObjectTimeline = runtimeTypes.TypeOf<typeof SavedObjectTimelineRuntimeType>;
/**
* This type represents a timeline type stored in a saved object that does not include any fields that reference
* other saved objects.
*/
export type SavedObjectTimelineWithoutExternalRefs = Omit<
SavedObjectTimeline,
'dataViewId' | 'savedQueryId'
>;

View file

@ -6,7 +6,7 @@
*/
import type { Filter } from '@kbn/es-query';
import type { RowRendererId, TimelineTypeLiteral } from '.';
import type { RowRendererId, TimelineTypeLiteral } from './api';
import type { Direction } from '../../search_strategy';
import type { ExpandedDetailTimeline } from '../detail_panel';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type { TimelineResponse } from '../../common/types/timeline';
import type { TimelineResponse } from '../../common/types/timeline/api';
export interface Timeline {
title: string;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type { TimelineResponse } from '../../../common/types/timeline';
import type { TimelineResponse } from '../../../common/types/timeline/api';
import type { CompleteTimeline } from '../../objects/timeline';
import { rootRequest } from '../common';

View file

@ -17,7 +17,8 @@ import { inputsActions } from '../../common/store/inputs';
import { InputsModelId } from '../../common/store/inputs/constants';
import type { TimeRange } from '../../common/store/inputs/model';
import { SourcererScopeName } from '../../common/store/sourcerer/model';
import { TimelineTabs, TimelineId, TimelineType } from '../../../common/types';
import { TimelineTabs, TimelineId } from '../../../common/types/timeline';
import { TimelineType } from '../../../common/types/timeline/api';
import { ACTION_INVESTIGATE_IN_TIMELINE } from '../../detections/components/alerts_table/translations';
import type { DataProvider } from '../../timelines/components/timeline/data_providers/data_provider';
import { useCreateTimeline } from '../../timelines/components/timeline/properties/use_create_timeline';

View file

@ -26,7 +26,8 @@ import {
ADDED_TO_TIMELINE_TEMPLATE_MESSAGE,
} from '../../hooks/translations';
import { displaySuccessToast, useStateToaster } from '../toasters';
import { TimelineId, TimelineType } from '../../../../common/types/timeline';
import { TimelineId } from '../../../../common/types/timeline';
import { TimelineType } from '../../../../common/types/timeline/api';
import {
addProviderToTimeline,
fieldWasDroppedOnTimelineColumns,

View file

@ -18,7 +18,8 @@ import { updateProviders, setFilters } from '../../../../timelines/store/timelin
import { sourcererActions } from '../../../store/actions';
import { SourcererScopeName } from '../../../store/sourcerer/model';
import type { DataProvider } from '../../../../../common/types';
import { TimelineId, TimelineType } from '../../../../../common/types/timeline';
import { TimelineId } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
import { useCreateTimeline } from '../../../../timelines/components/timeline/properties/use_create_timeline';
import { ACTION_INVESTIGATE_IN_TIMELINE } from '../../../../detections/components/alerts_table/translations';
import { useDeepEqualSelector } from '../../../hooks/use_selector';

View file

@ -13,7 +13,7 @@ import type { Filter } from '@kbn/es-query';
import { dataTableActions } from '@kbn/securitysolution-data-table';
import type { TableId } from '@kbn/securitysolution-data-table';
import type { CustomBulkAction } from '../../../../common/types';
import { RowRendererId } from '../../../../common/types/timeline';
import { RowRendererId } from '../../../../common/types/timeline/api';
import { StatefulEventsViewer } from '../events_viewer';
import { eventsDefaultModel } from '../events_viewer/default_model';
import { MatrixHistogram } from '../matrix_histogram';

View file

@ -23,7 +23,12 @@ import type { ConnectedProps } from 'react-redux';
import { connect, useDispatch, useSelector } from 'react-redux';
import { ThemeContext } from 'styled-components';
import type { Filter } from '@kbn/es-query';
import type { Direction, EntityType, RowRenderer } from '@kbn/timelines-plugin/common';
import type {
DeprecatedCellValueElementProps,
DeprecatedRowRenderer,
Direction,
EntityType,
} from '@kbn/timelines-plugin/common';
import { isEmpty } from 'lodash';
import { getEsQueryConfig } from '@kbn/data-plugin/common';
import type { EuiTheme } from '@kbn/kibana-react-plugin/common';
@ -37,6 +42,7 @@ import type {
SetEventsDeleted,
SetEventsLoading,
} from '../../../../common/types';
import type { RowRenderer } from '../../../../common/types/timeline';
import { InputsModelId } from '../../store/inputs/constants';
import type { State } from '../../store';
import { inputsActions } from '../../store/actions';
@ -580,8 +586,14 @@ const StatefulEventsViewerComponent: React.FC<EventsViewerProps & PropsFromRedux
data={nonDeletedEvents}
id={tableId}
loadPage={loadPage}
renderCellValue={renderCellValue}
rowRenderers={rowRenderers}
// TODO: migrate away from deprecated type
renderCellValue={
renderCellValue as (
props: DeprecatedCellValueElementProps
) => React.ReactNode
}
// TODO: migrate away from deprecated type
rowRenderers={rowRenderers as unknown as DeprecatedRowRenderer[]}
totalItems={totalCountMinusDeleted}
bulkActions={bulkActions}
fieldBrowserOptions={fieldBrowserOptions}

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { TimelineType } from '../../../../common/types';
import { TimelineType } from '../../../../common/types/timeline/api';
import { render, screen } from '@testing-library/react';
import React from 'react';
import { TestProviders } from '../../mock';

View file

@ -7,7 +7,7 @@
import React from 'react';
import { NotesButton } from '../../../timelines/components/timeline/properties/helpers';
import { TimelineType } from '../../../../common/types';
import { TimelineType } from '../../../../common/types/timeline/api';
import { useUserPrivileges } from '../user_privileges';
import * as i18n from './translations';
import { ActionIconItem } from './action_icon_item';

View file

@ -12,7 +12,7 @@ import { PinEventAction } from './pin_event_action';
import { useUserPrivileges } from '../user_privileges';
import { getEndpointPrivilegesInitialStateMock } from '../user_privileges/endpoint/mocks';
import { TestProviders } from '../../mock';
import { TimelineType } from '../../../../common/types';
import { TimelineType } from '../../../../common/types/timeline/api';
jest.mock('../user_privileges');
const useUserPrivilegesMock = useUserPrivileges as jest.Mock;

View file

@ -9,7 +9,7 @@ import React, { useMemo } from 'react';
import { EuiToolTip } from '@elastic/eui';
import { EventsTdContent } from '../../../timelines/components/timeline/styles';
import { eventHasNotes, getPinTooltip } from '../../../timelines/components/timeline/body/helpers';
import type { TimelineType } from '../../../../common/types';
import type { TimelineType } from '../../../../common/types/timeline/api';
import { useUserPrivileges } from '../user_privileges';
import { DEFAULT_ACTION_BUTTON_WIDTH } from '.';
import { Pin } from '../../../timelines/components/timeline/pin';

View file

@ -6,7 +6,7 @@
*/
import { isEmpty } from 'lodash/fp';
import type { TimelineTypeLiteral } from '../../../../common/types/timeline';
import type { TimelineTypeLiteral } from '../../../../common/types/timeline/api';
import { appendSearch } from './helpers';
export const getTimelineTabsUrl = (tabName: TimelineTypeLiteral, search?: string) =>

View file

@ -9,7 +9,7 @@ import { useMemo } from 'react';
import type { Filter } from '@kbn/es-query';
import { FILTERS, BooleanRelation, FilterStateStore } from '@kbn/es-query';
import type { QueryOperator, DataProvider } from '@kbn/timelines-plugin/common';
import { DataProviderType } from '@kbn/timelines-plugin/common';
import { DataProviderType } from '../../../../../../common/types/timeline/api';
import { replaceParamsQuery } from './replace_params_query';
import type { TimelineEventsDetailsItem } from '../../../../../../common/search_strategy';
import {

View file

@ -6,7 +6,7 @@
*/
import { renderHook } from '@testing-library/react-hooks';
import type { QueryOperator } from '@kbn/timelines-plugin/common';
import { DataProviderType } from '@kbn/timelines-plugin/common';
import { DataProviderType } from '../../../../../../common/types/timeline/api';
import { useInsightQuery } from './use_insight_query';
import { TestProviders } from '../../../../mock';
import type { UseInsightQuery, UseInsightQueryResult } from './use_insight_query';

View file

@ -9,7 +9,7 @@ import React, { useCallback, memo } from 'react';
import type { EuiSelectableOption, EuiMarkdownEditorUiPlugin } from '@elastic/eui';
import { EuiModalBody, EuiModalHeader, EuiCodeBlock } from '@elastic/eui';
import { TimelineType } from '../../../../../../common/types/timeline';
import { TimelineType } from '../../../../../../common/types/timeline/api';
import { SelectableTimeline } from '../../../../../timelines/components/timeline/selectable_timeline';
import type { OpenTimelineResult } from '../../../../../timelines/components/open_timeline/types';
import { getTimelineUrl, useFormatUrl } from '../../../link_to';

View file

@ -25,7 +25,8 @@ import type { EuiSuperSelectOption } from '@elastic/eui/src/components/form/supe
import { waitFor } from '@testing-library/dom';
import { useSourcererDataView } from '../../containers/sourcerer';
import { useSignalHelpers } from '../../containers/sourcerer/use_signal_helpers';
import { TimelineId, TimelineType } from '../../../../common/types';
import { TimelineId } from '../../../../common/types/timeline';
import { TimelineType } from '../../../../common/types/timeline/api';
import { DEFAULT_INDEX_PATTERN } from '../../../../common/constants';
import { sortWithExcludesAtEnd } from '../../../../common/utils/sourcerer';

View file

@ -20,7 +20,8 @@ import React, { useMemo } from 'react';
import * as i18n from './translations';
import { Blockquote, ResetButton } from './helpers';
import { UpdateDefaultDataViewModal } from './update_default_data_view_modal';
import { TimelineId, TimelineType } from '../../../../common/types';
import { TimelineId } from '../../../../common/types';
import { TimelineType } from '../../../../common/types/timeline/api';
import { timelineSelectors } from '../../../timelines/store/timeline';
import { useDeepEqualSelector } from '../../hooks/use_selector';
import { timelineDefaults } from '../../../timelines/store/timeline/defaults';

View file

@ -8,7 +8,7 @@
import { EuiIcon, EuiLink, EuiToolTip } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import React, { useMemo } from 'react';
import { TimelineType } from '../../../../common/types';
import { TimelineType } from '../../../../common/types/timeline/api';
import { Blockquote } from './helpers';
import * as i18n from './translations';

View file

@ -11,7 +11,8 @@ import type { AppLeaveHandler } from '@kbn/core-application-browser';
import { useHistory } from 'react-router-dom';
import { useShowTimelineForGivenPath } from '../../utils/timeline/use_show_timeline_for_path';
import type { TimelineId } from '../../../../common/types';
import { TimelineStatus, TimelineTabs } from '../../../../common/types';
import { TimelineTabs } from '../../../../common/types';
import { TimelineStatus } from '../../../../common/types/timeline/api';
import { useKibana } from '../../lib/kibana';
import { useDeepEqualSelector } from '../use_selector';
import { APP_ID, APP_PATH } from '../../../../common/constants';

View file

@ -12,7 +12,7 @@ import { useDispatch } from 'react-redux';
import { getPageRowIndex } from '@kbn/securitysolution-data-table';
import type { TimelineNonEcsData } from '../../../../common/search_strategy';
import type { DataProvider } from '../../../../common/types';
import { TimelineId } from '../../../../common/types';
import { TimelineId } from '../../../../common/types/timeline';
import { useGetMappedNonEcsValue } from '../../../timelines/components/timeline/body/data_driven_columns';
import {
EXISTS_OPERATOR,

View file

@ -16,7 +16,8 @@ import { flow, get, isEmpty, isString } from 'lodash/fp';
import memoizeOne from 'memoize-one';
import type { BrowserFields } from '../../../../common/search_strategy';
import type { DataProvider, DataProvidersAnd } from '../../../../common/types';
import { DataProviderType, EXISTS_OPERATOR } from '../../../../common/types';
import { DataProviderType } from '../../../../common/types/timeline/api';
import { EXISTS_OPERATOR } from '../../../../common/types/timeline';
export type PrimitiveOrArrayOfPrimitives =
| string

View file

@ -32,12 +32,8 @@ import {
VIEW_SELECTION,
} from '../../../common/constants';
import { networkModel } from '../../explore/network/store';
import {
TimelineType,
TimelineStatus,
TimelineTabs,
TimelineId,
} from '../../../common/types/timeline';
import { TimelineTabs, TimelineId } from '../../../common/types/timeline';
import { TimelineType, TimelineStatus } from '../../../common/types/timeline/api';
import { mockManagementState } from '../../management/store/reducer';
import type { ManagementState } from '../../management/types';
import { initialSourcererState, SourcererScopeName } from '../store/sourcerer/model';

View file

@ -9,13 +9,9 @@ import { FilterStateStore } from '@kbn/es-query';
import type { DataTableModel } from '@kbn/securitysolution-data-table';
import { VIEW_SELECTION } from '../../../common/constants';
import type { TimelineResult } from '../../../common/types/timeline';
import {
TimelineId,
TimelineType,
TimelineStatus,
TimelineTabs,
} from '../../../common/types/timeline';
import type { TimelineResult } from '../../../common/types/timeline/api';
import { TimelineId, TimelineTabs } from '../../../common/types/timeline';
import { TimelineType, TimelineStatus } from '../../../common/types/timeline/api';
import type { OpenTimelineResult } from '../../timelines/components/open_timeline/types';
import type { TimelineEventsDetailsItem } from '../../../common/search_strategy';

View file

@ -33,12 +33,8 @@ import {
import type { CreateTimeline, UpdateTimelineLoading } from './types';
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
import type { DataProvider } from '../../../../common/types/timeline';
import {
TimelineId,
TimelineType,
TimelineStatus,
TimelineTabs,
} from '../../../../common/types/timeline';
import { TimelineType, TimelineStatus } from '../../../../common/types/timeline/api';
import { TimelineId, TimelineTabs } from '../../../../common/types/timeline';
import type { ISearchStart } from '@kbn/data-plugin/public';
import { searchServiceMock } from '@kbn/data-plugin/public/search/mocks';
import { getTimelineTemplate } from '../../../timelines/containers/api';

View file

@ -41,8 +41,9 @@ import {
ALERT_NEW_TERMS,
ALERT_RULE_INDICES,
} from '../../../../common/field_maps/field_names';
import type { TimelineResult } from '../../../../common/types/timeline';
import { TimelineId, TimelineStatus, TimelineType } from '../../../../common/types/timeline';
import type { TimelineResult } from '../../../../common/types/timeline/api';
import { TimelineId } from '../../../../common/types/timeline';
import { TimelineStatus, TimelineType } from '../../../../common/types/timeline/api';
import { updateAlertStatus } from '../../containers/detection_engine/alerts/api';
import type {
SendAlertToTimelineActionProps,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { TimelineType } from '../../../../common/types/timeline';
import { TimelineType } from '../../../../common/types/timeline/api';
import type { Filter } from '@kbn/es-query';
import { FilterStateStore } from '@kbn/es-query';
import type { DataProvider } from '../../../timelines/components/timeline/data_providers/data_provider';

View file

@ -11,7 +11,7 @@ import type { Filter, KueryNode } from '@kbn/es-query';
import { FilterStateStore, fromKueryExpression } from '@kbn/es-query';
import type { TimelineEventsDetailsItem } from '../../../../common/search_strategy';
import { TimelineType } from '../../../../common/types/timeline';
import { TimelineType } from '../../../../common/types/timeline/api';
import type {
DataProvider,
DataProvidersAnd,

View file

@ -25,7 +25,8 @@ import { dispatchUpdateTimeline } from '../../../../timelines/components/open_ti
import { timelineActions } from '../../../../timelines/store/timeline';
import { useCreateTimeline } from '../../../../timelines/components/timeline/properties/use_create_timeline';
import { INVESTIGATE_BULK_IN_TIMELINE } from '../translations';
import { TimelineId, TimelineType } from '../../../../../common/types/timeline';
import { TimelineId } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
import { sendBulkEventsToTimelineAction } from '../actions';
import type { CreateTimelineProps } from '../types';
import type { SourcererScopeName } from '../../../../common/store/sourcerer/model';

View file

@ -18,7 +18,8 @@ import type { Filter } from '@kbn/es-query';
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
import { timelineDefaults } from '../../../../timelines/store/timeline/defaults';
import { useKibana } from '../../../../common/lib/kibana';
import { TimelineId, TimelineType } from '../../../../../common/types/timeline';
import { TimelineId } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
import { timelineActions, timelineSelectors } from '../../../../timelines/store/timeline';
import { sendAlertToTimelineAction } from '../actions';
import { dispatchUpdateTimeline } from '../../../../timelines/components/open_timeline/helpers';

View file

@ -14,7 +14,7 @@ import { TakeActionDropdown } from '.';
import { generateAlertDetailsDataMock } from '../../../common/components/event_details/__mocks__';
import { getDetectionAlertMock } from '../../../common/mock/mock_detection_alerts';
import type { TimelineEventsDetailsItem } from '../../../../common/search_strategy';
import { TimelineId } from '../../../../common/types';
import { TimelineId } from '../../../../common/types/timeline';
import { TestProviders } from '../../../common/mock';
import { mockTimelines } from '../../../common/mock/mock_timelines_plugin';
import { createStartServicesMock } from '../../../common/lib/kibana/kibana_react.mock';

View file

@ -12,7 +12,7 @@ import { ALERT_RULE_NAME, TIMESTAMP } from '@kbn/rule-data-utils';
import { EuiSpacer } from '@elastic/eui';
import { useDispatch } from 'react-redux';
import { timelineActions } from '../../../timelines/store/timeline';
import { TimelineId } from '../../../../common/types';
import { TimelineId } from '../../../../common/types/timeline';
import { useGetFieldsData } from '../../../common/hooks/use_get_fields_data';
import { useSourcererDataView } from '../../../common/containers/sourcerer';
import { SourcererScopeName } from '../../../common/store/sourcerer/model';

View file

@ -10,7 +10,7 @@ import styled from 'styled-components';
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
import { defaultRowRenderers } from '../../../../../../timelines/components/timeline/body/renderers';
import { getRowRenderer } from '../../../../../../timelines/components/timeline/body/renderers/get_row_renderer';
import { TimelineId } from '../../../../../../../common/types';
import { TimelineId } from '../../../../../../../common/types/timeline';
import { SummaryPanel } from '../wrappers';
import { ALERT_REASON_PANEL_TITLE } from '../translation';

View file

@ -10,7 +10,7 @@ import type { TimelineEventsDetailsItem } from '@kbn/timelines-plugin/common';
import React, { useCallback, useMemo } from 'react';
import { find } from 'lodash/fp';
import type { EuiFlexItemProps } from '@elastic/eui';
import { TimelineId } from '../../../../../../../common/types';
import { TimelineId } from '../../../../../../../common/types/timeline';
import { isAlertFromEndpointEvent } from '../../../../../../common/utils/endpoint_alert_check';
import { SummaryValueCell } from '../../../../../../common/components/event_details/table/summary_value_cell';
import { useRiskScore } from '../../../../../../explore/containers/risk_score';

View file

@ -10,7 +10,7 @@ import { EuiFlexGroup } from '@elastic/eui';
import type { TimelineEventsDetailsItem } from '@kbn/timelines-plugin/common';
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
import type { SearchHit } from '../../../../../../common/search_strategy';
import { TimelineId } from '../../../../../../common/types';
import { TimelineId } from '../../../../../../common/types/timeline';
import { useDetailPanel } from '../../../../../timelines/components/side_panel/hooks/use_detail_panel';
import { useGetUserCasesPermissions } from '../../../../../common/lib/kibana';
import type { SelectedDataView } from '../../../../../common/store/sourcerer/model';

View file

@ -21,7 +21,7 @@ import {
KIBANA_NAMESPACE,
} from '@kbn/rule-data-utils';
import type { SearchHit } from '../../../../../../../common/search_strategy';
import { TimelineId } from '../../../../../../../common/types';
import { TimelineId } from '../../../../../../../common/types/timeline';
import { SeverityBadge } from '../../../../../components/rules/severity_badge';
import { getEnrichedFieldInfo } from '../../../../../../common/components/event_details/helpers';
import type { SelectedDataView } from '../../../../../../common/store/sourcerer/model';

View file

@ -17,7 +17,8 @@ import {
getDataProviderAnd,
} from '../../../../common/components/event_details/table/use_action_cell_data_provider';
import type { DataProvider, QueryOperator } from '../../../../../common/types/timeline';
import { TimelineId, TimelineType } from '../../../../../common/types/timeline';
import { TimelineId } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
import { useCreateTimeline } from '../../../../timelines/components/timeline/properties/use_create_timeline';
import { updateProviders } from '../../../../timelines/store/timeline/actions';
import { sourcererSelectors } from '../../../../common/store';

View file

@ -9,7 +9,7 @@ import { EuiHorizontalRule, EuiText } from '@elastic/eui';
import React, { useCallback, useMemo, useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { SortFieldTimeline, TimelineType } from '../../../../common/types/timeline';
import { SortFieldTimeline, TimelineType } from '../../../../common/types/timeline/api';
import { useGetAllTimeline } from '../../../timelines/containers/all';
import {
queryTimelineById,

View file

@ -22,7 +22,7 @@ import type {
OpenTimelineResult,
} from '../../../timelines/components/open_timeline/types';
import { WithHoverActions } from '../../../common/components/with_hover_actions';
import { TimelineType } from '../../../../common/types/timeline';
import { TimelineType } from '../../../../common/types/timeline/api';
import { RecentTimelineCounts } from './counts';
import * as i18n from './translations';

View file

@ -10,7 +10,8 @@ import { useDispatch } from 'react-redux';
import { timelineDefaults } from '../timelines/store/timeline/defaults';
import { APP_UI_ID } from '../../common/constants';
import type { DataProvider } from '../../common/types';
import { TimelineId, TimelineType } from '../../common/types';
import { TimelineId } from '../../common/types/timeline';
import { TimelineType } from '../../common/types/timeline/api';
import { useDeepEqualSelector } from '../common/hooks/use_selector';
import { useKibana } from '../common/lib/kibana';
import { useStartTransaction } from '../common/lib/apm/use_start_transaction';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { DataProviderType } from '@kbn/timelines-plugin/common';
import { DataProviderType } from '../../../../common/types/timeline/api';
import { mockBrowserFields } from '../../../common/containers/source/mock';
import {

View file

@ -8,7 +8,7 @@
import { findIndex } from 'lodash/fp';
import type { EuiComboBoxOptionOption } from '@elastic/eui';
import { DataProviderType } from '@kbn/timelines-plugin/common';
import { DataProviderType } from '../../../../common/types/timeline/api';
import type { BrowserField, BrowserFields } from '../../../common/containers/source';
import { getAllFieldsByName } from '../../../common/containers/source';

View file

@ -16,7 +16,8 @@ import { timelineSelectors } from '../../../store/timeline';
import { setInsertTimeline, showTimeline } from '../../../store/timeline/actions';
import { useDeepEqualSelector } from '../../../../common/hooks/use_selector';
import { useGetUserCasesPermissions, useKibana } from '../../../../common/lib/kibana';
import { TimelineStatus, TimelineId, TimelineType } from '../../../../../common/types/timeline';
import { TimelineId } from '../../../../../common/types/timeline';
import { TimelineStatus, TimelineType } from '../../../../../common/types/timeline/api';
import { getCreateCaseUrl, getCaseDetailsUrl } from '../../../../common/components/link_to';
import { SecurityPageName } from '../../../../app/types';
import { timelineDefaults } from '../../../store/timeline/defaults';

View file

@ -12,7 +12,7 @@ import { isEmpty } from 'lodash/fp';
import styled from 'styled-components';
import { FormattedRelative } from '@kbn/i18n-react';
import { TimelineStatus, TimelineType } from '../../../../../common/types/timeline';
import { TimelineStatus, TimelineType } from '../../../../../common/types/timeline/api';
import { TimelineEventsCountBadge } from '../../../../common/hooks/use_timeline_events_count';
import {
ACTIVE_TIMELINE_BUTTON_CLASS_NAME,

View file

@ -26,12 +26,8 @@ import { FormattedRelative } from '@kbn/i18n-react';
import { getEsQueryConfig } from '@kbn/data-plugin/common';
import { InputsModelId } from '../../../../common/store/inputs/constants';
import { useDeepEqualSelector } from '../../../../common/hooks/use_selector';
import {
TimelineStatus,
TimelineTabs,
TimelineType,
TimelineId,
} from '../../../../../common/types/timeline';
import { TimelineTabs, TimelineId } from '../../../../../common/types/timeline';
import { TimelineStatus, TimelineType } from '../../../../../common/types/timeline/api';
import type { State } from '../../../../common/store';
import { timelineActions, timelineSelectors } from '../../../store/timeline';
import { timelineDefaults } from '../../../store/timeline/defaults';

View file

@ -7,7 +7,7 @@
import { createSelector } from 'reselect';
import { TimelineStatus } from '../../../../../common/types/timeline';
import { TimelineStatus } from '../../../../../common/types/timeline/api';
import { timelineSelectors } from '../../../store/timeline';
export const getTimelineStatusByIdSelector = () =>

View file

@ -7,7 +7,8 @@
import { createSelector } from 'reselect';
import { TimelineStatus, TimelineTabs } from '../../../../common/types/timeline';
import { TimelineTabs } from '../../../../common/types/timeline';
import { TimelineStatus } from '../../../../common/types/timeline/api';
import { timelineSelectors } from '../../store/timeline';
export const getTimelineShowStatusByIdSelector = () =>

View file

@ -10,7 +10,7 @@ import userEvent from '@testing-library/user-event';
import { FormattedIp } from '.';
import { TestProviders } from '../../../common/mock';
import { TimelineId, TimelineTabs } from '../../../../common/types';
import { TimelineId, TimelineTabs } from '../../../../common/types/timeline';
import { timelineActions } from '../../store/timeline';
import { activeTimeline } from '../../containers/active_timeline_context';
import { StatefulEventContext } from '../../../common/components/events_viewer/stateful_event_context';

View file

@ -10,7 +10,7 @@ import { mount } from 'enzyme';
import '../../../../common/mock/formatted_relative';
import { NoteCards } from '.';
import { TimelineStatus } from '../../../../../common/types/timeline';
import { TimelineStatus } from '../../../../../common/types/timeline/api';
import { TestProviders } from '../../../../common/mock';
import type { TimelineResultNote } from '../../open_timeline/types';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { TimelineStatus, TimelineType } from '../../../../../common/types/timeline';
import { TimelineStatus, TimelineType } from '../../../../../common/types/timeline/api';
export const mockTimeline = {
data: {

View file

@ -12,7 +12,7 @@ import { useParams } from 'react-router-dom';
import { DeleteTimelineModal } from './delete_timeline_modal';
import * as i18n from '../translations';
import { TimelineType } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
jest.mock('react-router-dom', () => {
const actual = jest.requireActual('react-router-dom');

View file

@ -12,7 +12,7 @@ import { isEmpty } from 'lodash/fp';
import { useParams } from 'react-router-dom';
import * as i18n from '../translations';
import { TimelineType } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
interface Props {
title?: string | null;

View file

@ -10,7 +10,7 @@ import React from 'react';
import { useParams } from 'react-router-dom';
import { DeleteTimelineModalOverlay } from '.';
import { TimelineType } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
import * as i18n from '../translations';
import { useAppToasts } from '../../../../common/hooks/use_app_toasts';

View file

@ -12,7 +12,7 @@ import { createGlobalStyle } from 'styled-components';
import { useParams } from 'react-router-dom';
import { DeleteTimelineModal, DELETE_TIMELINE_MODAL_WIDTH } from './delete_timeline_modal';
import type { DeleteTimelines } from '../types';
import { TimelineType } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
import { useAppToasts } from '../../../../common/hooks/use_app_toasts';
import * as i18n from '../translations';

View file

@ -9,7 +9,7 @@ import type { EuiBasicTable } from '@elastic/eui';
import { EuiContextMenuPanel, EuiContextMenuItem } from '@elastic/eui';
import React, { useCallback, useMemo } from 'react';
import { TimelineType } from '../../../../common/types/timeline';
import { TimelineType } from '../../../../common/types/timeline/api';
import * as i18n from './translations';
import type { DeleteTimelines, OpenTimelineResult } from './types';

View file

@ -9,7 +9,7 @@ import React, { useCallback, useEffect } from 'react';
import { useParams } from 'react-router-dom';
import * as i18n from '../translations';
import { TimelineType } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
import { useAppToasts } from '../../../../common/hooks/use_app_toasts';
import { exportSelectedTimeline } from '../../../containers/api';
import { downloadBlob } from '../../../../common/utils/download_blob';

View file

@ -40,7 +40,8 @@ import type { Note } from '../../../common/lib/note';
import moment from 'moment';
import sinon from 'sinon';
import type { KueryFilterQueryKind } from '../../../../common/types/timeline';
import { TimelineId, TimelineType, TimelineStatus } from '../../../../common/types/timeline';
import { TimelineId } from '../../../../common/types/timeline';
import { TimelineType, TimelineStatus } from '../../../../common/types/timeline/api';
import {
mockTimeline as mockSelectedTimeline,
mockTemplate as mockSelectedTemplate,

View file

@ -13,21 +13,20 @@ import type { Dispatch } from 'redux';
import deepMerge from 'deepmerge';
import { InputsModelId } from '../../../common/store/inputs/constants';
import type { ColumnHeaderOptions } from '../../../../common/types/timeline';
import type {
ColumnHeaderOptions,
TimelineResult,
SingleTimelineResolveResponse,
ColumnHeaderResult,
FilterTimelineResult,
DataProviderResult,
} from '../../../../common/types/timeline';
} from '../../../../common/types/timeline/api';
import { TimelineId, TimelineTabs } from '../../../../common/types/timeline';
import {
DataProviderType,
TimelineId,
TimelineStatus,
TimelineType,
TimelineTabs,
} from '../../../../common/types/timeline';
} from '../../../../common/types/timeline/api';
import {
addNotes as dispatchAddNotes,

View file

@ -14,7 +14,7 @@ import { useHistory, useParams } from 'react-router-dom';
import '../../../common/mock/match_media';
import '../../../common/mock/formatted_relative';
import { SecurityPageName } from '../../../app/types';
import { TimelineType } from '../../../../common/types/timeline';
import { TimelineType } from '../../../../common/types/timeline/api';
import { TestProviders, mockOpenTimelineQueryResults } from '../../../common/mock';

View file

@ -16,7 +16,7 @@ import {
import { useNavigation } from '../../../common/lib/kibana';
import { SecurityPageName } from '../../../../common/constants';
import { useShallowEqualSelector } from '../../../common/hooks/use_selector';
import type { SortFieldTimeline } from '../../../../common/types/timeline';
import type { SortFieldTimeline } from '../../../../common/types/timeline/api';
import { TimelineId } from '../../../../common/types/timeline';
import type { TimelineModel } from '../../store/timeline/model';
import { timelineSelectors } from '../../store/timeline';

View file

@ -18,7 +18,7 @@ import type { TimelinesTableProps } from './timelines_table';
import { mockTimelineResults } from '../../../common/mock/timeline_results';
import { OpenTimeline } from './open_timeline';
import { DEFAULT_SORT_DIRECTION, DEFAULT_SORT_FIELD } from './constants';
import { TimelineType, TimelineStatus } from '../../../../common/types/timeline';
import { TimelineType, TimelineStatus } from '../../../../common/types/timeline/api';
import { getMockTheme } from '../../../common/lib/kibana/kibana_react.mock';
import { useUserPrivileges } from '../../../common/components/user_privileges';

View file

@ -10,7 +10,7 @@ import React, { useCallback, useMemo, useRef } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import styled from 'styled-components';
import { TimelineType, TimelineStatus } from '../../../../common/types/timeline';
import { TimelineType, TimelineStatus } from '../../../../common/types/timeline/api';
import { ImportDataModal } from '../../../common/components/import_data_modal';
import {
UtilityBarGroup,

View file

@ -17,7 +17,7 @@ import type { TimelinesTableProps } from '../timelines_table';
import { mockTimelineResults } from '../../../../common/mock/timeline_results';
import { OpenTimelineModalBody } from './open_timeline_modal_body';
import { DEFAULT_SORT_DIRECTION, DEFAULT_SORT_FIELD } from '../constants';
import { TimelineType, TimelineStatus } from '../../../../../common/types/timeline';
import { TimelineType, TimelineStatus } from '../../../../../common/types/timeline/api';
import { getMockTheme } from '../../../../common/lib/kibana/kibana_react.mock';
jest.mock('../../../../common/lib/kibana');

View file

@ -10,7 +10,7 @@ import { mountWithIntl } from '@kbn/test-jest-helpers';
import React from 'react';
import { ThemeProvider } from 'styled-components';
import { TimelineType } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
import { SearchRow } from '.';

View file

@ -15,7 +15,7 @@ import {
import React, { useMemo } from 'react';
import styled from 'styled-components';
import { TimelineType } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
import * as i18n from '../translations';
import type { OpenTimelineProps } from '../types';

View file

@ -16,7 +16,7 @@ import type {
TimelineActionsOverflowColumns,
} from '../types';
import * as i18n from '../translations';
import { TimelineStatus, TimelineType } from '../../../../../common/types/timeline';
import { TimelineStatus, TimelineType } from '../../../../../common/types/timeline/api';
/**
* Returns the action columns (e.g. delete, open duplicate timeline)
*/

View file

@ -16,7 +16,7 @@ import * as i18n from '../translations';
import type { OnOpenTimeline, OnToggleShowNotes, OpenTimelineResult } from '../types';
import { getEmptyTagValue } from '../../../../common/components/empty_value';
import { FormattedRelativePreferenceDate } from '../../../../common/components/formatted_date';
import { TimelineType } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
const LineClampTextContainer = styled.span`
text-overflow: ellipsis;

View file

@ -12,8 +12,8 @@ import { ACTION_COLUMN_WIDTH } from './common_styles';
import { getNotesCount, getPinnedEventCount } from '../helpers';
import * as i18n from '../translations';
import type { FavoriteTimelineResult, OpenTimelineResult } from '../types';
import type { TimelineTypeLiteralWithNull } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline';
import type { TimelineTypeLiteralWithNull } from '../../../../../common/types/timeline/api';
import { TimelineType } from '../../../../../common/types/timeline/api';
/**
* Returns the columns that have icon headers

View file

@ -26,8 +26,8 @@ import { getActionsColumns } from './actions_columns';
import { getCommonColumns } from './common_columns';
import { getExtendedColumns } from './extended_columns';
import { getIconHeaderColumns } from './icon_header_columns';
import type { TimelineTypeLiteralWithNull } from '../../../../../common/types/timeline';
import { TimelineStatus, TimelineType } from '../../../../../common/types/timeline';
import type { TimelineTypeLiteralWithNull } from '../../../../../common/types/timeline/api';
import { TimelineStatus, TimelineType } from '../../../../../common/types/timeline/api';
import { useUserPrivileges } from '../../../../common/components/user_privileges';
// there are a number of type mismatches across this file
const EuiBasicTable: any = _EuiBasicTable; // eslint-disable-line @typescript-eslint/no-explicit-any

View file

@ -9,7 +9,7 @@ import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines_page';
import { DEFAULT_SORT_DIRECTION, DEFAULT_SORT_FIELD } from '../constants';
import type { OpenTimelineResult } from '../types';
import type { TimelinesTableProps } from '.';
import { TimelineType } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
export const getMockTimelinesTableProps = (
mockOpenTimelineResults: OpenTimelineResult[]

View file

@ -10,14 +10,14 @@ import type { AllTimelinesVariables } from '../../containers/all';
import type { TimelineModel } from '../../store/timeline/model';
import type { NoteResult } from '../../../../common/types/timeline/note';
import type {
RowRendererId,
SingleTimelineResolveResponse,
TimelineTypeLiteral,
TimelineTypeLiteralWithNull,
TimelineStatus,
TemplateTimelineTypeLiteral,
RowRendererId,
TimelineStatusLiteralWithNull,
SingleTimelineResolveResponse,
} from '../../../../common/types/timeline';
} from '../../../../common/types/timeline/api';
/** The users who added a timeline to favorites */
export interface FavoriteTimelineResult {

View file

@ -12,12 +12,12 @@ import type {
TimelineTypeLiteralWithNull,
TemplateTimelineTypeLiteralWithNull,
TimelineStatusLiteralWithNull,
} from '../../../../common/types/timeline';
} from '../../../../common/types/timeline/api';
import {
TimelineStatus,
TimelineType,
TemplateTimelineType,
} from '../../../../common/types/timeline';
} from '../../../../common/types/timeline/api';
import * as i18n from './translations';
import type { TemplateTimelineFilter } from './types';

View file

@ -10,8 +10,8 @@ import { useParams } from 'react-router-dom';
import { EuiTabs, EuiTab, EuiSpacer } from '@elastic/eui';
import { noop } from 'lodash/fp';
import type { TimelineTypeLiteralWithNull } from '../../../../common/types/timeline';
import { TimelineType } from '../../../../common/types/timeline';
import type { TimelineTypeLiteralWithNull } from '../../../../common/types/timeline/api';
import { TimelineType } from '../../../../common/types/timeline/api';
import { SecurityPageName } from '../../../app/types';
import { getTimelineTabsUrl, useFormatUrl } from '../../../common/components/link_to';
import * as i18n from './translations';

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { RowRendererId } from '../../../../../common/types/timeline';
import { RowRendererId } from '../../../../../common/types/timeline/api';
import * as i18n from './translations';
export const eventRendererNames: { [key in RowRendererId]: string } = {

View file

@ -8,7 +8,7 @@
import { EuiLink } from '@elastic/eui';
import React from 'react';
import { RowRendererId } from '../../../../../common/types/timeline';
import { RowRendererId } from '../../../../../common/types/timeline/api';
import {
AlertsExample,
AuditdExample,

View file

@ -23,7 +23,7 @@ import { useDispatch } from 'react-redux';
import styled from 'styled-components';
import type { State } from '../../../common/store';
import { RowRendererId } from '../../../../common/types/timeline';
import { RowRendererId } from '../../../../common/types/timeline/api';
import { useDeepEqualSelector } from '../../../common/hooks/use_selector';
import { setExcludedRowRendererIds as dispatchSetExcludedRowRendererIds } from '../../store/timeline/actions';
import { timelineSelectors } from '../../store/timeline';

View file

@ -10,7 +10,7 @@ import React, { useMemo, useCallback } from 'react';
import { xor } from 'lodash/fp';
import styled from 'styled-components';
import type { RowRendererId } from '../../../../common/types/timeline';
import type { RowRendererId } from '../../../../common/types/timeline/api';
import type { RowRendererOption } from './catalog';
import { renderers } from './catalog';

View file

@ -10,7 +10,7 @@ import { useDetailPanel } from './use_detail_panel';
import { timelineActions } from '../../../store/timeline';
import { useDeepEqualSelector } from '../../../../common/hooks/use_selector';
import { SourcererScopeName } from '../../../../common/store/sourcerer/model';
import { TimelineId, TimelineTabs } from '../../../../../common/types';
import { TimelineId, TimelineTabs } from '../../../../../common/types/timeline';
import { FlowTargetSourceDest } from '../../../../../common/search_strategy';
const mockDispatch = jest.fn();

View file

@ -19,7 +19,7 @@ import { getNewSortDirectionOnClick, getNextSortDirection, getSortDirection } fr
import { Direction } from '../../../../../../../common/search_strategy';
import { useDeepEqualSelector } from '../../../../../../common/hooks/use_selector';
import type { ColumnHeaderType } from '../../../../../../../common/types';
import { TimelineId } from '../../../../../../../common/types';
import { TimelineId } from '../../../../../../../common/types/timeline';
const mockDispatch = jest.fn();
jest.mock('react-redux', () => {

View file

@ -12,7 +12,8 @@ import { TestProviders } from '../../../../../common/mock';
import { EventColumnView } from './event_column_view';
import { DefaultCellRenderer } from '../../cell_rendering/default_cell_renderer';
import { TimelineTabs, TimelineType, TimelineId } from '../../../../../../common/types/timeline';
import { TimelineTabs, TimelineId } from '../../../../../../common/types/timeline';
import { TimelineType } from '../../../../../../common/types/timeline/api';
import { useShallowEqualSelector } from '../../../../../common/hooks/use_selector';
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
import { getDefaultControlColumn } from '../control_columns';

View file

@ -13,7 +13,7 @@ import {
stringifyEvent,
} from './helpers';
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
import { TimelineType } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline/api';
describe('helpers', () => {
describe('stringifyEvent', () => {

View file

@ -9,8 +9,9 @@ import { isEmpty } from 'lodash/fp';
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
import type { TimelineItem, TimelineNonEcsData } from '../../../../../common/search_strategy';
import type { TimelineEventsType, TimelineTypeLiteral } from '../../../../../common/types/timeline';
import { TimelineType } from '../../../../../common/types/timeline';
import type { TimelineEventsType } from '../../../../../common/types/timeline';
import type { TimelineTypeLiteral } from '../../../../../common/types/timeline/api';
import { TimelineType } from '../../../../../common/types/timeline/api';
import type { OnPinEvent, OnUnPinEvent } from '../events';
import * as i18n from './translations';

View file

@ -20,7 +20,7 @@ import type { ControlColumnProps } from '../../../../../common/types';
import type { CellValueElementProps } from '../cell_rendering';
import { DEFAULT_COLUMN_MIN_WIDTH } from './constants';
import type { RowRenderer, TimelineTabs } from '../../../../../common/types/timeline';
import { RowRendererId } from '../../../../../common/types/timeline';
import { RowRendererId } from '../../../../../common/types/timeline/api';
import type { BrowserFields } from '../../../../common/containers/source';
import type { TimelineItem } from '../../../../../common/search_strategy/timeline';
import type { inputsModel, State } from '../../../../common/store';

View file

@ -10,7 +10,7 @@ import React from 'react';
import { TestProviders } from '../../../../../../../common/mock';
import { AlertField } from '.';
import { TimelineId } from '../../../../../../../../common/types';
import { TimelineId } from '../../../../../../../../common/types/timeline';
const contextId = 'test';
const eventId = 'abcd';

View file

@ -11,7 +11,7 @@ import React from 'react';
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
import { TestProviders } from '../../../../../../../common/mock';
import { AlertFieldFlexGroup, DEFAULT_GAP, eventKindMatches, showWith } from '.';
import { TimelineId } from '../../../../../../../../common/types';
import { TimelineId } from '../../../../../../../../common/types/timeline';
import { TableId } from '@kbn/securitysolution-data-table';
describe('helpers', () => {

View file

@ -27,7 +27,7 @@ import {
WITH_FIELD_NAMES,
} from './helpers';
import { alertRenderer } from '.';
import { TimelineId } from '../../../../../../../common/types';
import { TimelineId } from '../../../../../../../common/types/timeline';
const dataWithAllFields: Ecs = {
_id: 'abcd',

View file

@ -12,7 +12,7 @@ import styled from 'styled-components';
import { AlertField } from './alert_field';
import type { RowRenderer } from '../../../../../../../common/types';
import { RowRendererId } from '../../../../../../../common/types';
import { RowRendererId } from '../../../../../../../common/types/timeline/api';
import {
ID,
DESTINATION_IP,

View file

@ -10,7 +10,7 @@ import { cloneDeep } from 'lodash/fp';
import React from 'react';
import type { RowRenderer } from '../../../../../../../common/types';
import { TimelineId } from '../../../../../../../common/types';
import { TimelineId } from '../../../../../../../common/types/timeline';
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
import { mockTimelineData, TestProviders } from '../../../../../../common/mock';
import { useMountAppended } from '../../../../../../common/utils/use_mount_appended';

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