diff --git a/.buildkite/pipelines/pull_request/renovate.yml b/.buildkite/pipelines/pull_request/renovate.yml
index 3b441cfe5375..98302a8d7912 100644
--- a/.buildkite/pipelines/pull_request/renovate.yml
+++ b/.buildkite/pipelines/pull_request/renovate.yml
@@ -1,12 +1,4 @@
steps:
- - command: .buildkite/scripts/lifecycle/pre_build.sh
- label: Pre-Build
- timeout_in_minutes: 10
- agents:
- machineType: n2-standard-2
-
- - wait
-
- command: .buildkite/scripts/steps/renovate.sh
label: 'Renovate validation'
agents:
diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts
index 87ac7096e5a3..51587280c4ed 100644
--- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts
+++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts
@@ -39,15 +39,16 @@ const getPipeline = (filename: string, removeSteps = true) => {
return;
}
+ pipeline.push(getAgentImageConfig({ returnYaml: true }));
+
const onlyRunQuickChecks = await areChangesSkippable([/^renovate\.json$/], REQUIRED_PATHS);
if (onlyRunQuickChecks) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/renovate.yml', false));
- pipeline.push(getPipeline('.buildkite/pipelines/pull_request/post_build.yml'));
- console.log('Isolated changes to renovate.json. Skipping main PR pipeline.');
+
+ console.log([...new Set(pipeline)].join('\n'));
return;
}
- pipeline.push(getAgentImageConfig({ returnYaml: true }));
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/base.yml', false));
if (await doAnyChangesMatch([/^packages\/kbn-handlebars/])) {
@@ -250,7 +251,7 @@ const getPipeline = (filename: string, removeSteps = true) => {
/^packages\/kbn-securitysolution-.*/,
/^x-pack\/plugins\/alerting/,
/^x-pack\/plugins\/data_views\/common/,
- /^x-pack\/plugins\/lists/,
+ /^x-pack\/solutions\/security\/plugins\/lists/,
/^x-pack\/plugins\/rule_registry\/common/,
/^x-pack\/solutions\/security\/plugins\/security_solution/,
/^x-pack\/solutions\/security\/plugins\/security_solution_ess/,
@@ -306,10 +307,10 @@ const getPipeline = (filename: string, removeSteps = true) => {
/^packages\/kbn-search-types/,
/^packages\/kbn-securitysolution-.*/,
/^src\/platform\/packages\/shared\/kbn-securitysolution-ecs/,
- /^packages\/kbn-securitysolution-io-ts-alerting-types/,
- /^packages\/kbn-securitysolution-io-ts-list-types/,
- /^packages\/kbn-securitysolution-list-hooks/,
- /^packages\/kbn-securitysolution-t-grid/,
+ /^x-pack\/solutions\/security\/packages\/kbn-securitysolution-io-ts-alerting-types/,
+ /^x-pack\/solutions\/security\/packages\/kbn-securitysolution-io-ts-list-types/,
+ /^x-pack\/solutions\/security\/packages\/kbn-securitysolution-list-hooks/,
+ /^x-pack\/solutions\/security\/packages\/kbn-securitysolution-t-grid/,
/^packages\/kbn-ui-theme/,
/^packages\/kbn-utility-types/,
/^packages\/react/,
@@ -335,7 +336,7 @@ const getPipeline = (filename: string, removeSteps = true) => {
/^x-pack\/plugins\/cases/,
/^x-pack\/plugins\/data_views\/common/,
/^x-pack\/solutions\/security\/plugins\/elastic_assistant/,
- /^x-pack\/plugins\/lists/,
+ /^x-pack\/solutions\/security\/plugins\/lists/,
/^x-pack\/plugins\/rule_registry\/common/,
/^x-pack\/solutions\/security\/plugins\/security_solution/,
/^x-pack\/solutions\/security\/plugins\/security_solution_ess/,
diff --git a/.buildkite/scripts/steps/code_generation/security_solution_codegen.sh b/.buildkite/scripts/steps/code_generation/security_solution_codegen.sh
index db7131d12785..5f140efc5db8 100755
--- a/.buildkite/scripts/steps/code_generation/security_solution_codegen.sh
+++ b/.buildkite/scripts/steps/code_generation/security_solution_codegen.sh
@@ -7,16 +7,16 @@ source .buildkite/scripts/common/util.sh
echo --- Security Solution OpenAPI Code Generation
echo -e "\n[Security Solution OpenAPI Code Generation] OpenAPI Common Package\n"
-(cd packages/kbn-openapi-common && yarn openapi:generate)
+(cd src/platform/packages/shared/kbn-openapi-common && yarn openapi:generate)
echo -e "\n[Security Solution OpenAPI Code Generation] Lists Common Package\n"
-(cd packages/kbn-securitysolution-lists-common && yarn openapi:generate)
+(cd x-pack/solutions/security/packages/kbn-securitysolution-lists-common && yarn openapi:generate)
echo -e "\n[Security Solution OpenAPI Code Generation] Exceptions Common Package\n"
-(cd packages/kbn-securitysolution-exceptions-common && yarn openapi:generate)
+(cd x-pack/solutions/security/packages/kbn-securitysolution-exceptions-common && yarn openapi:generate)
echo -e "\n[Security Solution OpenAPI Code Generation] Endpoint Exceptions Common Package\n"
-(cd packages/kbn-securitysolution-endpoint-exceptions-common && yarn openapi:generate)
+(cd x-pack/solutions/security/packages/kbn-securitysolution-endpoint-exceptions-common && yarn openapi:generate)
echo -e "\n[Security Solution OpenAPI Code Generation] Security Solution Plugin\n"
(cd x-pack/solutions/security/plugins/security_solution && yarn openapi:generate)
diff --git a/.buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh b/.buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh
index 18d2c963b3c2..4dd23435e351 100755
--- a/.buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh
+++ b/.buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh
@@ -16,13 +16,13 @@ echo -e "\n[Security Solution OpenAPI Bundling] Entity Analytics API\n"
(cd x-pack/solutions/security/plugins/security_solution && yarn openapi:bundle:entity-analytics)
echo -e "\n[Security Solution OpenAPI Bundling] Lists API\n"
-(cd packages/kbn-securitysolution-lists-common && yarn openapi:bundle)
+(cd x-pack/solutions/security/packages/kbn-securitysolution-lists-common && yarn openapi:bundle)
echo -e "\n[Security Solution OpenAPI Bundling] Exceptions API\n"
-(cd packages/kbn-securitysolution-exceptions-common && yarn openapi:bundle)
+(cd x-pack/solutions/security/packages/kbn-securitysolution-exceptions-common && yarn openapi:bundle)
echo -e "\n[Security Solution OpenAPI Bundling] Endpoint Exceptions API\n"
-(cd packages/kbn-securitysolution-endpoint-exceptions-common && yarn openapi:bundle)
+(cd x-pack/solutions/security/packages/kbn-securitysolution-endpoint-exceptions-common && yarn openapi:bundle)
echo -e "\n[Security Solution OpenAPI Bundling] Endpoint Management API\n"
(cd x-pack/solutions/security/plugins/security_solution && yarn openapi:bundle:endpoint-management)
diff --git a/.eslintrc.js b/.eslintrc.js
index 6bf88444aaf7..93e3dabf3b86 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1343,8 +1343,8 @@ module.exports = {
{
// front end and common typescript and javascript files only
files: [
- 'x-pack/plugins/lists/public/**/*.{js,mjs,ts,tsx}',
- 'x-pack/plugins/lists/common/**/*.{js,mjs,ts,tsx}',
+ 'x-pack/solutions/security/plugins/lists/public/**/*.{js,mjs,ts,tsx}',
+ 'x-pack/solutions/security/plugins/lists/common/**/*.{js,mjs,ts,tsx}',
],
rules: {
'import/no-nodejs-modules': 'error',
@@ -1360,14 +1360,20 @@ module.exports = {
},
{
// typescript for /public and /common
- files: ['x-pack/plugins/lists/public/*.{ts,tsx}', 'x-pack/plugins/lists/common/*.{ts,tsx}'],
+ files: [
+ 'x-pack/solutions/security/plugins/lists/public/*.{ts,tsx}',
+ 'x-pack/solutions/security/plugins/lists/common/*.{ts,tsx}',
+ ],
rules: {
'@typescript-eslint/no-for-in-array': 'error',
},
},
{
// typescript for /public and /common
- files: ['x-pack/plugins/lists/public/*.{ts,tsx}', 'x-pack/plugins/lists/common/*.{ts,tsx}'],
+ files: [
+ 'x-pack/solutions/security/plugins/lists/public/*.{ts,tsx}',
+ 'x-pack/solutions/security/plugins/lists/common/*.{ts,tsx}',
+ ],
plugins: ['react'],
env: {
jest: true,
@@ -1425,7 +1431,7 @@ module.exports = {
},
},
{
- files: ['x-pack/plugins/lists/public/**/!(*.test).{js,mjs,ts,tsx}'],
+ files: ['x-pack/solutions/security/plugins/lists/public/**/!(*.test).{js,mjs,ts,tsx}'],
plugins: ['react-perf'],
rules: {
'react-perf/jsx-no-new-object-as-prop': 'error',
@@ -1436,7 +1442,7 @@ module.exports = {
},
{
// typescript and javascript for front and back
- files: ['x-pack/plugins/lists/**/*.{js,mjs,ts,tsx}'],
+ files: ['x-pack/solutions/security/plugins/lists/**/*.{js,mjs,ts,tsx}'],
plugins: ['eslint-plugin-node'],
env: {
jest: true,
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 627579d513e9..4943b4279c39 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -395,7 +395,6 @@ packages/kbn-monaco @elastic/appex-sharedux
packages/kbn-object-versioning @elastic/appex-sharedux
packages/kbn-object-versioning-utils @elastic/appex-sharedux
packages/kbn-openapi-bundler @elastic/security-detection-rule-management
-packages/kbn-openapi-common @elastic/security-detection-rule-management
packages/kbn-openapi-generator @elastic/security-detection-rule-management
packages/kbn-optimizer @elastic/kibana-operations
packages/kbn-optimizer-webpack-helpers @elastic/kibana-operations
@@ -454,24 +453,6 @@ packages/kbn-search-index-documents @elastic/search-kibana
packages/kbn-search-response-warnings @elastic/kibana-data-discovery
packages/kbn-search-types @elastic/kibana-data-discovery
packages/kbn-security-hardening @elastic/kibana-security
-packages/kbn-securitysolution-autocomplete @elastic/security-detection-engine
-packages/kbn-securitysolution-endpoint-exceptions-common @elastic/security-detection-engine
-packages/kbn-securitysolution-es-utils @elastic/security-detection-engine
-packages/kbn-securitysolution-exception-list-components @elastic/security-detection-engine
-packages/kbn-securitysolution-exceptions-common @elastic/security-detection-engine
-packages/kbn-securitysolution-hook-utils @elastic/security-detection-engine
-packages/kbn-securitysolution-io-ts-alerting-types @elastic/security-detection-engine
-packages/kbn-securitysolution-io-ts-list-types @elastic/security-detection-engine
-packages/kbn-securitysolution-io-ts-types @elastic/security-detection-engine
-packages/kbn-securitysolution-io-ts-utils @elastic/security-detection-engine
-packages/kbn-securitysolution-list-api @elastic/security-detection-engine
-packages/kbn-securitysolution-list-constants @elastic/security-detection-engine
-packages/kbn-securitysolution-list-hooks @elastic/security-detection-engine
-packages/kbn-securitysolution-list-utils @elastic/security-detection-engine
-packages/kbn-securitysolution-lists-common @elastic/security-detection-engine
-packages/kbn-securitysolution-rules @elastic/security-detection-engine
-packages/kbn-securitysolution-t-grid @elastic/security-detection-engine
-packages/kbn-securitysolution-utils @elastic/security-detection-engine
packages/kbn-server-http-tools @elastic/kibana-core
packages/kbn-set-map @elastic/kibana-operations
packages/kbn-shared-svg @elastic/obs-ux-infra_services-team
@@ -517,7 +498,6 @@ packages/kbn-whereis-pkg-cli @elastic/kibana-operations
packages/kbn-xstate-utils @elastic/obs-ux-logs-team
packages/kbn-yarn-lock-validator @elastic/kibana-operations
packages/kbn-zod @elastic/kibana-core
-packages/kbn-zod-helpers @elastic/security-detection-rule-management
packages/presentation/presentation_containers @elastic/kibana-presentation
packages/presentation/presentation_publishing @elastic/kibana-presentation
packages/react/kibana_context/common @elastic/appex-sharedux
@@ -613,8 +593,13 @@ src/platform/packages/shared/kbn-management/settings/components/field_row @elast
src/platform/packages/shared/kbn-management/settings/field_definition @elastic/kibana-management
src/platform/packages/shared/kbn-management/settings/types @elastic/kibana-management
src/platform/packages/shared/kbn-management/settings/utilities @elastic/kibana-management
+src/platform/packages/shared/kbn-openapi-common @elastic/security-detection-rule-management
src/platform/packages/shared/kbn-osquery-io-ts-types @elastic/security-asset-management
src/platform/packages/shared/kbn-securitysolution-ecs @elastic/security-threat-hunting-explore
+src/platform/packages/shared/kbn-securitysolution-es-utils @elastic/security-detection-engine
+src/platform/packages/shared/kbn-securitysolution-io-ts-types @elastic/security-detection-engine
+src/platform/packages/shared/kbn-securitysolution-io-ts-utils @elastic/security-detection-engine
+src/platform/packages/shared/kbn-securitysolution-rules @elastic/security-detection-engine
src/platform/packages/shared/kbn-server-route-repository @elastic/obs-knowledge-team
src/platform/packages/shared/kbn-server-route-repository-client @elastic/obs-knowledge-team
src/platform/packages/shared/kbn-server-route-repository-utils @elastic/obs-knowledge-team
@@ -623,6 +608,7 @@ src/platform/packages/shared/kbn-sse-utils-client @elastic/obs-knowledge-team
src/platform/packages/shared/kbn-sse-utils-server @elastic/obs-knowledge-team
src/platform/packages/shared/kbn-typed-react-router-config @elastic/obs-knowledge-team @elastic/obs-ux-infra_services-team
src/platform/packages/shared/kbn-unsaved-changes-prompt @elastic/kibana-management
+src/platform/packages/shared/kbn-zod-helpers @elastic/security-detection-rule-management
src/platform/packages/shared/serverless/settings/security_project @elastic/security-solution @elastic/kibana-management
src/platform/plugins/shared/ai_assistant_management/selection @elastic/obs-ai-assistant
src/platform/plugins/shared/console @elastic/kibana-management
@@ -878,6 +864,7 @@ x-pack/platform/plugins/shared/license_management @elastic/kibana-management
x-pack/platform/plugins/shared/ml @elastic/ml-ui
x-pack/platform/plugins/shared/observability_solution/observability_ai_assistant @elastic/obs-ai-assistant
x-pack/platform/plugins/shared/osquery @elastic/security-defend-workflows
+x-pack/platform/plugins/shared/screenshotting @elastic/kibana-reporting-services
x-pack/platform/plugins/shared/searchprofiler @elastic/kibana-management
x-pack/plugins/actions @elastic/response-ops
x-pack/plugins/alerting @elastic/response-ops
@@ -909,7 +896,6 @@ x-pack/plugins/graph @elastic/kibana-visualizations
x-pack/plugins/index_management @elastic/kibana-management
x-pack/plugins/lens @elastic/kibana-visualizations
x-pack/plugins/licensing @elastic/kibana-core
-x-pack/plugins/lists @elastic/security-detection-engine
x-pack/plugins/logstash @elastic/logstash
x-pack/plugins/maps @elastic/kibana-presentation
x-pack/plugins/monitoring @elastic/stack-monitoring
@@ -935,7 +921,6 @@ x-pack/plugins/observability_solution/profiling_data_access @elastic/obs-ux-infr
x-pack/plugins/reporting @elastic/appex-sharedux
x-pack/plugins/rule_registry @elastic/response-ops @elastic/obs-ux-management-team
x-pack/plugins/saved_objects_tagging @elastic/appex-sharedux
-x-pack/plugins/screenshotting @elastic/kibana-reporting-services
x-pack/plugins/search_assistant @elastic/search-kibana
x-pack/plugins/search_connectors @elastic/search-kibana
x-pack/plugins/search_homepage @elastic/search-kibana
@@ -953,7 +938,7 @@ x-pack/plugins/stack_connectors @elastic/response-ops
x-pack/plugins/task_manager @elastic/response-ops
x-pack/plugins/telemetry_collection_xpack @elastic/kibana-core
x-pack/plugins/triggers_actions_ui @elastic/response-ops
-x-pack/plugins/upgrade_assistant @elastic/kibana-management
+x-pack/plugins/upgrade_assistant @elastic/kibana-core
x-pack/solutions/observability/packages/alert_details @elastic/obs-ux-management-team
x-pack/solutions/observability/packages/alerting_test_data @elastic/obs-ux-management-team
x-pack/solutions/observability/packages/get_padded_alert_time_range_util @elastic/obs-ux-management-team
@@ -986,6 +971,20 @@ x-pack/solutions/security/packages/features @elastic/security-threat-hunting-exp
x-pack/solutions/security/packages/index-adapter @elastic/security-threat-hunting
x-pack/solutions/security/packages/kbn-cloud-security-posture/graph @elastic/kibana-cloud-security-posture
x-pack/solutions/security/packages/kbn-cloud-security-posture/public @elastic/kibana-cloud-security-posture
+x-pack/solutions/security/packages/kbn-securitysolution-autocomplete @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-endpoint-exceptions-common @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-exception-list-components @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-exceptions-common @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-hook-utils @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-io-ts-alerting-types @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-io-ts-list-types @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-list-api @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-list-constants @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-list-hooks @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-list-utils @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-lists-common @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-t-grid @elastic/security-detection-engine
+x-pack/solutions/security/packages/kbn-securitysolution-utils @elastic/security-detection-engine
x-pack/solutions/security/packages/navigation @elastic/security-threat-hunting-explore
x-pack/solutions/security/packages/side_nav @elastic/security-threat-hunting-explore
x-pack/solutions/security/packages/storybook/config @elastic/security-threat-hunting-explore
@@ -996,6 +995,7 @@ x-pack/solutions/security/plugins/cloud_security_posture @elastic/kibana-cloud-s
x-pack/solutions/security/plugins/ecs_data_quality_dashboard @elastic/security-threat-hunting-explore
x-pack/solutions/security/plugins/elastic_assistant @elastic/security-generative-ai
x-pack/solutions/security/plugins/kubernetes_security @elastic/kibana-cloud-security-posture
+x-pack/solutions/security/plugins/lists @elastic/security-detection-engine
x-pack/solutions/security/plugins/security_solution @elastic/security-solution
x-pack/solutions/security/plugins/security_solution_ess @elastic/security-solution
x-pack/solutions/security/plugins/security_solution_serverless @elastic/security-solution
@@ -2638,7 +2638,14 @@ oas_docs/kibana.info.yaml @elastic/platform-docs
# Plugin manifests
/src/plugins/**/kibana.jsonc @elastic/kibana-core
+/src/platform/plugins/shared/**/kibana.jsonc @elastic/kibana-core
+/src/platform/plugins/private/**/kibana.jsonc @elastic/kibana-core
/x-pack/plugins/**/kibana.jsonc @elastic/kibana-core
+/x-pack/platform/plugins/shared/**/kibana.jsonc @elastic/kibana-core
+/x-pack/platform/plugins/private/**/kibana.jsonc @elastic/kibana-core
+/x-pack//solutions/observability/plugins/**/kibana.jsonc @elastic/kibana-core
+/x-pack//solutions/search/plugins/**/kibana.jsonc @elastic/kibana-core
+/x-pack//solutions/security/plugins/**/kibana.jsonc @elastic/kibana-core
# Temporary Encrypted Saved Objects (ESO) guarding
# This additional code-ownership is meant to be a temporary precaution to notify the Kibana platform security team
@@ -3354,20 +3361,20 @@ x-pack/solutions/security/packages/kbn-cloud-security-posture/public @elastic/ki
x-pack/solutions/security/packages/data-stream-adapter @elastic/security-threat-hunting
x-pack/solutions/security/packages/expandable-flyout @elastic/security-threat-hunting-investigations
x-pack/solutions/security/packages/index-adapter @elastic/security-threat-hunting
-x-pack/solutions/security/packages/kbn-securitysolution-autocomplete @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-endpoint-exceptions-common @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-exception-list-components @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-exceptions-common @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-hook-utils @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-io-ts-alerting-types @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-io-ts-list-types @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-list-api @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-list-constants @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-list-hooks @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-list-utils @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-lists-common @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-t-grid @elastic/security-detection-engine
-x-pack/solutions/security/packages/kbn-securitysolution-utils @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-autocomplete @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-endpoint-exceptions-common @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-exception-list-components @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-exceptions-common @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-hook-utils @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-io-ts-alerting-types @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-io-ts-list-types @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-list-api @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-list-constants @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-list-hooks @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-list-utils @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-lists-common @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-t-grid @elastic/security-detection-engine
+x-pack/solutions/security/x-pack/solutions/security/packages/kbn-securitysolution-utils @elastic/security-detection-engine
x-pack/solutions/security/packages/navigation @elastic/security-threat-hunting-explore
x-pack/solutions/security/packages/side_nav @elastic/security-threat-hunting-explore
x-pack/solutions/security/packages/upselling @elastic/security-threat-hunting-explore
@@ -3377,7 +3384,7 @@ x-pack/solutions/security/plugins/cloud_security_posture @elastic/kibana-cloud-s
x-pack/solutions/security/plugins/ecs_data_quality_dashboard @elastic/security-threat-hunting-explore
x-pack/solutions/security/plugins/elastic_assistant @elastic/security-generative-ai
x-pack/solutions/security/plugins/kubernetes_security @elastic/kibana-cloud-security-posture
-x-pack/solutions/security/plugins/lists @elastic/security-detection-engine
+x-pack/solutions/security/solutions/security/plugins/lists @elastic/security-detection-engine
x-pack/solutions/security/solutions/security/plugins/security_solution @elastic/security-solution
x-pack/solutions/security/solutions/security/plugins/security_solution_ess @elastic/security-solution
x-pack/solutions/security/solutions/security/plugins/security_solution_serverless @elastic/security-solution
diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml
index 8ad946732714..3077ac0f5167 100644
--- a/.github/codeql/codeql-config.yml
+++ b/.github/codeql/codeql-config.yml
@@ -78,8 +78,8 @@ paths-ignore:
- x-pack/solutions/security/plugins/elastic_assistant/scripts
- x-pack/plugins/event_log/scripts
- x-pack/plugins/fleet/scripts
- - x-pack/plugins/lists/scripts
- - x-pack/plugins/lists/server/scripts
+ - x-pack/solutions/security/plugins/lists/scripts
+ - x-pack/solutions/security/plugins/lists/server/scripts
- x-pack/plugins/observability_solution/*/scripts
- x-pack/platform/plugins/shared/osquery/scripts
- x-pack/plugins/rule_registry/scripts
diff --git a/.i18nrc.json b/.i18nrc.json
index 63cbc62d1365..0e167c2b08b5 100644
--- a/.i18nrc.json
+++ b/.i18nrc.json
@@ -6,7 +6,7 @@
"alertsUIShared": "packages/kbn-alerts-ui-shared/src",
"alertingTypes": "packages/kbn-alerting-types",
"apmOss": "src/plugins/apm_oss",
- "autocomplete": "packages/kbn-securitysolution-autocomplete/src",
+ "autocomplete": "x-pack/solutions/security/packages/kbn-securitysolution-autocomplete/src",
"avcBanner": "src/platform/packages/shared/kbn-avc-banner/src",
"bfetch": "src/plugins/bfetch",
"bfetchError": "packages/kbn-bfetch-error",
@@ -25,12 +25,13 @@
"data": "src/plugins/data",
"observabilityAlertDetails": "x-pack/solutions/observability/packages/alert_details",
"dataViews": "src/plugins/data_views",
- "defaultNavigation": [
- "packages/default-nav",
- "src/platform/packages/private/default-nav"
- ],
+ "defaultNavigation": ["packages/default-nav", "src/platform/packages/private/default-nav"],
"devTools": "src/platform/plugins/shared/dev_tools",
- "discover": ["src/plugins/discover", "packages/kbn-discover-utils", "packages/kbn-discover-contextual-components"],
+ "discover": [
+ "src/plugins/discover",
+ "packages/kbn-discover-utils",
+ "packages/kbn-discover-contextual-components"
+ ],
"savedSearch": "src/plugins/saved_search",
"embeddableApi": "src/plugins/embeddable",
"presentationPanel": "src/plugins/presentation_panel",
@@ -87,8 +88,8 @@
"kibana-react": "src/plugins/kibana_react",
"kibanaOverview": "src/plugins/kibana_overview",
"lensFormulaDocs": "packages/kbn-lens-formula-docs",
- "lists": "packages/kbn-securitysolution-list-utils/src",
- "exceptionList-components": "packages/kbn-securitysolution-exception-list-components/src",
+ "lists": "x-pack/solutions/security/packages/kbn-securitysolution-list-utils/src",
+ "exceptionList-components": "x-pack/solutions/security/packages/kbn-securitysolution-exception-list-components/src",
"management": [
"src/platform/plugins/shared/management",
"src/platform/packages/private/kbn-management",
@@ -120,11 +121,15 @@
"searchResponseWarnings": "packages/kbn-search-response-warnings",
"searchTypes": "packages/kbn-search-types",
"securitySolutionPackages": [
- "x-pack/solutions/security/packages"
- ],
- "sharedPlatformPackages": [
- "x-pack/platform/packages/shared/kbn-cloud-security-posture"
+ "x-pack/solutions/security/packages/data_table",
+ "x-pack/solutions/security/packages/ecs_data_quality_dashboard",
+ "x-pack/solutions/security/packages/features",
+ "x-pack/solutions/security/packages/kbn-cloud-security-posture",
+ "x-pack/solutions/security/packages/navigation",
+ "x-pack/solutions/security/packages/side_nav",
+ "x-pack/solutions/security/packages/upselling"
],
+ "sharedPlatformPackages": ["x-pack/platform/packages/shared/kbn-cloud-security-posture"],
"serverlessPackages": "packages/serverless",
"sse": ["src/platform/packages/shared/kbn-sse-utils"],
"coloring": "packages/kbn-coloring/src",
@@ -140,7 +145,7 @@
"uiActionsExamples": "examples/ui_action_examples",
"usageCollection": "src/plugins/usage_collection",
"userProfileComponents": "packages/kbn-user-profile-components",
- "utils": "packages/kbn-securitysolution-utils/src",
+ "utils": "x-pack/solutions/security/packages/kbn-securitysolution-utils/src",
"visDefaultEditor": "src/plugins/vis_default_editor",
"visTypeGauge": "src/plugins/vis_types/gauge",
"visTypeHeatmap": "src/plugins/vis_types/heatmap",
diff --git a/config/serverless.security.yml b/config/serverless.security.yml
index 47a67c293565..0e3a0c92f854 100644
--- a/config/serverless.security.yml
+++ b/config/serverless.security.yml
@@ -106,7 +106,7 @@ xpack.fleet.internal.registry.excludePackages: [
'dga',
# Unsupported in serverless
- 'cloud-defend',
+ 'cloud_defend',
]
# fleet_server package installed to publish agent metrics
xpack.fleet.packages:
diff --git a/dev_docs/key_concepts/building_blocks.mdx b/dev_docs/key_concepts/building_blocks.mdx
index 29cf2df7a764..1afac686d1ad 100644
--- a/dev_docs/key_concepts/building_blocks.mdx
+++ b/dev_docs/key_concepts/building_blocks.mdx
@@ -42,7 +42,7 @@ and . Every feature that is added to a registered (Lens, Maps, Saved Searches and more) will be available automatically, as well as any that are added to the Embeddable context menu panel (for example, drilldowns, custom panel time ranges, and "share to" features).
+with the . Every feature that is added to a registered (Lens, Maps, Discover sessions and more) will be available automatically, as well as any that are added to the Embeddable context menu panel (for example, drilldowns, custom panel time ranges, and "share to" features).
The Dashboard Embeddable is one of the highest-level UI components you can add to your application.
diff --git a/dev_docs/tutorials/performance/adding_custom_performance_metrics.mdx b/dev_docs/tutorials/performance/adding_custom_performance_metrics.mdx
index 37322e3f55e0..41570826ad2b 100644
--- a/dev_docs/tutorials/performance/adding_custom_performance_metrics.mdx
+++ b/dev_docs/tutorials/performance/adding_custom_performance_metrics.mdx
@@ -294,7 +294,63 @@ This event will be indexed with the following structure:
}
```
+#### Add time ranges
+
+The meta field supports telemetry on time ranges, providing calculated metrics for enhanced context. This includes:
+
+- **Query range in ceconds:**
+
+ - Calculated as the time difference in seconds between `rangeFrom` and `rangeTo`.
+
+- **Offset calculation:**
+ - A **negative offset** indicates that `rangeTo` is in the past.
+ - A **positive offset** indicates that `rangeTo` is in the future.
+ - An offset of **zero** indicates that `rangeTo` matches `'now'`.
+
+###### Code example
+
+```
+onPageReady({
+ meta: {
+ rangeFrom: 'now-15m',
+ rangeTo: 'now',
+ }
+});
+```
+
+This will be indexed as:
+
+```typescript
+{
+ "_index": "backing-ebt-kibana-browser-performance-metrics-000001", // Performance metrics are stored in a dedicated simplified index (browser \ server).
+ "_source": {
+ "timestamp": "2024-08-13T11:29:58.275Z"
+ "event_type": "performance_metric", // All performance events share a common event type to simplify mapping
+ "eventName": 'kibana:plugin_render_time', // Event name as specified when reporting it
+ "duration": 736, // Event duration as specified when reporting it
+ "meta": {
+ "target": '/home',
+ "query_range_secs": 900
+ "query_offset_secs": 0 // now
+ },
+ "context": { // Context holds information identifying the deployment, version, application and page that generated the event
+ "version": "8.16.0-SNAPSHOT",
+ "cluster_name": "elasticsearch",
+ "pageName": "application:home:app",
+ "applicationId": "home",
+ "page": "app",
+ "entityId": "61c58ad0-3dd3-11e8-b2b9-5d5dc1715159",
+ "branch": "main",
+ ...
+ },
+
+ ...
+ },
+}
+```
+
#### Add custom metrics
+
Having `kibana:plugin_render_time` metric event is not always enough, depending on the use case you would likely need some complementary information to give some sense to the value reported by the metric (e.g. number of hosts, number of services, number of dataStreams, etc).
`kibana:plugin_render_time` metric API supports up to 9 numbered free fields that can be used to report numeric metrics that you intend to analyze. Note that they can be used for any type of numeric information you may want to report.
@@ -304,10 +360,12 @@ We could make use of these custom metrics using the following format:
...
// Call onPageReady once the meaningful data has rendered and visible to the user
onPageReady({
- key1: 'datasets',
- value1: 5,
- key2: 'documents',
- value2: 1000,
+ customMetrics: {
+ key1: 'datasets',
+ value1: 5,
+ key2: 'documents',
+ value2: 1000,
+ }
});
...
```
diff --git a/docs/concepts/data-views.asciidoc b/docs/concepts/data-views.asciidoc
index 02922b298976..eb090554186a 100644
--- a/docs/concepts/data-views.asciidoc
+++ b/docs/concepts/data-views.asciidoc
@@ -166,7 +166,7 @@ clusters or indicies from cross-cluster search].
When you delete a {data-source}, you cannot recover the associated field formatters, runtime fields, source filters,
and field popularity data. Deleting a {data-source} does not remove any indices or data documents from {es}.
-WARNING: Deleting a {data-source} breaks all visualizations, saved searches, and other saved objects that reference the data view.
+WARNING: Deleting a {data-source} breaks all visualizations, saved Discover sessions, and other saved objects that reference the data view.
. Go to the **Data Views** management page using the navigation menu or the <>.
diff --git a/docs/concepts/esql.asciidoc b/docs/concepts/esql.asciidoc
index a3a091a4c6d0..0b9af290c2d8 100644
--- a/docs/concepts/esql.asciidoc
+++ b/docs/concepts/esql.asciidoc
@@ -26,7 +26,7 @@ disabled using the `enableESQL` setting from the
{kibana-ref}/advanced-options.html[Advanced Settings].
This will hide the {esql} user interface from various applications.
-However, users will be able to access existing {esql} artifacts like saved searches and visualizations.
+However, users will be able to access existing {esql} artifacts like saved Discover sessions and visualizations.
====
[float]
diff --git a/docs/concepts/save-query.asciidoc b/docs/concepts/save-query.asciidoc
index b249f7e9aea2..a4d6dd28ea6e 100644
--- a/docs/concepts/save-query.asciidoc
+++ b/docs/concepts/save-query.asciidoc
@@ -11,10 +11,10 @@ Save this query, and you can embed the search results in dashboards,
use them as a foundation for building a visualization,
and share them in a link or CVS form.
-Saved queries are different than <>,
+Saved queries are different than <>,
which include the *Discover* configuration—selected columns in the document table, sort order, and
{data-source}—in addition to the query.
-Saved searches are primarily used for adding search results to a dashboard.
+Discover sessions are primarily used for adding search results to a dashboard.
[role="xpack"]
==== Read-only access
diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc
index f18bafe5221b..80511095a000 100644
--- a/docs/developer/plugin-list.asciidoc
+++ b/docs/developer/plugin-list.asciidoc
@@ -309,6 +309,7 @@ oss plugins.
|{kib-repo}blob/{branch}/src/plugins/saved_search/README.md[savedSearch]
|Contains the saved search saved object definition and helpers.
+This object is created when a user saves their current session in the Discover app.
|{kib-repo}blob/{branch}/src/plugins/screenshot_mode/README.md[screenshotMode]
@@ -693,7 +694,7 @@ the infrastructure monitoring use-case within Kibana.
|The licensing plugin retrieves license data from Elasticsearch at regular configurable intervals.
-|{kib-repo}blob/{branch}/x-pack/plugins/lists/README.md[lists]
+|{kib-repo}blob/{branch}/x-pack/solutions/security/plugins/lists/README.md[lists]
|README.md for developers working on the backend lists on how to get started
using the CURL scripts in the scripts folder.
@@ -815,7 +816,7 @@ Elastic.
|Add tagging capability to saved objects
-|{kib-repo}blob/{branch}/x-pack/plugins/screenshotting/README.md[screenshotting]
+|{kib-repo}blob/{branch}/x-pack/platform/plugins/shared/screenshotting/README.md[screenshotting]
|This plugin provides functionality to take screenshots of the Kibana pages.
It uses Chromium and Puppeteer underneath to run the browser in headless mode.
diff --git a/docs/discover/document-explorer.asciidoc b/docs/discover/document-explorer.asciidoc
index 47b4a5bc3fcf..d026cf2930f1 100644
--- a/docs/discover/document-explorer.asciidoc
+++ b/docs/discover/document-explorer.asciidoc
@@ -36,7 +36,7 @@ In the pop-up, drag the column names to their new order.
* To resize a column, drag the right edge of the column header until the column is the width that you want.
+
-Column widths are stored with a saved search. When you visualize saved searches on dashboards, the saved search appears the same as in **Discover**.
+Column widths are stored with a Discover session. When you add a Discover session as a dashboard panel, it appears the same as in **Discover**.
[float]
[[document-explorer-density]]
diff --git a/docs/discover/get-started-discover.asciidoc b/docs/discover/get-started-discover.asciidoc
index ec44f977f4aa..f3ffcc92b582 100644
--- a/docs/discover/get-started-discover.asciidoc
+++ b/docs/discover/get-started-discover.asciidoc
@@ -293,24 +293,24 @@ Learn more about how to use ES|QL queries in <>.
[float]
[[save-discover-search]]
-==== Save your search for later use
+==== Save your Discover session for later use
-Save your search so you can use it later, generate a CSV report, or use it to create visualizations, dashboards, and Canvas workpads.
-Saving a search saves the query text, filters,
+Save your Discover session so you can use it later, generate a CSV report, or use it to create visualizations, dashboards, and Canvas workpads.
+Saving a Discover session saves the query text, filters,
and current view of *Discover*, including the columns selected in
the document table, the sort order, and the {data-source}.
. In the application menu bar, click **Save**.
-. Give your search a title and a description.
+. Give your session a title and a description.
-. Optionally store <> and the time range with the search.
+. Optionally store <> and the time range with the session.
. Click **Save**.
[float]
[[share-your-findings]]
-==== Share your search
+==== Share your Discover session
To share your search and **Discover** view with a larger audience, click *Share* in the application menu bar.
For detailed information about the sharing options, refer to <>.
diff --git a/docs/discover/save-search.asciidoc b/docs/discover/save-search.asciidoc
index 024fd97ab107..d661e8c01b83 100644
--- a/docs/discover/save-search.asciidoc
+++ b/docs/discover/save-search.asciidoc
@@ -1,9 +1,9 @@
[[save-open-search]]
-== Save a search for reuse
+== Save a Discover session for reuse
-A saved search is a convenient way to reuse a search
+A saved Discover session is a convenient way to reuse a search
that you've created in *Discover*.
-Saved searches are good for adding search results to a dashboard,
+Discover sessions are good for saving a configured view of Discover to use later or adding search results to a dashboard,
and can also serve as a foundation for building visualizations.
[role="xpack"]
@@ -16,27 +16,27 @@ displayed and the *Save* button is not visible. For more information, refer to <
[role="screenshot"]
image::discover/images/read-only-badge.png[Example of Discover's read only access indicator in Kibana's header]
[float]
-=== Save a search
+=== Save a Discover session
-By default, a saved search stores the query text, filters, and
+By default, a Discover session stores the query text, filters, and
current view of *Discover*, including the columns and sort order in the document table, and the {data-source}.
-. Once you've created a search worth saving, click *Save* in the toolbar.
-. Enter a name for the search.
-. Optionally store <> and the time range with the search.
+. Once you've created a view worth saving, click *Save* in the toolbar.
+. Enter a name for the session.
+. Optionally store <> and the time range with the session.
. Click *Save*.
-. To reload your search results in *Discover*, click *Open* in the toolbar, and select the saved search.
+. To reload your search results in *Discover*, click *Open* in the toolbar, and select the saved Discover session.
+
-If the saved search is associated with a different {data-source} than is currently
-selected, opening the saved search changes the selected {data-source}. The query language
-used for the saved search is also automatically selected.
+If the saved Discover session is associated with a different {data-source} than is currently
+selected, opening the saved Discover session changes the selected {data-source}. The query language
+used for the saved Discover session is also automatically selected.
[float]
-=== Duplicate a search
-. In **Discover**, open the search that you want to duplicate.
+=== Duplicate a Discover session
+. In **Discover**, open the Discover session that you want to duplicate.
. In the toolbar, click *Save*.
-. Give the search a new name.
-. Turn on **Save as new search**.
+. Give the session a new name.
+. Turn on **Save as new Discover session**.
. Click *Save*.
@@ -46,5 +46,5 @@ used for the saved search is also automatically selected.
. Go to *Dashboards*.
. Open or create the dashboard, then click *Edit*.
. Click *Add from library*.
-. From the *Types* dropdown, select *Saved search*.
-. Select the saved search that you want to visualize, then click *X* to close the list.
+. From the *Types* dropdown, select *Discover session*.
+. Select the Discover session that you want to add, then click *X* to close the list.
diff --git a/docs/discover/search-sessions.asciidoc b/docs/discover/search-sessions.asciidoc
index fe1e945e676f..5d6b4a2d0043 100644
--- a/docs/discover/search-sessions.asciidoc
+++ b/docs/discover/search-sessions.asciidoc
@@ -52,7 +52,7 @@ image::images/search-session-awhile.png[Search Session indicator displaying the
Once you save a search session, you can start a new search,
navigate to a different application, or close the browser.
-. To view your saved searches, go to the
+. To view your saved search sessions, go to the
*Search Sessions* management page using the navigation menu or the <>.
For a saved or completed session, you can also open this view from the search sessions popup.
diff --git a/docs/discover/search.asciidoc b/docs/discover/search.asciidoc
index 439c5c443cc0..c7fde4159ec9 100644
--- a/docs/discover/search.asciidoc
+++ b/docs/discover/search.asciidoc
@@ -92,10 +92,10 @@ status:[400 TO 499] AND (extension:php OR extension:html)
[[save-open-search]]
-=== Save a search
-A saved search persists your current view of Discover for later retrieval and reuse. You can reload a saved search into Discover, add it to a dashboard, and use it as the basis for a visualization.
+=== Save a Discover session
+A saved Discover session persists your current view of Discover for later retrieval and reuse. You can reload a saved session into Discover, add it to a dashboard, and use it as the basis for a visualization.
-A saved search includes the query text, filters, and optionally, the time filter. A saved search also includes the selected columns in the document table, the sort order, and the current index pattern.
+A Discover session includes the query text, filters, and optionally, the time filter. A Discover session also includes the selected columns in the document table, the sort order, and the current {data-source}.
[role="xpack"]
[[discover-read-only-access]]
@@ -107,23 +107,23 @@ Kibana see <>.
[role="screenshot"]
image::discover/images/read-only-badge.png[Example of Discover's read only access indicator in Kibana's header]
-==== Save a search
-To save the current search:
+==== Save a Discover session
+To save the current session:
. Click *Save* in the toolbar.
-. Enter a name for the search and click *Save*.
+. Enter a name for the session and click *Save*.
-To import, export, and delete saved searches, go to the *Saved Objects* management page using the navigation menu or the <>.
+To import, export, and delete saved Discover sessions, go to the *Saved Objects* management page using the navigation menu or the <>.
-==== Open a saved search
-To load a saved search into Discover:
+==== Open a saved Discover session
+To load a saved session into Discover:
. Click *Open* in the toolbar.
-. Select the search you want to open.
+. Select the session you want to open.
-If the saved search is associated with a different index pattern than is currently
-selected, opening the saved search changes the selected index pattern. The query language
-used for the saved search will also be automatically selected.
+If the saved Discover session is associated with a different {data-source} than is currently
+selected, opening the saved Discover session changes the selected {data-source}. The query language
+used for the saved Discover session will also be automatically selected.
[[save-load-delete-query]]
=== Save a query
@@ -133,7 +133,7 @@ A saved query is a portable collection of query text and filters that you can re
* View the results of the same query in multiple apps
* Share your query
-Saved queries don't include information specific to Discover, such as the currently selected columns in the document table, the sort order, and the index pattern. If you want to save your current view of Discover for later retrieval and reuse, create a <> instead.
+Saved queries don't include information specific to Discover, such as the currently selected columns in the document table, the sort order, and the {data-source}. If you want to save your current view of Discover for later retrieval and reuse, create a <> instead.
[role="xpack"]
==== Read-only access
diff --git a/docs/fleet/fleet.asciidoc b/docs/fleet/fleet.asciidoc
index 52c282555700..366d28fae3f5 100644
--- a/docs/fleet/fleet.asciidoc
+++ b/docs/fleet/fleet.asciidoc
@@ -18,7 +18,7 @@ It is recommended for advanced users only.
[role="screenshot"]
image::fleet/images/fleet-start.png[{fleet} app in {kib}]
-Most integration content installed by {fleet} isn’t editable. This content is tagged with a **Managed** badge in the {kib} UI. Managed content itself cannot be edited or deleted, however managed visualizations, dashboards, and saved searches can be cloned.
+Most integration content installed by {fleet} isn’t editable. This content is tagged with a **Managed** badge in the {kib} UI. Managed content itself cannot be edited or deleted, however managed visualizations, dashboards, and Discover sessions can be cloned.
[role="screenshot"]
image::fleet/images/system-managed.png[An image of the new managed badge.]
@@ -37,7 +37,7 @@ To clone a dashboard:
. Click *Save and return* after editing the dashboard.
. Click *Save*.
-To clone managed content relating to specific visualization editors, such as Lens, TSVB, and Maps, view the visualization in the editor then begin to make edits. Unlike cloning dashboards, and dashboard panels, the cloned content retains the original configurations. Once finished you are prompted to save the edits as a new visualization. The same applies for altering any saved searches in a managed visualization.
+To clone managed content relating to specific visualization editors, such as Lens, TSVB, and Maps, view the visualization in the editor then begin to make edits. Unlike cloning dashboards, and dashboard panels, the cloned content retains the original configurations. Once finished you are prompted to save the edits as a new visualization. The same applies for altering any linked Discover sessions in a managed visualization.
[float]
== Get started
diff --git a/docs/management/advanced-options.asciidoc b/docs/management/advanced-options.asciidoc
index ef6d6306792b..5f51a86b01ae 100644
--- a/docs/management/advanced-options.asciidoc
+++ b/docs/management/advanced-options.asciidoc
@@ -311,7 +311,7 @@ Sets the maximum number of rows for the entire document table. This is the maxim
[[discover-searchonpageload]]`discover:searchOnPageLoad`::
Controls whether a search is executed when *Discover* first loads. This setting
-does not have an effect when loading a saved search.
+does not have an effect when loading a saved Discover session.
[[discover:showFieldStatistics]]`discover:showFieldStatistics`::
beta[] Enables the Field statistics view. Examine details such as
@@ -324,10 +324,10 @@ Controls the display of multi-fields in the expanded document view.
The default sort direction for time-based data views.
[[doctable-hidetimecolumn]]`doc_table:hideTimeColumn`::
-Hides the "Time" column in *Discover* and in all saved searches on dashboards.
+Hides the "Time" column in *Discover* and in all Discover session panels on dashboards.
[[doctable-highlight]]`doc_table:highlight`::
-Highlights results in *Discover* and saved searches on dashboards. Highlighting
+Highlights search results in *Discover* and Discover session panels on dashboards. Highlighting
slows requests when working on big documents.
diff --git a/docs/search/playground/index.asciidoc b/docs/search/playground/index.asciidoc
index 72d8eccab47c..465637e79bc0 100644
--- a/docs/search/playground/index.asciidoc
+++ b/docs/search/playground/index.asciidoc
@@ -18,7 +18,16 @@ Refer to the following for more advanced topics:
* <>
* <>
-* <>
+* <>
+
+.🍿 Getting started videos
+***********************
+Watch these video tutorials to help you get started:
+
+* https://www.youtube.com/watch?v=zTHgJ3rhe10[Getting Started]
+* https://www.youtube.com/watch?v=ZtxoASFvkno[Using Playground with local LLMs]
+***********************
+
[float]
[[playground-how-it-works]]
@@ -259,4 +268,4 @@ Once you've got {x} up and running, and you've tested out the chat interface, yo
include::playground-context.asciidoc[]
include::playground-query.asciidoc[]
-include::playground-troubleshooting.asciidoc[]
\ No newline at end of file
+include::playground-troubleshooting.asciidoc[]
diff --git a/docs/setup/configuring-reporting.asciidoc b/docs/setup/configuring-reporting.asciidoc
index bcef6a026625..8711185dbc1b 100644
--- a/docs/setup/configuring-reporting.asciidoc
+++ b/docs/setup/configuring-reporting.asciidoc
@@ -121,8 +121,8 @@ PUT :/api/security/role/custom_reporting_user
// CONSOLE
<1> Grants access to generate PNG and PDF reports in *Dashboard*.
-<2> Grants access to generate CSV reports from saved search panels in *Dashboard*.
-<3> Grants access to generate CSV reports from saved searches in *Discover*.
+<2> Grants access to generate CSV reports from saved Discover session panels in *Dashboard*.
+<3> Grants access to generate CSV reports from saved Discover sessions in *Discover*.
<4> Grants access to generate PDF reports in *Canvas*.
<5> Grants access to generate PNG and PDF reports in *Visualize Library*.
@@ -157,8 +157,8 @@ PUT localhost:5601/api/security/role/custom_reporting_user
---------------------------------------------------------------
// CONSOLE
-<1> Grants access to generate CSV reports from saved searches in *Discover*.
-<2> Grants access to generate CSV reports from saved search panels in *Dashboard*.
+<1> Grants access to generate CSV reports from saved Discover sessions in *Discover*.
+<2> Grants access to generate CSV reports from saved Discover session panels in *Dashboard*.
[float]
[[grant-user-access-external-provider]]
diff --git a/docs/user/dashboard/aggregation-based.asciidoc b/docs/user/dashboard/aggregation-based.asciidoc
index f27d60928e6f..e3f1f0bea671 100644
--- a/docs/user/dashboard/aggregation-based.asciidoc
+++ b/docs/user/dashboard/aggregation-based.asciidoc
@@ -7,7 +7,7 @@ With aggregation-based visualizations, you can:
* Split charts up to three aggregation levels, which is more than *Lens* and *TSVB*
* Create visualization with non-time series data
-* Use a <> as an input
+* Use a <> as an input
* Sort data tables and use the summary row and percentage column features
* Assign colors to data series
* Extend features with plugins
@@ -112,7 +112,7 @@ Choose the type of visualization you want to create, then use the editor to conf
.. Select the data source you want to visualize.
+
-NOTE: There is no performance impact on the data source you select. For example, *Discover* saved searches perform the same as {data-sources}.
+NOTE: There is no performance impact on the data source you select. For example, saved Discover sessions perform the same as {data-sources}.
. Add the <> you want to visualize using the editor, then click *Update*.
+
diff --git a/docs/user/dashboard/create-visualizations.asciidoc b/docs/user/dashboard/create-visualizations.asciidoc
index 815f46d5711e..f0cf95733a97 100644
--- a/docs/user/dashboard/create-visualizations.asciidoc
+++ b/docs/user/dashboard/create-visualizations.asciidoc
@@ -163,9 +163,9 @@ To enable series data interactions, configure <> data in *Discover*.
+* *Discover session interactions* — Opens <> data in *Discover*.
+
-To use saved search interactions, open the panel menu, then click *More > View saved search*.
+To use saved Discover session interactions, open the panel menu, then click *More > View Discover session*.
[[edit-panels]]
=== Edit panels
diff --git a/docs/user/dashboard/lens.asciidoc b/docs/user/dashboard/lens.asciidoc
index 3c2a120d167d..525ff8d7bfb6 100644
--- a/docs/user/dashboard/lens.asciidoc
+++ b/docs/user/dashboard/lens.asciidoc
@@ -668,10 +668,10 @@ For area, line, and bar charts, press Shift, then click the series in the legend
[discrete]
[[is-it-possible-to-use-saved-serches-in-lens]]
-.*How do I visualize saved searches?*
+.*How do I visualize saved Discover sessions?*
[%collapsible]
====
-Visualizing saved searches in unsupported.
+Visualizing saved Discover sessions in unsupported.
====
[discrete]
diff --git a/docs/user/dashboard/tsvb.asciidoc b/docs/user/dashboard/tsvb.asciidoc
index e8e7cec48800..15433b19b6fc 100644
--- a/docs/user/dashboard/tsvb.asciidoc
+++ b/docs/user/dashboard/tsvb.asciidoc
@@ -233,7 +233,7 @@ For example `https://example.org/{{key}}`
This instructs TSVB to substitute the value from your visualization wherever it sees `{{key}}`.
-If your data contain reserved or invalid URL characters such as "#" or "&", you should apply a transform to URL-encode the key like this `{{encodeURIComponent key}}`. If you are dynamically constructing a drilldown to another location in Kibana (for example, clicking a table row takes to you a value-scoped saved search), you will likely want to Rison-encode your key as it may contain invalid Rison characters. (https://github.com/Nanonid/rison#rison---compact-data-in-uris[Rison] is the serialization format many parts of Kibana use to store information in their URL.)
+If your data contain reserved or invalid URL characters such as "#" or "&", you should apply a transform to URL-encode the key like this `{{encodeURIComponent key}}`. If you are dynamically constructing a drilldown to another location in Kibana (for example, clicking a table row takes to you a value-scoped Discover session), you will likely want to Rison-encode your key as it may contain invalid Rison characters. (https://github.com/Nanonid/rison#rison---compact-data-in-uris[Rison] is the serialization format many parts of Kibana use to store information in their URL.)
For example: `discover#/view/0ac50180-82d9-11ec-9f4a-55de56b00cc0?_a=(filters:!((query:(match_phrase:(foo.keyword:{{rison key}})))))`
diff --git a/docs/user/management.asciidoc b/docs/user/management.asciidoc
index c46786b98829..b503dbdc2d0e 100644
--- a/docs/user/management.asciidoc
+++ b/docs/user/management.asciidoc
@@ -85,7 +85,7 @@ You can add and remove remote clusters, and check their connectivity.
| <>
| Monitor the generation of reports—PDF, PNG, and CSV—and download reports that you previously generated.
-A report can contain a dashboard, visualization, saved search, or Canvas workpad.
+A report can contain a dashboard, visualization, table with Discover search results, or Canvas workpad.
| Machine Learning Jobs
| View, export, and import your <> and
diff --git a/docs/user/ml/index.asciidoc b/docs/user/ml/index.asciidoc
index 91227055fa8a..92a28a1fdb0c 100644
--- a/docs/user/ml/index.asciidoc
+++ b/docs/user/ml/index.asciidoc
@@ -168,7 +168,7 @@ It makes it easy to find and investigate causes of unusual spikes or drops by us
Examine the histogram chart of the log rates for a given {data-source}, and find the reason behind a particular change possibly in millions of log events across multiple fields and values.
You can find log rate analysis embedded in multiple applications.
-In {kib}, you can find it under **{ml-app}** > **AIOps Labs** or by using the <>. Here, you can select the {data-source} or saved search that you want to analyze.
+In {kib}, you can find it under **{ml-app}** > **AIOps Labs** or by using the <>. Here, you can select the {data-source} or saved Discover session that you want to analyze.
[role="screenshot"]
image::user/ml/images/ml-log-rate-analysis-before.png[Log event histogram chart]
@@ -203,7 +203,7 @@ and an example document that matches the category.
//end::log-pattern-analysis-intro[]
You can find log pattern analysis under **{ml-app}** > **AIOps Labs** or by using the <>.
-Here, you can select the {data-source} or saved search that you want to analyze, or in
+Here, you can select the {data-source} or saved Discover session that you want to analyze, or in
**Discover** as an available action for any text field.
[role="screenshot"]
@@ -228,7 +228,7 @@ to detect distribution changes, trend changes, and other statistically
significant change points in a metric of your time series data.
You can find change point detection under **{ml-app}** > **AIOps Labs** or by using the <>.
-Here, you can select the {data-source} or saved search that you want to analyze.
+Here, you can select the {data-source} or saved Discover session that you want to analyze.
[role="screenshot"]
image::user/ml/images/ml-change-point-detection.png[Change point detection UI]
diff --git a/docs/user/reporting/automating-report-generation.asciidoc b/docs/user/reporting/automating-report-generation.asciidoc
index b4334b7c7ea8..0b773decd60a 100644
--- a/docs/user/reporting/automating-report-generation.asciidoc
+++ b/docs/user/reporting/automating-report-generation.asciidoc
@@ -24,7 +24,7 @@ To create the POST URL for CSV reports:
. Go to *Discover*.
-. Open the saved search you want to share.
+. Open the saved Discover session you want to share.
. In the toolbar, click *Share > Export > Copy POST URL*.
@@ -54,7 +54,7 @@ If you experience issues with the deprecated report URLs after you upgrade {kib}
* *Dashboard* reports: `/api/reporting/generate/dashboard/`
* *Visualize Library* reports: `/api/reporting/generate/visualization/`
-* *Discover* saved search reports: `/api/reporting/generate/search/`
+* *Discover* reports: `/api/reporting/generate/search/`
IMPORTANT:
In earlier {kib} versions, you could use the `&sync` parameter to append to report URLs that held the request open until the document was fully generated. The `&sync` parameter is now unsupported. If you use the `&sync` parameter in Watcher, you must update the parameter.
diff --git a/docs/user/reporting/index.asciidoc b/docs/user/reporting/index.asciidoc
index 4425cc45d9b4..7a52f5d77b10 100644
--- a/docs/user/reporting/index.asciidoc
+++ b/docs/user/reporting/index.asciidoc
@@ -4,16 +4,16 @@
[partintro]
--
-:frontmatter-description: {kib} provides you with several options to share *Discover* saved searches, dashboards, *Visualize Library* visualizations, and *Canvas* workpads with others, or on a website.
+:frontmatter-description: {kib} provides you with several options to share *Discover* sessions, dashboards, *Visualize Library* visualizations, and *Canvas* workpads with others, or on a website.
:frontmatter-tags-products: [kibana]
-{kib} provides you with several options to share *Discover* saved searches, dashboards, *Visualize Library* visualizations, and *Canvas* workpads. These sharing options are available from the *Share* menu in the toolbar.
+{kib} provides you with several options to share *Discover* sessions, dashboards, *Visualize Library* visualizations, and *Canvas* workpads. These sharing options are available from the *Share* menu in the toolbar.
[float]
[[share-a-direct-link]]
== Share with a direct link
-You can share direct links to saved searches, dashboards, and visualizations. When clicking **Share**, look for the **Links** tab to get the shareable link and copy it.
+You can share direct links to saved Discover sessions, dashboards, and visualizations. When clicking **Share**, look for the **Links** tab to get the shareable link and copy it.
TIP: When sharing an object with unsaved changes, you get a temporary link that might break in the future, for example in case of upgrade. Save the object to get a permanent link instead.
@@ -29,13 +29,13 @@ image::https://images.contentstack.io/v3/assets/bltefdd0b53724fa2ce/blt49f2b5a80
NOTE: For more information on how to configure reporting in {kib}, refer to <>
-Create and download PDF, PNG, or CSV reports of saved searches, dashboards, visualizations, and workpads.
+Create and download PDF, PNG, or CSV reports of saved Discover sessions, dashboards, visualizations, and workpads.
* *PDF* — Generate and download PDF files of dashboards, visualizations, and *Canvas* workpads. PDF reports are a link:https://www.elastic.co/subscriptions[subscription feature].
* *PNG* — Generate and download PNG files of dashboards and visualizations. PNG reports are a link:https://www.elastic.co/subscriptions[subscription feature].
-* *CSV Reports* — Generate CSV reports of saved searches. <>.
+* *CSV Reports* — Generate CSV reports of saved Discover sessions. <>.
* *CSV Download* — Generate and download CSV files of *Lens* visualizations.
@@ -44,7 +44,7 @@ Create and download PDF, PNG, or CSV reports of saved searches, dashboards, visu
[[reporting-layout-sizing]]
The layout and size of the report depends on what you are sharing.
-For saved searches, dashboards, and visualizations, the layout depends on the size of the panels.
+For saved Discover sessions, dashboards, and visualizations, the layout depends on the size of the panels.
For workpads, the layout depends on the size of the worksheet dimensions.
To change the output size, change the size of the browser, which resizes the shareable container before the report generates. It might take some trial and error before you're satisfied.
@@ -54,13 +54,13 @@ In the following dashboard, the shareable container is highlighted:
[role="screenshot"]
image::user/reporting/images/shareable-container.png["Shareable Container"]
-. Open the saved search, dashboard, visualization, or workpad you want to share.
+. Open the saved Discover session, dashboard, visualization, or workpad you want to share.
. From the toolbar, click *Share*, then select the report option.
* If you are creating dashboard PDFs, select *For printing* to create printer-friendly PDFs with multiple A4 portrait pages and two visualizations per page.
+
-NOTE: When you create a dashboard report that includes a data table or saved search, the PDF includes only the visible data.
+NOTE: When you create a dashboard report that includes a data table or Discover session, the PDF includes only the visible data.
* If you are creating workpad PDFs, select *Full page layout* to create PDFs without margins that surround the workpad.
diff --git a/examples/content_management_examples/public/examples/finder/finder_app.tsx b/examples/content_management_examples/public/examples/finder/finder_app.tsx
index b8aaa6fe5f34..dda034e71118 100644
--- a/examples/content_management_examples/public/examples/finder/finder_app.tsx
+++ b/examples/content_management_examples/public/examples/finder/finder_app.tsx
@@ -37,7 +37,7 @@ export const FinderApp = (props: {
{
type: `search`,
getIconForSavedObject: () => 'discoverApp',
- name: 'Saved search',
+ name: 'Discover session',
},
{
type: 'index-pattern',
diff --git a/oas_docs/bundle.json b/oas_docs/bundle.json
index 320730edc972..3e3d47df0166 100644
--- a/oas_docs/bundle.json
+++ b/oas_docs/bundle.json
@@ -39790,7 +39790,7 @@
},
"/api/spaces/_copy_saved_objects": {
"post": {
- "description": "It also allows you to automatically copy related objects, so when you copy a dashboard, this can automatically copy over the associated visualizations, data views, and saved searches, as required. You can request to overwrite any objects that already exist in the target space if they share an identifier or you can use the resolve copy saved objects conflicts API to do this on a per-object basis.
[Required authorization] Route required privileges: ALL of [copySavedObjectsToSpaces].",
+ "description": "It also allows you to automatically copy related objects, so when you copy a dashboard, this can automatically copy over the associated visualizations, data views, and saved Discover sessions, as required. You can request to overwrite any objects that already exist in the target space if they share an identifier or you can use the resolve copy saved objects conflicts API to do this on a per-object basis.
[Required authorization] Route required privileges: ALL of [copySavedObjectsToSpaces].",
"operationId": "post-spaces-copy-saved-objects",
"parameters": [
{
diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml
index f12014443bb0..5845ba56ae89 100644
--- a/oas_docs/output/kibana.yaml
+++ b/oas_docs/output/kibana.yaml
@@ -37372,7 +37372,7 @@ paths:
- roles
/api/spaces/_copy_saved_objects:
post:
- description: 'It also allows you to automatically copy related objects, so when you copy a dashboard, this can automatically copy over the associated visualizations, data views, and saved searches, as required. You can request to overwrite any objects that already exist in the target space if they share an identifier or you can use the resolve copy saved objects conflicts API to do this on a per-object basis.
[Required authorization] Route required privileges: ALL of [copySavedObjectsToSpaces].'
+ description: 'It also allows you to automatically copy related objects, so when you copy a dashboard, this can automatically copy over the associated visualizations, data views, and saved Discover sessions, as required. You can request to overwrite any objects that already exist in the target space if they share an identifier or you can use the resolve copy saved objects conflicts API to do this on a per-object basis.
[Required authorization] Route required privileges: ALL of [copySavedObjectsToSpaces].'
operationId: post-spaces-copy-saved-objects
parameters:
- description: A required header to protect against CSRF attacks
diff --git a/oas_docs/scripts/merge_ess_oas.js b/oas_docs/scripts/merge_ess_oas.js
index 3d96ad5b5933..df0b6e5a4ac0 100644
--- a/oas_docs/scripts/merge_ess_oas.js
+++ b/oas_docs/scripts/merge_ess_oas.js
@@ -27,9 +27,9 @@ const { REPO_ROOT } = require('@kbn/repo-info');
// Security solution
`${REPO_ROOT}/x-pack/solutions/security/plugins/security_solution/docs/openapi/ess/*.schema.yaml`,
- `${REPO_ROOT}/packages/kbn-securitysolution-lists-common/docs/openapi/ess/*.schema.yaml`,
- `${REPO_ROOT}/packages/kbn-securitysolution-exceptions-common/docs/openapi/ess/*.schema.yaml`,
- `${REPO_ROOT}/packages/kbn-securitysolution-endpoint-exceptions-common/docs/openapi/ess/*.schema.yaml`,
+ `${REPO_ROOT}/x-pack/solutions/security/packages/kbn-securitysolution-lists-common/docs/openapi/ess/*.schema.yaml`,
+ `${REPO_ROOT}/x-pack/solutions/security/packages/kbn-securitysolution-exceptions-common/docs/openapi/ess/*.schema.yaml`,
+ `${REPO_ROOT}/x-pack/solutions/security/packages/kbn-securitysolution-endpoint-exceptions-common/docs/openapi/ess/*.schema.yaml`,
`${REPO_ROOT}/x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/ess/*.schema.yaml`,
`${REPO_ROOT}/x-pack/platform/plugins/shared/osquery/docs/openapi/ess/*.schema.yaml`,
],
diff --git a/oas_docs/scripts/merge_serverless_oas.js b/oas_docs/scripts/merge_serverless_oas.js
index 2f92195502db..343487d8fc4f 100644
--- a/oas_docs/scripts/merge_serverless_oas.js
+++ b/oas_docs/scripts/merge_serverless_oas.js
@@ -25,9 +25,9 @@ const { REPO_ROOT } = require('@kbn/repo-info');
// Security solution
`${REPO_ROOT}/x-pack/solutions/security/plugins/security_solution/docs/openapi/serverless/*.schema.yaml`,
- `${REPO_ROOT}/packages/kbn-securitysolution-lists-common/docs/openapi/serverless/*.schema.yaml`,
- `${REPO_ROOT}/packages/kbn-securitysolution-exceptions-common/docs/openapi/serverless/*.schema.yaml`,
- `${REPO_ROOT}/packages/kbn-securitysolution-endpoint-exceptions-common/docs/openapi/serverless/*.schema.yaml`,
+ `${REPO_ROOT}/x-pack/solutions/security/packages/kbn-securitysolution-lists-common/docs/openapi/serverless/*.schema.yaml`,
+ `${REPO_ROOT}/x-pack/solutions/security/packages/kbn-securitysolution-exceptions-common/docs/openapi/serverless/*.schema.yaml`,
+ `${REPO_ROOT}/x-pack/solutions/security/packages/kbn-securitysolution-endpoint-exceptions-common/docs/openapi/serverless/*.schema.yaml`,
`${REPO_ROOT}/x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/serverless/*.schema.yaml`,
`${REPO_ROOT}/x-pack/platform/plugins/shared/osquery/docs/openapi/serverless/*.schema.yaml`,
],
diff --git a/package.json b/package.json
index ee007b076af4..a60710029650 100644
--- a/package.json
+++ b/package.json
@@ -619,7 +619,7 @@
"@kbn/license-management-plugin": "link:x-pack/platform/plugins/shared/license_management",
"@kbn/licensing-plugin": "link:x-pack/plugins/licensing",
"@kbn/links-plugin": "link:src/plugins/links",
- "@kbn/lists-plugin": "link:x-pack/plugins/lists",
+ "@kbn/lists-plugin": "link:x-pack/solutions/security/plugins/lists",
"@kbn/llm-tasks-plugin": "link:x-pack/platform/plugins/shared/ai_infra/llm_tasks",
"@kbn/locator-examples-plugin": "link:examples/locator_examples",
"@kbn/locator-explorer-plugin": "link:examples/locator_explorer",
@@ -713,7 +713,7 @@
"@kbn/observability-utils-server": "link:x-pack/packages/observability/observability_utils/observability_utils_server",
"@kbn/oidc-provider-plugin": "link:x-pack/test/security_api_integration/plugins/oidc_provider",
"@kbn/open-telemetry-instrumented-plugin": "link:test/common/plugins/otel_metrics",
- "@kbn/openapi-common": "link:packages/kbn-openapi-common",
+ "@kbn/openapi-common": "link:src/platform/packages/shared/kbn-openapi-common",
"@kbn/osquery-io-ts-types": "link:src/platform/packages/shared/kbn-osquery-io-ts-types",
"@kbn/osquery-plugin": "link:x-pack/platform/plugins/shared/osquery",
"@kbn/paertial-results-example-plugin": "link:examples/partial_results_example",
@@ -796,7 +796,7 @@
"@kbn/screenshot-mode-example-plugin": "link:examples/screenshot_mode_example",
"@kbn/screenshot-mode-plugin": "link:src/plugins/screenshot_mode",
"@kbn/screenshotting-example-plugin": "link:x-pack/examples/screenshotting_example",
- "@kbn/screenshotting-plugin": "link:x-pack/plugins/screenshotting",
+ "@kbn/screenshotting-plugin": "link:x-pack/platform/plugins/shared/screenshotting",
"@kbn/screenshotting-server": "link:packages/kbn-screenshotting-server",
"@kbn/search-api-keys-components": "link:packages/kbn-search-api-keys-components",
"@kbn/search-api-keys-server": "link:packages/kbn-search-api-keys-server",
@@ -839,26 +839,26 @@
"@kbn/security-solution-upselling": "link:x-pack/solutions/security/packages/upselling",
"@kbn/security-test-endpoints-plugin": "link:x-pack/test/security_functional/plugins/test_endpoints",
"@kbn/security-ui-components": "link:x-pack/packages/security/ui_components",
- "@kbn/securitysolution-autocomplete": "link:packages/kbn-securitysolution-autocomplete",
+ "@kbn/securitysolution-autocomplete": "link:x-pack/solutions/security/packages/kbn-securitysolution-autocomplete",
"@kbn/securitysolution-data-table": "link:x-pack/solutions/security/packages/data_table",
"@kbn/securitysolution-ecs": "link:src/platform/packages/shared/kbn-securitysolution-ecs",
- "@kbn/securitysolution-endpoint-exceptions-common": "link:packages/kbn-securitysolution-endpoint-exceptions-common",
- "@kbn/securitysolution-es-utils": "link:packages/kbn-securitysolution-es-utils",
- "@kbn/securitysolution-exception-list-components": "link:packages/kbn-securitysolution-exception-list-components",
- "@kbn/securitysolution-exceptions-common": "link:packages/kbn-securitysolution-exceptions-common",
- "@kbn/securitysolution-hook-utils": "link:packages/kbn-securitysolution-hook-utils",
- "@kbn/securitysolution-io-ts-alerting-types": "link:packages/kbn-securitysolution-io-ts-alerting-types",
- "@kbn/securitysolution-io-ts-list-types": "link:packages/kbn-securitysolution-io-ts-list-types",
- "@kbn/securitysolution-io-ts-types": "link:packages/kbn-securitysolution-io-ts-types",
- "@kbn/securitysolution-io-ts-utils": "link:packages/kbn-securitysolution-io-ts-utils",
- "@kbn/securitysolution-list-api": "link:packages/kbn-securitysolution-list-api",
- "@kbn/securitysolution-list-constants": "link:packages/kbn-securitysolution-list-constants",
- "@kbn/securitysolution-list-hooks": "link:packages/kbn-securitysolution-list-hooks",
- "@kbn/securitysolution-list-utils": "link:packages/kbn-securitysolution-list-utils",
- "@kbn/securitysolution-lists-common": "link:packages/kbn-securitysolution-lists-common",
- "@kbn/securitysolution-rules": "link:packages/kbn-securitysolution-rules",
- "@kbn/securitysolution-t-grid": "link:packages/kbn-securitysolution-t-grid",
- "@kbn/securitysolution-utils": "link:packages/kbn-securitysolution-utils",
+ "@kbn/securitysolution-endpoint-exceptions-common": "link:x-pack/solutions/security/packages/kbn-securitysolution-endpoint-exceptions-common",
+ "@kbn/securitysolution-es-utils": "link:src/platform/packages/shared/kbn-securitysolution-es-utils",
+ "@kbn/securitysolution-exception-list-components": "link:x-pack/solutions/security/packages/kbn-securitysolution-exception-list-components",
+ "@kbn/securitysolution-exceptions-common": "link:x-pack/solutions/security/packages/kbn-securitysolution-exceptions-common",
+ "@kbn/securitysolution-hook-utils": "link:x-pack/solutions/security/packages/kbn-securitysolution-hook-utils",
+ "@kbn/securitysolution-io-ts-alerting-types": "link:x-pack/solutions/security/packages/kbn-securitysolution-io-ts-alerting-types",
+ "@kbn/securitysolution-io-ts-list-types": "link:x-pack/solutions/security/packages/kbn-securitysolution-io-ts-list-types",
+ "@kbn/securitysolution-io-ts-types": "link:src/platform/packages/shared/kbn-securitysolution-io-ts-types",
+ "@kbn/securitysolution-io-ts-utils": "link:src/platform/packages/shared/kbn-securitysolution-io-ts-utils",
+ "@kbn/securitysolution-list-api": "link:x-pack/solutions/security/packages/kbn-securitysolution-list-api",
+ "@kbn/securitysolution-list-constants": "link:x-pack/solutions/security/packages/kbn-securitysolution-list-constants",
+ "@kbn/securitysolution-list-hooks": "link:x-pack/solutions/security/packages/kbn-securitysolution-list-hooks",
+ "@kbn/securitysolution-list-utils": "link:x-pack/solutions/security/packages/kbn-securitysolution-list-utils",
+ "@kbn/securitysolution-lists-common": "link:x-pack/solutions/security/packages/kbn-securitysolution-lists-common",
+ "@kbn/securitysolution-rules": "link:src/platform/packages/shared/kbn-securitysolution-rules",
+ "@kbn/securitysolution-t-grid": "link:x-pack/solutions/security/packages/kbn-securitysolution-t-grid",
+ "@kbn/securitysolution-utils": "link:x-pack/solutions/security/packages/kbn-securitysolution-utils",
"@kbn/server-http-tools": "link:packages/kbn-server-http-tools",
"@kbn/server-route-repository": "link:src/platform/packages/shared/kbn-server-route-repository",
"@kbn/server-route-repository-client": "link:src/platform/packages/shared/kbn-server-route-repository-client",
@@ -1027,7 +1027,7 @@
"@kbn/watcher-plugin": "link:x-pack/platform/plugins/private/watcher",
"@kbn/xstate-utils": "link:packages/kbn-xstate-utils",
"@kbn/zod": "link:packages/kbn-zod",
- "@kbn/zod-helpers": "link:packages/kbn-zod-helpers",
+ "@kbn/zod-helpers": "link:src/platform/packages/shared/kbn-zod-helpers",
"@langchain/aws": "^0.1.2",
"@langchain/community": "0.3.14",
"@langchain/core": "^0.3.16",
diff --git a/packages/core/http/core-http-server-internal/src/http_config.test.ts b/packages/core/http/core-http-server-internal/src/http_config.test.ts
index 4ba13489552b..fa2fbe7ad9f3 100644
--- a/packages/core/http/core-http-server-internal/src/http_config.test.ts
+++ b/packages/core/http/core-http-server-internal/src/http_config.test.ts
@@ -517,9 +517,9 @@ describe('versioned', () => {
).toThrow(/failed validation/);
});
- it('defaults version resolution "none" when in dev', () => {
+ it('defaults version resolution "oldest" when in dev', () => {
expect(config.schema.validate({}, { dev: true })).toMatchObject({
- versioned: { versionResolution: 'none' },
+ versioned: { versionResolution: 'oldest' },
});
});
});
diff --git a/packages/core/http/core-http-server-internal/src/http_config.ts b/packages/core/http/core-http-server-internal/src/http_config.ts
index 11c1afc41033..4ba9bcb9e88b 100644
--- a/packages/core/http/core-http-server-internal/src/http_config.ts
+++ b/packages/core/http/core-http-server-internal/src/http_config.ts
@@ -213,7 +213,7 @@ const configSchema = schema.object(
* Which handler resolution algo to use for public routes: "newest" or "oldest".
*
* @note Internal routes always require a version to be specified.
- * @note in development we have an additional option "none" which is also the default in dev.
+ * @note in development we have an additional option "none".
* This prevents any fallbacks and requires that a version specified.
* Useful for ensuring that a given client always specifies a version.
*/
@@ -221,7 +221,7 @@ const configSchema = schema.object(
schema.contextRef('dev'),
true,
schema.oneOf([schema.literal('newest'), schema.literal('oldest'), schema.literal('none')], {
- defaultValue: 'none',
+ defaultValue: 'oldest',
}),
schema.oneOf([schema.literal('newest'), schema.literal('oldest')], {
defaultValue: 'oldest',
diff --git a/packages/core/http/core-http-server-internal/src/http_server.ts b/packages/core/http/core-http-server-internal/src/http_server.ts
index 14cc4397ebce..1d80c9c4ab0d 100644
--- a/packages/core/http/core-http-server-internal/src/http_server.ts
+++ b/packages/core/http/core-http-server-internal/src/http_server.ts
@@ -93,7 +93,11 @@ function startEluMeasurement(
if (
eluMonitorOptions.logging.enabled &&
active >= eluMonitorOptions.logging.threshold.ela &&
- utilization >= eluMonitorOptions.logging.threshold.elu
+ utilization >= eluMonitorOptions.logging.threshold.elu &&
+ // static js and js.map assets are generating lots of noise for this
+ // event loop check, hiding endpoint slowness which are higher priority
+ // remove this check once endpoints slowness is addressed
+ !['js', 'js.map'].some((ext) => path.endsWith(ext))
) {
log.warn(
`Event loop utilization for ${path} exceeded threshold of ${elaThreshold}ms (${Math.round(
diff --git a/packages/kbn-babel-preset/styled_components_files.js b/packages/kbn-babel-preset/styled_components_files.js
index 2a74c5b60f18..6f6e1ddbb14a 100644
--- a/packages/kbn-babel-preset/styled_components_files.js
+++ b/packages/kbn-babel-preset/styled_components_files.js
@@ -16,12 +16,13 @@ module.exports = {
/packages[\/\\]kbn-ui-shared-deps-(npm|src)[\/\\]/,
/src[\/\\]plugins[\/\\](kibana_react)[\/\\]/,
/x-pack[\/\\]solutions[\/\\]observability[\/\\]plugins[\/\\](exploratory_view|investigate|investigate_app|observability|observability_ai_assistant_app|observability_ai_assistant_management|observability_solution|serverless_observability|streams|streams_app|synthetics|uptime|ux)[\/\\]/,
- /x-pack[\/\\]plugins[\/\\](observability_solution\/apm|beats_management|fleet|lists|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/,
- /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\](observability_solution\/apm|beats_management|fleet|observability_solution\/infra|lists|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/,
+ /x-pack[\/\\]plugins[\/\\](beats_management|fleet|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/,
+ /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\](beats_management|fleet|lists|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/,
/x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]/,
/x-pack[\/\\]packages[\/\\]elastic_assistant[\/\\]/,
/x-pack[\/\\]solutions[\/\\]security[\/\\]packages[\/\\]ecs_data_quality_dashboard[\/\\]/,
/x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]/,
/x-pack[\/\\]platform[\/\\]packages[\/\\]shared[\/\\]kbn-elastic-assistant[\/\\]/,
+ /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]lists/,
],
};
diff --git a/packages/kbn-cli-dev-mode/src/watcher.ts b/packages/kbn-cli-dev-mode/src/watcher.ts
index 6dc11371d958..193458495aa2 100644
--- a/packages/kbn-cli-dev-mode/src/watcher.ts
+++ b/packages/kbn-cli-dev-mode/src/watcher.ts
@@ -19,7 +19,7 @@ import { Log } from './log';
const packageMatcher = makeMatcher([
'**/*',
'!**/.*',
- '!x-pack/plugins/screenshotting/chromium/**',
+ '!x-pack/platform/plugins/shared/screenshotting/chromium/**',
'!x-pack/plugins/canvas/shareable_runtime/**',
]);
diff --git a/packages/kbn-openapi-common/jest.config.js b/packages/kbn-openapi-common/jest.config.js
deleted file mode 100644
index c8e533f9d7ed..000000000000
--- a/packages/kbn-openapi-common/jest.config.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-module.exports = {
- preset: '@kbn/test/jest_node',
- rootDir: '../..',
- roots: ['/packages/kbn-openapi-common'],
-};
diff --git a/packages/kbn-openapi-common/scripts/openapi_generate.js b/packages/kbn-openapi-common/scripts/openapi_generate.js
deleted file mode 100644
index 07b7c4c0e4a0..000000000000
--- a/packages/kbn-openapi-common/scripts/openapi_generate.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-require('../../../src/setup_node_env');
-const { resolve } = require('path');
-const { generate } = require('@kbn/openapi-generator');
-
-const ROOT = resolve(__dirname, '..');
-
-(async () => {
- await generate({
- title: 'OpenAPI Common Schemas (kbn-openapi-common)',
- rootDir: ROOT,
- sourceGlob: './schemas/**/*.schema.yaml',
- templateName: 'zod_operation_schema',
- });
-})();
diff --git a/packages/kbn-openapi-common/tsconfig.json b/packages/kbn-openapi-common/tsconfig.json
deleted file mode 100644
index 29a271ba4840..000000000000
--- a/packages/kbn-openapi-common/tsconfig.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "compilerOptions": {
- "outDir": "target/types",
- "types": ["jest", "node"]
- },
- "exclude": ["target/**/*"],
- "extends": "../../tsconfig.base.json",
- "include": ["**/*.ts"],
- "kbn_references": [
- "@kbn/zod",
- "@kbn/zod-helpers",
- ]
-}
diff --git a/packages/kbn-saved-search-component/README.md b/packages/kbn-saved-search-component/README.md
index 296ddb9079bc..61ec5a6cd8a9 100644
--- a/packages/kbn-saved-search-component/README.md
+++ b/packages/kbn-saved-search-component/README.md
@@ -1,6 +1,6 @@
# @kbn/saved-search-component
-A component wrapper around Discover's Saved Search embeddable. This can be used in solutions without being within a Dasboard context.
+A component wrapper around Discover session embeddable. This can be used in solutions without being within a Dasboard context.
This can be used to render a context-aware (logs etc) "document table".
diff --git a/packages/kbn-search-api-panels/components/cloud_details.tsx b/packages/kbn-search-api-panels/components/cloud_details.tsx
index df2cc6bb6837..0c406b4c3185 100644
--- a/packages/kbn-search-api-panels/components/cloud_details.tsx
+++ b/packages/kbn-search-api-panels/components/cloud_details.tsx
@@ -97,7 +97,7 @@ export const CloudDetailsPanel = ({
-
+
{
name: 'indexName-name',
pipeline: {
extract_binary_content: true,
- name: 'ent-search-generic-ingestion',
+ name: 'search-default-ingestion',
reduce_whitespace: true,
run_ml_inference: false,
},
@@ -103,7 +103,7 @@ describe('createConnectorDocument', () => {
name: 'indexName-name',
pipeline: {
extract_binary_content: true,
- name: 'ent-search-generic-ingestion',
+ name: 'search-default-ingestion',
reduce_whitespace: true,
run_ml_inference: false,
},
diff --git a/packages/kbn-securitysolution-autocomplete/index.ts b/packages/kbn-securitysolution-autocomplete/index.ts
deleted file mode 100644
index e47113719176..000000000000
--- a/packages/kbn-securitysolution-autocomplete/index.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export * from './src/check_empty_value';
-export * from './src/es_field_selector';
-export * from './src/field_value_exists';
-export * from './src/field_value_lists';
-export * from './src/field_value_match';
-export * from './src/field_value_match_any';
-export * from './src/field_value_wildcard';
-export * from './src/filter_field_to_list';
-export * from './src/get_generic_combo_box_props';
-export * from './src/get_operators';
-export * from './src/hooks';
-export * from './src/operator';
-export * from './src/param_is_valid';
-export * from './src/param_contains_space';
-
-export { default as autoCompletei18n } from './src/translations';
diff --git a/packages/kbn-securitysolution-autocomplete/jest.config.js b/packages/kbn-securitysolution-autocomplete/jest.config.js
deleted file mode 100644
index b7d1e59f7786..000000000000
--- a/packages/kbn-securitysolution-autocomplete/jest.config.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-module.exports = {
- preset: '@kbn/test',
- rootDir: '../..',
- roots: ['/packages/kbn-securitysolution-autocomplete'],
-};
diff --git a/packages/kbn-securitysolution-autocomplete/package.json b/packages/kbn-securitysolution-autocomplete/package.json
deleted file mode 100644
index f841706e57a7..000000000000
--- a/packages/kbn-securitysolution-autocomplete/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "@kbn/securitysolution-autocomplete",
- "version": "1.0.0",
- "description": "Security Solution auto complete",
- "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
- "private": true,
- "sideEffects": false
-}
\ No newline at end of file
diff --git a/packages/kbn-securitysolution-autocomplete/src/autocomplete/index.mock.ts b/packages/kbn-securitysolution-autocomplete/src/autocomplete/index.mock.ts
deleted file mode 100644
index 71bfb7f4a67c..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/autocomplete/index.mock.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-// Copied from "src/plugins/data/public/mocks.ts" but without any type information
-// TODO: Remove this in favor of the data/public/mocks if/when they become available, https://github.com/elastic/kibana/issues/100715
-export const autocompleteStartMock = {
- getQuerySuggestions: jest.fn(),
- getValueSuggestions: jest.fn(),
- hasQuerySuggestions: jest.fn(),
-};
diff --git a/packages/kbn-securitysolution-autocomplete/src/check_empty_value/index.test.ts b/packages/kbn-securitysolution-autocomplete/src/check_empty_value/index.test.ts
deleted file mode 100644
index d98feca80b75..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/check_empty_value/index.test.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { checkEmptyValue } from '.';
-import { getField } from '../fields/index.mock';
-import * as i18n from '../translations';
-
-describe('check_empty_value', () => {
- test('returns no errors if no field has been selected', () => {
- const isValid = checkEmptyValue('', undefined, true, false);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns error string if user has touched a required input and left empty', () => {
- const isValid = checkEmptyValue(undefined, getField('@timestamp'), true, true);
-
- expect(isValid).toEqual(i18n.FIELD_REQUIRED_ERR);
- });
-
- test('returns no errors if required input is empty but user has not yet touched it', () => {
- const isValid = checkEmptyValue(undefined, getField('@timestamp'), true, false);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns no errors if user has touched an input that is not required and left empty', () => {
- const isValid = checkEmptyValue(undefined, getField('@timestamp'), false, true);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns no errors if user has touched an input that is not required and left empty string', () => {
- const isValid = checkEmptyValue('', getField('@timestamp'), false, true);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns null if input value is not empty string or undefined', () => {
- const isValid = checkEmptyValue('hellooo', getField('@timestamp'), false, true);
-
- expect(isValid).toBeNull();
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/check_empty_value/index.ts b/packages/kbn-securitysolution-autocomplete/src/check_empty_value/index.ts
deleted file mode 100644
index 218b8fee94d1..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/check_empty_value/index.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { DataViewFieldBase } from '@kbn/es-query';
-import * as i18n from '../translations';
-
-/**
- * Determines if empty value is ok
- */
-export const checkEmptyValue = (
- param: string | undefined,
- field: DataViewFieldBase | undefined,
- isRequired: boolean,
- touched: boolean
-): string | undefined | null => {
- if (isRequired && touched && (param == null || param.trim() === '')) {
- return i18n.FIELD_REQUIRED_ERR;
- }
-
- if (
- field == null ||
- (isRequired && !touched) ||
- (!isRequired && (param == null || param === ''))
- ) {
- return undefined;
- }
-
- return null;
-};
diff --git a/packages/kbn-securitysolution-autocomplete/src/es_field_selector/__tests__/disabled_types_with_tooltip_text.test.ts b/packages/kbn-securitysolution-autocomplete/src/es_field_selector/__tests__/disabled_types_with_tooltip_text.test.ts
deleted file mode 100644
index 980819d1cedf..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/es_field_selector/__tests__/disabled_types_with_tooltip_text.test.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { disabledTypesWithTooltipText } from '../disabled_types_with_tooltip_text';
-
-jest.mock('../../translations', () => ({
- BINARY_TYPE_NOT_SUPPORTED: 'Binary fields are currently unsupported',
-}));
-describe('disabledTypesWithTooltipText', () => {
- it('should return Binary fields are currently unsupported for binary type', () => {
- const type = 'binary';
- expect(disabledTypesWithTooltipText[type]).toEqual('Binary fields are currently unsupported');
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/es_field_selector/__tests__/index.test.tsx b/packages/kbn-securitysolution-autocomplete/src/es_field_selector/__tests__/index.test.tsx
deleted file mode 100644
index 1b33b4b29464..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/es_field_selector/__tests__/index.test.tsx
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { fireEvent, render, waitFor, within } from '@testing-library/react';
-import '@testing-library/jest-dom';
-
-import { EsFieldSelector } from '..';
-import { fields, getField } from '../../fields/index.mock';
-
-describe('FieldComponent', () => {
- it('should render the component enabled and displays the selected field correctly', () => {
- const wrapper = render(
-
- );
- expect(wrapper.container).toMatchSnapshot();
- const comboBox = wrapper.getByTestId('fieldAutocompleteComboBox');
- const input = within(comboBox).getByRole('combobox');
- expect(input).toHaveAttribute('value', 'machine.os.raw');
- });
- it('should render the component disabled if isDisabled is true', () => {
- const wrapper = render(
-
- );
- expect(wrapper.container).toMatchSnapshot();
- expect(wrapper.getByTestId('fieldAutocompleteComboBox').querySelector('input')).toBeDisabled();
- });
- it('should render the loading spinner if isLoading is true when clicked', () => {
- const wrapper = render(
-
- );
- const fieldAutocompleteComboBox = wrapper.getByTestId('fieldAutocompleteComboBox');
- expect(wrapper.container).toMatchSnapshot();
- fireEvent.click(fieldAutocompleteComboBox);
- expect(wrapper.getByRole('progressbar')).toBeInTheDocument();
- });
- it('should allow user to clear values if isClearable is true', () => {
- const wrapper = render(
-
- );
- expect(wrapper.container).toMatchSnapshot();
- expect(wrapper.getByTestId('comboBoxClearButton')).toBeInTheDocument();
- });
- it('should change the selected value', async () => {
- const wrapper = render(
-
- );
- const fieldAutocompleteComboBox = wrapper.getByTestId('comboBoxSearchInput');
- fireEvent.change(fieldAutocompleteComboBox, { target: { value: '_source' } });
- expect(fieldAutocompleteComboBox).toHaveValue('_source');
- });
-
- it('it allows custom user input if "acceptsCustomOptions" is "true"', async () => {
- const mockOnChange = jest.fn();
- const wrapper = render(
-
- );
-
- const fieldAutocompleteComboBox = wrapper.getByTestId('comboBoxSearchInput');
- fireEvent.change(fieldAutocompleteComboBox, { target: { value: 'custom' } });
- await waitFor(() =>
- expect(wrapper.getByTestId('fieldAutocompleteComboBox')).toHaveTextContent('custom')
- );
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/es_field_selector/disabled_types_with_tooltip_text.ts b/packages/kbn-securitysolution-autocomplete/src/es_field_selector/disabled_types_with_tooltip_text.ts
deleted file mode 100644
index 422a909bb991..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/es_field_selector/disabled_types_with_tooltip_text.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-interface DisabledTypesTextType {
- [typeName: string]: string;
-}
-import * as i18n from '../translations';
-
-export const disabledTypesWithTooltipText: DisabledTypesTextType = {
- binary: i18n.BINARY_TYPE_NOT_SUPPORTED,
-};
diff --git a/packages/kbn-securitysolution-autocomplete/src/es_field_selector/index.tsx b/packages/kbn-securitysolution-autocomplete/src/es_field_selector/index.tsx
deleted file mode 100644
index 31efaa23b62d..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/es_field_selector/index.tsx
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { EuiComboBox } from '@elastic/eui';
-import { i18n } from '@kbn/i18n';
-
-import { FieldBaseProps } from './types';
-import { useEsField } from './use_es_field';
-
-const AS_PLAIN_TEXT = { asPlainText: true };
-
-interface EsFieldSelectorProps extends FieldBaseProps {
- isClearable?: boolean;
- isDisabled?: boolean;
- isLoading?: boolean;
- placeholder: string;
- acceptsCustomOptions?: boolean;
- showMappingConflicts?: boolean;
- 'aria-label'?: string;
-}
-
-export function EsFieldSelector({
- fieldInputWidth,
- fieldTypeFilter = [],
- indexPattern,
- isClearable = false,
- isDisabled = false,
- isLoading = false,
- isRequired = false,
- onChange,
- placeholder,
- selectedField,
- acceptsCustomOptions = false,
- showMappingConflicts = false,
- 'aria-label': ariaLabel,
-}: EsFieldSelectorProps): JSX.Element {
- const {
- isInvalid,
- comboOptions,
- selectedComboOptions,
- fieldWidth,
- renderFields,
- handleTouch,
- handleValuesChange,
- handleCreateCustomOption,
- } = useEsField({
- indexPattern,
- fieldTypeFilter,
- isRequired,
- selectedField,
- fieldInputWidth,
- showMappingConflicts,
- onChange,
- });
-
- if (acceptsCustomOptions) {
- return (
-
- );
- }
-
- return (
-
- );
-}
diff --git a/packages/kbn-securitysolution-autocomplete/src/es_field_selector/types.ts b/packages/kbn-securitysolution-autocomplete/src/es_field_selector/types.ts
deleted file mode 100644
index b0f1ab56e807..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/es_field_selector/types.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { DataViewBase, DataViewFieldBase } from '@kbn/es-query';
-import { FieldConflictsInfo } from '@kbn/securitysolution-list-utils';
-import { GetGenericComboBoxPropsReturn } from '../get_generic_combo_box_props';
-
-export interface FieldBaseProps {
- indexPattern: DataViewBase | undefined;
- fieldTypeFilter?: string[];
- isRequired?: boolean;
- selectedField?: DataViewFieldBase | undefined;
- fieldInputWidth?: number;
- showMappingConflicts?: boolean;
- onChange: (a: DataViewFieldBase[]) => void;
-}
-
-export interface ComboBoxFields {
- availableFields: DataViewField[];
- selectedFields: DataViewField[];
-}
-
-export interface GetFieldComboBoxPropsReturn extends GetGenericComboBoxPropsReturn {
- disabledLabelTooltipTexts: { [label: string]: string };
- mappingConflictsTooltipInfo: { [label: string]: FieldConflictsInfo[] };
-}
-
-export interface DataViewField extends DataViewFieldBase {
- esTypes?: string[];
-}
diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_exists/index.test.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_exists/index.test.tsx
deleted file mode 100644
index 801f8e2864d5..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/field_value_exists/index.test.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { mount } from 'enzyme';
-
-import { AutocompleteFieldExistsComponent } from '.';
-
-describe('AutocompleteFieldExistsComponent', () => {
- test('it renders field disabled', () => {
- const wrapper = mount();
-
- expect(
- wrapper
- .find(`[data-test-subj="valuesAutocompleteComboBox existsComboxBox"] input`)
- .prop('disabled')
- ).toBeTruthy();
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_exists/index.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_exists/index.tsx
deleted file mode 100644
index 592886905aae..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/field_value_exists/index.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui';
-
-const NO_OPTIONS_FOR_EXIST: EuiComboBoxOptionOption[] = [];
-
-interface AutocompleteFieldExistsProps {
- placeholder: string;
- rowLabel?: string;
- 'aria-label'?: string;
-}
-
-export const AutocompleteFieldExistsComponent: React.FC = ({
- placeholder,
- rowLabel,
- 'aria-label': ariaLabel,
-}): JSX.Element => (
-
-
-
-);
-
-AutocompleteFieldExistsComponent.displayName = 'AutocompleteFieldExists';
diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_lists/index.test.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_lists/index.test.tsx
deleted file mode 100644
index b2d8dc0a70be..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/field_value_lists/index.test.tsx
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { mount } from 'enzyme';
-import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui';
-import { waitFor } from '@testing-library/react';
-import type { ListSchema } from '@kbn/securitysolution-io-ts-list-types';
-
-import { getField } from '../fields/index.mock';
-import { AutocompleteFieldListsComponent } from '.';
-import {
- getListResponseMock,
- getFoundListsBySizeSchemaMock,
- DATE_NOW,
- IMMUTABLE,
- VERSION,
-} from '../list_schema/index.mock';
-
-// TODO: Once these mocks are available, use them instead of hand mocking, https://github.com/elastic/kibana/issues/100715
-// const mockKibanaHttpService = coreMock.createStart().http;
-// import { coreMock } from '../../../../../../../src/core/public/mocks';
-const mockKibanaHttpService = jest.fn();
-const mockShowValueListModal = jest.fn();
-const MockedShowValueListModal = (props: unknown) => {
- mockShowValueListModal(props);
- return <>>;
-};
-const mockStart = jest.fn();
-const mockKeywordList: ListSchema = {
- ...getListResponseMock(),
- id: 'keyword_list',
- name: 'keyword list',
- type: 'keyword',
-};
-const mockResult = { ...getFoundListsBySizeSchemaMock() };
-mockResult.smallLists = [...mockResult.smallLists, mockKeywordList];
-mockResult.largeLists = [];
-jest.mock('@kbn/securitysolution-list-hooks', () => {
- const originalModule = jest.requireActual('@kbn/securitysolution-list-hooks');
-
- return {
- ...originalModule,
- useFindListsBySize: () => ({
- error: undefined,
- loading: false,
- result: mockResult,
- start: mockStart.mockReturnValue(mockResult),
- }),
- };
-});
-
-describe('AutocompleteFieldListsComponent', () => {
- test('it renders disabled if "isDisabled" is true', async () => {
- const wrapper = mount(
-
- );
-
- expect(
- wrapper
- .find(`[data-test-subj="valuesAutocompleteComboBox listsComboxBox"] input`)
- .prop('disabled')
- ).toBeTruthy();
- });
-
- test('it renders loading if "isLoading" is true', async () => {
- const wrapper = mount(
-
- );
-
- wrapper
- .find(`[data-test-subj="valuesAutocompleteComboBox listsComboxBox"] button`)
- .at(0)
- .simulate('click');
- expect(
- wrapper
- .find(
- `EuiComboBoxOptionsList[data-test-subj="valuesAutocompleteComboBox listsComboxBox-optionsList"]`
- )
- .prop('isLoading')
- ).toBeTruthy();
- });
-
- test('it allows user to clear values if "isClearable" is true', async () => {
- const wrapper = mount(
-
- );
- expect(
- wrapper
- .find('EuiComboBox[data-test-subj="valuesAutocompleteComboBox listsComboxBox"]')
- .prop('options')
- ).toEqual([{ label: 'some name', disabled: false }]);
- });
-
- test('it correctly displays lists that match the selected "keyword" field esType', () => {
- const wrapper = mount(
-
- );
-
- wrapper.find('[data-test-subj="comboBoxToggleListButton"] button').simulate('click');
-
- expect(
- wrapper
- .find('EuiComboBox[data-test-subj="valuesAutocompleteComboBox listsComboxBox"]')
- .prop('options')
- ).toEqual([{ label: 'keyword list', disabled: false }]);
- });
-
- test('it correctly displays lists that match the selected "ip" field esType', () => {
- const wrapper = mount(
-
- );
-
- wrapper.find('[data-test-subj="comboBoxToggleListButton"] button').simulate('click');
-
- expect(
- wrapper
- .find('EuiComboBox[data-test-subj="valuesAutocompleteComboBox listsComboxBox"]')
- .prop('options')
- ).toEqual([{ label: 'some name', disabled: false }]);
- });
-
- test('it correctly displays selected list', async () => {
- const wrapper = mount(
-
- );
-
- expect(
- wrapper
- .find(`[data-test-subj="valuesAutocompleteComboBox listsComboxBox"] input`)
- .at(0)
- .props().value
- ).toEqual('some name');
- });
-
- test('it invokes "onChange" when option selected', async () => {
- const mockOnChange = jest.fn();
- const wrapper = mount(
-
- );
-
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onChange: (a: EuiComboBoxOptionOption[]) => void;
- }
- ).onChange([{ label: 'some name', disabled: false }]);
-
- await waitFor(() => {
- expect(mockOnChange).toHaveBeenCalledWith({
- '@timestamp': DATE_NOW,
- _version: undefined,
- created_at: DATE_NOW,
- created_by: 'some user',
- description: 'some description',
- deserializer: undefined,
- id: 'some-list-id',
- immutable: IMMUTABLE,
- meta: {},
- name: 'some name',
- serializer: undefined,
- tie_breaker_id: '6a76b69d-80df-4ab2-8c3e-85f466b06a0e',
- type: 'ip',
- updated_at: DATE_NOW,
- updated_by: 'some user',
- version: VERSION,
- });
- });
- });
-
- test('it render the value list modal', async () => {
- mockShowValueListModal.mockReset();
- mount(
-
- );
-
- expect(mockShowValueListModal).toHaveBeenCalledWith(
- expect.objectContaining({
- children: 'Show value list',
- listId: 'some-list-id',
- shouldShowContentIfModalNotAvailable: false,
- })
- );
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_lists/index.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_lists/index.tsx
deleted file mode 100644
index c332dde356f2..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/field_value_lists/index.tsx
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { ElementType, useCallback, useEffect, useMemo, useState } from 'react';
-import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow, EuiLink, EuiText } from '@elastic/eui';
-import type { ListSchema } from '@kbn/securitysolution-io-ts-list-types';
-import { useFindListsBySize } from '@kbn/securitysolution-list-hooks';
-import { DataViewFieldBase } from '@kbn/es-query';
-import { getDocLinks } from '@kbn/doc-links';
-
-import { filterFieldToList } from '../filter_field_to_list';
-import { getGenericComboBoxProps } from '../get_generic_combo_box_props';
-
-// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
-// import { HttpStart } from '@kbn/core/public';
-type HttpStart = any;
-
-import * as i18n from '../translations';
-
-const SINGLE_SELECTION = { asPlainText: true };
-
-interface AutocompleteFieldListsProps {
- httpService: HttpStart;
- isClearable: boolean;
- isDisabled: boolean;
- isLoading: boolean;
- onChange: (arg: ListSchema) => void;
- placeholder: string;
- rowLabel?: string;
- selectedField: DataViewFieldBase | undefined;
- selectedValue: string | undefined;
- allowLargeValueLists?: boolean;
- 'aria-label'?: string;
- showValueListModal: ElementType;
-}
-
-export interface AutocompleteListsData {
- smallLists: ListSchema[];
- largeLists: ListSchema[];
-}
-
-export const AutocompleteFieldListsComponent: React.FC = ({
- httpService,
- isClearable = false,
- isDisabled = false,
- isLoading = false,
- onChange,
- placeholder,
- rowLabel,
- selectedField,
- selectedValue,
- allowLargeValueLists = false,
- 'aria-label': ariaLabel,
- showValueListModal,
-}): JSX.Element => {
- const [error, setError] = useState(undefined);
- const [listData, setListData] = useState({
- smallLists: [],
- largeLists: [],
- });
- const { loading, result, start } = useFindListsBySize();
- const getLabel = useCallback(({ name }: ListSchema) => name, []);
-
- const optionsMemo = useMemo(
- () => filterFieldToList(listData, selectedField),
- [listData, selectedField]
- );
- const selectedOptionsMemo = useMemo(() => {
- if (selectedValue != null) {
- const combinedLists = [...listData.smallLists, ...listData.largeLists];
- const list = combinedLists.filter(({ id }) => id === selectedValue);
- return list ?? [];
- } else {
- return [];
- }
- }, [selectedValue, listData]);
- const { comboOptions, labels, selectedComboOptions } = useMemo(
- () =>
- getGenericComboBoxProps({
- getLabel,
- options: [...optionsMemo.smallLists, ...optionsMemo.largeLists],
- selectedOptions: selectedOptionsMemo,
- disabledOptions: allowLargeValueLists ? undefined : optionsMemo.largeLists, // Disable large lists if the rule type doesn't allow it
- }),
- [optionsMemo, selectedOptionsMemo, getLabel, allowLargeValueLists]
- );
-
- const handleValuesChange = useCallback(
- (newOptions: EuiComboBoxOptionOption[]) => {
- const combinedLists = [...optionsMemo.smallLists, ...optionsMemo.largeLists];
- const [newValue] = newOptions.map(({ label }) => combinedLists[labels.indexOf(label)]);
- onChange(newValue ?? '');
- },
- [labels, optionsMemo, onChange]
- );
-
- const setIsTouchedValue = useCallback((): void => {
- setError(selectedValue == null ? i18n.FIELD_REQUIRED_ERR : undefined);
- }, [selectedValue]);
-
- useEffect(() => {
- if (result != null) {
- setListData(result);
- }
- }, [result]);
-
- useEffect(() => {
- if (selectedField != null && httpService != null) {
- start({
- http: httpService,
- pageIndex: 1,
- pageSize: 500,
- });
- }
- }, [selectedField, start, httpService]);
-
- const isLoadingState = useMemo((): boolean => isLoading || loading, [isLoading, loading]);
- const ShowValueListModal = showValueListModal;
-
- const helpText = useMemo(() => {
- return (
- <>
- {selectedValue && (
-
- {i18n.SHOW_VALUE_LIST_MODAL}
-
- )}
- {!allowLargeValueLists && (
-
- {i18n.LISTS_TOOLTIP_INFO}{' '}
-
- {i18n.SEE_DOCUMENTATION}
-
-
- )}
- >
- );
- }, [allowLargeValueLists, selectedValue, ShowValueListModal]);
- return (
-
-
-
- );
-};
-
-AutocompleteFieldListsComponent.displayName = 'AutocompleteFieldList';
diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.test.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.test.tsx
deleted file mode 100644
index e83d79b180e9..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.test.tsx
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { ReactWrapper, mount } from 'enzyme';
-import {
- EuiComboBox,
- EuiComboBoxOptionOption,
- EuiFormHelpText,
- EuiSuperSelect,
-} from '@elastic/eui';
-import { act, waitFor } from '@testing-library/react';
-import { AutocompleteFieldMatchComponent } from '.';
-import { useFieldValueAutocomplete } from '../hooks/use_field_value_autocomplete';
-import { fields, getField } from '../fields/index.mock';
-import { autocompleteStartMock } from '../autocomplete/index.mock';
-
-jest.mock('../hooks/use_field_value_autocomplete');
-jest.mock('../translations', () => ({
- FIELD_SPACE_WARNING: 'Warning: there is a space',
-}));
-describe('AutocompleteFieldMatchComponent', () => {
- let wrapper: ReactWrapper;
-
- const getValueSuggestionsMock = jest
- .fn()
- .mockResolvedValue([false, true, ['value 3', 'value 4'], jest.fn()]);
-
- const findEuiComboBox = () =>
- wrapper.find(EuiComboBox).props() as unknown as {
- onChange: (a: EuiComboBoxOptionOption[]) => void;
- onSearchChange: (a: string) => void;
- onCreateOption: (a: string) => void;
- };
-
- beforeEach(() => {
- (useFieldValueAutocomplete as jest.Mock).mockReturnValue([
- false,
- true,
- ['value 1', 'value 2'],
- getValueSuggestionsMock,
- ]);
- });
-
- afterEach(() => {
- jest.clearAllMocks();
- wrapper.unmount();
- });
-
- test('it renders row label if one passed in', () => {
- wrapper = mount(
-
- );
-
- expect(
- wrapper.find('[data-test-subj="valuesAutocompleteMatchLabel"] label').at(0).text()
- ).toEqual('Row Label');
- });
-
- test('it renders disabled if "isDisabled" is true', () => {
- wrapper = mount(
-
- );
-
- expect(
- wrapper.find('[data-test-subj="valuesAutocompleteMatch"] input').prop('disabled')
- ).toBeTruthy();
- });
-
- test('it renders loading if "isLoading" is true', () => {
- wrapper = mount(
-
- );
- wrapper.find('[data-test-subj="valuesAutocompleteMatch"] button').at(0).simulate('click');
- expect(
- wrapper
- .find('EuiComboBoxOptionsList[data-test-subj="valuesAutocompleteMatch-optionsList"]')
- .prop('isLoading')
- ).toBeTruthy();
- });
-
- test('it allows user to clear values if "isClearable" is true', () => {
- wrapper = mount(
-
- );
-
- expect(wrapper.find(`[data-test-subj="comboBoxClearButton"]`)).toBeTruthy();
- });
-
- test('it correctly displays selected value', () => {
- wrapper = mount(
-
- );
-
- expect(
- wrapper.find('[data-test-subj="valuesAutocompleteMatch"] input').at(0).props().value
- ).toEqual('127.0.0.1');
- });
-
- test('it invokes "onChange" when new value created', () => {
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- findEuiComboBox().onCreateOption('127.0.0.1');
-
- expect(mockOnChange).toHaveBeenCalledWith('127.0.0.1');
- });
-
- test('it invokes "onChange" when new value selected', () => {
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- findEuiComboBox().onChange([{ label: 'value 1' }]);
-
- expect(mockOnChange).toHaveBeenCalledWith('value 1');
- });
-
- test('it invokes "onChange" with empty value (i.e. clears selection) when new value searched', () => {
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- act(() => {
- findEuiComboBox().onSearchChange('value 12');
- });
-
- expect(mockOnChange).toHaveBeenCalledWith('');
- });
-
- test('should show the warning helper text if the new value contains spaces when change', async () => {
- (useFieldValueAutocomplete as jest.Mock).mockReturnValue([
- false,
- true,
- [' value 1 ', 'value 2'],
- getValueSuggestionsMock,
- ]);
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- await waitFor(() => findEuiComboBox().onChange([{ label: ' value 1 ' }]));
- wrapper.update();
- expect(mockOnChange).toHaveBeenCalledWith(' value 1 ');
-
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeTruthy();
- });
-
- test('it refreshes autocomplete with search query when new value searched', () => {
- wrapper = mount(
-
- );
- act(() => {
- findEuiComboBox().onSearchChange('value 1');
- });
-
- expect(useFieldValueAutocomplete).toHaveBeenCalledWith({
- autocompleteService: autocompleteStartMock,
- fieldValue: '',
- indexPattern: {
- fields,
- id: '1234',
- title: 'logstash-*',
- },
- operatorType: 'match',
- query: 'value 1',
- selectedField: getField('machine.os.raw'),
- });
- });
-
- test('it refreshes autocomplete with search query when input field is cleared', () => {
- wrapper = mount(
-
- );
-
- act(() => {
- findEuiComboBox().onSearchChange('value 1');
- });
- act(() => {
- findEuiComboBox().onSearchChange('');
- });
-
- // 1st call is initial render, 2nd call sets the search query:
- expect(useFieldValueAutocomplete).toHaveBeenNthCalledWith(2, {
- autocompleteService: autocompleteStartMock,
- fieldValue: 'windows',
- indexPattern: { fields, id: '1234', title: 'logstash-*' },
- operatorType: 'match',
- query: 'value 1',
- selectedField: getField('machine.os.raw'),
- });
- // last call is the refresh when input field is cleared
- expect(useFieldValueAutocomplete).toHaveBeenLastCalledWith({
- autocompleteService: autocompleteStartMock,
- fieldValue: 'windows',
- indexPattern: { fields, id: '1234', title: 'logstash-*' },
- operatorType: 'match',
- query: '',
- selectedField: getField('machine.os.raw'),
- });
- });
-
- test('should show the warning helper text if the new value contains spaces when searching a new query', () => {
- wrapper = mount(
-
- );
- act(() => {
- findEuiComboBox().onSearchChange(' value 1');
- });
-
- wrapper.update();
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeTruthy();
- expect(euiFormHelptext.text()).toEqual('Warning: there is a space');
- });
-
- test('should show the warning helper text if selectedValue contains spaces when editing', () => {
- wrapper = mount(
-
- );
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeTruthy();
- expect(euiFormHelptext.text()).toEqual('Warning: there is a space');
- });
-
- test('should not show the warning helper text if selectedValue is falsy', () => {
- wrapper = mount(
-
- );
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeFalsy();
- });
-
- describe('boolean type', () => {
- const valueSuggestionsMock = jest.fn().mockResolvedValue([false, false, [], jest.fn()]);
-
- beforeEach(() => {
- (useFieldValueAutocomplete as jest.Mock).mockReturnValue([
- false,
- false,
- [],
- valueSuggestionsMock,
- ]);
- });
-
- test('it displays only two options - "true" or "false"', () => {
- wrapper = mount(
-
- );
- expect(
- wrapper.find('[data-test-subj="valuesAutocompleteMatchBoolean"]').exists()
- ).toBeTruthy();
- expect(
- wrapper.find('[data-test-subj="valuesAutocompleteMatchBoolean"]').at(0).prop('options')
- ).toEqual([
- {
- inputDisplay: 'true',
- value: 'true',
- },
- {
- inputDisplay: 'false',
- value: 'false',
- },
- ]);
- });
-
- test('it invokes "onChange" with "true" when selected', () => {
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- (
- wrapper.find(EuiSuperSelect).props() as unknown as {
- onChange: (a: string) => void;
- }
- ).onChange('true');
-
- expect(mockOnChange).toHaveBeenCalledWith('true');
- });
-
- test('it invokes "onChange" with "false" when selected', () => {
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- (
- wrapper.find(EuiSuperSelect).props() as unknown as {
- onChange: (a: string) => void;
- }
- ).onChange('false');
-
- expect(mockOnChange).toHaveBeenCalledWith('false');
- });
- });
-
- describe('number type', () => {
- const valueSuggestionsMock = jest.fn().mockResolvedValue([false, false, [], jest.fn()]);
-
- beforeEach(() => {
- (useFieldValueAutocomplete as jest.Mock).mockReturnValue([
- false,
- false,
- [],
- valueSuggestionsMock,
- ]);
- });
-
- test('it number input when field type is number', () => {
- wrapper = mount(
-
- );
-
- expect(
- wrapper.find('[data-test-subj="valueAutocompleteFieldMatchNumber"]').exists()
- ).toBeTruthy();
- });
-
- test('it invokes "onChange" with numeric value when inputted', () => {
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
- wrapper
- .find('[data-test-subj="valueAutocompleteFieldMatchNumber"] input')
- .at(0)
- .simulate('change', { target: { value: '8' } });
-
- expect(mockOnChange).toHaveBeenCalledWith('8');
- });
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.tsx
deleted file mode 100644
index 5b627451db19..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.tsx
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { useCallback, useMemo, useState, useEffect } from 'react';
-import {
- EuiSuperSelect,
- EuiFormRow,
- EuiFieldNumber,
- EuiComboBoxOptionOption,
- EuiComboBox,
-} from '@elastic/eui';
-import { DataViewBase, DataViewFieldBase } from '@kbn/es-query';
-
-import { uniq } from 'lodash';
-
-import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types';
-
-// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
-// import { AutocompleteStart } from '../../../../../../../src/plugins/unified_search/public';
-type AutocompleteStart = any;
-
-import * as i18n from '../translations';
-import { useFieldValueAutocomplete } from '../hooks/use_field_value_autocomplete';
-import {
- getGenericComboBoxProps,
- GetGenericComboBoxPropsReturn,
-} from '../get_generic_combo_box_props';
-import { paramIsValid } from '../param_is_valid';
-import { paramContainsSpace } from '../param_contains_space';
-
-const BOOLEAN_OPTIONS = [
- { inputDisplay: 'true', value: 'true' },
- { inputDisplay: 'false', value: 'false' },
-];
-
-const SINGLE_SELECTION = { asPlainText: true };
-
-type Warning = string | React.ReactNode;
-
-interface AutocompleteFieldMatchProps {
- placeholder: string;
- selectedField: DataViewFieldBase | undefined;
- selectedValue: string | undefined;
- indexPattern: DataViewBase | undefined;
- isLoading?: boolean;
- isDisabled?: boolean;
- isClearable?: boolean;
- isRequired?: boolean;
- fieldInputWidth?: number;
- rowLabel?: string;
- autocompleteService: AutocompleteStart;
- onChange: (arg: string) => void;
- onError?: (arg: boolean) => void;
- onWarning?: (arg: boolean) => void;
- warning?: Warning;
- 'aria-label'?: string;
-}
-
-export const AutocompleteFieldMatchComponent: React.FC = ({
- placeholder,
- rowLabel,
- selectedField,
- selectedValue,
- indexPattern,
- isLoading = false,
- isDisabled = false,
- isClearable = false,
- isRequired = false,
- fieldInputWidth,
- autocompleteService,
- onChange,
- onError,
- onWarning,
- warning,
- 'aria-label': ariaLabel,
-}): JSX.Element => {
- const [searchQuery, setSearchQuery] = useState('');
- const [touched, setIsTouched] = useState(false);
- const [error, setError] = useState(undefined);
- const [showSpacesWarning, setShowSpacesWarning] = useState(false);
- const [isLoadingSuggestions, isSuggestingValues, suggestions] = useFieldValueAutocomplete({
- autocompleteService,
- fieldValue: selectedValue,
- indexPattern,
- operatorType: OperatorTypeEnum.MATCH,
- query: searchQuery,
- selectedField,
- });
- const getLabel = useCallback((option: string): string => option, []);
-
- const optionsMemo = useMemo((): string[] => {
- const valueAsStr = String(selectedValue);
- return selectedValue != null && selectedValue.trim() !== ''
- ? uniq([valueAsStr, ...suggestions])
- : suggestions;
- }, [suggestions, selectedValue]);
-
- const selectedOptionsMemo = useMemo((): string[] => {
- const valueAsStr = String(selectedValue);
- return selectedValue ? [valueAsStr] : [];
- }, [selectedValue]);
-
- const handleSpacesWarning = useCallback(
- (param: string | undefined) => {
- if (!param) return setShowSpacesWarning(false);
- setShowSpacesWarning(!!paramContainsSpace(param));
- },
- [setShowSpacesWarning]
- );
-
- const handleError = useCallback(
- (err: string | undefined): void => {
- setError((existingErr): string | undefined => {
- const oldErr = existingErr != null;
- const newErr = err != null;
- if (oldErr !== newErr && onError != null) {
- onError(newErr);
- }
-
- return err;
- });
- },
- [setError, onError]
- );
-
- const handleWarning = useCallback(
- (warn: Warning | undefined): void => {
- if (onWarning) {
- onWarning(warn !== undefined);
- }
- },
- [onWarning]
- );
-
- const { comboOptions, labels, selectedComboOptions } = useMemo(
- (): GetGenericComboBoxPropsReturn =>
- getGenericComboBoxProps({
- getLabel,
- options: optionsMemo,
- selectedOptions: selectedOptionsMemo,
- }),
- [optionsMemo, selectedOptionsMemo, getLabel]
- );
-
- const handleValuesChange = useCallback(
- (newOptions: EuiComboBoxOptionOption[]): void => {
- const [newValue] = newOptions.map(({ label }) => optionsMemo[labels.indexOf(label)]);
-
- handleSpacesWarning(newValue);
- handleError(undefined);
- handleWarning(undefined);
- onChange(newValue ?? '');
- },
- [handleError, handleWarning, handleSpacesWarning, labels, onChange, optionsMemo]
- );
-
- const handleSearchChange = useCallback(
- (searchVal: string): void => {
- if (searchVal !== '' && selectedField != null) {
- const err = paramIsValid(searchVal, selectedField, isRequired, touched);
- handleError(err);
- handleWarning(warning);
-
- if (!err) handleSpacesWarning(searchVal);
- }
-
- if (searchVal) {
- // Clear selected option when user types to allow user to modify value without {backspace}
- onChange('');
- }
-
- // Update search query unconditionally to show correct suggestions even when input is cleared
- setSearchQuery(searchVal);
- },
- [
- selectedField,
- onChange,
- isRequired,
- touched,
- handleError,
- handleWarning,
- warning,
- handleSpacesWarning,
- ]
- );
-
- const handleCreateOption = useCallback(
- (option: string): boolean | undefined => {
- const err = paramIsValid(option, selectedField, isRequired, touched);
- handleError(err);
- handleWarning(warning);
-
- if (err != null) {
- // Explicitly reject the user's input
- setShowSpacesWarning(false);
- return false;
- }
-
- handleSpacesWarning(option);
- onChange(option);
- return undefined;
- },
- [
- isRequired,
- onChange,
- selectedField,
- touched,
- handleError,
- handleSpacesWarning,
- handleWarning,
- warning,
- ]
- );
-
- const handleNonComboBoxInputChange = useCallback(
- (event: React.ChangeEvent): void => {
- const newValue = event.target.value;
- onChange(newValue);
- },
- [onChange]
- );
-
- const handleBooleanInputChange = useCallback(
- (newOption: string): void => {
- onChange(newOption);
- },
- [onChange]
- );
-
- const setIsTouchedValue = useCallback((): void => {
- setIsTouched(true);
-
- const err = paramIsValid(selectedValue, selectedField, isRequired, true);
- handleError(err);
- handleWarning(warning);
- }, [setIsTouched, handleError, selectedValue, selectedField, isRequired, warning, handleWarning]);
-
- const inputPlaceholder = useMemo((): string => {
- if (isLoading || isLoadingSuggestions) {
- return i18n.LOADING;
- } else if (selectedField == null) {
- return i18n.SELECT_FIELD_FIRST;
- } else {
- return placeholder;
- }
- }, [isLoading, selectedField, isLoadingSuggestions, placeholder]);
-
- const isLoadingState = useMemo(
- (): boolean => isLoading || isLoadingSuggestions,
- [isLoading, isLoadingSuggestions]
- );
-
- useEffect((): void => {
- setError(undefined);
- if (onError != null) onError(false);
-
- handleSpacesWarning(selectedValue);
- // Looks like selectedField return new object every time when we for example add "and" entry
- // that's why we need to check for name and type here
- // Probably we should use some kind of memoization on parent components for entries
- }, [selectedField?.name, selectedField?.type, selectedValue, handleSpacesWarning, onError]);
-
- const defaultInput = useMemo((): JSX.Element => {
- return (
-
-
-
- );
- }, [
- rowLabel,
- error,
- selectedField,
- showSpacesWarning,
- inputPlaceholder,
- isDisabled,
- isLoadingState,
- isClearable,
- comboOptions,
- selectedComboOptions,
- handleValuesChange,
- handleSearchChange,
- handleCreateOption,
- setIsTouchedValue,
- warning,
- fieldInputWidth,
- ariaLabel,
- ]);
-
- if (!isSuggestingValues && selectedField != null) {
- switch (selectedField.type) {
- case 'number':
- return (
-
- 0
- ? parseFloat(selectedValue)
- : selectedValue ?? ''
- }
- onChange={handleNonComboBoxInputChange}
- data-test-subj="valueAutocompleteFieldMatchNumber"
- style={fieldInputWidth ? { width: `${fieldInputWidth}px` } : {}}
- aria-label={ariaLabel}
- fullWidth
- />
-
- );
- case 'boolean':
- return (
-
-
-
- );
- default:
- return defaultInput;
- }
- } else {
- return defaultInput;
- }
-};
-
-AutocompleteFieldMatchComponent.displayName = 'AutocompleteFieldMatch';
diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_match_any/index.test.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_match_any/index.test.tsx
deleted file mode 100644
index 0b73a57814aa..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/field_value_match_any/index.test.tsx
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { ReactWrapper, mount } from 'enzyme';
-import { EuiComboBox, EuiComboBoxOptionOption, EuiFormHelpText } from '@elastic/eui';
-import { act, waitFor } from '@testing-library/react';
-
-import { AutocompleteFieldMatchAnyComponent } from '.';
-import { getField, fields } from '../fields/index.mock';
-import { useFieldValueAutocomplete } from '../hooks/use_field_value_autocomplete';
-import { autocompleteStartMock } from '../autocomplete/index.mock';
-
-jest.mock('../hooks/use_field_value_autocomplete', () => {
- const actual = jest.requireActual('../hooks/use_field_value_autocomplete');
- return {
- ...actual,
- useFieldValueAutocomplete: jest.fn(),
- };
-});
-jest.mock('../translations', () => ({
- FIELD_SPACE_WARNING: 'Warning: there is a space',
-}));
-
-describe('AutocompleteFieldMatchAnyComponent', () => {
- let wrapper: ReactWrapper;
- const getValueSuggestionsMock = jest
- .fn()
- .mockResolvedValue([false, true, ['value 3', 'value 4'], jest.fn()]);
-
- beforeEach(() => {
- (useFieldValueAutocomplete as jest.Mock).mockReturnValue([
- false,
- true,
- ['value 1', 'value 2'],
- getValueSuggestionsMock,
- ]);
- });
-
- afterEach(() => {
- jest.clearAllMocks();
- wrapper.unmount();
- });
-
- test('it renders disabled if "isDisabled" is true', () => {
- wrapper = mount(
-
- );
-
- expect(
- wrapper.find(`[data-test-subj="valuesAutocompleteMatchAny"] input`).prop('disabled')
- ).toBeTruthy();
- });
-
- test('it renders loading if "isLoading" is true', () => {
- wrapper = mount(
-
- );
- wrapper.find(`[data-test-subj="valuesAutocompleteMatchAny"] button`).at(0).simulate('click');
- expect(
- wrapper
- .find(`EuiComboBoxOptionsList[data-test-subj="valuesAutocompleteMatchAny-optionsList"]`)
- .prop('isLoading')
- ).toBeTruthy();
- });
-
- test('it allows user to clear values if "isClearable" is true', () => {
- wrapper = mount(
-
- );
-
- expect(wrapper.find(`[data-test-subj="comboBoxClearButton"]`)).toBeTruthy();
- });
-
- test('it correctly displays selected value', () => {
- wrapper = mount(
-
- );
-
- expect(
- wrapper.find(`[data-test-subj="valuesAutocompleteMatchAny"] EuiComboBoxPill`).at(0).text()
- ).toEqual('127.0.0.1');
- });
-
- test('it invokes "onChange" when new value created', async () => {
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onCreateOption: (a: string) => void;
- }
- ).onCreateOption('127.0.0.1');
-
- expect(mockOnChange).toHaveBeenCalledWith(['127.0.0.1']);
- });
-
- test('it invokes "onChange" when new value selected', async () => {
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onChange: (a: EuiComboBoxOptionOption[]) => void;
- }
- ).onChange([{ label: 'value 1' }]);
-
- expect(mockOnChange).toHaveBeenCalledWith(['value 1']);
- });
-
- test('it refreshes autocomplete with search query when new value searched', () => {
- wrapper = mount(
-
- );
- act(() => {
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onSearchChange: (a: string) => void;
- }
- ).onSearchChange('value 1');
- });
- expect(useFieldValueAutocomplete).toHaveBeenCalledWith({
- autocompleteService: autocompleteStartMock,
- fieldValue: [],
- indexPattern: {
- fields,
- id: '1234',
- title: 'logstash-*',
- },
- operatorType: 'match_any',
- query: 'value 1',
- selectedField: getField('machine.os.raw'),
- });
- });
- test('should show the warning helper text if the new value contains spaces when change', async () => {
- (useFieldValueAutocomplete as jest.Mock).mockReturnValue([
- false,
- true,
- [' value 1 ', 'value 2'],
- getValueSuggestionsMock,
- ]);
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- await waitFor(() =>
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onChange: (a: EuiComboBoxOptionOption[]) => void;
- }
- ).onChange([{ label: ' value 1 ' }])
- );
- wrapper.update();
- expect(mockOnChange).toHaveBeenCalledWith([' value 1 ']);
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeTruthy();
- });
- test('should show the warning helper text if the new value contains spaces when searching a new query', () => {
- wrapper = mount(
-
- );
- act(() => {
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onSearchChange: (a: string) => void;
- }
- ).onSearchChange(' value 1');
- });
-
- wrapper.update();
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeTruthy();
- expect(euiFormHelptext.text()).toEqual('Warning: there is a space');
- });
- test('should show the warning helper text if selectedValue contains spaces when editing', () => {
- wrapper = mount(
-
- );
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeTruthy();
- expect(euiFormHelptext.text()).toEqual('Warning: there is a space');
- });
- test('should not show the warning helper text if selectedValue is falsy', () => {
- wrapper = mount(
-
- );
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeFalsy();
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_match_any/index.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_match_any/index.tsx
deleted file mode 100644
index 761712797c5e..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/field_value_match_any/index.tsx
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { useCallback, useEffect, useMemo, useState } from 'react';
-import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui';
-import { uniq } from 'lodash';
-import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types';
-import { DataViewBase, DataViewFieldBase } from '@kbn/es-query';
-
-// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
-// import { AutocompleteStart } from '../../../../../../../src/plugins/unified_search/public';
-type AutocompleteStart = any;
-
-import * as i18n from '../translations';
-import {
- getGenericComboBoxProps,
- GetGenericComboBoxPropsReturn,
-} from '../get_generic_combo_box_props';
-import { useFieldValueAutocomplete } from '../hooks/use_field_value_autocomplete';
-import { paramIsValid } from '../param_is_valid';
-import { paramContainsSpace } from '../param_contains_space';
-
-interface AutocompleteFieldMatchAnyProps {
- placeholder: string;
- selectedField: DataViewFieldBase | undefined;
- selectedValue: string[];
- indexPattern: DataViewBase | undefined;
- isLoading: boolean;
- isDisabled: boolean;
- isClearable: boolean;
- isRequired?: boolean;
- rowLabel?: string;
- autocompleteService: AutocompleteStart;
- onChange: (arg: string[]) => void;
- onError?: (arg: boolean) => void;
- 'aria-label'?: string;
-}
-
-export const AutocompleteFieldMatchAnyComponent: React.FC = ({
- placeholder,
- rowLabel,
- selectedField,
- selectedValue,
- indexPattern,
- isLoading,
- isDisabled = false,
- isClearable = false,
- isRequired = false,
- onChange,
- onError,
- autocompleteService,
- 'aria-label': ariaLabel,
-}): JSX.Element => {
- const [searchQuery, setSearchQuery] = useState('');
- const [touched, setIsTouched] = useState(false);
- const [error, setError] = useState(undefined);
- const [showSpacesWarning, setShowSpacesWarning] = useState(false);
- const [isLoadingSuggestions, isSuggestingValues, suggestions] = useFieldValueAutocomplete({
- autocompleteService,
- fieldValue: selectedValue,
- indexPattern,
- operatorType: OperatorTypeEnum.MATCH_ANY,
- query: searchQuery,
- selectedField,
- });
- const getLabel = useCallback((option: string): string => option, []);
- const optionsMemo = useMemo(
- (): string[] => (selectedValue ? uniq([...selectedValue, ...suggestions]) : suggestions),
- [suggestions, selectedValue]
- );
- const { comboOptions, labels, selectedComboOptions } = useMemo(
- (): GetGenericComboBoxPropsReturn =>
- getGenericComboBoxProps({
- getLabel,
- options: optionsMemo,
- selectedOptions: selectedValue,
- }),
- [optionsMemo, selectedValue, getLabel]
- );
- const handleSpacesWarning = useCallback(
- (params: string[]) =>
- setShowSpacesWarning(!!params.find((param: string) => paramContainsSpace(param))),
- [setShowSpacesWarning]
- );
- const handleError = useCallback(
- (err: string | undefined): void => {
- setError((existingErr): string | undefined => {
- const oldErr = existingErr != null;
- const newErr = err != null;
- if (oldErr !== newErr && onError != null) {
- onError(newErr);
- }
-
- return err;
- });
- },
- [setError, onError]
- );
-
- const handleValuesChange = useCallback(
- (newOptions: EuiComboBoxOptionOption[]): void => {
- const newValues: string[] = newOptions.map(({ label }) => optionsMemo[labels.indexOf(label)]);
- handleError(undefined);
- handleSpacesWarning(newValues);
- onChange(newValues);
- },
- [handleError, handleSpacesWarning, labels, onChange, optionsMemo]
- );
-
- const handleSearchChange = useCallback(
- (searchVal: string) => {
- if (searchVal === '') {
- handleError(undefined);
- }
-
- if (searchVal !== '' && selectedField != null) {
- const err = paramIsValid(searchVal, selectedField, isRequired, touched);
- handleError(err);
-
- if (!err) handleSpacesWarning([searchVal]);
-
- setSearchQuery(searchVal);
- }
- },
- [handleError, handleSpacesWarning, isRequired, selectedField, touched]
- );
-
- const handleCreateOption = useCallback(
- (option: string): boolean => {
- const err = paramIsValid(option, selectedField, isRequired, touched);
- handleError(err);
-
- if (err != null) {
- // Explicitly reject the user's input
- setShowSpacesWarning(false);
- return false;
- }
-
- onChange([...(selectedValue || []), option]);
- handleSpacesWarning([option]);
- return true;
- },
- [handleError, handleSpacesWarning, isRequired, onChange, selectedField, selectedValue, touched]
- );
-
- const setIsTouchedValue = useCallback((): void => {
- handleError(selectedComboOptions.length === 0 ? i18n.FIELD_REQUIRED_ERR : undefined);
- setIsTouched(true);
- }, [setIsTouched, handleError, selectedComboOptions]);
-
- const inputPlaceholder = useMemo(
- (): string => (isLoading || isLoadingSuggestions ? i18n.LOADING : placeholder),
- [isLoading, isLoadingSuggestions, placeholder]
- );
-
- const isLoadingState = useMemo(
- (): boolean => isLoading || isLoadingSuggestions,
- [isLoading, isLoadingSuggestions]
- );
- useEffect((): void => {
- handleSpacesWarning(selectedValue);
- }, [selectedField, selectedValue, handleSpacesWarning]);
-
- const defaultInput = useMemo((): JSX.Element => {
- return (
-
-
-
- );
- }, [
- rowLabel,
- error,
- selectedField,
- showSpacesWarning,
- inputPlaceholder,
- isLoadingState,
- isClearable,
- isDisabled,
- comboOptions,
- selectedComboOptions,
- handleValuesChange,
- handleSearchChange,
- handleCreateOption,
- setIsTouchedValue,
- ariaLabel,
- ]);
-
- if (!isSuggestingValues && selectedField != null) {
- switch (selectedField.type) {
- case 'number':
- return (
-
-
-
- );
- default:
- return defaultInput;
- }
- }
-
- return defaultInput;
-};
-
-AutocompleteFieldMatchAnyComponent.displayName = 'AutocompleteFieldMatchAny';
diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_wildcard/index.test.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_wildcard/index.test.tsx
deleted file mode 100644
index 2840e428a69e..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/field_value_wildcard/index.test.tsx
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { ReactWrapper, mount } from 'enzyme';
-import { EuiComboBox, EuiComboBoxOptionOption, EuiFormHelpText } from '@elastic/eui';
-import { act, waitFor } from '@testing-library/react';
-import { AutocompleteFieldWildcardComponent } from '.';
-import { useFieldValueAutocomplete } from '../hooks/use_field_value_autocomplete';
-import { fields, getField } from '../fields/index.mock';
-import { autocompleteStartMock } from '../autocomplete/index.mock';
-import { WILDCARD_WARNING, FILEPATH_WARNING } from '@kbn/securitysolution-utils';
-
-jest.mock('../hooks/use_field_value_autocomplete');
-jest.mock('../translations', () => ({
- FIELD_SPACE_WARNING: 'Warning: there is a space',
-}));
-describe('AutocompleteFieldWildcardComponent', () => {
- let wrapper: ReactWrapper;
-
- const getValueSuggestionsMock = jest
- .fn()
- .mockResolvedValue([false, true, ['value 3', 'value 4'], jest.fn()]);
-
- beforeEach(() => {
- (useFieldValueAutocomplete as jest.Mock).mockReturnValue([
- false,
- true,
- ['value 1', 'value 2'],
- getValueSuggestionsMock,
- ]);
- });
-
- afterEach(() => {
- jest.clearAllMocks();
- wrapper.unmount();
- });
-
- test('it renders row label if one passed in', () => {
- wrapper = mount(
-
- );
-
- expect(
- wrapper.find('[data-test-subj="valuesAutocompleteWildcardLabel"] label').at(0).text()
- ).toEqual('Row Label');
- });
-
- test('it renders disabled if "isDisabled" is true', () => {
- wrapper = mount(
-
- );
-
- expect(
- wrapper.find('[data-test-subj="valuesAutocompleteWildcard"] input').prop('disabled')
- ).toBeTruthy();
- });
-
- test('it renders loading if "isLoading" is true', () => {
- wrapper = mount(
-
- );
- wrapper.find('[data-test-subj="valuesAutocompleteWildcard"] button').at(0).simulate('click');
- expect(
- wrapper
- .find('EuiComboBoxOptionsList[data-test-subj="valuesAutocompleteWildcard-optionsList"]')
- .prop('isLoading')
- ).toBeTruthy();
- });
-
- test('it allows user to clear values if "isClearable" is true', () => {
- wrapper = mount(
-
- );
-
- expect(wrapper.find(`[data-test-subj="comboBoxClearButton"]`)).toBeTruthy();
- });
-
- test('it correctly displays selected value', () => {
- wrapper = mount(
-
- );
-
- expect(
- wrapper.find('[data-test-subj="valuesAutocompleteWildcard"] input').at(0).props().value
- ).toEqual('/opt/*/app.dmg');
- });
-
- test('it invokes "onChange" when new value created', async () => {
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onCreateOption: (a: string) => void;
- }
- ).onCreateOption('/opt/*/app.dmg');
-
- expect(mockOnChange).toHaveBeenCalledWith('/opt/*/app.dmg');
- });
-
- test('it invokes "onChange" when new value selected', async () => {
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onChange: (a: EuiComboBoxOptionOption[]) => void;
- }
- ).onChange([{ label: 'value 1' }]);
-
- expect(mockOnChange).toHaveBeenCalledWith('value 1');
- });
-
- test('it refreshes autocomplete with search query when new value searched', () => {
- wrapper = mount(
-
- );
- act(() => {
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onSearchChange: (a: string) => void;
- }
- ).onSearchChange('A:\\Some Folder\\inc*.exe');
- });
-
- expect(useFieldValueAutocomplete).toHaveBeenCalledWith({
- autocompleteService: autocompleteStartMock,
- fieldValue: '',
- indexPattern: {
- fields,
- id: '1234',
- title: 'logs-endpoint.events.*',
- },
- operatorType: 'wildcard',
- query: 'A:\\Some Folder\\inc*.exe',
- selectedField: getField('file.path.text'),
- });
- });
-
- test('it does not invoke "onWarning" when no warning exists', () => {
- const mockOnWarning = jest.fn();
- wrapper = mount(
-
- );
-
- act(() => {
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onBlur: () => void;
- }
- ).onBlur();
- });
-
- expect(mockOnWarning).not.toHaveBeenCalledWith(true);
- });
-
- test('it invokes "onWarning" when warning exists', () => {
- const mockOnWarning = jest.fn();
- wrapper = mount(
-
- );
-
- act(() => {
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onBlur: () => void;
- }
- ).onBlur();
- });
-
- expect(mockOnWarning).toHaveBeenCalledWith(true);
- expect(
- wrapper
- .find('[data-test-subj="valuesAutocompleteWildcardLabel"] div.euiFormHelpText')
- .at(0)
- .text()
- ).toEqual(FILEPATH_WARNING);
- });
-
- test('it invokes "onWarning" when warning exists and is wildcard warning', () => {
- const mockOnWarning = jest.fn();
- wrapper = mount(
-
- );
-
- act(() => {
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onBlur: () => void;
- }
- ).onBlur();
- });
-
- expect(mockOnWarning).toHaveBeenCalledWith(true);
- const helpText = wrapper
- .find('[data-test-subj="valuesAutocompleteWildcardLabel"] div.euiFormHelpText')
- .at(0);
- expect(helpText.text()).toEqual(WILDCARD_WARNING);
- expect(helpText.find('.euiToolTipAnchor')).toBeTruthy();
- });
- test('should show the warning helper text if the new value contains spaces when change', async () => {
- (useFieldValueAutocomplete as jest.Mock).mockReturnValue([
- false,
- true,
- [' value 1 ', 'value 2'],
- getValueSuggestionsMock,
- ]);
- const mockOnChange = jest.fn();
- wrapper = mount(
-
- );
-
- await waitFor(() =>
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onChange: (a: EuiComboBoxOptionOption[]) => void;
- }
- ).onChange([{ label: ' value 1 ' }])
- );
- wrapper.update();
- expect(mockOnChange).toHaveBeenCalledWith(' value 1 ');
-
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeTruthy();
- });
- test('should show the warning helper text if the new value contains spaces when searching a new query', () => {
- wrapper = mount(
-
- );
- act(() => {
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onSearchChange: (a: string) => void;
- }
- ).onSearchChange(' value 1');
- });
-
- wrapper.update();
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeTruthy();
- expect(euiFormHelptext.text()).toEqual('Warning: there is a space');
- });
- test('should show the warning helper text if selectedValue contains spaces when editing', () => {
- wrapper = mount(
-
- );
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeTruthy();
- expect(euiFormHelptext.text()).toEqual('Warning: there is a space');
- });
- test('should not show the warning helper text if selectedValue is falsy', () => {
- wrapper = mount(
-
- );
- const euiFormHelptext = wrapper.find(EuiFormHelpText);
- expect(euiFormHelptext.length).toBeFalsy();
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_wildcard/index.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_wildcard/index.tsx
deleted file mode 100644
index 5a55b3399a6a..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/field_value_wildcard/index.tsx
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { useCallback, useMemo, useState, useEffect, memo } from 'react';
-import { EuiFormRow, EuiComboBoxOptionOption, EuiComboBox } from '@elastic/eui';
-import { DataViewBase, DataViewFieldBase } from '@kbn/es-query';
-
-import { uniq } from 'lodash';
-
-import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types';
-
-// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
-// import { AutocompleteStart } from '../../../../../../../src/plugins/unified_search/public';
-type AutocompleteStart = any;
-
-import * as i18n from '../translations';
-import { useFieldValueAutocomplete } from '../hooks/use_field_value_autocomplete';
-import {
- getGenericComboBoxProps,
- GetGenericComboBoxPropsReturn,
-} from '../get_generic_combo_box_props';
-import { paramIsValid } from '../param_is_valid';
-import { paramContainsSpace } from '../param_contains_space';
-
-const SINGLE_SELECTION = { asPlainText: true };
-
-type Warning = string | React.ReactNode;
-interface AutocompleteFieldWildcardProps {
- placeholder: string;
- selectedField: DataViewFieldBase | undefined;
- selectedValue: string | undefined;
- indexPattern: DataViewBase | undefined;
- isLoading: boolean;
- isDisabled?: boolean;
- isClearable?: boolean;
- isRequired?: boolean;
- fieldInputWidth?: number;
- rowLabel?: string;
- autocompleteService: AutocompleteStart;
- onChange: (arg: string) => void;
- onError: (arg: boolean) => void;
- onWarning: (arg: boolean) => void;
- warning?: Warning;
- 'aria-label'?: string;
-}
-
-export const AutocompleteFieldWildcardComponent: React.FC = memo(
- ({
- autocompleteService,
- placeholder,
- rowLabel,
- selectedField,
- selectedValue,
- indexPattern,
- isLoading,
- isDisabled = false,
- isClearable = false,
- isRequired = false,
- fieldInputWidth,
- onChange,
- onError,
- onWarning,
- warning,
- 'aria-label': ariaLabel,
- }): JSX.Element => {
- const [searchQuery, setSearchQuery] = useState('');
- const [touched, setIsTouched] = useState(false);
- const [error, setError] = useState(undefined);
- const [showSpacesWarning, setShowSpacesWarning] = useState(false);
- const [isLoadingSuggestions, , suggestions] = useFieldValueAutocomplete({
- autocompleteService,
- fieldValue: selectedValue,
- indexPattern,
- operatorType: OperatorTypeEnum.WILDCARD,
- query: searchQuery,
- selectedField,
- });
- const getLabel = useCallback((option: string): string => option, []);
- const optionsMemo = useMemo((): string[] => {
- const valueAsStr = String(selectedValue);
- return selectedValue != null && selectedValue.trim() !== ''
- ? uniq([valueAsStr, ...suggestions])
- : suggestions;
- }, [suggestions, selectedValue]);
- const selectedOptionsMemo = useMemo((): string[] => {
- const valueAsStr = String(selectedValue);
- return selectedValue ? [valueAsStr] : [];
- }, [selectedValue]);
-
- const handleSpacesWarning = useCallback(
- (param: string | undefined) => {
- if (!param) return setShowSpacesWarning(false);
- setShowSpacesWarning(!!paramContainsSpace(param));
- },
- [setShowSpacesWarning]
- );
- const handleError = useCallback(
- (err: string | undefined): void => {
- setError((existingErr): string | undefined => {
- const oldErr = existingErr != null;
- const newErr = err != null;
- if (oldErr !== newErr && onError != null) {
- onError(newErr);
- }
-
- return err;
- });
- },
- [setError, onError]
- );
-
- const handleWarning = useCallback(
- (warn: Warning | undefined): void => {
- onWarning(warn !== undefined);
- },
- [onWarning]
- );
-
- const { comboOptions, labels, selectedComboOptions } = useMemo(
- (): GetGenericComboBoxPropsReturn =>
- getGenericComboBoxProps({
- getLabel,
- options: optionsMemo,
- selectedOptions: selectedOptionsMemo,
- }),
- [optionsMemo, selectedOptionsMemo, getLabel]
- );
-
- const handleValuesChange = useCallback(
- (newOptions: EuiComboBoxOptionOption[]): void => {
- const [newValue] = newOptions.map(({ label }) => optionsMemo[labels.indexOf(label)]);
- handleError(undefined);
- handleSpacesWarning(newValue);
- setShowSpacesWarning(false);
-
- onChange(newValue ?? '');
- },
- [handleError, handleSpacesWarning, labels, onChange, optionsMemo]
- );
-
- const handleSearchChange = useCallback(
- (searchVal: string): void => {
- if (searchVal.trim() !== '' && selectedField != null) {
- const err = paramIsValid(searchVal, selectedField, isRequired, touched);
- handleError(err);
- handleWarning(warning);
- if (!err) handleSpacesWarning(searchVal);
-
- setSearchQuery(searchVal);
- }
- },
- [handleError, handleSpacesWarning, isRequired, selectedField, touched, warning, handleWarning]
- );
-
- const handleCreateOption = useCallback(
- (option: string): boolean | undefined => {
- const err = paramIsValid(option, selectedField, isRequired, touched);
- handleError(err);
- handleWarning(warning);
-
- if (err != null) {
- // Explicitly reject the user's input
- setShowSpacesWarning(false);
- return false;
- }
-
- handleSpacesWarning(option);
- onChange(option);
- return undefined;
- },
- [
- isRequired,
- handleSpacesWarning,
- onChange,
- selectedField,
- touched,
- handleError,
- handleWarning,
- warning,
- ]
- );
-
- const setIsTouchedValue = useCallback((): void => {
- setIsTouched(true);
-
- const err = paramIsValid(selectedValue, selectedField, isRequired, true);
- handleError(err);
- handleWarning(warning);
- }, [
- setIsTouched,
- handleError,
- selectedValue,
- selectedField,
- isRequired,
- handleWarning,
- warning,
- ]);
-
- const inputPlaceholder = useMemo((): string => {
- if (isLoading || isLoadingSuggestions) {
- return i18n.LOADING;
- } else if (selectedField == null) {
- return i18n.SELECT_FIELD_FIRST;
- } else {
- return placeholder;
- }
- }, [isLoading, selectedField, isLoadingSuggestions, placeholder]);
-
- const isLoadingState = useMemo(
- (): boolean => isLoading || isLoadingSuggestions,
- [isLoading, isLoadingSuggestions]
- );
-
- useEffect((): void => {
- setError(undefined);
- if (onError != null) {
- onError(false);
- }
- handleSpacesWarning(selectedValue);
-
- onWarning(false);
- }, [selectedField, selectedValue, onError, onWarning, handleSpacesWarning]);
-
- const defaultInput = useMemo((): JSX.Element => {
- return (
-
-
-
- );
- }, [
- rowLabel,
- error,
- warning,
- showSpacesWarning,
- selectedField,
- inputPlaceholder,
- isDisabled,
- isLoadingState,
- isClearable,
- comboOptions,
- selectedComboOptions,
- handleValuesChange,
- handleSearchChange,
- handleCreateOption,
- setIsTouchedValue,
- fieldInputWidth,
- ariaLabel,
- ]);
-
- return defaultInput;
- }
-);
-
-AutocompleteFieldWildcardComponent.displayName = 'AutocompleteFieldWildcard';
diff --git a/packages/kbn-securitysolution-autocomplete/src/fields/index.mock.ts b/packages/kbn-securitysolution-autocomplete/src/fields/index.mock.ts
deleted file mode 100644
index dcb719ccdb56..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/fields/index.mock.ts
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { DataViewFieldBase } from '@kbn/es-query';
-
-// Copied from "src/plugins/data/common/index_patterns/fields/fields.mocks.ts" but with the types changed to "DataViewFieldBase" since that type is compatible.
-// TODO: This should move out once those mocks are directly useable or in their own package, https://github.com/elastic/kibana/issues/100715
-
-export const fields: DataViewFieldBase[] = [
- {
- name: 'bytes',
- type: 'number',
- esTypes: ['long'],
- count: 10,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'ssl',
- type: 'boolean',
- esTypes: ['boolean'],
- count: 20,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: '@timestamp',
- type: 'date',
- esTypes: ['date'],
- count: 30,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'time',
- type: 'date',
- esTypes: ['date'],
- count: 30,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: '@tags',
- type: 'string',
- esTypes: ['keyword'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'utc_time',
- type: 'date',
- esTypes: ['date'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'phpmemory',
- type: 'number',
- esTypes: ['integer'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'ip',
- type: 'ip',
- esTypes: ['ip'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'request_body',
- type: 'attachment',
- esTypes: ['attachment'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'point',
- type: 'geo_point',
- esTypes: ['geo_point'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'area',
- type: 'geo_shape',
- esTypes: ['geo_shape'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'hashed',
- type: 'murmur3',
- esTypes: ['murmur3'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: false,
- readFromDocValues: false,
- },
- {
- name: 'geo.coordinates',
- type: 'geo_point',
- esTypes: ['geo_point'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'extension',
- type: 'string',
- esTypes: ['keyword'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'machine.os',
- type: 'string',
- esTypes: ['text'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: false,
- },
- {
- name: 'machine.os.raw',
- type: 'string',
- esTypes: ['keyword'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- subType: { multi: { parent: 'machine.os' } },
- },
- {
- name: 'geo.src',
- type: 'string',
- esTypes: ['keyword'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: '_id',
- type: 'string',
- esTypes: ['_id'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: false,
- },
- {
- name: '_type',
- type: 'string',
- esTypes: ['_type'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: false,
- },
- {
- name: '_source',
- type: '_source',
- esTypes: ['_source'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: false,
- },
- {
- name: 'non-filterable',
- type: 'string',
- esTypes: ['text'],
- count: 0,
- scripted: false,
- searchable: false,
- aggregatable: true,
- readFromDocValues: false,
- },
- {
- name: 'non-sortable',
- type: 'string',
- esTypes: ['text'],
- count: 0,
- scripted: false,
- searchable: false,
- aggregatable: false,
- readFromDocValues: false,
- },
- {
- name: 'custom_user_field',
- type: 'conflict',
- esTypes: ['long', 'text'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: true,
- readFromDocValues: true,
- },
- {
- name: 'script string',
- type: 'string',
- count: 0,
- scripted: true,
- script: "'i am a string'",
- lang: 'expression',
- searchable: true,
- aggregatable: true,
- readFromDocValues: false,
- },
- {
- name: 'script number',
- type: 'number',
- count: 0,
- scripted: true,
- script: '1234',
- lang: 'expression',
- searchable: true,
- aggregatable: true,
- readFromDocValues: false,
- },
- {
- name: 'script date',
- type: 'date',
- count: 0,
- scripted: true,
- script: '1234',
- lang: 'painless',
- searchable: true,
- aggregatable: true,
- readFromDocValues: false,
- },
- {
- name: 'script murmur3',
- type: 'murmur3',
- count: 0,
- scripted: true,
- script: '1234',
- lang: 'expression',
- searchable: true,
- aggregatable: true,
- readFromDocValues: false,
- },
- {
- name: 'nestedField.child',
- type: 'string',
- esTypes: ['text'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: false,
- readFromDocValues: false,
- subType: { nested: { path: 'nestedField' } },
- },
- {
- name: 'nestedField.nestedChild.doublyNestedChild',
- type: 'string',
- esTypes: ['text'],
- count: 0,
- scripted: false,
- searchable: true,
- aggregatable: false,
- readFromDocValues: false,
- subType: { nested: { path: 'nestedField.nestedChild' } },
- },
- {
- name: 'file.path.text',
- type: 'string',
- esTypes: ['text'],
- searchable: true,
- aggregatable: false,
- subType: { multi: { parent: 'file.path' } },
- },
-] as unknown as DataViewFieldBase[];
-
-export const getField = (name: string) => fields.find((field) => field.name === name);
diff --git a/packages/kbn-securitysolution-autocomplete/src/filter_field_to_list/index.test.ts b/packages/kbn-securitysolution-autocomplete/src/filter_field_to_list/index.test.ts
deleted file mode 100644
index be0710bfd1ba..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/filter_field_to_list/index.test.ts
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { filterFieldToList } from '.';
-
-import { getListResponseMock } from '../list_schema/index.mock';
-import { DataViewFieldBase } from '@kbn/es-query';
-import { AutocompleteListsData } from '../field_value_lists';
-
-const emptyListData: AutocompleteListsData = { smallLists: [], largeLists: [] };
-
-describe('#filterFieldToList', () => {
- test('it returns empty list data object if given a undefined for field', () => {
- const filter = filterFieldToList(emptyListData, undefined);
- expect(filter).toEqual(emptyListData);
- });
-
- test('it returns empty list data object if filed does not contain esTypes', () => {
- const field: DataViewFieldBase = {
- name: 'some-name',
- type: 'some-type',
- };
- const filter = filterFieldToList(emptyListData, field);
- expect(filter).toEqual(emptyListData);
- });
-
- test('it returns filtered lists of ip_range -> ip', () => {
- const field: DataViewFieldBase & { esTypes: string[] } = {
- esTypes: ['ip'],
- name: 'some-name',
- type: 'ip',
- };
- const listData: AutocompleteListsData = {
- smallLists: [{ ...getListResponseMock(), type: 'ip_range' }],
- largeLists: [],
- };
- const filter = filterFieldToList(listData, field);
- const expected = listData;
- expect(filter).toEqual(expected);
- });
-
- test('it returns filtered lists of ip -> ip', () => {
- const field: DataViewFieldBase & { esTypes: string[] } = {
- esTypes: ['ip'],
- name: 'some-name',
- type: 'ip',
- };
- const listData: AutocompleteListsData = {
- smallLists: [{ ...getListResponseMock(), type: 'ip' }],
- largeLists: [],
- };
- const filter = filterFieldToList(listData, field);
- const expected = listData;
- expect(filter).toEqual(expected);
- });
-
- test('it returns filtered lists of keyword -> keyword', () => {
- const field: DataViewFieldBase & { esTypes: string[] } = {
- esTypes: ['keyword'],
- name: 'some-name',
- type: 'keyword',
- };
- const listData: AutocompleteListsData = {
- smallLists: [{ ...getListResponseMock(), type: 'keyword' }],
- largeLists: [],
- };
- const filter = filterFieldToList(listData, field);
- const expected = listData;
- expect(filter).toEqual(expected);
- });
-
- test('it returns filtered lists of text -> text', () => {
- const field: DataViewFieldBase & { esTypes: string[] } = {
- esTypes: ['text'],
- name: 'some-name',
- type: 'text',
- };
- const listData: AutocompleteListsData = {
- smallLists: [{ ...getListResponseMock(), type: 'text' }],
- largeLists: [],
- };
- const filter = filterFieldToList(listData, field);
- const expected = listData;
- expect(filter).toEqual(expected);
- });
-
- test('it returns small and large filtered lists of ip_range -> ip', () => {
- const field: DataViewFieldBase & { esTypes: string[] } = {
- esTypes: ['ip'],
- name: 'some-name',
- type: 'ip',
- };
- const listData: AutocompleteListsData = {
- smallLists: [{ ...getListResponseMock(), type: 'ip_range' }],
- largeLists: [{ ...getListResponseMock(), type: 'ip_range' }],
- };
- const filter = filterFieldToList(listData, field);
- const expected = listData;
- expect(filter).toEqual(expected);
- });
-
- test('it returns 1 filtered lists of ip_range -> ip if the 2nd is not compatible type', () => {
- const field: DataViewFieldBase & { esTypes: string[] } = {
- esTypes: ['ip'],
- name: 'some-name',
- type: 'ip',
- };
- const listData: AutocompleteListsData = {
- smallLists: [{ ...getListResponseMock(), type: 'ip_range' }],
- largeLists: [{ ...getListResponseMock(), type: 'text' }],
- };
- const filter = filterFieldToList(listData, field);
- const expected: AutocompleteListsData = {
- smallLists: [{ ...getListResponseMock(), type: 'ip_range' }],
- largeLists: [],
- };
- expect(filter).toEqual(expected);
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/filter_field_to_list/index.ts b/packages/kbn-securitysolution-autocomplete/src/filter_field_to_list/index.ts
deleted file mode 100644
index 86d429cc9ef8..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/filter_field_to_list/index.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { DataViewFieldBase } from '@kbn/es-query';
-import { typeMatch } from '../type_match';
-import { AutocompleteListsData } from '../field_value_lists';
-
-/**
- * Given an array of lists and optionally a field this will return all
- * the lists that match against the field based on the types from the field
- *
- * NOTE: That we support one additional property from "FieldSpec" located here:
- * src/plugins/data/common/index_patterns/fields/types.ts
- * This type property is esTypes. If it exists and is on there we will read off the esTypes.
- * @param lists The lists to match against the field
- * @param field The field to check against the list to see if they are compatible
- */
-export const filterFieldToList = (
- lists: AutocompleteListsData,
- field?: DataViewFieldBase & { esTypes?: string[] }
-): AutocompleteListsData => {
- if (field != null) {
- const { esTypes = [] } = field;
- return {
- smallLists: lists.smallLists.filter(({ type }) =>
- esTypes.some((esType: string) => typeMatch(type, esType))
- ),
- largeLists: lists.largeLists.filter(({ type }) =>
- esTypes.some((esType: string) => typeMatch(type, esType))
- ),
- };
- } else {
- return { smallLists: [], largeLists: [] };
- }
-};
diff --git a/packages/kbn-securitysolution-autocomplete/src/get_generic_combo_box_props/index.test.tsx b/packages/kbn-securitysolution-autocomplete/src/get_generic_combo_box_props/index.test.tsx
deleted file mode 100644
index 82ca7f60de24..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/get_generic_combo_box_props/index.test.tsx
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { getGenericComboBoxProps } from '.';
-
-describe('get_generic_combo_box_props', () => {
- test('it returns empty arrays if "options" is empty array', () => {
- const result = getGenericComboBoxProps({
- options: [],
- selectedOptions: ['option1'],
- getLabel: (t: string) => t,
- });
-
- expect(result).toEqual({ comboOptions: [], labels: [], selectedComboOptions: [] });
- });
-
- test('it returns formatted props if "options" array is not empty', () => {
- const result = getGenericComboBoxProps({
- options: ['option1', 'option2', 'option3'],
- selectedOptions: [],
- getLabel: (t: string) => t,
- });
-
- expect(result).toEqual({
- comboOptions: [
- {
- label: 'option1',
- },
- {
- label: 'option2',
- },
- {
- label: 'option3',
- },
- ],
- labels: ['option1', 'option2', 'option3'],
- selectedComboOptions: [],
- });
- });
-
- test('it does not return "selectedOptions" items that do not appear in "options"', () => {
- const result = getGenericComboBoxProps({
- options: ['option1', 'option2', 'option3'],
- selectedOptions: ['option4'],
- getLabel: (t: string) => t,
- });
-
- expect(result).toEqual({
- comboOptions: [
- {
- label: 'option1',
- },
- {
- label: 'option2',
- },
- {
- label: 'option3',
- },
- ],
- labels: ['option1', 'option2', 'option3'],
- selectedComboOptions: [],
- });
- });
-
- test('it returns "selectedOptions" items that do appear in "options"', () => {
- const result = getGenericComboBoxProps({
- options: ['option1', 'option2', 'option3'],
- selectedOptions: ['option2'],
- getLabel: (t: string) => t,
- });
-
- expect(result).toEqual({
- comboOptions: [
- {
- label: 'option1',
- },
- {
- label: 'option2',
- },
- {
- label: 'option3',
- },
- ],
- labels: ['option1', 'option2', 'option3'],
- selectedComboOptions: [
- {
- label: 'option2',
- },
- ],
- });
- });
-
- test('it returns "disabledOptions" items that do appear in "options" as disabled', () => {
- const result = getGenericComboBoxProps({
- options: ['option1', 'option2', 'option3'],
- selectedOptions: [],
- disabledOptions: ['option2'],
- getLabel: (t: string) => t,
- });
-
- expect(result).toEqual({
- comboOptions: [
- {
- label: 'option1',
- disabled: false,
- },
- {
- label: 'option2',
- disabled: true,
- },
- {
- label: 'option3',
- disabled: false,
- },
- ],
- labels: ['option1', 'option2', 'option3'],
- selectedComboOptions: [],
- });
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/get_generic_combo_box_props/index.ts b/packages/kbn-securitysolution-autocomplete/src/get_generic_combo_box_props/index.ts
deleted file mode 100644
index 2f2a6697c422..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/get_generic_combo_box_props/index.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EuiComboBoxOptionOption } from '@elastic/eui';
-
-export interface GetGenericComboBoxPropsReturn {
- comboOptions: EuiComboBoxOptionOption[];
- labels: string[];
- selectedComboOptions: EuiComboBoxOptionOption[];
-}
-
-/**
- * Determines the options, selected values and option labels for EUI combo box
- * @param options options user can select from
- * @param selectedOptions user selection if any
- * @param getLabel helper function to know which property to use for labels
- */
-export const getGenericComboBoxProps = ({
- getLabel,
- options,
- selectedOptions,
- disabledOptions,
-}: {
- getLabel: (value: T) => string;
- options: T[];
- selectedOptions: T[];
- disabledOptions?: T[];
-}): GetGenericComboBoxPropsReturn => {
- const newLabels = options.map(getLabel);
- const disabledLabels = disabledOptions?.map(getLabel);
- const newComboOptions: EuiComboBoxOptionOption[] = newLabels.map((label) => ({
- label,
- disabled: disabledLabels && disabledLabels.length !== 0 && disabledLabels.includes(label),
- }));
- const newSelectedComboOptions = selectedOptions
- .map(getLabel)
- .filter((option) => {
- return newLabels.indexOf(option) !== -1;
- })
- .map((option) => {
- return newComboOptions[newLabels.indexOf(option)];
- });
-
- return {
- comboOptions: newComboOptions,
- labels: newLabels,
- selectedComboOptions: newSelectedComboOptions,
- };
-};
diff --git a/packages/kbn-securitysolution-autocomplete/src/get_operators/index.test.ts b/packages/kbn-securitysolution-autocomplete/src/get_operators/index.test.ts
deleted file mode 100644
index 711e7ea87a8e..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/get_operators/index.test.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import {
- doesNotExistOperator,
- EVENT_FILTERS_OPERATORS,
- ALL_OPERATORS,
- existsOperator,
- isNotOperator,
- isOperator,
-} from '@kbn/securitysolution-list-utils';
-import { getOperators } from '.';
-import { getField } from '../fields/index.mock';
-
-describe('#getOperators', () => {
- test('it returns "isOperator" if passed in field is "undefined"', () => {
- const operator = getOperators(undefined);
-
- expect(operator).toEqual([isOperator]);
- });
-
- test('it returns expected operators when field type is "boolean"', () => {
- const operator = getOperators(getField('ssl'));
-
- expect(operator).toEqual([isOperator, isNotOperator, existsOperator, doesNotExistOperator]);
- });
-
- test('it returns "isOperator" when field type is "nested"', () => {
- const operator = getOperators({
- name: 'nestedField',
- scripted: false,
- subType: { nested: { path: 'nestedField' } },
- type: 'nested',
- });
-
- expect(operator).toEqual([isOperator]);
- });
-
- test('it includes a "matches" operator when field is "file.path.text"', () => {
- const operator = getOperators({
- name: 'file.path.text',
- type: 'simple',
- });
-
- expect(operator).toEqual(EVENT_FILTERS_OPERATORS);
- });
-
- test('it returns all operator types when field type is not null, boolean, or nested', () => {
- const operator = getOperators(getField('machine.os.raw'));
-
- expect(operator).toEqual(ALL_OPERATORS);
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/get_operators/index.ts b/packages/kbn-securitysolution-autocomplete/src/get_operators/index.ts
deleted file mode 100644
index dbb36fd479df..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/get_operators/index.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { DataViewFieldBase } from '@kbn/es-query';
-
-import {
- ALL_OPERATORS,
- EVENT_FILTERS_OPERATORS,
- OperatorOption,
- doesNotExistOperator,
- existsOperator,
- isNotOperator,
- isOperator,
-} from '@kbn/securitysolution-list-utils';
-
-/**
- * Returns the appropriate operators given a field type
- *
- * @param field DataViewFieldBase selected field
- *
- */
-export const getOperators = (field: DataViewFieldBase | undefined): OperatorOption[] => {
- if (field == null) {
- return [isOperator];
- } else if (field.type === 'boolean') {
- return [isOperator, isNotOperator, existsOperator, doesNotExistOperator];
- } else if (field.type === 'nested') {
- return [isOperator];
- } else if (field.name === 'file.path.text') {
- return EVENT_FILTERS_OPERATORS;
- } else {
- return ALL_OPERATORS;
- }
-};
diff --git a/packages/kbn-securitysolution-autocomplete/src/hooks/index.ts b/packages/kbn-securitysolution-autocomplete/src/hooks/index.ts
deleted file mode 100644
index 5aa216af4c67..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/hooks/index.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export * from './use_field_value_autocomplete';
diff --git a/packages/kbn-securitysolution-autocomplete/src/hooks/use_field_value_autocomplete/index.test.ts b/packages/kbn-securitysolution-autocomplete/src/hooks/use_field_value_autocomplete/index.test.ts
deleted file mode 100644
index 836744f3ede2..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/hooks/use_field_value_autocomplete/index.test.ts
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { waitFor, renderHook } from '@testing-library/react';
-import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types';
-
-import { UseFieldValueAutocompleteReturn, useFieldValueAutocomplete } from '.';
-import { getField } from '../../fields/index.mock';
-import { autocompleteStartMock } from '../../autocomplete/index.mock';
-import { DataViewFieldBase } from '@kbn/es-query';
-
-// Copied from "src/plugins/data/common/index_patterns/index_pattern.stub.ts"
-// TODO: Remove this in favor of the above if/when it is ported, https://github.com/elastic/kibana/issues/100715
-export const stubIndexPatternWithFields = {
- id: '1234',
- title: 'logstash-*',
- fields: [
- {
- name: 'response',
- type: 'number',
- esTypes: ['integer'],
- aggregatable: true,
- filterable: true,
- searchable: true,
- },
- ],
-};
-
-describe('use_field_value_autocomplete', () => {
- const onErrorMock = jest.fn();
- const getValueSuggestionsMock = jest.fn().mockResolvedValue(['value 1', 'value 2']);
-
- afterEach(() => {
- onErrorMock.mockClear();
- getValueSuggestionsMock.mockClear();
- });
-
- test('initializes hook', async () => {
- const { result } = renderHook(() =>
- useFieldValueAutocomplete({
- autocompleteService: {
- ...autocompleteStartMock,
- getValueSuggestions: getValueSuggestionsMock,
- },
- fieldValue: '',
- indexPattern: undefined,
- operatorType: OperatorTypeEnum.MATCH,
- query: '',
- selectedField: undefined,
- })
- );
- await waitFor(() => expect(result.current).toEqual([false, true, [], result.current[3]]));
- });
-
- test('does not call autocomplete service if "operatorType" is "exists"', async () => {
- const { result } = renderHook(() =>
- useFieldValueAutocomplete({
- autocompleteService: {
- ...autocompleteStartMock,
- getValueSuggestions: getValueSuggestionsMock,
- },
- fieldValue: '',
- indexPattern: stubIndexPatternWithFields,
- operatorType: OperatorTypeEnum.EXISTS,
- query: '',
- selectedField: getField('machine.os'),
- })
- );
-
- await waitFor(() => {
- const expectedResult: UseFieldValueAutocompleteReturn = [false, true, [], result.current[3]];
-
- expect(result.current).toEqual(expectedResult);
- expect(getValueSuggestionsMock).not.toHaveBeenCalled();
- });
- });
-
- test('does not call autocomplete service if "selectedField" is undefined', async () => {
- const { result } = renderHook(() =>
- useFieldValueAutocomplete({
- autocompleteService: {
- ...autocompleteStartMock,
- getValueSuggestions: getValueSuggestionsMock,
- },
- fieldValue: '',
- indexPattern: stubIndexPatternWithFields,
- operatorType: OperatorTypeEnum.EXISTS,
- query: '',
- selectedField: undefined,
- })
- );
-
- await waitFor(() => {
- const expectedResult: UseFieldValueAutocompleteReturn = [false, true, [], result.current[3]];
-
- expect(result.current).toEqual(expectedResult);
- expect(getValueSuggestionsMock).not.toHaveBeenCalled();
- });
- });
-
- test('does not call autocomplete service if "indexPattern" is undefined', async () => {
- const { result } = renderHook(() =>
- useFieldValueAutocomplete({
- autocompleteService: {
- ...autocompleteStartMock,
- getValueSuggestions: getValueSuggestionsMock,
- },
- fieldValue: '',
- indexPattern: undefined,
- operatorType: OperatorTypeEnum.EXISTS,
- query: '',
- selectedField: getField('machine.os'),
- })
- );
-
- await waitFor(() => {
- const expectedResult: UseFieldValueAutocompleteReturn = [false, true, [], result.current[3]];
-
- expect(result.current).toEqual(expectedResult);
- expect(getValueSuggestionsMock).not.toHaveBeenCalled();
- });
- });
-
- test('it uses full path name for nested fields to fetch suggestions', async () => {
- const suggestionsMock = jest.fn().mockResolvedValue([]);
-
- const selectedField: DataViewFieldBase | undefined = getField('nestedField.child');
- if (selectedField == null) {
- throw new TypeError('selectedField for this test should always be defined');
- }
-
- const { signal } = new AbortController();
- renderHook(() =>
- useFieldValueAutocomplete({
- autocompleteService: {
- ...autocompleteStartMock,
- getValueSuggestions: suggestionsMock,
- },
- fieldValue: '',
- indexPattern: stubIndexPatternWithFields,
- operatorType: OperatorTypeEnum.MATCH,
- query: '',
- selectedField: { ...selectedField, name: 'child' },
- })
- );
-
- await waitFor(() =>
- expect(suggestionsMock).toHaveBeenCalledWith({
- field: { ...getField('nestedField.child'), name: 'nestedField.child' },
- indexPattern: {
- fields: [
- {
- aggregatable: true,
- esTypes: ['integer'],
- filterable: true,
- name: 'response',
- searchable: true,
- type: 'number',
- },
- ],
- id: '1234',
- title: 'logstash-*',
- },
- query: '',
- signal,
- useTimeRange: false,
- })
- );
- });
-
- test('returns "isSuggestingValues" of false if field type is boolean', async () => {
- const { result } = renderHook(() =>
- useFieldValueAutocomplete({
- autocompleteService: {
- ...autocompleteStartMock,
- getValueSuggestions: getValueSuggestionsMock,
- },
- fieldValue: '',
- indexPattern: stubIndexPatternWithFields,
- operatorType: OperatorTypeEnum.MATCH,
- query: '',
- selectedField: getField('ssl'),
- })
- );
-
- await waitFor(() => {
- const expectedResult: UseFieldValueAutocompleteReturn = [false, false, [], result.current[3]];
-
- expect(result.current).toEqual(expectedResult);
- expect(getValueSuggestionsMock).not.toHaveBeenCalled();
- });
- });
-
- test('returns "isSuggestingValues" of false to note that autocomplete service is not in use if no autocomplete suggestions available', async () => {
- const suggestionsMock = jest.fn().mockResolvedValue([]);
-
- const { result } = renderHook(() =>
- useFieldValueAutocomplete({
- autocompleteService: {
- ...autocompleteStartMock,
- getValueSuggestions: suggestionsMock,
- },
- fieldValue: '',
- indexPattern: stubIndexPatternWithFields,
- operatorType: OperatorTypeEnum.MATCH,
- query: '',
- selectedField: getField('bytes'),
- })
- );
-
- await waitFor(() => {
- const expectedResult: UseFieldValueAutocompleteReturn = [false, false, [], result.current[3]];
-
- expect(suggestionsMock).toHaveBeenCalled();
- expect(result.current).toEqual(expectedResult);
- });
- });
-
- test('returns suggestions', async () => {
- const { signal } = new AbortController();
- const { result } = renderHook(() =>
- useFieldValueAutocomplete({
- autocompleteService: {
- ...autocompleteStartMock,
- getValueSuggestions: getValueSuggestionsMock,
- },
- fieldValue: '',
- indexPattern: stubIndexPatternWithFields,
- operatorType: OperatorTypeEnum.MATCH,
- query: '',
- selectedField: getField('@tags'),
- })
- );
-
- await waitFor(() => {
- const expectedResult: UseFieldValueAutocompleteReturn = [
- false,
- true,
- ['value 1', 'value 2'],
- result.current[3],
- ];
-
- expect(getValueSuggestionsMock).toHaveBeenCalledWith({
- field: getField('@tags'),
- indexPattern: stubIndexPatternWithFields,
- query: '',
- signal,
- useTimeRange: false,
- });
- expect(result.current).toEqual(expectedResult);
- });
- });
-
- test('returns new suggestions on subsequent calls', async () => {
- const { result } = renderHook(() =>
- useFieldValueAutocomplete({
- autocompleteService: {
- ...autocompleteStartMock,
- getValueSuggestions: getValueSuggestionsMock,
- },
- fieldValue: '',
- indexPattern: stubIndexPatternWithFields,
- operatorType: OperatorTypeEnum.MATCH,
- query: '',
- selectedField: getField('@tags'),
- })
- );
-
- await waitFor(() => expect(result.current[3]).not.toBeNull());
-
- // Added check for typescripts sake, if null,
- // would not reach below logic as test would stop above
- if (result.current[3] != null) {
- result.current[3]({
- fieldSelected: getField('@tags'),
- patterns: stubIndexPatternWithFields,
- searchQuery: '',
- value: 'hello',
- });
- }
-
- await waitFor(() => {
- const expectedResult: UseFieldValueAutocompleteReturn = [
- false,
- true,
- ['value 1', 'value 2'],
- result.current[3],
- ];
-
- expect(getValueSuggestionsMock).toHaveBeenCalledTimes(2);
- expect(result.current).toEqual(expectedResult);
- });
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/hooks/use_field_value_autocomplete/index.ts b/packages/kbn-securitysolution-autocomplete/src/hooks/use_field_value_autocomplete/index.ts
deleted file mode 100644
index 9fff2abfd5be..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/hooks/use_field_value_autocomplete/index.ts
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { useEffect, useRef, useState } from 'react';
-import { debounce } from 'lodash';
-import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types';
-import { DataViewBase, DataViewFieldBase, getDataViewFieldSubtypeNested } from '@kbn/es-query';
-
-// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
-// import { AutocompleteStart } from '../../../../../../../../src/plugins/unified_search/public';
-type AutocompleteStart = any;
-
-interface FuncArgs {
- fieldSelected: DataViewFieldBase | undefined;
- patterns: DataViewBase | undefined;
- searchQuery: string;
- value: string | string[] | undefined;
-}
-
-type Func = (args: FuncArgs) => void;
-
-export type UseFieldValueAutocompleteReturn = [boolean, boolean, string[], Func | null];
-
-export interface UseFieldValueAutocompleteProps {
- autocompleteService: AutocompleteStart;
- fieldValue: string | string[] | undefined;
- indexPattern: DataViewBase | undefined;
- operatorType: OperatorTypeEnum;
- query: string;
- selectedField: DataViewFieldBase | undefined;
-}
-/**
- * Hook for using the field value autocomplete service
- */
-export const useFieldValueAutocomplete = ({
- selectedField,
- operatorType,
- fieldValue,
- query,
- indexPattern,
- autocompleteService,
-}: UseFieldValueAutocompleteProps): UseFieldValueAutocompleteReturn => {
- const [isLoading, setIsLoading] = useState(false);
- const [isSuggestingValues, setIsSuggestingValues] = useState(true);
- const [suggestions, setSuggestions] = useState([]);
- const updateSuggestions = useRef(null);
-
- useEffect(() => {
- let isSubscribed = true;
- const abortCtrl = new AbortController();
-
- const fetchSuggestions = debounce(
- async ({ fieldSelected, patterns, searchQuery }: FuncArgs) => {
- try {
- if (isSubscribed) {
- if (fieldSelected == null || patterns == null) {
- return;
- }
-
- if (fieldSelected.type === 'boolean') {
- setIsSuggestingValues(false);
- return;
- }
-
- setIsLoading(true);
- const subTypeNested = getDataViewFieldSubtypeNested(fieldSelected);
- const field = subTypeNested
- ? {
- ...fieldSelected,
- name: `${subTypeNested.nested.path}.${fieldSelected.name}`,
- }
- : fieldSelected;
-
- const newSuggestions = await autocompleteService.getValueSuggestions({
- field,
- indexPattern: patterns,
- query: searchQuery,
- signal: abortCtrl.signal,
- useTimeRange: false,
- });
-
- if (newSuggestions.length === 0) {
- setIsSuggestingValues(false);
- }
-
- setIsLoading(false);
- setSuggestions([...newSuggestions]);
- }
- } catch (error) {
- if (isSubscribed) {
- setSuggestions([]);
- setIsLoading(false);
- }
- }
- },
- 500
- );
-
- if (operatorType !== OperatorTypeEnum.EXISTS) {
- fetchSuggestions({
- fieldSelected: selectedField,
- patterns: indexPattern,
- searchQuery: query,
- value: fieldValue,
- });
- }
-
- updateSuggestions.current = fetchSuggestions;
-
- return (): void => {
- isSubscribed = false;
- abortCtrl.abort();
- };
- }, [selectedField, operatorType, fieldValue, indexPattern, query, autocompleteService]);
-
- return [isLoading, isSuggestingValues, suggestions, updateSuggestions.current];
-};
diff --git a/packages/kbn-securitysolution-autocomplete/src/list_schema/index.mock.ts b/packages/kbn-securitysolution-autocomplete/src/list_schema/index.mock.ts
deleted file mode 100644
index e2c2c9b0fe05..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/list_schema/index.mock.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import {
- FoundListSchema,
- ListSchema,
- FoundListsBySizeSchema,
-} from '@kbn/securitysolution-io-ts-list-types';
-
-// TODO: Once this mock is available within packages, use it instead, https://github.com/elastic/kibana/issues/100715
-// import { getFoundListSchemaMock } from '../../../../../lists/common/schemas/response/found_list_schema.mock';
-export const getFoundListSchemaMock = (): FoundListSchema => ({
- cursor: '123',
- data: [getListResponseMock()],
- page: 1,
- per_page: 1,
- total: 1,
-});
-
-export const getFoundListsBySizeSchemaMock = (): FoundListsBySizeSchema => ({
- smallLists: [getListResponseMock()],
- largeLists: [getListResponseMock()],
-});
-
-// TODO: Once these mocks are available from packages use it instead, https://github.com/elastic/kibana/issues/100715
-export const DATE_NOW = '2020-04-20T15:25:31.830Z';
-export const USER = 'some user';
-export const IMMUTABLE = false;
-export const VERSION = 1;
-export const DESCRIPTION = 'some description';
-export const TIE_BREAKER = '6a76b69d-80df-4ab2-8c3e-85f466b06a0e';
-export const LIST_ID = 'some-list-id';
-export const META = {};
-export const TYPE = 'ip';
-export const NAME = 'some name';
-
-// TODO: Once this mock is available within packages, use it instead, https://github.com/elastic/kibana/issues/100715
-// import { getListResponseMock } from '../../../../../lists/common/schemas/response/list_schema.mock';
-export const getListResponseMock = (): ListSchema => ({
- '@timestamp': DATE_NOW,
- _version: undefined,
- created_at: DATE_NOW,
- created_by: USER,
- description: DESCRIPTION,
- deserializer: undefined,
- id: LIST_ID,
- immutable: IMMUTABLE,
- meta: META,
- name: NAME,
- serializer: undefined,
- tie_breaker_id: TIE_BREAKER,
- type: TYPE,
- updated_at: DATE_NOW,
- updated_by: USER,
- version: VERSION,
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/operator/index.test.tsx b/packages/kbn-securitysolution-autocomplete/src/operator/index.test.tsx
deleted file mode 100644
index 4d2112d8f31d..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/operator/index.test.tsx
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { mount } from 'enzyme';
-import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui';
-import { isNotOperator, isOperator } from '@kbn/securitysolution-list-utils';
-
-import { OperatorComponent } from '.';
-import { getField } from '../fields/index.mock';
-
-describe('operator', () => {
- test('it renders disabled if "isDisabled" is true', () => {
- const wrapper = mount(
-
- );
-
- expect(
- wrapper.find(`[data-test-subj="operatorAutocompleteComboBox"] input`).prop('disabled')
- ).toBeTruthy();
- });
-
- test('it renders loading if "isLoading" is true', () => {
- const wrapper = mount(
-
- );
- wrapper.find(`[data-test-subj="operatorAutocompleteComboBox"] button`).at(0).simulate('click');
- expect(
- wrapper
- .find(`EuiComboBoxOptionsList[data-test-subj="operatorAutocompleteComboBox-optionsList"]`)
- .prop('isLoading')
- ).toBeTruthy();
- });
-
- test('it allows user to clear values if "isClearable" is true', () => {
- const wrapper = mount(
-
- );
-
- expect(wrapper.find(`button[data-test-subj="comboBoxClearButton"]`).exists()).toBeTruthy();
- });
-
- test('it displays "operatorOptions" if param is passed in with items', () => {
- const wrapper = mount(
-
- );
-
- expect(
- wrapper.find(`[data-test-subj="operatorAutocompleteComboBox"]`).at(0).prop('options')
- ).toEqual([{ label: 'is not' }]);
- });
-
- test('it does not display "operatorOptions" if param is passed in with no items', () => {
- const wrapper = mount(
-
- );
-
- expect(
- wrapper.find(`[data-test-subj="operatorAutocompleteComboBox"]`).at(0).prop('options')
- ).toEqual([
- {
- label: 'is',
- },
- {
- label: 'is not',
- },
- {
- label: 'is one of',
- },
- {
- label: 'is not one of',
- },
- {
- label: 'exists',
- },
- {
- label: 'does not exist',
- },
- {
- label: 'is in list',
- },
- {
- label: 'is not in list',
- },
- {
- label: 'matches',
- },
- {
- label: 'does not match',
- },
- ]);
- });
-
- test('it correctly displays selected operator', () => {
- const wrapper = mount(
-
- );
-
- expect(
- wrapper.find('[data-test-subj="operatorAutocompleteComboBox"] input').at(0).props().value
- ).toEqual('is');
- });
-
- test('it only displays subset of operators if field type is nested', () => {
- const wrapper = mount(
-
- );
-
- expect(
- wrapper.find(`[data-test-subj="operatorAutocompleteComboBox"]`).at(0).prop('options')
- ).toEqual([{ label: 'is' }]);
- });
-
- test('it only displays subset of operators if field type is boolean', () => {
- const wrapper = mount(
-
- );
-
- expect(
- wrapper.find(`[data-test-subj="operatorAutocompleteComboBox"]`).at(0).prop('options')
- ).toEqual([
- { label: 'is' },
- { label: 'is not' },
- { label: 'exists' },
- { label: 'does not exist' },
- ]);
- });
-
- test('it only displays subset of operators if field name is "file.path.text"', () => {
- const wrapper = mount(
-
- );
-
- expect(
- wrapper.find(`[data-test-subj="operatorAutocompleteComboBox"]`).at(0).prop('options')
- ).toEqual([
- { label: 'is' },
- { label: 'is not' },
- { label: 'is one of' },
- { label: 'is not one of' },
- { label: 'matches' },
- { label: 'does not match' },
- ]);
- });
-
- test('it invokes "onChange" when option selected', () => {
- const mockOnChange = jest.fn();
- const wrapper = mount(
-
- );
-
- (
- wrapper.find(EuiComboBox).props() as unknown as {
- onChange: (a: EuiComboBoxOptionOption[]) => void;
- }
- ).onChange([{ label: 'is not' }]);
-
- expect(mockOnChange).toHaveBeenCalledWith([
- { message: 'is not', operator: 'excluded', type: 'match', value: 'is_not' },
- ]);
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/operator/index.tsx b/packages/kbn-securitysolution-autocomplete/src/operator/index.tsx
deleted file mode 100644
index c3d91c16eae9..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/operator/index.tsx
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { useCallback, useMemo } from 'react';
-import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui';
-import { OperatorOption } from '@kbn/securitysolution-list-utils';
-import { DataViewFieldBase } from '@kbn/es-query';
-
-import { getOperators } from '../get_operators';
-import {
- getGenericComboBoxProps,
- GetGenericComboBoxPropsReturn,
-} from '../get_generic_combo_box_props';
-
-const AS_PLAIN_TEXT = { asPlainText: true };
-
-interface OperatorState {
- isClearable: boolean;
- isDisabled: boolean;
- isLoading: boolean;
- onChange: (arg: OperatorOption[]) => void;
- operator: OperatorOption;
- operatorInputWidth?: number;
- operatorOptions?: OperatorOption[];
- placeholder: string;
- selectedField: DataViewFieldBase | undefined;
- 'aria-label'?: string;
-}
-
-export const OperatorComponent: React.FC = ({
- isClearable = false,
- isDisabled = false,
- isLoading = false,
- onChange,
- operator,
- operatorOptions,
- operatorInputWidth = 150,
- placeholder,
- selectedField,
- 'aria-label': ariaLabel,
-}): JSX.Element => {
- const getLabel = useCallback(({ message }: OperatorOption): string => message, []);
- const optionsMemo = useMemo(
- (): OperatorOption[] =>
- operatorOptions != null && operatorOptions.length > 0
- ? operatorOptions
- : getOperators(selectedField),
- [operatorOptions, selectedField]
- );
- const selectedOptionsMemo = useMemo(
- (): OperatorOption[] => (operator ? [operator] : []),
- [operator]
- );
- const { comboOptions, labels, selectedComboOptions } = useMemo(
- (): GetGenericComboBoxPropsReturn =>
- getGenericComboBoxProps({
- getLabel,
- options: optionsMemo,
- selectedOptions: selectedOptionsMemo,
- }),
- [optionsMemo, selectedOptionsMemo, getLabel]
- );
-
- const handleValuesChange = useCallback(
- (newOptions: EuiComboBoxOptionOption[]): void => {
- const newValues: OperatorOption[] = newOptions.map(
- ({ label }) => optionsMemo[labels.indexOf(label)]
- );
- onChange(newValues);
- },
- [labels, onChange, optionsMemo]
- );
-
- const inputWidth = useMemo(() => {
- return { width: `${operatorInputWidth}px` };
- }, [operatorInputWidth]);
-
- return (
-
- );
-};
-
-OperatorComponent.displayName = 'Operator';
diff --git a/packages/kbn-securitysolution-autocomplete/src/param_contains_space/index.test.ts b/packages/kbn-securitysolution-autocomplete/src/param_contains_space/index.test.ts
deleted file mode 100644
index aef6fc4acffa..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/param_contains_space/index.test.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { paramContainsSpace } from '.';
-
-describe('param_contains_space', () => {
- test('should return true if leading spaces were found', () => {
- expect(paramContainsSpace(' test')).toBeTruthy();
- });
- test('should return true if trailing spaces were found', () => {
- expect(paramContainsSpace('test ')).toBeTruthy();
- });
- test('should return true if both trailing and leading spaces were found', () => {
- expect(paramContainsSpace(' test ')).toBeTruthy();
- });
- test('should return true if tabs was found', () => {
- expect(paramContainsSpace('\ttest')).toBeTruthy();
- });
- test('should return false if no spaces were found', () => {
- expect(paramContainsSpace('test test')).toBeFalsy();
- });
- test('should return false if param is falsy', () => {
- expect(paramContainsSpace('')).toBeFalsy();
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/param_contains_space/index.ts b/packages/kbn-securitysolution-autocomplete/src/param_contains_space/index.ts
deleted file mode 100644
index 996167f20536..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/param_contains_space/index.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export const paramContainsSpace = (param: string) => param && param.trim().length !== param.length;
diff --git a/packages/kbn-securitysolution-autocomplete/src/param_is_valid/index.test.ts b/packages/kbn-securitysolution-autocomplete/src/param_is_valid/index.test.ts
deleted file mode 100644
index c530bca356cb..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/param_is_valid/index.test.ts
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { paramIsValid } from '.';
-import { getField } from '../fields/index.mock';
-import * as i18n from '../translations';
-import moment from 'moment';
-
-describe('params_is_valid', () => {
- beforeEach(() => {
- // Disable momentJS deprecation warning and it looks like it is not typed either so
- // we have to disable the type as well and cannot extend it easily.
- (
- moment as unknown as {
- suppressDeprecationWarnings: boolean;
- }
- ).suppressDeprecationWarnings = true;
- });
-
- afterEach(() => {
- // Re-enable momentJS deprecation warning and it looks like it is not typed either so
- // we have to disable the type as well and cannot extend it easily.
- (
- moment as unknown as {
- suppressDeprecationWarnings: boolean;
- }
- ).suppressDeprecationWarnings = false;
- });
-
- test('returns no errors if no field has been selected', () => {
- const isValid = paramIsValid('', undefined, true, false);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns error string if user has touched a required input and left empty', () => {
- const isValid = paramIsValid(undefined, getField('@timestamp'), true, true);
-
- expect(isValid).toEqual(i18n.FIELD_REQUIRED_ERR);
- });
-
- test('returns no errors if required input is empty but user has not yet touched it', () => {
- const isValid = paramIsValid(undefined, getField('@timestamp'), true, false);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns no errors if user has touched an input that is not required and left empty', () => {
- const isValid = paramIsValid(undefined, getField('@timestamp'), false, true);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns no errors if user has touched an input that is not required and left empty string', () => {
- const isValid = paramIsValid('', getField('@timestamp'), false, true);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns no errors if field is of type date and value is valid', () => {
- const isValid = paramIsValid('1994-11-05T08:15:30-05:00', getField('@timestamp'), false, true);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns errors if filed is of type date and value is not valid', () => {
- const isValid = paramIsValid('1593478826', getField('@timestamp'), false, true);
-
- expect(isValid).toEqual(i18n.DATE_ERR);
- });
-
- test('returns no errors if field is of type number and value is an integer', () => {
- const isValid = paramIsValid('4', getField('bytes'), true, true);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns no errors if field is of type number and value is a float', () => {
- const isValid = paramIsValid('4.3', getField('bytes'), true, true);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns no errors if field is of type number and value is a long', () => {
- const isValid = paramIsValid('-9223372036854775808', getField('bytes'), true, true);
-
- expect(isValid).toBeUndefined();
- });
-
- test('returns errors if field is of type number and value is "hello"', () => {
- const isValid = paramIsValid('hello', getField('bytes'), true, true);
-
- expect(isValid).toEqual(i18n.NUMBER_ERR);
- });
-
- test('returns errors if field is of type number and value is "123abc"', () => {
- const isValid = paramIsValid('123abc', getField('bytes'), true, true);
-
- expect(isValid).toEqual(i18n.NUMBER_ERR);
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/param_is_valid/index.ts b/packages/kbn-securitysolution-autocomplete/src/param_is_valid/index.ts
deleted file mode 100644
index 5abde0b36c4c..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/param_is_valid/index.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import dateMath from '@kbn/datemath';
-import { DataViewFieldBase } from '@kbn/es-query';
-import { checkEmptyValue } from '../check_empty_value';
-
-import * as i18n from '../translations';
-
-/**
- * Very basic validation for values
- * @param param the value being checked
- * @param field the selected field
- * @param isRequired whether or not an empty value is allowed
- * @param touched has field been touched by user
- * @returns undefined if valid, string with error message if invalid
- */
-export const paramIsValid = (
- param: string | undefined,
- field: DataViewFieldBase | undefined,
- isRequired: boolean,
- touched: boolean
-): string | undefined => {
- if (field == null) {
- return undefined;
- }
-
- const emptyValueError = checkEmptyValue(param, field, isRequired, touched);
- if (emptyValueError !== null) {
- return emptyValueError;
- }
-
- switch (field.type) {
- case 'date':
- const moment = dateMath.parse(param ?? '');
- const isDate = Boolean(moment && moment.isValid());
- return isDate ? undefined : i18n.DATE_ERR;
- case 'number':
- const isNum = param != null && param.trim() !== '' && !isNaN(+param);
- return isNum ? undefined : i18n.NUMBER_ERR;
- default:
- return undefined;
- }
-};
diff --git a/packages/kbn-securitysolution-autocomplete/src/translations/index.ts b/packages/kbn-securitysolution-autocomplete/src/translations/index.ts
deleted file mode 100644
index 01671880d2dc..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/translations/index.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { i18n } from '@kbn/i18n';
-
-export const LOADING = i18n.translate('autocomplete.loadingDescription', {
- defaultMessage: 'Loading...',
-});
-
-export const SELECT_FIELD_FIRST = i18n.translate('autocomplete.selectField', {
- defaultMessage: 'Please select a field first...',
-});
-
-export const FIELD_REQUIRED_ERR = i18n.translate('autocomplete.fieldRequiredError', {
- defaultMessage: 'Value cannot be empty',
-});
-
-export const NUMBER_ERR = i18n.translate('autocomplete.invalidNumberError', {
- defaultMessage: 'Not a valid number',
-});
-
-export const DATE_ERR = i18n.translate('autocomplete.invalidDateError', {
- defaultMessage: 'Not a valid date',
-});
-
-export const BINARY_TYPE_NOT_SUPPORTED = i18n.translate('autocomplete.invalidBinaryType', {
- defaultMessage: 'Binary fields are currently unsupported',
-});
-export const FIELD_SPACE_WARNING = i18n.translate('autocomplete.fieldSpaceWarning', {
- defaultMessage: "Warning: Spaces at the start or end of this value aren't being displayed.",
-});
-
-export const LISTS_TOOLTIP_INFO = i18n.translate('autocomplete.listsTooltipWarning', {
- defaultMessage: "Lists that aren't able to be processed by this rule type will be disabled.",
-});
-
-export const SEE_DOCUMENTATION = i18n.translate('autocomplete.seeDocumentation', {
- defaultMessage: 'See Documentation',
-});
-
-export const FIELD_CONFLICT_INDICES_WARNING_TITLE = i18n.translate(
- 'autocomplete.conflictIndicesWarning.title',
- {
- defaultMessage: 'Mapping Conflict',
- }
-);
-
-export const FIELD_CONFLICT_INDICES_WARNING_DESCRIPTION = i18n.translate(
- 'autocomplete.conflictIndicesWarning.description',
- {
- defaultMessage:
- 'This field is defined as different types across the following indices or is unmapped. This can cause unexpected query results.',
- }
-);
-
-export const CONFLICT_MULTIPLE_INDEX_DESCRIPTION = (name: string, count: number): string =>
- i18n.translate('autocomplete.conflictIndicesWarning.index.description', {
- defaultMessage: '{name} ({count} indices)',
- values: { count, name },
- });
-
-export const SHOW_VALUE_LIST_MODAL = i18n.translate('autocomplete.showValueListModal', {
- defaultMessage: 'Show value list',
-});
-
-// eslint-disable-next-line import/no-default-export
-export default {
- LOADING,
- SELECT_FIELD_FIRST,
- FIELD_REQUIRED_ERR,
- NUMBER_ERR,
- DATE_ERR,
- FIELD_SPACE_WARNING,
- BINARY_TYPE_NOT_SUPPORTED,
-};
diff --git a/packages/kbn-securitysolution-autocomplete/src/type_match/index.test.ts b/packages/kbn-securitysolution-autocomplete/src/type_match/index.test.ts
deleted file mode 100644
index 15c7c3f580da..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/type_match/index.test.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { typeMatch } from '.';
-
-describe('type_match', () => {
- test('ip -> ip is true', () => {
- expect(typeMatch('ip', 'ip')).toEqual(true);
- });
-
- test('keyword -> keyword is true', () => {
- expect(typeMatch('keyword', 'keyword')).toEqual(true);
- });
-
- test('text -> text is true', () => {
- expect(typeMatch('text', 'text')).toEqual(true);
- });
-
- test('ip_range -> ip is true', () => {
- expect(typeMatch('ip_range', 'ip')).toEqual(true);
- });
-
- test('date_range -> date is true', () => {
- expect(typeMatch('date_range', 'date')).toEqual(true);
- });
-
- test('double_range -> double is true', () => {
- expect(typeMatch('double_range', 'double')).toEqual(true);
- });
-
- test('float_range -> float is true', () => {
- expect(typeMatch('float_range', 'float')).toEqual(true);
- });
-
- test('integer_range -> integer is true', () => {
- expect(typeMatch('integer_range', 'integer')).toEqual(true);
- });
-
- test('long_range -> long is true', () => {
- expect(typeMatch('long_range', 'long')).toEqual(true);
- });
-
- test('ip -> date is false', () => {
- expect(typeMatch('ip', 'date')).toEqual(false);
- });
-
- test('long -> float is false', () => {
- expect(typeMatch('long', 'float')).toEqual(false);
- });
-
- test('integer -> long is false', () => {
- expect(typeMatch('integer', 'long')).toEqual(false);
- });
-});
diff --git a/packages/kbn-securitysolution-autocomplete/src/type_match/index.ts b/packages/kbn-securitysolution-autocomplete/src/type_match/index.ts
deleted file mode 100644
index 4d5899a376a0..000000000000
--- a/packages/kbn-securitysolution-autocomplete/src/type_match/index.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import type { Type } from '@kbn/securitysolution-io-ts-list-types';
-
-/**
- * Given an input list type and a string based ES type this will match
- * if they're exact or if they are compatible with a range
- * @param type The type to match against the esType
- * @param esType The ES type to match with
- */
-export const typeMatch = (type: Type, esType: string): boolean => {
- return (
- type === esType ||
- (type === 'ip_range' && esType === 'ip') ||
- (type === 'date_range' && esType === 'date') ||
- (type === 'double_range' && esType === 'double') ||
- (type === 'float_range' && esType === 'float') ||
- (type === 'integer_range' && esType === 'integer') ||
- (type === 'long_range' && esType === 'long')
- );
-};
diff --git a/packages/kbn-securitysolution-autocomplete/tsconfig.json b/packages/kbn-securitysolution-autocomplete/tsconfig.json
deleted file mode 100644
index f7df7da6f06a..000000000000
--- a/packages/kbn-securitysolution-autocomplete/tsconfig.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "extends": "../../tsconfig.base.json",
- "compilerOptions": {
- "outDir": "target/types",
- "types": ["jest", "node"]
- },
- "include": [
- "**/*.ts",
- "**/*.tsx",
- ],
- "kbn_references": [
- "@kbn/datemath",
- "@kbn/es-query",
- "@kbn/i18n",
- "@kbn/securitysolution-io-ts-list-types",
- "@kbn/securitysolution-list-hooks",
- "@kbn/securitysolution-list-utils",
- "@kbn/doc-links",
- "@kbn/securitysolution-utils",
- ],
- "exclude": [
- "target/**/*",
- ],
-}
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/api/create_endpoint_list/create_endpoint_list.gen.ts b/packages/kbn-securitysolution-endpoint-exceptions-common/api/create_endpoint_list/create_endpoint_list.gen.ts
deleted file mode 100644
index 42a3b67106c0..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/api/create_endpoint_list/create_endpoint_list.gen.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/*
- * NOTICE: Do not edit this file manually.
- * This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
- *
- * info:
- * title: Create endpoint list API endpoint
- * version: 2023-10-31
- */
-
-import { z } from '@kbn/zod';
-
-import { EndpointList } from '../model/endpoint_list_common.gen';
-
-export type CreateEndpointListResponse = z.infer;
-export const CreateEndpointListResponse = EndpointList;
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/api/create_endpoint_list/create_endpoint_list.schema.yaml b/packages/kbn-securitysolution-endpoint-exceptions-common/api/create_endpoint_list/create_endpoint_list.schema.yaml
deleted file mode 100644
index b2ca0f563617..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/api/create_endpoint_list/create_endpoint_list.schema.yaml
+++ /dev/null
@@ -1,45 +0,0 @@
-openapi: 3.0.0
-info:
- title: Create endpoint list API endpoint
- version: '2023-10-31'
-paths:
- /api/endpoint_list:
- post:
- x-labels: [serverless, ess]
- x-codegen-enabled: true
- operationId: CreateEndpointList
- summary: Create an endpoint exception list
- description: Create an endpoint exception list, which groups endpoint exception list items. If an endpoint exception list already exists, an empty response is returned.
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- $ref: '../model/endpoint_list_common.schema.yaml#/components/schemas/EndpointList'
- 400:
- description: Invalid input data
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Insufficient privileges
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 500:
- description: Internal server error
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/api/delete_endpoint_list_item/delete_endpoint_list_item.schema.yaml b/packages/kbn-securitysolution-endpoint-exceptions-common/api/delete_endpoint_list_item/delete_endpoint_list_item.schema.yaml
deleted file mode 100644
index 69db50616918..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/api/delete_endpoint_list_item/delete_endpoint_list_item.schema.yaml
+++ /dev/null
@@ -1,64 +0,0 @@
-openapi: 3.0.0
-info:
- title: Delete endpoint list item API endpoint
- version: '2023-10-31'
-paths:
- /api/endpoint_list/items:
- delete:
- x-labels: [serverless, ess]
- x-codegen-enabled: true
- operationId: DeleteEndpointListItem
- summary: Delete an endpoint exception list item
- description: Delete an endpoint exception list item using the `id` or `item_id` field.
- parameters:
- - name: id
- in: query
- required: false
- description: Either `id` or `item_id` must be specified
- schema:
- $ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemId'
- - name: item_id
- in: query
- required: false
- description: Either `id` or `item_id` must be specified
- schema:
- $ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemHumanId'
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- $ref: '../model/endpoint_list_common.schema.yaml#/components/schemas/EndpointListItem'
- 400:
- description: Invalid input data
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Insufficient privileges
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 404:
- description: Endpoint list item not found
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/api/find_endpoint_list_item/find_endpoint_list_item.schema.yaml b/packages/kbn-securitysolution-endpoint-exceptions-common/api/find_endpoint_list_item/find_endpoint_list_item.schema.yaml
deleted file mode 100644
index 6dc2fcaa7e87..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/api/find_endpoint_list_item/find_endpoint_list_item.schema.yaml
+++ /dev/null
@@ -1,113 +0,0 @@
-openapi: 3.0.0
-info:
- title: Find endpoint list items API endpoint
- version: '2023-10-31'
-paths:
- /api/endpoint_list/items/_find:
- get:
- x-labels: [serverless, ess]
- x-codegen-enabled: true
- operationId: FindEndpointListItems
- summary: Get endpoint exception list items
- description: Get a list of all endpoint exception list items.
- parameters:
- - name: filter
- in: query
- required: false
- description: |
- Filters the returned results according to the value of the specified field,
- using the `:` syntax.
- schema:
- $ref: '#/components/schemas/FindEndpointListItemsFilter'
- - name: page
- in: query
- required: false
- description: The page number to return
- schema:
- type: integer
- minimum: 0
- - name: per_page
- in: query
- required: false
- description: The number of exception list items to return per page
- schema:
- type: integer
- minimum: 0
- - name: sort_field
- in: query
- required: false
- description: Determines which field is used to sort the results
- schema:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
- - name: sort_order
- in: query
- required: false
- description: Determines the sort order, which can be `desc` or `asc`
- schema:
- type: string
- enum: [desc, asc]
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- type: object
- properties:
- data:
- type: array
- items:
- $ref: '../model/endpoint_list_common.schema.yaml#/components/schemas/EndpointListItem'
- page:
- type: integer
- minimum: 0
- per_page:
- type: integer
- minimum: 0
- total:
- type: integer
- minimum: 0
- pit:
- type: string
- required:
- - data
- - page
- - per_page
- - total
- 400:
- description: Invalid input data
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Insufficient privileges
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 404:
- description: Endpoint list not found
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
-
-components:
- schemas:
- FindEndpointListItemsFilter:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/api/index.ts b/packages/kbn-securitysolution-endpoint-exceptions-common/api/index.ts
deleted file mode 100644
index c71b02c448db..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/api/index.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export * from './create_endpoint_list/create_endpoint_list.gen';
-export * from './create_endpoint_list_item/create_endpoint_list_item.gen';
-export * from './read_endpoint_list_item/read_endpoint_list_item.gen';
-export * from './update_endpoint_list_item/update_endpoint_list_item.gen';
-export * from './delete_endpoint_list_item/delete_endpoint_list_item.gen';
-export * from './find_endpoint_list_item/find_endpoint_list_item.gen';
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/api/model/endpoint_list_common.gen.ts b/packages/kbn-securitysolution-endpoint-exceptions-common/api/model/endpoint_list_common.gen.ts
deleted file mode 100644
index 6c8093246b1a..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/api/model/endpoint_list_common.gen.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/*
- * NOTICE: Do not edit this file manually.
- * This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
- *
- * info:
- * title: Common Exception List Attributes
- * version: not applicable
- */
-
-import { z } from '@kbn/zod';
-
-import {
- ExceptionList,
- ExceptionListItem,
-} from '@kbn/securitysolution-exceptions-common/api/model/exception_list_common.gen';
-
-export type EndpointList = z.infer;
-export const EndpointList = z.union([ExceptionList, z.object({}).strict()]);
-
-export type EndpointListItem = z.infer;
-export const EndpointListItem = ExceptionListItem;
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/api/read_endpoint_list_item/read_endpoint_list_item.schema.yaml b/packages/kbn-securitysolution-endpoint-exceptions-common/api/read_endpoint_list_item/read_endpoint_list_item.schema.yaml
deleted file mode 100644
index 8a4e0b291c76..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/api/read_endpoint_list_item/read_endpoint_list_item.schema.yaml
+++ /dev/null
@@ -1,66 +0,0 @@
-openapi: 3.0.0
-info:
- title: Read endpoint list item API endpoint
- version: '2023-10-31'
-paths:
- /api/endpoint_list/items:
- get:
- x-labels: [serverless, ess]
- x-codegen-enabled: true
- operationId: ReadEndpointListItem
- summary: Get an endpoint exception list item
- description: Get the details of an endpoint exception list item using the `id` or `item_id` field.
- parameters:
- - name: id
- in: query
- required: false
- description: Either `id` or `item_id` must be specified
- schema:
- $ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemId'
- - name: item_id
- in: query
- required: false
- description: Either `id` or `item_id` must be specified
- schema:
- $ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemHumanId'
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- type: array
- items:
- $ref: '../model/endpoint_list_common.schema.yaml#/components/schemas/EndpointListItem'
- 400:
- description: Invalid input data
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Insufficient privileges
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 404:
- description: Endpoint list item not found
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/package.json b/packages/kbn-securitysolution-endpoint-exceptions-common/package.json
deleted file mode 100644
index 78470be1d4e4..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/package.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "description": "OpenAPI Endpoint Exceptions Common",
- "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
- "name": "@kbn/securitysolution-endpoint-exceptions-common",
- "private": true,
- "version": "1.0.0",
- "scripts": {
- "openapi:generate": "node scripts/openapi_generate",
- "openapi:bundle": "node scripts/openapi_bundle"
- }
-}
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/scripts/openapi_bundle.js b/packages/kbn-securitysolution-endpoint-exceptions-common/scripts/openapi_bundle.js
deleted file mode 100644
index e5a02965593c..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/scripts/openapi_bundle.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-require('../../../src/setup_node_env');
-const { join, resolve } = require('path');
-const { bundle } = require('@kbn/openapi-bundler');
-
-const ROOT = resolve(__dirname, '..');
-
-(async () => {
- await bundle({
- sourceGlob: join(ROOT, 'api/**/*.schema.yaml'),
- outputFilePath: join(
- ROOT,
- 'docs/openapi/serverless/security_solution_endpoint_exceptions_api_{version}.bundled.schema.yaml'
- ),
- options: {
- includeLabels: ['serverless'],
- prototypeDocument: {
- info: {
- title: 'Security Endpoint Exceptions API (Elastic Cloud Serverless)',
- description: 'Endpoint Exceptions API allow you to manage Endpoint lists.',
- },
- tags: [
- {
- name: 'Security Endpoint Exceptions API',
- 'x-displayName': 'Security endpoint exceptions',
- description:
- "Endpoint Exceptions API allows you to manage detection rule endpoint exceptions to prevent a rule from generating an alert from incoming events even when the rule's other criteria are met.",
- },
- ],
- },
- },
- });
-
- await bundle({
- sourceGlob: join(ROOT, 'api/**/*.schema.yaml'),
- outputFilePath: join(
- ROOT,
- 'docs/openapi/ess/security_solution_endpoint_exceptions_api_{version}.bundled.schema.yaml'
- ),
- options: {
- includeLabels: ['ess'],
- prototypeDocument: {
- info: {
- title: 'Security Endpoint Exceptions API (Elastic Cloud and self-hosted)',
- description: 'Endpoint Exceptions API allow you to manage Endpoint lists.',
- },
- tags: [
- {
- name: 'Security Endpoint Exceptions API',
- 'x-displayName': 'Security endpoint exceptions',
- description:
- "Endpoint Exceptions API allows you to manage detection rule endpoint exceptions to prevent a rule from generating an alert from incoming events even when the rule's other criteria are met.",
- },
- ],
- },
- },
- });
-})();
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/scripts/openapi_generate.js b/packages/kbn-securitysolution-endpoint-exceptions-common/scripts/openapi_generate.js
deleted file mode 100644
index bca85786a518..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/scripts/openapi_generate.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-require('../../../src/setup_node_env');
-const { join, resolve } = require('path');
-const { generate } = require('@kbn/openapi-generator');
-const { REPO_ROOT } = require('@kbn/repo-info');
-
-const ROOT = resolve(__dirname, '..');
-
-(async () => {
- await generate({
- title: 'OpenAPI Endpoint Exceptions API Schemas',
- rootDir: ROOT,
- sourceGlob: './api/**/*.schema.yaml',
- templateName: 'zod_operation_schema',
- });
-
- await generate({
- title: 'Endpoint Exceptions API client for tests',
- rootDir: ROOT,
- sourceGlob: './api/**/*.schema.yaml',
- templateName: 'api_client_supertest',
- skipLinting: true,
- bundle: {
- outFile: join(
- REPO_ROOT,
- 'x-pack/test/api_integration/services/security_solution_endpoint_exceptions_api.gen.ts'
- ),
- },
- });
-})();
diff --git a/packages/kbn-securitysolution-endpoint-exceptions-common/tsconfig.json b/packages/kbn-securitysolution-endpoint-exceptions-common/tsconfig.json
deleted file mode 100644
index 7e3c3fd7396d..000000000000
--- a/packages/kbn-securitysolution-endpoint-exceptions-common/tsconfig.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "compilerOptions": {
- "outDir": "target/types",
- "types": ["jest", "node"]
- },
- "exclude": ["target/**/*"],
- "extends": "../../tsconfig.base.json",
- "include": ["**/*.ts"],
- "kbn_references": [
- "@kbn/securitysolution-exceptions-common",
- "@kbn/openapi-common",
- "@kbn/zod",
- ]
-}
diff --git a/packages/kbn-securitysolution-es-utils/jest.config.js b/packages/kbn-securitysolution-es-utils/jest.config.js
deleted file mode 100644
index 5d52b2d390b5..000000000000
--- a/packages/kbn-securitysolution-es-utils/jest.config.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-module.exports = {
- preset: '@kbn/test',
- rootDir: '../..',
- roots: ['/packages/kbn-securitysolution-es-utils'],
-};
diff --git a/packages/kbn-securitysolution-es-utils/tsconfig.json b/packages/kbn-securitysolution-es-utils/tsconfig.json
deleted file mode 100644
index e584d504cc9c..000000000000
--- a/packages/kbn-securitysolution-es-utils/tsconfig.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "extends": "../../tsconfig.base.json",
- "compilerOptions": {
- "outDir": "target/types",
- "types": [
- "jest",
- "node"
- ]
- },
- "include": [
- "**/*.ts"
- ],
- "exclude": [
- "target/**/*",
- ],
- "kbn_references": [
- "@kbn/zod-helpers",
- "@kbn/zod",
- ]
-}
diff --git a/packages/kbn-securitysolution-exception-list-components/index.ts b/packages/kbn-securitysolution-exception-list-components/index.ts
deleted file mode 100644
index 0e11a4694384..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/index.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export * from './src/search_bar';
-export * from './src/empty_viewer_state';
-export * from './src/pagination/pagination';
-// export * from './src/exceptions_utility/exceptions_utility';
-export * from './src/exception_items';
-export * from './src/exception_item_card';
-export * from './src/value_with_space_warning';
-export * from './src/types';
-export * from './src/list_header';
-export * from './src/header_menu';
-export * from './src/generate_linked_rules_menu_item';
-export * from './src/wildcard_with_wrong_operator_callout';
-export * from './src/partial_code_signature_callout';
diff --git a/packages/kbn-securitysolution-exception-list-components/jest.config.js b/packages/kbn-securitysolution-exception-list-components/jest.config.js
deleted file mode 100644
index e9d4ad8ad848..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/jest.config.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-module.exports = {
- preset: '@kbn/test',
- rootDir: '../..',
- roots: ['/packages/kbn-securitysolution-exception-list-components'],
- coverageReporters: ['text', 'html'],
- collectCoverageFrom: [
- '/packages/kbn-securitysolution-exception-list-components/**/*.{ts,tsx}',
- '!/packages/kbn-securitysolution-exception-list-components/**/*.test',
- '!/packages/kbn-securitysolution-exception-list-components/**/types/*',
- '!/packages/kbn-securitysolution-exception-list-components/**/*.type',
- '!/packages/kbn-securitysolution-exception-list-components/**/*.styles',
- '!/packages/kbn-securitysolution-exception-list-components/**/mocks/*',
- '!/packages/kbn-securitysolution-exception-list-components/**/*.config',
- '!/packages/kbn-securitysolution-exception-list-components/**/translations',
- '!/packages/kbn-securitysolution-exception-list-components/**/types/*',
- ],
- setupFilesAfterEnv: [
- '/packages/kbn-securitysolution-exception-list-components/setup_test.ts',
- ],
-};
diff --git a/packages/kbn-securitysolution-exception-list-components/package.json b/packages/kbn-securitysolution-exception-list-components/package.json
deleted file mode 100644
index 0b99a01c071e..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/package.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "name": "@kbn/securitysolution-exception-list-components",
- "private": true,
- "version": "1.0.0",
- "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
- "sideEffects": false
-}
\ No newline at end of file
diff --git a/packages/kbn-securitysolution-exception-list-components/setup_test.ts b/packages/kbn-securitysolution-exception-list-components/setup_test.ts
deleted file mode 100644
index 5ebc6d3dac1c..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/setup_test.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-// eslint-disable-next-line import/no-extraneous-dependencies
-import '@testing-library/jest-dom';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/custom.d.ts b/packages/kbn-securitysolution-exception-list-components/src/custom.d.ts
deleted file mode 100644
index aa99593b9e87..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/custom.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-declare module '*.svg' {
- const content: string;
- // eslint-disable-next-line import/no-default-export
- export default content;
-}
diff --git a/packages/kbn-securitysolution-exception-list-components/src/empty_viewer_state/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/empty_viewer_state/index.tsx
deleted file mode 100644
index e9996e814c34..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/empty_viewer_state/index.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { useMemo } from 'react';
-import type { FC } from 'react';
-import { css } from '@emotion/react';
-import {
- EuiSkeletonText,
- EuiImage,
- EuiEmptyPrompt,
- EuiButton,
- useEuiTheme,
- EuiPanel,
-} from '@elastic/eui';
-import type { ExpressionColor } from '@elastic/eui/src/components/expression/expression';
-import type { EuiFacetGroupLayout } from '@elastic/eui/src/components/facet/facet_group';
-import { euiThemeVars } from '@kbn/ui-theme';
-import { ListTypeText, ViewerStatus } from '../types';
-import * as i18n from '../translations';
-import illustration from '../assets/images/illustration_product_no_results_magnifying_glass.svg';
-
-interface EmptyViewerStateProps {
- title?: string;
- body?: string;
- buttonText?: string;
- listType?: ListTypeText;
- isReadOnly: boolean;
- viewerStatus: ViewerStatus;
- onEmptyButtonStateClick?: () => void | null;
-}
-
-const panelCss = css`
- margin: ${euiThemeVars.euiSizeL} 0;
- padding: ${euiThemeVars.euiSizeL} 0;
-`;
-const EmptyViewerStateComponent: FC = ({
- title,
- body,
- buttonText,
- listType,
- isReadOnly,
- viewerStatus,
- onEmptyButtonStateClick,
-}) => {
- const { euiTheme } = useEuiTheme();
-
- const euiEmptyPromptProps = useMemo(() => {
- switch (viewerStatus) {
- case ViewerStatus.ERROR: {
- return {
- color: 'danger' as ExpressionColor,
- iconType: 'error',
- title: (
- {title || i18n.EMPTY_VIEWER_STATE_ERROR_TITLE}
- ),
- body: {body || i18n.EMPTY_VIEWER_STATE_ERROR_BODY}
,
- 'data-test-subj': 'errorViewerState',
- };
- }
- case ViewerStatus.EMPTY:
- return {
- color: 'subdued' as ExpressionColor,
- iconType: 'plusInCircle',
- iconColor: euiTheme.colors.darkestShade,
- title: (
- {title || i18n.EMPTY_VIEWER_STATE_EMPTY_TITLE}
- ),
- body: {body || i18n.EMPTY_VIEWER_STATE_EMPTY_BODY}
,
- 'data-test-subj': 'emptyViewerState',
- actions: [
-
- {buttonText || i18n.EMPTY_VIEWER_STATE_EMPTY_VIEWER_BUTTON(listType || 'rule')}
- ,
- ],
- };
- case ViewerStatus.EMPTY_SEARCH:
- return {
- color: 'plain' as ExpressionColor,
- layout: 'horizontal' as EuiFacetGroupLayout,
- hasBorder: true,
- hasShadow: false,
- icon: ,
- title: (
-
- {title || i18n.EMPTY_VIEWER_STATE_EMPTY_SEARCH_TITLE}
-
- ),
- body: (
-
- {body || i18n.EMPTY_VIEWER_STATE_EMPTY_SEARCH_BODY}
-
- ),
- 'data-test-subj': 'emptySearchViewerState',
- };
- }
- }, [
- viewerStatus,
- euiTheme.colors.darkestShade,
- title,
- body,
- onEmptyButtonStateClick,
- isReadOnly,
- buttonText,
- listType,
- ]);
-
- return (
-
-
-
-
-
- );
-};
-
-export const EmptyViewerState = React.memo(EmptyViewerStateComponent);
-
-EmptyViewerState.displayName = 'EmptyViewerState';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/index.tsx
deleted file mode 100644
index d2e5ac0577af..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/index.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { memo } from 'react';
-import type { EuiCommentProps } from '@elastic/eui';
-import { EuiAccordion, EuiCommentList, EuiFlexItem, EuiPanel, EuiText } from '@elastic/eui';
-import { css } from '@emotion/react';
-import { euiThemeVars } from '@kbn/ui-theme';
-import * as i18n from '../translations';
-
-const accordionCss = css`
- color: ${euiThemeVars.euiColorPrimary};
-`;
-
-export interface ExceptionItemCardCommentsProps {
- comments: EuiCommentProps[];
- dataTestSubj?: string;
-}
-
-export const ExceptionItemCardComments = memo(
- ({ comments, dataTestSubj }) => {
- if (!comments.length) return null;
- return (
-
-
-
- );
- }
-);
-
-ExceptionItemCardComments.displayName = 'ExceptionItemCardComments';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.styles.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.styles.tsx
deleted file mode 100644
index 8a089df54f2f..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.styles.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { cx } from '@emotion/css';
-import { css } from '@emotion/react';
-import { euiThemeVars } from '@kbn/ui-theme';
-
-// TODO check font Roboto Mono
-export const nestedGroupSpaceCss = css`
- margin-left: ${euiThemeVars.euiSizeXL};
- margin-bottom: ${euiThemeVars.euiSizeXS};
- padding-top: ${euiThemeVars.euiSizeXS};
-`;
-
-export const borderCss = cx(
- 'eui-xScroll',
- `
- border: 1px;
- border-color: #d3dae6;
- border-style: solid;
-`
-);
-
-export const valueContainerCss = css`
- display: flex;
- align-items: center;
- margin-left: ${euiThemeVars.euiSizeS};
-`;
-export const expressionContainerCss = css`
- display: flex;
- align-items: center;
-`;
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/index.tsx
deleted file mode 100644
index b765439116ce..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/index.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { ElementType, FC, memo } from 'react';
-import { EuiExpression, EuiToken, EuiFlexGroup } from '@elastic/eui';
-import { ListOperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types';
-import {
- nestedGroupSpaceCss,
- valueContainerCss,
- expressionContainerCss,
-} from '../conditions.styles';
-import type { Entry } from '../types';
-import * as i18n from '../../translations';
-import { getValue, getValueExpression } from './entry_content.helper';
-
-interface EntryContentProps {
- entry: Entry;
- index: number;
- isNestedEntry?: boolean;
- dataTestSubj?: string;
- showValueListModal: ElementType;
-}
-
-export const EntryContent: FC = memo(
- ({ entry, index, isNestedEntry = false, dataTestSubj, showValueListModal }) => {
- const { field, type } = entry;
- const value = getValue(entry);
- const operator = 'operator' in entry ? entry.operator : '';
-
- const entryKey = `${field}${type}${value}${index}`;
- return (
-
-
- {isNestedEntry ? (
-
-
-
-
-
- {getValueExpression(
- type as ListOperatorTypeEnum,
- operator,
- value,
- showValueListModal
- )}
-
-
- ) : (
- <>
-
-
- {getValueExpression(
- type as ListOperatorTypeEnum,
- operator,
- value,
- showValueListModal
- )}
- >
- )}
-
-
- );
- }
-);
-EntryContent.displayName = 'EntryContent';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/index.tsx
deleted file mode 100644
index f472402adddc..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/index.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { memo } from 'react';
-import { EuiPanel } from '@elastic/eui';
-
-import { borderCss } from './conditions.styles';
-import { EntryContent } from './entry_content';
-import { OsCondition } from './os_conditions';
-import type { CriteriaConditionsProps, Entry } from './types';
-
-export const ExceptionItemCardConditions = memo(
- ({ os, entries, dataTestSubj, showValueListModal }) => {
- return (
-
- {os?.length ? : null}
- {entries.map((entry: Entry, index: number) => {
- const nestedEntries = 'entries' in entry ? entry.entries : [];
- return (
-
-
- {nestedEntries?.length
- ? nestedEntries.map((nestedEntry: Entry, nestedIndex: number) => (
-
- ))
- : null}
-
- );
- })}
-
- );
- }
-);
-ExceptionItemCardConditions.displayName = 'ExceptionItemCardConditions';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/index.tsx
deleted file mode 100644
index 0d8285924c31..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/index.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { memo, useMemo } from 'react';
-import { EuiExpression } from '@elastic/eui';
-
-import { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
-import { OS_LABELS } from '../conditions.config';
-import * as i18n from '../../translations';
-
-export interface OsConditionsProps {
- dataTestSubj?: string;
- os: ExceptionListItemSchema['os_types'];
-}
-
-export const OsCondition = memo(({ os, dataTestSubj }) => {
- const osLabel = useMemo(() => {
- return os.map((osValue) => OS_LABELS[osValue] ?? osValue).join(', ');
- }, [os]);
- return osLabel ? (
-
-
-
-
-
-
- ) : null;
-});
-OsCondition.displayName = 'OsCondition';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/types.ts b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/types.ts
deleted file mode 100644
index 0400ca6548d9..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/types.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import type {
- EntryExists,
- EntryList,
- EntryMatch,
- EntryMatchAny,
- EntryMatchWildcard,
- EntryNested,
- ExceptionListItemSchema,
-} from '@kbn/securitysolution-io-ts-list-types';
-import { ElementType } from 'react';
-
-export type Entry =
- | EntryExists
- | EntryList
- | EntryMatch
- | EntryMatchAny
- | EntryMatchWildcard
- | EntryNested;
-
-export type Entries = ExceptionListItemSchema['entries'];
-export interface CriteriaConditionsProps {
- entries: Entries;
- dataTestSubj: string;
- os?: ExceptionListItemSchema['os_types'];
- showValueListModal: ElementType;
-}
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/index.tsx
deleted file mode 100644
index 72b02cc79a79..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/index.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { memo } from 'react';
-import { EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui';
-import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
-import { HeaderMenu } from '../../header_menu';
-
-export interface ExceptionItemCardHeaderProps {
- item: ExceptionListItemSchema;
- actions: Array<{ key: string; icon: string; label: string | boolean; onClick: () => void }>;
- disableActions?: boolean;
- dataTestSubj: string;
-}
-
-export const ExceptionItemCardHeader = memo(
- ({ item, actions, disableActions = false, dataTestSubj }) => {
- return (
-
-
-
- {item.name}
-
-
-
-
-
-
- );
- }
-);
-
-ExceptionItemCardHeader.displayName = 'ExceptionItemCardHeader';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.ts b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.ts
deleted file mode 100644
index 26af37709233..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export * from './conditions';
-export * from './header';
-export * from './meta';
-export * from './comments';
-export * from './exception_item_card';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/details_info.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/details_info.test.tsx
deleted file mode 100644
index cbb48e172322..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/details_info.test.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { render } from '@testing-library/react';
-import { MetaInfoDetails } from '.';
-
-describe('MetaInfoDetails', () => {
- it('should render lastUpdate as string', () => {
- const wrapper = render(
-
- );
- expect(wrapper.container).toMatchSnapshot();
- expect(wrapper.getByTestId('MetaInfoDetailslastUpdate')).toHaveTextContent('last update');
- });
- it('should render lastUpdate as JSX Element', () => {
- const wrapper = render(
- Last update value
}
- lastUpdateValue="value"
- />
- );
- expect(wrapper.container).toMatchSnapshot();
- expect(wrapper.getByTestId('MetaInfoDetailslastUpdate')).toHaveTextContent('Last update value');
- });
-});
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/index.tsx
deleted file mode 100644
index cc9eaa813aa9..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/index.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { memo } from 'react';
-import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
-import { css } from '@emotion/react';
-import { euiThemeVars } from '@kbn/ui-theme';
-import * as i18n from '../../translations';
-
-interface MetaInfoDetailsProps {
- label: string;
- lastUpdate: JSX.Element | string;
- lastUpdateValue?: string;
- dataTestSubj?: string;
-}
-
-const euiBadgeFontFamily = css`
- font-family: ${euiThemeVars.euiFontFamily};
-`;
-export const MetaInfoDetails = memo(
- ({ label, lastUpdate, lastUpdateValue, dataTestSubj }) => {
- return (
-
-
-
- {label}
-
-
-
-
- {lastUpdate}
-
-
- {lastUpdateValue != null && (
- <>
-
-
- {i18n.EXCEPTION_ITEM_CARD_META_BY}
-
-
-
-
-
-
- {lastUpdateValue}
-
-
-
-
- >
- )}
-
- );
- }
-);
-
-MetaInfoDetails.displayName = 'MetaInfoDetails';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/index.tsx
deleted file mode 100644
index d9c0f84b02d0..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/index.tsx
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { memo, useMemo } from 'react';
-import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
-import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
-
-import { css } from '@emotion/react';
-import { euiThemeVars } from '@kbn/ui-theme';
-import * as i18n from '../translations';
-import type { Rule } from '../../types';
-import { MetaInfoDetails } from './details_info';
-import { HeaderMenu } from '../../header_menu';
-import { generateLinkedRulesMenuItems } from '../../generate_linked_rules_menu_item';
-
-const itemCss = css`
- border-right: 1px solid #d3dae6;
- padding: ${euiThemeVars.euiSizeS} ${euiThemeVars.euiSizeM} ${euiThemeVars.euiSizeS} 0;
-`;
-
-export interface ExceptionItemCardMetaInfoProps {
- item: ExceptionListItemSchema;
- rules: Rule[];
- dataTestSubj: string;
- formattedDateComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common
- securityLinkAnchorComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common
-}
-
-export const ExceptionItemCardMetaInfo = memo(
- ({ item, rules, dataTestSubj, securityLinkAnchorComponent, formattedDateComponent }) => {
- const FormattedDateComponent = formattedDateComponent;
-
- const referencedLinks = useMemo(
- () =>
- generateLinkedRulesMenuItems({
- dataTestSubj,
- linkedRules: rules,
- securityLinkAnchorComponent,
- }),
- [dataTestSubj, rules, securityLinkAnchorComponent]
- );
-
- const isExpired = useMemo(
- () => (item.expire_time ? new Date(item.expire_time) <= new Date() : false),
- [item]
- );
-
- return (
-
- {FormattedDateComponent !== null && (
- <>
-
-
- }
- lastUpdateValue={item.created_by}
- dataTestSubj={`${dataTestSubj || ''}CreatedBy`}
- />
-
-
-
-
- }
- lastUpdateValue={item.updated_by}
- dataTestSubj={`${dataTestSubj || ''}UpdatedBy`}
- />
-
- {item.expire_time != null && (
- <>
-
-
- }
- dataTestSubj={`${dataTestSubj || ''}ExpireTime`}
- />
-
- >
- )}
- >
- )}
-
-
-
-
- );
- }
-);
-ExceptionItemCardMetaInfo.displayName = 'ExceptionItemCardMetaInfo';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/translations.ts b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/translations.ts
deleted file mode 100644
index 78a0dac775cf..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/translations.ts
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { i18n } from '@kbn/i18n';
-
-export const exceptionItemCardEditButton = (listType: string) =>
- i18n.translate('exceptionList-components.exceptions.exceptionItem.card.editItemButton', {
- values: { listType },
- defaultMessage: 'Edit {listType} exception',
- });
-
-export const exceptionItemCardDeleteButton = (listType: string) =>
- i18n.translate('exceptionList-components.exceptions.exceptionItem.card.deleteItemButton', {
- values: { listType },
- defaultMessage: 'Delete {listType} exception',
- });
-
-export const EXCEPTION_ITEM_CARD_CREATED_LABEL = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.createdLabel',
- {
- defaultMessage: 'Created',
- }
-);
-
-export const EXCEPTION_ITEM_CARD_UPDATED_LABEL = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.updatedLabel',
- {
- defaultMessage: 'Updated',
- }
-);
-
-export const EXCEPTION_ITEM_CARD_EXPIRES_LABEL = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.expiresLabel',
- {
- defaultMessage: 'Expires at',
- }
-);
-
-export const EXCEPTION_ITEM_CARD_EXPIRED_LABEL = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.expiredLabel',
- {
- defaultMessage: 'Expired at',
- }
-);
-
-export const EXCEPTION_ITEM_CARD_META_BY = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.metaDetailsBy',
- {
- defaultMessage: 'by',
- }
-);
-
-export const exceptionItemCardCommentsAccordion = (comments: number) =>
- i18n.translate('exceptionList-components.exceptions.exceptionItem.card.showCommentsLabel', {
- values: { comments },
- defaultMessage: 'Show {comments, plural, =1 {comment} other {comments}} ({comments})',
- });
-
-export const CONDITION_OPERATOR_TYPE_MATCH = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.matchOperator',
- {
- defaultMessage: 'IS',
- }
-);
-
-export const CONDITION_OPERATOR_TYPE_NOT_MATCH = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.matchOperator.not',
- {
- defaultMessage: 'IS NOT',
- }
-);
-
-export const CONDITION_OPERATOR_TYPE_WILDCARD_MATCHES = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.wildcardMatchesOperator',
- {
- defaultMessage: 'MATCHES',
- }
-);
-
-export const CONDITION_OPERATOR_TYPE_WILDCARD_DOES_NOT_MATCH = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.wildcardDoesNotMatchOperator',
- {
- defaultMessage: 'DOES NOT MATCH',
- }
-);
-
-export const CONDITION_OPERATOR_TYPE_NESTED = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.nestedOperator',
- {
- defaultMessage: 'has',
- }
-);
-
-export const CONDITION_OPERATOR_TYPE_MATCH_ANY = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.matchAnyOperator',
- {
- defaultMessage: 'is one of',
- }
-);
-
-export const CONDITION_OPERATOR_TYPE_NOT_MATCH_ANY = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.matchAnyOperator.not',
- {
- defaultMessage: 'is not one of',
- }
-);
-
-export const CONDITION_OPERATOR_TYPE_EXISTS = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.existsOperator',
- {
- defaultMessage: 'exists',
- }
-);
-
-export const CONDITION_OPERATOR_TYPE_DOES_NOT_EXIST = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.existsOperator.not',
- {
- defaultMessage: 'does not exist',
- }
-);
-
-export const CONDITION_OPERATOR_TYPE_LIST = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.listOperator',
- {
- defaultMessage: 'included in',
- }
-);
-
-export const CONDITION_OPERATOR_TYPE_NOT_IN_LIST = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.listOperator.not',
- {
- defaultMessage: 'is not included in',
- }
-);
-
-export const CONDITION_AND = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.and',
- {
- defaultMessage: 'AND',
- }
-);
-
-export const CONDITION_OS = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.os',
- {
- defaultMessage: 'OS',
- }
-);
-
-export const OS_WINDOWS = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.windows',
- {
- defaultMessage: 'Windows',
- }
-);
-
-export const OS_LINUX = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.linux',
- {
- defaultMessage: 'Linux',
- }
-);
-
-export const OS_MAC = i18n.translate(
- 'exceptionList-components.exceptions.exceptionItem.card.conditions.macos',
- {
- defaultMessage: 'Mac',
- }
-);
-
-export const AFFECTED_RULES = (numRules: number) =>
- i18n.translate('exceptionList-components.exceptions.card.exceptionItem.affectedRules', {
- values: { numRules },
- defaultMessage: 'Affects {numRules} {numRules, plural, =1 {rule} other {rules}}',
- });
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_items/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_items/index.tsx
deleted file mode 100644
index edad9aecdb0d..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_items/index.tsx
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { ElementType } from 'react';
-import { css } from '@emotion/react';
-import type { FC } from 'react';
-import { EuiCommentProps, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
-
-import type {
- CommentsArray,
- ExceptionListItemSchema,
- ExceptionListTypeEnum,
-} from '@kbn/securitysolution-io-ts-list-types';
-
-import { euiThemeVars } from '@kbn/ui-theme';
-import { EmptyViewerState, ExceptionItemCard, Pagination, PaginationProps } from '../..';
-
-import type {
- RuleReferences,
- ExceptionListItemIdentifiers,
- ViewerStatus,
- GetExceptionItemProps,
-} from '../types';
-
-const exceptionItemCss = css`
- margin: ${euiThemeVars.euiSize} 0;
- &div:first-child {
- margin: ${euiThemeVars.euiSizeXS} 0 ${euiThemeVars.euiSize};
- }
-`;
-
-interface ExceptionItemsProps {
- lastUpdated: string | number | null;
- viewerStatus: ViewerStatus;
- isReadOnly: boolean;
- emptyViewerTitle?: string;
- emptyViewerBody?: string;
- emptyViewerButtonText?: string;
- exceptions: ExceptionListItemSchema[];
- listType: ExceptionListTypeEnum;
- ruleReferences: RuleReferences;
- pagination: PaginationProps['pagination'];
- editActionLabel?: string;
- deleteActionLabel?: string;
- dataTestSubj?: string;
- securityLinkAnchorComponent: ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common
- formattedDateComponent: ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common
- exceptionsUtilityComponent: ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common
- getFormattedComments: (comments: CommentsArray) => EuiCommentProps[]; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common
- onCreateExceptionListItem?: () => void;
- onDeleteException: (arg: ExceptionListItemIdentifiers) => void;
- onEditExceptionItem: (item: ExceptionListItemSchema) => void;
- onPaginationChange: (arg: GetExceptionItemProps) => void;
- showValueListModal: ElementType;
-}
-
-const ExceptionItemsComponent: FC = ({
- lastUpdated,
- viewerStatus,
- isReadOnly,
- exceptions,
- listType,
- ruleReferences,
- emptyViewerTitle,
- emptyViewerBody,
- emptyViewerButtonText,
- pagination,
- dataTestSubj,
- editActionLabel,
- deleteActionLabel,
- securityLinkAnchorComponent,
- exceptionsUtilityComponent,
- formattedDateComponent,
- getFormattedComments,
- onPaginationChange,
- onDeleteException,
- onEditExceptionItem,
- onCreateExceptionListItem,
- showValueListModal,
-}) => {
- const ExceptionsUtility = exceptionsUtilityComponent;
- if (!exceptions.length || viewerStatus)
- return (
-
- );
- const ShowValueListModal = showValueListModal;
- return (
- <>
-
-
-
-
- {exceptions.map((exception) => (
-
-
-
- ))}
-
-
-
-
- >
- );
-};
-
-ExceptionItemsComponent.displayName = 'ExceptionItemsComponent';
-
-export const ExceptionItems = React.memo(ExceptionItemsComponent);
-
-ExceptionItems.displayName = 'ExceptionsItems';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/index.tsx
deleted file mode 100644
index d68ac8f114a0..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/index.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { ElementType, ReactElement } from 'react';
-import { EuiContextMenuItem, EuiFlexGroup, EuiFlexItem, EuiIcon, IconType } from '@elastic/eui';
-import { Rule } from '../types';
-import { itemContentCss, containerCss } from './menu_link.styles';
-
-interface MenuItemLinkedRulesProps {
- leftIcon?: IconType;
- dataTestSubj?: string;
- linkedRules: Rule[];
- securityLinkAnchorComponent: ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common
-}
-
-export const generateLinkedRulesMenuItems = ({
- dataTestSubj,
- linkedRules,
- securityLinkAnchorComponent,
- leftIcon = '',
-}: MenuItemLinkedRulesProps): ReactElement[] | null => {
- if (!linkedRules.length || securityLinkAnchorComponent === null) return null;
-
- const SecurityLinkAnchor = securityLinkAnchorComponent;
- return linkedRules.map((rule) => {
- return (
- 1 ? containerCss : ''}
- data-test-subj={`${dataTestSubj || ''}ActionItem${rule.id}`}
- key={rule.id}
- >
-
- {leftIcon ? (
-
-
-
- ) : null}
-
-
-
-
-
- );
- });
-};
diff --git a/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/menu_link.styles.ts b/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/menu_link.styles.ts
deleted file mode 100644
index 42f470ce39dd..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/menu_link.styles.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { css } from '@emotion/react';
-import { euiThemeVars } from '@kbn/ui-theme';
-
-export const containerCss = css`
- border-bottom: 1px solid ${euiThemeVars.euiColorLightShade};
-`;
-
-export const itemContentCss = css`
- color: ${euiThemeVars.euiColorPrimary};
- flex-basis: content;
-`;
diff --git a/packages/kbn-securitysolution-exception-list-components/src/header_menu/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/header_menu/index.tsx
deleted file mode 100644
index 2f39959c33fe..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/header_menu/index.tsx
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { FC, ReactElement, useMemo, useState } from 'react';
-import {
- EuiButtonEmpty,
- EuiButtonEmptyProps,
- EuiButtonIcon,
- EuiContextMenuItem,
- EuiContextMenuPanel,
- EuiFlexGroup,
- EuiPopover,
- PanelPaddingSize,
- PopoverAnchorPosition,
-} from '@elastic/eui';
-
-import { css } from '@emotion/react';
-
-export interface Action {
- key: string;
- icon: string;
- label: string | boolean;
- disabled?: boolean;
- onClick: (e: React.MouseEvent) => void;
-}
-
-interface HeaderMenuComponentProps {
- disableActions: boolean;
- actions: Action[] | ReactElement[] | null;
- text?: string;
- iconType?: EuiButtonEmptyProps['iconType'];
- iconSide?: EuiButtonEmptyProps['iconSide'];
- dataTestSubj?: string;
- emptyButton?: boolean;
- useCustomActions?: boolean;
- anchorPosition?: PopoverAnchorPosition;
- panelPaddingSize?: PanelPaddingSize;
-}
-
-const popoverHeightStyle = css`
- max-height: 300px;
- height: 100%;
- overflow-x: hidden;
- overflow-y: auto;
-`;
-const HeaderMenuComponent: FC = ({
- text,
- dataTestSubj,
- actions,
- disableActions,
- emptyButton,
- useCustomActions,
- iconType,
- iconSide = 'left',
- anchorPosition = 'downCenter',
- panelPaddingSize = 's',
-}) => {
- const [isPopoverOpen, setIsPopoverOpen] = useState(false);
-
- const onAffectedRulesClick = () => setIsPopoverOpen((isOpen) => !isOpen);
- const onClosePopover = () => setIsPopoverOpen(false);
-
- const itemActions = useMemo(() => {
- if (useCustomActions || actions === null) return actions;
- return (actions as Action[]).map((action) => (
- {
- onClosePopover();
- if (typeof action.onClick === 'function') action.onClick(e);
- }}
- >
- {action.label}
-
- ));
- }, [actions, dataTestSubj, useCustomActions]);
-
- return (
-
-
- {text}
-
- ) : (
-
- {text}
-
- )
- }
- onClick={(e) => e.stopPropagation()}
- panelPaddingSize={panelPaddingSize}
- isOpen={isPopoverOpen}
- closePopover={onClosePopover}
- anchorPosition={anchorPosition}
- data-test-subj={`${dataTestSubj || ''}Items`}
- >
- {!itemActions ? null : (
-
- )}
-
-
- );
-};
-HeaderMenuComponent.displayName = 'HeaderMenuComponent';
-
-export const HeaderMenu = React.memo(HeaderMenuComponent);
-
-HeaderMenu.displayName = 'HeaderMenu';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/index.tsx
deleted file mode 100644
index 82aec99bebb3..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/index.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { FC } from 'react';
-import {
- EuiButton,
- EuiButtonEmpty,
- EuiFieldText,
- EuiForm,
- EuiFormRow,
- EuiModal,
- EuiModalBody,
- EuiModalFooter,
- EuiModalHeader,
- EuiModalHeaderTitle,
- EuiTextArea,
- EuiProgress,
-} from '@elastic/eui';
-import * as i18n from '../../translations';
-import { ListDetails } from '../../types';
-import { useEditModal } from './use_edit_modal';
-
-interface EditModalProps {
- listDetails: ListDetails;
- onSave: (newListDetails: ListDetails) => void;
- onCancel: () => void;
-}
-
-const EditModalComponent: FC = ({ listDetails, onSave, onCancel }) => {
- const { error, modalFormId, newListDetails, showProgress, onBlur, onSubmit, onChange } =
- useEditModal({
- listDetails,
- onSave,
- });
- return (
-
- {showProgress && (
-
- )}
-
-
- {i18n.EXCEPTION_LIST_HEADER_EDIT_MODAL_TITLE(listDetails.name)}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {i18n.EXCEPTION_LIST_HEADER_EDIT_MODAL_CANCEL_BUTTON}
-
-
-
- {i18n.EXCEPTION_LIST_HEADER_EDIT_MODAL_SAVE_BUTTON}
-
-
-
- );
-};
-EditModalComponent.displayName = 'EditModalComponent';
-
-export const EditModal = React.memo(EditModalComponent);
-
-EditModal.displayName = 'EditModal';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/list_header/index.tsx
deleted file mode 100644
index 849dd4ef1ba8..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/list_header/index.tsx
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import type { FC } from 'react';
-import { EuiIcon, EuiPageHeader, EuiText } from '@elastic/eui';
-import * as i18n from '../translations';
-import { textCss, descriptionContainerCss, backTextCss } from './list_header.styles';
-import { MenuItems } from './menu_items';
-import { TextWithEdit } from '../text_with_edit';
-import { EditModal } from './edit_modal';
-import { ListDetails, Rule } from '../types';
-import { useExceptionListHeader } from './use_list_header';
-import { textWithEditContainerCss } from '../text_with_edit/text_with_edit.styles';
-
-interface ExceptionListHeaderComponentProps {
- name: string;
- description?: string;
- listId: string;
- isReadonly: boolean;
- linkedRules: Rule[];
- dataTestSubj?: string;
- backOptions: BackOptions;
- canUserEditList?: boolean;
- securityLinkAnchorComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common
- onEditListDetails: (listDetails: ListDetails) => void;
- onDeleteList: () => void;
- onManageRules: () => void;
- onExportList: () => void;
- onDuplicateList: () => void;
-}
-
-export interface BackOptions {
- pageId: string;
- path: string;
- dataTestSubj?: string;
- onNavigate: (path: string) => void;
-}
-const ExceptionListHeaderComponent: FC = ({
- name,
- description,
- listId,
- linkedRules,
- isReadonly,
- dataTestSubj,
- securityLinkAnchorComponent,
- backOptions,
- canUserEditList = true,
- onEditListDetails,
- onDeleteList,
- onManageRules,
- onExportList,
- onDuplicateList,
-}) => {
- const { isModalVisible, listDetails, onEdit, onSave, onCancel } = useExceptionListHeader({
- name,
- description,
- onEditListDetails,
- });
- return (
-
-
- }
- responsive
- data-test-subj={`${dataTestSubj || ''}PageHeader`}
- description={
-
-
-
- {i18n.EXCEPTION_LIST_HEADER_LIST_ID}:
- {listId}
-
-
- }
- rightSideItems={[
-
,
- ]}
- breadcrumbs={[
- {
- text: (
-
-
- {i18n.EXCEPTION_LIST_HEADER_BREADCRUMB}
-
- ),
- color: 'primary',
- 'aria-current': false,
- href: backOptions.path,
- onClick: (e) => {
- e.preventDefault();
- backOptions.onNavigate(backOptions.path);
- },
- },
- ]}
- />
- {isModalVisible && (
-
- )}
-
- );
-};
-
-ExceptionListHeaderComponent.displayName = 'ExceptionListHeaderComponent';
-
-export const ExceptionListHeader = React.memo(ExceptionListHeaderComponent);
-
-ExceptionListHeader.displayName = 'ExceptionListHeader';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/list_header.styles.ts b/packages/kbn-securitysolution-exception-list-components/src/list_header/list_header.styles.ts
deleted file mode 100644
index c3cba9f9dcdb..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/list_header/list_header.styles.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { css } from '@emotion/react';
-import { euiThemeVars } from '@kbn/ui-theme';
-
-export const headerMenuCss = css`
- border-right: 1px solid #d3dae6;
- padding: ${euiThemeVars.euiSizeXS} ${euiThemeVars.euiSizeL} ${euiThemeVars.euiSizeXS} 0;
-`;
-
-export const noLinkedRulesCss = css`
- width: max-content;
-`;
-
-export const textCss = css`
- font-size: ${euiThemeVars.euiFontSize};
- color: ${euiThemeVars.euiTextSubduedColor};
- margin-left: ${euiThemeVars.euiSizeXS};
-`;
-export const descriptionContainerCss = css`
- margin-top: -${euiThemeVars.euiSizeL};
- margin-bottom: -${euiThemeVars.euiSizeL};
-`;
-
-export const backTextCss = css`
- font-size: ${euiThemeVars.euiFontSizeXS};
-`;
diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/index.tsx
deleted file mode 100644
index f0aecf21b6c7..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/index.tsx
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiTextColor } from '@elastic/eui';
-import React, { FC, useMemo } from 'react';
-import { HeaderMenu } from '../../header_menu';
-import { headerMenuCss, noLinkedRulesCss } from '../list_header.styles';
-import * as i18n from '../../translations';
-import { Rule } from '../../types';
-import { generateLinkedRulesMenuItems } from '../../generate_linked_rules_menu_item';
-interface MenuItemsProps {
- isReadonly: boolean;
- dataTestSubj?: string;
- linkedRules: Rule[];
- canUserEditList?: boolean;
- securityLinkAnchorComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common
- onDeleteList: () => void;
- onManageRules: () => void;
- onExportList: () => void;
- onDuplicateList: () => void;
-}
-
-const MenuItemsComponent: FC = ({
- dataTestSubj,
- linkedRules,
- securityLinkAnchorComponent,
- isReadonly,
- canUserEditList = true,
- onDeleteList,
- onManageRules,
- onExportList,
- onDuplicateList,
-}) => {
- const referencedLinks = useMemo(
- () =>
- generateLinkedRulesMenuItems({
- leftIcon: 'check',
- dataTestSubj,
- linkedRules,
- securityLinkAnchorComponent,
- }),
- [dataTestSubj, linkedRules, securityLinkAnchorComponent]
- );
- return (
-
-
- {linkedRules.length ? (
-
- ) : (
-
- {i18n.EXCEPTION_LIST_HEADER_LINKED_RULES(linkedRules.length)}
-
- )}
-
-
- {canUserEditList && (
-
- {
- if (typeof onManageRules === 'function') onManageRules();
- }}
- >
- {i18n.EXCEPTION_LIST_HEADER_LINK_RULES_BUTTON}
-
-
- )}
-
- {
- if (typeof onExportList === 'function') onExportList();
- },
- },
- {
- key: '2',
- icon: 'copy',
- label: i18n.EXCEPTION_LIST_HEADER_DUPLICATE_ACTION,
- onClick: () => {
- if (typeof onDuplicateList === 'function') onDuplicateList();
- },
- disabled: !canUserEditList,
- },
- {
- key: '3',
- icon: 'trash',
- label: i18n.EXCEPTION_LIST_HEADER_DELETE_ACTION,
- onClick: () => {
- if (typeof onDeleteList === 'function') onDeleteList();
- },
- disabled: !canUserEditList,
- },
- ]}
- disableActions={isReadonly}
- anchorPosition="downCenter"
- />
-
-
- );
-};
-
-MenuItemsComponent.displayName = 'MenuItemsComponent';
-
-export const MenuItems = React.memo(MenuItemsComponent);
-
-MenuItems.displayName = 'MenuItems';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/use_list_header.ts b/packages/kbn-securitysolution-exception-list-components/src/list_header/use_list_header.ts
deleted file mode 100644
index 676dd08a53be..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/list_header/use_list_header.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { useState } from 'react';
-import { ListDetails } from '../types';
-
-interface UseExceptionListHeaderProps {
- name: string;
- description?: string;
- onEditListDetails: (listDetails: ListDetails) => void;
-}
-export const useExceptionListHeader = ({
- name,
- description,
- onEditListDetails,
-}: UseExceptionListHeaderProps) => {
- const [isModalVisible, setIsModalVisible] = useState(false);
- const [listDetails, setListDetails] = useState({ name, description });
- const onEdit = () => {
- setIsModalVisible(true);
- };
- const onSave = (newListDetails: ListDetails) => {
- setListDetails(newListDetails);
- if (typeof onEditListDetails === 'function') onEditListDetails(newListDetails);
- setTimeout(() => {
- setIsModalVisible(false);
- }, 200);
- };
- const onCancel = () => {
- setIsModalVisible(false);
- };
-
- return {
- isModalVisible,
- listDetails,
- onEdit,
- onSave,
- onCancel,
- };
-};
diff --git a/packages/kbn-securitysolution-exception-list-components/src/mocks/comments.mock.tsx b/packages/kbn-securitysolution-exception-list-components/src/mocks/comments.mock.tsx
deleted file mode 100644
index 4c9b813463ca..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/mocks/comments.mock.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import type { Comment, CommentsArray } from '@kbn/securitysolution-io-ts-list-types';
-
-export const getCommentsMock = (): Comment => ({
- comment: 'some old comment',
- created_at: '2020-04-20T15:25:31.830Z',
- created_by: 'some user',
- id: 'uuid_here',
-});
-
-export const getCommentsArrayMock = (): CommentsArray => [getCommentsMock(), getCommentsMock()];
-
-export const mockGetFormattedComments = () =>
- getCommentsArrayMock().map((comment) => ({
- username: comment.created_by,
- children: {comment.comment}
,
- }));
diff --git a/packages/kbn-securitysolution-exception-list-components/src/mocks/entry.mock.ts b/packages/kbn-securitysolution-exception-list-components/src/mocks/entry.mock.ts
deleted file mode 100644
index a39fe947caa2..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/mocks/entry.mock.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { Entry } from '../exception_item_card/conditions/types';
-
-export const includedListTypeEntry: Entry = {
- field: '',
- operator: 'included',
- type: 'list',
- list: { id: 'list_id', type: 'boolean' },
-};
-
-export const includedMatchTypeEntry: Entry = {
- field: '',
- operator: 'included',
- type: 'match',
- value: 'matches value',
-};
-
-export const includedExistsTypeEntry: Entry = {
- field: '',
- operator: 'included',
- type: 'exists',
-};
diff --git a/packages/kbn-securitysolution-exception-list-components/src/mocks/exception_list_item_schema.mock.ts b/packages/kbn-securitysolution-exception-list-components/src/mocks/exception_list_item_schema.mock.ts
deleted file mode 100644
index f9c24d46228c..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/mocks/exception_list_item_schema.mock.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
-
-export const getExceptionListItemSchemaMock = (
- overrides?: Partial
-): ExceptionListItemSchema => ({
- _version: undefined,
- comments: [],
- created_at: '2020-04-20T15:25:31.830Z',
- created_by: 'some user',
- description: 'some description',
- entries: [
- {
- entries: [
- { field: 'nested.field', operator: 'included', type: 'match', value: 'some value' },
- ],
- field: 'some.parentField',
- type: 'nested',
- },
- { field: 'some.not.nested.field', operator: 'included', type: 'match', value: 'some value' },
- ],
- expire_time: undefined,
- id: '1',
- item_id: 'endpoint_list_item',
- list_id: 'endpoint_list_id',
- meta: {},
- name: 'some name',
- namespace_type: 'single',
- os_types: [],
- tags: ['user added string for a tag', 'malware'],
- tie_breaker_id: '6a76b69d-80df-4ab2-8c3e-85f466b06a0e',
- type: 'simple',
- updated_at: '2020-04-20T15:25:31.830Z',
- updated_by: 'some user',
- ...(overrides || {}),
-});
diff --git a/packages/kbn-securitysolution-exception-list-components/src/mocks/header.mock.ts b/packages/kbn-securitysolution-exception-list-components/src/mocks/header.mock.ts
deleted file mode 100644
index 06aa00b5ff72..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/mocks/header.mock.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export const handleEdit = jest.fn();
-export const handleDelete = jest.fn();
-export const actions = [
- {
- key: 'edit',
- icon: 'pencil',
- label: 'Edit detection exception',
- onClick: handleEdit,
- },
- {
- key: 'delete',
- icon: 'trash',
- label: 'Delete detection exception',
- onClick: handleDelete,
- },
-];
-export const actionsWithDisabledDelete = [
- {
- key: 'edit',
- icon: 'pencil',
- label: 'Edit detection exception',
- onClick: handleEdit,
- },
- {
- key: 'delete',
- icon: 'trash',
- disabled: true,
- label: 'Delete detection exception',
- onClick: handleDelete,
- },
-];
diff --git a/packages/kbn-securitysolution-exception-list-components/src/mocks/rule_references.mock.ts b/packages/kbn-securitysolution-exception-list-components/src/mocks/rule_references.mock.ts
deleted file mode 100644
index 3592d5f03cc4..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/mocks/rule_references.mock.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { Rule, RuleReference } from '../types';
-
-export const rules: Rule[] = [
- {
- exceptions_list: [
- {
- id: '123',
- list_id: 'i_exist',
- namespace_type: 'single',
- type: 'detection',
- },
- {
- id: '456',
- list_id: 'i_exist_2',
- namespace_type: 'single',
- type: 'detection',
- },
- ],
- id: '1a2b3c',
- name: 'Simple Rule Query',
- rule_id: 'rule-2',
- },
-];
-
-export const ruleReference: RuleReference = {
- name: 'endpoint list',
- id: 'endpoint_list',
- referenced_rules: rules,
- listId: 'endpoint_list_id',
-};
-
-export const ruleReferences = {
- endpoint_list_id: ruleReference,
-};
diff --git a/packages/kbn-securitysolution-exception-list-components/src/mocks/security_link_component.mock.tsx b/packages/kbn-securitysolution-exception-list-components/src/mocks/security_link_component.mock.tsx
deleted file mode 100644
index 1ad7d2921c5a..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/mocks/security_link_component.mock.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { ReactElement } from 'react';
-import { generateLinkedRulesMenuItems } from '../generate_linked_rules_menu_item';
-import { rules } from './rule_references.mock';
-export const securityLinkAnchorComponentMock = ({
- referenceName,
- referenceId,
-}: {
- referenceName: string;
- referenceId: string;
-}) => (
-
-);
-
-export const getSecurityLinkAction = (dataTestSubj: string) =>
- generateLinkedRulesMenuItems({
- dataTestSubj,
- linkedRules: [
- ...rules,
- {
- exceptions_list: [],
- id: '2a2b3c',
- name: 'Simple Rule Query 2',
- rule_id: 'rule-2',
- },
- ],
- securityLinkAnchorComponent: securityLinkAnchorComponentMock,
- }) as ReactElement[];
diff --git a/packages/kbn-securitysolution-exception-list-components/src/mocks/value_list_modal.mock.tsx b/packages/kbn-securitysolution-exception-list-components/src/mocks/value_list_modal.mock.tsx
deleted file mode 100644
index 930439b577ff..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/mocks/value_list_modal.mock.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-
-export const mockShowValueListModal = jest.fn();
-export const MockedShowValueListModal = (props: { children: React.ReactNode }) => {
- mockShowValueListModal(props);
- return <>{props.children}>;
-};
diff --git a/packages/kbn-securitysolution-exception-list-components/src/pagination/pagination.tsx b/packages/kbn-securitysolution-exception-list-components/src/pagination/pagination.tsx
deleted file mode 100644
index 38be3b8474ad..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/pagination/pagination.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import type { FC } from 'react';
-import { EuiTablePagination } from '@elastic/eui';
-
-import type { PaginationProps } from '../types';
-import { usePagination } from './use_pagination';
-
-const PaginationComponent: FC = ({
- dataTestSubj,
- ariaLabel,
- pagination,
- onPaginationChange,
-}) => {
- const {
- pageIndex,
- pageCount,
- pageSize,
- pageSizeOptions,
-
- handleItemsPerPageChange,
- handlePageIndexChange,
- } = usePagination({ pagination, onPaginationChange });
-
- return (
-
- );
-};
-
-PaginationComponent.displayName = 'PaginationComponent';
-
-export const Pagination = React.memo(PaginationComponent);
-
-Pagination.displayName = 'Pagination';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/partial_code_signature_callout/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/partial_code_signature_callout/index.tsx
deleted file mode 100644
index 72836fc78fb5..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/partial_code_signature_callout/index.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { FormattedMessage } from '@kbn/i18n-react';
-import { i18n } from '@kbn/i18n';
-
-import { EuiCallOut } from '@elastic/eui';
-
-export const PartialCodeSignatureCallout = () => {
- return (
-
-
-
- );
-};
diff --git a/packages/kbn-securitysolution-exception-list-components/src/search_bar/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/search_bar/index.tsx
deleted file mode 100644
index 0670a2553a69..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/search_bar/index.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { useCallback } from 'react';
-import type { FC } from 'react';
-
-import type { EuiSearchBarProps, IconType, SearchFilterConfig } from '@elastic/eui';
-import { EuiFlexGroup, EuiFlexItem, EuiButton, EuiSearchBar } from '@elastic/eui';
-import type { ExceptionListTypeEnum } from '@kbn/securitysolution-io-ts-list-types';
-import type { GetExceptionItemProps } from '../types';
-
-const ITEMS_SCHEMA = {
- strict: true,
- fields: {
- created_by: {
- type: 'string',
- },
- description: {
- type: 'string',
- },
- id: {
- type: 'string',
- },
- item_id: {
- type: 'string',
- },
- list_id: {
- type: 'string',
- },
- name: {
- type: 'string',
- },
- os_types: {
- type: 'string',
- },
- tags: {
- type: 'string',
- },
- },
-};
-interface SearchBarProps {
- addExceptionButtonText?: string;
- placeholdertext?: string;
- canAddException?: boolean; // TODO what is the default value
-
- // TODO: REFACTOR: not to send the listType and handle it in the Parent
- // Exception list type used to determine what type of item is
- // being created when "onAddExceptionClick" is invoked
- listType: ExceptionListTypeEnum;
- isSearching?: boolean;
- dataTestSubj?: string;
- filters?: SearchFilterConfig[]; // TODO about filters
- isButtonFilled?: boolean;
- buttonIconType?: IconType;
- onSearch: (arg: GetExceptionItemProps) => void;
- onAddExceptionClick: (type: ExceptionListTypeEnum) => void;
-}
-const SearchBarComponent: FC = ({
- addExceptionButtonText,
- placeholdertext,
- canAddException,
- listType,
- isSearching,
- dataTestSubj,
- filters = [],
- isButtonFilled = true,
- buttonIconType,
- onSearch,
- onAddExceptionClick,
-}) => {
- const handleOnSearch = useCallback>(
- ({ queryText }): void => {
- onSearch({ search: queryText });
- },
- [onSearch]
- );
-
- const handleAddException = useCallback(() => {
- // TODO: ASK YARA why we need to send the listType
- onAddExceptionClick(listType);
- }, [onAddExceptionClick, listType]);
-
- return (
-
-
-
-
- {!canAddException && (
-
-
- {addExceptionButtonText}
-
-
- )}
-
- );
-};
-
-SearchBarComponent.displayName = 'SearchBarComponent';
-
-export const SearchBar = React.memo(SearchBarComponent);
-
-SearchBar.displayName = 'SearchBar';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/index.tsx
deleted file mode 100644
index aa5625cfe671..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/index.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React, { FC } from 'react';
-import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
-import { Interpolation, Theme } from '@emotion/react';
-import { textWithEditContainerCss, editIconCss } from './text_with_edit.styles';
-interface TextWithEditProps {
- isReadonly: boolean;
- dataTestSubj?: string;
- text: string;
- textCss?: Interpolation;
- onEdit?: () => void;
-}
-
-const TextWithEditComponent: FC = ({
- isReadonly,
- dataTestSubj,
- text,
- onEdit,
- textCss,
-}) => {
- return (
-
-
-
- {text}
-
-
-
- {isReadonly ? null : (
- (typeof onEdit === 'function' ? onEdit() : null)}
- />
- )}
-
-
- );
-};
-TextWithEditComponent.displayName = 'TextWithEditComponent';
-
-export const TextWithEdit = React.memo(TextWithEditComponent);
-
-TextWithEdit.displayName = 'TextWithEdit';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/text_with_edit.styles.ts b/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/text_with_edit.styles.ts
deleted file mode 100644
index e293ea073041..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/text_with_edit.styles.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { css } from '@emotion/react';
-import { euiThemeVars } from '@kbn/ui-theme';
-
-export const textWithEditContainerCss = css`
- display: flex;
- width: fit-content;
- align-items: baseline;
- padding-bottom: ${euiThemeVars.euiSizeS};
- h1 {
- margin-bottom: 0;
- }
-`;
-export const editIconCss = css`
- button {
- margin-left: -${euiThemeVars.euiSizeM};
- }
-`;
diff --git a/packages/kbn-securitysolution-exception-list-components/src/translations.ts b/packages/kbn-securitysolution-exception-list-components/src/translations.ts
deleted file mode 100644
index dff688d156da..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/translations.ts
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { i18n } from '@kbn/i18n';
-
-export const EMPTY_VIEWER_STATE_EMPTY_TITLE = i18n.translate(
- 'exceptionList-components.empty.viewer.state.empty.title',
- {
- defaultMessage: 'Add exceptions to this list',
- }
-);
-
-export const EMPTY_VIEWER_STATE_EMPTY_BODY = i18n.translate(
- 'exceptionList-components.empty.viewer.state.empty.body',
- {
- defaultMessage: 'There is no exception in your list. Create your first exception.',
- }
-);
-export const EMPTY_VIEWER_STATE_EMPTY_SEARCH_TITLE = i18n.translate(
- 'exceptionList-components.empty.viewer.state.empty_search.search.title',
- {
- defaultMessage: 'No results match your search criteria',
- }
-);
-
-export const EMPTY_VIEWER_STATE_EMPTY_SEARCH_BODY = i18n.translate(
- 'exceptionList-components.empty.viewer.state.empty_search.body',
- {
- defaultMessage: 'Try modifying your search',
- }
-);
-
-export const EMPTY_VIEWER_STATE_EMPTY_VIEWER_BUTTON = (exceptionType: string) =>
- i18n.translate('exceptionList-components.empty.viewer.state.empty.viewer_button', {
- values: { exceptionType },
- defaultMessage: 'Create {exceptionType} exception',
- });
-
-export const EMPTY_VIEWER_STATE_ERROR_TITLE = i18n.translate(
- 'exceptionList-components.empty.viewer.state.error_title',
- {
- defaultMessage: 'Unable to load exception items',
- }
-);
-
-export const EMPTY_VIEWER_STATE_ERROR_BODY = i18n.translate(
- 'exceptionList-components.empty.viewer.state.error_body',
- {
- defaultMessage:
- 'There was an error loading the exception items. Contact your administrator for help.',
- }
-);
-export const EXCEPTION_LIST_HEADER_EXPORT_ACTION = i18n.translate(
- 'exceptionList-components.exception_list_header_export_action',
- {
- defaultMessage: 'Export exception list',
- }
-);
-export const EXCEPTION_LIST_HEADER_DELETE_ACTION = i18n.translate(
- 'exceptionList-components.exception_list_header_delete_action',
- {
- defaultMessage: 'Delete exception list',
- }
-);
-export const EXCEPTION_LIST_HEADER_DUPLICATE_ACTION = i18n.translate(
- 'exceptionList-components.exception_list_header_duplicate_action',
- {
- defaultMessage: 'Duplicate exception list',
- }
-);
-export const EXCEPTION_LIST_HEADER_LINK_RULES_BUTTON = i18n.translate(
- 'exceptionList-components.exception_list_header_link_rules_button',
- {
- defaultMessage: 'Link rules',
- }
-);
-
-export const EXCEPTION_LIST_HEADER_LINKED_RULES = (noOfRules: number) =>
- i18n.translate('exceptionList-components.exception_list_header_linked_rules', {
- values: { noOfRules },
- defaultMessage: 'Linked to {noOfRules} rules',
- });
-
-export const EXCEPTION_LIST_HEADER_BREADCRUMB = i18n.translate(
- 'exceptionList-components.exception_list_header_breadcrumb',
- {
- defaultMessage: 'Shared Exception Lists',
- }
-);
-
-export const EXCEPTION_LIST_HEADER_LIST_ID = i18n.translate(
- 'exceptionList-components.exception_list_header_list_id',
- {
- defaultMessage: 'List ID',
- }
-);
-
-export const EXCEPTION_LIST_HEADER_NAME = i18n.translate(
- 'exceptionList-components.exception_list_header_name',
- {
- defaultMessage: 'Add a name',
- }
-);
-
-export const EXCEPTION_LIST_HEADER_DESCRIPTION = i18n.translate(
- 'exceptionList-components.exception_list_header_description',
- {
- defaultMessage: 'Add a description',
- }
-);
-
-export const EXCEPTION_LIST_HEADER_EDIT_MODAL_TITLE = (listName: string) =>
- i18n.translate('exceptionList-components.exception_list_header_edit_modal_name', {
- defaultMessage: 'Edit {listName}',
- values: { listName },
- });
-
-export const EXCEPTION_LIST_HEADER_EDIT_MODAL_SAVE_BUTTON = i18n.translate(
- 'exceptionList-components.exception_list_header_edit_modal_save_button',
- {
- defaultMessage: 'Save',
- }
-);
-
-export const EXCEPTION_LIST_HEADER_EDIT_MODAL_CANCEL_BUTTON = i18n.translate(
- 'exceptionList-components.exception_list_header_edit_modal_cancel_button',
- {
- defaultMessage: 'Cancel',
- }
-);
-export const EXCEPTION_LIST_HEADER_NAME_TEXTBOX = i18n.translate(
- 'exceptionList-components.exception_list_header_Name_textbox',
- {
- defaultMessage: 'Name',
- }
-);
-
-export const EXCEPTION_LIST_HEADER_DESCRIPTION_TEXTBOX = i18n.translate(
- 'exceptionList-components.exception_list_header_description_textbox',
- {
- defaultMessage: 'Description (optional)',
- }
-);
-
-export const LIST_NAME_REQUIRED_ERROR = i18n.translate(
- 'exceptionList-components.exception_list_header_description_textboxexceptionList-components.exception_list_header_name_required_eror',
- {
- defaultMessage: 'List name cannot be empty',
- }
-);
diff --git a/packages/kbn-securitysolution-exception-list-components/src/types/index.ts b/packages/kbn-securitysolution-exception-list-components/src/types/index.ts
deleted file mode 100644
index 57a0ee3901ba..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/types/index.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { ListArray } from '@kbn/securitysolution-io-ts-list-types';
-
-import type { Pagination } from '@elastic/eui';
-import type { NamespaceType } from '@kbn/securitysolution-io-ts-list-types';
-
-export interface GetExceptionItemProps {
- pagination?: PaginationProps['pagination'];
- search?: string;
- filters?: string;
-}
-
-export interface PaginationProps {
- dataTestSubj?: string;
- ariaLabel?: string;
- pagination: Pagination & { pageSize: number };
- onPaginationChange: (arg: GetExceptionItemProps) => void;
-}
-
-export enum ViewerStatus {
- ERROR = 'error',
- EMPTY = 'empty',
- EMPTY_SEARCH = 'empty_search',
- LOADING = 'loading',
- SEARCHING = 'searching',
- DELETING = 'deleting',
-}
-
-export interface ExceptionListSummaryProps {
- pagination: Pagination;
- // Corresponds to last time exception items were fetched
- lastUpdated: string | number | null;
-}
-
-export type ViewerFlyoutName = 'addException' | 'editException' | null;
-
-export interface RuleReferences {
- [key: string]: RuleReference;
-}
-
-export interface ExceptionListItemIdentifiers {
- id: string;
- name: string;
- namespaceType: NamespaceType;
-}
-
-export enum ListTypeText {
- ENDPOINT = 'endpoint',
- DETECTION = 'empty',
- RULE_DEFAULT = 'empty_search',
-}
-export interface Rule {
- name: string;
- id: string;
- rule_id: string;
- exceptions_list?: ListArray;
-}
-
-export interface RuleReference {
- name: string;
- id: string;
- referenced_rules: Rule[];
- listId?: string;
-}
-
-export interface ListDetails {
- name: string;
- description?: string;
-}
diff --git a/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/index.ts b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/index.ts
deleted file mode 100644
index 5a0843be833f..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/index.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export { ValueWithSpaceWarning } from './value_with_space_warning';
diff --git a/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/use_value_with_space_warning.ts b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/use_value_with_space_warning.ts
deleted file mode 100644
index d5a6392815a7..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/use_value_with_space_warning.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { paramContainsSpace, autoCompletei18n } from '@kbn/securitysolution-autocomplete';
-
-interface UseValueWithSpaceWarningResult {
- showSpaceWarningIcon: boolean;
- warningText: string;
-}
-interface UseValueWithSpaceWarningProps {
- value: string | string[];
- tooltipIconText?: string;
-}
-
-export const useValueWithSpaceWarning = ({
- value,
- tooltipIconText,
-}: UseValueWithSpaceWarningProps): UseValueWithSpaceWarningResult => {
- const showSpaceWarningIcon = Array.isArray(value)
- ? value.find(paramContainsSpace)
- : paramContainsSpace(value);
-
- return {
- showSpaceWarningIcon: !!showSpaceWarningIcon,
- warningText: tooltipIconText || autoCompletei18n.FIELD_SPACE_WARNING,
- };
-};
diff --git a/packages/kbn-securitysolution-exception-list-components/src/wildcard_with_wrong_operator_callout/index.tsx b/packages/kbn-securitysolution-exception-list-components/src/wildcard_with_wrong_operator_callout/index.tsx
deleted file mode 100644
index d68782b4c17f..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/src/wildcard_with_wrong_operator_callout/index.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import React from 'react';
-import { FormattedMessage } from '@kbn/i18n-react';
-import { i18n } from '@kbn/i18n';
-
-import { EuiCallOut } from '@elastic/eui';
-
-export const WildCardWithWrongOperatorCallout = () => {
- return (
-
-
-
- {i18n.translate(
- 'exceptionList-components.wildcardWithWrongOperatorCallout.changeTheOperator',
- { defaultMessage: 'Change the operator' }
- )}
-
- ),
- matches: (
-
- {i18n.translate(
- 'exceptionList-components.wildcardWithWrongOperatorCallout.matches',
- { defaultMessage: 'matches' }
- )}
-
- ),
- }}
- />
-
-
- );
-};
diff --git a/packages/kbn-securitysolution-exception-list-components/tsconfig.json b/packages/kbn-securitysolution-exception-list-components/tsconfig.json
deleted file mode 100644
index b3df3a2aa208..000000000000
--- a/packages/kbn-securitysolution-exception-list-components/tsconfig.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "extends": "../../tsconfig.base.json",
- "compilerOptions": {
- "outDir": "target/types",
- "types": [
- "jest",
- "node",
- "react",
- "@emotion/react/types/css-prop"
- ]
- },
- "include": [
- "**/*.ts",
- "**/*.tsx",
- "**/*.d.ts"
- ],
- "kbn_references": [
- "@kbn/securitysolution-io-ts-list-types",
- "@kbn/securitysolution-autocomplete",
- "@kbn/ui-theme",
- "@kbn/i18n",
- "@kbn/i18n-react",
- ],
- "exclude": [
- "target/**/*",
- ]
-}
diff --git a/packages/kbn-securitysolution-exceptions-common/api/create_shared_exceptions_list/create_shared_exceptions_list.gen.ts b/packages/kbn-securitysolution-exceptions-common/api/create_shared_exceptions_list/create_shared_exceptions_list.gen.ts
deleted file mode 100644
index aedd1f5fc5cc..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/create_shared_exceptions_list/create_shared_exceptions_list.gen.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/*
- * NOTICE: Do not edit this file manually.
- * This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
- *
- * info:
- * title: Create shared exception list API endpoint
- * version: 2023-10-31
- */
-
-import { z } from '@kbn/zod';
-
-import {
- ExceptionListName,
- ExceptionListDescription,
- ExceptionList,
-} from '../model/exception_list_common.gen';
-
-export type CreateSharedExceptionListRequestBody = z.infer<
- typeof CreateSharedExceptionListRequestBody
->;
-export const CreateSharedExceptionListRequestBody = z.object({
- name: ExceptionListName,
- description: ExceptionListDescription,
-});
-export type CreateSharedExceptionListRequestBodyInput = z.input<
- typeof CreateSharedExceptionListRequestBody
->;
-
-export type CreateSharedExceptionListResponse = z.infer;
-export const CreateSharedExceptionListResponse = ExceptionList;
diff --git a/packages/kbn-securitysolution-exceptions-common/api/create_shared_exceptions_list/create_shared_exceptions_list.schema.yaml b/packages/kbn-securitysolution-exceptions-common/api/create_shared_exceptions_list/create_shared_exceptions_list.schema.yaml
deleted file mode 100644
index c4cee089e583..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/create_shared_exceptions_list/create_shared_exceptions_list.schema.yaml
+++ /dev/null
@@ -1,68 +0,0 @@
-openapi: 3.0.0
-info:
- title: Create shared exception list API endpoint
- version: '2023-10-31'
-paths:
- /api/exceptions/shared:
- post:
- x-labels: [serverless, ess]
- operationId: CreateSharedExceptionList
- x-codegen-enabled: true
- summary: Create a shared exception list
- description: |
- An exception list groups exception items and can be associated with detection rules. A shared exception list can apply to multiple detection rules.
- > info
- > All exception items added to the same list are evaluated using `OR` logic. That is, if any of the items in a list evaluate to `true`, the exception prevents the rule from generating an alert. Likewise, `OR` logic is used for evaluating exceptions when more than one exception list is assigned to a rule. To use the `AND` operator, you can define multiple clauses (`entries`) in a single exception item.
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- name:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListName'
- description:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListDescription'
- required:
- - name
- - description
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionList'
- 400:
- description: Invalid input data response
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Not enough privileges response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 409:
- description: Exception list already exists response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-exceptions-common/api/delete_exception_list/delete_exception_list.schema.yaml b/packages/kbn-securitysolution-exceptions-common/api/delete_exception_list/delete_exception_list.schema.yaml
deleted file mode 100644
index 92afc3232efe..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/delete_exception_list/delete_exception_list.schema.yaml
+++ /dev/null
@@ -1,70 +0,0 @@
-openapi: 3.0.0
-info:
- title: Delete exception list API endpoint
- version: '2023-10-31'
-paths:
- /api/exception_lists:
- delete:
- x-labels: [serverless, ess]
- operationId: DeleteExceptionList
- x-codegen-enabled: true
- summary: Delete an exception list
- description: Delete an exception list using the `id` or `list_id` field.
- parameters:
- - name: id
- in: query
- required: false
- description: Either `id` or `list_id` must be specified
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListId'
- - name: list_id
- in: query
- required: false
- description: Either `id` or `list_id` must be specified
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListHumanId'
- - name: namespace_type
- in: query
- required: false
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionNamespaceType'
- default: single
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionList'
- 400:
- description: Invalid input data response
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Not enough privileges response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 404:
- description: Exception list not found response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-exceptions-common/api/delete_exception_list_item/delete_exception_list_item.schema.yaml b/packages/kbn-securitysolution-exceptions-common/api/delete_exception_list_item/delete_exception_list_item.schema.yaml
deleted file mode 100644
index 9f57afcd5ab1..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/delete_exception_list_item/delete_exception_list_item.schema.yaml
+++ /dev/null
@@ -1,70 +0,0 @@
-openapi: 3.0.0
-info:
- title: Delete exception list item API endpoint
- version: '2023-10-31'
-paths:
- /api/exception_lists/items:
- delete:
- x-labels: [serverless, ess]
- operationId: DeleteExceptionListItem
- x-codegen-enabled: true
- summary: Delete an exception list item
- description: Delete an exception list item using the `id` or `item_id` field.
- parameters:
- - name: id
- in: query
- required: false
- description: Either `id` or `item_id` must be specified
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemId'
- - name: item_id
- in: query
- required: false
- description: Either `id` or `item_id` must be specified
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemHumanId'
- - name: namespace_type
- in: query
- required: false
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionNamespaceType'
- default: single
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItem'
- 400:
- description: Invalid input data response
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Not enough privileges response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 404:
- description: Exception list item not found response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-exceptions-common/api/duplicate_exception_list/duplicate_exception_list.schema.yaml b/packages/kbn-securitysolution-exceptions-common/api/duplicate_exception_list/duplicate_exception_list.schema.yaml
deleted file mode 100644
index 758171327ee4..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/duplicate_exception_list/duplicate_exception_list.schema.yaml
+++ /dev/null
@@ -1,71 +0,0 @@
-openapi: 3.0.0
-info:
- title: Duplicate exception list API endpoint
- version: '2023-10-31'
-paths:
- /api/exception_lists/_duplicate:
- post:
- x-labels: [serverless, ess]
- operationId: DuplicateExceptionList
- x-codegen-enabled: true
- summary: Duplicate an exception list
- description: Duplicate an existing exception list.
- parameters:
- - name: list_id
- in: query
- required: true
- description: Exception list's human identifier
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListHumanId'
- - name: namespace_type
- in: query
- required: true
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionNamespaceType'
- - name: include_expired_exceptions
- in: query
- required: true
- description: Determines whether to include expired exceptions in the exported list
- schema:
- type: string
- enum: ['true', 'false']
- default: 'true'
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionList'
- 400:
- description: Invalid input data response
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Not enough privileges response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 405:
- description: Exception list to duplicate not found response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-exceptions-common/api/export_exception_list/export_exception_list.gen.ts b/packages/kbn-securitysolution-exceptions-common/api/export_exception_list/export_exception_list.gen.ts
deleted file mode 100644
index 9645b8ac793c..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/export_exception_list/export_exception_list.gen.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/*
- * NOTICE: Do not edit this file manually.
- * This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
- *
- * info:
- * title: Export exception list API endpoint
- * version: 2023-10-31
- */
-
-import { z } from '@kbn/zod';
-
-import {
- ExceptionListId,
- ExceptionListHumanId,
- ExceptionNamespaceType,
-} from '../model/exception_list_common.gen';
-
-export type ExportExceptionListRequestQuery = z.infer;
-export const ExportExceptionListRequestQuery = z.object({
- /**
- * Exception list's identifier
- */
- id: ExceptionListId,
- /**
- * Exception list's human identifier
- */
- list_id: ExceptionListHumanId,
- namespace_type: ExceptionNamespaceType,
- /**
- * Determines whether to include expired exceptions in the exported list
- */
- include_expired_exceptions: z.enum(['true', 'false']).default('true'),
-});
-export type ExportExceptionListRequestQueryInput = z.input;
diff --git a/packages/kbn-securitysolution-exceptions-common/api/export_exception_list/export_exception_list.schema.yaml b/packages/kbn-securitysolution-exceptions-common/api/export_exception_list/export_exception_list.schema.yaml
deleted file mode 100644
index 3232f46c238c..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/export_exception_list/export_exception_list.schema.yaml
+++ /dev/null
@@ -1,79 +0,0 @@
-openapi: 3.0.0
-info:
- title: Export exception list API endpoint
- version: '2023-10-31'
-paths:
- /api/exception_lists/_export:
- post:
- x-labels: [serverless, ess]
- operationId: ExportExceptionList
- x-codegen-enabled: true
- summary: Export an exception list
- description: Export an exception list and its associated items to an NDJSON file.
- parameters:
- - name: id
- in: query
- required: true
- description: Exception list's identifier
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListId'
- - name: list_id
- in: query
- required: true
- description: Exception list's human identifier
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListHumanId'
- - name: namespace_type
- in: query
- required: true
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionNamespaceType'
- - name: include_expired_exceptions
- in: query
- required: true
- description: Determines whether to include expired exceptions in the exported list
- schema:
- type: string
- enum: ['true', 'false']
- default: 'true'
- responses:
- 200:
- description: Successful response
- content:
- application/ndjson:
- schema:
- type: string
- format: binary
- description: A `.ndjson` file containing specified exception list and its items
- 400:
- description: Invalid input data response
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Not enough privileges response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 404:
- description: Exception list not found response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-exceptions-common/api/index.ts b/packages/kbn-securitysolution-exceptions-common/api/index.ts
deleted file mode 100644
index fd6722b67ace..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/index.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export * from './model/exception_list_common.gen';
-export * from './model/exception_list_item_entry.gen';
-export * from './create_exception_list_item/create_exception_list_item.gen';
-export * from './create_rule_exceptions/create_rule_exceptions.gen';
-export * from './create_shared_exceptions_list/create_shared_exceptions_list.gen';
-export * from './create_exception_list/create_exception_list.gen';
-export * from './delete_exception_list_item/delete_exception_list_item.gen';
-export * from './delete_exception_list/delete_exception_list.gen';
-export * from './duplicate_exception_list/duplicate_exception_list.gen';
-export * from './export_exception_list/export_exception_list.gen';
-export * from './find_exception_list_items/find_exception_list_items.gen';
-export * from './find_exception_lists/find_exception_lists.gen';
-export * from './import_exceptions/import_exceptions.gen';
-export * from './read_exception_list_item/read_exception_list_item.gen';
-export * from './read_exception_list/read_exception_list.gen';
-export * from './read_exception_list_summary/read_exception_list_summary.gen';
-export * from './update_exception_list_item/update_exception_list_item.gen';
-export * from './update_exception_list/update_exception_list.gen';
diff --git a/packages/kbn-securitysolution-exceptions-common/api/model/exception_list_item_entry.schema.yaml b/packages/kbn-securitysolution-exceptions-common/api/model/exception_list_item_entry.schema.yaml
deleted file mode 100644
index 883a62e5bbec..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/model/exception_list_item_entry.schema.yaml
+++ /dev/null
@@ -1,147 +0,0 @@
-openapi: 3.0.0
-info:
- title: Common Exception List Item Entry Attributes
- version: 'not applicable'
-paths: {}
-components:
- x-codegen-enabled: true
- schemas:
- ExceptionListItemEntryOperator:
- type: string
- enum: [excluded, included]
-
- ExceptionListItemEntryMatch:
- type: object
- properties:
- type:
- type: string
- enum: [match]
- field:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
- value:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
- operator:
- $ref: '#/components/schemas/ExceptionListItemEntryOperator'
- required:
- - type
- - field
- - value
- - operator
-
- ExceptionListItemEntryMatchAny:
- type: object
- properties:
- type:
- type: string
- enum: [match_any]
- field:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
- value:
- type: array
- items:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
- minItems: 1
- operator:
- $ref: '#/components/schemas/ExceptionListItemEntryOperator'
- required:
- - type
- - field
- - value
- - operator
-
- ExceptionListItemEntryList:
- type: object
- properties:
- type:
- type: string
- enum: [list]
- field:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
- list:
- type: object
- properties:
- id:
- $ref: '../../../kbn-securitysolution-lists-common/api/model/list_common.schema.yaml#/components/schemas/ListId'
- type:
- $ref: '../../../kbn-securitysolution-lists-common/api/model/list_common.schema.yaml#/components/schemas/ListType'
- required: [id, type]
- operator:
- $ref: '#/components/schemas/ExceptionListItemEntryOperator'
- required:
- - type
- - field
- - list
- - operator
-
- ExceptionListItemEntryExists:
- type: object
- properties:
- type:
- type: string
- enum: [exists]
- field:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
- operator:
- $ref: '#/components/schemas/ExceptionListItemEntryOperator'
- required:
- - type
- - field
- - operator
-
- ExceptionListItemEntryNestedEntryItem:
- oneOf:
- - $ref: '#/components/schemas/ExceptionListItemEntryMatch'
- - $ref: '#/components/schemas/ExceptionListItemEntryMatchAny'
- - $ref: '#/components/schemas/ExceptionListItemEntryExists'
-
- ExceptionListItemEntryNested:
- type: object
- properties:
- type:
- type: string
- enum: [nested]
- field:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
- entries:
- type: array
- items:
- $ref: '#/components/schemas/ExceptionListItemEntryNestedEntryItem'
- minItems: 1
- required:
- - type
- - field
- - entries
-
- ExceptionListItemEntryMatchWildcard:
- type: object
- properties:
- type:
- type: string
- enum: [wildcard]
- field:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
- value:
- $ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
- operator:
- $ref: '#/components/schemas/ExceptionListItemEntryOperator'
- required:
- - type
- - field
- - value
- - operator
-
- ExceptionListItemEntry:
- discriminator:
- propertyName: type
- anyOf:
- - $ref: '#/components/schemas/ExceptionListItemEntryMatch'
- - $ref: '#/components/schemas/ExceptionListItemEntryMatchAny'
- - $ref: '#/components/schemas/ExceptionListItemEntryList'
- - $ref: '#/components/schemas/ExceptionListItemEntryExists'
- - $ref: '#/components/schemas/ExceptionListItemEntryNested'
- - $ref: '#/components/schemas/ExceptionListItemEntryMatchWildcard'
-
- ExceptionListItemEntryArray:
- type: array
- items:
- $ref: '#/components/schemas/ExceptionListItemEntry'
diff --git a/packages/kbn-securitysolution-exceptions-common/api/quickstart_client.gen.ts b/packages/kbn-securitysolution-exceptions-common/api/quickstart_client.gen.ts
deleted file mode 100644
index 4827baab85e9..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/quickstart_client.gen.ts
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/*
- * NOTICE: Do not edit this file manually.
- * This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
- *
- * info:
- * title: Exceptions API client for quickstart
- * version: Bundle (no version)
- */
-
-import type { KbnClient } from '@kbn/test';
-import { ToolingLog } from '@kbn/tooling-log';
-import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
-import { replaceParams } from '@kbn/openapi-common/shared';
-import { catchAxiosErrorFormatAndThrow } from '@kbn/securitysolution-utils';
-
-import type {
- CreateExceptionListItemRequestBodyInput,
- CreateExceptionListItemResponse,
-} from './create_exception_list_item/create_exception_list_item.gen';
-import type {
- CreateExceptionListRequestBodyInput,
- CreateExceptionListResponse,
-} from './create_exception_list/create_exception_list.gen';
-import type {
- CreateRuleExceptionListItemsRequestParamsInput,
- CreateRuleExceptionListItemsRequestBodyInput,
- CreateRuleExceptionListItemsResponse,
-} from './create_rule_exceptions/create_rule_exceptions.gen';
-import type {
- CreateSharedExceptionListRequestBodyInput,
- CreateSharedExceptionListResponse,
-} from './create_shared_exceptions_list/create_shared_exceptions_list.gen';
-import type {
- DeleteExceptionListItemRequestQueryInput,
- DeleteExceptionListItemResponse,
-} from './delete_exception_list_item/delete_exception_list_item.gen';
-import type {
- DeleteExceptionListRequestQueryInput,
- DeleteExceptionListResponse,
-} from './delete_exception_list/delete_exception_list.gen';
-import type {
- DuplicateExceptionListRequestQueryInput,
- DuplicateExceptionListResponse,
-} from './duplicate_exception_list/duplicate_exception_list.gen';
-import type { ExportExceptionListRequestQueryInput } from './export_exception_list/export_exception_list.gen';
-import type {
- FindExceptionListItemsRequestQueryInput,
- FindExceptionListItemsResponse,
-} from './find_exception_list_items/find_exception_list_items.gen';
-import type {
- FindExceptionListsRequestQueryInput,
- FindExceptionListsResponse,
-} from './find_exception_lists/find_exception_lists.gen';
-import type {
- ImportExceptionListRequestQueryInput,
- ImportExceptionListResponse,
-} from './import_exceptions/import_exceptions.gen';
-import type {
- ReadExceptionListItemRequestQueryInput,
- ReadExceptionListItemResponse,
-} from './read_exception_list_item/read_exception_list_item.gen';
-import type {
- ReadExceptionListSummaryRequestQueryInput,
- ReadExceptionListSummaryResponse,
-} from './read_exception_list_summary/read_exception_list_summary.gen';
-import type {
- ReadExceptionListRequestQueryInput,
- ReadExceptionListResponse,
-} from './read_exception_list/read_exception_list.gen';
-import type {
- UpdateExceptionListItemRequestBodyInput,
- UpdateExceptionListItemResponse,
-} from './update_exception_list_item/update_exception_list_item.gen';
-import type {
- UpdateExceptionListRequestBodyInput,
- UpdateExceptionListResponse,
-} from './update_exception_list/update_exception_list.gen';
-
-export interface ClientOptions {
- kbnClient: KbnClient;
- log: ToolingLog;
-}
-
-export class Client {
- readonly kbnClient: KbnClient;
- readonly log: ToolingLog;
-
- constructor(options: ClientOptions) {
- this.kbnClient = options.kbnClient;
- this.log = options.log;
- }
- /**
- * An exception list groups exception items and can be associated with detection rules. You can assign detection rules with multiple exception lists.
-> info
-> All exception items added to the same list are evaluated using `OR` logic. That is, if any of the items in a list evaluate to `true`, the exception prevents the rule from generating an alert. Likewise, `OR` logic is used for evaluating exceptions when more than one exception list is assigned to a rule. To use the `AND` operator, you can define multiple clauses (`entries`) in a single exception item.
-
- */
- async createExceptionList(props: CreateExceptionListProps) {
- this.log.info(`${new Date().toISOString()} Calling API CreateExceptionList`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'POST',
- body: props.body,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Create an exception item and associate it with the specified exception list.
-> info
-> Before creating exception items, you must create an exception list.
-
- */
- async createExceptionListItem(props: CreateExceptionListItemProps) {
- this.log.info(`${new Date().toISOString()} Calling API CreateExceptionListItem`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists/items',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'POST',
- body: props.body,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Create exception items that apply to a single detection rule.
- */
- async createRuleExceptionListItems(props: CreateRuleExceptionListItemsProps) {
- this.log.info(`${new Date().toISOString()} Calling API CreateRuleExceptionListItems`);
- return this.kbnClient
- .request({
- path: replaceParams('/api/detection_engine/rules/{id}/exceptions', props.params),
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'POST',
- body: props.body,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * An exception list groups exception items and can be associated with detection rules. A shared exception list can apply to multiple detection rules.
-> info
-> All exception items added to the same list are evaluated using `OR` logic. That is, if any of the items in a list evaluate to `true`, the exception prevents the rule from generating an alert. Likewise, `OR` logic is used for evaluating exceptions when more than one exception list is assigned to a rule. To use the `AND` operator, you can define multiple clauses (`entries`) in a single exception item.
-
- */
- async createSharedExceptionList(props: CreateSharedExceptionListProps) {
- this.log.info(`${new Date().toISOString()} Calling API CreateSharedExceptionList`);
- return this.kbnClient
- .request({
- path: '/api/exceptions/shared',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'POST',
- body: props.body,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Delete an exception list using the `id` or `list_id` field.
- */
- async deleteExceptionList(props: DeleteExceptionListProps) {
- this.log.info(`${new Date().toISOString()} Calling API DeleteExceptionList`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'DELETE',
-
- query: props.query,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Delete an exception list item using the `id` or `item_id` field.
- */
- async deleteExceptionListItem(props: DeleteExceptionListItemProps) {
- this.log.info(`${new Date().toISOString()} Calling API DeleteExceptionListItem`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists/items',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'DELETE',
-
- query: props.query,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Duplicate an existing exception list.
- */
- async duplicateExceptionList(props: DuplicateExceptionListProps) {
- this.log.info(`${new Date().toISOString()} Calling API DuplicateExceptionList`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists/_duplicate',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'POST',
-
- query: props.query,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Export an exception list and its associated items to an NDJSON file.
- */
- async exportExceptionList(props: ExportExceptionListProps) {
- this.log.info(`${new Date().toISOString()} Calling API ExportExceptionList`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists/_export',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'POST',
-
- query: props.query,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Get a list of all exception list items in the specified list.
- */
- async findExceptionListItems(props: FindExceptionListItemsProps) {
- this.log.info(`${new Date().toISOString()} Calling API FindExceptionListItems`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists/items/_find',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'GET',
-
- query: props.query,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Get a list of all exception lists.
- */
- async findExceptionLists(props: FindExceptionListsProps) {
- this.log.info(`${new Date().toISOString()} Calling API FindExceptionLists`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists/_find',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'GET',
-
- query: props.query,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Import an exception list and its associated items from an NDJSON file.
- */
- async importExceptionList(props: ImportExceptionListProps) {
- this.log.info(`${new Date().toISOString()} Calling API ImportExceptionList`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists/_import',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'POST',
- body: props.attachment,
- query: props.query,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Get the details of an exception list using the `id` or `list_id` field.
- */
- async readExceptionList(props: ReadExceptionListProps) {
- this.log.info(`${new Date().toISOString()} Calling API ReadExceptionList`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'GET',
-
- query: props.query,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Get the details of an exception list item using the `id` or `item_id` field.
- */
- async readExceptionListItem(props: ReadExceptionListItemProps) {
- this.log.info(`${new Date().toISOString()} Calling API ReadExceptionListItem`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists/items',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'GET',
-
- query: props.query,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Get a summary of the specified exception list.
- */
- async readExceptionListSummary(props: ReadExceptionListSummaryProps) {
- this.log.info(`${new Date().toISOString()} Calling API ReadExceptionListSummary`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists/summary',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'GET',
-
- query: props.query,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Update an exception list using the `id` or `list_id` field.
- */
- async updateExceptionList(props: UpdateExceptionListProps) {
- this.log.info(`${new Date().toISOString()} Calling API UpdateExceptionList`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'PUT',
- body: props.body,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
- /**
- * Update an exception list item using the `id` or `item_id` field.
- */
- async updateExceptionListItem(props: UpdateExceptionListItemProps) {
- this.log.info(`${new Date().toISOString()} Calling API UpdateExceptionListItem`);
- return this.kbnClient
- .request({
- path: '/api/exception_lists/items',
- headers: {
- [ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
- },
- method: 'PUT',
- body: props.body,
- })
- .catch(catchAxiosErrorFormatAndThrow);
- }
-}
-
-export interface CreateExceptionListProps {
- body: CreateExceptionListRequestBodyInput;
-}
-export interface CreateExceptionListItemProps {
- body: CreateExceptionListItemRequestBodyInput;
-}
-export interface CreateRuleExceptionListItemsProps {
- params: CreateRuleExceptionListItemsRequestParamsInput;
- body: CreateRuleExceptionListItemsRequestBodyInput;
-}
-export interface CreateSharedExceptionListProps {
- body: CreateSharedExceptionListRequestBodyInput;
-}
-export interface DeleteExceptionListProps {
- query: DeleteExceptionListRequestQueryInput;
-}
-export interface DeleteExceptionListItemProps {
- query: DeleteExceptionListItemRequestQueryInput;
-}
-export interface DuplicateExceptionListProps {
- query: DuplicateExceptionListRequestQueryInput;
-}
-export interface ExportExceptionListProps {
- query: ExportExceptionListRequestQueryInput;
-}
-export interface FindExceptionListItemsProps {
- query: FindExceptionListItemsRequestQueryInput;
-}
-export interface FindExceptionListsProps {
- query: FindExceptionListsRequestQueryInput;
-}
-export interface ImportExceptionListProps {
- query: ImportExceptionListRequestQueryInput;
- attachment: FormData;
-}
-export interface ReadExceptionListProps {
- query: ReadExceptionListRequestQueryInput;
-}
-export interface ReadExceptionListItemProps {
- query: ReadExceptionListItemRequestQueryInput;
-}
-export interface ReadExceptionListSummaryProps {
- query: ReadExceptionListSummaryRequestQueryInput;
-}
-export interface UpdateExceptionListProps {
- body: UpdateExceptionListRequestBodyInput;
-}
-export interface UpdateExceptionListItemProps {
- body: UpdateExceptionListItemRequestBodyInput;
-}
diff --git a/packages/kbn-securitysolution-exceptions-common/api/read_exception_list/read_exception_list.gen.ts b/packages/kbn-securitysolution-exceptions-common/api/read_exception_list/read_exception_list.gen.ts
deleted file mode 100644
index 67a832b01195..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/read_exception_list/read_exception_list.gen.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/*
- * NOTICE: Do not edit this file manually.
- * This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
- *
- * info:
- * title: Read exception list API endpoint
- * version: 2023-10-31
- */
-
-import { z } from '@kbn/zod';
-
-import {
- ExceptionListId,
- ExceptionListHumanId,
- ExceptionNamespaceType,
- ExceptionList,
-} from '../model/exception_list_common.gen';
-
-export type ReadExceptionListRequestQuery = z.infer;
-export const ReadExceptionListRequestQuery = z.object({
- /**
- * Either `id` or `list_id` must be specified
- */
- id: ExceptionListId.optional(),
- /**
- * Either `id` or `list_id` must be specified
- */
- list_id: ExceptionListHumanId.optional(),
- namespace_type: ExceptionNamespaceType.optional().default('single'),
-});
-export type ReadExceptionListRequestQueryInput = z.input;
-
-export type ReadExceptionListResponse = z.infer;
-export const ReadExceptionListResponse = ExceptionList;
diff --git a/packages/kbn-securitysolution-exceptions-common/api/read_exception_list/read_exception_list.schema.yaml b/packages/kbn-securitysolution-exceptions-common/api/read_exception_list/read_exception_list.schema.yaml
deleted file mode 100644
index 0bf082c1713b..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/read_exception_list/read_exception_list.schema.yaml
+++ /dev/null
@@ -1,70 +0,0 @@
-openapi: 3.0.0
-info:
- title: Read exception list API endpoint
- version: '2023-10-31'
-paths:
- /api/exception_lists:
- get:
- x-labels: [serverless, ess]
- operationId: ReadExceptionList
- x-codegen-enabled: true
- summary: Get exception list details
- description: Get the details of an exception list using the `id` or `list_id` field.
- parameters:
- - name: id
- in: query
- required: false
- description: Either `id` or `list_id` must be specified
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListId'
- - name: list_id
- in: query
- required: false
- description: Either `id` or `list_id` must be specified
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListHumanId'
- - name: namespace_type
- in: query
- required: false
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionNamespaceType'
- default: single
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionList'
- 400:
- description: Invalid input data response
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Not enough privileges response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 404:
- description: Exception list item not found response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-exceptions-common/api/read_exception_list_item/read_exception_list_item.schema.yaml b/packages/kbn-securitysolution-exceptions-common/api/read_exception_list_item/read_exception_list_item.schema.yaml
deleted file mode 100644
index c271016a87eb..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/read_exception_list_item/read_exception_list_item.schema.yaml
+++ /dev/null
@@ -1,70 +0,0 @@
-openapi: 3.0.0
-info:
- title: Read exception list item API endpoint
- version: '2023-10-31'
-paths:
- /api/exception_lists/items:
- get:
- x-labels: [serverless, ess]
- operationId: ReadExceptionListItem
- x-codegen-enabled: true
- summary: Get an exception list item
- description: Get the details of an exception list item using the `id` or `item_id` field.
- parameters:
- - name: id
- in: query
- required: false
- description: Either `id` or `item_id` must be specified
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemId'
- - name: item_id
- in: query
- required: false
- description: Either `id` or `item_id` must be specified
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemHumanId'
- - name: namespace_type
- in: query
- required: false
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionNamespaceType'
- default: single
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItem'
- 400:
- description: Invalid input data response
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Not enough privileges response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 404:
- description: Exception list item not found response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-exceptions-common/api/read_exception_list_summary/read_exception_list_summary.schema.yaml b/packages/kbn-securitysolution-exceptions-common/api/read_exception_list_summary/read_exception_list_summary.schema.yaml
deleted file mode 100644
index b0627111e877..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/api/read_exception_list_summary/read_exception_list_summary.schema.yaml
+++ /dev/null
@@ -1,89 +0,0 @@
-openapi: 3.0.0
-info:
- title: Read exception list summary API endpoint
- version: '2023-10-31'
-paths:
- /api/exception_lists/summary:
- get:
- x-labels: [serverless, ess]
- operationId: ReadExceptionListSummary
- x-codegen-enabled: true
- summary: Get an exception list summary
- description: Get a summary of the specified exception list.
- parameters:
- - name: id
- in: query
- required: false
- description: Exception list's identifier generated upon creation
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListId'
- - name: list_id
- in: query
- required: false
- description: Exception list's human readable identifier
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionListHumanId'
- - name: namespace_type
- in: query
- required: false
- schema:
- $ref: '../model/exception_list_common.schema.yaml#/components/schemas/ExceptionNamespaceType'
- default: single
- - name: filter
- in: query
- required: false
- description: Search filter clause
- schema:
- type: string
- responses:
- 200:
- description: Successful response
- content:
- application/json:
- schema:
- type: object
- properties:
- windows:
- type: integer
- minimum: 0
- linux:
- type: integer
- minimum: 0
- macos:
- type: integer
- minimum: 0
- total:
- type: integer
- minimum: 0
- 400:
- description: Invalid input data response
- content:
- application/json:
- schema:
- oneOf:
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- - $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 401:
- description: Unsuccessful authentication response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 403:
- description: Not enough privileges response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse'
- 404:
- description: Exception list not found response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
- 500:
- description: Internal server error response
- content:
- application/json:
- schema:
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse'
diff --git a/packages/kbn-securitysolution-exceptions-common/package.json b/packages/kbn-securitysolution-exceptions-common/package.json
deleted file mode 100644
index 5148c4d5eedf..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/package.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "description": "Security Solution Exceptions common package",
- "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
- "name": "@kbn/securitysolution-exceptions-common",
- "private": true,
- "version": "1.0.0",
- "scripts": {
- "openapi:generate": "node scripts/openapi_generate",
- "openapi:bundle": "node scripts/openapi_bundle"
- }
-}
diff --git a/packages/kbn-securitysolution-exceptions-common/scripts/openapi_bundle.js b/packages/kbn-securitysolution-exceptions-common/scripts/openapi_bundle.js
deleted file mode 100644
index 70299e56eac2..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/scripts/openapi_bundle.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-require('../../../src/setup_node_env');
-const { join, resolve } = require('path');
-const { bundle } = require('@kbn/openapi-bundler');
-
-const ROOT = resolve(__dirname, '..');
-
-(async () => {
- await bundle({
- sourceGlob: join(ROOT, 'api/**/*.schema.yaml'),
- outputFilePath: join(
- ROOT,
- 'docs/openapi/serverless/security_solution_exceptions_api_{version}.bundled.schema.yaml'
- ),
- options: {
- includeLabels: ['serverless'],
- prototypeDocument: join(ROOT, 'scripts/openapi_bundle_info/exceptions_serverless.info.yaml'),
- },
- });
-
- await bundle({
- sourceGlob: join(ROOT, 'api/**/*.schema.yaml'),
- outputFilePath: join(
- ROOT,
- 'docs/openapi/ess/security_solution_exceptions_api_{version}.bundled.schema.yaml'
- ),
- options: {
- includeLabels: ['ess'],
- prototypeDocument: join(ROOT, 'scripts/openapi_bundle_info/exceptions_ess.info.yaml'),
- },
- });
-})();
diff --git a/packages/kbn-securitysolution-exceptions-common/scripts/openapi_generate.js b/packages/kbn-securitysolution-exceptions-common/scripts/openapi_generate.js
deleted file mode 100644
index 13b260476f3a..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/scripts/openapi_generate.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-require('../../../src/setup_node_env');
-const { join, resolve } = require('path');
-const { generate } = require('@kbn/openapi-generator');
-const { REPO_ROOT } = require('@kbn/repo-info');
-
-const ROOT = resolve(__dirname, '..');
-
-(async () => {
- await generate({
- title: 'OpenAPI Exceptions API Schemas',
- rootDir: ROOT,
- sourceGlob: './api/**/*.schema.yaml',
- templateName: 'zod_operation_schema',
- });
-
- await generate({
- title: 'Exceptions API client for tests',
- rootDir: ROOT,
- sourceGlob: './api/**/*.schema.yaml',
- templateName: 'api_client_supertest',
- skipLinting: true,
- bundle: {
- outFile: join(
- REPO_ROOT,
- 'x-pack/test/api_integration/services/security_solution_exceptions_api.gen.ts'
- ),
- },
- });
-
- await generate({
- title: 'Exceptions API client for quickstart',
- rootDir: ROOT,
- sourceGlob: './api/**/*.schema.yaml',
- templateName: 'api_client_quickstart',
- skipLinting: true,
- bundle: {
- outFile: join(
- REPO_ROOT,
- 'packages/kbn-securitysolution-exceptions-common/api/quickstart_client.gen.ts'
- ),
- },
- });
-})();
diff --git a/packages/kbn-securitysolution-exceptions-common/tsconfig.json b/packages/kbn-securitysolution-exceptions-common/tsconfig.json
deleted file mode 100644
index a58753f53a4f..000000000000
--- a/packages/kbn-securitysolution-exceptions-common/tsconfig.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "compilerOptions": {
- "outDir": "target/types",
- "types": ["jest", "node"]
- },
- "exclude": ["target/**/*"],
- "extends": "../../tsconfig.base.json",
- "include": ["**/*.ts"],
- "kbn_references": [
- "@kbn/openapi-common",
- "@kbn/zod-helpers",
- "@kbn/securitysolution-lists-common",
- "@kbn/test",
- "@kbn/tooling-log",
- "@kbn/core-http-common",
- "@kbn/securitysolution-utils",
- "@kbn/zod",
- ]
-}
diff --git a/packages/kbn-securitysolution-hook-utils/index.ts b/packages/kbn-securitysolution-hook-utils/index.ts
deleted file mode 100644
index be336bddcf9b..000000000000
--- a/packages/kbn-securitysolution-hook-utils/index.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export * from './src/types';
-export * from './src/use_async';
-export * from './src/use_is_mounted';
-export * from './src/use_observable';
-export * from './src/with_optional_signal';
diff --git a/packages/kbn-securitysolution-hook-utils/jest.config.js b/packages/kbn-securitysolution-hook-utils/jest.config.js
deleted file mode 100644
index badea193370b..000000000000
--- a/packages/kbn-securitysolution-hook-utils/jest.config.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-module.exports = {
- preset: '@kbn/test',
- rootDir: '../..',
- roots: ['/packages/kbn-securitysolution-hook-utils'],
-};
diff --git a/packages/kbn-securitysolution-hook-utils/package.json b/packages/kbn-securitysolution-hook-utils/package.json
deleted file mode 100644
index 71a83ce3ebb4..000000000000
--- a/packages/kbn-securitysolution-hook-utils/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "@kbn/securitysolution-hook-utils",
- "version": "1.0.0",
- "description": "Security Solution utilities for React hooks",
- "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
- "private": true,
- "sideEffects": false
-}
\ No newline at end of file
diff --git a/packages/kbn-securitysolution-hook-utils/src/types.ts b/packages/kbn-securitysolution-hook-utils/src/types.ts
deleted file mode 100644
index 6642afac7381..000000000000
--- a/packages/kbn-securitysolution-hook-utils/src/types.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/**
- * Represents the state of an asynchronous task, along with an initiator
- * function to kick off the work.
- */
-export interface Task {
- loading: boolean;
- error: unknown | undefined;
- result: Result | undefined;
- start: (...args: Args) => void;
-}
diff --git a/packages/kbn-securitysolution-hook-utils/src/use_async/index.test.ts b/packages/kbn-securitysolution-hook-utils/src/use_async/index.test.ts
deleted file mode 100644
index 99417c1fe329..000000000000
--- a/packages/kbn-securitysolution-hook-utils/src/use_async/index.test.ts
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { waitFor, renderHook, act } from '@testing-library/react';
-
-import { useAsync } from '.';
-
-interface TestArgs {
- n: number;
- s: string;
-}
-
-type TestReturn = Promise;
-
-describe('useAsync', () => {
- /**
- * Timeout for both jest tests and for the waitFor.
- * jest tests default to 5 seconds and waitFor defaults to 1 second.
- * 20_0000 = 20,000 milliseconds = 20 seconds
- */
- const timeout = 20_000;
-
- let fn: jest.Mock;
- let args: TestArgs;
-
- beforeEach(() => {
- args = { n: 1, s: 's' };
- fn = jest.fn().mockResolvedValue(false);
- });
-
- it('does not invoke fn if start was not called', () => {
- renderHook(() => useAsync(fn));
- expect(fn).not.toHaveBeenCalled();
- });
-
- it(
- 'invokes the function when start is called',
- async () => {
- const { result } = renderHook(() => useAsync(fn));
-
- act(() => {
- result.current.start(args);
- });
- await waitFor(() => expect(fn).toHaveBeenCalled(), { timeout });
- },
- timeout
- );
-
- it('invokes the function with start args', async () => {
- const { result } = renderHook(() => useAsync(fn));
- const expectedArgs = { ...args };
-
- act(() => {
- result.current.start(args);
- });
- await waitFor(() => expect(fn).toHaveBeenCalledWith(expectedArgs), { timeout });
- });
-
- it(
- 'populates result with the resolved value of the fn',
- async () => {
- const { result } = renderHook(() => useAsync(fn));
- fn.mockResolvedValue({ resolved: 'value' });
-
- act(() => {
- result.current.start(args);
- });
- await waitFor(
- () => {
- expect(result.current.result).toEqual({ resolved: 'value' });
- expect(result.current.error).toBeUndefined();
- },
- { timeout }
- );
- },
- timeout
- );
-
- it(
- 'populates error if function rejects',
- async () => {
- fn.mockRejectedValue(new Error('whoops'));
- const { result } = renderHook(() => useAsync(fn));
-
- act(() => {
- result.current.start(args);
- });
-
- await waitFor(
- () => {
- expect(result.current.result).toBeUndefined();
- expect(result.current.error).toEqual(new Error('whoops'));
- },
- { timeout }
- );
- },
- timeout
- );
-
- it(
- 'populates the loading state while the function is pending',
- async () => {
- let resolve: () => void;
- fn.mockImplementation(() => new Promise((_resolve) => (resolve = _resolve)));
-
- const { result } = renderHook(() => useAsync(fn));
-
- act(() => {
- result.current.start(args);
- });
-
- expect(result.current.loading).toBe(true);
-
- act(() => resolve());
- await waitFor(() => expect(result.current.loading).toBe(false), { timeout });
- },
- timeout
- );
-
- it(
- 'multiple start calls reset state',
- async () => {
- let resolve: (result: string) => void;
- fn.mockImplementation(() => new Promise((_resolve) => (resolve = _resolve)));
-
- const { result } = renderHook(() => useAsync(fn));
-
- act(() => {
- result.current.start(args);
- });
-
- expect(result.current.loading).toBe(true);
-
- act(() => resolve('result'));
- await waitFor(
- () => {
- expect(result.current.loading).toBe(false);
- expect(result.current.result).toBe('result');
- },
- { timeout }
- );
-
- act(() => {
- result.current.start(args);
- });
-
- expect(result.current.loading).toBe(true);
- expect(result.current.result).toBe(undefined);
- act(() => resolve('result'));
- await waitFor(
- () => {
- expect(result.current.loading).toBe(false);
- expect(result.current.result).toBe('result');
- },
- { timeout }
- );
- },
- timeout
- );
-});
diff --git a/packages/kbn-securitysolution-hook-utils/src/use_async/index.ts b/packages/kbn-securitysolution-hook-utils/src/use_async/index.ts
deleted file mode 100644
index 2c695b26acdd..000000000000
--- a/packages/kbn-securitysolution-hook-utils/src/use_async/index.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { useCallback, useState } from 'react';
-
-import { Task } from '../types';
-import { useIsMounted } from '../use_is_mounted';
-
-/**
- *
- * This hook wraps a promise-returning thunk (task) in order to conditionally
- * initiate the work, and automatically provide state corresponding to the
- * task's status.
- *
- * In order to function properly and not rerender unnecessarily, ensure that
- * your task is a stable function reference.
- *
- * @param fn a function returning a promise.
- *
- * @returns An {@link Task} containing the task's current state along with a
- * start callback
- */
-export const useAsync = (
- fn: (...args: Args) => Promise
-): Task => {
- const isMounted = useIsMounted();
- const [loading, setLoading] = useState(false);
- const [error, setError] = useState();
- const [result, setResult] = useState();
-
- const start = useCallback(
- (...args: Args) => {
- setLoading(true);
- setResult(undefined);
- setError(undefined);
- fn(...args)
- .then((r) => isMounted() && setResult(r))
- .catch((e) => isMounted() && setError(e))
- .finally(() => isMounted() && setLoading(false));
- },
- [fn, isMounted]
- );
-
- return {
- error,
- loading,
- result,
- start,
- };
-};
diff --git a/packages/kbn-securitysolution-hook-utils/src/use_is_mounted/index.test.ts b/packages/kbn-securitysolution-hook-utils/src/use_is_mounted/index.test.ts
deleted file mode 100644
index a8013a65441c..000000000000
--- a/packages/kbn-securitysolution-hook-utils/src/use_is_mounted/index.test.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { renderHook } from '@testing-library/react';
-
-import { useIsMounted } from '.';
-
-describe('useIsMounted', () => {
- it('evaluates to true when mounted', () => {
- const { result } = renderHook(() => useIsMounted());
-
- expect(result.current()).toEqual(true);
- });
-
- it('evaluates to false when unmounted', () => {
- const { result, unmount } = renderHook(() => useIsMounted());
-
- unmount();
- expect(result.current()).toEqual(false);
- });
-});
diff --git a/packages/kbn-securitysolution-hook-utils/src/use_is_mounted/index.ts b/packages/kbn-securitysolution-hook-utils/src/use_is_mounted/index.ts
deleted file mode 100644
index b563840d2f73..000000000000
--- a/packages/kbn-securitysolution-hook-utils/src/use_is_mounted/index.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { useCallback, useEffect, useRef } from 'react';
-
-type GetIsMounted = () => boolean;
-
-/**
- *
- * @returns A {@link GetIsMounted} getter function returning whether the component is currently mounted
- */
-export const useIsMounted = (): GetIsMounted => {
- const isMounted = useRef(false);
- const getIsMounted: GetIsMounted = useCallback(() => isMounted.current, []);
- const handleCleanup = useCallback(() => {
- isMounted.current = false;
- }, []);
-
- useEffect(() => {
- isMounted.current = true;
- return handleCleanup;
- }, [handleCleanup]);
-
- return getIsMounted;
-};
diff --git a/packages/kbn-securitysolution-hook-utils/src/use_observable/index.test.ts b/packages/kbn-securitysolution-hook-utils/src/use_observable/index.test.ts
deleted file mode 100644
index 8d90bffeb3ee..000000000000
--- a/packages/kbn-securitysolution-hook-utils/src/use_observable/index.test.ts
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { renderHook, act } from '@testing-library/react';
-import { Subject, throwError } from 'rxjs';
-
-import { useObservable } from '.';
-
-interface TestArgs {
- n: number;
- s: string;
-}
-
-type TestReturn = Subject;
-
-describe('useObservable', () => {
- let fn: jest.Mock;
- let subject: TestReturn;
- let args: TestArgs;
-
- beforeEach(() => {
- args = { n: 1, s: 's' };
- subject = new Subject();
- fn = jest.fn().mockReturnValue(subject);
- });
-
- it('does not invoke fn if start was not called', () => {
- renderHook(() => useObservable(fn));
- expect(fn).not.toHaveBeenCalled();
- });
-
- it('invokes the function when start is called', () => {
- const { result } = renderHook(() => useObservable(fn));
-
- act(() => {
- result.current.start(args);
- });
-
- expect(fn).toHaveBeenCalled();
- });
-
- it('invokes the function with start args', () => {
- const { result } = renderHook(() => useObservable(fn));
- const expectedArgs = { ...args };
-
- act(() => {
- result.current.start(args);
- });
-
- expect(fn).toHaveBeenCalledWith(expectedArgs);
- });
-
- it('populates result with the next value of the fn', () => {
- const { result } = renderHook(() => useObservable(fn));
-
- act(() => {
- result.current.start(args);
- });
- act(() => subject.next('value'));
-
- expect(result.current.result).toEqual('value');
- expect(result.current.error).toBeUndefined();
- });
-
- it('populates error if observable throws an error', () => {
- const error = new Error('whoops');
- const errorFn = () => throwError(error);
-
- const { result } = renderHook(() => useObservable(errorFn));
-
- act(() => {
- result.current.start();
- });
-
- expect(result.current.result).toBeUndefined();
- expect(result.current.error).toEqual(error);
- });
-
- it('populates the loading state while no value has resolved', () => {
- const { result } = renderHook(() => useObservable(fn));
-
- act(() => {
- result.current.start(args);
- });
-
- expect(result.current.loading).toBe(true);
-
- act(() => subject.next('a value'));
-
- expect(result.current.loading).toBe(false);
- });
-
- it('updates result with each resolved value', () => {
- const { result } = renderHook(() => useObservable(fn));
-
- act(() => {
- result.current.start(args);
- });
-
- act(() => subject.next('a value'));
- expect(result.current.result).toEqual('a value');
-
- act(() => subject.next('a subsequent value'));
- expect(result.current.result).toEqual('a subsequent value');
- });
-
- it('does not update result with values if start has not been called', () => {
- const { result } = renderHook(() => useObservable(fn));
-
- act(() => subject.next('a value'));
- expect(result.current.result).toBeUndefined();
-
- act(() => subject.next('a subsequent value'));
- expect(result.current.result).toBeUndefined();
- });
-
- it('unsubscribes on unmount', () => {
- const { result, unmount } = renderHook(() => useObservable(fn));
-
- act(() => {
- result.current.start(args);
- });
- expect(subject.observers).toHaveLength(1);
-
- unmount();
- expect(subject.observers).toHaveLength(0);
- });
-
- it('multiple start calls reset state', () => {
- const { result } = renderHook(() => useObservable(fn));
-
- act(() => {
- result.current.start(args);
- });
-
- expect(result.current.loading).toBe(true);
-
- act(() => subject.next('one value'));
-
- expect(result.current.loading).toBe(false);
- expect(result.current.result).toBe('one value');
-
- act(() => {
- result.current.start(args);
- });
-
- expect(result.current.loading).toBe(true);
- expect(result.current.result).toBe(undefined);
-
- act(() => subject.next('another value'));
-
- expect(result.current.loading).toBe(false);
- expect(result.current.result).toBe('another value');
- });
-});
diff --git a/packages/kbn-securitysolution-hook-utils/src/use_observable/index.ts b/packages/kbn-securitysolution-hook-utils/src/use_observable/index.ts
deleted file mode 100644
index 0b7f9ab93e02..000000000000
--- a/packages/kbn-securitysolution-hook-utils/src/use_observable/index.ts
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { useCallback, useEffect, useRef, useReducer, Reducer } from 'react';
-import { Observable, Subscription } from 'rxjs';
-
-import { useIsMounted } from '../use_is_mounted';
-import { Task } from '../types';
-
-interface State {
- loading: boolean;
- error?: unknown;
- result?: T;
-}
-
-export type Action =
- | { type: 'setResult'; result: T }
- | { type: 'setError'; error: unknown }
- | { type: 'load' };
-
-function reducer(state: State, action: Action) {
- switch (action.type) {
- case 'setResult':
- return { ...state, result: action.result, loading: false };
- case 'setError':
- return { ...state, error: action.error, loading: false };
- case 'load':
- return { loading: true, result: undefined, error: undefined };
- }
-}
-
-/**
- *
- * @param fn function returning an observable
- *
- * @returns An {@link Async} containing the underlying task's state along with a start callback
- */
-export const useObservable = (
- fn: (...args: Args) => Observable
-): Task => {
- const isMounted = useIsMounted();
- const subRef = useRef();
- const [state, dispatch] = useReducer, Action>>(reducer, {
- loading: false,
- error: undefined,
- result: undefined,
- });
-
- const start = useCallback(
- (...args: Args) => {
- if (subRef.current) {
- subRef.current.unsubscribe();
- }
- dispatch({ type: 'load' });
-
- subRef.current = fn(...args).subscribe(
- (r) => {
- if (isMounted()) {
- dispatch({ type: 'setResult', result: r });
- }
- },
- (e) => {
- if (isMounted()) {
- dispatch({ type: 'setError', error: e });
- }
- }
- );
- },
- [fn, isMounted]
- );
-
- useEffect(
- () => () => {
- if (subRef.current) {
- subRef.current.unsubscribe();
- }
- },
- []
- );
-
- return {
- result: state.result,
- error: state.error,
- loading: state.loading,
- start,
- };
-};
diff --git a/packages/kbn-securitysolution-hook-utils/src/with_optional_signal/index.test.ts b/packages/kbn-securitysolution-hook-utils/src/with_optional_signal/index.test.ts
deleted file mode 100644
index fa77482d24be..000000000000
--- a/packages/kbn-securitysolution-hook-utils/src/with_optional_signal/index.test.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { withOptionalSignal } from '.';
-
-type TestFn = ({ number, signal }: { number: number; signal: AbortSignal }) => boolean;
-
-describe('withOptionalSignal', () => {
- it('does not require a signal on the returned function', () => {
- const fn = jest.fn().mockReturnValue('hello') as TestFn;
-
- const wrappedFn = withOptionalSignal(fn);
-
- expect(wrappedFn({ number: 1 })).toEqual('hello');
- });
-
- it('will pass a given signal to the wrapped function', () => {
- const fn = jest.fn().mockReturnValue('hello') as TestFn;
- const { signal } = new AbortController();
-
- const wrappedFn = withOptionalSignal(fn);
-
- wrappedFn({ number: 1, signal });
- expect(fn).toHaveBeenCalledWith({ number: 1, signal });
- });
-});
diff --git a/packages/kbn-securitysolution-hook-utils/src/with_optional_signal/index.ts b/packages/kbn-securitysolution-hook-utils/src/with_optional_signal/index.ts
deleted file mode 100644
index eb7cffeb7e00..000000000000
--- a/packages/kbn-securitysolution-hook-utils/src/with_optional_signal/index.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-interface SignalArgs {
- signal: AbortSignal;
-}
-
-export type OptionalSignalArgs = Omit & Partial;
-
-/**
- *
- * @param fn an async function receiving an AbortSignal argument
- *
- * @returns An async function where the AbortSignal argument is optional
- */
-export const withOptionalSignal =
- (fn: (args: Args) => Result) =>
- (args: OptionalSignalArgs): Result => {
- const signal = args.signal != null ? args.signal : new AbortController().signal;
- return fn({ ...args, signal } as Args);
- };
diff --git a/packages/kbn-securitysolution-hook-utils/tsconfig.json b/packages/kbn-securitysolution-hook-utils/tsconfig.json
deleted file mode 100644
index 9b5c5373afe0..000000000000
--- a/packages/kbn-securitysolution-hook-utils/tsconfig.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "extends": "../../tsconfig.base.json",
- "compilerOptions": {
- "outDir": "target/types",
- "types": ["jest", "node"]
- },
- "include": [
- "**/*.ts"
- ],
- "exclude": [
- "target/**/*",
- ]
-}
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/index.ts
deleted file mode 100644
index 6baaf0a70403..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/index.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export * from './src/actions';
-export * from './src/default_actions_array';
-export * from './src/default_export_file_name';
-export * from './src/default_from_string';
-export * from './src/default_interval_string';
-export * from './src/default_language_string';
-export * from './src/default_max_signals_number';
-export * from './src/default_page';
-export * from './src/default_per_page';
-export * from './src/default_risk_score_mapping_array';
-export * from './src/default_severity_mapping_array';
-export * from './src/default_threat_array';
-export * from './src/default_to_string';
-export * from './src/default_uuid';
-export * from './src/frequency';
-export * from './src/language';
-export * from './src/machine_learning_job_id';
-export * from './src/max_signals';
-export * from './src/normalized_ml_job_id';
-export * from './src/references_default_array';
-export * from './src/risk_score';
-export * from './src/risk_score_mapping';
-export * from './src/rule_schedule';
-export * from './src/saved_object_attributes';
-export * from './src/severity';
-export * from './src/severity_mapping';
-export * from './src/threat';
-export * from './src/threat_mapping';
-export * from './src/threat_subtechnique';
-export * from './src/threat_tactic';
-export * from './src/threat_technique';
-export * from './src/throttle';
-export * from './src/type';
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/jest.config.js b/packages/kbn-securitysolution-io-ts-alerting-types/jest.config.js
deleted file mode 100644
index b4c7014f9154..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/jest.config.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-module.exports = {
- preset: '@kbn/test',
- rootDir: '../..',
- roots: ['/packages/kbn-securitysolution-io-ts-alerting-types'],
-};
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/package.json b/packages/kbn-securitysolution-io-ts-alerting-types/package.json
deleted file mode 100644
index ab19f69d20b3..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "@kbn/securitysolution-io-ts-alerting-types",
- "version": "1.0.0",
- "description": "io ts utilities and types to be shared with plugins from the security solution project",
- "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
- "private": true,
- "sideEffects": false
-}
\ No newline at end of file
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/actions/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/actions/index.ts
deleted file mode 100644
index ad1dde3da745..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/actions/index.ts
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-
-import * as t from 'io-ts';
-import { saved_object_attributes } from '../saved_object_attributes';
-import { RuleActionFrequency } from '../frequency';
-
-export type RuleActionGroup = t.TypeOf;
-export const RuleActionGroup = t.string;
-
-export type RuleActionId = t.TypeOf;
-export const RuleActionId = t.string;
-
-export type RuleActionTypeId = t.TypeOf;
-export const RuleActionTypeId = t.string;
-
-export type RuleActionUuid = t.TypeOf;
-export const RuleActionUuid = NonEmptyString;
-
-/**
- * Params is an "object", since it is a type of RuleActionParams which is action templates.
- * @see x-pack/plugins/alerting/common/rule.ts
- */
-export type RuleActionParams = t.TypeOf;
-export const RuleActionParams = saved_object_attributes;
-
-export const RuleActionAlertsFilter = t.partial({
- query: t.union([
- t.undefined,
- t.intersection([
- t.strict({
- kql: t.string,
- filters: t.array(
- t.intersection([
- t.type({
- meta: t.partial({
- alias: t.union([t.string, t.null]),
- disabled: t.boolean,
- negate: t.boolean,
- controlledBy: t.string,
- group: t.string,
- index: t.string,
- isMultiIndex: t.boolean,
- type: t.string,
- key: t.string,
- params: t.any,
- value: t.string,
- }),
- }),
- t.partial({
- $state: t.type({ store: t.any }),
- query: t.record(t.string, t.any),
- }),
- ])
- ),
- }),
- t.partial({ dsl: t.string }),
- ]),
- ]),
- timeframe: t.union([
- t.undefined,
- t.strict({
- timezone: t.string,
- days: t.array(
- t.union([
- t.literal(1),
- t.literal(2),
- t.literal(3),
- t.literal(4),
- t.literal(5),
- t.literal(6),
- t.literal(7),
- ])
- ),
- hours: t.strict({
- start: t.string,
- end: t.string,
- }),
- }),
- ]),
-});
-
-export type RuleAction = t.TypeOf;
-export const RuleAction = t.exact(
- t.intersection([
- t.type({
- group: RuleActionGroup,
- id: RuleActionId,
- action_type_id: RuleActionTypeId,
- params: RuleActionParams,
- }),
- t.partial({
- uuid: RuleActionUuid,
- alerts_filter: RuleActionAlertsFilter,
- frequency: RuleActionFrequency,
- }),
- ])
-);
-
-export type RuleActionArray = t.TypeOf;
-export const RuleActionArray = t.array(RuleAction);
-
-export type RuleActionCamel = t.TypeOf;
-export const RuleActionCamel = t.exact(
- t.intersection([
- t.type({
- group: RuleActionGroup,
- id: RuleActionId,
- actionTypeId: RuleActionTypeId,
- params: RuleActionParams,
- }),
- t.partial({
- uuid: RuleActionUuid,
- alertsFilter: RuleActionAlertsFilter,
- frequency: RuleActionFrequency,
- }),
- ])
-);
-
-export type RuleActionArrayCamel = t.TypeOf;
-export const RuleActionArrayCamel = t.array(RuleActionCamel);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/constants/index.mock.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/constants/index.mock.ts
deleted file mode 100644
index bb398e0df846..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/constants/index.mock.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export const ENTRY_VALUE = 'some host name';
-export const FIELD = 'host.name';
-export const MATCH = 'match';
-export const MATCH_ANY = 'match_any';
-export const OPERATOR = 'included';
-export const NESTED = 'nested';
-export const NESTED_FIELD = 'parent.field';
-export const LIST_ID = 'some-list-id';
-export const LIST = 'list';
-export const TYPE = 'ip';
-export const EXISTS = 'exists';
-export const WILDCARD = 'wildcard';
-export const USER = 'some user';
-export const DATE_NOW = '2020-04-20T15:25:31.830Z';
-
-// Exception List specific
-export const ID = 'uuid_here';
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/constants/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/constants/index.ts
deleted file mode 100644
index 0c930e5f4a80..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/constants/index.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/**
- * TODO: Create a kbn-alerting-constants and add this to it.
- * @deprecated Use a DEFAULT_MAX_SIGNALS from a kbn-alerting-constants package.
- */
-export const DEFAULT_MAX_SIGNALS = 100;
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_actions_array/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_actions_array/index.ts
deleted file mode 100644
index 17c3f9301c6d..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_actions_array/index.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { RuleActionArray } from '../actions';
-
-export const DefaultActionsArray = new t.Type<
- RuleActionArray,
- RuleActionArray | undefined,
- unknown
->(
- 'DefaultActionsArray',
- RuleActionArray.is,
- (input, context): Either =>
- input == null ? t.success([]) : RuleActionArray.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_export_file_name/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_export_file_name/index.test.ts
deleted file mode 100644
index b07ade238db2..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_export_file_name/index.test.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { DefaultExportFileName } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_export_file_name', () => {
- test('it should validate a regular string', () => {
- const payload = 'some string';
- const decoded = DefaultExportFileName.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should not validate a number', () => {
- const payload = 5;
- const decoded = DefaultExportFileName.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "5" supplied to "DefaultExportFileName"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default of "export.ndjson"', () => {
- const payload = null;
- const decoded = DefaultExportFileName.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual('export.ndjson');
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_export_file_name/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_export_file_name/index.ts
deleted file mode 100644
index dedbadfa6f52..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_export_file_name/index.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-
-/**
- * Types the DefaultExportFileName as:
- * - If null or undefined, then a default of "export.ndjson" will be used
- */
-export const DefaultExportFileName = new t.Type(
- 'DefaultExportFileName',
- t.string.is,
- (input, context): Either =>
- input == null ? t.success('export.ndjson') : t.string.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_from_string/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_from_string/index.test.ts
deleted file mode 100644
index 2515b3f8b015..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_from_string/index.test.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { DefaultFromString } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_from_string', () => {
- test('it should validate a from string', () => {
- const payload = 'now-20m';
- const decoded = DefaultFromString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should not validate a number', () => {
- const payload = 5;
- const decoded = DefaultFromString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "5" supplied to "DefaultFromString"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default of "now-6m"', () => {
- const payload = null;
- const decoded = DefaultFromString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual('now-6m');
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_from_string/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_from_string/index.ts
deleted file mode 100644
index ccf70aab8a7b..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_from_string/index.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { From } from '../from';
-
-/**
- * Types the DefaultFromString as:
- * - If null or undefined, then a default of the string "now-6m" will be used
- */
-export const DefaultFromString = new t.Type(
- 'DefaultFromString',
- t.string.is,
- (input, context): Either => {
- if (input == null) {
- return t.success('now-6m');
- }
- return From.validate(input, context);
- },
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_interval_string/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_interval_string/index.test.ts
deleted file mode 100644
index 8944d57ba899..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_interval_string/index.test.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { DefaultIntervalString } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_interval_string', () => {
- test('it should validate a interval string', () => {
- const payload = '20m';
- const decoded = DefaultIntervalString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should not validate a number', () => {
- const payload = 5;
- const decoded = DefaultIntervalString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "5" supplied to "DefaultIntervalString"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default of "5m"', () => {
- const payload = null;
- const decoded = DefaultIntervalString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual('5m');
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_interval_string/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_interval_string/index.ts
deleted file mode 100644
index 3fc5d4f42ccb..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_interval_string/index.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-
-/**
- * Types the DefaultIntervalString as:
- * - If null or undefined, then a default of the string "5m" will be used
- */
-export const DefaultIntervalString = new t.Type(
- 'DefaultIntervalString',
- t.string.is,
- (input, context): Either =>
- input == null ? t.success('5m') : t.string.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_language_string/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_language_string/index.test.ts
deleted file mode 100644
index 4a8d50c88eaa..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_language_string/index.test.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { Language } from '../language';
-import { DefaultLanguageString } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_language_string', () => {
- test('it should validate a string', () => {
- const payload: Language = 'lucene';
- const decoded = DefaultLanguageString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should not validate a number', () => {
- const payload = 5;
- const decoded = DefaultLanguageString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "5" supplied to "DefaultLanguageString"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default of "kuery"', () => {
- const payload = null;
- const decoded = DefaultLanguageString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual('kuery');
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_language_string/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_language_string/index.ts
deleted file mode 100644
index 02328d94b011..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_language_string/index.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { language } from '../language';
-
-/**
- * Types the DefaultLanguageString as:
- * - If null or undefined, then a default of the string "kuery" will be used
- */
-export const DefaultLanguageString = new t.Type(
- 'DefaultLanguageString',
- t.string.is,
- (input, context): Either =>
- input == null ? t.success('kuery') : language.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_max_signals_number/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_max_signals_number/index.test.ts
deleted file mode 100644
index 66eb77400ac1..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_max_signals_number/index.test.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { DefaultMaxSignalsNumber } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { DEFAULT_MAX_SIGNALS } from '../constants';
-
-describe('default_from_string', () => {
- test('it should validate a max signal number', () => {
- const payload = 5;
- const decoded = DefaultMaxSignalsNumber.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should not validate a string', () => {
- const payload = '5';
- const decoded = DefaultMaxSignalsNumber.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "5" supplied to "DefaultMaxSignals"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should not validate a zero', () => {
- const payload = 0;
- const decoded = DefaultMaxSignalsNumber.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "0" supplied to "DefaultMaxSignals"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should not validate a negative number', () => {
- const payload = -1;
- const decoded = DefaultMaxSignalsNumber.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "-1" supplied to "DefaultMaxSignals"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default of DEFAULT_MAX_SIGNALS', () => {
- const payload = null;
- const decoded = DefaultMaxSignalsNumber.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(DEFAULT_MAX_SIGNALS);
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_max_signals_number/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_max_signals_number/index.ts
deleted file mode 100644
index 8acbc2f223a1..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_max_signals_number/index.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { max_signals } from '../max_signals';
-import { DEFAULT_MAX_SIGNALS } from '../constants';
-
-/**
- * Types the default max signal:
- * - Natural Number (positive integer and not a float),
- * - greater than 1
- * - If undefined then it will use DEFAULT_MAX_SIGNALS (100) as the default
- */
-export const DefaultMaxSignalsNumber = new t.Type(
- 'DefaultMaxSignals',
- t.number.is,
- (input, context): Either => {
- return input == null ? t.success(DEFAULT_MAX_SIGNALS) : max_signals.validate(input, context);
- },
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_page/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_page/index.test.ts
deleted file mode 100644
index 5af986fefe8d..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_page/index.test.ts
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { DefaultPage } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_page', () => {
- test('it should validate a regular number greater than zero', () => {
- const payload = 5;
- const decoded = DefaultPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate a string of a number', () => {
- const payload = '5';
- const decoded = DefaultPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(5);
- });
-
- test('it should not validate a junk string', () => {
- const payload = 'invalid-string';
- const decoded = DefaultPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "NaN" supplied to "DefaultPerPage"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should not validate an empty string', () => {
- const payload = '';
- const decoded = DefaultPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "NaN" supplied to "DefaultPerPage"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should not validate a zero', () => {
- const payload = 0;
- const decoded = DefaultPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "0" supplied to "DefaultPerPage"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should not validate a negative number', () => {
- const payload = -1;
- const decoded = DefaultPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "-1" supplied to "DefaultPerPage"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default of 20', () => {
- const payload = null;
- const decoded = DefaultPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(1);
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_page/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_page/index.ts
deleted file mode 100644
index 8486c516aebf..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_page/index.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { PositiveIntegerGreaterThanZero } from '@kbn/securitysolution-io-ts-types';
-
-/**
- * Types the DefaultPerPage as:
- * - If a string this will convert the string to a number
- * - If null or undefined, then a default of 1 will be used
- * - If the number is 0 or less this will not validate as it has to be a positive number greater than zero
- */
-export const DefaultPage = new t.Type(
- 'DefaultPerPage',
- t.number.is,
- (input, context): Either => {
- if (input == null) {
- return t.success(1);
- } else if (typeof input === 'string') {
- return PositiveIntegerGreaterThanZero.validate(parseInt(input, 10), context);
- } else {
- return PositiveIntegerGreaterThanZero.validate(input, context);
- }
- },
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_per_page/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_per_page/index.test.ts
deleted file mode 100644
index 78fa2a9be8c8..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_per_page/index.test.ts
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { DefaultPerPage } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_per_page', () => {
- test('it should validate a regular number greater than zero', () => {
- const payload = 5;
- const decoded = DefaultPerPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate a string of a number', () => {
- const payload = '5';
- const decoded = DefaultPerPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(5);
- });
-
- test('it should not validate a junk string', () => {
- const payload = 'invalid-string';
- const decoded = DefaultPerPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "NaN" supplied to "DefaultPerPage"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should not validate an empty string', () => {
- const payload = '';
- const decoded = DefaultPerPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "NaN" supplied to "DefaultPerPage"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should not validate a zero', () => {
- const payload = 0;
- const decoded = DefaultPerPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "0" supplied to "DefaultPerPage"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should not validate a negative number', () => {
- const payload = -1;
- const decoded = DefaultPerPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "-1" supplied to "DefaultPerPage"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default of 20', () => {
- const payload = null;
- const decoded = DefaultPerPage.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(20);
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_per_page/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_per_page/index.ts
deleted file mode 100644
index 4f272fc0517e..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_per_page/index.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { PositiveIntegerGreaterThanZero } from '@kbn/securitysolution-io-ts-types';
-
-/**
- * Types the DefaultPerPage as:
- * - If a string this will convert the string to a number
- * - If null or undefined, then a default of 20 will be used
- * - If the number is 0 or less this will not validate as it has to be a positive number greater than zero
- */
-export const DefaultPerPage = new t.Type(
- 'DefaultPerPage',
- t.number.is,
- (input, context): Either => {
- if (input == null) {
- return t.success(20);
- } else if (typeof input === 'string') {
- return PositiveIntegerGreaterThanZero.validate(parseInt(input, 10), context);
- } else {
- return PositiveIntegerGreaterThanZero.validate(input, context);
- }
- },
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_risk_score_mapping_array/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_risk_score_mapping_array/index.ts
deleted file mode 100644
index 9eb6938bcfcb..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_risk_score_mapping_array/index.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { RiskScoreMapping } from '../risk_score_mapping';
-
-/**
- * Types the DefaultStringArray as:
- * - If null or undefined, then a default RiskScoreMapping array will be set
- */
-export const DefaultRiskScoreMappingArray = new t.Type<
- RiskScoreMapping,
- RiskScoreMapping | undefined,
- unknown
->(
- 'DefaultRiskScoreMappingArray',
- RiskScoreMapping.is,
- (input, context): Either =>
- input == null ? t.success([]) : RiskScoreMapping.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_severity_mapping_array/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_severity_mapping_array/index.ts
deleted file mode 100644
index ac72e3330f2a..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_severity_mapping_array/index.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { SeverityMapping } from '../severity_mapping';
-
-/**
- * Types the DefaultStringArray as:
- * - If null or undefined, then a default SeverityMapping array will be set
- */
-export const DefaultSeverityMappingArray = new t.Type<
- SeverityMapping,
- SeverityMapping | undefined,
- unknown
->(
- 'DefaultSeverityMappingArray',
- SeverityMapping.is,
- (input, context): Either =>
- input == null ? t.success([]) : SeverityMapping.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_threat_array/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_threat_array/index.test.ts
deleted file mode 100644
index ebd1ca9384b1..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_threat_array/index.test.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { Threats } from '../threat';
-import { DefaultThreatArray } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_threat_null', () => {
- test('it should validate an empty array', () => {
- const payload: Threats = [];
- const decoded = DefaultThreatArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array of threats', () => {
- const payload: Threats = [
- {
- framework: 'MITRE ATTACK',
- technique: [{ reference: 'https://test.com', name: 'Audio Capture', id: 'T1123' }],
- tactic: { reference: 'https://test.com', name: 'Collection', id: 'TA000999' },
- },
- ];
- const decoded = DefaultThreatArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should not validate an array with a number', () => {
- const payload = [
- {
- framework: 'MITRE ATTACK',
- technique: [{ reference: 'https://test.com', name: 'Audio Capture', id: 'T1123' }],
- tactic: { reference: 'https://test.com', name: 'Collection', id: 'TA000999' },
- },
- 5,
- ];
- const decoded = DefaultThreatArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "5" supplied to "DefaultThreatArray"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default empty array if not provided a value', () => {
- const payload = null;
- const decoded = DefaultThreatArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual([]);
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_threat_array/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_threat_array/index.ts
deleted file mode 100644
index bb38b6382230..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_threat_array/index.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { threats, Threats } from '../threat';
-
-/**
- * Types the DefaultThreatArray as:
- * - If null or undefined, then an empty array will be set
- */
-export const DefaultThreatArray = new t.Type(
- 'DefaultThreatArray',
- threats.is,
- (input, context): Either =>
- input == null ? t.success([]) : threats.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_to_string/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_to_string/index.test.ts
deleted file mode 100644
index e8bcdcc664cf..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_to_string/index.test.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { DefaultToString } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_to_string', () => {
- test('it should validate a to string', () => {
- const payload = 'now-5m';
- const decoded = DefaultToString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should not validate a number', () => {
- const payload = 5;
- const decoded = DefaultToString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "5" supplied to "DefaultToString"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default of "now"', () => {
- const payload = null;
- const decoded = DefaultToString.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual('now');
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_to_string/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_to_string/index.ts
deleted file mode 100644
index 4074cc3bbbe9..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_to_string/index.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-
-/**
- * Types the DefaultToString as:
- * - If null or undefined, then a default of the string "now" will be used
- */
-export const DefaultToString = new t.Type(
- 'DefaultToString',
- t.string.is,
- (input, context): Either =>
- input == null ? t.success('now') : t.string.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_uuid/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/default_uuid/index.ts
deleted file mode 100644
index 4144b4e6824c..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/default_uuid/index.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { v4 as uuidv4 } from 'uuid';
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-
-/**
- * Types the DefaultUuid as:
- * - If null or undefined, then a default string uuidv4() will be
- * created otherwise it will be checked just against an empty string
- */
-export const DefaultUuid = new t.Type(
- 'DefaultUuid',
- t.string.is,
- (input, context): Either =>
- input == null ? t.success(uuidv4()) : NonEmptyString.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/frequency/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/frequency/index.ts
deleted file mode 100644
index 0247bfb155f3..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/frequency/index.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-import { RuleActionThrottle } from '../throttle';
-
-/**
- * Action summary indicates whether we will send a summary notification about all the generate alerts or notification per individual alert
- */
-export type RuleActionSummary = t.TypeOf;
-export const RuleActionSummary = t.boolean;
-
-/**
- * The condition for throttling the notification: `onActionGroupChange`, `onActiveAlert`, or `onThrottleInterval`
- */
-export type RuleActionNotifyWhen = t.TypeOf;
-export const RuleActionNotifyWhen = t.union([
- t.literal('onActionGroupChange'),
- t.literal('onActiveAlert'),
- t.literal('onThrottleInterval'),
-]);
-
-/**
- * The action frequency defines when the action runs (for example, only on rule execution or at specific time intervals).
- */
-export type RuleActionFrequency = t.TypeOf;
-export const RuleActionFrequency = t.type({
- summary: RuleActionSummary,
- notifyWhen: RuleActionNotifyWhen,
- throttle: t.union([RuleActionThrottle, t.null]),
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/from/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/from/index.ts
deleted file mode 100644
index 390649416273..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/from/index.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { Either } from 'fp-ts/lib/Either';
-import * as t from 'io-ts';
-import { parseScheduleDates } from '@kbn/securitysolution-io-ts-utils';
-
-const stringValidator = (input: unknown): input is string => typeof input === 'string';
-
-export type From = t.TypeOf;
-export const From = new t.Type(
- 'From',
- t.string.is,
- (input, context): Either => {
- if (stringValidator(input) && parseScheduleDates(input) == null) {
- return t.failure(input, context, 'Failed to parse "from" on rule param');
- }
- return t.string.validate(input, context);
- },
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/language/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/language/index.ts
deleted file mode 100644
index 95017209b2c6..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/language/index.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-export const language = t.keyof({ eql: null, kuery: null, lucene: null, esql: null });
-export type Language = t.TypeOf;
-
-export const languageOrUndefined = t.union([language, t.undefined]);
-export type LanguageOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/machine_learning_job_id/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/machine_learning_job_id/index.ts
deleted file mode 100644
index 00dc70eb5575..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/machine_learning_job_id/index.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-
-import { machine_learning_job_id_normalized } from '../normalized_ml_job_id';
-
-export const machine_learning_job_id = t.union([t.string, machine_learning_job_id_normalized]);
-export type MachineLearningJobId = t.TypeOf;
-
-export const machineLearningJobIdOrUndefined = t.union([machine_learning_job_id, t.undefined]);
-export type MachineLearningJobIdOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/max_signals/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/max_signals/index.ts
deleted file mode 100644
index aa8bdf6f539a..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/max_signals/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-import { PositiveIntegerGreaterThanZero } from '@kbn/securitysolution-io-ts-types';
-
-export const max_signals = PositiveIntegerGreaterThanZero;
-export type MaxSignals = t.TypeOf;
-
-export const maxSignalsOrUndefined = t.union([max_signals, t.undefined]);
-export type MaxSignalsOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/normalized_ml_job_id/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/normalized_ml_job_id/index.ts
deleted file mode 100644
index 2d89147c4fa1..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/normalized_ml_job_id/index.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-
-import { NonEmptyArray } from '@kbn/securitysolution-io-ts-types';
-
-export const machine_learning_job_id_normalized = NonEmptyArray(t.string);
-export type MachineLearningJobIdNormalized = t.TypeOf;
-
-export const machineLearningJobIdNormalizedOrUndefined = t.union([
- machine_learning_job_id_normalized,
- t.undefined,
-]);
-export type MachineLearningJobIdNormalizedOrUndefined = t.TypeOf<
- typeof machineLearningJobIdNormalizedOrUndefined
->;
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/references_default_array/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/references_default_array/index.test.ts
deleted file mode 100644
index 7b6146a320d6..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/references_default_array/index.test.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { ReferencesDefaultArray } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_string_array', () => {
- test('it should validate an empty array', () => {
- const payload: string[] = [];
- const decoded = ReferencesDefaultArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array of strings', () => {
- const payload = ['value 1', 'value 2'];
- const decoded = ReferencesDefaultArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should not validate an array with a number', () => {
- const payload = ['value 1', 5];
- const decoded = ReferencesDefaultArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "5" supplied to "referencesWithDefaultArray"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default array entry', () => {
- const payload = null;
- const decoded = ReferencesDefaultArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual([]);
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/references_default_array/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/references_default_array/index.ts
deleted file mode 100644
index fcf22ad918c9..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/references_default_array/index.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-
-/**
- * Types the ReferencesDefaultArray as:
- * - If null or undefined, then a default array will be set
- */
-export const ReferencesDefaultArray = new t.Type(
- 'referencesWithDefaultArray',
- t.array(t.string).is,
- (input, context): Either =>
- input == null ? t.success([]) : t.array(t.string).validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/risk_score/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/risk_score/index.test.ts
deleted file mode 100644
index 85d83d0ec77d..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/risk_score/index.test.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { RiskScore } from '.';
-
-describe('risk_score', () => {
- test('it should validate a positive number', () => {
- const payload = 1;
- const decoded = RiskScore.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate a zero', () => {
- const payload = 0;
- const decoded = RiskScore.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should NOT validate a negative number', () => {
- const payload = -1;
- const decoded = RiskScore.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "-1" supplied to "RiskScore"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should NOT validate a string', () => {
- const payload = 'some string';
- const decoded = RiskScore.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "some string" supplied to "RiskScore"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should NOT validate a risk score greater than 100', () => {
- const payload = 101;
- const decoded = RiskScore.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "101" supplied to "RiskScore"']);
- expect(message.schema).toEqual({});
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/risk_score/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/risk_score/index.ts
deleted file mode 100644
index ecc48e9a699d..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/risk_score/index.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-
-/**
- * Types the risk score as:
- * - Natural Number (positive integer and not a float),
- * - Between the values [0 and 100] inclusive.
- */
-export type RiskScore = t.TypeOf;
-export const RiskScore = new t.Type(
- 'RiskScore',
- t.number.is,
- (input, context): Either => {
- return typeof input === 'number' && Number.isSafeInteger(input) && input >= 0 && input <= 100
- ? t.success(input)
- : t.failure(input, context);
- },
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/risk_score_mapping/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/risk_score_mapping/index.ts
deleted file mode 100644
index 59f7c7ab69fb..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/risk_score_mapping/index.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { operator } from '@kbn/securitysolution-io-ts-types';
-import { RiskScore } from '../risk_score';
-
-export type RiskScoreMappingItem = t.TypeOf;
-export const RiskScoreMappingItem = t.exact(
- t.type({
- field: t.string,
- value: t.string,
- operator,
- risk_score: t.union([RiskScore, t.undefined]),
- })
-);
-
-export type RiskScoreMapping = t.TypeOf;
-export const RiskScoreMapping = t.array(RiskScoreMappingItem);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/rule_schedule/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/rule_schedule/index.ts
deleted file mode 100644
index 4d0113f330ae..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/rule_schedule/index.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { From } from '../from';
-
-export type RuleInterval = t.TypeOf;
-export const RuleInterval = t.string; // we need a more specific schema
-
-export type RuleIntervalFrom = t.TypeOf;
-export const RuleIntervalFrom = From;
-
-/**
- * TODO: Create a regular expression type or custom date math part type here
- */
-export type RuleIntervalTo = t.TypeOf;
-export const RuleIntervalTo = t.string; // we need a more specific schema
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/saved_object_attributes/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/saved_object_attributes/index.ts
deleted file mode 100644
index 2a7af4e66518..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/saved_object_attributes/index.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-
-/**
- * TODO: This type are originally from "src/core/types/saved_objects.ts", once that is package friendly remove
- * this copied type.
- *
- * Don't use this type, it's simply a helper type for {@link SavedObjectAttribute}
- *
- * @public
- */
-export type SavedObjectAttributeSingle =
- | string
- | number
- | boolean
- | null
- | undefined
- | SavedObjectAttributes;
-
-/**
- * TODO: This type are originally from "src/core/types/saved_objects.ts", once that is package friendly remove
- * this copied type.
- *
- * Type definition for a Saved Object attribute value
- *
- * @public
- */
-export type SavedObjectAttribute = SavedObjectAttributeSingle | SavedObjectAttributeSingle[];
-
-/**
- * TODO: This type are originally from "src/core/types/saved_objects.ts", once that is package friendly remove
- * this copied type.
- *
- * The data for a Saved Object is stored as an object in the `attributes`
- * property.
- *
- * @public
- */
-export interface SavedObjectAttributes {
- [key: string]: SavedObjectAttribute;
-}
-
-export const saved_object_attribute_single: t.Type = t.recursion(
- 'saved_object_attribute_single',
- () => t.union([t.string, t.number, t.boolean, t.null, t.undefined, saved_object_attributes])
-);
-export const saved_object_attribute: t.Type = t.recursion(
- 'saved_object_attribute',
- () => t.union([saved_object_attribute_single, t.array(saved_object_attribute_single)])
-);
-export const saved_object_attributes: t.Type = t.recursion(
- 'saved_object_attributes',
- () => t.record(t.string, saved_object_attribute)
-);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/severity/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/severity/index.ts
deleted file mode 100644
index fef1082129df..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/severity/index.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-export type Severity = t.TypeOf;
-export const Severity = t.keyof({ low: null, medium: null, high: null, critical: null });
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/severity_mapping/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/severity_mapping/index.ts
deleted file mode 100644
index afd7889658a3..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/severity_mapping/index.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-import { operator } from '@kbn/securitysolution-io-ts-types';
-import { Severity } from '../severity';
-
-export type SeverityMappingItem = t.TypeOf;
-export const SeverityMappingItem = t.exact(
- t.type({
- field: t.string,
- operator,
- value: t.string,
- severity: Severity,
- })
-);
-
-export type SeverityMapping = t.TypeOf;
-export const SeverityMapping = t.array(SeverityMappingItem);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/threat/index.ts
deleted file mode 100644
index e60f9ccafcc1..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat/index.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-import { threat_tactic } from '../threat_tactic';
-import { threat_techniques } from '../threat_technique';
-
-export const threat_framework = t.string;
-
-export const threat = t.intersection([
- t.exact(
- t.type({
- framework: threat_framework,
- tactic: threat_tactic,
- })
- ),
- t.exact(
- t.partial({
- technique: threat_techniques,
- })
- ),
-]);
-
-export type Threat = t.TypeOf;
-
-export const threats = t.array(threat);
-export type Threats = t.TypeOf;
-
-export const threatsOrUndefined = t.union([threats, t.undefined]);
-export type ThreatsOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.test.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.test.ts
deleted file mode 100644
index 3d3e1ab9a22b..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.test.ts
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import {
- concurrent_searches,
- items_per_search,
- ThreatMapping,
- threatMappingEntries,
- ThreatMappingEntries,
- threat_mapping,
-} from '.';
-import { foldLeftRight, getPaths, exactCheck } from '@kbn/securitysolution-io-ts-utils';
-
-describe('threat_mapping', () => {
- describe('threatMappingEntries', () => {
- test('it should validate an entry', () => {
- const payload: ThreatMappingEntries = [
- {
- field: 'field.one',
- type: 'mapping',
- value: 'field.one',
- },
- ];
- const decoded = threatMappingEntries.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should fail validation with an extra entry item', () => {
- const payload: Array = [
- {
- field: 'field.one',
- type: 'mapping',
- value: 'field.one',
- extra: 'blah',
- },
- ];
- const decoded = threatMappingEntries.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['invalid keys "extra"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validation with a non string', () => {
- const payload = [
- {
- field: 5,
- type: 'mapping',
- value: 'field.one',
- },
- ] as unknown as ThreatMappingEntries[];
- const decoded = threatMappingEntries.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "5" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validation with a wrong type', () => {
- const payload = [
- {
- field: 'field.one',
- type: 'invalid',
- value: 'field.one',
- },
- ] as unknown as ThreatMappingEntries[];
- const decoded = threatMappingEntries.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "invalid" supplied to "type"',
- ]);
- expect(message.schema).toEqual({});
- });
- });
-
- describe('threat_mapping', () => {
- test('it should validate a threat mapping', () => {
- const payload: ThreatMapping = [
- {
- entries: [
- {
- field: 'field.one',
- type: 'mapping',
- value: 'field.one',
- },
- ],
- },
- ];
- const decoded = threat_mapping.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
- });
-
- test('it should fail validate with an extra key', () => {
- const payload: Array = [
- {
- entries: [
- {
- field: 'field.one',
- type: 'mapping',
- value: 'field.one',
- },
- ],
- extra: 'invalid',
- },
- ];
-
- const decoded = threat_mapping.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['invalid keys "extra"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validate with an extra inner entry', () => {
- const payload: Array }> = [
- {
- entries: [
- {
- field: 'field.one',
- type: 'mapping',
- value: 'field.one',
- extra: 'blah',
- },
- ],
- },
- ];
-
- const decoded = threat_mapping.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['invalid keys "extra"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validate with an extra inner entry with the wrong data type', () => {
- const payload = [
- {
- entries: [
- {
- field: 5,
- type: 'mapping',
- value: 'field.one',
- },
- ],
- },
- ] as unknown as ThreatMapping;
-
- const decoded = threat_mapping.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "5" supplied to "entries,field"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validate with empty array', () => {
- const payload: string[] = [];
-
- const decoded = threat_mapping.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "[]" supplied to "NonEmptyArray"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validation when concurrent_searches is < 0', () => {
- const payload = -1;
- const decoded = concurrent_searches.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "-1" supplied to "PositiveIntegerGreaterThanZero"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validation when concurrent_searches is 0', () => {
- const payload = 0;
- const decoded = concurrent_searches.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "0" supplied to "PositiveIntegerGreaterThanZero"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validation when items_per_search is 0', () => {
- const payload = 0;
- const decoded = items_per_search.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "0" supplied to "PositiveIntegerGreaterThanZero"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validation when items_per_search is < 0', () => {
- const payload = -1;
- const decoded = items_per_search.decode(payload);
- const checked = exactCheck(payload, decoded);
- const message = pipe(checked, foldLeftRight);
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "-1" supplied to "PositiveIntegerGreaterThanZero"',
- ]);
- expect(message.schema).toEqual({});
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.ts
deleted file mode 100644
index 0cc8c950f754..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_mapping/index.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-import {
- NonEmptyArray,
- NonEmptyString,
- PositiveIntegerGreaterThanZero,
-} from '@kbn/securitysolution-io-ts-types';
-import { language } from '../language';
-
-export const threat_query = t.string;
-export type ThreatQuery = t.TypeOf;
-export const threatQueryOrUndefined = t.union([threat_query, t.undefined]);
-export type ThreatQueryOrUndefined = t.TypeOf;
-
-export const threat_indicator_path = t.string;
-export type ThreatIndicatorPath = t.TypeOf;
-export const threatIndicatorPathOrUndefined = t.union([threat_indicator_path, t.undefined]);
-export type ThreatIndicatorPathOrUndefined = t.TypeOf;
-
-export const threat_filters = t.array(t.unknown); // Filters are not easily type-able yet
-export type ThreatFilters = t.TypeOf;
-export const threatFiltersOrUndefined = t.union([threat_filters, t.undefined]);
-export type ThreatFiltersOrUndefined = t.TypeOf;
-
-export const threatMapEntry = t.exact(
- t.type({
- field: NonEmptyString,
- type: t.keyof({ mapping: null }),
- value: NonEmptyString,
- })
-);
-
-export type ThreatMapEntry = t.TypeOf;
-
-export const threatMappingEntries = t.array(threatMapEntry);
-export type ThreatMappingEntries = t.TypeOf;
-
-export const threatMap = t.exact(
- t.type({
- entries: threatMappingEntries,
- })
-);
-export type ThreatMap = t.TypeOf;
-
-export const threat_mapping = NonEmptyArray(threatMap, 'NonEmptyArray');
-export type ThreatMapping = t.TypeOf;
-
-export const threatMappingOrUndefined = t.union([threat_mapping, t.undefined]);
-export type ThreatMappingOrUndefined = t.TypeOf;
-
-export const threat_index = t.array(t.string);
-export type ThreatIndex = t.TypeOf;
-export const threatIndexOrUndefined = t.union([threat_index, t.undefined]);
-export type ThreatIndexOrUndefined = t.TypeOf;
-
-export const threat_language = t.union([language, t.undefined]);
-export type ThreatLanguage = t.TypeOf;
-export const threatLanguageOrUndefined = t.union([threat_language, t.undefined]);
-export type ThreatLanguageOrUndefined = t.TypeOf;
-
-export const concurrent_searches = PositiveIntegerGreaterThanZero;
-export type ConcurrentSearches = t.TypeOf;
-export const concurrentSearchesOrUndefined = t.union([concurrent_searches, t.undefined]);
-export type ConcurrentSearchesOrUndefined = t.TypeOf;
-
-export const items_per_search = PositiveIntegerGreaterThanZero;
-export type ItemsPerSearch = t.TypeOf;
-export const itemsPerSearchOrUndefined = t.union([items_per_search, t.undefined]);
-export type ItemsPerSearchOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_subtechnique/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_subtechnique/index.ts
deleted file mode 100644
index 963bf76bf5f8..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_subtechnique/index.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-
-export const threat_subtechnique_id = t.string;
-export const threat_subtechnique_name = t.string;
-export const threat_subtechnique_reference = t.string;
-
-export const threat_subtechnique = t.type({
- id: threat_subtechnique_id,
- name: threat_subtechnique_name,
- reference: threat_subtechnique_reference,
-});
-
-export const threat_subtechniques = t.array(threat_subtechnique);
-
-export type ThreatSubtechnique = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_tactic/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_tactic/index.ts
deleted file mode 100644
index a142788876e7..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_tactic/index.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-
-export const threat_tactic_id = t.string;
-export const threat_tactic_name = t.string;
-export const threat_tactic_reference = t.string;
-
-export const threat_tactic = t.type({
- id: threat_tactic_id,
- name: threat_tactic_name,
- reference: threat_tactic_reference,
-});
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_technique/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_technique/index.ts
deleted file mode 100644
index 2953ea86b3b3..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/threat_technique/index.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-import { threat_subtechniques } from '../threat_subtechnique';
-
-export const threat_technique_id = t.string;
-export const threat_technique_name = t.string;
-export const threat_technique_reference = t.string;
-
-export const threat_technique = t.intersection([
- t.exact(
- t.type({
- id: threat_technique_id,
- name: threat_technique_name,
- reference: threat_technique_reference,
- })
- ),
- t.exact(
- t.partial({
- subtechnique: threat_subtechniques,
- })
- ),
-]);
-export const threat_techniques = t.array(threat_technique);
-
-export type ThreatTechnique = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/throttle/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/throttle/index.ts
deleted file mode 100644
index f1d6bdca8fed..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/throttle/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { TimeDuration } from '@kbn/securitysolution-io-ts-types';
-
-export type RuleActionThrottle = t.TypeOf;
-export const RuleActionThrottle = t.union([
- t.literal('no_actions'),
- t.literal('rule'),
- TimeDuration({ allowedUnits: ['s', 'm', 'h', 'd'] }),
-]);
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/src/type/index.ts b/packages/kbn-securitysolution-io-ts-alerting-types/src/type/index.ts
deleted file mode 100644
index 68c7a2f30a2b..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/src/type/index.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-export const type = t.keyof({
- eql: null,
- machine_learning: null,
- query: null,
- saved_query: null,
- threshold: null,
- threat_match: null,
- new_terms: null,
- esql: null,
-});
-export type Type = t.TypeOf;
-
-export const typeOrUndefined = t.union([type, t.undefined]);
-export type TypeOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-alerting-types/tsconfig.json b/packages/kbn-securitysolution-io-ts-alerting-types/tsconfig.json
deleted file mode 100644
index f9fb0b0fcebb..000000000000
--- a/packages/kbn-securitysolution-io-ts-alerting-types/tsconfig.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "extends": "../../tsconfig.base.json",
- "compilerOptions": {
- "outDir": "target/types",
- "types": [
- "jest",
- "node"
- ]
- },
- "include": [
- "**/*.ts"
- ],
- "kbn_references": [
- "@kbn/securitysolution-io-ts-types",
- "@kbn/securitysolution-io-ts-utils"
- ],
- "exclude": [
- "target/**/*",
- ]
-}
diff --git a/packages/kbn-securitysolution-io-ts-list-types/index.ts b/packages/kbn-securitysolution-io-ts-list-types/index.ts
deleted file mode 100644
index 6d6b4e241b6d..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/index.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export * from './src/common';
-export * from './src/request';
-export * from './src/response';
-export * from './src/typescript_types';
diff --git a/packages/kbn-securitysolution-io-ts-list-types/jest.config.js b/packages/kbn-securitysolution-io-ts-list-types/jest.config.js
deleted file mode 100644
index adcf48629dd7..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/jest.config.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-module.exports = {
- preset: '@kbn/test',
- rootDir: '../..',
- roots: ['/packages/kbn-securitysolution-io-ts-list-types'],
-};
diff --git a/packages/kbn-securitysolution-io-ts-list-types/package.json b/packages/kbn-securitysolution-io-ts-list-types/package.json
deleted file mode 100644
index 50c88fb22054..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "@kbn/securitysolution-io-ts-list-types",
- "version": "1.0.0",
- "description": "io ts utilities and types to be shared with plugins from the security solution project",
- "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
- "private": true,
- "sideEffects": false
-}
\ No newline at end of file
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/comment/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/comment/index.mock.ts
deleted file mode 100644
index d824f23fe74b..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/comment/index.mock.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { Comment, CommentsArray } from '.';
-import { DATE_NOW, ID, USER } from '../../constants/index.mock';
-
-export const getCommentsMock = (): Comment => ({
- comment: 'some old comment',
- created_at: DATE_NOW,
- created_by: USER,
- id: ID,
-});
-
-export const getCommentsArrayMock = (): CommentsArray => [getCommentsMock(), getCommentsMock()];
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/comment/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/comment/index.test.ts
deleted file mode 100644
index deca11f809cb..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/comment/index.test.ts
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getCommentsArrayMock, getCommentsMock } from './index.mock';
-import {
- Comment,
- comment,
- CommentsArray,
- commentsArray,
- CommentsArrayOrUndefined,
- commentsArrayOrUndefined,
-} from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { DATE_NOW } from '../../constants/index.mock';
-
-describe('Comment', () => {
- describe('comment', () => {
- test('it fails validation when "id" is undefined', () => {
- const payload = { ...getCommentsMock(), id: undefined };
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "undefined" supplied to "id"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it passes validation with a typical comment', () => {
- const payload = getCommentsMock();
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it passes validation with "updated_at" and "updated_by" fields included', () => {
- const payload = getCommentsMock();
- payload.updated_at = DATE_NOW;
- payload.updated_by = 'someone';
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it fails validation when undefined', () => {
- const payload = undefined;
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "undefined" supplied to "({| comment: NonEmptyString, created_at: string, created_by: string, id: NonEmptyString |} & Partial<{| updated_at: string, updated_by: string |}>)"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it fails validation when "comment" is an empty string', () => {
- const payload: Omit & { comment: string } = {
- ...getCommentsMock(),
- comment: '',
- };
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "comment"']);
- expect(message.schema).toEqual({});
- });
-
- test('it fails validation when "comment" is not a string', () => {
- const payload: Omit & { comment: string[] } = {
- ...getCommentsMock(),
- comment: ['some value'],
- };
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "["some value"]" supplied to "comment"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it fails validation when "created_at" is not a string', () => {
- const payload: Omit & { created_at: number } = {
- ...getCommentsMock(),
- created_at: 1,
- };
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "created_at"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it fails validation when "created_by" is not a string', () => {
- const payload: Omit & { created_by: number } = {
- ...getCommentsMock(),
- created_by: 1,
- };
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "created_by"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it fails validation when "updated_at" is not a string', () => {
- const payload: Omit & { updated_at: number } = {
- ...getCommentsMock(),
- updated_at: 1,
- };
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "updated_at"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it fails validation when "updated_by" is not a string', () => {
- const payload: Omit & { updated_by: number } = {
- ...getCommentsMock(),
- updated_by: 1,
- };
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "updated_by"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: Comment & {
- extraKey?: string;
- } = getCommentsMock();
- payload.extraKey = 'some value';
- const decoded = comment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getCommentsMock());
- });
- });
-
- describe('commentsArray', () => {
- test('it passes validation an array of Comment', () => {
- const payload = getCommentsArrayMock();
- const decoded = commentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it passes validation when a Comment includes "updated_at" and "updated_by"', () => {
- const commentsPayload = getCommentsMock();
- commentsPayload.updated_at = DATE_NOW;
- commentsPayload.updated_by = 'someone';
- const payload = [{ ...commentsPayload }, ...getCommentsArrayMock()];
- const decoded = commentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it fails validation when undefined', () => {
- const payload = undefined;
- const decoded = commentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "undefined" supplied to "Array<({| comment: NonEmptyString, created_at: string, created_by: string, id: NonEmptyString |} & Partial<{| updated_at: string, updated_by: string |}>)>"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it fails validation when array includes non Comment types', () => {
- const payload = [1] as unknown as CommentsArray;
- const decoded = commentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "Array<({| comment: NonEmptyString, created_at: string, created_by: string, id: NonEmptyString |} & Partial<{| updated_at: string, updated_by: string |}>)>"',
- ]);
- expect(message.schema).toEqual({});
- });
- });
-
- describe('commentsArrayOrUndefined', () => {
- test('it passes validation an array of Comment', () => {
- const payload = getCommentsArrayMock();
- const decoded = commentsArrayOrUndefined.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it passes validation when undefined', () => {
- const payload = undefined;
- const decoded = commentsArrayOrUndefined.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it fails validation when array includes non Comment types', () => {
- const payload = [1] as unknown as CommentsArrayOrUndefined;
- const decoded = commentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "Array<({| comment: NonEmptyString, created_at: string, created_by: string, id: NonEmptyString |} & Partial<{| updated_at: string, updated_by: string |}>)>"',
- ]);
- expect(message.schema).toEqual({});
- });
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/comment/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/comment/index.ts
deleted file mode 100644
index 3aac99e6c48e..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/comment/index.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-import { created_at } from '../created_at';
-import { created_by } from '../created_by';
-import { id } from '../id';
-import { updated_at } from '../updated_at';
-import { updated_by } from '../updated_by';
-
-export const comment = t.intersection([
- t.exact(
- t.type({
- comment: NonEmptyString,
- created_at,
- created_by,
- id,
- })
- ),
- t.exact(
- t.partial({
- updated_at,
- updated_by,
- })
- ),
-]);
-
-export const commentsArray = t.array(comment);
-export type CommentsArray = t.TypeOf;
-export type Comment = t.TypeOf;
-export const commentsArrayOrUndefined = t.union([commentsArray, t.undefined]);
-export type CommentsArrayOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/create_comment/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/create_comment/index.mock.ts
deleted file mode 100644
index bad427de9747..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/create_comment/index.mock.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { CreateComment, CreateCommentsArray } from '.';
-
-export const getCreateCommentsMock = (): CreateComment => ({
- comment: 'some comments',
-});
-
-export const getCreateCommentsArrayMock = (): CreateCommentsArray => [getCreateCommentsMock()];
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/create_comment/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/create_comment/index.test.ts
deleted file mode 100644
index c537e9e28091..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/create_comment/index.test.ts
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getCreateCommentsArrayMock, getCreateCommentsMock } from './index.mock';
-import {
- CreateComment,
- createComment,
- CreateCommentsArray,
- createCommentsArray,
- CreateCommentsArrayOrUndefined,
- createCommentsArrayOrUndefined,
-} from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('CreateComment', () => {
- describe('createComment', () => {
- test('it passes validation with a default comment', () => {
- const payload = getCreateCommentsMock();
- const decoded = createComment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it fails validation when undefined', () => {
- const payload = undefined;
- const decoded = createComment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "undefined" supplied to "{| comment: NonEmptyString |}"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it fails validation when "comment" is not a string', () => {
- const payload: Omit & { comment: string[] } = {
- ...getCreateCommentsMock(),
- comment: ['some value'],
- };
- const decoded = createComment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "["some value"]" supplied to "comment"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: CreateComment & {
- extraKey?: string;
- } = getCreateCommentsMock();
- payload.extraKey = 'some value';
- const decoded = createComment.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getCreateCommentsMock());
- });
- });
-
- describe('createCommentsArray', () => {
- test('it passes validation an array of comments', () => {
- const payload = getCreateCommentsArrayMock();
- const decoded = createCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it fails validation when undefined', () => {
- const payload = undefined;
- const decoded = createCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "undefined" supplied to "Array<{| comment: NonEmptyString |}>"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it fails validation when array includes non comments types', () => {
- const payload = [1] as unknown as CreateCommentsArray;
- const decoded = createCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "Array<{| comment: NonEmptyString |}>"',
- ]);
- expect(message.schema).toEqual({});
- });
- });
-
- describe('createCommentsArrayOrUndefined', () => {
- test('it passes validation an array of comments', () => {
- const payload = getCreateCommentsArrayMock();
- const decoded = createCommentsArrayOrUndefined.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it passes validation when undefined', () => {
- const payload = undefined;
- const decoded = createCommentsArrayOrUndefined.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it fails validation when array includes non comments types', () => {
- const payload = [1] as unknown as CreateCommentsArrayOrUndefined;
- const decoded = createCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "Array<{| comment: NonEmptyString |}>"',
- ]);
- expect(message.schema).toEqual({});
- });
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/create_comment/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/create_comment/index.ts
deleted file mode 100644
index f4082df289ac..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/create_comment/index.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-
-export const createComment = t.exact(
- t.type({
- comment: NonEmptyString,
- })
-);
-
-export type CreateComment = t.TypeOf;
-export const createCommentsArray = t.array(createComment);
-export type CreateCommentsArray = t.TypeOf;
-export type CreateComments = t.TypeOf;
-export const createCommentsArrayOrUndefined = t.union([createCommentsArray, t.undefined]);
-export type CreateCommentsArrayOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/created_at/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/created_at/index.ts
deleted file mode 100644
index 697a5034cbf0..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/created_at/index.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-
-export const created_at = t.string; // TODO: Make this into an ISO Date string check
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/created_by/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/created_by/index.ts
deleted file mode 100644
index e6f3e2f90edb..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/created_by/index.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-/* eslint-disable @typescript-eslint/naming-convention */
-
-import * as t from 'io-ts';
-
-export const created_by = t.string;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/cursor/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/cursor/index.ts
deleted file mode 100644
index 4844ffe7e364..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/cursor/index.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-export const cursor = t.string;
-export type Cursor = t.TypeOf;
-export const cursorOrUndefined = t.union([cursor, t.undefined]);
-export type CursorOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_comments_array/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_comments_array/index.test.ts
deleted file mode 100644
index d0c7e3cc0447..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_comments_array/index.test.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { CommentsArray } from '../comment';
-import { DefaultCommentsArray } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { getCommentsArrayMock } from '../comment/index.mock';
-
-describe('default_comments_array', () => {
- test('it should pass validation when supplied an empty array', () => {
- const payload: CommentsArray = [];
- const decoded = DefaultCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should pass validation when supplied an array of comments', () => {
- const payload: CommentsArray = getCommentsArrayMock();
- const decoded = DefaultCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should fail validation when supplied an array of numbers', () => {
- const payload = [1];
- const decoded = DefaultCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "Array<({| comment: NonEmptyString, created_at: string, created_by: string, id: NonEmptyString |} & Partial<{| updated_at: string, updated_by: string |}>)>"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validation when supplied an array of strings', () => {
- const payload = ['some string'];
- const decoded = DefaultCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "some string" supplied to "Array<({| comment: NonEmptyString, created_at: string, created_by: string, id: NonEmptyString |} & Partial<{| updated_at: string, updated_by: string |}>)>"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default array entry', () => {
- const payload = null;
- const decoded = DefaultCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual([]);
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_comments_array/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_comments_array/index.ts
deleted file mode 100644
index 6a89b0063351..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_comments_array/index.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { comment, CommentsArray } from '../comment';
-
-/**
- * Types the DefaultCommentsArray as:
- * - If null or undefined, then a default array of type entry will be set
- */
-export const DefaultCommentsArray = new t.Type(
- 'DefaultCommentsArray',
- t.array(comment).is,
- (input): Either =>
- input == null ? t.success([]) : t.array(comment).decode(input),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_create_comments_array/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_create_comments_array/index.test.ts
deleted file mode 100644
index ce909c0314b3..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_create_comments_array/index.test.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { CommentsArray } from '../comment';
-import { DefaultCommentsArray } from '../default_comments_array';
-import { getCommentsArrayMock } from '../comment/index.mock';
-
-describe('default_comments_array', () => {
- test('it should pass validation when supplied an empty array', () => {
- const payload: CommentsArray = [];
- const decoded = DefaultCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should pass validation when supplied an array of comments', () => {
- const payload: CommentsArray = getCommentsArrayMock();
- const decoded = DefaultCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should fail validation when supplied an array of numbers', () => {
- const payload = [1];
- const decoded = DefaultCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "Array<({| comment: NonEmptyString, created_at: string, created_by: string, id: NonEmptyString |} & Partial<{| updated_at: string, updated_by: string |}>)>"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validation when supplied an array of strings', () => {
- const payload = ['some string'];
- const decoded = DefaultCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "some string" supplied to "Array<({| comment: NonEmptyString, created_at: string, created_by: string, id: NonEmptyString |} & Partial<{| updated_at: string, updated_by: string |}>)>"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default array entry', () => {
- const payload = null;
- const decoded = DefaultCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual([]);
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_create_comments_array/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_create_comments_array/index.ts
deleted file mode 100644
index 0ed345891719..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_create_comments_array/index.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { createComment, CreateCommentsArray } from '../create_comment';
-
-/**
- * Types the DefaultCreateComments as:
- * - If null or undefined, then a default array of type entry will be set
- */
-export const DefaultCreateCommentsArray = new t.Type<
- CreateCommentsArray,
- CreateCommentsArray,
- unknown
->(
- 'DefaultCreateComments',
- t.array(createComment).is,
- (input): Either =>
- input == null ? t.success([]) : t.array(createComment).decode(input),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_import_comments_array/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_import_comments_array/index.test.ts
deleted file mode 100644
index 9b6f8df6850c..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_import_comments_array/index.test.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { ImportCommentsArray } from '../import_comment';
-import { DefaultImportCommentsArray } from '.';
-import { getCommentsArrayMock } from '../comment/index.mock';
-import { getCreateCommentsArrayMock } from '../create_comment/index.mock';
-
-describe('default_import_comments_array', () => {
- test('it should pass validation when supplied an empty array', () => {
- const payload: ImportCommentsArray = [];
- const decoded = DefaultImportCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should pass validation when supplied an array of comments', () => {
- const payload: ImportCommentsArray = getCommentsArrayMock();
- const decoded = DefaultImportCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should pass validation when supplied an array of new comments', () => {
- const payload: ImportCommentsArray = getCreateCommentsArrayMock();
- const decoded = DefaultImportCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should pass validation when supplied an array of new and existing comments', () => {
- const payload: ImportCommentsArray = [
- ...getCommentsArrayMock(),
- ...getCreateCommentsArrayMock(),
- ];
- const decoded = DefaultImportCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should fail validation when supplied an array of numbers', () => {
- const payload = [1];
- const decoded = DefaultImportCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "DefaultImportComments"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validation when supplied an array of strings', () => {
- const payload = ['some string'];
- const decoded = DefaultImportCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "some string" supplied to "DefaultImportComments"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default array entry', () => {
- const payload = null;
- const decoded = DefaultImportCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual([]);
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_import_comments_array/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_import_comments_array/index.ts
deleted file mode 100644
index dc8d18e7e11e..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_import_comments_array/index.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { importComment, ImportCommentsArray } from '../import_comment';
-
-/**
- * Types the DefaultImportCommentsArray as:
- * - If null or undefined, then a default array of type ImportCommentsArray will be set
- */
-export const DefaultImportCommentsArray = new t.Type<
- ImportCommentsArray,
- ImportCommentsArray,
- unknown
->(
- 'DefaultImportComments',
- t.array(importComment).is,
- (input, context): Either =>
- input == null ? t.success([]) : t.array(importComment).validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace/index.test.ts
deleted file mode 100644
index 69cdd841c0a5..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace/index.test.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { DefaultNamespace } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_namespace', () => {
- test('it should validate "single"', () => {
- const payload = 'single';
- const decoded = DefaultNamespace.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate "agnostic"', () => {
- const payload = 'agnostic';
- const decoded = DefaultNamespace.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it defaults to "single" if "undefined"', () => {
- const payload = undefined;
- const decoded = DefaultNamespace.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual('single');
- });
-
- test('it defaults to "single" if "null"', () => {
- const payload = null;
- const decoded = DefaultNamespace.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual('single');
- });
-
- test('it should FAIL validation if not "single" or "agnostic"', () => {
- const payload = 'something else';
- const decoded = DefaultNamespace.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- `Invalid value "something else" supplied to "DefaultNamespace"`,
- ]);
- expect(message.schema).toEqual({});
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace/index.ts
deleted file mode 100644
index 33f53c55b198..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace/index.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-
-export const namespaceType = t.keyof({ agnostic: null, single: null });
-export type NamespaceType = t.TypeOf;
-
-/**
- * Types the DefaultNamespace as:
- * - If null or undefined, then a default string/enumeration of "single" will be used.
- */
-export const DefaultNamespace = new t.Type(
- 'DefaultNamespace',
- namespaceType.is,
- (input, context): Either =>
- input == null ? t.success('single') : namespaceType.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace_array/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace_array/index.test.ts
deleted file mode 100644
index 359674e57041..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace_array/index.test.ts
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { DefaultNamespaceArray, DefaultNamespaceArrayType } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('default_namespace_array', () => {
- test('it should validate "null" single item as an array with a "single" value', () => {
- const payload: DefaultNamespaceArrayType = null;
- const decoded = DefaultNamespaceArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(['single']);
- });
-
- test('it should FAIL validation of numeric value', () => {
- const payload = 5;
- const decoded = DefaultNamespaceArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "5" supplied to "DefaultNamespaceArray"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should validate "undefined" item as an array with a "single" value', () => {
- const payload: DefaultNamespaceArrayType = undefined;
- const decoded = DefaultNamespaceArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(['single']);
- });
-
- test('it should validate "single" as an array of a "single" value', () => {
- const payload: DefaultNamespaceArrayType = 'single';
- const decoded = DefaultNamespaceArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual([payload]);
- });
-
- test('it should validate "agnostic" as an array of a "agnostic" value', () => {
- const payload: DefaultNamespaceArrayType = 'agnostic';
- const decoded = DefaultNamespaceArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual([payload]);
- });
-
- test('it should validate "single,agnostic" as an array of 2 values of ["single", "agnostic"] values', () => {
- const payload: DefaultNamespaceArrayType = 'agnostic,single';
- const decoded = DefaultNamespaceArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(['agnostic', 'single']);
- });
-
- test('it should validate 3 elements of "single,agnostic,single" as an array of 3 values of ["single", "agnostic", "single"] values', () => {
- const payload: DefaultNamespaceArrayType = 'single,agnostic,single';
- const decoded = DefaultNamespaceArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(['single', 'agnostic', 'single']);
- });
-
- test('it should validate 3 elements of "single,agnostic, single" as an array of 3 values of ["single", "agnostic", "single"] values when there are spaces', () => {
- const payload: DefaultNamespaceArrayType = ' single, agnostic, single ';
- const decoded = DefaultNamespaceArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(['single', 'agnostic', 'single']);
- });
-
- test('it should FAIL validation when given 3 elements of "single,agnostic,junk" since the 3rd value is junk', () => {
- const payload: DefaultNamespaceArrayType = 'single,agnostic,junk';
- const decoded = DefaultNamespaceArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "junk" supplied to "DefaultNamespaceArray"',
- ]);
- expect(message.schema).toEqual({});
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace_array/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace_array/index.ts
deleted file mode 100644
index 9692b8a2783d..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_namespace_array/index.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { namespaceType } from '../default_namespace';
-
-export const namespaceTypeArray = t.array(namespaceType);
-export type NamespaceTypeArray = t.TypeOf;
-
-/**
- * Types the DefaultNamespaceArray as:
- * - If null or undefined, then a default string array of "single" will be used.
- * - If it contains a string, then it is split along the commas and puts them into an array and validates it
- */
-export const DefaultNamespaceArray = new t.Type<
- NamespaceTypeArray,
- string | undefined | null,
- unknown
->(
- 'DefaultNamespaceArray',
- namespaceTypeArray.is,
- (input, context): Either => {
- if (input == null) {
- return t.success(['single']);
- } else if (typeof input === 'string') {
- const commaSeparatedValues = input
- .trim()
- .split(',')
- .map((value) => value.trim());
- return namespaceTypeArray.validate(commaSeparatedValues, context);
- }
- return t.failure(input, context);
- },
- String
-);
-
-export type DefaultNamespaceArrayType = t.OutputOf;
-export type DefaultNamespaceArrayTypeDecoded = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_update_comments_array/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_update_comments_array/index.test.ts
deleted file mode 100644
index aaffae53ceca..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_update_comments_array/index.test.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { UpdateCommentsArray } from '../update_comment';
-import { DefaultUpdateCommentsArray } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { getUpdateCommentsArrayMock } from '../update_comment/index.mock';
-
-describe('default_update_comments_array', () => {
- test('it should pass validation when supplied an empty array', () => {
- const payload: UpdateCommentsArray = [];
- const decoded = DefaultUpdateCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should pass validation when supplied an array of comments', () => {
- const payload: UpdateCommentsArray = getUpdateCommentsArrayMock();
- const decoded = DefaultUpdateCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should fail validation when supplied an array of numbers', () => {
- const payload = [1];
- const decoded = DefaultUpdateCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "1" supplied to "DefaultUpdateComments"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should fail validation when supplied an array of strings', () => {
- const payload = ['some string'];
- const decoded = DefaultUpdateCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "some string" supplied to "DefaultUpdateComments"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should return a default array entry', () => {
- const payload = null;
- const decoded = DefaultUpdateCommentsArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual([]);
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_update_comments_array/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/default_update_comments_array/index.ts
deleted file mode 100644
index 47c0e562133d..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/default_update_comments_array/index.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { updateCommentsArray, UpdateCommentsArray } from '../update_comment';
-
-/**
- * Types the DefaultUpdateComments as:
- * - If null or undefined, then a default array of type UpdateCommentsArray will be set
- */
-export const DefaultUpdateCommentsArray = new t.Type<
- UpdateCommentsArray,
- UpdateCommentsArray,
- unknown
->(
- 'DefaultUpdateComments',
- updateCommentsArray.is,
- (input, context): Either =>
- input == null ? t.success([]) : updateCommentsArray.validate(input, context),
- t.identity
-);
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/description/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/description/index.ts
deleted file mode 100644
index 75fd7ac92ffc..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/description/index.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-export const description = t.string;
-export type Description = t.TypeOf;
-export const descriptionOrUndefined = t.union([description, t.undefined]);
-export type DescriptionOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/deserializer/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/deserializer/index.ts
deleted file mode 100644
index c5489a946897..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/deserializer/index.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-export const deserializer = t.string;
-export type Deserializer = t.TypeOf;
-export const deserializerOrUndefined = t.union([deserializer, t.undefined]);
-export type DeserializerOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entries/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entries/index.mock.ts
deleted file mode 100644
index bc091b1e33c3..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entries/index.mock.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EndpointEntriesArray } from '.';
-import { getEndpointEntryMatchMock } from '../entry_match/index.mock';
-import { getEndpointEntryMatchAnyMock } from '../entry_match_any/index.mock';
-import { getEndpointEntryNestedMock } from '../entry_nested/index.mock';
-import { getEndpointEntryMatchWildcardMock } from '../entry_match_wildcard/index.mock';
-
-export const getEndpointEntriesArrayMock = (): EndpointEntriesArray => [
- getEndpointEntryMatchMock(),
- getEndpointEntryMatchAnyMock(),
- getEndpointEntryNestedMock(),
- getEndpointEntryMatchWildcardMock(),
-];
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entries/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entries/index.test.ts
deleted file mode 100644
index 574bf4276461..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entries/index.test.ts
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEndpointEntryMatchMock } from '../entry_match/index.mock';
-import {
- endpointEntriesArray,
- nonEmptyEndpointEntriesArray,
- NonEmptyEndpointEntriesArray,
-} from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { getEndpointEntryMatchAnyMock } from '../entry_match_any/index.mock';
-import { getEndpointEntryNestedMock } from '../entry_nested/index.mock';
-import { getEndpointEntriesArrayMock } from './index.mock';
-import { getEntryListMock } from '../../entries_list/index.mock';
-import { getEntryExistsMock } from '../../entries_exist/index.mock';
-import { getEndpointEntryMatchWildcardMock } from '../entry_match_wildcard/index.mock';
-
-describe('Endpoint', () => {
- describe('entriesArray', () => {
- test('it should validate an array with match entry', () => {
- const payload = [getEndpointEntryMatchMock()];
- const decoded = endpointEntriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array with match_any entry', () => {
- const payload = [getEndpointEntryMatchAnyMock()];
- const decoded = endpointEntriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should NOT validate an empty array', () => {
- const payload: NonEmptyEndpointEntriesArray = [];
- const decoded = nonEmptyEndpointEntriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "[]" supplied to "NonEmptyEndpointEntriesArray"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('type guard for nonEmptyEndpointNestedEntries should allow array of endpoint entries', () => {
- const payload: NonEmptyEndpointEntriesArray = [getEndpointEntryMatchAnyMock()];
- const guarded = nonEmptyEndpointEntriesArray.is(payload);
- expect(guarded).toBeTruthy();
- });
-
- test('type guard for nonEmptyEndpointNestedEntries should disallow empty arrays', () => {
- const payload: NonEmptyEndpointEntriesArray = [];
- const guarded = nonEmptyEndpointEntriesArray.is(payload);
- expect(guarded).toBeFalsy();
- });
-
- test('it should NOT validate an array with exists entry', () => {
- const payload = [getEntryExistsMock()];
- const decoded = endpointEntriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "exists" supplied to "type"',
- 'Invalid value "undefined" supplied to "value"',
- 'Invalid value "undefined" supplied to "entries"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should NOT validate an array with list entry', () => {
- const payload = [getEntryListMock()];
- const decoded = endpointEntriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "list" supplied to "type"',
- 'Invalid value "undefined" supplied to "value"',
- 'Invalid value "undefined" supplied to "entries"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should validate an array with nested entry', () => {
- const payload = [getEndpointEntryNestedMock()];
- const decoded = endpointEntriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array with wildcard entry', () => {
- const payload = [getEndpointEntryMatchWildcardMock()];
- const decoded = endpointEntriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array with all types of entries', () => {
- const payload = getEndpointEntriesArrayMock();
- const decoded = endpointEntriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entries/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entries/index.ts
deleted file mode 100644
index 992237161d06..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entries/index.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { endpointEntryMatch } from '../entry_match';
-import { endpointEntryMatchAny } from '../entry_match_any';
-import { endpointEntryNested } from '../entry_nested';
-import { endpointEntryMatchWildcard } from '../entry_match_wildcard';
-
-export const endpointEntriesArray = t.array(
- t.union([
- endpointEntryMatch,
- endpointEntryMatchAny,
- endpointEntryMatchWildcard,
- endpointEntryNested,
- ])
-);
-export type EndpointEntriesArray = t.TypeOf;
-
-/**
- * Types the nonEmptyEndpointEntriesArray as:
- * - An array of entries of length 1 or greater
- *
- */
-export const nonEmptyEndpointEntriesArray = new t.Type<
- EndpointEntriesArray,
- EndpointEntriesArray,
- unknown
->(
- 'NonEmptyEndpointEntriesArray',
- (u: unknown): u is EndpointEntriesArray => endpointEntriesArray.is(u) && u.length > 0,
- (input, context): Either => {
- if (Array.isArray(input) && input.length === 0) {
- return t.failure(input, context);
- } else {
- return endpointEntriesArray.validate(input, context);
- }
- },
- t.identity
-);
-
-export type NonEmptyEndpointEntriesArray = t.OutputOf;
-export type NonEmptyEndpointEntriesArrayDecoded = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match/index.mock.ts
deleted file mode 100644
index 76305cf70c58..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match/index.mock.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EndpointEntryMatch } from '.';
-import { ENTRY_VALUE, FIELD, MATCH, OPERATOR } from '../../../constants/index.mock';
-
-export const getEndpointEntryMatchMock = (): EndpointEntryMatch => ({
- field: FIELD,
- operator: OPERATOR,
- type: MATCH,
- value: ENTRY_VALUE,
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match/index.test.ts
deleted file mode 100644
index 5c20b697b3bf..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match/index.test.ts
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEndpointEntryMatchMock } from './index.mock';
-import { EndpointEntryMatch, endpointEntryMatch } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { getEntryMatchMock } from '../../entry_match/index.mock';
-
-describe('endpointEntryMatch', () => {
- test('it should validate an entry', () => {
- const payload = getEndpointEntryMatchMock();
- const decoded = endpointEntryMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should NOT validate when "operator" is "excluded"', () => {
- // Use the generic entry mock so we can test operator: excluded
- const payload = getEntryMatchMock();
- payload.operator = 'excluded';
- const decoded = endpointEntryMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "excluded" supplied to "operator"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "field" is empty string', () => {
- const payload: Omit & { field: string } = {
- ...getEndpointEntryMatchMock(),
- field: '',
- };
- const decoded = endpointEntryMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "value" is not string', () => {
- const payload: Omit & { value: string[] } = {
- ...getEndpointEntryMatchMock(),
- value: ['some value'],
- };
- const decoded = endpointEntryMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "["some value"]" supplied to "value"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "value" is empty string', () => {
- const payload: Omit & { value: string } = {
- ...getEndpointEntryMatchMock(),
- value: '',
- };
- const decoded = endpointEntryMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "value"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "type" is not "match"', () => {
- const payload: Omit & { type: string } = {
- ...getEndpointEntryMatchMock(),
- type: 'match_any',
- };
- const decoded = endpointEntryMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "match_any" supplied to "type"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: EndpointEntryMatch & {
- extraKey?: string;
- } = getEndpointEntryMatchMock();
- payload.extraKey = 'some value';
- const decoded = endpointEntryMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getEntryMatchMock());
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match/index.ts
deleted file mode 100644
index 5ae0258ebfb7..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match/index.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { NonEmptyString, operatorIncluded } from '@kbn/securitysolution-io-ts-types';
-
-export const endpointEntryMatch = t.exact(
- t.type({
- field: NonEmptyString,
- operator: operatorIncluded,
- type: t.keyof({ match: null }),
- value: NonEmptyString,
- })
-);
-export type EndpointEntryMatch = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_any/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_any/index.mock.ts
deleted file mode 100644
index b3bfffd4daf9..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_any/index.mock.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { ENTRY_VALUE, FIELD, MATCH_ANY, OPERATOR } from '../../../constants/index.mock';
-import { EndpointEntryMatchAny } from '.';
-
-export const getEndpointEntryMatchAnyMock = (): EndpointEntryMatchAny => ({
- field: FIELD,
- operator: OPERATOR,
- type: MATCH_ANY,
- value: [ENTRY_VALUE],
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_any/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_any/index.test.ts
deleted file mode 100644
index e121eed769ea..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_any/index.test.ts
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEndpointEntryMatchAnyMock } from './index.mock';
-import { EndpointEntryMatchAny, endpointEntryMatchAny } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { getEntryMatchAnyMock } from '../../entry_match_any/index.mock';
-
-describe('endpointEntryMatchAny', () => {
- test('it should validate an entry', () => {
- const payload = getEndpointEntryMatchAnyMock();
- const decoded = endpointEntryMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should NOT validate when operator is "excluded"', () => {
- // Use the generic entry mock so we can test operator: excluded
- const payload = getEntryMatchAnyMock();
- payload.operator = 'excluded';
- const decoded = endpointEntryMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "excluded" supplied to "operator"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when field is empty string', () => {
- const payload: Omit & { field: string } = {
- ...getEndpointEntryMatchAnyMock(),
- field: '',
- };
- const decoded = endpointEntryMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when value is empty array', () => {
- const payload: Omit & { value: string[] } = {
- ...getEndpointEntryMatchAnyMock(),
- value: [],
- };
- const decoded = endpointEntryMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "[]" supplied to "value"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when value is not string array', () => {
- const payload: Omit & { value: string } = {
- ...getEndpointEntryMatchAnyMock(),
- value: 'some string',
- };
- const decoded = endpointEntryMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "some string" supplied to "value"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "type" is not "match_any"', () => {
- const payload: Omit & { type: string } = {
- ...getEndpointEntryMatchAnyMock(),
- type: 'match',
- };
- const decoded = endpointEntryMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "match" supplied to "type"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: EndpointEntryMatchAny & {
- extraKey?: string;
- } = getEndpointEntryMatchAnyMock();
- payload.extraKey = 'some extra key';
- const decoded = endpointEntryMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getEntryMatchAnyMock());
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_any/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_any/index.ts
deleted file mode 100644
index d639f4481d4d..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_any/index.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import {
- NonEmptyString,
- nonEmptyOrNullableStringArray,
- operatorIncluded,
-} from '@kbn/securitysolution-io-ts-types';
-
-export const endpointEntryMatchAny = t.exact(
- t.type({
- field: NonEmptyString,
- operator: operatorIncluded,
- type: t.keyof({ match_any: null }),
- value: nonEmptyOrNullableStringArray,
- })
-);
-export type EndpointEntryMatchAny = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_wildcard/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_wildcard/index.mock.ts
deleted file mode 100644
index f1b5c7e7421a..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_wildcard/index.mock.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { ENTRY_VALUE, FIELD, OPERATOR, WILDCARD } from '../../../constants/index.mock';
-import { EndpointEntryMatchWildcard } from '.';
-
-export const getEndpointEntryMatchWildcardMock = (): EndpointEntryMatchWildcard => ({
- field: FIELD,
- operator: OPERATOR,
- type: WILDCARD,
- value: ENTRY_VALUE,
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_wildcard/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_wildcard/index.test.ts
deleted file mode 100644
index 025994afcd9e..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_wildcard/index.test.ts
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEndpointEntryMatchWildcardMock } from './index.mock';
-import { EndpointEntryMatchWildcard, endpointEntryMatchWildcard } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { getEntryMatchWildcardMock } from '../../entry_match_wildcard/index.mock';
-
-describe('endpointEntryMatchWildcard', () => {
- test('it should validate an entry', () => {
- const payload = getEndpointEntryMatchWildcardMock();
- const decoded = endpointEntryMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when "operator" is "excluded"', () => {
- const payload = getEntryMatchWildcardMock();
- payload.operator = 'excluded';
- const decoded = endpointEntryMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should FAIL validation when "field" is empty string', () => {
- const payload: Omit & { field: string } = {
- ...getEndpointEntryMatchWildcardMock(),
- field: '',
- };
- const decoded = endpointEntryMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "value" is not string', () => {
- const payload: Omit & { value: string[] } = {
- ...getEndpointEntryMatchWildcardMock(),
- value: ['some value'],
- };
- const decoded = endpointEntryMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "["some value"]" supplied to "value"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "value" is empty string', () => {
- const payload: Omit & { value: string } = {
- ...getEndpointEntryMatchWildcardMock(),
- value: '',
- };
- const decoded = endpointEntryMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "value"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "type" is not "wildcard"', () => {
- const payload: Omit & { type: string } = {
- ...getEndpointEntryMatchWildcardMock(),
- type: 'match',
- };
- const decoded = endpointEntryMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "match" supplied to "type"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: EndpointEntryMatchWildcard & {
- extraKey?: string;
- } = getEndpointEntryMatchWildcardMock();
- payload.extraKey = 'some value';
- const decoded = endpointEntryMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getEntryMatchWildcardMock());
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_wildcard/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_wildcard/index.ts
deleted file mode 100644
index b42f6245ea28..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_match_wildcard/index.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import {
- NonEmptyString,
- operatorExcluded,
- operatorIncluded,
-} from '@kbn/securitysolution-io-ts-types';
-
-export const endpointEntryMatchWildcard = t.exact(
- t.type({
- field: NonEmptyString,
- operator: t.union([operatorIncluded, operatorExcluded]),
- type: t.keyof({ wildcard: null }),
- value: NonEmptyString,
- })
-);
-export type EndpointEntryMatchWildcard = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_nested/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_nested/index.mock.ts
deleted file mode 100644
index 44c5f8db5f6e..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_nested/index.mock.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EndpointEntryNested } from '.';
-import { FIELD, NESTED } from '../../../constants/index.mock';
-import { getEndpointEntryMatchMock } from '../entry_match/index.mock';
-import { getEndpointEntryMatchAnyMock } from '../entry_match_any/index.mock';
-
-export const getEndpointEntryNestedMock = (): EndpointEntryNested => ({
- entries: [getEndpointEntryMatchMock(), getEndpointEntryMatchAnyMock()],
- field: FIELD,
- type: NESTED,
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_nested/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_nested/index.test.ts
deleted file mode 100644
index c062deb88af8..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_nested/index.test.ts
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { EndpointEntryNested, endpointEntryNested } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { getEndpointEntryNestedMock } from './index.mock';
-import { getEndpointEntryMatchAnyMock } from '../entry_match_any/index.mock';
-import {
- nonEmptyEndpointNestedEntriesArray,
- NonEmptyEndpointNestedEntriesArray,
-} from '../non_empty_nested_entries_array';
-import { getEndpointEntryMatchMock } from '../entry_match/index.mock';
-import { getEntryExistsMock } from '../../entries_exist/index.mock';
-
-describe('endpointEntryNested', () => {
- test('it should validate a nested entry', () => {
- const payload = getEndpointEntryNestedMock();
- const decoded = endpointEntryNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should FAIL validation when "type" is not "nested"', () => {
- const payload: Omit & { type: 'match' } = {
- ...getEndpointEntryNestedMock(),
- type: 'match',
- };
- const decoded = endpointEntryNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "match" supplied to "type"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "field" is empty string', () => {
- const payload: Omit & {
- field: string;
- } = { ...getEndpointEntryNestedMock(), field: '' };
- const decoded = endpointEntryNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "field" is not a string', () => {
- const payload: Omit & {
- field: number;
- } = { ...getEndpointEntryNestedMock(), field: 1 };
- const decoded = endpointEntryNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "1" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "entries" is not an array', () => {
- const payload: Omit & {
- entries: string;
- } = { ...getEndpointEntryNestedMock(), entries: 'im a string' };
- const decoded = endpointEntryNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "im a string" supplied to "entries"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should validate when "entries" contains an entry item that is type "match"', () => {
- const payload = { ...getEndpointEntryNestedMock(), entries: [getEndpointEntryMatchAnyMock()] };
- const decoded = endpointEntryNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual({
- entries: [
- {
- field: 'host.name',
- operator: 'included',
- type: 'match_any',
- value: ['some host name'],
- },
- ],
- field: 'host.name',
- type: 'nested',
- });
- });
-
- test('it should NOT validate when "entries" contains an entry item that is type "exists"', () => {
- const payload = { ...getEndpointEntryNestedMock(), entries: [getEntryExistsMock()] };
- const decoded = endpointEntryNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "exists" supplied to "entries,type"',
- 'Invalid value "undefined" supplied to "entries,value"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: EndpointEntryNested & {
- extraKey?: string;
- } = getEndpointEntryNestedMock();
- payload.extraKey = 'some extra key';
- const decoded = endpointEntryNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getEndpointEntryNestedMock());
- });
-
- test('type guard for nonEmptyEndpointNestedEntries should allow array of endpoint entries', () => {
- const payload: NonEmptyEndpointNestedEntriesArray = [
- getEndpointEntryMatchMock(),
- getEndpointEntryMatchAnyMock(),
- ];
- const guarded = nonEmptyEndpointNestedEntriesArray.is(payload);
- expect(guarded).toBeTruthy();
- });
-
- test('type guard for nonEmptyEndpointNestedEntries should disallow empty arrays', () => {
- const payload: NonEmptyEndpointNestedEntriesArray = [];
- const guarded = nonEmptyEndpointNestedEntriesArray.is(payload);
- expect(guarded).toBeFalsy();
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_nested/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_nested/index.ts
deleted file mode 100644
index 6625c1dfeaf5..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/entry_nested/index.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-import { nonEmptyEndpointNestedEntriesArray } from '../non_empty_nested_entries_array';
-
-export const endpointEntryNested = t.exact(
- t.type({
- entries: nonEmptyEndpointNestedEntriesArray,
- field: NonEmptyString,
- type: t.keyof({ nested: null }),
- })
-);
-export type EndpointEntryNested = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/index.ts
deleted file mode 100644
index fb42cc8ee468..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/index.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-export * from './entries';
-export * from './non_empty_nested_entries_array';
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/non_empty_nested_entries_array/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/non_empty_nested_entries_array/index.ts
deleted file mode 100644
index 9bcfccae97b3..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/endpoint/non_empty_nested_entries_array/index.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { Either } from 'fp-ts/lib/Either';
-import { endpointEntryMatch } from '../entry_match';
-import { endpointEntryMatchAny } from '../entry_match_any';
-
-export const endpointNestedEntriesArray = t.array(
- t.union([endpointEntryMatch, endpointEntryMatchAny])
-);
-export type EndpointNestedEntriesArray = t.TypeOf;
-
-/**
- * Types the nonEmptyNestedEntriesArray as:
- * - An array of entries of length 1 or greater
- *
- */
-export const nonEmptyEndpointNestedEntriesArray = new t.Type<
- EndpointNestedEntriesArray,
- EndpointNestedEntriesArray,
- unknown
->(
- 'NonEmptyEndpointNestedEntriesArray',
- (u: unknown): u is EndpointNestedEntriesArray => endpointNestedEntriesArray.is(u) && u.length > 0,
- (input, context): Either => {
- if (Array.isArray(input) && input.length === 0) {
- return t.failure(input, context);
- } else {
- return endpointNestedEntriesArray.validate(input, context);
- }
- },
- t.identity
-);
-
-export type NonEmptyEndpointNestedEntriesArray = t.OutputOf<
- typeof nonEmptyEndpointNestedEntriesArray
->;
-export type NonEmptyEndpointNestedEntriesArrayDecoded = t.TypeOf<
- typeof nonEmptyEndpointNestedEntriesArray
->;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entries/index.mock.ts
deleted file mode 100644
index 5b8c802c94a3..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries/index.mock.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EntriesArray } from '.';
-import { getEntryExistsMock } from '../entries_exist/index.mock';
-import { getEntryListMock } from '../entries_list/index.mock';
-import { getEntryMatchMock } from '../entry_match/index.mock';
-import { getEntryMatchAnyMock } from '../entry_match_any/index.mock';
-import { getEntryNestedMock } from '../entry_nested/index.mock';
-
-export const getListAndNonListEntriesArrayMock = (): EntriesArray => [
- getEntryMatchMock(),
- getEntryMatchAnyMock(),
- getEntryListMock(),
- getEntryExistsMock(),
- getEntryNestedMock(),
-];
-
-export const getListEntriesArrayMock = (): EntriesArray => [getEntryListMock(), getEntryListMock()];
-
-export const getEntriesArrayMock = (): EntriesArray => [
- getEntryMatchMock(),
- getEntryMatchAnyMock(),
- getEntryExistsMock(),
- getEntryNestedMock(),
-];
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entries/index.test.ts
deleted file mode 100644
index 73553be78b9a..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries/index.test.ts
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEntryMatchMock } from '../entry_match/index.mock';
-import { entriesArray, entriesArrayOrUndefined, entry } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { getEntryMatchAnyMock } from '../entry_match_any/index.mock';
-import { getEntryExistsMock } from '../entries_exist/index.mock';
-import { getEntryListMock } from '../entries_list/index.mock';
-import { getEntryNestedMock } from '../entry_nested/index.mock';
-import { getEntriesArrayMock } from './index.mock';
-
-describe('Entries', () => {
- describe('entry', () => {
- test('it should validate a match entry', () => {
- const payload = getEntryMatchMock();
- const decoded = entry.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate a match_any entry', () => {
- const payload = getEntryMatchAnyMock();
- const decoded = entry.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate a exists entry', () => {
- const payload = getEntryExistsMock();
- const decoded = entry.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate a list entry', () => {
- const payload = getEntryListMock();
- const decoded = entry.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should FAIL validation of nested entry', () => {
- const payload = getEntryNestedMock();
- const decoded = entry.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "undefined" supplied to "operator"',
- 'Invalid value "nested" supplied to "type"',
- 'Invalid value "undefined" supplied to "value"',
- 'Invalid value "undefined" supplied to "list"',
- ]);
- expect(message.schema).toEqual({});
- });
- });
-
- describe('entriesArray', () => {
- test('it should validate an array with match entry', () => {
- const payload = [getEntryMatchMock()];
- const decoded = entriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array with match_any entry', () => {
- const payload = [getEntryMatchAnyMock()];
- const decoded = entriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array with exists entry', () => {
- const payload = [getEntryExistsMock()];
- const decoded = entriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array with list entry', () => {
- const payload = [getEntryListMock()];
- const decoded = entriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array with nested entry', () => {
- const payload = [getEntryNestedMock()];
- const decoded = entriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array with all types of entries', () => {
- const payload = [...getEntriesArrayMock()];
- const decoded = entriesArray.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
- });
-
- describe('entriesArrayOrUndefined', () => {
- test('it should validate undefined', () => {
- const payload = undefined;
- const decoded = entriesArrayOrUndefined.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate an array with nested entry', () => {
- const payload = [getEntryNestedMock()];
- const decoded = entriesArrayOrUndefined.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entries/index.ts
deleted file mode 100644
index f2dbbd91dfce..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries/index.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { entriesExists } from '../entries_exist';
-import { entriesList } from '../entries_list';
-import { entriesMatch } from '../entry_match';
-import { entriesMatchAny } from '../entry_match_any';
-import { entriesMatchWildcard } from '../entry_match_wildcard';
-import { entriesNested } from '../entry_nested';
-
-// NOTE: Type nested is not included here to denote it's non-recursive nature.
-// So a nested entry is really just a collection of `Entry` types.
-export const entry = t.union([
- entriesMatch,
- entriesMatchAny,
- entriesList,
- entriesExists,
- entriesMatchWildcard,
-]);
-export type Entry = t.TypeOf;
-
-export const entriesArray = t.array(
- t.union([
- entriesMatch,
- entriesMatchAny,
- entriesList,
- entriesExists,
- entriesNested,
- entriesMatchWildcard,
- ])
-);
-export type EntriesArray = t.TypeOf;
-
-export const entriesArrayOrUndefined = t.union([entriesArray, t.undefined]);
-export type EntriesArrayOrUndefined = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_exist/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_exist/index.mock.ts
deleted file mode 100644
index 3a588ec9cc7b..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_exist/index.mock.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EntryExists } from '.';
-import { EXISTS, FIELD, OPERATOR } from '../../constants/index.mock';
-
-export const getEntryExistsMock = (): EntryExists => ({
- field: FIELD,
- operator: OPERATOR,
- type: EXISTS,
-});
-
-export const getEntryExistsExcludedMock = (): EntryExists => ({
- ...getEntryExistsMock(),
- operator: 'excluded',
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_exist/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_exist/index.test.ts
deleted file mode 100644
index 8ebf60ebc19f..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_exist/index.test.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEntryExistsMock } from './index.mock';
-import { entriesExists, EntryExists } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('entriesExists', () => {
- test('it should validate an entry', () => {
- const payload = getEntryExistsMock();
- const decoded = entriesExists.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when "operator" is "included"', () => {
- const payload = getEntryExistsMock();
- const decoded = entriesExists.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when "operator" is "excluded"', () => {
- const payload = getEntryExistsMock();
- payload.operator = 'excluded';
- const decoded = entriesExists.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should FAIL validation when "field" is empty string', () => {
- const payload: Omit & { field: string } = {
- ...getEntryExistsMock(),
- field: '',
- };
- const decoded = entriesExists.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: EntryExists & {
- extraKey?: string;
- } = getEntryExistsMock();
- payload.extraKey = 'some extra key';
- const decoded = entriesExists.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getEntryExistsMock());
- });
-
- test('it should FAIL validation when "type" is not "exists"', () => {
- const payload: Omit & { type: string } = {
- ...getEntryExistsMock(),
- type: 'match',
- };
- const decoded = entriesExists.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "match" supplied to "type"']);
- expect(message.schema).toEqual({});
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_exist/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_exist/index.ts
deleted file mode 100644
index 460030dcc951..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_exist/index.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-import { listOperator as operator } from '../list_operator';
-
-export const entriesExists = t.exact(
- t.type({
- field: NonEmptyString,
- operator,
- type: t.keyof({ exists: null }),
- })
-);
-export type EntryExists = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_list/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_list/index.mock.ts
deleted file mode 100644
index 06e006ed661b..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_list/index.mock.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EntryList } from '.';
-import { FIELD, LIST, LIST_ID, OPERATOR, TYPE } from '../../constants/index.mock';
-
-export const getEntryListMock = (): EntryList => ({
- field: FIELD,
- list: { id: LIST_ID, type: TYPE },
- operator: OPERATOR,
- type: LIST,
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_list/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_list/index.test.ts
deleted file mode 100644
index eb047a07f08d..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_list/index.test.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEntryListMock } from './index.mock';
-import { entriesList, EntryList } from '.';
-
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('entriesList', () => {
- test('it should validate an entry', () => {
- const payload = getEntryListMock();
- const decoded = entriesList.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when operator is "included"', () => {
- const payload = getEntryListMock();
- const decoded = entriesList.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when "operator" is "excluded"', () => {
- const payload = getEntryListMock();
- payload.operator = 'excluded';
- const decoded = entriesList.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should FAIL validation when "list" is not expected value', () => {
- const payload: Omit & { list: string } = {
- ...getEntryListMock(),
- list: 'someListId',
- };
- const decoded = entriesList.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "someListId" supplied to "list"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "list.id" is empty string', () => {
- const payload: Omit & { list: { id: string; type: 'ip' } } = {
- ...getEntryListMock(),
- list: { id: '', type: 'ip' },
- };
- const decoded = entriesList.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "list,id"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "type" is not "lists"', () => {
- const payload: Omit & { type: 'match_any' } = {
- ...getEntryListMock(),
- type: 'match_any',
- };
- const decoded = entriesList.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "match_any" supplied to "type"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: EntryList & {
- extraKey?: string;
- } = getEntryListMock();
- payload.extraKey = 'some extra key';
- const decoded = entriesList.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getEntryListMock());
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_list/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_list/index.ts
deleted file mode 100644
index f55a3f056218..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entries_list/index.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-
-import { type } from '../type';
-import { listOperator as operator } from '../list_operator';
-
-export const entriesList = t.exact(
- t.type({
- field: NonEmptyString,
- list: t.exact(t.type({ id: NonEmptyString, type })),
- operator,
- type: t.keyof({ list: null }),
- })
-);
-export type EntryList = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match/index.mock.ts
deleted file mode 100644
index 9e09661c2945..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match/index.mock.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EntryMatch } from '.';
-import { ENTRY_VALUE, FIELD, MATCH, OPERATOR } from '../../constants/index.mock';
-
-export const getEntryMatchMock = (): EntryMatch => ({
- field: FIELD,
- operator: OPERATOR,
- type: MATCH,
- value: ENTRY_VALUE,
-});
-
-export const getEntryMatchExcludeMock = (): EntryMatch => ({
- ...getEntryMatchMock(),
- operator: 'excluded',
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match/index.test.ts
deleted file mode 100644
index f2f8dbb8998f..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match/index.test.ts
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEntryMatchMock } from './index.mock';
-import { entriesMatch, EntryMatch } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('entriesMatch', () => {
- test('it should validate an entry', () => {
- const payload = getEntryMatchMock();
- const decoded = entriesMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when operator is "included"', () => {
- const payload = getEntryMatchMock();
- const decoded = entriesMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when "operator" is "excluded"', () => {
- const payload = getEntryMatchMock();
- payload.operator = 'excluded';
- const decoded = entriesMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should FAIL validation when "field" is empty string', () => {
- const payload: Omit & { field: string } = {
- ...getEntryMatchMock(),
- field: '',
- };
- const decoded = entriesMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "value" is not string', () => {
- const payload: Omit & { value: string[] } = {
- ...getEntryMatchMock(),
- value: ['some value'],
- };
- const decoded = entriesMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "["some value"]" supplied to "value"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "value" is empty string', () => {
- const payload: Omit & { value: string } = {
- ...getEntryMatchMock(),
- value: '',
- };
- const decoded = entriesMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "value"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "type" is not "match"', () => {
- const payload: Omit & { type: string } = {
- ...getEntryMatchMock(),
- type: 'match_any',
- };
- const decoded = entriesMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "match_any" supplied to "type"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: EntryMatch & {
- extraKey?: string;
- } = getEntryMatchMock();
- payload.extraKey = 'some value';
- const decoded = entriesMatch.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getEntryMatchMock());
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match/index.ts
deleted file mode 100644
index 17bf0ab5b89e..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match/index.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-import { listOperator as operator } from '../list_operator';
-
-export const entriesMatch = t.exact(
- t.type({
- field: NonEmptyString,
- operator,
- type: t.keyof({ match: null }),
- value: NonEmptyString,
- })
-);
-export type EntryMatch = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_any/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_any/index.mock.ts
deleted file mode 100644
index 7a5c4c57fa32..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_any/index.mock.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EntryMatchAny } from '.';
-import { ENTRY_VALUE, FIELD, MATCH_ANY, OPERATOR } from '../../constants/index.mock';
-
-export const getEntryMatchAnyMock = (): EntryMatchAny => ({
- field: FIELD,
- operator: OPERATOR,
- type: MATCH_ANY,
- value: [ENTRY_VALUE],
-});
-
-export const getEntryMatchAnyExcludeMock = (): EntryMatchAny => ({
- ...getEntryMatchAnyMock(),
- operator: 'excluded',
- value: [ENTRY_VALUE, 'some other host name'],
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_any/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_any/index.test.ts
deleted file mode 100644
index 3e4752f39508..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_any/index.test.ts
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEntryMatchAnyMock } from './index.mock';
-import { entriesMatchAny, EntryMatchAny } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('entriesMatchAny', () => {
- test('it should validate an entry', () => {
- const payload = getEntryMatchAnyMock();
- const decoded = entriesMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when operator is "included"', () => {
- const payload = getEntryMatchAnyMock();
- const decoded = entriesMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when operator is "excluded"', () => {
- const payload = getEntryMatchAnyMock();
- payload.operator = 'excluded';
- const decoded = entriesMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should FAIL validation when field is empty string', () => {
- const payload: Omit & { field: string } = {
- ...getEntryMatchAnyMock(),
- field: '',
- };
- const decoded = entriesMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when value is empty array', () => {
- const payload: Omit & { value: string[] } = {
- ...getEntryMatchAnyMock(),
- value: [],
- };
- const decoded = entriesMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "[]" supplied to "value"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when value is not string array', () => {
- const payload: Omit & { value: string } = {
- ...getEntryMatchAnyMock(),
- value: 'some string',
- };
- const decoded = entriesMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "some string" supplied to "value"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "type" is not "match_any"', () => {
- const payload: Omit & { type: string } = {
- ...getEntryMatchAnyMock(),
- type: 'match',
- };
- const decoded = entriesMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "match" supplied to "type"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: EntryMatchAny & {
- extraKey?: string;
- } = getEntryMatchAnyMock();
- payload.extraKey = 'some extra key';
- const decoded = entriesMatchAny.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getEntryMatchAnyMock());
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_any/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_any/index.ts
deleted file mode 100644
index be08fb370abd..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_any/index.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-import { NonEmptyString, nonEmptyOrNullableStringArray } from '@kbn/securitysolution-io-ts-types';
-import { listOperator as operator } from '../list_operator';
-
-export const entriesMatchAny = t.exact(
- t.type({
- field: NonEmptyString,
- operator,
- type: t.keyof({ match_any: null }),
- value: nonEmptyOrNullableStringArray,
- })
-);
-export type EntryMatchAny = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_wildcard/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_wildcard/index.mock.ts
deleted file mode 100644
index 6dc33289d22d..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_wildcard/index.mock.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EntryMatchWildcard } from '.';
-import { ENTRY_VALUE, FIELD, OPERATOR, WILDCARD } from '../../constants/index.mock';
-
-export const getEntryMatchWildcardMock = (): EntryMatchWildcard => ({
- field: FIELD,
- operator: OPERATOR,
- type: WILDCARD,
- value: ENTRY_VALUE,
-});
-
-export const getEntryMatchWildcardExcludeMock = (): EntryMatchWildcard => ({
- ...getEntryMatchWildcardMock(),
- operator: 'excluded',
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_wildcard/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_wildcard/index.test.ts
deleted file mode 100644
index a84996a6c105..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_wildcard/index.test.ts
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEntryMatchWildcardMock } from './index.mock';
-import { entriesMatchWildcard, EntryMatchWildcard } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('entriesMatchWildcard', () => {
- test('it should validate an entry', () => {
- const payload = getEntryMatchWildcardMock();
- const decoded = entriesMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when operator is "included"', () => {
- const payload = getEntryMatchWildcardMock();
- const decoded = entriesMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should validate when "operator" is "excluded"', () => {
- const payload = getEntryMatchWildcardMock();
- payload.operator = 'excluded';
- const decoded = entriesMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should FAIL validation when "field" is empty string', () => {
- const payload: Omit & { field: string } = {
- ...getEntryMatchWildcardMock(),
- field: '',
- };
- const decoded = entriesMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "value" is not string', () => {
- const payload: Omit & { value: string[] } = {
- ...getEntryMatchWildcardMock(),
- value: ['some value'],
- };
- const decoded = entriesMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "["some value"]" supplied to "value"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "value" is empty string', () => {
- const payload: Omit & { value: string } = {
- ...getEntryMatchWildcardMock(),
- value: '',
- };
- const decoded = entriesMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "value"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "type" is not "wildcard"', () => {
- const payload: Omit & { type: string } = {
- ...getEntryMatchWildcardMock(),
- type: 'match',
- };
- const decoded = entriesMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "match" supplied to "type"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should strip out extra keys', () => {
- const payload: EntryMatchWildcard & {
- extraKey?: string;
- } = getEntryMatchWildcardMock();
- payload.extraKey = 'some value';
- const decoded = entriesMatchWildcard.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getEntryMatchWildcardMock());
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_wildcard/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_wildcard/index.ts
deleted file mode 100644
index 17afe342961c..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_match_wildcard/index.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-import { listOperator as operator } from '../list_operator';
-
-export const entriesMatchWildcard = t.exact(
- t.type({
- field: NonEmptyString,
- operator,
- type: t.keyof({ wildcard: null }),
- value: NonEmptyString,
- })
-);
-export type EntryMatchWildcard = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_nested/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_nested/index.mock.ts
deleted file mode 100644
index 34d687502e24..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_nested/index.mock.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { EntryNested } from '.';
-import { NESTED, NESTED_FIELD } from '../../constants/index.mock';
-import { getEntryExistsMock } from '../entries_exist/index.mock';
-import { getEntryMatchExcludeMock, getEntryMatchMock } from '../entry_match/index.mock';
-import { getEntryMatchAnyExcludeMock, getEntryMatchAnyMock } from '../entry_match_any/index.mock';
-
-export const getEntryNestedMock = (): EntryNested => ({
- entries: [getEntryMatchMock(), getEntryMatchAnyMock()],
- field: NESTED_FIELD,
- type: NESTED,
-});
-
-export const getEntryNestedExcludeMock = (): EntryNested => ({
- ...getEntryNestedMock(),
- entries: [getEntryMatchExcludeMock(), getEntryMatchAnyExcludeMock()],
-});
-
-export const getEntryNestedMixedEntries = (): EntryNested => ({
- ...getEntryNestedMock(),
- entries: [getEntryMatchMock(), getEntryMatchAnyExcludeMock(), getEntryExistsMock()],
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_nested/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_nested/index.test.ts
deleted file mode 100644
index cfd43c4c0993..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_nested/index.test.ts
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getEntryNestedMock } from './index.mock';
-import { entriesNested, EntryNested } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-import { getEntryMatchAnyMock } from '../entry_match_any/index.mock';
-import { getEntryExistsMock } from '../entries_exist/index.mock';
-
-describe('entriesNested', () => {
- test('it should validate a nested entry', () => {
- const payload = getEntryNestedMock();
- const decoded = entriesNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should FAIL validation when "type" is not "nested"', () => {
- const payload: Omit & { type: 'match' } = {
- ...getEntryNestedMock(),
- type: 'match',
- };
- const decoded = entriesNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "match" supplied to "type"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "field" is empty string', () => {
- const payload: Omit & {
- field: string;
- } = { ...getEntryNestedMock(), field: '' };
- const decoded = entriesNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "field" is not a string', () => {
- const payload: Omit & {
- field: number;
- } = { ...getEntryNestedMock(), field: 1 };
- const decoded = entriesNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual(['Invalid value "1" supplied to "field"']);
- expect(message.schema).toEqual({});
- });
-
- test('it should FAIL validation when "entries" is not a an array', () => {
- const payload: Omit & {
- entries: string;
- } = { ...getEntryNestedMock(), entries: 'im a string' };
- const decoded = entriesNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([
- 'Invalid value "im a string" supplied to "entries"',
- ]);
- expect(message.schema).toEqual({});
- });
-
- test('it should validate when "entries" contains an entry item that is type "match"', () => {
- const payload = { ...getEntryNestedMock(), entries: [getEntryMatchAnyMock()] };
- const decoded = entriesNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual({
- entries: [
- {
- field: 'host.name',
- operator: 'included',
- type: 'match_any',
- value: ['some host name'],
- },
- ],
- field: 'parent.field',
- type: 'nested',
- });
- });
-
- test('it should validate when "entries" contains an entry item that is type "exists"', () => {
- const payload = { ...getEntryNestedMock(), entries: [getEntryExistsMock()] };
- const decoded = entriesNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual({
- entries: [
- {
- field: 'host.name',
- operator: 'included',
- type: 'exists',
- },
- ],
- field: 'parent.field',
- type: 'nested',
- });
- });
-
- test('it should strip out extra keys', () => {
- const payload: EntryNested & {
- extraKey?: string;
- } = getEntryNestedMock();
- payload.extraKey = 'some extra key';
- const decoded = entriesNested.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getEntryNestedMock());
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_nested/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_nested/index.ts
deleted file mode 100644
index 8b19fee9fb5c..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/entry_nested/index.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-import { nonEmptyNestedEntriesArray } from '../non_empty_nested_entries_array';
-
-export const entriesNested = t.exact(
- t.type({
- entries: nonEmptyNestedEntriesArray,
- field: NonEmptyString,
- type: t.keyof({ nested: null }),
- })
-);
-export type EntryNested = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.mock.ts
deleted file mode 100644
index 15cdd79dc2e9..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.mock.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { ExportExceptionDetails } from '.';
-
-export interface ExportExceptionDetailsMock {
- listCount?: number;
- missingListsCount?: number;
- missingLists?: Array>;
- itemCount?: number;
- missingItemCount?: number;
- missingItems?: Array>;
-}
-
-export const getExceptionExportDetailsMock = (
- details?: ExportExceptionDetailsMock
-): ExportExceptionDetails => ({
- exported_exception_list_count: details?.listCount ?? 0,
- exported_exception_list_item_count: details?.itemCount ?? 0,
- missing_exception_list_item_count: details?.missingItemCount ?? 0,
- missing_exception_list_items: details?.missingItems ?? [],
- missing_exception_lists: details?.missingLists ?? [],
- missing_exception_lists_count: details?.missingListsCount ?? 0,
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.test.ts
deleted file mode 100644
index c9b1a4767e57..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import { pipe } from 'fp-ts/lib/pipeable';
-import { left } from 'fp-ts/lib/Either';
-import { getExceptionExportDetailsMock } from './index.mock';
-import { exportExceptionDetailsSchema, ExportExceptionDetails } from '.';
-import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils';
-
-describe('exportExceptionDetails', () => {
- test('it should validate export meta', () => {
- const payload = getExceptionExportDetailsMock();
- const decoded = exportExceptionDetailsSchema.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(payload);
- });
-
- test('it should strip out extra keys', () => {
- const payload: ExportExceptionDetails & {
- extraKey?: string;
- } = getExceptionExportDetailsMock();
- payload.extraKey = 'some extra key';
- const decoded = exportExceptionDetailsSchema.decode(payload);
- const message = pipe(decoded, foldLeftRight);
-
- expect(getPaths(left(message.errors))).toEqual([]);
- expect(message.schema).toEqual(getExceptionExportDetailsMock());
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.ts
deleted file mode 100644
index 9e4ff134d6e9..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-import { NonEmptyString } from '@kbn/securitysolution-io-ts-types';
-
-export const exportExceptionDetails = {
- exported_exception_list_count: t.number,
- exported_exception_list_item_count: t.number,
- missing_exception_list_item_count: t.number,
- missing_exception_list_items: t.array(
- t.exact(
- t.type({
- item_id: NonEmptyString,
- })
- )
- ),
- missing_exception_lists: t.array(
- t.exact(
- t.type({
- list_id: NonEmptyString,
- })
- )
- ),
- missing_exception_lists_count: t.number,
-};
-
-export const exportExceptionDetailsSchema = t.exact(t.type(exportExceptionDetails));
-
-export type ExportExceptionDetails = t.TypeOf;
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_list/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_list/index.test.ts
deleted file mode 100644
index 2c6aae8a5693..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_list/index.test.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", 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 "rule_default"', () => {
- const payload = 'rule_default';
- 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);
- });
-});
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_list/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_list/index.ts
deleted file mode 100644
index db7633705ac5..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_list/index.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-export const exceptionListType = t.keyof({
- detection: null,
- rule_default: null,
- endpoint: null,
- endpoint_trusted_apps: null,
- endpoint_events: null,
- endpoint_host_isolation_exceptions: null,
- endpoint_blocklists: null,
-});
-export const exceptionListTypeOrUndefined = t.union([exceptionListType, t.undefined]);
-export type ExceptionListType = t.TypeOf;
-export type ExceptionListTypeOrUndefined = t.TypeOf;
-export enum ExceptionListTypeEnum {
- DETECTION = 'detection', // shared exception list type
- RULE_DEFAULT = 'rule_default', // rule default, cannot be shared
- ENDPOINT = 'endpoint',
- ENDPOINT_TRUSTED_APPS = 'endpoint',
- ENDPOINT_EVENTS = 'endpoint_events',
- ENDPOINT_HOST_ISOLATION_EXCEPTIONS = 'endpoint_host_isolation_exceptions',
- ENDPOINT_BLOCKLISTS = 'endpoint_blocklists',
-}
diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_list_item_type/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_list_item_type/index.ts
deleted file mode 100644
index 5e124b9f923d..000000000000
--- a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_list_item_type/index.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-import * as t from 'io-ts';
-
-export const exceptionListItemType = t.keyof({ simple: null });
-export const exceptionListItemTypeOrUndefined = t.union([exceptionListItemType, t.undefined]);
-export type ExceptionListItemType = t.TypeOf;
-export type ExceptionListItemTypeOrUndefined = t.TypeOf