-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security Solutions] Re-arranges and adds more packages to remove copied code #100310
Merged
FrankHassanabad
merged 9 commits into
elastic:master
from
FrankHassanabad:add-more-list-packages
May 19, 2021
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8cde065
Re-arranged and added packages
FrankHassanabad e487a4f
Fixed e2e tests
FrankHassanabad 5f2e94d
Merge branch 'master' into add-more-list-packages
FrankHassanabad 25ca889
Used import type in more areas
FrankHassanabad d86afb5
Unexport things that are not needed to be exported
FrankHassanabad f90b74a
Merge branch 'master' into add-more-list-packages
FrankHassanabad b004023
Added new package for the list utils to begin reducing size of the ov…
FrankHassanabad 60e9fc5
Merge branch 'master' into add-more-list-packages
FrankHassanabad 16759a5
Fixes source root problem
FrankHassanabad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
packages/kbn-securitysolution-io-ts-list-types/src/common/cursor/index.ts
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,13 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
import * as t from 'io-ts'; | ||
|
||
export const cursor = t.string; | ||
export type Cursor = t.TypeOf<typeof cursor>; | ||
export const cursorOrUndefined = t.union([cursor, t.undefined]); | ||
export type CursorOrUndefined = t.TypeOf<typeof cursorOrUndefined>; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
packages/kbn-securitysolution-io-ts-list-types/src/common/deserializer/index.ts
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,14 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const deserializer = t.string; | ||
export type Deserializer = t.TypeOf<typeof deserializer>; | ||
export const deserializerOrUndefined = t.union([deserializer, t.undefined]); | ||
export type DeserializerOrUndefined = t.TypeOf<typeof deserializerOrUndefined>; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions
45
packages/kbn-securitysolution-io-ts-list-types/src/common/exception_list/index.test.ts
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,45 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { exceptionListType, ExceptionListTypeEnum } from '.'; | ||
|
||
import { pipe } from 'fp-ts/lib/pipeable'; | ||
import { left } from 'fp-ts/lib/Either'; | ||
import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils'; | ||
|
||
describe('exceptionListType', () => { | ||
test('it should validate for "detection"', () => { | ||
const payload = 'detection'; | ||
const decoded = exceptionListType.decode(payload); | ||
const message = pipe(decoded, foldLeftRight); | ||
|
||
expect(getPaths(left(message.errors))).toEqual([]); | ||
expect(message.schema).toEqual(payload); | ||
}); | ||
|
||
test('it should validate for "endpoint"', () => { | ||
const payload = 'endpoint'; | ||
const decoded = exceptionListType.decode(payload); | ||
const message = pipe(decoded, foldLeftRight); | ||
|
||
expect(getPaths(left(message.errors))).toEqual([]); | ||
expect(message.schema).toEqual(payload); | ||
}); | ||
|
||
test('it should contain same amount of keys as enum', () => { | ||
// Might seem like a weird test, but its meant to | ||
// ensure that if exceptionListType is updated, you | ||
// also update the ExceptionListTypeEnum, a workaround | ||
// for io-ts not yet supporting enums | ||
// https://github.com/gcanti/io-ts/issues/67 | ||
const keys = Object.keys(exceptionListType.keys).sort().join(',').toLowerCase(); | ||
const enumKeys = Object.keys(ExceptionListTypeEnum).sort().join(',').toLowerCase(); | ||
|
||
expect(keys).toEqual(enumKeys); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
packages/kbn-securitysolution-io-ts-list-types/src/common/file/index.ts
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,10 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
import * as t from 'io-ts'; | ||
|
||
export const file = t.object; |
14 changes: 14 additions & 0 deletions
14
packages/kbn-securitysolution-io-ts-list-types/src/common/filter/index.ts
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,14 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const filter = t.string; | ||
export type Filter = t.TypeOf<typeof filter>; | ||
export const filterOrUndefined = t.union([filter, t.undefined]); | ||
export type FilterOrUndefined = t.TypeOf<typeof filterOrUndefined>; |
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
packages/kbn-securitysolution-io-ts-list-types/src/common/immutable/index.ts
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,14 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const immutable = t.boolean; | ||
export type Immutable = t.TypeOf<typeof immutable>; | ||
export const immutableOrUndefined = t.union([immutable, t.undefined]); | ||
export type ImmutableOrUndefined = t.TypeOf<typeof immutableOrUndefined>; |
62 changes: 62 additions & 0 deletions
62
packages/kbn-securitysolution-io-ts-list-types/src/common/index.ts
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,62 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
export * from './comment'; | ||
export * from './create_comment'; | ||
export * from './created_at'; | ||
export * from './created_by'; | ||
export * from './cursor'; | ||
export * from './default_namespace'; | ||
export * from './default_namespace_array'; | ||
export * from './description'; | ||
export * from './deserializer'; | ||
export * from './endpoint'; | ||
export * from './entries'; | ||
export * from './entries_exist'; | ||
export * from './entries_list'; | ||
export * from './entry_match'; | ||
export * from './entry_match_any'; | ||
export * from './entry_match_wildcard'; | ||
export * from './entry_nested'; | ||
export * from './exception_list'; | ||
export * from './exception_list_item_type'; | ||
export * from './filter'; | ||
export * from './id'; | ||
export * from './immutable'; | ||
export * from './item_id'; | ||
export * from './list_id'; | ||
export * from './list_operator'; | ||
export * from './list_type'; | ||
export * from './lists'; | ||
export * from './lists_default_array'; | ||
export * from './meta'; | ||
export * from './name'; | ||
export * from './non_empty_entries_array'; | ||
export * from './non_empty_nested_entries_array'; | ||
export * from './os_type'; | ||
export * from './page'; | ||
export * from './per_page'; | ||
export * from './serializer'; | ||
export * from './sort_field'; | ||
export * from './sort_order'; | ||
export * from './tags'; | ||
export * from './tie_breaker_id'; | ||
export * from './total'; | ||
export * from './type'; | ||
export * from './underscore_version'; | ||
export * from './update_comment'; | ||
export * from './updated_at'; | ||
export * from './updated_by'; |
11 changes: 11 additions & 0 deletions
11
packages/kbn-securitysolution-io-ts-list-types/src/common/item/index.ts
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,11 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const item = t.string; |
File renamed without changes.
17 changes: 17 additions & 0 deletions
17
packages/kbn-securitysolution-io-ts-list-types/src/common/list_id/index.ts
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,17 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
|
||
import * as t from 'io-ts'; | ||
import { NonEmptyString } from '@kbn/securitysolution-io-ts-types'; | ||
|
||
export const list_id = NonEmptyString; | ||
export type ListId = t.TypeOf<typeof list_id>; | ||
export const list_idOrUndefined = t.union([list_id, t.undefined]); | ||
export type ListIdOrUndefined = t.TypeOf<typeof list_idOrUndefined>; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping-pong on the auto-formatter...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this change is so large I am going to leave it. Wish my editor hadn't done this.