forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move exceptions builder to lists plugin (elastic#94002)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
57dd7d0
commit 1015d8b
Showing
10 changed files
with
149 additions
and
113 deletions.
There are no files selected for viewing
156 changes: 75 additions & 81 deletions
156
...on_engine/build_exceptions_filter.test.ts → ...xceptions/build_exceptions_filter.test.ts
Large diffs are not rendered by default.
Oops, something went wrong.
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,8 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export * from './build_exceptions_filter'; |
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,24 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export interface BooleanFilter { | ||
bool: { | ||
must?: unknown | unknown[]; | ||
must_not?: unknown | unknown[]; | ||
should?: unknown[]; | ||
filter?: unknown | unknown[]; | ||
minimum_should_match?: number; | ||
}; | ||
} | ||
|
||
export interface NestedFilter { | ||
nested: { | ||
path: string; | ||
query: unknown | unknown[]; | ||
score_mode: string; | ||
}; | ||
} |
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,24 @@ | ||
/* | ||
* 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 { CreateExceptionListItemSchema, EntriesArray, ExceptionListItemSchema } from '../schemas'; | ||
|
||
export const hasLargeValueItem = ( | ||
exceptionItems: Array<ExceptionListItemSchema | CreateExceptionListItemSchema> | ||
): boolean => { | ||
return exceptionItems.some((exceptionItem) => hasLargeValueList(exceptionItem.entries)); | ||
}; | ||
|
||
export const hasLargeValueList = (entries: EntriesArray): boolean => { | ||
const found = entries.filter(({ type }) => type === 'list'); | ||
return found.length > 0; | ||
}; | ||
|
||
export const hasNestedEntry = (entries: EntriesArray): boolean => { | ||
const found = entries.filter(({ type }) => type === 'nested'); | ||
return found.length > 0; | ||
}; |
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