-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Adding type field to client * Removing context and adding association type * Handle alerts from multiple indices * Adding flow for adding a sub case * Making progress on creating alerts from rules * Refactored add comment to handle case and sub case * Starting sub case API and refactoring of case client * Fleshing out find cases * Finished the find cases api * Filtering comments by association type * Fixing tests and types * Updating snapshots * Cleaning up comment references * Working unit tests * Fixing integration tests and got ES to work * Unit tests and api integration test working * Refactoring find and get_status * Starting patch, and update * script for sub cases * Removing converted_by and fixing type errors * Adding docs for script * Removing converted_by and fixing integration test * Adding sub case id to comment routes * Removing stringify comparison * Adding delete api and tests * Updating license * missed license files * Integration tests passing * Adding more tests for sub cases * Find int tests, scoped client, patch sub user actions * fixing types and call cluster * fixing get sub case param issue * Adding user actions for sub cases * Preventing alerts on collections and refactoring user * Allowing type to be updated for ind cases * Refactoring and writing tests * Fixing sub case status filtering * Adding more tests not allowing gen alerts patch * Working unit tests * Push to connector gets all sub case comments * Writing more tests and cleaning up * Updating push functionality for generated alerts and sub cases * Adding comment about updating collection sync * Refactoring update alert status for sub cases and removing request and cleaning up * Addressing alert service feedback * Fixing sub case sync bug and cleaning up comment types * Addressing more feedback Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
23a06a8
commit 6ad67fd
Showing
123 changed files
with
8,319 additions
and
2,181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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 { CaseAttributesRt } from './case'; | ||
import { CommentResponseRt } from './comment'; | ||
import { SubCaseAttributesRt, SubCaseResponseRt } from './sub_case'; | ||
|
||
export const CollectionSubCaseAttributesRt = rt.intersection([ | ||
rt.partial({ subCase: SubCaseAttributesRt }), | ||
rt.type({ | ||
case: CaseAttributesRt, | ||
}), | ||
]); | ||
|
||
export const CollectWithSubCaseResponseRt = rt.intersection([ | ||
CaseAttributesRt, | ||
rt.type({ | ||
id: rt.string, | ||
totalComment: rt.number, | ||
version: rt.string, | ||
}), | ||
rt.partial({ | ||
subCase: SubCaseResponseRt, | ||
totalAlerts: rt.number, | ||
comments: rt.array(CommentResponseRt), | ||
}), | ||
]); | ||
|
||
export type CollectionWithSubCaseResponse = rt.TypeOf<typeof CollectWithSubCaseResponseRt>; | ||
export type CollectionWithSubCaseAttributes = rt.TypeOf<typeof CollectionSubCaseAttributesRt>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* 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 { NumberFromString } from '../saved_object'; | ||
import { UserRT } from '../user'; | ||
import { CommentResponseRt } from './comment'; | ||
import { CasesStatusResponseRt } from './status'; | ||
import { CaseStatusRt } from './status'; | ||
|
||
const SubCaseBasicRt = rt.type({ | ||
status: CaseStatusRt, | ||
}); | ||
|
||
export const SubCaseAttributesRt = rt.intersection([ | ||
SubCaseBasicRt, | ||
rt.type({ | ||
closed_at: rt.union([rt.string, rt.null]), | ||
closed_by: rt.union([UserRT, rt.null]), | ||
created_at: rt.string, | ||
created_by: rt.union([UserRT, rt.null]), | ||
updated_at: rt.union([rt.string, rt.null]), | ||
updated_by: rt.union([UserRT, rt.null]), | ||
}), | ||
]); | ||
|
||
export const SubCasesFindRequestRt = rt.partial({ | ||
status: CaseStatusRt, | ||
defaultSearchOperator: rt.union([rt.literal('AND'), rt.literal('OR')]), | ||
fields: rt.array(rt.string), | ||
page: NumberFromString, | ||
perPage: NumberFromString, | ||
search: rt.string, | ||
searchFields: rt.array(rt.string), | ||
sortField: rt.string, | ||
sortOrder: rt.union([rt.literal('desc'), rt.literal('asc')]), | ||
}); | ||
|
||
export const SubCaseResponseRt = rt.intersection([ | ||
SubCaseAttributesRt, | ||
rt.type({ | ||
id: rt.string, | ||
totalComment: rt.number, | ||
totalAlerts: rt.number, | ||
version: rt.string, | ||
}), | ||
rt.partial({ | ||
comments: rt.array(CommentResponseRt), | ||
}), | ||
]); | ||
|
||
export const SubCasesFindResponseRt = rt.intersection([ | ||
rt.type({ | ||
subCases: rt.array(SubCaseResponseRt), | ||
page: rt.number, | ||
per_page: rt.number, | ||
total: rt.number, | ||
}), | ||
CasesStatusResponseRt, | ||
]); | ||
|
||
export const SubCasePatchRequestRt = rt.intersection([ | ||
rt.partial(SubCaseBasicRt.props), | ||
rt.type({ id: rt.string, version: rt.string }), | ||
]); | ||
|
||
export const SubCasesPatchRequestRt = rt.type({ subCases: rt.array(SubCasePatchRequestRt) }); | ||
export const SubCasesResponseRt = rt.array(SubCaseResponseRt); | ||
|
||
export type SubCaseAttributes = rt.TypeOf<typeof SubCaseAttributesRt>; | ||
export type SubCaseResponse = rt.TypeOf<typeof SubCaseResponseRt>; | ||
export type SubCasesResponse = rt.TypeOf<typeof SubCasesResponseRt>; | ||
export type SubCasesFindResponse = rt.TypeOf<typeof SubCasesFindResponseRt>; | ||
export type SubCasePatchRequest = rt.TypeOf<typeof SubCasePatchRequestRt>; | ||
export type SubCasesPatchRequest = rt.TypeOf<typeof SubCasesPatchRequestRt>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.