mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
## Summary This PR moves the last remaining timeline api schema to a common location as per https://github.com/elastic/security-team/issues/7099 ### Checklist Delete any items that are not applicable to this PR. - [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 ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
parent
3d6dbd4ad7
commit
586afe9f27
5 changed files with 28 additions and 20 deletions
|
@ -19,3 +19,4 @@ export * from './patch_timelines/patch_timelines_schema';
|
|||
export * from './persist_favorite/persist_favorite_schema';
|
||||
export * from './persist_note/persist_note_route';
|
||||
export * from './pinned_events/pinned_events_route';
|
||||
export * from './install_prepackaged_timelines/install_prepackaged_timelines';
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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 rt from 'io-ts';
|
||||
|
||||
import { unionWithNullType } from '../../../utility_types';
|
||||
import { ImportTimelinesSchemaRt, TimelineSavedToReturnObjectRuntimeType } from '..';
|
||||
|
||||
export const checkTimelineStatusRt = rt.type({
|
||||
timelinesToInstall: rt.array(unionWithNullType(ImportTimelinesSchemaRt)),
|
||||
timelinesToUpdate: rt.array(unionWithNullType(ImportTimelinesSchemaRt)),
|
||||
prepackagedTimelines: rt.array(unionWithNullType(TimelineSavedToReturnObjectRuntimeType)),
|
||||
});
|
||||
|
||||
export type CheckTimelineStatusRt = rt.TypeOf<typeof checkTimelineStatusRt>;
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import { transformError } from '@kbn/securitysolution-es-utils';
|
||||
import { validate } from '@kbn/securitysolution-io-ts-utils';
|
||||
import { checkTimelineStatusRt } from '../../../../../../common/api/timeline';
|
||||
import { buildSiemResponse } from '../../../routes/utils';
|
||||
import type { SetupPlugins } from '../../../../../plugin';
|
||||
import type { SecuritySolutionPluginRouter } from '../../../../../types';
|
||||
|
@ -24,10 +25,7 @@ import { createPrebuiltRuleAssetsClient } from '../../logic/rule_assets/prebuilt
|
|||
import { rulesToMap } from '../../logic/utils';
|
||||
|
||||
import { buildFrameworkRequest } from '../../../../timeline/utils/common';
|
||||
import {
|
||||
checkTimelinesStatus,
|
||||
checkTimelineStatusRt,
|
||||
} from '../../../../timeline/utils/check_timelines_status';
|
||||
import { checkTimelinesStatus } from '../../../../timeline/utils/check_timelines_status';
|
||||
|
||||
export const getPrebuiltRulesAndTimelinesStatusRoute = (
|
||||
router: SecuritySolutionPluginRouter,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import { transformError } from '@kbn/securitysolution-es-utils';
|
||||
import { validate } from '@kbn/securitysolution-io-ts-utils';
|
||||
import { checkTimelineStatusRt } from '../../../../../../common/api/timeline';
|
||||
import type { SecuritySolutionPluginRouter } from '../../../../../types';
|
||||
|
||||
import { TIMELINE_PREPACKAGED_URL } from '../../../../../../common/constants';
|
||||
|
@ -18,7 +19,7 @@ import { buildSiemResponse } from '../../../../detection_engine/routes/utils';
|
|||
|
||||
import { installPrepackagedTimelines } from './helpers';
|
||||
|
||||
import { checkTimelinesStatus, checkTimelineStatusRt } from '../../../utils/check_timelines_status';
|
||||
import { checkTimelinesStatus } from '../../../utils/check_timelines_status';
|
||||
|
||||
import { buildFrameworkRequest } from '../../../utils/common';
|
||||
|
||||
|
|
|
@ -6,29 +6,18 @@
|
|||
*/
|
||||
|
||||
import path, { join, resolve } from 'path';
|
||||
import * as rt from 'io-ts';
|
||||
import type { TimelineSavedObject, ImportTimelinesSchema } from '../../../../common/api/timeline';
|
||||
import {
|
||||
TimelineSavedToReturnObjectRuntimeType,
|
||||
ImportTimelinesSchemaRt,
|
||||
import type {
|
||||
CheckTimelineStatusRt,
|
||||
TimelineSavedObject,
|
||||
ImportTimelinesSchema,
|
||||
} from '../../../../common/api/timeline';
|
||||
|
||||
import { unionWithNullType } from '../../../../common/utility_types';
|
||||
|
||||
import type { FrameworkRequest } from '../../framework';
|
||||
|
||||
import { getExistingPrepackagedTimelines } from '../saved_object/timelines';
|
||||
|
||||
import { loadData, getReadables } from './common';
|
||||
|
||||
export const checkTimelineStatusRt = rt.type({
|
||||
timelinesToInstall: rt.array(unionWithNullType(ImportTimelinesSchemaRt)),
|
||||
timelinesToUpdate: rt.array(unionWithNullType(ImportTimelinesSchemaRt)),
|
||||
prepackagedTimelines: rt.array(unionWithNullType(TimelineSavedToReturnObjectRuntimeType)),
|
||||
});
|
||||
|
||||
export type CheckTimelineStatusRt = rt.TypeOf<typeof checkTimelineStatusRt>;
|
||||
|
||||
export const getTimelinesToUpdate = (
|
||||
timelinesFromFileSystem: ImportTimelinesSchema[],
|
||||
installedTimelines: TimelineSavedObject[]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue