diff --git a/.buildkite/pipelines/pull_request/scout_ui_tests.yml b/.buildkite/pipelines/pull_request/scout_ui_tests.yml index 37ea1567c4f42..16981921f79a9 100644 --- a/.buildkite/pipelines/pull_request/scout_ui_tests.yml +++ b/.buildkite/pipelines/pull_request/scout_ui_tests.yml @@ -2,7 +2,7 @@ steps: - command: .buildkite/scripts/steps/functional/scout_ui_tests.sh label: 'Scout UI Tests' agents: - machineType: n2-standard-4 + machineType: n2-standard-8 preemptible: true depends_on: - build @@ -11,7 +11,7 @@ steps: - linting - linting_with_types - check_types - timeout_in_minutes: 30 + timeout_in_minutes: 60 retry: automatic: - exit_status: '-1' diff --git a/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml b/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml index 7cffb9017b527..a8ac3e742c23c 100644 --- a/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml +++ b/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml @@ -37,4 +37,4 @@ steps: retry: automatic: - exit_status: '-1' - limit: 1 \ No newline at end of file + limit: 1 diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index 4353f4f079a9f..fd8ebb042ed46 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -109,18 +109,6 @@ const getPipeline = (filename: string, removeSteps = true) => { pipeline.push(getPipeline('.buildkite/pipelines/pull_request/inventory_cypress.yml')); } - if ( - (await doAnyChangesMatch([ - /^x-pack\/solutions\/observability\/plugins\/observability_onboarding/, - /^x-pack\/platform\/plugins\/shared\/fleet/, - ])) || - GITHUB_PR_LABELS.includes('ci:all-cypress-suites') - ) { - pipeline.push( - getPipeline('.buildkite/pipelines/pull_request/observability_onboarding_cypress.yml') - ); - } - if ( (await doAnyChangesMatch([/^x-pack\/solutions\/observability\/plugins\/profiling/])) || GITHUB_PR_LABELS.includes('ci:all-cypress-suites') @@ -405,6 +393,7 @@ const getPipeline = (filename: string, removeSteps = true) => { if ( (await doAnyChangesMatch([ /^x-pack\/platform\/plugins\/private\/discover_enhanced\/ui_tests/, + /^x-pack\/solutions\/observability\/plugins\/observability_onboarding/, /^packages\/kbn-scout/, ])) || GITHUB_PR_LABELS.includes('ci:scout-ui-tests') diff --git a/.buildkite/scripts/steps/functional/scout_ui_tests.sh b/.buildkite/scripts/steps/functional/scout_ui_tests.sh index b568ed9c80b1a..c16c92152684d 100755 --- a/.buildkite/scripts/steps/functional/scout_ui_tests.sh +++ b/.buildkite/scripts/steps/functional/scout_ui_tests.sh @@ -6,29 +6,33 @@ source .buildkite/scripts/steps/functional/common.sh export JOB=kibana-scout-ui-tests -TEST_CONFIG="x-pack/platform/plugins/private/discover_enhanced/ui_tests/playwright.config.ts" KIBANA_DIR="$KIBANA_BUILD_LOCATION" -declare -A TESTS=( - ["Stateful"]="--stateful" - ["Serverless Elasticsearch"]="--serverless=es" - ["Serverless Observability"]="--serverless=oblt" - ["Serverless Security"]="--serverless=security" -) +run_tests() { + local suit_name=$1 + local config_path=$2 + local run_mode=$3 -ORDER=("Stateful" "Serverless Elasticsearch" "Serverless Observability" "Serverless Security") - -EXIT_CODE=0 - -for TEST_NAME in "${ORDER[@]}"; do - RUN_MODE="${TESTS[$TEST_NAME]}" - echo "--- $TEST_NAME: 'discover_enhanced' plugin UI Tests" - if ! node scripts/scout run-tests "$RUN_MODE" --config "$TEST_CONFIG" --kibana-install-dir "$KIBANA_DIR"; then - echo "$TEST_NAME: failed" + echo "--- $suit_name ($run_mode) UI Tests" + if ! node scripts/scout run-tests "$run_mode" --config "$config_path" --kibana-install-dir "$KIBANA_DIR"; then + echo "$suit_name: failed" EXIT_CODE=1 else - echo "$TEST_NAME: passed" + echo "$suit_name: passed" fi +} + +EXIT_CODE=0 + +# Discovery Enhanced +for run_mode in "--stateful" "--serverless=es" "--serverless=oblt" "--serverless=security"; do + run_tests "Discovery Enhanced" "x-pack/platform/plugins/private/discover_enhanced/ui_tests/playwright.config.ts" "$run_mode" +done + +# Observability Onboarding +for run_mode in "--stateful" "--serverless=oblt"; do + run_tests "Observability Onboarding" "x-pack/solutions/observability/plugins/observability_onboarding/ui_tests/playwright.config.ts" "$run_mode" done + exit $EXIT_CODE diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f0383e9e556d6..d9002f9b4b8fb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -49,7 +49,6 @@ packages/core/base/core-base-browser-mocks @elastic/kibana-core packages/core/base/core-base-server-mocks @elastic/kibana-core packages/core/capabilities/core-capabilities-browser-mocks @elastic/kibana-core packages/core/capabilities/core-capabilities-server-mocks @elastic/kibana-core -packages/core/chrome/core-chrome-browser @elastic/appex-sharedux packages/core/chrome/core-chrome-browser-mocks @elastic/appex-sharedux packages/core/deprecations/core-deprecations-browser-mocks @elastic/kibana-core packages/core/deprecations/core-deprecations-server-mocks @elastic/kibana-core @@ -100,10 +99,6 @@ packages/core/usage-data/core-usage-data-server-mocks @elastic/kibana-core packages/core/user-settings/core-user-settings-server @elastic/kibana-security packages/core/user-settings/core-user-settings-server-internal @elastic/kibana-security packages/core/user-settings/core-user-settings-server-mocks @elastic/kibana-security -packages/deeplinks/shared @elastic/appex-sharedux -packages/home/sample_data_card @elastic/appex-sharedux -packages/home/sample_data_tab @elastic/appex-sharedux -packages/home/sample_data_types @elastic/appex-sharedux packages/kbn-ambient-common-types @elastic/kibana-operations packages/kbn-ambient-ftr-types @elastic/kibana-operations @elastic/appex-qa packages/kbn-ambient-storybook-types @elastic/kibana-operations @@ -154,10 +149,8 @@ packages/kbn-generate @elastic/kibana-operations packages/kbn-generate-console-definitions @elastic/kibana-management packages/kbn-get-repo-files @elastic/kibana-operations packages/kbn-grid-layout @elastic/kibana-presentation -packages/kbn-guided-onboarding @elastic/appex-sharedux packages/kbn-import-locator @elastic/kibana-operations packages/kbn-import-resolver @elastic/kibana-operations -packages/kbn-item-buffer @elastic/appex-sharedux packages/kbn-jest-serializers @elastic/kibana-operations packages/kbn-journeys @elastic/kibana-operations @elastic/appex-qa packages/kbn-json-ast @elastic/kibana-operations @@ -166,8 +159,6 @@ packages/kbn-lint-packages-cli @elastic/kibana-operations packages/kbn-lint-ts-projects-cli @elastic/kibana-operations packages/kbn-managed-vscode-config @elastic/kibana-operations packages/kbn-managed-vscode-config-cli @elastic/kibana-operations -packages/kbn-management/settings/section_registry @elastic/appex-sharedux @elastic/kibana-management -packages/kbn-management/settings/setting_ids @elastic/appex-sharedux @elastic/kibana-management packages/kbn-management/storybook/config @elastic/kibana-management packages/kbn-manifest @elastic/kibana-core packages/kbn-mock-idp-plugin @elastic/kibana-security @@ -184,14 +175,12 @@ packages/kbn-picomatcher @elastic/kibana-operations packages/kbn-plugin-check @elastic/appex-sharedux packages/kbn-plugin-generator @elastic/kibana-operations packages/kbn-plugin-helpers @elastic/kibana-operations -packages/kbn-react-mute-legacy-root-warning @elastic/appex-sharedux packages/kbn-relocate @elastic/kibana-core packages/kbn-repo-file-maps @elastic/kibana-operations packages/kbn-repo-linter @elastic/kibana-operations packages/kbn-repo-path @elastic/kibana-operations packages/kbn-repo-source-classifier @elastic/kibana-operations packages/kbn-repo-source-classifier-cli @elastic/kibana-operations -packages/kbn-saved-objects-settings @elastic/appex-sharedux packages/kbn-saved-search-component @elastic/obs-ux-logs-team packages/kbn-scout @elastic/appex-qa packages/kbn-scout-info @elastic/appex-qa @@ -215,18 +204,8 @@ packages/kbn-validate-next-docs-cli @elastic/kibana-operations packages/kbn-web-worker-stub @elastic/kibana-operations packages/kbn-whereis-pkg-cli @elastic/kibana-operations packages/kbn-yarn-lock-validator @elastic/kibana-operations -packages/react/kibana_context/common @elastic/appex-sharedux -packages/react/kibana_context/render @elastic/appex-sharedux -packages/react/kibana_context/root @elastic/appex-sharedux -packages/react/kibana_context/styled @elastic/appex-sharedux -packages/react/kibana_context/theme @elastic/appex-sharedux -packages/react/kibana_mount @elastic/appex-sharedux packages/response-ops/rule_form @elastic/response-ops -packages/serverless/project_switcher @elastic/appex-sharedux -packages/serverless/settings/common @elastic/appex-sharedux @elastic/kibana-management -packages/serverless/settings/observability_project @elastic/appex-sharedux @elastic/kibana-management @elastic/obs-ux-management-team packages/serverless/storybook/config @elastic/appex-sharedux -packages/serverless/types @elastic/appex-sharedux src/core @elastic/kibana-core src/core/packages/analytics/browser @elastic/kibana-core src/core/packages/analytics/browser-internal @elastic/kibana-core @@ -245,6 +224,7 @@ src/core/packages/capabilities/browser-internal @elastic/kibana-core src/core/packages/capabilities/common @elastic/kibana-core src/core/packages/capabilities/server @elastic/kibana-core src/core/packages/capabilities/server-internal @elastic/kibana-core +src/core/packages/chrome/browser @elastic/appex-sharedux src/core/packages/chrome/browser-internal @elastic/appex-sharedux src/core/packages/config/server-internal @elastic/kibana-core src/core/packages/custom-branding/browser @elastic/appex-sharedux @@ -387,6 +367,7 @@ src/platform/packages/private/kbn-generate-csv @elastic/appex-sharedux src/platform/packages/private/kbn-handlebars @elastic/kibana-security src/platform/packages/private/kbn-hapi-mocks @elastic/kibana-core src/platform/packages/private/kbn-health-gateway-server @elastic/kibana-core +src/platform/packages/private/kbn-item-buffer @elastic/appex-sharedux src/platform/packages/private/kbn-language-documentation @elastic/kibana-esql src/platform/packages/private/kbn-lens-formula-docs @elastic/kibana-visualizations src/platform/packages/private/kbn-managed-content-badge @elastic/kibana-visualizations @@ -395,6 +376,7 @@ src/platform/packages/private/kbn-management/settings/components/field_category src/platform/packages/private/kbn-management/settings/components/form @elastic/kibana-management src/platform/packages/private/kbn-mapbox-gl @elastic/kibana-presentation src/platform/packages/private/kbn-panel-loader @elastic/kibana-presentation +src/platform/packages/private/kbn-react-mute-legacy-root-warning @elastic/appex-sharedux src/platform/packages/private/kbn-repo-packages @elastic/kibana-operations src/platform/packages/private/kbn-reporting/common @elastic/appex-sharedux src/platform/packages/private/kbn-reporting/export_types/csv @elastic/appex-sharedux @@ -407,6 +389,7 @@ src/platform/packages/private/kbn-reporting/get_csv_panel_actions @elastic/appex src/platform/packages/private/kbn-reporting/mocks_server @elastic/appex-sharedux src/platform/packages/private/kbn-reporting/public @elastic/appex-sharedux src/platform/packages/private/kbn-reporting/server @elastic/appex-sharedux +src/platform/packages/private/kbn-saved-objects-settings @elastic/appex-sharedux src/platform/packages/private/kbn-screenshotting-server @elastic/appex-sharedux src/platform/packages/private/kbn-timelion-grammar @elastic/kibana-visualizations src/platform/packages/private/kbn-tinymath @elastic/kibana-visualizations @@ -414,6 +397,9 @@ src/platform/packages/private/kbn-transpose-utils @elastic/kibana-visualizations src/platform/packages/private/kbn-ui-shared-deps-npm @elastic/kibana-operations src/platform/packages/private/kbn-ui-shared-deps-src @elastic/kibana-operations src/platform/packages/private/kbn-unsaved-changes-badge @elastic/kibana-data-discovery +src/platform/packages/private/serverless/project_switcher @elastic/appex-sharedux +src/platform/packages/private/serverless/settings/common @elastic/appex-sharedux @elastic/kibana-management +src/platform/packages/private/serverless/types @elastic/appex-sharedux src/platform/packages/private/shared-ux/page/analytics_no_data/impl @elastic/appex-sharedux src/platform/packages/private/shared-ux/page/analytics_no_data/mocks @elastic/appex-sharedux src/platform/packages/private/shared-ux/page/analytics_no_data/types @elastic/appex-sharedux @@ -442,6 +428,10 @@ src/platform/packages/shared/deeplinks/ml @elastic/ml-ui src/platform/packages/shared/deeplinks/observability @elastic/obs-ux-management-team src/platform/packages/shared/deeplinks/search @elastic/search-kibana src/platform/packages/shared/deeplinks/security @elastic/security-solution +src/platform/packages/shared/deeplinks/shared @elastic/appex-sharedux +src/platform/packages/shared/home/sample_data_card @elastic/appex-sharedux +src/platform/packages/shared/home/sample_data_tab @elastic/appex-sharedux +src/platform/packages/shared/home/sample_data_types @elastic/appex-sharedux src/platform/packages/shared/kbn-actions-types @elastic/response-ops src/platform/packages/shared/kbn-alerting-types @elastic/response-ops src/platform/packages/shared/kbn-alerts-as-data-utils @elastic/response-ops @@ -483,6 +473,7 @@ src/platform/packages/shared/kbn-field-types @elastic/kibana-data-discovery src/platform/packages/shared/kbn-field-utils @elastic/kibana-data-discovery src/platform/packages/shared/kbn-flot-charts @elastic/kibana-presentation @elastic/stack-monitoring src/platform/packages/shared/kbn-grouping @elastic/response-ops +src/platform/packages/shared/kbn-guided-onboarding @elastic/appex-sharedux src/platform/packages/shared/kbn-i18n @elastic/kibana-core src/platform/packages/shared/kbn-i18n-react @elastic/kibana-core src/platform/packages/shared/kbn-interpreter @elastic/kibana-visualizations @@ -494,9 +485,12 @@ src/platform/packages/shared/kbn-management/cards_navigation @elastic/kibana-man src/platform/packages/shared/kbn-management/settings/components/field_input @elastic/kibana-management src/platform/packages/shared/kbn-management/settings/components/field_row @elastic/kibana-management src/platform/packages/shared/kbn-management/settings/field_definition @elastic/kibana-management +src/platform/packages/shared/kbn-management/settings/section_registry @elastic/appex-sharedux @elastic/kibana-management +src/platform/packages/shared/kbn-management/settings/setting_ids @elastic/appex-sharedux @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-monaco @elastic/appex-sharedux +src/platform/packages/shared/kbn-object-utils @elastic/kibana-core src/platform/packages/shared/kbn-object-versioning @elastic/appex-sharedux src/platform/packages/shared/kbn-object-versioning-utils @elastic/appex-sharedux src/platform/packages/shared/kbn-openapi-common @elastic/security-detection-rule-management @@ -556,7 +550,14 @@ src/platform/packages/shared/kbn-zod @elastic/kibana-core src/platform/packages/shared/kbn-zod-helpers @elastic/security-detection-rule-management src/platform/packages/shared/presentation/presentation_containers @elastic/kibana-presentation src/platform/packages/shared/presentation/presentation_publishing @elastic/kibana-presentation +src/platform/packages/shared/react/kibana_context/common @elastic/appex-sharedux +src/platform/packages/shared/react/kibana_context/render @elastic/appex-sharedux +src/platform/packages/shared/react/kibana_context/root @elastic/appex-sharedux +src/platform/packages/shared/react/kibana_context/styled @elastic/appex-sharedux +src/platform/packages/shared/react/kibana_context/theme @elastic/appex-sharedux +src/platform/packages/shared/react/kibana_mount @elastic/appex-sharedux src/platform/packages/shared/response-ops/rule_params @elastic/response-ops +src/platform/packages/shared/serverless/settings/observability_project @elastic/appex-sharedux @elastic/kibana-management @elastic/obs-ux-management-team src/platform/packages/shared/serverless/settings/search_project @elastic/search-kibana @elastic/kibana-management src/platform/packages/shared/serverless/settings/security_project @elastic/security-solution @elastic/kibana-management src/platform/packages/shared/shared-ux/avatar/solution @elastic/appex-sharedux @@ -838,6 +839,7 @@ x-pack/platform/plugins/private/custom_branding @elastic/appex-sharedux x-pack/platform/plugins/private/data_usage @elastic/obs-ai-assistant @elastic/security-solution x-pack/platform/plugins/private/data_visualizer @elastic/ml-ui x-pack/platform/plugins/private/discover_enhanced @elastic/kibana-data-discovery +x-pack/platform/plugins/private/drilldowns/url_drilldown @elastic/appex-sharedux x-pack/platform/plugins/private/file_upload @elastic/kibana-presentation @elastic/ml-ui x-pack/platform/plugins/private/global_search_bar @elastic/appex-sharedux x-pack/platform/plugins/private/global_search_providers @elastic/appex-sharedux @@ -902,7 +904,6 @@ x-pack/platform/plugins/shared/stack_alerts @elastic/response-ops x-pack/platform/plugins/shared/stack_connectors @elastic/response-ops x-pack/platform/plugins/shared/task_manager @elastic/response-ops x-pack/platform/plugins/shared/triggers_actions_ui @elastic/response-ops -x-pack/plugins/drilldowns/url_drilldown @elastic/appex-sharedux 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 @@ -932,7 +933,6 @@ x-pack/solutions/observability/plugins/observability_ai_assistant_app @elastic/o x-pack/solutions/observability/plugins/observability_ai_assistant_management @elastic/obs-ai-assistant x-pack/solutions/observability/plugins/observability_logs_explorer @elastic/obs-ux-logs-team x-pack/solutions/observability/plugins/observability_onboarding @elastic/obs-ux-logs-team -x-pack/solutions/observability/plugins/observability_onboarding/e2e @elastic/obs-ux-logs-team x-pack/solutions/observability/plugins/observability_shared @elastic/observability-ui x-pack/solutions/observability/plugins/observability_solution/entities_data_access @elastic/obs-entities x-pack/solutions/observability/plugins/observability_solution/entity_manager_app @elastic/obs-entities @@ -1304,7 +1304,6 @@ packages/kbn-monaco/src/esql @elastic/kibana-esql ## Logs UI code exceptions -> @elastic/obs-ux-logs-team /x-pack/test/api_integration/deployment_agnostic/apis/observability/data_quality/ @elastic/obs-ux-logs-team -/x-pack/test/upgrade/apps/logs @elastic/obs-ux-logs-team /x-pack/test_serverless/functional/page_objects/svl_oblt_onboarding_stream_log_file.ts @elastic/obs-ux-logs-team /x-pack/test_serverless/functional/page_objects/svl_oblt_onboarding_page.ts @elastic/obs-ux-logs-team /x-pack/solutions/observability/plugins/infra/common/http_api/log_alerts @elastic/obs-ux-logs-team @@ -1419,7 +1418,7 @@ packages/kbn-monaco/src/esql @elastic/kibana-esql /x-pack/test/functional/page_objects/dataset_quality.ts @elastic/obs-ux-logs-team /x-pack/test_serverless/functional/test_suites/observability/index* @elastic/obs-ux-logs-team /x-pack/test_serverless/functional/test_suites/observability/cypress @elastic/obs-ux-logs-team -/x-pack/test/functional/services/infra_source_configuration_form.ts @elastic/obs-ux-logs-team +/x-pack/test/functional/services/infra_source_configuration_form.ts @elastic/obs-ux-infra_services-team /x-pack/test/functional/services/logs_ui @elastic/obs-ux-logs-team /x-pack/test/functional/page_objects/observability_logs_explorer.ts @elastic/obs-ux-logs-team /test/functional/services/selectable.ts @elastic/obs-ux-logs-team diff --git a/.i18nrc.json b/.i18nrc.json index df5deb402b915..3e5f8512c3b9d 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -65,9 +65,9 @@ "grouping": "src/platform/packages/shared/kbn-grouping/src", "alertsGrouping": "x-pack/solutions/observability/packages/kbn-alerts-grouping", "guidedOnboarding": "src/platform/plugins/shared/guided_onboarding", - "guidedOnboardingPackage": "packages/kbn-guided-onboarding", + "guidedOnboardingPackage": "src/platform/packages/shared/kbn-guided-onboarding", "home": "src/platform/plugins/shared/home", - "homePackages": "packages/home", + "homePackages": "src/platform/packages/shared/home", "indexPatternEditor": "src/platform/plugins/shared/data_view_editor", "indexPatternFieldEditor": "src/platform/plugins/shared/data_view_field_editor", "indexPatternManagement": "src/platform/plugins/shared/data_view_management", @@ -99,7 +99,7 @@ "newsfeed": "src/platform/plugins/shared/newsfeed", "presentationUtil": "src/platform/plugins/shared/presentation_util", "randomSampling": "x-pack/platform/packages/private/kbn-random-sampling", - "reactPackages": "packages/react", + "reactPackages": ["src/platform/packages/shared/react", "src/platform/packages/private/react"], "esqlEditor": "src/platform/packages/private/kbn-esql-editor", "esqlUtils": "src/platform/packages/shared/kbn-esql-utils", "reporting": "src/platform/packages/private/kbn-reporting", diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 1f90e36cd7ce3..727a3aec35369 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -966,7 +966,7 @@ As a developer you can reuse and extend built-in alerts and actions UI functiona in their infrastructure. -|{kib-repo}blob/{branch}/x-pack/plugins/drilldowns/url_drilldown/README.md[urlDrilldown] +|{kib-repo}blob/{branch}/x-pack/platform/plugins/private/drilldowns/url_drilldown/README.md[urlDrilldown] |NOTE: This plugin contains implementation of URL drilldown. For drilldowns infrastructure code refer to ui_actions_enhanced plugin. diff --git a/oas_docs/output/kibana.serverless.yaml b/oas_docs/output/kibana.serverless.yaml index 719e4f3b735a1..40ed1874797c1 100644 --- a/oas_docs/output/kibana.serverless.yaml +++ b/oas_docs/output/kibana.serverless.yaml @@ -9367,6 +9367,27 @@ paths: tags: - Security Endpoint Management API x-beta: true + /api/endpoint/action/runscript: + post: + description: Run a shell command on an endpoint. + operationId: RunScriptAction + requestBody: + content: + application/json; Elastic-Api-Version=2023-10-31: + schema: + $ref: '#/components/schemas/Security_Endpoint_Management_API_RunScriptRouteRequestBody' + required: true + responses: + '200': + content: + application/json; Elastic-Api-Version=2023-10-31: + schema: + $ref: '#/components/schemas/Security_Endpoint_Management_API_SuccessResponse' + description: OK + summary: Run a script + tags: + - Security Endpoint Management API + x-beta: true /api/endpoint/action/scan: post: description: Scan a specific file or directory on an endpoint for malware. @@ -46578,6 +46599,23 @@ components: type: string minItems: 1 type: array + Security_Endpoint_Management_API_CloudFileScriptParameters: + type: object + properties: + cloudFile: + description: Script name in cloud storage. + minLength: 1 + type: string + commandLine: + description: Command line arguments. + minLength: 1 + type: string + timeout: + description: Timeout in seconds. + minimum: 1 + type: integer + required: + - cloudFile Security_Endpoint_Management_API_Command: description: The command to be executed (cannot be an empty string) enum: @@ -46704,6 +46742,23 @@ components: - parameters Security_Endpoint_Management_API_GetProcessesRouteRequestBody: $ref: '#/components/schemas/Security_Endpoint_Management_API_NoParametersRequestSchema' + Security_Endpoint_Management_API_HostPathScriptParameters: + type: object + properties: + commandLine: + description: Command line arguments. + minLength: 1 + type: string + hostPath: + description: Absolute or relative path of script on host machine. + minLength: 1 + type: string + timeout: + description: Timeout in seconds. + minimum: 1 + type: integer + required: + - hostPath Security_Endpoint_Management_API_IsolateRouteRequestBody: $ref: '#/components/schemas/Security_Endpoint_Management_API_NoParametersRequestSchema' Security_Endpoint_Management_API_KillProcessRouteRequestBody: @@ -46857,6 +46912,34 @@ components: properties: note: type: string + Security_Endpoint_Management_API_RawScriptParameters: + type: object + properties: + commandLine: + description: Command line arguments. + minLength: 1 + type: string + raw: + description: Raw script content. + minLength: 1 + type: string + timeout: + description: Timeout in seconds. + minimum: 1 + type: integer + required: + - raw + Security_Endpoint_Management_API_RunScriptRouteRequestBody: + type: object + properties: + parameters: + description: Exactly one of 'Raw', 'HostPath', or 'CloudFile' must be provided. CommandLine and Timeout are optional for all. + oneOf: + - $ref: '#/components/schemas/Security_Endpoint_Management_API_RawScriptParameters' + - $ref: '#/components/schemas/Security_Endpoint_Management_API_HostPathScriptParameters' + - $ref: '#/components/schemas/Security_Endpoint_Management_API_CloudFileScriptParameters' + required: + - parameters Security_Endpoint_Management_API_ScanRouteRequestBody: allOf: - type: object diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index d06897f5db6e2..c398c20361e64 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -11549,6 +11549,26 @@ paths: summary: Get running processes tags: - Security Endpoint Management API + /api/endpoint/action/runscript: + post: + description: Run a shell command on an endpoint. + operationId: RunScriptAction + requestBody: + content: + application/json; Elastic-Api-Version=2023-10-31: + schema: + $ref: '#/components/schemas/Security_Endpoint_Management_API_RunScriptRouteRequestBody' + required: true + responses: + '200': + content: + application/json; Elastic-Api-Version=2023-10-31: + schema: + $ref: '#/components/schemas/Security_Endpoint_Management_API_SuccessResponse' + description: OK + summary: Run a script + tags: + - Security Endpoint Management API /api/endpoint/action/scan: post: description: Scan a specific file or directory on an endpoint for malware. @@ -53454,6 +53474,23 @@ components: type: string minItems: 1 type: array + Security_Endpoint_Management_API_CloudFileScriptParameters: + type: object + properties: + cloudFile: + description: Script name in cloud storage. + minLength: 1 + type: string + commandLine: + description: Command line arguments. + minLength: 1 + type: string + timeout: + description: Timeout in seconds. + minimum: 1 + type: integer + required: + - cloudFile Security_Endpoint_Management_API_Command: description: The command to be executed (cannot be an empty string) enum: @@ -53580,6 +53617,23 @@ components: - parameters Security_Endpoint_Management_API_GetProcessesRouteRequestBody: $ref: '#/components/schemas/Security_Endpoint_Management_API_NoParametersRequestSchema' + Security_Endpoint_Management_API_HostPathScriptParameters: + type: object + properties: + commandLine: + description: Command line arguments. + minLength: 1 + type: string + hostPath: + description: Absolute or relative path of script on host machine. + minLength: 1 + type: string + timeout: + description: Timeout in seconds. + minimum: 1 + type: integer + required: + - hostPath Security_Endpoint_Management_API_IsolateRouteRequestBody: $ref: '#/components/schemas/Security_Endpoint_Management_API_NoParametersRequestSchema' Security_Endpoint_Management_API_KillProcessRouteRequestBody: @@ -53733,6 +53787,34 @@ components: properties: note: type: string + Security_Endpoint_Management_API_RawScriptParameters: + type: object + properties: + commandLine: + description: Command line arguments. + minLength: 1 + type: string + raw: + description: Raw script content. + minLength: 1 + type: string + timeout: + description: Timeout in seconds. + minimum: 1 + type: integer + required: + - raw + Security_Endpoint_Management_API_RunScriptRouteRequestBody: + type: object + properties: + parameters: + description: Exactly one of 'Raw', 'HostPath', or 'CloudFile' must be provided. CommandLine and Timeout are optional for all. + oneOf: + - $ref: '#/components/schemas/Security_Endpoint_Management_API_RawScriptParameters' + - $ref: '#/components/schemas/Security_Endpoint_Management_API_HostPathScriptParameters' + - $ref: '#/components/schemas/Security_Endpoint_Management_API_CloudFileScriptParameters' + required: + - parameters Security_Endpoint_Management_API_ScanRouteRequestBody: allOf: - type: object diff --git a/oas_docs/package-lock.json b/oas_docs/package-lock.json index 637641180323c..c6d3bb5e31641 100644 --- a/oas_docs/package-lock.json +++ b/oas_docs/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@redocly/cli": "^1.26.0", + "@redocly/cli": "^1.27.0", "bump-cli": "^2.8.4" } }, @@ -515,12 +515,12 @@ } }, "node_modules/@redocly/cli": { - "version": "1.26.0", - "resolved": "https://registry.npmjs.org/@redocly/cli/-/cli-1.26.0.tgz", - "integrity": "sha512-yUsrTmEPHaBDQf16jSFGi2n+AJabHacLpr7La92Dseo0tRkgLKsUWiaVEEyqm79POBytD87mVTi3THitqnSyZQ==", + "version": "1.27.1", + "resolved": "https://registry.npmjs.org/@redocly/cli/-/cli-1.27.1.tgz", + "integrity": "sha512-IgFzIKgWDaGY8jOlWYVp7VyIwElIjqrVLvZWzdDS/vdQlJ0DdISQ1nRy/YSh0Rqw69hJOpgn5cXMH/SS/qO33Q==", "license": "MIT", "dependencies": { - "@redocly/openapi-core": "1.26.0", + "@redocly/openapi-core": "1.27.1", "abort-controller": "^3.0.0", "chokidar": "^3.5.1", "colorette": "^1.2.0", @@ -556,9 +556,9 @@ "license": "MIT" }, "node_modules/@redocly/openapi-core": { - "version": "1.26.0", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.26.0.tgz", - "integrity": "sha512-8Ofu6WpBp7eoLmf1qQ4+T0W4LRr8es+4Drw/RJG+acPXmaT2TmHk2B2v+3+1R9GqSIj6kx3N7JmQkxAPCnvDLw==", + "version": "1.27.1", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.27.1.tgz", + "integrity": "sha512-zQ47/A+Drk2Y75/af69MD3Oad4H9LxkUDzcm7XBkyLNDKIWQrDKDnS5476oDq77+zciymNxgMVtxxVXlnGS8kw==", "license": "MIT", "dependencies": { "@redocly/ajv": "^8.11.2", @@ -567,7 +567,6 @@ "https-proxy-agent": "^7.0.4", "js-levenshtein": "^1.1.6", "js-yaml": "^4.1.0", - "lodash.isequal": "^4.5.0", "minimatch": "^5.0.1", "node-fetch": "^2.6.1", "pluralize": "^8.0.0", @@ -2740,7 +2739,8 @@ "node_modules/lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==" + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", + "peer": true }, "node_modules/loose-envify": { "version": "1.4.0", diff --git a/oas_docs/package.json b/oas_docs/package.json index 81ce46597c50d..ef981c7d891ee 100644 --- a/oas_docs/package.json +++ b/oas_docs/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "bump-cli": "^2.8.4", - "@redocly/cli": "^1.26.0" + "@redocly/cli": "^1.27.0" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/package.json b/package.json index 82d6ab24099cb..0092b609fd5cf 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "@elastic/charts": "68.0.4", "@elastic/datemath": "5.0.3", "@elastic/ebt": "^1.1.1", - "@elastic/ecs": "^8.11.1", + "@elastic/ecs": "^8.11.5", "@elastic/elasticsearch": "^8.16.0", "@elastic/ems-client": "8.6.2", "@elastic/eui": "98.2.1-borealis.2", @@ -262,7 +262,7 @@ "@kbn/core-capabilities-common": "link:src/core/packages/capabilities/common", "@kbn/core-capabilities-server": "link:src/core/packages/capabilities/server", "@kbn/core-capabilities-server-internal": "link:src/core/packages/capabilities/server-internal", - "@kbn/core-chrome-browser": "link:packages/core/chrome/core-chrome-browser", + "@kbn/core-chrome-browser": "link:src/core/packages/chrome/browser", "@kbn/core-chrome-browser-internal": "link:src/core/packages/chrome/browser-internal", "@kbn/core-config-server-internal": "link:src/core/packages/config/server-internal", "@kbn/core-custom-branding-browser": "link:src/core/packages/custom-branding/browser", @@ -445,7 +445,7 @@ "@kbn/deeplinks-observability": "link:src/platform/packages/shared/deeplinks/observability", "@kbn/deeplinks-search": "link:src/platform/packages/shared/deeplinks/search", "@kbn/deeplinks-security": "link:src/platform/packages/shared/deeplinks/security", - "@kbn/deeplinks-shared": "link:packages/deeplinks/shared", + "@kbn/deeplinks-shared": "link:src/platform/packages/shared/deeplinks/shared", "@kbn/default-nav-analytics": "link:src/platform/packages/private/default-nav/analytics", "@kbn/default-nav-devtools": "link:src/platform/packages/private/default-nav/devtools", "@kbn/default-nav-management": "link:src/platform/packages/private/default-nav/management", @@ -551,7 +551,7 @@ "@kbn/grid-layout": "link:packages/kbn-grid-layout", "@kbn/grokdebugger-plugin": "link:x-pack/platform/plugins/private/grokdebugger", "@kbn/grouping": "link:src/platform/packages/shared/kbn-grouping", - "@kbn/guided-onboarding": "link:packages/kbn-guided-onboarding", + "@kbn/guided-onboarding": "link:src/platform/packages/shared/kbn-guided-onboarding", "@kbn/guided-onboarding-example-plugin": "link:examples/guided_onboarding_example", "@kbn/guided-onboarding-plugin": "link:src/platform/plugins/shared/guided_onboarding", "@kbn/handlebars": "link:src/platform/packages/private/kbn-handlebars", @@ -560,9 +560,9 @@ "@kbn/health-gateway-server": "link:src/platform/packages/private/kbn-health-gateway-server", "@kbn/hello-world-plugin": "link:examples/hello_world", "@kbn/home-plugin": "link:src/platform/plugins/shared/home", - "@kbn/home-sample-data-card": "link:packages/home/sample_data_card", - "@kbn/home-sample-data-tab": "link:packages/home/sample_data_tab", - "@kbn/home-sample-data-types": "link:packages/home/sample_data_types", + "@kbn/home-sample-data-card": "link:src/platform/packages/shared/home/sample_data_card", + "@kbn/home-sample-data-tab": "link:src/platform/packages/shared/home/sample_data_tab", + "@kbn/home-sample-data-types": "link:src/platform/packages/shared/home/sample_data_types", "@kbn/i18n": "link:src/platform/packages/shared/kbn-i18n", "@kbn/i18n-react": "link:src/platform/packages/shared/kbn-i18n-react", "@kbn/iframe-embedded-plugin": "link:x-pack/test/functional_embedded/plugins/iframe_embedded", @@ -592,7 +592,7 @@ "@kbn/investigation-shared": "link:x-pack/solutions/observability/packages/kbn-investigation-shared", "@kbn/io-ts-utils": "link:src/platform/packages/shared/kbn-io-ts-utils", "@kbn/ipynb": "link:x-pack/solutions/search/packages/kbn-ipynb", - "@kbn/item-buffer": "link:packages/kbn-item-buffer", + "@kbn/item-buffer": "link:src/platform/packages/private/kbn-item-buffer", "@kbn/json-schemas": "link:x-pack/platform/packages/private/ml/json_schemas", "@kbn/kbn-health-gateway-status-plugin": "link:test/health_gateway/plugins/status", "@kbn/kbn-sample-panel-action-plugin": "link:test/plugin_functional/plugins/kbn_sample_panel_action", @@ -635,8 +635,8 @@ "@kbn/management-settings-components-field-row": "link:src/platform/packages/shared/kbn-management/settings/components/field_row", "@kbn/management-settings-components-form": "link:src/platform/packages/private/kbn-management/settings/components/form", "@kbn/management-settings-field-definition": "link:src/platform/packages/shared/kbn-management/settings/field_definition", - "@kbn/management-settings-ids": "link:packages/kbn-management/settings/setting_ids", - "@kbn/management-settings-section-registry": "link:packages/kbn-management/settings/section_registry", + "@kbn/management-settings-ids": "link:src/platform/packages/shared/kbn-management/settings/setting_ids", + "@kbn/management-settings-section-registry": "link:src/platform/packages/shared/kbn-management/settings/section_registry", "@kbn/management-settings-types": "link:src/platform/packages/shared/kbn-management/settings/types", "@kbn/management-settings-utilities": "link:src/platform/packages/shared/kbn-management/settings/utilities", "@kbn/management-test-plugin": "link:test/plugin_functional/plugins/management_test_plugin", @@ -686,6 +686,7 @@ "@kbn/newsfeed-test-plugin": "link:test/common/plugins/newsfeed", "@kbn/no-data-page-plugin": "link:src/platform/plugins/private/no_data_page", "@kbn/notifications-plugin": "link:x-pack/platform/plugins/shared/notifications", + "@kbn/object-utils": "link:src/platform/packages/shared/kbn-object-utils", "@kbn/object-versioning": "link:src/platform/packages/shared/kbn-object-versioning", "@kbn/object-versioning-utils": "link:src/platform/packages/shared/kbn-object-versioning-utils", "@kbn/observability-ai-assistant-app-plugin": "link:x-pack/solutions/observability/plugins/observability_ai_assistant_app", @@ -730,13 +731,13 @@ "@kbn/random-sampling": "link:x-pack/platform/packages/private/kbn-random-sampling", "@kbn/react-field": "link:src/platform/packages/shared/kbn-react-field", "@kbn/react-hooks": "link:src/platform/packages/shared/kbn-react-hooks", - "@kbn/react-kibana-context-common": "link:packages/react/kibana_context/common", - "@kbn/react-kibana-context-render": "link:packages/react/kibana_context/render", - "@kbn/react-kibana-context-root": "link:packages/react/kibana_context/root", - "@kbn/react-kibana-context-styled": "link:packages/react/kibana_context/styled", - "@kbn/react-kibana-context-theme": "link:packages/react/kibana_context/theme", - "@kbn/react-kibana-mount": "link:packages/react/kibana_mount", - "@kbn/react-mute-legacy-root-warning": "link:packages/kbn-react-mute-legacy-root-warning", + "@kbn/react-kibana-context-common": "link:src/platform/packages/shared/react/kibana_context/common", + "@kbn/react-kibana-context-render": "link:src/platform/packages/shared/react/kibana_context/render", + "@kbn/react-kibana-context-root": "link:src/platform/packages/shared/react/kibana_context/root", + "@kbn/react-kibana-context-styled": "link:src/platform/packages/shared/react/kibana_context/styled", + "@kbn/react-kibana-context-theme": "link:src/platform/packages/shared/react/kibana_context/theme", + "@kbn/react-kibana-mount": "link:src/platform/packages/shared/react/kibana_mount", + "@kbn/react-mute-legacy-root-warning": "link:src/platform/packages/private/kbn-react-mute-legacy-root-warning", "@kbn/recently-accessed": "link:src/platform/packages/shared/kbn-recently-accessed", "@kbn/remote-clusters-plugin": "link:x-pack/platform/plugins/private/remote_clusters", "@kbn/rendering-plugin": "link:test/plugin_functional/plugins/rendering_plugin", @@ -782,7 +783,7 @@ "@kbn/saved-objects-hidden-type-plugin": "link:test/plugin_functional/plugins/saved_objects_hidden_type", "@kbn/saved-objects-management-plugin": "link:src/platform/plugins/shared/saved_objects_management", "@kbn/saved-objects-plugin": "link:src/platform/plugins/shared/saved_objects", - "@kbn/saved-objects-settings": "link:packages/kbn-saved-objects-settings", + "@kbn/saved-objects-settings": "link:src/platform/packages/private/kbn-saved-objects-settings", "@kbn/saved-objects-tagging-oss-plugin": "link:src/platform/plugins/shared/saved_objects_tagging_oss", "@kbn/saved-objects-tagging-plugin": "link:x-pack/platform/plugins/shared/saved_objects_tagging", "@kbn/saved-search-component": "link:packages/kbn-saved-search-component", @@ -859,14 +860,14 @@ "@kbn/server-route-repository-client": "link:src/platform/packages/shared/kbn-server-route-repository-client", "@kbn/server-route-repository-utils": "link:src/platform/packages/shared/kbn-server-route-repository-utils", "@kbn/serverless": "link:x-pack/platform/plugins/shared/serverless", - "@kbn/serverless-common-settings": "link:packages/serverless/settings/common", + "@kbn/serverless-common-settings": "link:src/platform/packages/private/serverless/settings/common", "@kbn/serverless-observability": "link:x-pack/solutions/observability/plugins/serverless_observability", - "@kbn/serverless-observability-settings": "link:packages/serverless/settings/observability_project", - "@kbn/serverless-project-switcher": "link:packages/serverless/project_switcher", + "@kbn/serverless-observability-settings": "link:src/platform/packages/shared/serverless/settings/observability_project", + "@kbn/serverless-project-switcher": "link:src/platform/packages/private/serverless/project_switcher", "@kbn/serverless-search": "link:x-pack/solutions/search/plugins/serverless_search", "@kbn/serverless-search-settings": "link:src/platform/packages/shared/serverless/settings/search_project", "@kbn/serverless-security-settings": "link:src/platform/packages/shared/serverless/settings/security_project", - "@kbn/serverless-types": "link:packages/serverless/types", + "@kbn/serverless-types": "link:src/platform/packages/private/serverless/types", "@kbn/session-notifications-plugin": "link:test/plugin_functional/plugins/session_notifications", "@kbn/session-view-plugin": "link:x-pack/solutions/security/plugins/session_view", "@kbn/share-examples-plugin": "link:examples/share_examples", @@ -989,7 +990,7 @@ "@kbn/unsaved-changes-prompt": "link:src/platform/packages/shared/kbn-unsaved-changes-prompt", "@kbn/upgrade-assistant-plugin": "link:x-pack/platform/plugins/private/upgrade_assistant", "@kbn/uptime-plugin": "link:x-pack/solutions/observability/plugins/uptime", - "@kbn/url-drilldown-plugin": "link:x-pack/plugins/drilldowns/url_drilldown", + "@kbn/url-drilldown-plugin": "link:x-pack/platform/plugins/private/drilldowns/url_drilldown", "@kbn/url-forwarding-plugin": "link:src/platform/plugins/private/url_forwarding", "@kbn/usage-collection-plugin": "link:src/platform/plugins/shared/usage_collection", "@kbn/usage-collection-test-plugin": "link:test/plugin_functional/plugins/usage_collection", @@ -1159,7 +1160,7 @@ "icalendar": "0.7.1", "immer": "^9.0.21", "inquirer": "^7.3.3", - "io-ts": "^2.0.5", + "io-ts": "^2.2.22", "ipaddr.js": "2.0.0", "isbinaryfile": "4.0.2", "joi": "^17.13.3", @@ -1172,6 +1173,7 @@ "json-stable-stringify": "^1.0.1", "json-stringify-pretty-compact": "1.2.0", "json-stringify-safe": "5.0.1", + "jsonpath-plus": "^10.2.0", "jsonwebtoken": "^9.0.2", "jsts": "^1.6.2", "kea": "^2.6.0", @@ -1203,6 +1205,7 @@ "nodemailer": "^6.9.15", "normalize-path": "^3.0.0", "nunjucks": "^3.2.4", + "oas": "^25.2.0", "object-hash": "^3.0.0", "object-path-immutable": "^3.1.1", "openai": "^4.72.0", @@ -1474,7 +1477,6 @@ "@kbn/manifest": "link:packages/kbn-manifest", "@kbn/mock-idp-plugin": "link:packages/kbn-mock-idp-plugin", "@kbn/mock-idp-utils": "link:packages/kbn-mock-idp-utils", - "@kbn/observability-onboarding-e2e": "link:x-pack/solutions/observability/plugins/observability_onboarding/e2e", "@kbn/openapi-bundler": "link:packages/kbn-openapi-bundler", "@kbn/openapi-generator": "link:packages/kbn-openapi-generator", "@kbn/optimizer": "link:packages/kbn-optimizer", @@ -1527,7 +1529,7 @@ "@octokit/rest": "^17.11.2", "@parcel/watcher": "^2.1.0", "@playwright/test": "1.49.0", - "@redocly/cli": "^1.26.0", + "@redocly/cli": "^1.27.0", "@statoscope/webpack-plugin": "^5.28.2", "@storybook/addon-a11y": "^6.5.16", "@storybook/addon-actions": "^6.5.16", diff --git a/packages/kbn-babel-preset/styled_components_files.js b/packages/kbn-babel-preset/styled_components_files.js index eb105084f426c..60251771689bb 100644 --- a/packages/kbn-babel-preset/styled_components_files.js +++ b/packages/kbn-babel-preset/styled_components_files.js @@ -578,6 +578,7 @@ module.exports = { /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]timelines[\/\\]public[\/\\]components[\/\\]loading[\/\\]index.tsx/, /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]timelines[\/\\]public[\/\\]mock[\/\\]test_providers.tsx/, /x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]public[\/\\]applications[\/\\]resolver_test[\/\\]index.tsx/, + /src[\/\\]platform[\/\\]packages[\/\\]shared[\/\\]react[\/\\]kibana_context[\/\\]styled[\/\\]styled_provider.tsx/, /src[\/\\]platform[\/\\]plugins[\/\\]shared[\/\\]custom_integrations[\/\\]public[\/\\]components[\/\\]fleet_integration[\/\\]elasticsearch_dotnet[\/\\]elasticsearch_dotnet_readme.tsx/, /src[\/\\]platform[\/\\]plugins[\/\\]shared[\/\\]custom_integrations[\/\\]public[\/\\]components[\/\\]fleet_integration[\/\\]elasticsearch_go[\/\\]elasticsearch_go_readme.tsx/, /src[\/\\]platform[\/\\]plugins[\/\\]shared[\/\\]custom_integrations[\/\\]public[\/\\]components[\/\\]fleet_integration[\/\\]elasticsearch_java[\/\\]elasticsearch_java_readme.tsx/, @@ -586,6 +587,5 @@ module.exports = { /src[\/\\]platform[\/\\]plugins[\/\\]shared[\/\\]custom_integrations[\/\\]public[\/\\]components[\/\\]fleet_integration[\/\\]elasticsearch_py[\/\\]elasticsearch_py_readme.tsx/, /src[\/\\]platform[\/\\]plugins[\/\\]shared[\/\\]custom_integrations[\/\\]public[\/\\]components[\/\\]fleet_integration[\/\\]elasticsearch_ruby[\/\\]elasticsearch_ruby_readme.tsx/, /src[\/\\]platform[\/\\]plugins[\/\\]shared[\/\\]custom_integrations[\/\\]public[\/\\]components[\/\\]fleet_integration[\/\\]sample[\/\\]sample_client_readme.tsx/, - /packages[\/\\]react[\/\\]kibana_context[\/\\]styled[\/\\]styled_provider.tsx/, ], }; diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index cadfe863b1ab3..43cefb1f22e0b 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -15,7 +15,7 @@ pageLoadAssetSize: cloudExperiments: 109746 cloudFullStory: 18493 cloudLinks: 55984 - cloudSecurityPosture: 19109 + cloudSecurityPosture: 19270 console: 46091 contentManagement: 16254 controls: 60000 diff --git a/packages/kbn-relocate/list.ts b/packages/kbn-relocate/list.ts index ed1c2072429b5..73fe93f3b6d9f 100644 --- a/packages/kbn-relocate/list.ts +++ b/packages/kbn-relocate/list.ts @@ -11,14 +11,14 @@ import { sortBy } from 'lodash'; import type { ToolingLog } from '@kbn/tooling-log'; import { getPackages } from '@kbn/repo-packages'; import { REPO_ROOT } from '@kbn/repo-info'; +import { join } from 'path'; import type { Package } from './types'; import { BASE_FOLDER, EXCLUDED_MODULES, KIBANA_FOLDER } from './constants'; import { calculateModuleTargetFolder, isInTargetFolder } from './utils/relocate'; import { createModuleTable } from './utils/logging'; +import { safeExec } from './utils/exec'; export const listModules = async (listFlag: string, log: ToolingLog) => { - // get all modules - const modules = getPackages(REPO_ROOT); const devOnly: Package[] = []; const test: Package[] = []; const examples: Package[] = []; @@ -26,47 +26,38 @@ export const listModules = async (listFlag: string, log: ToolingLog) => { const incorrect: Package[] = []; const correct: Package[] = []; + // get all modules + await safeExec('yarn kbn bootstrap'); + const modules = getPackages(REPO_ROOT); + // find modules selected by user filters sortBy(modules, 'directory') // explicit exclusions .filter(({ id }) => !EXCLUDED_MODULES.includes(id)) .forEach((module) => { + const directory = module.directory.startsWith(BASE_FOLDER) + ? module.directory + : join(BASE_FOLDER, module.directory); + if (module.isDevOnly()) { devOnly.push(module); - return; - } - - if ( - module.directory.includes(`/${KIBANA_FOLDER}/test/`) || - module.directory.includes(`/${KIBANA_FOLDER}/x-pack/test/`) + } else if ( + directory.includes(`/${KIBANA_FOLDER}/test/`) || + directory.includes(`/${KIBANA_FOLDER}/x-pack/test/`) ) { test.push(module); - return; - } - - if ( - module.directory.includes(`/${KIBANA_FOLDER}/examples/`) || - module.directory.includes(`/${KIBANA_FOLDER}/x-pack/examples/`) + } else if ( + directory.includes(`/${KIBANA_FOLDER}/examples/`) || + directory.includes(`/${KIBANA_FOLDER}/x-pack/examples/`) ) { examples.push(module); - return; - } - - if (!module.group || module.group === 'common' || !module.visibility) { - // log.warning(`The module ${module.id} does not specify 'group' or 'visibility'. Skipping`); + } else if (!module.group || module.group === 'common' || !module.visibility) { uncategorised.push(module); - return; - } - - if (!isInTargetFolder(module)) { + } else if (!isInTargetFolder(module)) { incorrect.push(module); - // log.warning(dedent`The module ${module.id} is not in the correct folder: - // - ${module.directory} - // - ${calculateModuleTargetFolder(module)}`); - - return; + } else { + correct.push(module); } - correct.push(module); }); if (listFlag === 'all') { diff --git a/packages/kbn-relocate/relocate.ts b/packages/kbn-relocate/relocate.ts index d377ffe35dbdf..98da95f39f98f 100644 --- a/packages/kbn-relocate/relocate.ts +++ b/packages/kbn-relocate/relocate.ts @@ -102,6 +102,7 @@ export interface RelocateModulesParams { const findModules = ({ teams, paths, included, excluded }: FindModulesParams, log: ToolingLog) => { // get all modules const modules = getPackages(REPO_ROOT); + const moduleFilters = teams.length > 0 || paths.length > 0 || included.length > 0; // find modules selected by user filters return ( @@ -121,6 +122,7 @@ const findModules = ({ teams, paths, included, excluded }: FindModulesParams, lo // the module is under the umbrella specified by the user .filter( (module) => + !moduleFilters || included.includes(module.id) || teams.some((team) => belongsTo(module, team)) || paths.some((path) => module.directory.includes(path)) diff --git a/packages/kbn-scout/src/config/serverless/serverless.base.config.ts b/packages/kbn-scout/src/config/serverless/serverless.base.config.ts index 0df42d354a1e1..c7fb06da954ef 100644 --- a/packages/kbn-scout/src/config/serverless/serverless.base.config.ts +++ b/packages/kbn-scout/src/config/serverless/serverless.base.config.ts @@ -12,10 +12,12 @@ import { format as formatUrl } from 'url'; import Fs from 'fs'; import { CA_CERT_PATH, kibanaDevServiceAccount } from '@kbn/dev-utils'; -import { defineDockerServersConfig, getDockerFileMountPath } from '@kbn/test'; +import { + fleetPackageRegistryDockerImage, + defineDockerServersConfig, + getDockerFileMountPath, +} from '@kbn/test'; import { MOCK_IDP_REALM_NAME } from '@kbn/mock-idp-utils'; - -import { dockerImage } from '@kbn/test-suites-xpack/fleet_api_integration/config.base'; import { REPO_ROOT } from '@kbn/repo-info'; import { ScoutServerConfig } from '../../types'; import { SAML_IDP_PLUGIN_PATH, SERVERLESS_IDP_METADATA_PATH, JWKS_PATH } from '../constants'; @@ -55,7 +57,7 @@ export const defaultConfig: ScoutServerConfig = { dockerServers: defineDockerServersConfig({ registry: { enabled: !!dockerRegistryPort, - image: dockerImage, + image: fleetPackageRegistryDockerImage, portInContainer: 8080, port: dockerRegistryPort, args: dockerArgs, diff --git a/packages/kbn-scout/src/config/stateful/base.config.ts b/packages/kbn-scout/src/config/stateful/base.config.ts index 2bac0024ad4e3..043b34723a21c 100644 --- a/packages/kbn-scout/src/config/stateful/base.config.ts +++ b/packages/kbn-scout/src/config/stateful/base.config.ts @@ -17,12 +17,9 @@ import { MOCK_IDP_ATTRIBUTE_EMAIL, MOCK_IDP_ATTRIBUTE_NAME, } from '@kbn/mock-idp-utils'; -import { defineDockerServersConfig } from '@kbn/test'; +import { fleetPackageRegistryDockerImage, defineDockerServersConfig } from '@kbn/test'; import path from 'path'; - import { MOCK_IDP_REALM_NAME } from '@kbn/mock-idp-utils'; - -import { dockerImage } from '@kbn/test-suites-xpack/fleet_api_integration/config.base'; import { REPO_ROOT } from '@kbn/repo-info'; import { STATEFUL_ROLES_ROOT_PATH } from '@kbn/es'; import type { ScoutServerConfig } from '../../types'; @@ -66,7 +63,7 @@ export const defaultConfig: ScoutServerConfig = { dockerServers: defineDockerServersConfig({ registry: { enabled: !!dockerRegistryPort, - image: dockerImage, + image: fleetPackageRegistryDockerImage, portInContainer: 8080, port: dockerRegistryPort, args: dockerArgs, diff --git a/packages/kbn-scout/tsconfig.json b/packages/kbn-scout/tsconfig.json index 4be38ce4c80fd..9a8fa16477ec2 100644 --- a/packages/kbn-scout/tsconfig.json +++ b/packages/kbn-scout/tsconfig.json @@ -25,7 +25,6 @@ "@kbn/es-archiver", "@kbn/dev-utils", "@kbn/mock-idp-utils", - "@kbn/test-suites-xpack", "@kbn/test-subj-selector", "@kbn/scout-info", "@kbn/scout-reporting" diff --git a/packages/kbn-test/index.ts b/packages/kbn-test/index.ts index cc97a4afa7906..725893b6c6a39 100644 --- a/packages/kbn-test/index.ts +++ b/packages/kbn-test/index.ts @@ -78,3 +78,10 @@ export * from './src/kbn_client'; export * from './src/find_test_plugin_paths'; export { getDockerFileMountPath } from '@kbn/es'; + +// Docker image to use for Fleet API integration tests. +// This image comes from the latest successful build of https://buildkite.com/elastic/kibana-package-registry-promote +// which is promoted after acceptance tests succeed against docker.elastic.co/package-registry/distribution:lite +export const fleetPackageRegistryDockerImage = + process.env.FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE || + 'docker.elastic.co/kibana-ci/package-registry-distribution:lite'; diff --git a/packages/kbn-test/jest-preset.js b/packages/kbn-test/jest-preset.js index 5f60f52d04181..82781c3d018d4 100644 --- a/packages/kbn-test/jest-preset.js +++ b/packages/kbn-test/jest-preset.js @@ -78,7 +78,7 @@ module.exports = { // A list of paths to snapshot serializer modules Jest should use for snapshot testing snapshotSerializers: [ - '/packages/react/kibana_mount/test_helpers/react_mount_serializer.ts', + '/src/platform/packages/shared/react/kibana_mount/test_helpers/react_mount_serializer.ts', 'enzyme-to-json/serializer', '/packages/kbn-test/src/jest/setup/emotion.js', ], diff --git a/packages/react/kibana_context/common/jest.config.js b/packages/react/kibana_context/common/jest.config.js deleted file mode 100644 index 708e43e399a34..0000000000000 --- a/packages/react/kibana_context/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/react/kibana_context/common'], -}; diff --git a/packages/react/kibana_context/render/jest.config.js b/packages/react/kibana_context/render/jest.config.js deleted file mode 100644 index c02768dbba623..0000000000000 --- a/packages/react/kibana_context/render/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/react/kibana_context/render'], -}; diff --git a/packages/react/kibana_context/root/jest.config.js b/packages/react/kibana_context/root/jest.config.js deleted file mode 100644 index b38b84714318d..0000000000000 --- a/packages/react/kibana_context/root/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/react/kibana_context/root'], -}; diff --git a/packages/react/kibana_context/styled/jest.config.js b/packages/react/kibana_context/styled/jest.config.js deleted file mode 100644 index d71954a615f5b..0000000000000 --- a/packages/react/kibana_context/styled/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/react/kibana_context/styled'], -}; diff --git a/packages/react/kibana_context/theme/jest.config.js b/packages/react/kibana_context/theme/jest.config.js deleted file mode 100644 index 3d6452df29f45..0000000000000 --- a/packages/react/kibana_context/theme/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/react/kibana_context/theme'], -}; diff --git a/packages/serverless/project_switcher/jest.config.js b/packages/serverless/project_switcher/jest.config.js deleted file mode 100644 index 9f223dca5b719..0000000000000 --- a/packages/serverless/project_switcher/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/serverless/project_switcher'], -}; diff --git a/src/core/packages/chrome/browser-internal/src/ui/header/header_help_menu.tsx b/src/core/packages/chrome/browser-internal/src/ui/header/header_help_menu.tsx index b6789a096f7da..84c93a2ed0222 100644 --- a/src/core/packages/chrome/browser-internal/src/ui/header/header_help_menu.tsx +++ b/src/core/packages/chrome/browser-internal/src/ui/header/header_help_menu.tsx @@ -21,8 +21,9 @@ import { EuiPopover, EuiPopoverTitle, EuiSpacer, - EuiTitle, - EuiHorizontalRule, + EuiPopoverFooter, + withEuiTheme, + WithEuiThemeProps, } from '@elastic/eui'; import type { InternalApplicationStart } from '@kbn/core-application-browser-internal'; @@ -33,6 +34,7 @@ import type { import type { ChromeHelpMenuLink } from '@kbn/core-chrome-browser/src'; import type { DocLinksStart } from '@kbn/core-doc-links-browser'; +import { css } from '@emotion/react'; import { HeaderExtension } from './header_extension'; import { isModifiedOrPrevented } from './nav_link'; @@ -68,7 +70,6 @@ const buildDefaultContentLinks = ({ defaultMessage: 'Open an issue in GitHub', }), href: docLinks.links.kibana.createGithubIssue, - iconType: 'logoGithub', }, ]; @@ -92,10 +93,10 @@ interface State { defaultContentLinks: ChromeHelpMenuLink[]; } -export class HeaderHelpMenu extends Component { +class HelpMenu extends Component { private subscription?: Subscription; - constructor(props: Props) { + constructor(props: Props & WithEuiThemeProps) { super(props); this.state = { @@ -136,12 +137,16 @@ export class HeaderHelpMenu extends Component { } public render() { - const { kibanaVersion } = this.props; + const { kibanaVersion, theme } = this.props; const defaultContent = this.renderDefaultContent(); const globalCustomContent = this.renderGlobalCustomContent(); const customContent = this.renderCustomContent(); + const euiThemePadding = css` + padding: ${theme.euiTheme.size.s}; + `; + const button = ( { {defaultContent} {customContent && ( <> - + {customContent} )} @@ -210,40 +215,37 @@ export class HeaderHelpMenu extends Component { return ( - {defaultContentLinks.map( - ({ href, title, iconType, onClick: _onClick, dataTestSubj }, i) => { - const isLast = i === defaultContentLinks.length - 1; - - if (href && _onClick) { - throw new Error( - 'Only one of `href` and `onClick` should be provided for the help menu link.' - ); - } - - const hrefProps = href ? { href, target: '_blank' } : {}; - const onClick = () => { - if (!_onClick) return; - _onClick(); - this.closeMenu(); - }; - - return ( - - - {title} - - {!isLast && } - + {defaultContentLinks.map(({ href, title, onClick: _onClick, dataTestSubj }, i) => { + const isLast = i === defaultContentLinks.length - 1; + + if (href && _onClick) { + throw new Error( + 'Only one of `href` and `onClick` should be provided for the help menu link.' ); } - )} + + const hrefProps = href ? { href, target: '_blank' } : {}; + const onClick = () => { + if (!_onClick) return; + _onClick(); + this.closeMenu(); + }; + + return ( + + + {title} + + {!isLast && } + + ); + })} ); } @@ -333,10 +335,9 @@ export class HeaderHelpMenu extends Component { return ( <> - +

{appName}

-
- + {customLinks} {content && ( <> @@ -402,3 +403,5 @@ const createCustomLink = ( ); }; + +export const HeaderHelpMenu = withEuiTheme(HelpMenu); diff --git a/packages/core/chrome/core-chrome-browser/README.md b/src/core/packages/chrome/browser/README.md similarity index 100% rename from packages/core/chrome/core-chrome-browser/README.md rename to src/core/packages/chrome/browser/README.md diff --git a/packages/core/chrome/core-chrome-browser/index.ts b/src/core/packages/chrome/browser/index.ts similarity index 100% rename from packages/core/chrome/core-chrome-browser/index.ts rename to src/core/packages/chrome/browser/index.ts diff --git a/packages/kbn-guided-onboarding/jest.config.js b/src/core/packages/chrome/browser/jest.config.js similarity index 85% rename from packages/kbn-guided-onboarding/jest.config.js rename to src/core/packages/chrome/browser/jest.config.js index 19b9e73d70359..37b0603d800df 100644 --- a/packages/kbn-guided-onboarding/jest.config.js +++ b/src/core/packages/chrome/browser/jest.config.js @@ -9,6 +9,6 @@ module.exports = { preset: '@kbn/test', - rootDir: '../..', - roots: ['/packages/kbn-guided-onboarding'], + rootDir: '../../../../..', + roots: ['/src/core/packages/chrome/browser'], }; diff --git a/packages/core/chrome/core-chrome-browser/kibana.jsonc b/src/core/packages/chrome/browser/kibana.jsonc similarity index 100% rename from packages/core/chrome/core-chrome-browser/kibana.jsonc rename to src/core/packages/chrome/browser/kibana.jsonc diff --git a/packages/core/chrome/core-chrome-browser/package.json b/src/core/packages/chrome/browser/package.json similarity index 100% rename from packages/core/chrome/core-chrome-browser/package.json rename to src/core/packages/chrome/browser/package.json diff --git a/packages/core/chrome/core-chrome-browser/src/breadcrumb.ts b/src/core/packages/chrome/browser/src/breadcrumb.ts similarity index 100% rename from packages/core/chrome/core-chrome-browser/src/breadcrumb.ts rename to src/core/packages/chrome/browser/src/breadcrumb.ts diff --git a/packages/core/chrome/core-chrome-browser/src/contracts.ts b/src/core/packages/chrome/browser/src/contracts.ts similarity index 100% rename from packages/core/chrome/core-chrome-browser/src/contracts.ts rename to src/core/packages/chrome/browser/src/contracts.ts diff --git a/packages/core/chrome/core-chrome-browser/src/doc_title.ts b/src/core/packages/chrome/browser/src/doc_title.ts similarity index 100% rename from packages/core/chrome/core-chrome-browser/src/doc_title.ts rename to src/core/packages/chrome/browser/src/doc_title.ts diff --git a/packages/core/chrome/core-chrome-browser/src/help_extension.ts b/src/core/packages/chrome/browser/src/help_extension.ts similarity index 100% rename from packages/core/chrome/core-chrome-browser/src/help_extension.ts rename to src/core/packages/chrome/browser/src/help_extension.ts diff --git a/packages/core/chrome/core-chrome-browser/src/index.ts b/src/core/packages/chrome/browser/src/index.ts similarity index 100% rename from packages/core/chrome/core-chrome-browser/src/index.ts rename to src/core/packages/chrome/browser/src/index.ts diff --git a/packages/core/chrome/core-chrome-browser/src/nav_controls.ts b/src/core/packages/chrome/browser/src/nav_controls.ts similarity index 99% rename from packages/core/chrome/core-chrome-browser/src/nav_controls.ts rename to src/core/packages/chrome/browser/src/nav_controls.ts index 9efa4c457e8b4..7bf1d96ce35dc 100644 --- a/packages/core/chrome/core-chrome-browser/src/nav_controls.ts +++ b/src/core/packages/chrome/browser/src/nav_controls.ts @@ -20,7 +20,6 @@ export interface ChromeNavControl { export interface ChromeHelpMenuLink { title: string; href?: string; - iconType?: string; onClick?: () => void; dataTestSubj?: string; } diff --git a/packages/core/chrome/core-chrome-browser/src/nav_links.ts b/src/core/packages/chrome/browser/src/nav_links.ts similarity index 100% rename from packages/core/chrome/core-chrome-browser/src/nav_links.ts rename to src/core/packages/chrome/browser/src/nav_links.ts diff --git a/packages/core/chrome/core-chrome-browser/src/project_navigation.ts b/src/core/packages/chrome/browser/src/project_navigation.ts similarity index 100% rename from packages/core/chrome/core-chrome-browser/src/project_navigation.ts rename to src/core/packages/chrome/browser/src/project_navigation.ts diff --git a/packages/core/chrome/core-chrome-browser/src/recently_accessed.ts b/src/core/packages/chrome/browser/src/recently_accessed.ts similarity index 100% rename from packages/core/chrome/core-chrome-browser/src/recently_accessed.ts rename to src/core/packages/chrome/browser/src/recently_accessed.ts diff --git a/packages/core/chrome/core-chrome-browser/src/types.ts b/src/core/packages/chrome/browser/src/types.ts similarity index 100% rename from packages/core/chrome/core-chrome-browser/src/types.ts rename to src/core/packages/chrome/browser/src/types.ts diff --git a/packages/core/chrome/core-chrome-browser/tsconfig.json b/src/core/packages/chrome/browser/tsconfig.json similarity index 92% rename from packages/core/chrome/core-chrome-browser/tsconfig.json rename to src/core/packages/chrome/browser/tsconfig.json index 03ae62928c03e..d2bbfd79414c7 100644 --- a/packages/core/chrome/core-chrome-browser/tsconfig.json +++ b/src/core/packages/chrome/browser/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/src/core/packages/elasticsearch/server-internal/src/is_scripting_enabled.test.ts b/src/core/packages/elasticsearch/server-internal/src/is_scripting_enabled.test.ts index d77121cec13c0..e94981d88966b 100644 --- a/src/core/packages/elasticsearch/server-internal/src/is_scripting_enabled.test.ts +++ b/src/core/packages/elasticsearch/server-internal/src/is_scripting_enabled.test.ts @@ -8,7 +8,7 @@ */ import { isRetryableEsClientErrorMock } from './is_scripting_enabled.test.mocks'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { elasticsearchClientMock } from '@kbn/core-elasticsearch-client-server-mocks'; import { isInlineScriptingEnabled } from './is_scripting_enabled'; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_create.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_create.test.ts index 92dbeb4339a27..cd0ddf183da42 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_create.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_create.test.ts @@ -168,9 +168,9 @@ describe('#bulkCreate', () => { getId = () => expect.any(String), }: { method: string; _index?: string; getId?: (type: string, id?: string) => string } ) => { - const body = []; + const operations = []; for (const { type, id, if_primary_term: ifPrimaryTerm, if_seq_no: ifSeqNo } of objects) { - body.push({ + operations.push({ [method]: { _index, _id: getId(type, id), @@ -179,10 +179,10 @@ describe('#bulkCreate', () => { : {}), }, }); - body.push(expect.any(Object)); + operations.push(expect.any(Object)); } expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }; @@ -290,9 +290,9 @@ describe('#bulkCreate', () => { it(`formats the ES request`, async () => { await bulkCreateSuccess(client, repository, [obj1, obj2]); - const body = [...expectObjArgs(obj1), ...expectObjArgs(obj2)]; + const operations = [...expectObjArgs(obj1), ...expectObjArgs(obj2)]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -301,9 +301,12 @@ describe('#bulkCreate', () => { const obj1WithManagedTrue = { ...obj1, managed: true }; const obj2WithManagedTrue = { ...obj2, managed: true }; await bulkCreateSuccess(client, repository, [obj1WithManagedTrue, obj2WithManagedTrue]); - const body = [...expectObjArgs(obj1WithManagedTrue), ...expectObjArgs(obj2WithManagedTrue)]; + const operations = [ + ...expectObjArgs(obj1WithManagedTrue), + ...expectObjArgs(obj2WithManagedTrue), + ]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -333,9 +336,9 @@ describe('#bulkCreate', () => { await bulkCreateSuccess(client, repository, objects); const expected = expect.not.objectContaining({ originId: expect.anything() }); - const body = [expect.any(Object), expected, expect.any(Object), expected]; + const operations = [expect.any(Object), expected, expect.any(Object), expected]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -360,9 +363,9 @@ describe('#bulkCreate', () => { ]; await bulkCreateSuccess(client, repository, objects); const expected = expect.objectContaining({ originId: 'some-originId' }); - const body = [expect.any(Object), expected, expect.any(Object), expected]; + const operations = [expect.any(Object), expected, expect.any(Object), expected]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -375,9 +378,9 @@ describe('#bulkCreate', () => { ]; await bulkCreateSuccess(client, repository, objects); const expected = expect.not.objectContaining({ originId: expect.anything() }); - const body = [expect.any(Object), expected, expect.any(Object), expected]; + const operations = [expect.any(Object), expected, expect.any(Object), expected]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -389,9 +392,9 @@ describe('#bulkCreate', () => { ]; await bulkCreateSuccess(client, repository, objects); const expected = expect.objectContaining({ originId: 'existing-originId' }); - const body = [expect.any(Object), expected, expect.any(Object), expected]; + const operations = [expect.any(Object), expected, expect.any(Object), expected]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -401,9 +404,9 @@ describe('#bulkCreate', () => { it(`adds namespace to request body for any types that are single-namespace`, async () => { await bulkCreateSuccess(client, repository, [obj1, obj2], { namespace }); const expected = expect.objectContaining({ namespace }); - const body = [expect.any(Object), expected, expect.any(Object), expected]; + const operations = [expect.any(Object), expected, expect.any(Object), expected]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -412,9 +415,9 @@ describe('#bulkCreate', () => { it(`adds managed=false to request body if declared for any types that are single-namespace`, async () => { await bulkCreateSuccess(client, repository, [obj1, obj2], { namespace, managed: false }); const expected = expect.objectContaining({ namespace, managed: false }); - const body = [expect.any(Object), expected, expect.any(Object), expected]; + const operations = [expect.any(Object), expected, expect.any(Object), expected]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -422,9 +425,9 @@ describe('#bulkCreate', () => { it(`adds managed=true to request body if declared for any types that are single-namespace`, async () => { await bulkCreateSuccess(client, repository, [obj1, obj2], { namespace, managed: true }); const expected = expect.objectContaining({ namespace, managed: true }); - const body = [expect.any(Object), expected, expect.any(Object), expected]; + const operations = [expect.any(Object), expected, expect.any(Object), expected]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -432,9 +435,9 @@ describe('#bulkCreate', () => { it(`normalizes options.namespace from 'default' to undefined`, async () => { await bulkCreateSuccess(client, repository, [obj1, obj2], { namespace: 'default' }); const expected = expect.not.objectContaining({ namespace: 'default' }); - const body = [expect.any(Object), expected, expect.any(Object), expected]; + const operations = [expect.any(Object), expected, expect.any(Object), expected]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -446,9 +449,9 @@ describe('#bulkCreate', () => { ]; await bulkCreateSuccess(client, repository, objects, { namespace }); const expected = expect.not.objectContaining({ namespace: expect.anything() }); - const body = [expect.any(Object), expected, expect.any(Object), expected]; + const operations = [expect.any(Object), expected, expect.any(Object), expected]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -468,9 +471,9 @@ describe('#bulkCreate', () => { await bulkCreateSuccess(client, repository, objects, { namespace, overwrite: true }); const expected1 = expect.objectContaining({ namespaces: [namespace ?? 'default'] }); const expected2 = expect.objectContaining({ namespaces: ['*'] }); - const body = [expect.any(Object), expected1, expect.any(Object), expected2]; + const operations = [expect.any(Object), expected1, expect.any(Object), expected2]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); client.bulk.mockClear(); @@ -503,7 +506,7 @@ describe('#bulkCreate', () => { }, ]); await bulkCreateSuccess(client, repository, objects, { namespace, overwrite: true }); - const body = [ + const operations = [ { index: expect.objectContaining({ _id: `${ns2}:dashboard:${o1.id}` }) }, expect.objectContaining({ namespace: ns2 }), { @@ -525,7 +528,7 @@ describe('#bulkCreate', () => { }) ); expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); client.bulk.mockClear(); @@ -539,12 +542,12 @@ describe('#bulkCreate', () => { const test = async (namespace?: string) => { const objects = [{ ...obj1, type: 'dashboard', initialNamespaces: ['default'] }]; await bulkCreateSuccess(client, repository, objects, { namespace, overwrite: true }); - const body = [ + const operations = [ { index: expect.objectContaining({ _id: `dashboard:${obj1.id}` }) }, expect.not.objectContaining({ namespace: 'default' }), ]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); client.bulk.mockClear(); @@ -558,9 +561,9 @@ describe('#bulkCreate', () => { const objects = [obj1, { ...obj2, type: NAMESPACE_AGNOSTIC_TYPE }]; await bulkCreateSuccess(client, repository, objects, { namespace, overwrite: true }); const expected = expect.not.objectContaining({ namespaces: expect.anything() }); - const body = [expect.any(Object), expected, expect.any(Object), expected]; + const operations = [expect.any(Object), expected, expect.any(Object), expected]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); client.bulk.mockClear(); @@ -652,9 +655,9 @@ describe('#bulkCreate', () => { const result = await repository.bulkCreate(objects); expect(client.bulk).toHaveBeenCalled(); const objCall = isBulkError ? expectObjArgs(obj) : []; - const body = [...expectObjArgs(obj1), ...objCall, ...expectObjArgs(obj2)]; + const operations = [...expectObjArgs(obj1), ...objCall, ...expectObjArgs(obj2)]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); expect(result).toEqual({ @@ -765,7 +768,7 @@ describe('#bulkCreate', () => { ); expect(client.bulk).toHaveBeenCalled(); expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body: [...expectObjArgs(o1), ...expectObjArgs(o5)] }), + expect.objectContaining({ operations: [...expectObjArgs(o1), ...expectObjArgs(o5)] }), expect.anything() ); expect(result).toEqual({ diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_create.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_create.ts index 95e9c9acb7953..1a9b8956a3084 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_create.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_create.ts @@ -282,7 +282,7 @@ export const performBulkCreate = async ( ? await client.bulk({ refresh, require_alias: true, - body: bulkCreateParams, + operations: bulkCreateParams, }) : undefined; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_delete.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_delete.test.ts index d0efc5bf6be4f..a4c6f365529f1 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_delete.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_delete.test.ts @@ -18,7 +18,7 @@ import { } from '../repository.test.mock'; import type { Payload } from '@hapi/boom'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsBulkDeleteObject, @@ -131,9 +131,9 @@ describe('#bulkDelete', () => { overrides?: Record; } ) => { - const body = []; + const operations = []; for (const { type, id } of objects) { - body.push({ + operations.push({ [method]: { _index, _id: getId(type, id), @@ -143,7 +143,7 @@ describe('#bulkDelete', () => { } expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }; @@ -202,9 +202,9 @@ describe('#bulkDelete', () => { overrides?: Record; } ) => { - const body = []; + const operations = []; for (const { type, id } of objects) { - body.push({ + operations.push({ [method]: { _index, _id: getId(type, id), @@ -213,7 +213,7 @@ describe('#bulkDelete', () => { }); } expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }; @@ -266,7 +266,7 @@ describe('#bulkDelete', () => { expect.objectContaining({ _id: `${MULTI_NAMESPACE_ISOLATED_TYPE}:${obj2.id}` }), ]; expect(client.mget).toHaveBeenCalledWith( - expect.objectContaining({ body: { docs } }), + expect.objectContaining({ docs }), expect.anything() ); }); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_delete.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_delete.ts index e3fcff2dd1003..6495272fccdb0 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_delete.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_delete.ts @@ -141,7 +141,7 @@ export const performBulkDelete = async ( const bulkDeleteResponse = bulkDeleteParams.length ? await client.bulk({ refresh, - body: bulkDeleteParams, + operations: bulkDeleteParams, require_alias: true, }) : undefined; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.isolated.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.isolated.test.ts index 792bc652b0f6a..9c24ab6d68d4e 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.isolated.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.isolated.test.ts @@ -11,7 +11,7 @@ import { getSavedObjectFromSourceMock, rawDocExistsInNamespaceMock, } from './bulk_get.isolated.test.mocks'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { SavedObject, CheckAuthorizationResult } from '@kbn/core-saved-objects-server'; import { apiContextMock, ApiExecutionContextMock } from '../../mocks'; import { performBulkGet } from './bulk_get'; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.test.ts index 3e5310952c116..eff12c97379c8 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.test.ts @@ -15,7 +15,7 @@ import { } from '../repository.test.mock'; import type { Payload } from '@hapi/boom'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsBulkGetObject } from '@kbn/core-saved-objects-api-server'; import { type SavedObjectsRawDocSource, type SavedObject } from '@kbn/core-saved-objects-server'; @@ -149,14 +149,12 @@ describe('#bulkGet', () => { ) => { expect(client.mget).toHaveBeenCalledWith( expect.objectContaining({ - body: { - docs: objects.map(({ type, id }) => - expect.objectContaining({ - _index, - _id: getId(type, id), - }) - ), - }, + docs: objects.map(({ type, id }) => + expect.objectContaining({ + _index, + _id: getId(type, id), + }) + ), }), expect.anything() ); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.ts index 3cc6511adefa2..858b4830a7270 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_get.ts @@ -134,11 +134,7 @@ export const performBulkGet = async ( })); const bulkGetResponse = bulkGetDocs.length ? await client.mget( - { - body: { - docs: bulkGetDocs, - }, - }, + { docs: bulkGetDocs }, { ignore: [404], meta: true } ) : undefined; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_update.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_update.test.ts index 183c33e6f4079..411caec4d319b 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_update.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_update.test.ts @@ -17,7 +17,7 @@ import { } from '../repository.test.mock'; import type { Payload } from '@hapi/boom'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsBulkUpdateObject, @@ -164,13 +164,13 @@ describe('#bulkUpdate', () => { overrides?: Record; } ) => { - const body = []; + const operations = []; for (const object of objects) { - body.push(getBulkIndexEntry(method, object, _index, getId, overrides)); - body.push(expect.any(Object)); + operations.push(getBulkIndexEntry(method, object, _index, getId, overrides)); + operations.push(expect.any(Object)); } expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }; @@ -214,7 +214,7 @@ describe('#bulkUpdate', () => { expect.objectContaining({ _id: `${MULTI_NAMESPACE_ISOLATED_TYPE}:${obj2.id}` }), ]; expect(client.mget).toHaveBeenCalledWith( - expect.objectContaining({ body: { docs } }), + expect.objectContaining({ docs }), expect.anything() ); }); @@ -239,7 +239,7 @@ describe('#bulkUpdate', () => { expect(client.bulk).toHaveBeenCalledTimes(1); expect(client.bulk).toHaveBeenCalledWith( expect.objectContaining({ - body: [ + operations: [ getBulkIndexEntry('index', _obj1), expect.objectContaining({ [obj1.type]: { @@ -267,7 +267,7 @@ describe('#bulkUpdate', () => { expect(client.bulk).toHaveBeenCalledTimes(1); expect(client.bulk).toHaveBeenCalledWith( expect.objectContaining({ - body: [ + operations: [ getBulkIndexEntry('index', _obj1), expect.objectContaining({ [obj1.type]: { @@ -288,12 +288,12 @@ describe('#bulkUpdate', () => { it(`defaults to no references`, async () => { await bulkUpdateSuccess(client, repository, registry, [obj1, obj2]); - const body = [ + const operations = [ ...expectObjArgs({ ...obj1, references: [] }), ...expectObjArgs({ ...obj2, references: [] }), ]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); }); @@ -302,12 +302,12 @@ describe('#bulkUpdate', () => { const test = async (references: SavedObjectReference[]) => { const objects = [obj1, obj2].map((obj) => ({ ...obj, references })); await bulkUpdateSuccess(client, repository, registry, objects); - const body = [ + const operations = [ ...expectObjArgs({ ...obj1, references }), ...expectObjArgs({ ...obj2, references }), ]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); client.bulk.mockClear(); @@ -322,12 +322,12 @@ describe('#bulkUpdate', () => { const test = async (references: unknown) => { const objects = [obj1, obj2]; await bulkUpdateSuccess(client, repository, registry, objects); - const body = [ + const operations = [ ...expectObjArgs({ ...obj1, references: expect.not.arrayContaining([references]) }), ...expectObjArgs({ ...obj2, references: expect.not.arrayContaining([references]) }), ]; expect(client.bulk).toHaveBeenCalledWith( - expect.objectContaining({ body }), + expect.objectContaining({ operations }), expect.anything() ); client.bulk.mockClear(); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_update.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_update.ts index b8515ac1bf9e1..4ca0635066884 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_update.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/bulk_update.ts @@ -168,7 +168,7 @@ export const performBulkUpdate = async ( const bulkGetResponse = bulkGetDocs.length ? await client.mget( - { body: { docs: bulkGetDocs } }, + { docs: bulkGetDocs }, { ignore: [404], meta: true } ) : undefined; @@ -344,7 +344,7 @@ export const performBulkUpdate = async ( const bulkUpdateResponse = bulkUpdateParams.length ? await client.bulk({ refresh, - body: bulkUpdateParams, + operations: bulkUpdateParams, _source_includes: ['originId'], require_alias: true, }) diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/check_conflicts.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/check_conflicts.test.ts index 2858ae5288819..e67c6b623aa6a 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/check_conflicts.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/check_conflicts.test.ts @@ -13,7 +13,7 @@ import { mockGetSearchDsl, } from '../repository.test.mock'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { ALL_NAMESPACES_STRING } from '@kbn/core-saved-objects-utils-server'; import { SavedObjectsRepository } from '../repository'; @@ -100,14 +100,12 @@ describe('#checkConflicts', () => { ) => { expect(client.mget).toHaveBeenCalledWith( expect.objectContaining({ - body: { - docs: objects.map(({ type, id }) => - expect.objectContaining({ - _index, - _id: getId(type, id), - }) - ), - }, + docs: objects.map(({ type, id }) => + expect.objectContaining({ + _index, + _id: getId(type, id), + }) + ), }), expect.anything() ); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/check_conflicts.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/check_conflicts.ts index c85564b1a0eac..40cf6e590ddcf 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/check_conflicts.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/check_conflicts.ts @@ -85,11 +85,7 @@ export const performCheckConflicts = async ( })); const bulkGetResponse = bulkGetDocs.length ? await client.mget( - { - body: { - docs: bulkGetDocs, - }, - }, + { docs: bulkGetDocs }, { ignore: [404], meta: true } ) : undefined; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/create.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/create.test.ts index b1a3c951613d2..6473af396945e 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/create.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/create.test.ts @@ -16,7 +16,7 @@ import { mockGetSearchDsl, } from '../repository.test.mock'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsCreateOptions } from '@kbn/core-saved-objects-api-server'; import { @@ -234,8 +234,8 @@ describe('#create', () => { it(`defaults to empty references array`, async () => { await createSuccess(type, attributes, { id }); expect( - (client.create.mock.calls[0][0] as estypes.CreateRequest).body! - .references + (client.create.mock.calls[0][0] as estypes.CreateRequest) + .document!.references ).toEqual([]); }); @@ -244,7 +244,7 @@ describe('#create', () => { await createSuccess(type, attributes, { id, references }); expect( (client.create.mock.calls[0][0] as estypes.CreateRequest) - .body!.references + .document!.references ).toEqual(references); client.create.mockClear(); }; @@ -259,7 +259,7 @@ describe('#create', () => { await createSuccess(type, attributes, { id, references }); expect( (client.create.mock.calls[0][0] as estypes.CreateRequest) - .body!.references + .document!.references ).not.toBeDefined(); client.create.mockClear(); }; @@ -286,9 +286,7 @@ describe('#create', () => { it(`${objType} defaults to no originId`, async () => { await createSuccess(objType, attributes, { id }); expect(client.create).toHaveBeenCalledWith( - expect.objectContaining({ - body: expect.not.objectContaining({ originId: expect.anything() }), - }), + expect.not.objectContaining({ originId: expect.anything() }), expect.anything() ); }); @@ -310,7 +308,7 @@ describe('#create', () => { await createSuccess(objType, attributes, { id, originId: 'some-originId' }); expect(client.create).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ originId: 'some-originId' }), + document: expect.objectContaining({ originId: 'some-originId' }), }), expect.anything() ); @@ -321,7 +319,7 @@ describe('#create', () => { await createSuccess(objType, attributes, { id, originId: undefined }); expect(client.create).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.not.objectContaining({ originId: expect.anything() }), + document: expect.not.objectContaining({ originId: expect.anything() }), }), expect.anything() ); @@ -331,7 +329,7 @@ describe('#create', () => { await createSuccess(objType, attributes, { id }); expect(client.create).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ originId: 'existing-originId' }), + document: expect.objectContaining({ originId: 'existing-originId' }), }), expect.anything() ); @@ -388,7 +386,7 @@ describe('#create', () => { expect(client.create).toHaveBeenCalledWith( expect.objectContaining({ id: `${namespace}:${type}:${id}`, - body: expect.objectContaining({ namespace }), + document: expect.objectContaining({ namespace }), }), expect.anything() ); @@ -399,7 +397,7 @@ describe('#create', () => { expect(client.create).toHaveBeenCalledWith( expect.objectContaining({ id: `${type}:${id}`, - body: expect.not.objectContaining({ namespace: expect.anything() }), + document: expect.not.objectContaining({ namespace: expect.anything() }), }), expect.anything() ); @@ -410,7 +408,7 @@ describe('#create', () => { expect(client.create).toHaveBeenCalledWith( expect.objectContaining({ id: `${type}:${id}`, - body: expect.not.objectContaining({ namespace: expect.anything() }), + document: expect.not.objectContaining({ namespace: expect.anything() }), }), expect.anything() ); @@ -457,7 +455,7 @@ describe('#create', () => { expect(client.create).toHaveBeenCalledWith( expect.objectContaining({ id: `${MULTI_NAMESPACE_TYPE}:${id}`, - body: expect.objectContaining({ namespaces: [namespace] }), + document: expect.objectContaining({ namespaces: [namespace] }), }), expect.anything() ); @@ -465,7 +463,7 @@ describe('#create', () => { expect(client.index).toHaveBeenCalledWith( expect.objectContaining({ id: `${MULTI_NAMESPACE_ISOLATED_TYPE}:${id}`, - body: expect.objectContaining({ namespaces: ['*'] }), + document: expect.objectContaining({ namespaces: ['*'] }), }), expect.anything() ); @@ -524,7 +522,7 @@ describe('#create', () => { 1, expect.objectContaining({ id: `${ns2}:dashboard:${id}`, - body: expect.objectContaining({ namespace: ns2 }), + document: expect.objectContaining({ namespace: ns2 }), }), expect.anything() ); @@ -532,7 +530,7 @@ describe('#create', () => { 2, expect.objectContaining({ id: `${MULTI_NAMESPACE_TYPE}:${id}`, - body: expect.objectContaining({ namespaces: [ns2, ns3] }), + document: expect.objectContaining({ namespaces: [ns2, ns3] }), }), expect.anything() ); @@ -540,7 +538,7 @@ describe('#create', () => { expect(client.index).toHaveBeenCalledWith( expect.objectContaining({ id: `${MULTI_NAMESPACE_ISOLATED_TYPE}:${id}`, - body: expect.objectContaining({ namespaces: [ns2] }), + document: expect.objectContaining({ namespaces: [ns2] }), }), expect.anything() ); @@ -558,7 +556,7 @@ describe('#create', () => { 1, expect.objectContaining({ id: `dashboard:${id}`, - body: expect.not.objectContaining({ namespace: 'default' }), + document: expect.not.objectContaining({ namespace: 'default' }), }), expect.anything() ); @@ -569,7 +567,7 @@ describe('#create', () => { expect(client.create).toHaveBeenCalledWith( expect.objectContaining({ id: `${NAMESPACE_AGNOSTIC_TYPE}:${id}`, - body: expect.not.objectContaining({ + document: expect.not.objectContaining({ namespace: expect.anything(), namespaces: expect.anything(), }), diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/create.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/create.ts index 5fb22be52febd..4c7e0a17842f7 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/create.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/create.ts @@ -16,6 +16,7 @@ import { import { SavedObjectsUtils } from '@kbn/core-saved-objects-utils-server'; import { decodeRequestVersion } from '@kbn/core-saved-objects-base-server-internal'; import { SavedObjectsCreateOptions } from '@kbn/core-saved-objects-api-server'; +import { CreateRequest, type IndexRequest } from '@elastic/elasticsearch/lib/api/types'; import { DEFAULT_REFRESH_SETTING } from '../constants'; import type { PreflightCheckForCreateResult } from './internals/preflight_check_for_create'; import { getSavedObjectNamespaces, getCurrentTime, normalizeNamespace, setManaged } from './utils'; @@ -152,19 +153,19 @@ export const performCreate = async ( const raw = serializer.savedObjectToRaw(migrated as SavedObjectSanitizedDoc); - const requestParams = { + const requestParams: IndexRequest | CreateRequest = { id: raw._id, index: commonHelper.getIndexForType(type), refresh, - body: raw._source, + document: raw._source, ...(overwrite && version ? decodeRequestVersion(version) : {}), require_alias: true, }; const { body, statusCode, headers } = id && overwrite - ? await client.index(requestParams, { meta: true }) - : await client.create(requestParams, { meta: true }); + ? await client.index(requestParams as IndexRequest, { meta: true }) + : await client.create(requestParams as CreateRequest, { meta: true }); // throw if we can't verify a 404 response is from Elasticsearch if (isNotFoundFromUnsupportedServer({ statusCode, headers })) { diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/delete.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/delete.test.ts index 1c501b1fb5ec5..d788c5edff65e 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/delete.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/delete.test.ts @@ -16,7 +16,7 @@ import { mockGetSearchDsl, } from '../repository.test.mock'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsDeleteOptions } from '@kbn/core-saved-objects-api-server'; import { ALL_NAMESPACES_STRING } from '@kbn/core-saved-objects-utils-server'; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/delete_by_namespace.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/delete_by_namespace.ts index 14b9143fa6225..fc8bed73802c6 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/delete_by_namespace.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/delete_by_namespace.ts @@ -49,28 +49,26 @@ export const performDeleteByNamespace = async ( { index: commonHelper.getIndicesForTypes(typesToUpdate), refresh: options.refresh, - body: { - script: { - source: ` - if (!ctx._source.containsKey('namespaces')) { - ctx.op = "delete"; - } else { - ctx._source['namespaces'].removeAll(Collections.singleton(params['namespace'])); - if (ctx._source['namespaces'].empty) { - ctx.op = "delete"; - } - } - `, - lang: 'painless', - params: { namespace }, - }, - conflicts: 'proceed', - ...getSearchDsl(mappings, registry, { - namespaces: [namespace], - type: typesToUpdate, - kueryNode, - }), + script: { + source: ` + if (!ctx._source.containsKey('namespaces')) { + ctx.op = "delete"; + } else { + ctx._source['namespaces'].removeAll(Collections.singleton(params['namespace'])); + if (ctx._source['namespaces'].empty) { + ctx.op = "delete"; + } + } + `, + lang: 'painless', + params: { namespace }, }, + conflicts: 'proceed', + ...(getSearchDsl(mappings, registry, { + namespaces: [namespace], + type: typesToUpdate, + kueryNode, + }) as Omit, 'sort'>), // Sort types don't match and we're not sorting anyways }, { ignore: [404], meta: true } ); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.isolated.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.isolated.test.ts index f92e074ec4a26..a3d5778083574 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.isolated.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.isolated.test.ts @@ -8,7 +8,7 @@ */ import { isSupportedEsServerMock } from './find.isolated.test.mocks'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { SavedObject, AuthorizationTypeMap } from '@kbn/core-saved-objects-server'; import { apiContextMock, ApiExecutionContextMock } from '../../mocks'; import { performFind } from './find'; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.test.ts index 12b14bb6f1a32..6c9cca176c4d6 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.test.ts @@ -106,9 +106,7 @@ describe('find', () => { await findSuccess(client, repository, { type }); expect(client.search).toHaveBeenCalledWith( - expect.objectContaining({ - body: expect.objectContaining({ ...query }), - }), + expect.objectContaining({ ...query }), expect.anything() ); }); @@ -138,24 +136,22 @@ describe('find', () => { await findSuccess(client, repository, { type, fields: ['title'] }); expect(client.search).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ - _source: [ - `${type}.title`, - 'namespace', - 'namespaces', - 'type', - 'references', - 'migrationVersion', - 'coreMigrationVersion', - 'typeMigrationVersion', - 'managed', - 'updated_at', - 'updated_by', - 'created_at', - 'created_by', - 'originId', - ], - }), + _source: [ + `${type}.title`, + 'namespace', + 'namespaces', + 'type', + 'references', + 'migrationVersion', + 'coreMigrationVersion', + 'typeMigrationVersion', + 'managed', + 'updated_at', + 'updated_by', + 'created_at', + 'created_by', + 'originId', + ], }), expect.anything() ); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.ts index 40501a0d80a37..ee3f98eade3d5 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/find.ts @@ -8,7 +8,7 @@ */ import Boom from '@hapi/boom'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { isSupportedEsServer } from '@kbn/core-elasticsearch-server-internal'; import { SavedObjectsErrorHelpers, @@ -191,31 +191,26 @@ export const performFind = async ( preference, rest_total_hits_as_int: true, size: perPage, - body: { - size: perPage, - seq_no_primary_term: true, - from: perPage * (page - 1), - _source: includedFields(allowedTypes, fields), - ...(aggsObject ? { aggs: aggsObject } : {}), - ...getSearchDsl(mappings, registry, { - search, - defaultSearchOperator, - searchFields, - pit, - rootSearchFields, - type: allowedTypes, - searchAfter, - sortField, - sortOrder, - namespaces, - typeToNamespacesMap, // If defined, this takes precedence over the `type` and `namespaces` fields - hasReference, - hasReferenceOperator, - hasNoReference, - hasNoReferenceOperator, - kueryNode, - }), - }, + seq_no_primary_term: true, + ...(aggsObject ? { aggs: aggsObject } : {}), + ...getSearchDsl(mappings, registry, { + search, + defaultSearchOperator, + searchFields, + pit, + rootSearchFields, + type: allowedTypes, + searchAfter, + sortField, + sortOrder, + namespaces, + typeToNamespacesMap, // If defined, this takes precedence over the `type` and `namespaces` fields + hasReference, + hasReferenceOperator, + hasNoReference, + hasNoReferenceOperator, + kueryNode, + }), }; const { body, statusCode, headers } = await client.search(esOptions, { diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.test.ts index b04f7266b85f4..501e3b8a587cf 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.test.ts @@ -15,7 +15,7 @@ import { mockGetSearchDsl, } from '../repository.test.mock'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsBaseOptions } from '@kbn/core-saved-objects-api-server'; import { ALL_NAMESPACES_STRING } from '@kbn/core-saved-objects-utils-server'; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/helpers/preflight_check.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/helpers/preflight_check.ts index 73428ebcc8529..ab05a435a445b 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/helpers/preflight_check.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/helpers/preflight_check.ts @@ -88,10 +88,7 @@ export class PreflightCheckHelper { })); const bulkGetMultiNamespaceDocsResponse = bulkGetMultiNamespaceDocs.length - ? await this.client.mget( - { body: { docs: bulkGetMultiNamespaceDocs } }, - { ignore: [404], meta: true } - ) + ? await this.client.mget({ docs: bulkGetMultiNamespaceDocs }, { ignore: [404], meta: true }) : undefined; // fail fast if we can't verify a 404 response is from Elasticsearch if ( diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/increment_counter.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/increment_counter.test.ts index b4062ecbe7f2b..88ce6fb865f57 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/increment_counter.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/increment_counter.test.ts @@ -16,7 +16,7 @@ import { mockGetSearchDsl, } from '../repository.test.mock'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsIncrementCounterField, @@ -222,19 +222,17 @@ describe('#incrementCounter', () => { await incrementCounterSuccess(type, id, counterFields, { namespace, upsertAttributes }); expect(client.update).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ - upsert: expect.objectContaining({ - [type]: { - foo: 'bar', - hello: 'dolly', - ...counterFields.reduce((aggs, field) => { - return { - ...aggs, - [field]: 1, - }; - }, {}), - }, - }), + upsert: expect.objectContaining({ + [type]: { + foo: 'bar', + hello: 'dolly', + ...counterFields.reduce((aggs, field) => { + return { + ...aggs, + [field]: 1, + }; + }, {}), + }, }), }), expect.anything() @@ -495,12 +493,10 @@ describe('#incrementCounter', () => { expect(client.update).toBeCalledTimes(1); expect(client.update).toBeCalledWith( expect.objectContaining({ - body: expect.objectContaining({ - script: expect.objectContaining({ - params: expect.objectContaining({ - counterFieldNames: [counterFields[0]], - counts: [3], - }), + script: expect.objectContaining({ + params: expect.objectContaining({ + counterFieldNames: [counterFields[0]], + counts: [3], }), }), }), @@ -514,12 +510,10 @@ describe('#incrementCounter', () => { expect(client.update).toBeCalledTimes(1); expect(client.update).toBeCalledWith( expect.objectContaining({ - body: expect.objectContaining({ - script: expect.objectContaining({ - params: expect.objectContaining({ - counterFieldNames: [counterFields[0]], - counts: [0], - }), + script: expect.objectContaining({ + params: expect.objectContaining({ + counterFieldNames: [counterFields[0]], + counts: [0], }), }), }), diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.test.ts index 3d0ef40a2a22a..e43eeb570620a 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.test.ts @@ -134,7 +134,7 @@ describe('collectMultiNamespaceReferences', () => { ...objects: SavedObjectsCollectMultiNamespaceReferencesObject[] ) { const docs = objects.map(({ type, id }) => expect.objectContaining({ _id: `${type}:${id}` })); - expect(client.mget).toHaveBeenNthCalledWith(n, { body: { docs } }, expect.anything()); + expect(client.mget).toHaveBeenNthCalledWith(n, { docs }, expect.anything()); } it('returns an empty array if no object args are passed in', async () => { diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.ts index 4b35b45b89bb9..f802b8a97bcfd 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/collect_multi_namespace_references.ts @@ -185,7 +185,7 @@ async function getObjectsAndReferences({ ); } const bulkGetResponse = await client.mget( - { body: { docs: makeBulkGetDocs(bulkGetObjects) } }, + { docs: makeBulkGetDocs(bulkGetObjects) }, { ignore: [404], meta: true } ); // exit early if we can't verify a 404 response is from Elasticsearch diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/delete_legacy_url_aliases.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/delete_legacy_url_aliases.test.ts index 2334a5a5a3eeb..f4bba00e26968 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/delete_legacy_url_aliases.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/delete_legacy_url_aliases.test.ts @@ -86,14 +86,12 @@ describe('deleteLegacyUrlAliases', () => { expect(params.client.updateByQuery).toHaveBeenCalledTimes(1); expect(params.client.updateByQuery).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ - script: expect.objectContaining({ - params: { - namespaces, - matchTargetNamespaceOp: 'delete', - notMatchTargetNamespaceOp: 'noop', - }, - }), + script: expect.objectContaining({ + params: { + namespaces, + matchTargetNamespaceOp: 'delete', + notMatchTargetNamespaceOp: 'noop', + }, }), }), expect.anything() @@ -111,14 +109,12 @@ describe('deleteLegacyUrlAliases', () => { expect(params.client.updateByQuery).toHaveBeenCalledTimes(1); expect(params.client.updateByQuery).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ - script: expect.objectContaining({ - params: { - namespaces, - matchTargetNamespaceOp: 'noop', - notMatchTargetNamespaceOp: 'delete', - }, - }), + script: expect.objectContaining({ + params: { + namespaces, + matchTargetNamespaceOp: 'noop', + notMatchTargetNamespaceOp: 'delete', + }, }), }), expect.anything() diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/delete_legacy_url_aliases.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/delete_legacy_url_aliases.ts index b56eaddd35583..4486051898da5 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/delete_legacy_url_aliases.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/delete_legacy_url_aliases.ts @@ -69,29 +69,27 @@ export async function deleteLegacyUrlAliases(params: DeleteLegacyUrlAliasesParam { index: getIndexForType(LEGACY_URL_ALIAS_TYPE), refresh: false, // This could be called many times in succession, intentionally do not wait for a refresh - body: { - ...getSearchDsl(mappings, registry, { - type: LEGACY_URL_ALIAS_TYPE, - kueryNode: createKueryNode(type, id), - }), - script: { - // Intentionally use one script source with variable params to take advantage of ES script caching - source: ` + ...(getSearchDsl(mappings, registry, { + type: LEGACY_URL_ALIAS_TYPE, + kueryNode: createKueryNode(type, id), + }) as Omit, 'sort'>), // Omitting sort in the types in this operation because types expect only string[] and we're not really sorting + script: { + // Intentionally use one script source with variable params to take advantage of ES script caching + source: ` if (params['namespaces'].indexOf(ctx._source['${LEGACY_URL_ALIAS_TYPE}']['targetNamespace']) > -1) { ctx.op = params['matchTargetNamespaceOp']; } else { ctx.op = params['notMatchTargetNamespaceOp']; } `, - params: { - namespaces, - matchTargetNamespaceOp: deleteBehavior === 'inclusive' ? 'delete' : 'noop', - notMatchTargetNamespaceOp: deleteBehavior === 'inclusive' ? 'noop' : 'delete', - }, - lang: 'painless', + params: { + namespaces, + matchTargetNamespaceOp: deleteBehavior === 'inclusive' ? 'delete' : 'noop', + notMatchTargetNamespaceOp: deleteBehavior === 'inclusive' ? 'noop' : 'delete', }, - conflicts: 'proceed', + lang: 'painless', }, + conflicts: 'proceed', }, { ignore: [404] } ); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/increment_counter_internal.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/increment_counter_internal.ts index 00a588fb4d006..23a7091aefad6 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/increment_counter_internal.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/increment_counter_internal.ts @@ -125,36 +125,34 @@ export const incrementCounterInternal = async ( refresh, require_alias: true, _source: true, - body: { - script: { - source: ` - for (int i = 0; i < params.counterFieldNames.length; i++) { - def counterFieldName = params.counterFieldNames[i]; - def count = params.counts[i]; - - if (ctx._source[params.type][counterFieldName] == null) { - ctx._source[params.type][counterFieldName] = count; - } - else { - ctx._source[params.type][counterFieldName] += count; - } - } - ctx._source.updated_at = params.time; - `, - lang: 'painless', - params: { - counts: normalizedCounterFields.map( - (normalizedCounterField) => normalizedCounterField.incrementBy - ), - counterFieldNames: normalizedCounterFields.map( - (normalizedCounterField) => normalizedCounterField.fieldName - ), - time, - type, - }, + script: { + source: ` + for (int i = 0; i < params.counterFieldNames.length; i++) { + def counterFieldName = params.counterFieldNames[i]; + def count = params.counts[i]; + + if (ctx._source[params.type][counterFieldName] == null) { + ctx._source[params.type][counterFieldName] = count; + } + else { + ctx._source[params.type][counterFieldName] += count; + } + } + ctx._source.updated_at = params.time; + `, + lang: 'painless', + params: { + counts: normalizedCounterFields.map( + (normalizedCounterField) => normalizedCounterField.incrementBy + ), + counterFieldNames: normalizedCounterFields.map( + (normalizedCounterField) => normalizedCounterField.fieldName + ), + time, + type, }, - upsert: raw._source, }, + upsert: raw._source, }); const { originId } = body.get?._source ?? {}; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/internal_bulk_resolve.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/internal_bulk_resolve.test.ts index 55141d196709c..527ef0a855b28 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/internal_bulk_resolve.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/internal_bulk_resolve.test.ts @@ -147,7 +147,7 @@ describe('internalBulkResolve', () => { expect(client.bulk).toHaveBeenCalledTimes(1); expect(client.bulk).toHaveBeenCalledWith( expect.objectContaining({ - body: aliasIds + operations: aliasIds .map((id) => [ { update: { @@ -169,12 +169,10 @@ describe('internalBulkResolve', () => { expect(client.mget).toHaveBeenCalledTimes(1); expect(client.mget).toHaveBeenCalledWith( { - body: { - docs: objectIds.map((id) => ({ - _id: serializer.generateRawId(normalizedNamespace, OBJ_TYPE, id), - _index: `index-for-${OBJ_TYPE}`, - })), - }, + docs: objectIds.map((id) => ({ + _id: serializer.generateRawId(normalizedNamespace, OBJ_TYPE, id), + _index: `index-for-${OBJ_TYPE}`, + })), }, expect.anything() ); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/internal_bulk_resolve.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/internal_bulk_resolve.ts index 208056be6fc92..b76fe9402d20b 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/internal_bulk_resolve.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/internal_bulk_resolve.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import type { MgetResponseItem } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { MgetResponseItem } from '@elastic/elasticsearch/lib/api/types'; import { isNotFoundFromUnsupportedServer } from '@kbn/core-elasticsearch-server-internal'; import type { @@ -141,7 +141,7 @@ export async function internalBulkResolve( const bulkGetResponse = docsToBulkGet.length ? await client.mget( - { body: { docs: docsToBulkGet } }, + { docs: docsToBulkGet }, { ignore: [404], meta: true } ) : undefined; @@ -330,7 +330,7 @@ async function fetchAndUpdateAliases( const bulkUpdateResponse = await client.bulk({ refresh: false, require_alias: true, - body: bulkUpdateDocs, + operations: bulkUpdateDocs, }); return bulkUpdateResponse.items.map((item) => { // Map the bulk update response to the `_source` fields that were returned for each document diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/preflight_check_for_create.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/preflight_check_for_create.test.ts index ba355acd01c5f..e16ef3aacacf0 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/preflight_check_for_create.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/preflight_check_for_create.test.ts @@ -66,7 +66,7 @@ describe('preflightCheckForCreate', () => { return found ? { // @ts-expect-error - _id: params!.body!.docs![i]._id as string, // needed for mockRawDocExistsInNamespaces mock implementation and existingDocument assertions + _id: params!.docs![i]._id, // needed for mockRawDocExistsInNamespaces mock implementation and existingDocument assertions _index: 'doesnt-matter', _source: { ...(disabled !== undefined && { [LEGACY_URL_ALIAS_TYPE]: { disabled } }), @@ -86,7 +86,7 @@ describe('preflightCheckForCreate', () => { /** Asserts that mget is called for the given raw object IDs */ function expectMgetArgs(...rawObjectIds: string[]) { const docs = rawObjectIds.map((_id) => expect.objectContaining({ _id })); - expect(client.mget).toHaveBeenCalledWith({ body: { docs } }, expect.anything()); + expect(client.mget).toHaveBeenCalledWith({ docs }, expect.anything()); } /** Asserts that findLegacyUrlAliases is called for the given objects */ diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/preflight_check_for_create.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/preflight_check_for_create.ts index 341c65e722dd5..4bae59efefdca 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/preflight_check_for_create.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/preflight_check_for_create.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { isNotFoundFromUnsupportedServer } from '@kbn/core-elasticsearch-server-internal'; import { type ISavedObjectTypeRegistry, @@ -278,7 +278,7 @@ async function bulkGetObjectsAndAliases( const bulkGetResponse = docsToBulkGet.length ? await client.mget( - { body: { docs: docsToBulkGet } }, + { docs: docsToBulkGet }, { ignore: [404], meta: true } ) : undefined; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/update_objects_spaces.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/update_objects_spaces.test.ts index 537bd2db5e81c..426db23b6c57a 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/update_objects_spaces.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/update_objects_spaces.test.ts @@ -134,7 +134,7 @@ describe('#updateObjectsSpaces', () => { /** Asserts that mget is called for the given objects */ function expectMgetArgs(...objects: SavedObjectsUpdateObjectsSpacesObject[]) { const docs = objects.map(({ type, id }) => expect.objectContaining({ _id: `${type}:${id}` })); - expect(client.mget).toHaveBeenCalledWith({ body: { docs } }, expect.anything()); + expect(client.mget).toHaveBeenCalledWith({ docs }, expect.anything()); } /** Mocks the saved objects client so it returns the expected results */ @@ -153,14 +153,14 @@ describe('#updateObjectsSpaces', () => { }); } - /** Asserts that mget is called for the given objects */ + /** Asserts that bulk is called for the given objects */ function expectBulkArgs( ...objectActions: Array<{ object: { type: string; id: string; namespaces?: string[] }; action: 'update' | 'delete'; }> ) { - const body = objectActions.flatMap( + const operations = objectActions.flatMap( ({ object: { type, id, namespaces = expect.any(Array) }, action }) => { const operation = { [action]: { @@ -174,7 +174,7 @@ describe('#updateObjectsSpaces', () => { : [operation]; // 'delete' only uses an operation } ); - expect(client.bulk).toHaveBeenCalledWith(expect.objectContaining({ body })); + expect(client.bulk).toHaveBeenCalledWith(expect.objectContaining({ operations })); } beforeEach(() => { diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/update_objects_spaces.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/update_objects_spaces.ts index e3e7fcf42bb88..747db5976f004 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/update_objects_spaces.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/internals/update_objects_spaces.ts @@ -8,7 +8,7 @@ */ import pMap from 'p-map'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import intersection from 'lodash/intersection'; import type { Logger } from '@kbn/logging'; @@ -155,7 +155,7 @@ export async function updateObjectsSpaces({ })); const bulkGetResponse = bulkGetDocs.length ? await client.mget( - { body: { docs: bulkGetDocs } }, + { docs: bulkGetDocs }, { ignore: [404], meta: true } ) : undefined; @@ -261,7 +261,7 @@ export async function updateObjectsSpaces({ const { refresh = DEFAULT_REFRESH_SETTING } = options; const bulkOperationResponse = bulkOperationParams.length - ? await client.bulk({ refresh, body: bulkOperationParams, require_alias: true }) + ? await client.bulk({ refresh, operations: bulkOperationParams, require_alias: true }) : undefined; // Delete aliases if necessary, ensuring we don't have too many concurrent operations running. diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/open_point_in_time.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/open_point_in_time.test.ts index 2efc33eddddfd..bda6952138c41 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/open_point_in_time.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/open_point_in_time.test.ts @@ -189,9 +189,7 @@ describe('SavedObjectsRepository', () => { await successResponse('abc123'); expect(client.closePointInTime).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ - id: 'abc123', - }), + id: 'abc123', }), expect.anything() ); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/remove_references_to.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/remove_references_to.test.ts index e8dc5a4fe5fb1..cbc864adf0e39 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/remove_references_to.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/remove_references_to.test.ts @@ -15,7 +15,7 @@ import { mockGetSearchDsl, } from '../repository.test.mock'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { SavedObjectsRepository } from '../repository'; import { loggerMock } from '@kbn/logging-mocks'; @@ -106,9 +106,7 @@ describe('SavedObjectsRepository', () => { await removeReferencesToSuccess(client, repository, type, id, { type }); expect(client.updateByQuery).toHaveBeenCalledWith( - expect.objectContaining({ - body: expect.objectContaining({ ...query }), - }), + expect.objectContaining({ ...query }), expect.anything() ); }); @@ -139,13 +137,11 @@ describe('SavedObjectsRepository', () => { await removeReferencesToSuccess(client, repository, type, id); expect(client.updateByQuery).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ - script: expect.objectContaining({ - params: { - type, - id, - }, - }), + script: expect.objectContaining({ + params: { + type, + id, + }, }), }), expect.anything() @@ -270,11 +266,10 @@ describe('SavedObjectsRepository', () => { const client = apiExecutionContext.client; expect(client.updateByQuery).toHaveBeenCalledTimes(1); expect(client.updateByQuery).toHaveBeenLastCalledWith( - { + expect.objectContaining({ refresh: false, index: indices, - body: expect.any(Object), - }, + }), { ignore: [404], meta: true } ); }); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/remove_references_to.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/remove_references_to.ts index ec34343d9818c..0deb2db4a9df4 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/remove_references_to.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/remove_references_to.ts @@ -43,32 +43,30 @@ export const performRemoveReferencesTo = async ( { index: targetIndices, refresh, - body: { - script: { - source: ` - if (ctx._source.containsKey('references')) { - def items_to_remove = []; - for (item in ctx._source.references) { - if ( (item['type'] == params['type']) && (item['id'] == params['id']) ) { - items_to_remove.add(item); - } - } - ctx._source.references.removeAll(items_to_remove); + script: { + source: ` + if (ctx._source.containsKey('references')) { + def items_to_remove = []; + for (item in ctx._source.references) { + if ( (item['type'] == params['type']) && (item['id'] == params['id']) ) { + items_to_remove.add(item); } - `, - params: { - type, - id, - }, - lang: 'painless', + } + ctx._source.references.removeAll(items_to_remove); + } + `, + params: { + type, + id, }, - conflicts: 'proceed', - ...getSearchDsl(mappings, registry, { - namespaces: namespace ? [namespace] : undefined, - type: allTypes, - hasReference: { type, id }, - }), + lang: 'painless', }, + conflicts: 'proceed', + ...(getSearchDsl(mappings, registry, { + namespaces: namespace ? [namespace] : undefined, + type: allTypes, + hasReference: { type, id }, + }) as Omit, 'sort'>), // TS is complaining and it's unlikely that we sort here }, { ignore: [404], meta: true } ); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/update.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/update.test.ts index 728f8c42ce71b..7881947f58cc1 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/update.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/update.test.ts @@ -11,7 +11,7 @@ import { mockGetCurrentTime, mockPreflightCheckForCreate } from '../repository.test.mock'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { type SavedObjectUnsanitizedDoc, type SavedObjectReference, @@ -190,7 +190,7 @@ describe('#update', () => { expect(client.index).toHaveBeenCalledTimes(1); expect(client.index).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ + document: expect.objectContaining({ globalType: { foo: 'bar', title: 'Testing', @@ -219,7 +219,7 @@ describe('#update', () => { expect(client.index).toHaveBeenCalledTimes(1); expect(client.index).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ + document: expect.objectContaining({ globalType: { foo: 'bar', }, @@ -250,8 +250,8 @@ describe('#update', () => { migrator.migrateDocument.mockImplementationOnce((doc) => ({ ...doc })); await updateSuccess(client, repository, registry, type, id, attributes); expect( - (client.index.mock.calls[0][0] as estypes.CreateRequest).body! - .references + (client.index.mock.calls[0][0] as estypes.CreateRequest) + .document!.references ).toEqual([]); // we're indexing a full new doc, serializer adds default if not defined }); @@ -262,8 +262,8 @@ describe('#update', () => { references, }); expect( - (client.index.mock.calls[0][0] as estypes.CreateRequest).body! - .references + (client.index.mock.calls[0][0] as estypes.CreateRequest) + .document!.references ).toEqual(references); client.index.mockClear(); }; @@ -277,8 +277,8 @@ describe('#update', () => { references, }); expect( - (client.index.mock.calls[0][0] as estypes.CreateRequest).body! - .references + (client.index.mock.calls[0][0] as estypes.CreateRequest) + .document!.references ).toEqual(references); client.index.mockClear(); }; @@ -292,8 +292,8 @@ describe('#update', () => { references, }); expect( - (client.index.mock.calls[0][0] as estypes.CreateRequest).body! - .references + (client.index.mock.calls[0][0] as estypes.CreateRequest) + .document!.references ).toEqual(references); client.index.mockClear(); }; @@ -324,7 +324,8 @@ describe('#update', () => { ...mockTimestampFieldsWithCreated, }; expect( - (client.create.mock.calls[0][0] as estypes.CreateRequest).body! + (client.create.mock.calls[0][0] as estypes.CreateRequest) + .document! ).toEqual(expected); }); @@ -357,7 +358,8 @@ describe('#update', () => { ...mockTimestampFieldsWithCreated, }; expect( - (client.create.mock.calls[0][0] as estypes.CreateRequest).body! + (client.create.mock.calls[0][0] as estypes.CreateRequest) + .document! ).toEqual(expectedType); }); @@ -383,7 +385,7 @@ describe('#update', () => { index: '.kibana-test_8.0.0-testing', refresh: 'wait_for', require_alias: true, - body: expect.objectContaining({ + document: expect.objectContaining({ multiNamespaceIsolatedType: { title: 'Testing' }, namespaces: ['default'], references: [], @@ -403,8 +405,8 @@ describe('#update', () => { references, }); expect( - (client.index.mock.calls[0][0] as estypes.CreateRequest).body! - .references + (client.index.mock.calls[0][0] as estypes.CreateRequest) + .document!.references ).toEqual([]); client.index.mockClear(); client.create.mockClear(); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/update.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/update.ts index 2fdad31c2936d..552885bfd51b9 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/update.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/update.ts @@ -22,6 +22,7 @@ import type { SavedObjectsUpdateResponse, } from '@kbn/core-saved-objects-api-server'; import { isNotFoundFromUnsupportedServer } from '@kbn/core-elasticsearch-server-internal'; +import type { CreateRequest, IndexRequest } from '@elastic/elasticsearch/lib/api/types'; import { DEFAULT_REFRESH_SETTING, DEFAULT_RETRY_COUNT } from '../constants'; import { isValidRequest } from '../utils'; import { getCurrentTime, getSavedObjectFromSource, mergeForUpdate } from './utils'; @@ -187,12 +188,13 @@ export const executeUpdate = async ( validationHelper.validateObjectForCreate(type, migratedUpsert); const rawUpsert = serializer.savedObjectToRaw(migratedUpsert); - const createRequestParams = { + const createRequestParams: CreateRequest = { id: rawUpsert._id, index: commonHelper.getIndexForType(type), refresh, - body: rawUpsert._source, + document: rawUpsert._source, ...(version ? decodeRequestVersion(version) : {}), + // @ts-expect-error require_alias: true, }; @@ -289,11 +291,11 @@ export const executeUpdate = async ( ); // implement creating the call params - const indexRequestParams = { + const indexRequestParams: IndexRequest = { id: docToSend._id, index: commonHelper.getIndexForType(type), refresh, - body: docToSend._source, + document: docToSend._source, // using version from the source doc if not provided as option to avoid erasing changes in case of concurrent calls ...decodeRequestVersion(version || migrated!.version), require_alias: true, diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/es_responses.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/es_responses.ts index 70979081bc960..0079d276bbe29 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/es_responses.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/es_responses.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; /** * Type and type guard function for converting a possibly not existent doc to an existent doc. diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/internal_utils.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/internal_utils.ts index fed582f5c43d9..411d452b1a82f 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/internal_utils.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/internal_utils.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { Payload } from '@hapi/boom'; import { SavedObjectsErrorHelpers, diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/merge_for_update.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/merge_for_update.ts index 909ac19a18d6c..a930b0841b3df 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/merge_for_update.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/merge_for_update.ts @@ -9,7 +9,7 @@ import { isPlainObject } from 'lodash'; import { set } from '@kbn/safer-lodash-set'; -import type { MappingProperty as EsMappingProperty } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { MappingProperty as EsMappingProperty } from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsTypeMappingDefinition, SavedObjectsFieldMapping, diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/point_in_time_finder.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/point_in_time_finder.ts index cce8ca83dc5d9..7342690a4024a 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/point_in_time_finder.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/point_in_time_finder.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { Logger } from '@kbn/logging'; import type { SavedObjectsFindOptions, diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/repository.encryption_extension.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/repository.encryption_extension.test.ts index cf66621565577..5c1a9ecfce2a6 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/repository.encryption_extension.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/repository.encryption_extension.test.ts @@ -14,7 +14,7 @@ import { mockGetSearchDsl, } from './repository.test.mock'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { SavedObjectsRepository } from './repository'; import { loggerMock } from '@kbn/logging-mocks'; @@ -440,14 +440,12 @@ describe('SavedObjectsRepository Encryption Extension', () => { ) => { expect(client.mget).toHaveBeenCalledWith( expect.objectContaining({ - body: { - docs: objects.map(({ type, id }) => - expect.objectContaining({ - _index, - _id: getId(type, id), - }) - ), - }, + docs: objects.map(({ type, id }) => + expect.objectContaining({ + _index, + _id: getId(type, id), + }) + ), }), expect.anything() ); diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/repository.spaces_extension.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/repository.spaces_extension.test.ts index d91effdb90f19..c880baadb5eed 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/repository.spaces_extension.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/repository.spaces_extension.test.ts @@ -18,7 +18,7 @@ import { mockDeleteLegacyUrlAliases, } from './repository.test.mock'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { SavedObjectsRepository } from './repository'; import { loggerMock } from '@kbn/logging-mocks'; @@ -234,7 +234,7 @@ describe('SavedObjectsRepository Spaces Extension', () => { id: `${ currentSpace.expectedNamespace ? `${currentSpace.expectedNamespace}:` : '' }${type}:${id}`, - body: expect.objectContaining( + document: expect.objectContaining( currentSpace.expectedNamespace ? { namespace: currentSpace.expectedNamespace, @@ -274,7 +274,7 @@ describe('SavedObjectsRepository Spaces Extension', () => { expect(client.create).toHaveBeenCalledWith( expect.objectContaining({ id: expect.stringMatching(regex), - body: expect.objectContaining( + document: expect.objectContaining( currentSpace.expectedNamespace ? { namespace: currentSpace.expectedNamespace, @@ -379,18 +379,16 @@ describe('SavedObjectsRepository Spaces Extension', () => { expect(client.mget).toHaveBeenCalledTimes(1); expect(client.mget).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ - docs: expect.arrayContaining([ - expect.objectContaining({ - _id: `${ - currentSpace.expectedNamespace ? `${currentSpace.expectedNamespace}:` : '' - }${obj1.type}:${obj1.id}`, - }), - expect.objectContaining({ - _id: `${obj2.type}:${obj2.id}`, - }), - ]), - }), + docs: expect.arrayContaining([ + expect.objectContaining({ + _id: `${ + currentSpace.expectedNamespace ? `${currentSpace.expectedNamespace}:` : '' + }${obj1.type}:${obj1.id}`, + }), + expect.objectContaining({ + _id: `${obj2.type}:${obj2.id}`, + }), + ]), }), { ignore: [404], meta: true } ); @@ -570,18 +568,16 @@ describe('SavedObjectsRepository Spaces Extension', () => { expect(client.mget).toHaveBeenCalledTimes(1); expect(client.mget).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.objectContaining({ - docs: expect.arrayContaining([ - expect.objectContaining({ - _id: `${ - currentSpace.expectedNamespace ? `${currentSpace.expectedNamespace}:` : '' - }${obj1.type}:${obj1.id}`, - }), - expect.objectContaining({ - _id: `${obj2.type}:${obj2.id}`, - }), - ]), - }), + docs: expect.arrayContaining([ + expect.objectContaining({ + _id: `${ + currentSpace.expectedNamespace ? `${currentSpace.expectedNamespace}:` : '' + }${obj1.type}:${obj1.id}`, + }), + expect.objectContaining({ + _id: `${obj2.type}:${obj2.id}`, + }), + ]), }), { ignore: [404], meta: true } ); @@ -638,7 +634,7 @@ describe('SavedObjectsRepository Spaces Extension', () => { expect(client.bulk).toHaveBeenCalledTimes(1); expect(client.bulk).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.arrayContaining([ + operations: expect.arrayContaining([ expect.objectContaining({ create: expect.objectContaining({ _id: `${ @@ -696,7 +692,7 @@ describe('SavedObjectsRepository Spaces Extension', () => { expect(client.bulk).toHaveBeenCalledTimes(1); expect(client.bulk).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.arrayContaining([ + operations: expect.arrayContaining([ expect.objectContaining({ index: expect.objectContaining({ _id: `${ @@ -855,7 +851,7 @@ describe('SavedObjectsRepository Spaces Extension', () => { expect(client.bulk).toHaveBeenCalledTimes(1); expect(client.bulk).toHaveBeenCalledWith( expect.objectContaining({ - body: expect.arrayContaining([ + operations: expect.arrayContaining([ expect.objectContaining({ delete: expect.objectContaining({ _id: `${ diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/repository.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/repository.ts index b2b8de1b4192a..926a36a3bc207 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/repository.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/repository.ts @@ -537,9 +537,7 @@ export class SavedObjectsRepository implements ISavedObjectsRepository { this.extensions.securityExtension.auditClosePointInTime(); } - return await this.client.closePointInTime({ - body: { id }, - }); + return await this.client.closePointInTime({ id }); } /** diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/repository_es_client.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/repository_es_client.test.ts index b8f2ee6e41e3d..d271777f52294 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/repository_es_client.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/repository_es_client.test.ts @@ -25,19 +25,19 @@ describe('RepositoryEsClient', () => { it('delegates call to ES client method', async () => { expect(repositoryClient.bulk).toStrictEqual(expect.any(Function)); - await repositoryClient.bulk({ body: [] }); + await repositoryClient.bulk({ operations: [] }); expect(client.bulk).toHaveBeenCalledTimes(1); }); it('wraps a method call in retryCallCluster', async () => { - await repositoryClient.bulk({ body: [] }); + await repositoryClient.bulk({ operations: [] }); expect(retryCallClusterMock).toHaveBeenCalledTimes(1); }); it('keeps call options unchanged', async () => { expect(repositoryClient.bulk).toStrictEqual(expect.any(Function)); const options = { maxRetries: 12 }; - await repositoryClient.bulk({ body: [] }, options); + await repositoryClient.bulk({ operations: [] }, options); expect(client.bulk).toHaveBeenCalledWith(expect.any(Object), options); }); @@ -45,7 +45,7 @@ describe('RepositoryEsClient', () => { expect.assertions(1); client.bulk.mockRejectedValue(new Error('reason')); try { - await repositoryClient.bulk({ body: [] }); + await repositoryClient.bulk({ operations: [] }); } catch (e) { expect(SavedObjectsErrorHelpers.isSavedObjectsClientError(e)).toBe(true); } diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/search/aggregations/validation.test.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/search/aggregations/validation.test.ts index f7337ba2ca5dd..79cfd0c582458 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/search/aggregations/validation.test.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/search/aggregations/validation.test.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { validateAndConvertAggregations } from './validation'; type AggsMap = Record; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/search/aggregations/validation.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/search/aggregations/validation.ts index 2345261284519..3ee6d7077499a 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/search/aggregations/validation.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/search/aggregations/validation.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { ObjectType } from '@kbn/config-schema'; import { isPlainObject, isArray } from 'lodash'; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/search/search_dsl/search_dsl.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/search/search_dsl/search_dsl.ts index 639798aa27ec8..90bb8ae96fb8f 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/search/search_dsl/search_dsl.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/search/search_dsl/search_dsl.ts @@ -9,7 +9,7 @@ import Boom from '@hapi/boom'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsPitParams } from '@kbn/core-saved-objects-api-server'; import type { ISavedObjectTypeRegistry } from '@kbn/core-saved-objects-server'; import type { IndexMapping } from '@kbn/core-saved-objects-base-server-internal'; diff --git a/src/core/packages/saved-objects/api-server-internal/src/lib/search/search_dsl/sorting_params.ts b/src/core/packages/saved-objects/api-server-internal/src/lib/search/search_dsl/sorting_params.ts index d64c290da0569..c62f12dac8002 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/lib/search/search_dsl/sorting_params.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/lib/search/search_dsl/sorting_params.ts @@ -8,7 +8,7 @@ */ import Boom from '@hapi/boom'; -import type { SortOrder, SortCombinations } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { SortOrder, SortCombinations } from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsPitParams } from '@kbn/core-saved-objects-api-server/src/apis'; import { getProperty, type IndexMapping } from '@kbn/core-saved-objects-base-server-internal'; diff --git a/src/core/packages/saved-objects/api-server-internal/src/test_helpers/repository.test.common.ts b/src/core/packages/saved-objects/api-server-internal/src/test_helpers/repository.test.common.ts index 5670062c69ef2..25be3695db92f 100644 --- a/src/core/packages/saved-objects/api-server-internal/src/test_helpers/repository.test.common.ts +++ b/src/core/packages/saved-objects/api-server-internal/src/test_helpers/repository.test.common.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { schema } from '@kbn/config-schema'; import { loggerMock } from '@kbn/logging-mocks'; import type { Payload } from 'elastic-apm-node'; diff --git a/src/core/packages/saved-objects/api-server/src/apis/find.ts b/src/core/packages/saved-objects/api-server/src/apis/find.ts index 83bd08ba8b9c7..6d70566c7a8ad 100644 --- a/src/core/packages/saved-objects/api-server/src/apis/find.ts +++ b/src/core/packages/saved-objects/api-server/src/apis/find.ts @@ -11,7 +11,7 @@ import type { SortOrder, AggregationsAggregationContainer, SortResults, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +} from '@elastic/elasticsearch/lib/api/types'; import type { SavedObject } from '../..'; type KueryNode = any; diff --git a/src/core/packages/saved-objects/base-server-internal/src/utils/get_field_list.ts b/src/core/packages/saved-objects/base-server-internal/src/utils/get_field_list.ts index 1e3c29bb24a56..a0f07c300d271 100644 --- a/src/core/packages/saved-objects/base-server-internal/src/utils/get_field_list.ts +++ b/src/core/packages/saved-objects/base-server-internal/src/utils/get_field_list.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { MappingProperty as EsMappingProperty } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { MappingProperty as EsMappingProperty } from '@elastic/elasticsearch/lib/api/types'; import type { SavedObjectsTypeMappingDefinition, SavedObjectsFieldMapping, diff --git a/src/core/packages/saved-objects/migration-server-internal/src/actions/bulk_overwrite_transformed_documents.ts b/src/core/packages/saved-objects/migration-server-internal/src/actions/bulk_overwrite_transformed_documents.ts index b2222c562f9ad..fa5ab8e09b3d6 100644 --- a/src/core/packages/saved-objects/migration-server-internal/src/actions/bulk_overwrite_transformed_documents.ts +++ b/src/core/packages/saved-objects/migration-server-internal/src/actions/bulk_overwrite_transformed_documents.ts @@ -9,7 +9,7 @@ import * as Either from 'fp-ts/lib/Either'; import * as TaskEither from 'fp-ts/lib/TaskEither'; -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type * as estypes from '@elastic/elasticsearch/lib/api/types'; import { errors as esErrors } from '@elastic/elasticsearch'; import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import { diff --git a/src/core/packages/saved-objects/migration-server-internal/src/actions/create_index.ts b/src/core/packages/saved-objects/migration-server-internal/src/actions/create_index.ts index 60d3eb2aba762..5895f6b1cca0a 100644 --- a/src/core/packages/saved-objects/migration-server-internal/src/actions/create_index.ts +++ b/src/core/packages/saved-objects/migration-server-internal/src/actions/create_index.ts @@ -10,7 +10,7 @@ import * as Either from 'fp-ts/lib/Either'; import * as TaskEither from 'fp-ts/lib/TaskEither'; import { pipe } from 'fp-ts/lib/function'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { ElasticsearchClient, ElasticsearchCapabilities, diff --git a/src/core/packages/saved-objects/migration-server-internal/src/actions/read_with_pit.ts b/src/core/packages/saved-objects/migration-server-internal/src/actions/read_with_pit.ts index d22f05919aeb4..283786a4d90f5 100644 --- a/src/core/packages/saved-objects/migration-server-internal/src/actions/read_with_pit.ts +++ b/src/core/packages/saved-objects/migration-server-internal/src/actions/read_with_pit.ts @@ -9,7 +9,7 @@ import * as Either from 'fp-ts/lib/Either'; import * as TaskEither from 'fp-ts/lib/TaskEither'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import { errors as EsErrors } from '@elastic/elasticsearch'; import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import type { SavedObjectsRawDoc } from '@kbn/core-saved-objects-server'; diff --git a/src/core/packages/saved-objects/server/src/mapping_definition.ts b/src/core/packages/saved-objects/server/src/mapping_definition.ts index 1eee67f537095..d238d2298fc3e 100644 --- a/src/core/packages/saved-objects/server/src/mapping_definition.ts +++ b/src/core/packages/saved-objects/server/src/mapping_definition.ts @@ -11,7 +11,7 @@ import type { PropertyName as EsPropertyName, MappingProperty as EsMappingProperty, MappingPropertyBase as EsMappingPropertyBase, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +} from '@elastic/elasticsearch/lib/api/types'; /** * Describe a saved object type mapping. diff --git a/src/core/packages/saved-objects/server/src/saved_objects_type.ts b/src/core/packages/saved-objects/server/src/saved_objects_type.ts index cb2930f5d4676..dee93ada50cb3 100644 --- a/src/core/packages/saved-objects/server/src/saved_objects_type.ts +++ b/src/core/packages/saved-objects/server/src/saved_objects_type.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; import type { MaybePromise } from '@kbn/utility-types'; import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import type { SavedObjectsNamespaceType } from '@kbn/core-saved-objects-common'; diff --git a/src/core/packages/usage-data/server-internal/src/core_usage_data_service.ts b/src/core/packages/usage-data/server-internal/src/core_usage_data_service.ts index 7ac7cbb7fbb57..c970bd4abfa6d 100644 --- a/src/core/packages/usage-data/server-internal/src/core_usage_data_service.ts +++ b/src/core/packages/usage-data/server-internal/src/core_usage_data_service.ts @@ -16,7 +16,7 @@ import type { AggregationsMultiBucketAggregateBase, AggregationsSingleBucketAggregateBase, SearchTotalHits, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +} from '@elastic/elasticsearch/lib/api/types'; import type { CoreContext, CoreService } from '@kbn/core-base-server-internal'; import type { LoggingConfigType } from '@kbn/core-logging-server-internal'; import type { Logger } from '@kbn/logging'; diff --git a/src/core/server/integration_tests/saved_objects/migrations/group3/actions/es_errors.test.ts b/src/core/server/integration_tests/saved_objects/migrations/group3/actions/es_errors.test.ts index 108d92fc9a12a..a0d725324d9a1 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/group3/actions/es_errors.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/group3/actions/es_errors.test.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type * as estypes from '@elastic/elasticsearch/lib/api/types'; import { InternalCoreStart } from '@kbn/core-lifecycle-server-internal'; import { Root } from '@kbn/core-root-server-internal'; import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; diff --git a/packages/kbn-item-buffer/README.md b/src/platform/packages/private/kbn-item-buffer/README.md similarity index 100% rename from packages/kbn-item-buffer/README.md rename to src/platform/packages/private/kbn-item-buffer/README.md diff --git a/packages/kbn-item-buffer/index.ts b/src/platform/packages/private/kbn-item-buffer/index.ts similarity index 100% rename from packages/kbn-item-buffer/index.ts rename to src/platform/packages/private/kbn-item-buffer/index.ts diff --git a/packages/home/sample_data_types/jest.config.js b/src/platform/packages/private/kbn-item-buffer/jest.config.js similarity index 84% rename from packages/home/sample_data_types/jest.config.js rename to src/platform/packages/private/kbn-item-buffer/jest.config.js index a1d6c3cbb0bd1..2403741c95ba1 100644 --- a/packages/home/sample_data_types/jest.config.js +++ b/src/platform/packages/private/kbn-item-buffer/jest.config.js @@ -9,6 +9,6 @@ module.exports = { preset: '@kbn/test/jest_node', - rootDir: '../../..', - roots: ['/packages/home/sample_data_types'], + rootDir: '../../../../..', + roots: ['/src/platform/packages/private/kbn-item-buffer'], }; diff --git a/packages/kbn-item-buffer/kibana.jsonc b/src/platform/packages/private/kbn-item-buffer/kibana.jsonc similarity index 100% rename from packages/kbn-item-buffer/kibana.jsonc rename to src/platform/packages/private/kbn-item-buffer/kibana.jsonc diff --git a/packages/kbn-item-buffer/package.json b/src/platform/packages/private/kbn-item-buffer/package.json similarity index 100% rename from packages/kbn-item-buffer/package.json rename to src/platform/packages/private/kbn-item-buffer/package.json diff --git a/packages/kbn-item-buffer/src/__test__/run_item_buffer_tests.ts b/src/platform/packages/private/kbn-item-buffer/src/__test__/run_item_buffer_tests.ts similarity index 100% rename from packages/kbn-item-buffer/src/__test__/run_item_buffer_tests.ts rename to src/platform/packages/private/kbn-item-buffer/src/__test__/run_item_buffer_tests.ts diff --git a/packages/kbn-item-buffer/src/index.ts b/src/platform/packages/private/kbn-item-buffer/src/index.ts similarity index 100% rename from packages/kbn-item-buffer/src/index.ts rename to src/platform/packages/private/kbn-item-buffer/src/index.ts diff --git a/packages/kbn-item-buffer/src/item_buffer.test.ts b/src/platform/packages/private/kbn-item-buffer/src/item_buffer.test.ts similarity index 100% rename from packages/kbn-item-buffer/src/item_buffer.test.ts rename to src/platform/packages/private/kbn-item-buffer/src/item_buffer.test.ts diff --git a/packages/kbn-item-buffer/src/item_buffer.ts b/src/platform/packages/private/kbn-item-buffer/src/item_buffer.ts similarity index 100% rename from packages/kbn-item-buffer/src/item_buffer.ts rename to src/platform/packages/private/kbn-item-buffer/src/item_buffer.ts diff --git a/packages/kbn-item-buffer/src/timed_item_buffer.test.ts b/src/platform/packages/private/kbn-item-buffer/src/timed_item_buffer.test.ts similarity index 100% rename from packages/kbn-item-buffer/src/timed_item_buffer.test.ts rename to src/platform/packages/private/kbn-item-buffer/src/timed_item_buffer.test.ts diff --git a/packages/kbn-item-buffer/src/timed_item_buffer.ts b/src/platform/packages/private/kbn-item-buffer/src/timed_item_buffer.ts similarity index 100% rename from packages/kbn-item-buffer/src/timed_item_buffer.ts rename to src/platform/packages/private/kbn-item-buffer/src/timed_item_buffer.ts diff --git a/packages/kbn-react-mute-legacy-root-warning/tsconfig.json b/src/platform/packages/private/kbn-item-buffer/tsconfig.json similarity index 80% rename from packages/kbn-react-mute-legacy-root-warning/tsconfig.json rename to src/platform/packages/private/kbn-item-buffer/tsconfig.json index 2f9ddddbeea23..7aba1b1a9378a 100644 --- a/packages/kbn-react-mute-legacy-root-warning/tsconfig.json +++ b/src/platform/packages/private/kbn-item-buffer/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/kbn-react-mute-legacy-root-warning/README.md b/src/platform/packages/private/kbn-react-mute-legacy-root-warning/README.md similarity index 100% rename from packages/kbn-react-mute-legacy-root-warning/README.md rename to src/platform/packages/private/kbn-react-mute-legacy-root-warning/README.md diff --git a/packages/kbn-react-mute-legacy-root-warning/index.ts b/src/platform/packages/private/kbn-react-mute-legacy-root-warning/index.ts similarity index 100% rename from packages/kbn-react-mute-legacy-root-warning/index.ts rename to src/platform/packages/private/kbn-react-mute-legacy-root-warning/index.ts diff --git a/src/platform/packages/private/kbn-react-mute-legacy-root-warning/jest.config.js b/src/platform/packages/private/kbn-react-mute-legacy-root-warning/jest.config.js new file mode 100644 index 0000000000000..da6175c9c6c3b --- /dev/null +++ b/src/platform/packages/private/kbn-react-mute-legacy-root-warning/jest.config.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", 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: ['/src/platform/packages/private/kbn-react-mute-legacy-root-warning'], +}; diff --git a/packages/kbn-react-mute-legacy-root-warning/kibana.jsonc b/src/platform/packages/private/kbn-react-mute-legacy-root-warning/kibana.jsonc similarity index 100% rename from packages/kbn-react-mute-legacy-root-warning/kibana.jsonc rename to src/platform/packages/private/kbn-react-mute-legacy-root-warning/kibana.jsonc diff --git a/packages/kbn-react-mute-legacy-root-warning/package.json b/src/platform/packages/private/kbn-react-mute-legacy-root-warning/package.json similarity index 100% rename from packages/kbn-react-mute-legacy-root-warning/package.json rename to src/platform/packages/private/kbn-react-mute-legacy-root-warning/package.json diff --git a/packages/kbn-item-buffer/tsconfig.json b/src/platform/packages/private/kbn-react-mute-legacy-root-warning/tsconfig.json similarity index 80% rename from packages/kbn-item-buffer/tsconfig.json rename to src/platform/packages/private/kbn-react-mute-legacy-root-warning/tsconfig.json index 2f9ddddbeea23..7aba1b1a9378a 100644 --- a/packages/kbn-item-buffer/tsconfig.json +++ b/src/platform/packages/private/kbn-react-mute-legacy-root-warning/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/kbn-saved-objects-settings/README.md b/src/platform/packages/private/kbn-saved-objects-settings/README.md similarity index 100% rename from packages/kbn-saved-objects-settings/README.md rename to src/platform/packages/private/kbn-saved-objects-settings/README.md diff --git a/packages/kbn-saved-objects-settings/index.ts b/src/platform/packages/private/kbn-saved-objects-settings/index.ts similarity index 100% rename from packages/kbn-saved-objects-settings/index.ts rename to src/platform/packages/private/kbn-saved-objects-settings/index.ts diff --git a/packages/kbn-react-mute-legacy-root-warning/jest.config.js b/src/platform/packages/private/kbn-saved-objects-settings/jest.config.js similarity index 82% rename from packages/kbn-react-mute-legacy-root-warning/jest.config.js rename to src/platform/packages/private/kbn-saved-objects-settings/jest.config.js index 00d62deb5770f..0e76068f71342 100644 --- a/packages/kbn-react-mute-legacy-root-warning/jest.config.js +++ b/src/platform/packages/private/kbn-saved-objects-settings/jest.config.js @@ -9,6 +9,6 @@ module.exports = { preset: '@kbn/test/jest_node', - rootDir: '../..', - roots: ['/packages/kbn-react-mute-legacy-root-warning'], + rootDir: '../../../../..', + roots: ['/src/platform/packages/private/kbn-saved-objects-settings'], }; diff --git a/packages/kbn-saved-objects-settings/kibana.jsonc b/src/platform/packages/private/kbn-saved-objects-settings/kibana.jsonc similarity index 100% rename from packages/kbn-saved-objects-settings/kibana.jsonc rename to src/platform/packages/private/kbn-saved-objects-settings/kibana.jsonc diff --git a/packages/kbn-saved-objects-settings/package.json b/src/platform/packages/private/kbn-saved-objects-settings/package.json similarity index 100% rename from packages/kbn-saved-objects-settings/package.json rename to src/platform/packages/private/kbn-saved-objects-settings/package.json diff --git a/packages/kbn-saved-objects-settings/tsconfig.json b/src/platform/packages/private/kbn-saved-objects-settings/tsconfig.json similarity index 80% rename from packages/kbn-saved-objects-settings/tsconfig.json rename to src/platform/packages/private/kbn-saved-objects-settings/tsconfig.json index 2f9ddddbeea23..7aba1b1a9378a 100644 --- a/packages/kbn-saved-objects-settings/tsconfig.json +++ b/src/platform/packages/private/kbn-saved-objects-settings/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/src/platform/packages/private/kbn-ui-shared-deps-src/BUILD.bazel b/src/platform/packages/private/kbn-ui-shared-deps-src/BUILD.bazel index 0cccba9b65a1a..f14402dfa88c1 100644 --- a/src/platform/packages/private/kbn-ui-shared-deps-src/BUILD.bazel +++ b/src/platform/packages/private/kbn-ui-shared-deps-src/BUILD.bazel @@ -39,10 +39,10 @@ webpack_cli( "//src/platform/packages/shared/shared-ux/error_boundary", "//src/platform/packages/shared/kbn-rison", "//src/platform/packages/shared/shared-ux/code_editor/impl:code_editor", - "//packages/react/kibana_context/common", - "//packages/react/kibana_context/root", - "//packages/react/kibana_context/render", - "//packages/react/kibana_context/theme", + "//src/platform/packages/shared/react/kibana_context/common", + "//src/platform/packages/shared/react/kibana_context/root", + "//src/platform/packages/shared/react/kibana_context/render", + "//src/platform/packages/shared/react/kibana_context/theme", "//src/platform/packages/shared/shared-ux/router/impl:shared-ux-router", ], output_dir = True, diff --git a/packages/serverless/project_switcher/README.mdx b/src/platform/packages/private/serverless/project_switcher/README.mdx similarity index 100% rename from packages/serverless/project_switcher/README.mdx rename to src/platform/packages/private/serverless/project_switcher/README.mdx diff --git a/packages/serverless/project_switcher/index.ts b/src/platform/packages/private/serverless/project_switcher/index.ts similarity index 100% rename from packages/serverless/project_switcher/index.ts rename to src/platform/packages/private/serverless/project_switcher/index.ts diff --git a/src/platform/packages/private/serverless/project_switcher/jest.config.js b/src/platform/packages/private/serverless/project_switcher/jest.config.js new file mode 100644 index 0000000000000..17c8a482cb94b --- /dev/null +++ b/src/platform/packages/private/serverless/project_switcher/jest.config.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", 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: ['/src/platform/packages/private/serverless/project_switcher'], +}; diff --git a/packages/serverless/project_switcher/kibana.jsonc b/src/platform/packages/private/serverless/project_switcher/kibana.jsonc similarity index 100% rename from packages/serverless/project_switcher/kibana.jsonc rename to src/platform/packages/private/serverless/project_switcher/kibana.jsonc diff --git a/packages/serverless/project_switcher/mocks/jest.mock.ts b/src/platform/packages/private/serverless/project_switcher/mocks/jest.mock.ts similarity index 100% rename from packages/serverless/project_switcher/mocks/jest.mock.ts rename to src/platform/packages/private/serverless/project_switcher/mocks/jest.mock.ts diff --git a/packages/serverless/project_switcher/mocks/storybook.mock.ts b/src/platform/packages/private/serverless/project_switcher/mocks/storybook.mock.ts similarity index 100% rename from packages/serverless/project_switcher/mocks/storybook.mock.ts rename to src/platform/packages/private/serverless/project_switcher/mocks/storybook.mock.ts diff --git a/packages/serverless/project_switcher/package.json b/src/platform/packages/private/serverless/project_switcher/package.json similarity index 100% rename from packages/serverless/project_switcher/package.json rename to src/platform/packages/private/serverless/project_switcher/package.json diff --git a/packages/serverless/project_switcher/src/constants.ts b/src/platform/packages/private/serverless/project_switcher/src/constants.ts similarity index 100% rename from packages/serverless/project_switcher/src/constants.ts rename to src/platform/packages/private/serverless/project_switcher/src/constants.ts diff --git a/packages/serverless/project_switcher/src/header_button.tsx b/src/platform/packages/private/serverless/project_switcher/src/header_button.tsx similarity index 100% rename from packages/serverless/project_switcher/src/header_button.tsx rename to src/platform/packages/private/serverless/project_switcher/src/header_button.tsx diff --git a/packages/serverless/project_switcher/src/index.ts b/src/platform/packages/private/serverless/project_switcher/src/index.ts similarity index 100% rename from packages/serverless/project_switcher/src/index.ts rename to src/platform/packages/private/serverless/project_switcher/src/index.ts diff --git a/packages/serverless/project_switcher/src/item.tsx b/src/platform/packages/private/serverless/project_switcher/src/item.tsx similarity index 100% rename from packages/serverless/project_switcher/src/item.tsx rename to src/platform/packages/private/serverless/project_switcher/src/item.tsx diff --git a/packages/serverless/project_switcher/src/loader.tsx b/src/platform/packages/private/serverless/project_switcher/src/loader.tsx similarity index 100% rename from packages/serverless/project_switcher/src/loader.tsx rename to src/platform/packages/private/serverless/project_switcher/src/loader.tsx diff --git a/packages/serverless/project_switcher/src/logo.tsx b/src/platform/packages/private/serverless/project_switcher/src/logo.tsx similarity index 100% rename from packages/serverless/project_switcher/src/logo.tsx rename to src/platform/packages/private/serverless/project_switcher/src/logo.tsx diff --git a/packages/serverless/project_switcher/src/services.tsx b/src/platform/packages/private/serverless/project_switcher/src/services.tsx similarity index 100% rename from packages/serverless/project_switcher/src/services.tsx rename to src/platform/packages/private/serverless/project_switcher/src/services.tsx diff --git a/packages/serverless/project_switcher/src/switcher.component.tsx b/src/platform/packages/private/serverless/project_switcher/src/switcher.component.tsx similarity index 100% rename from packages/serverless/project_switcher/src/switcher.component.tsx rename to src/platform/packages/private/serverless/project_switcher/src/switcher.component.tsx diff --git a/packages/serverless/project_switcher/src/switcher.stories.tsx b/src/platform/packages/private/serverless/project_switcher/src/switcher.stories.tsx similarity index 100% rename from packages/serverless/project_switcher/src/switcher.stories.tsx rename to src/platform/packages/private/serverless/project_switcher/src/switcher.stories.tsx diff --git a/packages/serverless/project_switcher/src/switcher.test.tsx b/src/platform/packages/private/serverless/project_switcher/src/switcher.test.tsx similarity index 100% rename from packages/serverless/project_switcher/src/switcher.test.tsx rename to src/platform/packages/private/serverless/project_switcher/src/switcher.test.tsx diff --git a/packages/serverless/project_switcher/src/switcher.tsx b/src/platform/packages/private/serverless/project_switcher/src/switcher.tsx similarity index 100% rename from packages/serverless/project_switcher/src/switcher.tsx rename to src/platform/packages/private/serverless/project_switcher/src/switcher.tsx diff --git a/packages/serverless/project_switcher/src/types.ts b/src/platform/packages/private/serverless/project_switcher/src/types.ts similarity index 100% rename from packages/serverless/project_switcher/src/types.ts rename to src/platform/packages/private/serverless/project_switcher/src/types.ts diff --git a/packages/serverless/project_switcher/tsconfig.json b/src/platform/packages/private/serverless/project_switcher/tsconfig.json similarity index 86% rename from packages/serverless/project_switcher/tsconfig.json rename to src/platform/packages/private/serverless/project_switcher/tsconfig.json index 8fd6b54236754..d477303d65059 100644 --- a/packages/serverless/project_switcher/tsconfig.json +++ b/src/platform/packages/private/serverless/project_switcher/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.base.json", + "extends": "../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/serverless/settings/common/README.mdx b/src/platform/packages/private/serverless/settings/common/README.mdx similarity index 100% rename from packages/serverless/settings/common/README.mdx rename to src/platform/packages/private/serverless/settings/common/README.mdx diff --git a/packages/serverless/settings/common/index.ts b/src/platform/packages/private/serverless/settings/common/index.ts similarity index 100% rename from packages/serverless/settings/common/index.ts rename to src/platform/packages/private/serverless/settings/common/index.ts diff --git a/packages/serverless/settings/common/kibana.jsonc b/src/platform/packages/private/serverless/settings/common/kibana.jsonc similarity index 100% rename from packages/serverless/settings/common/kibana.jsonc rename to src/platform/packages/private/serverless/settings/common/kibana.jsonc diff --git a/packages/serverless/settings/common/package.json b/src/platform/packages/private/serverless/settings/common/package.json similarity index 100% rename from packages/serverless/settings/common/package.json rename to src/platform/packages/private/serverless/settings/common/package.json diff --git a/packages/serverless/settings/common/tsconfig.json b/src/platform/packages/private/serverless/settings/common/tsconfig.json similarity index 81% rename from packages/serverless/settings/common/tsconfig.json rename to src/platform/packages/private/serverless/settings/common/tsconfig.json index 16d6022e3d9bc..16a9ba9ba4b5d 100644 --- a/packages/serverless/settings/common/tsconfig.json +++ b/src/platform/packages/private/serverless/settings/common/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/serverless/types/README.mdx b/src/platform/packages/private/serverless/types/README.mdx similarity index 100% rename from packages/serverless/types/README.mdx rename to src/platform/packages/private/serverless/types/README.mdx diff --git a/packages/serverless/types/index.d.ts b/src/platform/packages/private/serverless/types/index.d.ts similarity index 100% rename from packages/serverless/types/index.d.ts rename to src/platform/packages/private/serverless/types/index.d.ts diff --git a/packages/serverless/types/kibana.jsonc b/src/platform/packages/private/serverless/types/kibana.jsonc similarity index 100% rename from packages/serverless/types/kibana.jsonc rename to src/platform/packages/private/serverless/types/kibana.jsonc diff --git a/packages/serverless/types/package.json b/src/platform/packages/private/serverless/types/package.json similarity index 100% rename from packages/serverless/types/package.json rename to src/platform/packages/private/serverless/types/package.json diff --git a/packages/serverless/types/tsconfig.json b/src/platform/packages/private/serverless/types/tsconfig.json similarity index 79% rename from packages/serverless/types/tsconfig.json rename to src/platform/packages/private/serverless/types/tsconfig.json index 6d27b06d5f8ba..63f0b5ff33faa 100644 --- a/packages/serverless/types/tsconfig.json +++ b/src/platform/packages/private/serverless/types/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.base.json", + "extends": "../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/src/platform/packages/shared/content-management/table_list_view_table/src/table_list_view_table.tsx b/src/platform/packages/shared/content-management/table_list_view_table/src/table_list_view_table.tsx index 7a5356f75eb2b..3ab48d58539f4 100644 --- a/src/platform/packages/shared/content-management/table_list_view_table/src/table_list_view_table.tsx +++ b/src/platform/packages/shared/content-management/table_list_view_table/src/table_list_view_table.tsx @@ -299,7 +299,7 @@ const urlStateSerializer = (updated: { const tableColumnMetadata = { title: { field: 'attributes.title', - name: 'Name, description, tags', + name: 'Name', }, updatedAt: { field: 'updatedAt', @@ -421,7 +421,7 @@ function TableListViewTableComp({ pageIndex: 0, totalItemCount: 0, pageSize: initialPageSize, - pageSizeOptions: uniq([10, 20, 50, initialPageSize]).sort(), + pageSizeOptions: uniq([10, 20, 50, initialPageSize]).sort((a, b) => Number(a) - Number(b)), }, tableSort: initialSort.tableSort, sortColumnChanged: !initialSort.isDefault, @@ -606,7 +606,7 @@ function TableListViewTableComp({ name: titleColumnName ?? i18n.translate('contentManagement.tableList.mainColumnName', { - defaultMessage: 'Name, description, tags', + defaultMessage: 'Name', }), sortable: true, render: (field: keyof T, record: T) => { @@ -696,7 +696,7 @@ function TableListViewTableComp({ ), icon: 'pencil', type: 'icon', - available: (item) => Boolean(tableItemsRowActions[item.id]?.edit?.enabled), + available: (item) => tableItemsRowActions[item.id]?.edit?.enabled !== false, enabled: (v) => !(v as unknown as { error: string })?.error, onClick: editItem, 'data-test-subj': `edit-action`, @@ -722,7 +722,7 @@ function TableListViewTableComp({ defaultMessage: 'View details', } ), - icon: 'iInCircle', + icon: 'controlsVertical', type: 'icon', onClick: inspectItem, 'data-test-subj': `inspect-action`, diff --git a/packages/deeplinks/shared/README.md b/src/platform/packages/shared/deeplinks/shared/README.md similarity index 100% rename from packages/deeplinks/shared/README.md rename to src/platform/packages/shared/deeplinks/shared/README.md diff --git a/packages/deeplinks/shared/deep_links.ts b/src/platform/packages/shared/deeplinks/shared/deep_links.ts similarity index 100% rename from packages/deeplinks/shared/deep_links.ts rename to src/platform/packages/shared/deeplinks/shared/deep_links.ts diff --git a/packages/deeplinks/shared/index.ts b/src/platform/packages/shared/deeplinks/shared/index.ts similarity index 100% rename from packages/deeplinks/shared/index.ts rename to src/platform/packages/shared/deeplinks/shared/index.ts diff --git a/packages/home/sample_data_card/jest.config.js b/src/platform/packages/shared/deeplinks/shared/jest.config.js similarity index 83% rename from packages/home/sample_data_card/jest.config.js rename to src/platform/packages/shared/deeplinks/shared/jest.config.js index 0d1af72780e0a..65434efdc3715 100644 --- a/packages/home/sample_data_card/jest.config.js +++ b/src/platform/packages/shared/deeplinks/shared/jest.config.js @@ -9,6 +9,6 @@ module.exports = { preset: '@kbn/test', - rootDir: '../../..', - roots: ['/packages/home/sample_data_card'], + rootDir: '../../../../../..', + roots: ['/src/platform/packages/shared/deeplinks/shared'], }; diff --git a/packages/deeplinks/shared/kibana.jsonc b/src/platform/packages/shared/deeplinks/shared/kibana.jsonc similarity index 100% rename from packages/deeplinks/shared/kibana.jsonc rename to src/platform/packages/shared/deeplinks/shared/kibana.jsonc diff --git a/packages/deeplinks/shared/package.json b/src/platform/packages/shared/deeplinks/shared/package.json similarity index 100% rename from packages/deeplinks/shared/package.json rename to src/platform/packages/shared/deeplinks/shared/package.json diff --git a/packages/deeplinks/shared/tsconfig.json b/src/platform/packages/shared/deeplinks/shared/tsconfig.json similarity index 81% rename from packages/deeplinks/shared/tsconfig.json rename to src/platform/packages/shared/deeplinks/shared/tsconfig.json index d1414086f2187..18d16ae2e8837 100644 --- a/packages/deeplinks/shared/tsconfig.json +++ b/src/platform/packages/shared/deeplinks/shared/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.base.json", + "extends": "../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/home/sample_data_card/README.mdx b/src/platform/packages/shared/home/sample_data_card/README.mdx similarity index 100% rename from packages/home/sample_data_card/README.mdx rename to src/platform/packages/shared/home/sample_data_card/README.mdx diff --git a/packages/home/sample_data_card/index.ts b/src/platform/packages/shared/home/sample_data_card/index.ts similarity index 100% rename from packages/home/sample_data_card/index.ts rename to src/platform/packages/shared/home/sample_data_card/index.ts diff --git a/src/platform/packages/shared/home/sample_data_card/jest.config.js b/src/platform/packages/shared/home/sample_data_card/jest.config.js new file mode 100644 index 0000000000000..0491810279eac --- /dev/null +++ b/src/platform/packages/shared/home/sample_data_card/jest.config.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", 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: ['/src/platform/packages/shared/home/sample_data_card'], +}; diff --git a/packages/home/sample_data_card/kibana.jsonc b/src/platform/packages/shared/home/sample_data_card/kibana.jsonc similarity index 100% rename from packages/home/sample_data_card/kibana.jsonc rename to src/platform/packages/shared/home/sample_data_card/kibana.jsonc diff --git a/packages/home/sample_data_card/package.json b/src/platform/packages/shared/home/sample_data_card/package.json similarity index 100% rename from packages/home/sample_data_card/package.json rename to src/platform/packages/shared/home/sample_data_card/package.json diff --git a/packages/home/sample_data_card/src/__snapshots__/sample_data_card.test.tsx.snap b/src/platform/packages/shared/home/sample_data_card/src/__snapshots__/sample_data_card.test.tsx.snap similarity index 100% rename from packages/home/sample_data_card/src/__snapshots__/sample_data_card.test.tsx.snap rename to src/platform/packages/shared/home/sample_data_card/src/__snapshots__/sample_data_card.test.tsx.snap diff --git a/packages/home/sample_data_card/src/constants.ts b/src/platform/packages/shared/home/sample_data_card/src/constants.ts similarity index 100% rename from packages/home/sample_data_card/src/constants.ts rename to src/platform/packages/shared/home/sample_data_card/src/constants.ts diff --git a/packages/home/sample_data_card/src/footer/__snapshots__/disabled_footer.test.tsx.snap b/src/platform/packages/shared/home/sample_data_card/src/footer/__snapshots__/disabled_footer.test.tsx.snap similarity index 100% rename from packages/home/sample_data_card/src/footer/__snapshots__/disabled_footer.test.tsx.snap rename to src/platform/packages/shared/home/sample_data_card/src/footer/__snapshots__/disabled_footer.test.tsx.snap diff --git a/packages/home/sample_data_card/src/footer/__snapshots__/install_footer.test.tsx.snap b/src/platform/packages/shared/home/sample_data_card/src/footer/__snapshots__/install_footer.test.tsx.snap similarity index 100% rename from packages/home/sample_data_card/src/footer/__snapshots__/install_footer.test.tsx.snap rename to src/platform/packages/shared/home/sample_data_card/src/footer/__snapshots__/install_footer.test.tsx.snap diff --git a/packages/home/sample_data_card/src/footer/__snapshots__/remove_footer.test.tsx.snap b/src/platform/packages/shared/home/sample_data_card/src/footer/__snapshots__/remove_footer.test.tsx.snap similarity index 100% rename from packages/home/sample_data_card/src/footer/__snapshots__/remove_footer.test.tsx.snap rename to src/platform/packages/shared/home/sample_data_card/src/footer/__snapshots__/remove_footer.test.tsx.snap diff --git a/packages/home/sample_data_card/src/footer/__snapshots__/view_button.test.tsx.snap b/src/platform/packages/shared/home/sample_data_card/src/footer/__snapshots__/view_button.test.tsx.snap similarity index 100% rename from packages/home/sample_data_card/src/footer/__snapshots__/view_button.test.tsx.snap rename to src/platform/packages/shared/home/sample_data_card/src/footer/__snapshots__/view_button.test.tsx.snap diff --git a/packages/home/sample_data_card/src/footer/disabled_footer.test.tsx b/src/platform/packages/shared/home/sample_data_card/src/footer/disabled_footer.test.tsx similarity index 100% rename from packages/home/sample_data_card/src/footer/disabled_footer.test.tsx rename to src/platform/packages/shared/home/sample_data_card/src/footer/disabled_footer.test.tsx diff --git a/packages/home/sample_data_card/src/footer/disabled_footer.tsx b/src/platform/packages/shared/home/sample_data_card/src/footer/disabled_footer.tsx similarity index 100% rename from packages/home/sample_data_card/src/footer/disabled_footer.tsx rename to src/platform/packages/shared/home/sample_data_card/src/footer/disabled_footer.tsx diff --git a/packages/home/sample_data_card/src/footer/footer.stories.tsx b/src/platform/packages/shared/home/sample_data_card/src/footer/footer.stories.tsx similarity index 100% rename from packages/home/sample_data_card/src/footer/footer.stories.tsx rename to src/platform/packages/shared/home/sample_data_card/src/footer/footer.stories.tsx diff --git a/packages/home/sample_data_card/src/footer/index.tsx b/src/platform/packages/shared/home/sample_data_card/src/footer/index.tsx similarity index 100% rename from packages/home/sample_data_card/src/footer/index.tsx rename to src/platform/packages/shared/home/sample_data_card/src/footer/index.tsx diff --git a/packages/home/sample_data_card/src/footer/install_footer.test.tsx b/src/platform/packages/shared/home/sample_data_card/src/footer/install_footer.test.tsx similarity index 100% rename from packages/home/sample_data_card/src/footer/install_footer.test.tsx rename to src/platform/packages/shared/home/sample_data_card/src/footer/install_footer.test.tsx diff --git a/packages/home/sample_data_card/src/footer/install_footer.tsx b/src/platform/packages/shared/home/sample_data_card/src/footer/install_footer.tsx similarity index 100% rename from packages/home/sample_data_card/src/footer/install_footer.tsx rename to src/platform/packages/shared/home/sample_data_card/src/footer/install_footer.tsx diff --git a/packages/home/sample_data_card/src/footer/remove_footer.test.tsx b/src/platform/packages/shared/home/sample_data_card/src/footer/remove_footer.test.tsx similarity index 100% rename from packages/home/sample_data_card/src/footer/remove_footer.test.tsx rename to src/platform/packages/shared/home/sample_data_card/src/footer/remove_footer.test.tsx diff --git a/packages/home/sample_data_card/src/footer/remove_footer.tsx b/src/platform/packages/shared/home/sample_data_card/src/footer/remove_footer.tsx similarity index 100% rename from packages/home/sample_data_card/src/footer/remove_footer.tsx rename to src/platform/packages/shared/home/sample_data_card/src/footer/remove_footer.tsx diff --git a/packages/home/sample_data_card/src/footer/view_button.test.tsx b/src/platform/packages/shared/home/sample_data_card/src/footer/view_button.test.tsx similarity index 100% rename from packages/home/sample_data_card/src/footer/view_button.test.tsx rename to src/platform/packages/shared/home/sample_data_card/src/footer/view_button.test.tsx diff --git a/packages/home/sample_data_card/src/footer/view_button.tsx b/src/platform/packages/shared/home/sample_data_card/src/footer/view_button.tsx similarity index 100% rename from packages/home/sample_data_card/src/footer/view_button.tsx rename to src/platform/packages/shared/home/sample_data_card/src/footer/view_button.tsx diff --git a/packages/home/sample_data_card/src/hooks/index.ts b/src/platform/packages/shared/home/sample_data_card/src/hooks/index.ts similarity index 100% rename from packages/home/sample_data_card/src/hooks/index.ts rename to src/platform/packages/shared/home/sample_data_card/src/hooks/index.ts diff --git a/packages/home/sample_data_card/src/hooks/use_install.ts b/src/platform/packages/shared/home/sample_data_card/src/hooks/use_install.ts similarity index 100% rename from packages/home/sample_data_card/src/hooks/use_install.ts rename to src/platform/packages/shared/home/sample_data_card/src/hooks/use_install.ts diff --git a/packages/home/sample_data_card/src/hooks/use_remove.ts b/src/platform/packages/shared/home/sample_data_card/src/hooks/use_remove.ts similarity index 100% rename from packages/home/sample_data_card/src/hooks/use_remove.ts rename to src/platform/packages/shared/home/sample_data_card/src/hooks/use_remove.ts diff --git a/packages/home/sample_data_card/src/mocks/dashboard.png b/src/platform/packages/shared/home/sample_data_card/src/mocks/dashboard.png similarity index 100% rename from packages/home/sample_data_card/src/mocks/dashboard.png rename to src/platform/packages/shared/home/sample_data_card/src/mocks/dashboard.png diff --git a/packages/home/sample_data_card/src/mocks/dashboard_dark.png b/src/platform/packages/shared/home/sample_data_card/src/mocks/dashboard_dark.png similarity index 100% rename from packages/home/sample_data_card/src/mocks/dashboard_dark.png rename to src/platform/packages/shared/home/sample_data_card/src/mocks/dashboard_dark.png diff --git a/packages/home/sample_data_card/src/mocks/icon.svg b/src/platform/packages/shared/home/sample_data_card/src/mocks/icon.svg similarity index 100% rename from packages/home/sample_data_card/src/mocks/icon.svg rename to src/platform/packages/shared/home/sample_data_card/src/mocks/icon.svg diff --git a/packages/home/sample_data_card/src/mocks/index.ts b/src/platform/packages/shared/home/sample_data_card/src/mocks/index.ts similarity index 100% rename from packages/home/sample_data_card/src/mocks/index.ts rename to src/platform/packages/shared/home/sample_data_card/src/mocks/index.ts diff --git a/packages/home/sample_data_card/src/sample_data_card.component.tsx b/src/platform/packages/shared/home/sample_data_card/src/sample_data_card.component.tsx similarity index 100% rename from packages/home/sample_data_card/src/sample_data_card.component.tsx rename to src/platform/packages/shared/home/sample_data_card/src/sample_data_card.component.tsx diff --git a/packages/home/sample_data_card/src/sample_data_card.stories.tsx b/src/platform/packages/shared/home/sample_data_card/src/sample_data_card.stories.tsx similarity index 100% rename from packages/home/sample_data_card/src/sample_data_card.stories.tsx rename to src/platform/packages/shared/home/sample_data_card/src/sample_data_card.stories.tsx diff --git a/packages/home/sample_data_card/src/sample_data_card.test.tsx b/src/platform/packages/shared/home/sample_data_card/src/sample_data_card.test.tsx similarity index 100% rename from packages/home/sample_data_card/src/sample_data_card.test.tsx rename to src/platform/packages/shared/home/sample_data_card/src/sample_data_card.test.tsx diff --git a/packages/home/sample_data_card/src/sample_data_card.tsx b/src/platform/packages/shared/home/sample_data_card/src/sample_data_card.tsx similarity index 100% rename from packages/home/sample_data_card/src/sample_data_card.tsx rename to src/platform/packages/shared/home/sample_data_card/src/sample_data_card.tsx diff --git a/packages/home/sample_data_card/src/services.tsx b/src/platform/packages/shared/home/sample_data_card/src/services.tsx similarity index 100% rename from packages/home/sample_data_card/src/services.tsx rename to src/platform/packages/shared/home/sample_data_card/src/services.tsx diff --git a/packages/home/sample_data_card/tsconfig.json b/src/platform/packages/shared/home/sample_data_card/tsconfig.json similarity index 86% rename from packages/home/sample_data_card/tsconfig.json rename to src/platform/packages/shared/home/sample_data_card/tsconfig.json index 531dd52379f12..6f2e89c5019f9 100644 --- a/packages/home/sample_data_card/tsconfig.json +++ b/src/platform/packages/shared/home/sample_data_card/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.base.json", + "extends": "../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/home/sample_data_tab/README.mdx b/src/platform/packages/shared/home/sample_data_tab/README.mdx similarity index 100% rename from packages/home/sample_data_tab/README.mdx rename to src/platform/packages/shared/home/sample_data_tab/README.mdx diff --git a/packages/home/sample_data_tab/index.ts b/src/platform/packages/shared/home/sample_data_tab/index.ts similarity index 100% rename from packages/home/sample_data_tab/index.ts rename to src/platform/packages/shared/home/sample_data_tab/index.ts diff --git a/src/platform/packages/shared/home/sample_data_tab/jest.config.js b/src/platform/packages/shared/home/sample_data_tab/jest.config.js new file mode 100644 index 0000000000000..1372916903c7e --- /dev/null +++ b/src/platform/packages/shared/home/sample_data_tab/jest.config.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", 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: ['/src/platform/packages/shared/home/sample_data_tab'], +}; diff --git a/packages/home/sample_data_tab/kibana.jsonc b/src/platform/packages/shared/home/sample_data_tab/kibana.jsonc similarity index 100% rename from packages/home/sample_data_tab/kibana.jsonc rename to src/platform/packages/shared/home/sample_data_tab/kibana.jsonc diff --git a/packages/home/sample_data_tab/package.json b/src/platform/packages/shared/home/sample_data_tab/package.json similarity index 100% rename from packages/home/sample_data_tab/package.json rename to src/platform/packages/shared/home/sample_data_tab/package.json diff --git a/packages/home/sample_data_tab/src/assets/welcome_dark.png b/src/platform/packages/shared/home/sample_data_tab/src/assets/welcome_dark.png similarity index 100% rename from packages/home/sample_data_tab/src/assets/welcome_dark.png rename to src/platform/packages/shared/home/sample_data_tab/src/assets/welcome_dark.png diff --git a/packages/home/sample_data_tab/src/assets/welcome_light.png b/src/platform/packages/shared/home/sample_data_tab/src/assets/welcome_light.png similarity index 100% rename from packages/home/sample_data_tab/src/assets/welcome_light.png rename to src/platform/packages/shared/home/sample_data_tab/src/assets/welcome_light.png diff --git a/packages/home/sample_data_tab/src/constants.ts b/src/platform/packages/shared/home/sample_data_tab/src/constants.ts similarity index 100% rename from packages/home/sample_data_tab/src/constants.ts rename to src/platform/packages/shared/home/sample_data_tab/src/constants.ts diff --git a/packages/home/sample_data_tab/src/demo_env_panel.stories.tsx b/src/platform/packages/shared/home/sample_data_tab/src/demo_env_panel.stories.tsx similarity index 100% rename from packages/home/sample_data_tab/src/demo_env_panel.stories.tsx rename to src/platform/packages/shared/home/sample_data_tab/src/demo_env_panel.stories.tsx diff --git a/packages/home/sample_data_tab/src/demo_env_panel.tsx b/src/platform/packages/shared/home/sample_data_tab/src/demo_env_panel.tsx similarity index 100% rename from packages/home/sample_data_tab/src/demo_env_panel.tsx rename to src/platform/packages/shared/home/sample_data_tab/src/demo_env_panel.tsx diff --git a/packages/home/sample_data_tab/src/hooks/index.ts b/src/platform/packages/shared/home/sample_data_tab/src/hooks/index.ts similarity index 100% rename from packages/home/sample_data_tab/src/hooks/index.ts rename to src/platform/packages/shared/home/sample_data_tab/src/hooks/index.ts diff --git a/packages/home/sample_data_tab/src/hooks/use_list.ts b/src/platform/packages/shared/home/sample_data_tab/src/hooks/use_list.ts similarity index 100% rename from packages/home/sample_data_tab/src/hooks/use_list.ts rename to src/platform/packages/shared/home/sample_data_tab/src/hooks/use_list.ts diff --git a/packages/home/sample_data_tab/src/mocks.ts b/src/platform/packages/shared/home/sample_data_tab/src/mocks.ts similarity index 100% rename from packages/home/sample_data_tab/src/mocks.ts rename to src/platform/packages/shared/home/sample_data_tab/src/mocks.ts diff --git a/packages/home/sample_data_tab/src/sample_data_cards.tsx b/src/platform/packages/shared/home/sample_data_tab/src/sample_data_cards.tsx similarity index 100% rename from packages/home/sample_data_tab/src/sample_data_cards.tsx rename to src/platform/packages/shared/home/sample_data_tab/src/sample_data_cards.tsx diff --git a/packages/home/sample_data_tab/src/sample_data_tab.stories.tsx b/src/platform/packages/shared/home/sample_data_tab/src/sample_data_tab.stories.tsx similarity index 100% rename from packages/home/sample_data_tab/src/sample_data_tab.stories.tsx rename to src/platform/packages/shared/home/sample_data_tab/src/sample_data_tab.stories.tsx diff --git a/packages/home/sample_data_tab/src/sample_data_tab.tsx b/src/platform/packages/shared/home/sample_data_tab/src/sample_data_tab.tsx similarity index 100% rename from packages/home/sample_data_tab/src/sample_data_tab.tsx rename to src/platform/packages/shared/home/sample_data_tab/src/sample_data_tab.tsx diff --git a/packages/home/sample_data_tab/src/services.tsx b/src/platform/packages/shared/home/sample_data_tab/src/services.tsx similarity index 100% rename from packages/home/sample_data_tab/src/services.tsx rename to src/platform/packages/shared/home/sample_data_tab/src/services.tsx diff --git a/packages/home/sample_data_tab/tsconfig.json b/src/platform/packages/shared/home/sample_data_tab/tsconfig.json similarity index 87% rename from packages/home/sample_data_tab/tsconfig.json rename to src/platform/packages/shared/home/sample_data_tab/tsconfig.json index 3cdeb5489c22a..2397a4d1e7c9b 100644 --- a/packages/home/sample_data_tab/tsconfig.json +++ b/src/platform/packages/shared/home/sample_data_tab/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.base.json", + "extends": "../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/home/sample_data_types/README.mdx b/src/platform/packages/shared/home/sample_data_types/README.mdx similarity index 100% rename from packages/home/sample_data_types/README.mdx rename to src/platform/packages/shared/home/sample_data_types/README.mdx diff --git a/packages/home/sample_data_types/index.d.ts b/src/platform/packages/shared/home/sample_data_types/index.d.ts similarity index 100% rename from packages/home/sample_data_types/index.d.ts rename to src/platform/packages/shared/home/sample_data_types/index.d.ts diff --git a/packages/kbn-item-buffer/jest.config.js b/src/platform/packages/shared/home/sample_data_types/jest.config.js similarity index 82% rename from packages/kbn-item-buffer/jest.config.js rename to src/platform/packages/shared/home/sample_data_types/jest.config.js index f553426f800bb..5f72cf7a026bc 100644 --- a/packages/kbn-item-buffer/jest.config.js +++ b/src/platform/packages/shared/home/sample_data_types/jest.config.js @@ -9,6 +9,6 @@ module.exports = { preset: '@kbn/test/jest_node', - rootDir: '../..', - roots: ['/packages/kbn-item-buffer'], + rootDir: '../../../../../..', + roots: ['/src/platform/packages/shared/home/sample_data_types'], }; diff --git a/packages/home/sample_data_types/kibana.jsonc b/src/platform/packages/shared/home/sample_data_types/kibana.jsonc similarity index 100% rename from packages/home/sample_data_types/kibana.jsonc rename to src/platform/packages/shared/home/sample_data_types/kibana.jsonc diff --git a/packages/home/sample_data_types/package.json b/src/platform/packages/shared/home/sample_data_types/package.json similarity index 100% rename from packages/home/sample_data_types/package.json rename to src/platform/packages/shared/home/sample_data_types/package.json diff --git a/packages/home/sample_data_types/tsconfig.json b/src/platform/packages/shared/home/sample_data_types/tsconfig.json similarity index 73% rename from packages/home/sample_data_types/tsconfig.json rename to src/platform/packages/shared/home/sample_data_types/tsconfig.json index 493400e55a76f..48a59d313f003 100644 --- a/packages/home/sample_data_types/tsconfig.json +++ b/src/platform/packages/shared/home/sample_data_types/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.base.json", + "extends": "../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [] diff --git a/src/platform/packages/shared/kbn-es-types/index.ts b/src/platform/packages/shared/kbn-es-types/index.ts index d4ba23840e2a6..683fddb541baf 100644 --- a/src/platform/packages/shared/kbn-es-types/index.ts +++ b/src/platform/packages/shared/kbn-es-types/index.ts @@ -13,7 +13,6 @@ export type { SearchHit, ESSearchResponse, ESSearchRequest, - ESSearchRequestWithoutBody, ESSourceOptions, InferSearchResponseOf, AggregationResultOf, diff --git a/src/platform/packages/shared/kbn-es-types/src/index.ts b/src/platform/packages/shared/kbn-es-types/src/index.ts index 77d02320b6f2d..354a26169c328 100644 --- a/src/platform/packages/shared/kbn-es-types/src/index.ts +++ b/src/platform/packages/shared/kbn-es-types/src/index.ts @@ -7,12 +7,10 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import * as estypesWithoutBody from '@elastic/elasticsearch/lib/api/types'; -import type { - Field, - QueryDslFieldAndFormat, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; +// TODO: Remove when all usages have been migrated to non-body +import { SearchRequest as SearchRequestWithBodyKey } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { Field, QueryDslFieldAndFormat } from '@elastic/elasticsearch/lib/api/types'; import { InferSearchResponseOf, AggregateOf as AggregationResultOf, @@ -26,8 +24,8 @@ import { } from './search'; export type ESFilter = estypes.QueryDslQueryContainer; -export type ESSearchRequest = estypes.SearchRequest; -export type ESSearchRequestWithoutBody = estypesWithoutBody.SearchRequest; +// For now, we also accept with body to unblock the migration to without body. +export type ESSearchRequest = estypes.SearchRequest | SearchRequestWithBodyKey; export type AggregationOptionsByType = Required; // Typings for Elasticsearch queries and aggregations. These are intended to be diff --git a/src/platform/packages/shared/kbn-es-types/src/search.ts b/src/platform/packages/shared/kbn-es-types/src/search.ts index 1c9a9e16fd4a7..e02b8a4a5e843 100644 --- a/src/platform/packages/shared/kbn-es-types/src/search.ts +++ b/src/platform/packages/shared/kbn-es-types/src/search.ts @@ -8,8 +8,9 @@ */ import type { ValuesType, UnionToIntersection } from 'utility-types'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import * as estypesWithoutBodyKey from '@elastic/elasticsearch/lib/api/types'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; +// TODO: Remove when all usages have been migrated to non-body +import { SearchRequest as SearchRequestWithBodyKey } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; interface AggregationsAggregationContainer extends Record { aggs?: any; @@ -61,7 +62,7 @@ type ValueTypeOfField = T extends Record type MaybeArray = T | T[]; -type Fields = Required['body']>['fields']; +type Fields = Required['fields']; type DocValueFields = MaybeArray; export type ChangePointType = @@ -635,8 +636,8 @@ type WrapAggregationResponse = keyof UnionToIntersection extends never export type InferSearchResponseOf< TDocument = unknown, TSearchRequest extends - | estypes.SearchRequest - | (estypesWithoutBodyKey.SearchRequest & { body?: never }) = estypes.SearchRequest, + | (estypes.SearchRequest & { body?: never }) // the union is necessary for the check 4 lines below + | SearchRequestWithBodyKey = estypes.SearchRequest, TOptions extends { restTotalHitsAsInt?: boolean } = {} > = Omit, 'aggregations' | 'hits'> & (TSearchRequest['body'] extends TopLevelAggregationRequest @@ -656,7 +657,7 @@ export type InferSearchResponseOf< }; }) & { hits: HitsOf< - TSearchRequest extends estypes.SearchRequest ? TSearchRequest['body'] : TSearchRequest, + TSearchRequest extends SearchRequestWithBodyKey ? TSearchRequest['body'] : TSearchRequest, TDocument >; }; @@ -690,5 +691,5 @@ export interface ESQLSearchParams { locale?: string; include_ccs_metadata?: boolean; dropNullColumns?: boolean; - params?: estypesWithoutBodyKey.ScalarValue[] | Array>; + params?: estypes.ScalarValue[] | Array>; } diff --git a/packages/kbn-guided-onboarding/README.md b/src/platform/packages/shared/kbn-guided-onboarding/README.md similarity index 100% rename from packages/kbn-guided-onboarding/README.md rename to src/platform/packages/shared/kbn-guided-onboarding/README.md diff --git a/packages/kbn-guided-onboarding/classic/index.ts b/src/platform/packages/shared/kbn-guided-onboarding/classic/index.ts similarity index 100% rename from packages/kbn-guided-onboarding/classic/index.ts rename to src/platform/packages/shared/kbn-guided-onboarding/classic/index.ts diff --git a/packages/kbn-guided-onboarding/guide/index.ts b/src/platform/packages/shared/kbn-guided-onboarding/guide/index.ts similarity index 100% rename from packages/kbn-guided-onboarding/guide/index.ts rename to src/platform/packages/shared/kbn-guided-onboarding/guide/index.ts diff --git a/packages/kbn-guided-onboarding/index.ts b/src/platform/packages/shared/kbn-guided-onboarding/index.ts similarity index 100% rename from packages/kbn-guided-onboarding/index.ts rename to src/platform/packages/shared/kbn-guided-onboarding/index.ts diff --git a/packages/deeplinks/shared/jest.config.js b/src/platform/packages/shared/kbn-guided-onboarding/jest.config.js similarity index 83% rename from packages/deeplinks/shared/jest.config.js rename to src/platform/packages/shared/kbn-guided-onboarding/jest.config.js index 5849db1143d72..b1ca25d2a3f74 100644 --- a/packages/deeplinks/shared/jest.config.js +++ b/src/platform/packages/shared/kbn-guided-onboarding/jest.config.js @@ -9,6 +9,6 @@ module.exports = { preset: '@kbn/test', - rootDir: '../../..', - roots: ['/packages/deeplinks/shared'], + rootDir: '../../../../..', + roots: ['/src/platform/packages/shared/kbn-guided-onboarding'], }; diff --git a/packages/kbn-guided-onboarding/kibana.jsonc b/src/platform/packages/shared/kbn-guided-onboarding/kibana.jsonc similarity index 100% rename from packages/kbn-guided-onboarding/kibana.jsonc rename to src/platform/packages/shared/kbn-guided-onboarding/kibana.jsonc diff --git a/packages/kbn-guided-onboarding/package.json b/src/platform/packages/shared/kbn-guided-onboarding/package.json similarity index 100% rename from packages/kbn-guided-onboarding/package.json rename to src/platform/packages/shared/kbn-guided-onboarding/package.json diff --git a/packages/kbn-guided-onboarding/src/common/test_guide_config.ts b/src/platform/packages/shared/kbn-guided-onboarding/src/common/test_guide_config.ts similarity index 100% rename from packages/kbn-guided-onboarding/src/common/test_guide_config.ts rename to src/platform/packages/shared/kbn-guided-onboarding/src/common/test_guide_config.ts diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/classic_version/__snapshots__/guide_cards.test.tsx.snap b/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/__snapshots__/guide_cards.test.tsx.snap similarity index 100% rename from packages/kbn-guided-onboarding/src/components/landing_page/classic_version/__snapshots__/guide_cards.test.tsx.snap rename to src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/__snapshots__/guide_cards.test.tsx.snap diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_card.tsx b/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_card.tsx similarity index 100% rename from packages/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_card.tsx rename to src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_card.tsx diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.constants.tsx b/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.constants.tsx similarity index 100% rename from packages/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.constants.tsx rename to src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.constants.tsx diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.test.tsx b/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.test.tsx similarity index 100% rename from packages/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.test.tsx rename to src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.test.tsx diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.tsx b/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.tsx similarity index 100% rename from packages/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.tsx rename to src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_cards.tsx diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_filters.tsx b/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_filters.tsx similarity index 100% rename from packages/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_filters.tsx rename to src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/classic_version/guide_filters.tsx diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/guide/guide_card.tsx b/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/guide/guide_card.tsx similarity index 100% rename from packages/kbn-guided-onboarding/src/components/landing_page/guide/guide_card.tsx rename to src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/guide/guide_card.tsx diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/guide/guide_cards.constants.tsx b/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/guide/guide_cards.constants.tsx similarity index 100% rename from packages/kbn-guided-onboarding/src/components/landing_page/guide/guide_cards.constants.tsx rename to src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/guide/guide_cards.constants.tsx diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/guide/guide_cards.tsx b/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/guide/guide_cards.tsx similarity index 100% rename from packages/kbn-guided-onboarding/src/components/landing_page/guide/guide_cards.tsx rename to src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/guide/guide_cards.tsx diff --git a/packages/kbn-guided-onboarding/src/components/landing_page/guide/guide_filters.tsx b/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/guide/guide_filters.tsx similarity index 100% rename from packages/kbn-guided-onboarding/src/components/landing_page/guide/guide_filters.tsx rename to src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/guide/guide_filters.tsx diff --git a/packages/kbn-guided-onboarding/src/types.ts b/src/platform/packages/shared/kbn-guided-onboarding/src/types.ts similarity index 100% rename from packages/kbn-guided-onboarding/src/types.ts rename to src/platform/packages/shared/kbn-guided-onboarding/src/types.ts diff --git a/packages/kbn-guided-onboarding/tsconfig.json b/src/platform/packages/shared/kbn-guided-onboarding/tsconfig.json similarity index 87% rename from packages/kbn-guided-onboarding/tsconfig.json rename to src/platform/packages/shared/kbn-guided-onboarding/tsconfig.json index b47b2dad14429..09caf676e195f 100644 --- a/packages/kbn-guided-onboarding/tsconfig.json +++ b/src/platform/packages/shared/kbn-guided-onboarding/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/kbn-management/settings/section_registry/README.mdx b/src/platform/packages/shared/kbn-management/settings/section_registry/README.mdx similarity index 100% rename from packages/kbn-management/settings/section_registry/README.mdx rename to src/platform/packages/shared/kbn-management/settings/section_registry/README.mdx diff --git a/packages/kbn-management/settings/section_registry/index.ts b/src/platform/packages/shared/kbn-management/settings/section_registry/index.ts similarity index 100% rename from packages/kbn-management/settings/section_registry/index.ts rename to src/platform/packages/shared/kbn-management/settings/section_registry/index.ts diff --git a/packages/kbn-management/settings/section_registry/kibana.jsonc b/src/platform/packages/shared/kbn-management/settings/section_registry/kibana.jsonc similarity index 100% rename from packages/kbn-management/settings/section_registry/kibana.jsonc rename to src/platform/packages/shared/kbn-management/settings/section_registry/kibana.jsonc diff --git a/packages/kbn-management/settings/section_registry/package.json b/src/platform/packages/shared/kbn-management/settings/section_registry/package.json similarity index 100% rename from packages/kbn-management/settings/section_registry/package.json rename to src/platform/packages/shared/kbn-management/settings/section_registry/package.json diff --git a/packages/kbn-management/settings/section_registry/section_registry.test.tsx b/src/platform/packages/shared/kbn-management/settings/section_registry/section_registry.test.tsx similarity index 100% rename from packages/kbn-management/settings/section_registry/section_registry.test.tsx rename to src/platform/packages/shared/kbn-management/settings/section_registry/section_registry.test.tsx diff --git a/packages/kbn-management/settings/section_registry/section_registry.ts b/src/platform/packages/shared/kbn-management/settings/section_registry/section_registry.ts similarity index 100% rename from packages/kbn-management/settings/section_registry/section_registry.ts rename to src/platform/packages/shared/kbn-management/settings/section_registry/section_registry.ts diff --git a/packages/kbn-management/settings/section_registry/tsconfig.json b/src/platform/packages/shared/kbn-management/settings/section_registry/tsconfig.json similarity index 84% rename from packages/kbn-management/settings/section_registry/tsconfig.json rename to src/platform/packages/shared/kbn-management/settings/section_registry/tsconfig.json index 2cf1893be5d55..a33d8c8631b73 100644 --- a/packages/kbn-management/settings/section_registry/tsconfig.json +++ b/src/platform/packages/shared/kbn-management/settings/section_registry/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/kbn-management/settings/setting_ids/README.mdx b/src/platform/packages/shared/kbn-management/settings/setting_ids/README.mdx similarity index 100% rename from packages/kbn-management/settings/setting_ids/README.mdx rename to src/platform/packages/shared/kbn-management/settings/setting_ids/README.mdx diff --git a/packages/kbn-management/settings/setting_ids/index.ts b/src/platform/packages/shared/kbn-management/settings/setting_ids/index.ts similarity index 100% rename from packages/kbn-management/settings/setting_ids/index.ts rename to src/platform/packages/shared/kbn-management/settings/setting_ids/index.ts diff --git a/packages/kbn-management/settings/setting_ids/kibana.jsonc b/src/platform/packages/shared/kbn-management/settings/setting_ids/kibana.jsonc similarity index 100% rename from packages/kbn-management/settings/setting_ids/kibana.jsonc rename to src/platform/packages/shared/kbn-management/settings/setting_ids/kibana.jsonc diff --git a/packages/kbn-management/settings/setting_ids/package.json b/src/platform/packages/shared/kbn-management/settings/setting_ids/package.json similarity index 100% rename from packages/kbn-management/settings/setting_ids/package.json rename to src/platform/packages/shared/kbn-management/settings/setting_ids/package.json diff --git a/packages/kbn-management/settings/setting_ids/tsconfig.json b/src/platform/packages/shared/kbn-management/settings/setting_ids/tsconfig.json similarity index 79% rename from packages/kbn-management/settings/setting_ids/tsconfig.json rename to src/platform/packages/shared/kbn-management/settings/setting_ids/tsconfig.json index 53e5c76cbab87..8636a00aae12f 100644 --- a/packages/kbn-management/settings/setting_ids/tsconfig.json +++ b/src/platform/packages/shared/kbn-management/settings/setting_ids/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/src/platform/packages/shared/kbn-object-utils/README.md b/src/platform/packages/shared/kbn-object-utils/README.md new file mode 100644 index 0000000000000..c3a94576d727f --- /dev/null +++ b/src/platform/packages/shared/kbn-object-utils/README.md @@ -0,0 +1,76 @@ +# @kbn/object-utils + +Utilities for objects manipulation and parsing. + +## Utilities + +### calculateObjectDiff + +This utils compares two JSON objects and calculates the added and removed properties, including nested properties. + +```ts +const oldObject = { + alpha: 1, + beta: { + gamma: 2, + delta: { + sigma: 7, + }, + }, +}; + +const newObject = { + alpha: 1, + beta: { + gamma: 2, + eta: 4, + }, +}; + +const diff = calculateObjectDiff(oldObject, newObject); + +/* +Result: +{ + added: { + beta: { + eta: 4, + }, + }, + removed: { + beta: { + delta: { + sigma: 7, + }, + }, + }, +} +*/ +``` + +### flattenObject + +This utils returns a flattened version of the input object also accounting for nested properties. + +```ts +const flattened = flattenObject({ + alpha: { + gamma: { + sigma: 1, + }, + delta: { + sigma: 2, + }, + }, + beta: 3, +}); + +/* +Result: +{ + 'alpha.gamma.sigma': 1, + 'alpha.delta.sigma': 2, + beta: 3, +} +*/ +``` diff --git a/packages/react/kibana_mount/jest.config.js b/src/platform/packages/shared/kbn-object-utils/index.ts similarity index 79% rename from packages/react/kibana_mount/jest.config.js rename to src/platform/packages/shared/kbn-object-utils/index.ts index bb607856d9376..f5051ab8b042c 100644 --- a/packages/react/kibana_mount/jest.config.js +++ b/src/platform/packages/shared/kbn-object-utils/index.ts @@ -7,8 +7,5 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -module.exports = { - preset: '@kbn/test', - rootDir: '../../..', - roots: ['/packages/react/kibana_mount'], -}; +export * from './src/calculate_object_diff'; +export * from './src/flatten_object'; diff --git a/packages/core/chrome/core-chrome-browser/jest.config.js b/src/platform/packages/shared/kbn-object-utils/jest.config.js similarity index 83% rename from packages/core/chrome/core-chrome-browser/jest.config.js rename to src/platform/packages/shared/kbn-object-utils/jest.config.js index c8f9d2b1fbcaf..cd6727b073b79 100644 --- a/packages/core/chrome/core-chrome-browser/jest.config.js +++ b/src/platform/packages/shared/kbn-object-utils/jest.config.js @@ -9,6 +9,6 @@ module.exports = { preset: '@kbn/test', - rootDir: '../../../..', - roots: ['/packages/core/chrome/core-chrome-browser'], + rootDir: '../../../../..', + roots: ['/src/platform/packages/shared/kbn-object-utils'], }; diff --git a/src/platform/packages/shared/kbn-object-utils/kibana.jsonc b/src/platform/packages/shared/kbn-object-utils/kibana.jsonc new file mode 100644 index 0000000000000..ce6365156b592 --- /dev/null +++ b/src/platform/packages/shared/kbn-object-utils/kibana.jsonc @@ -0,0 +1,10 @@ +{ + "type": "shared-common", + "id": "@kbn/object-utils", + "owner": [ + "@elastic/kibana-core" + ], + "group": "platform", + "visibility": "shared", + "devOnly": false +} \ No newline at end of file diff --git a/src/platform/packages/shared/kbn-object-utils/package.json b/src/platform/packages/shared/kbn-object-utils/package.json new file mode 100644 index 0000000000000..86111f76bb09d --- /dev/null +++ b/src/platform/packages/shared/kbn-object-utils/package.json @@ -0,0 +1,8 @@ +{ + "description": "Object utils for Kibana", + "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0", + "name": "@kbn/object-utils", + "private": true, + "version": "1.0.0", + "sideEffects": false +} \ No newline at end of file diff --git a/src/platform/packages/shared/kbn-object-utils/src/calculate_object_diff.test.ts b/src/platform/packages/shared/kbn-object-utils/src/calculate_object_diff.test.ts new file mode 100644 index 0000000000000..340be7783aef3 --- /dev/null +++ b/src/platform/packages/shared/kbn-object-utils/src/calculate_object_diff.test.ts @@ -0,0 +1,34 @@ +/* + * 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 { calculateObjectDiff } from './calculate_object_diff'; + +describe('calculateObjectDiff', () => { + it('should return the added and removed parts between 2 objects', () => { + const { added, removed } = calculateObjectDiff({ alpha: 1, beta: 2 }, { alpha: 1, gamma: 3 }); + expect(added).toEqual({ gamma: 3 }); + expect(removed).toEqual({ beta: 2 }); + }); + + it('should work on nested objects', () => { + const { added, removed } = calculateObjectDiff( + { alpha: 1, beta: { gamma: 2, delta: { sigma: 7 } } }, + { alpha: 1, beta: { gamma: 2, eta: 4 } } + ); + + expect(added).toEqual({ beta: { eta: 4 } }); + expect(removed).toEqual({ beta: { delta: { sigma: 7 } } }); + }); + + it('should return empty added/removed when the objects are the same', () => { + const { added, removed } = calculateObjectDiff({ alpha: 1, beta: 2 }, { alpha: 1, beta: 2 }); + expect(added).toEqual({}); + expect(removed).toEqual({}); + }); +}); diff --git a/src/platform/packages/shared/kbn-object-utils/src/calculate_object_diff.ts b/src/platform/packages/shared/kbn-object-utils/src/calculate_object_diff.ts new file mode 100644 index 0000000000000..33fe441de5ac6 --- /dev/null +++ b/src/platform/packages/shared/kbn-object-utils/src/calculate_object_diff.ts @@ -0,0 +1,75 @@ +/* + * 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 { isEmpty, isPlainObject } from 'lodash'; + +interface Obj { + [key: PropertyKey]: Obj | unknown; +} + +type DeepPartial = { + [Prop in keyof TInputObj]?: TInputObj[Prop] extends Obj + ? DeepPartial + : TInputObj[Prop]; +}; + +interface ObjectDiffResult { + added: DeepPartial; + removed: DeepPartial; +} + +/** + * Compares two JSON objects and calculates the added and removed properties, including nested properties. + * @param oldObj - The base object. + * @param newObj - The comparison object. + * @returns An object containing added and removed properties. + */ +export function calculateObjectDiff( + oldObj: TBase, + newObj?: TCompare +): ObjectDiffResult { + const added: DeepPartial = {}; + const removed: DeepPartial = {}; + + if (!newObj) return { added, removed }; + + function diffRecursive( + base: Obj, + compare: Obj, + addedMap: DeepPartial, + removedMap: DeepPartial + ): void { + for (const key in compare) { + if (!(key in base)) { + addedMap[key] = compare[key]; + } else if (isPlainObject(base[key]) && isPlainObject(compare[key])) { + addedMap[key] = {}; + removedMap[key] = {}; + diffRecursive( + base[key] as Obj, + compare[key] as Obj, + addedMap[key] as Obj, + removedMap[key] as Obj + ); + if (isEmpty(addedMap[key])) delete addedMap[key]; + if (isEmpty(removedMap[key])) delete removedMap[key]; + } + } + + for (const key in base) { + if (!(key in compare)) { + removedMap[key] = base[key]; + } + } + } + + diffRecursive(oldObj, newObj, added, removed); + + return { added, removed }; +} diff --git a/src/platform/packages/shared/kbn-object-utils/src/flatten_object.test.ts b/src/platform/packages/shared/kbn-object-utils/src/flatten_object.test.ts new file mode 100644 index 0000000000000..80bb6b4503020 --- /dev/null +++ b/src/platform/packages/shared/kbn-object-utils/src/flatten_object.test.ts @@ -0,0 +1,32 @@ +/* + * 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 { flattenObject } from './flatten_object'; + +describe('flattenObject', () => { + it('should flat gamma object properties', () => { + const flattened = flattenObject({ + alpha: { + gamma: { + sigma: 1, + }, + delta: { + sigma: 2, + }, + }, + beta: 3, + }); + + expect(flattened).toEqual({ + 'alpha.gamma.sigma': 1, + 'alpha.delta.sigma': 2, + beta: 3, + }); + }); +}); diff --git a/src/platform/packages/shared/kbn-object-utils/src/flatten_object.ts b/src/platform/packages/shared/kbn-object-utils/src/flatten_object.ts new file mode 100644 index 0000000000000..0690012ca2640 --- /dev/null +++ b/src/platform/packages/shared/kbn-object-utils/src/flatten_object.ts @@ -0,0 +1,33 @@ +/* + * 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 { isPlainObject } from 'lodash'; + +/** + * Returns a flattened version of the input object also accounting for nested properties. + * @param obj - The input object. + * @param parentKey - The initial key used for recursive flattening. + * @returns An object containing all the flattened properties. + */ +export function flattenObject(obj: Record, parentKey: string = '') { + const result: Record = {}; + + for (const key in obj) { + if (Object.hasOwn(obj, key)) { + const value = obj[key]; + const newKey = parentKey ? `${parentKey}.${key}` : key; + if (isPlainObject(value)) { + Object.assign(result, flattenObject(value as Record, newKey)); + } else { + result[newKey] = value; + } + } + } + return result; +} diff --git a/src/platform/packages/shared/kbn-object-utils/tsconfig.json b/src/platform/packages/shared/kbn-object-utils/tsconfig.json new file mode 100644 index 0000000000000..2e04c4a6f5733 --- /dev/null +++ b/src/platform/packages/shared/kbn-object-utils/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "outDir": "target/types", + "types": ["jest", "node"] + }, + "exclude": ["target/**/*"], + "extends": "../../../../../tsconfig.base.json", + "include": ["**/*.ts"], + "kbn_references": [] +} diff --git a/src/platform/packages/shared/kbn-search-connectors/types/native_connectors.ts b/src/platform/packages/shared/kbn-search-connectors/types/native_connectors.ts index 96af7ea581e6c..ba8aff69693d8 100644 --- a/src/platform/packages/shared/kbn-search-connectors/types/native_connectors.ts +++ b/src/platform/packages/shared/kbn-search-connectors/types/native_connectors.ts @@ -4242,6 +4242,45 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record { "data-test-subj": "unifiedDataTableCompareDocuments", "gridStyle": Object { "border": "horizontal", - "cellPadding": "s", + "cellPadding": "l", "fontSize": "s", "header": "underline", "rowHover": "highlight", diff --git a/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/compare_documents.tsx b/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/compare_documents.tsx index fc79c0efadf91..3e29e3903e717 100644 --- a/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/compare_documents.tsx +++ b/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/compare_documents.tsx @@ -56,7 +56,11 @@ export interface CompareDocumentsProps { const COMPARISON_ROW_HEIGHT: EuiDataGridRowHeightsOptions = { defaultHeight: 'auto' }; const COMPARISON_IN_MEMORY: EuiDataGridInMemory = { level: 'sorting' }; -const COMPARISON_GRID_STYLE: EuiDataGridStyle = { ...DATA_GRID_STYLE_DEFAULT, stripes: undefined }; +const COMPARISON_GRID_STYLE: EuiDataGridStyle = { + ...DATA_GRID_STYLE_DEFAULT, + cellPadding: 'l', + stripes: undefined, +}; const getStorageKey = (consumer: string, key: string) => `${consumer}:dataGridComparison${key}`; diff --git a/packages/react/kibana_context/common/BUILD.bazel b/src/platform/packages/shared/react/kibana_context/common/BUILD.bazel similarity index 100% rename from packages/react/kibana_context/common/BUILD.bazel rename to src/platform/packages/shared/react/kibana_context/common/BUILD.bazel diff --git a/packages/react/kibana_context/common/README.mdx b/src/platform/packages/shared/react/kibana_context/common/README.mdx similarity index 100% rename from packages/react/kibana_context/common/README.mdx rename to src/platform/packages/shared/react/kibana_context/common/README.mdx diff --git a/packages/react/kibana_context/common/color_mode.test.ts b/src/platform/packages/shared/react/kibana_context/common/color_mode.test.ts similarity index 100% rename from packages/react/kibana_context/common/color_mode.test.ts rename to src/platform/packages/shared/react/kibana_context/common/color_mode.test.ts diff --git a/packages/react/kibana_context/common/color_mode.ts b/src/platform/packages/shared/react/kibana_context/common/color_mode.ts similarity index 100% rename from packages/react/kibana_context/common/color_mode.ts rename to src/platform/packages/shared/react/kibana_context/common/color_mode.ts diff --git a/packages/react/kibana_context/common/index.ts b/src/platform/packages/shared/react/kibana_context/common/index.ts similarity index 100% rename from packages/react/kibana_context/common/index.ts rename to src/platform/packages/shared/react/kibana_context/common/index.ts diff --git a/packages/kbn-saved-objects-settings/jest.config.js b/src/platform/packages/shared/react/kibana_context/common/jest.config.js similarity index 81% rename from packages/kbn-saved-objects-settings/jest.config.js rename to src/platform/packages/shared/react/kibana_context/common/jest.config.js index c2d39b4e3cdbd..8954155118131 100644 --- a/packages/kbn-saved-objects-settings/jest.config.js +++ b/src/platform/packages/shared/react/kibana_context/common/jest.config.js @@ -9,6 +9,6 @@ module.exports = { preset: '@kbn/test/jest_node', - rootDir: '../..', - roots: ['/packages/kbn-saved-objects-settings'], + rootDir: '../../../../../../..', + roots: ['/src/platform/packages/shared/react/kibana_context/common'], }; diff --git a/packages/react/kibana_context/common/kibana.jsonc b/src/platform/packages/shared/react/kibana_context/common/kibana.jsonc similarity index 100% rename from packages/react/kibana_context/common/kibana.jsonc rename to src/platform/packages/shared/react/kibana_context/common/kibana.jsonc diff --git a/packages/react/kibana_context/common/package.json b/src/platform/packages/shared/react/kibana_context/common/package.json similarity index 100% rename from packages/react/kibana_context/common/package.json rename to src/platform/packages/shared/react/kibana_context/common/package.json diff --git a/packages/react/kibana_context/common/theme.ts b/src/platform/packages/shared/react/kibana_context/common/theme.ts similarity index 100% rename from packages/react/kibana_context/common/theme.ts rename to src/platform/packages/shared/react/kibana_context/common/theme.ts diff --git a/packages/react/kibana_context/common/tsconfig.json b/src/platform/packages/shared/react/kibana_context/common/tsconfig.json similarity index 78% rename from packages/react/kibana_context/common/tsconfig.json rename to src/platform/packages/shared/react/kibana_context/common/tsconfig.json index 994137ade7df2..2d893153b8fdd 100644 --- a/packages/react/kibana_context/common/tsconfig.json +++ b/src/platform/packages/shared/react/kibana_context/common/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/react/kibana_context/common/types.ts b/src/platform/packages/shared/react/kibana_context/common/types.ts similarity index 100% rename from packages/react/kibana_context/common/types.ts rename to src/platform/packages/shared/react/kibana_context/common/types.ts diff --git a/packages/react/kibana_context/render/BUILD.bazel b/src/platform/packages/shared/react/kibana_context/render/BUILD.bazel similarity index 83% rename from packages/react/kibana_context/render/BUILD.bazel rename to src/platform/packages/shared/react/kibana_context/render/BUILD.bazel index f1e3f4894d144..f4c0c575e27d8 100644 --- a/packages/react/kibana_context/render/BUILD.bazel +++ b/src/platform/packages/shared/react/kibana_context/render/BUILD.bazel @@ -23,8 +23,8 @@ SRCS = glob( DEPS = [ "@npm//react", - "//packages/react/kibana_context/common", - "//packages/react/kibana_context/root", + "//src/platform/packages/shared/react/kibana_context/common", + "//src/platform/packages/shared/react/kibana_context/root", ] js_library( diff --git a/packages/react/kibana_context/render/README.mdx b/src/platform/packages/shared/react/kibana_context/render/README.mdx similarity index 100% rename from packages/react/kibana_context/render/README.mdx rename to src/platform/packages/shared/react/kibana_context/render/README.mdx diff --git a/packages/react/kibana_context/render/index.ts b/src/platform/packages/shared/react/kibana_context/render/index.ts similarity index 100% rename from packages/react/kibana_context/render/index.ts rename to src/platform/packages/shared/react/kibana_context/render/index.ts diff --git a/src/platform/packages/shared/react/kibana_context/render/jest.config.js b/src/platform/packages/shared/react/kibana_context/render/jest.config.js new file mode 100644 index 0000000000000..161ae1d54dda7 --- /dev/null +++ b/src/platform/packages/shared/react/kibana_context/render/jest.config.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", 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: ['/src/platform/packages/shared/react/kibana_context/render'], +}; diff --git a/packages/react/kibana_context/render/kibana.jsonc b/src/platform/packages/shared/react/kibana_context/render/kibana.jsonc similarity index 100% rename from packages/react/kibana_context/render/kibana.jsonc rename to src/platform/packages/shared/react/kibana_context/render/kibana.jsonc diff --git a/packages/react/kibana_context/render/package.json b/src/platform/packages/shared/react/kibana_context/render/package.json similarity index 100% rename from packages/react/kibana_context/render/package.json rename to src/platform/packages/shared/react/kibana_context/render/package.json diff --git a/packages/react/kibana_context/render/render_provider.tsx b/src/platform/packages/shared/react/kibana_context/render/render_provider.tsx similarity index 100% rename from packages/react/kibana_context/render/render_provider.tsx rename to src/platform/packages/shared/react/kibana_context/render/render_provider.tsx diff --git a/packages/react/kibana_context/render/tsconfig.json b/src/platform/packages/shared/react/kibana_context/render/tsconfig.json similarity index 84% rename from packages/react/kibana_context/render/tsconfig.json rename to src/platform/packages/shared/react/kibana_context/render/tsconfig.json index 479f1a0ea50b1..65684da360349 100644 --- a/packages/react/kibana_context/render/tsconfig.json +++ b/src/platform/packages/shared/react/kibana_context/render/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/react/kibana_context/root/BUILD.bazel b/src/platform/packages/shared/react/kibana_context/root/BUILD.bazel similarity index 100% rename from packages/react/kibana_context/root/BUILD.bazel rename to src/platform/packages/shared/react/kibana_context/root/BUILD.bazel diff --git a/packages/react/kibana_context/root/README.mdx b/src/platform/packages/shared/react/kibana_context/root/README.mdx similarity index 100% rename from packages/react/kibana_context/root/README.mdx rename to src/platform/packages/shared/react/kibana_context/root/README.mdx diff --git a/packages/react/kibana_context/root/eui_provider.test.tsx b/src/platform/packages/shared/react/kibana_context/root/eui_provider.test.tsx similarity index 100% rename from packages/react/kibana_context/root/eui_provider.test.tsx rename to src/platform/packages/shared/react/kibana_context/root/eui_provider.test.tsx diff --git a/packages/react/kibana_context/root/eui_provider.tsx b/src/platform/packages/shared/react/kibana_context/root/eui_provider.tsx similarity index 100% rename from packages/react/kibana_context/root/eui_provider.tsx rename to src/platform/packages/shared/react/kibana_context/root/eui_provider.tsx diff --git a/packages/react/kibana_context/root/index.ts b/src/platform/packages/shared/react/kibana_context/root/index.ts similarity index 100% rename from packages/react/kibana_context/root/index.ts rename to src/platform/packages/shared/react/kibana_context/root/index.ts diff --git a/src/platform/packages/shared/react/kibana_context/root/jest.config.js b/src/platform/packages/shared/react/kibana_context/root/jest.config.js new file mode 100644 index 0000000000000..519dad66314cb --- /dev/null +++ b/src/platform/packages/shared/react/kibana_context/root/jest.config.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", 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: ['/src/platform/packages/shared/react/kibana_context/root'], +}; diff --git a/packages/react/kibana_context/root/kibana.jsonc b/src/platform/packages/shared/react/kibana_context/root/kibana.jsonc similarity index 84% rename from packages/react/kibana_context/root/kibana.jsonc rename to src/platform/packages/shared/react/kibana_context/root/kibana.jsonc index 1dc0779f86f0d..0df961f8135a4 100644 --- a/packages/react/kibana_context/root/kibana.jsonc +++ b/src/platform/packages/shared/react/kibana_context/root/kibana.jsonc @@ -5,5 +5,5 @@ "@elastic/appex-sharedux" ], "group": "platform", - "visibility": "private" -} \ No newline at end of file + "visibility": "shared" +} diff --git a/packages/react/kibana_context/root/package.json b/src/platform/packages/shared/react/kibana_context/root/package.json similarity index 100% rename from packages/react/kibana_context/root/package.json rename to src/platform/packages/shared/react/kibana_context/root/package.json diff --git a/packages/react/kibana_context/root/root_provider.test.tsx b/src/platform/packages/shared/react/kibana_context/root/root_provider.test.tsx similarity index 100% rename from packages/react/kibana_context/root/root_provider.test.tsx rename to src/platform/packages/shared/react/kibana_context/root/root_provider.test.tsx diff --git a/packages/react/kibana_context/root/root_provider.tsx b/src/platform/packages/shared/react/kibana_context/root/root_provider.tsx similarity index 100% rename from packages/react/kibana_context/root/root_provider.tsx rename to src/platform/packages/shared/react/kibana_context/root/root_provider.tsx diff --git a/packages/react/kibana_context/root/tsconfig.json b/src/platform/packages/shared/react/kibana_context/root/tsconfig.json similarity index 91% rename from packages/react/kibana_context/root/tsconfig.json rename to src/platform/packages/shared/react/kibana_context/root/tsconfig.json index 8035f8379e390..b934a5be91352 100644 --- a/packages/react/kibana_context/root/tsconfig.json +++ b/src/platform/packages/shared/react/kibana_context/root/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/react/kibana_context/styled/README.mdx b/src/platform/packages/shared/react/kibana_context/styled/README.mdx similarity index 100% rename from packages/react/kibana_context/styled/README.mdx rename to src/platform/packages/shared/react/kibana_context/styled/README.mdx diff --git a/packages/react/kibana_context/styled/index.ts b/src/platform/packages/shared/react/kibana_context/styled/index.ts similarity index 100% rename from packages/react/kibana_context/styled/index.ts rename to src/platform/packages/shared/react/kibana_context/styled/index.ts diff --git a/src/platform/packages/shared/react/kibana_context/styled/jest.config.js b/src/platform/packages/shared/react/kibana_context/styled/jest.config.js new file mode 100644 index 0000000000000..4939ca31ed107 --- /dev/null +++ b/src/platform/packages/shared/react/kibana_context/styled/jest.config.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", 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: ['/src/platform/packages/shared/react/kibana_context/styled'], +}; diff --git a/packages/react/kibana_context/styled/kibana.jsonc b/src/platform/packages/shared/react/kibana_context/styled/kibana.jsonc similarity index 100% rename from packages/react/kibana_context/styled/kibana.jsonc rename to src/platform/packages/shared/react/kibana_context/styled/kibana.jsonc diff --git a/packages/react/kibana_context/styled/package.json b/src/platform/packages/shared/react/kibana_context/styled/package.json similarity index 100% rename from packages/react/kibana_context/styled/package.json rename to src/platform/packages/shared/react/kibana_context/styled/package.json diff --git a/packages/react/kibana_context/styled/styled_provider.tsx b/src/platform/packages/shared/react/kibana_context/styled/styled_provider.tsx similarity index 100% rename from packages/react/kibana_context/styled/styled_provider.tsx rename to src/platform/packages/shared/react/kibana_context/styled/styled_provider.tsx diff --git a/packages/react/kibana_context/styled/tsconfig.json b/src/platform/packages/shared/react/kibana_context/styled/tsconfig.json similarity index 82% rename from packages/react/kibana_context/styled/tsconfig.json rename to src/platform/packages/shared/react/kibana_context/styled/tsconfig.json index fa8b369cdf3cb..6f3c23804f09d 100644 --- a/packages/react/kibana_context/styled/tsconfig.json +++ b/src/platform/packages/shared/react/kibana_context/styled/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/react/kibana_context/theme/BUILD.bazel b/src/platform/packages/shared/react/kibana_context/theme/BUILD.bazel similarity index 84% rename from packages/react/kibana_context/theme/BUILD.bazel rename to src/platform/packages/shared/react/kibana_context/theme/BUILD.bazel index 504477ad7a0ed..34d7dcc924f32 100644 --- a/packages/react/kibana_context/theme/BUILD.bazel +++ b/src/platform/packages/shared/react/kibana_context/theme/BUILD.bazel @@ -25,8 +25,8 @@ BUNDLER_DEPS = [ "@npm//react", "@npm//tslib", "@npm//react-use", - "//packages/react/kibana_context/common", - "//packages/react/kibana_context/root", + "//src/platform/packages/shared/react/kibana_context/common", + "//src/platform/packages/shared/react/kibana_context/root", ] js_library( diff --git a/packages/react/kibana_context/theme/README.mdx b/src/platform/packages/shared/react/kibana_context/theme/README.mdx similarity index 100% rename from packages/react/kibana_context/theme/README.mdx rename to src/platform/packages/shared/react/kibana_context/theme/README.mdx diff --git a/packages/react/kibana_context/theme/index.ts b/src/platform/packages/shared/react/kibana_context/theme/index.ts similarity index 100% rename from packages/react/kibana_context/theme/index.ts rename to src/platform/packages/shared/react/kibana_context/theme/index.ts diff --git a/src/platform/packages/shared/react/kibana_context/theme/jest.config.js b/src/platform/packages/shared/react/kibana_context/theme/jest.config.js new file mode 100644 index 0000000000000..1963334905278 --- /dev/null +++ b/src/platform/packages/shared/react/kibana_context/theme/jest.config.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", 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: ['/src/platform/packages/shared/react/kibana_context/theme'], +}; diff --git a/packages/react/kibana_context/theme/kibana.jsonc b/src/platform/packages/shared/react/kibana_context/theme/kibana.jsonc similarity index 100% rename from packages/react/kibana_context/theme/kibana.jsonc rename to src/platform/packages/shared/react/kibana_context/theme/kibana.jsonc diff --git a/packages/react/kibana_context/theme/package.json b/src/platform/packages/shared/react/kibana_context/theme/package.json similarity index 100% rename from packages/react/kibana_context/theme/package.json rename to src/platform/packages/shared/react/kibana_context/theme/package.json diff --git a/packages/react/kibana_context/theme/theme_provider.test.tsx b/src/platform/packages/shared/react/kibana_context/theme/theme_provider.test.tsx similarity index 100% rename from packages/react/kibana_context/theme/theme_provider.test.tsx rename to src/platform/packages/shared/react/kibana_context/theme/theme_provider.test.tsx diff --git a/packages/react/kibana_context/theme/theme_provider.tsx b/src/platform/packages/shared/react/kibana_context/theme/theme_provider.tsx similarity index 100% rename from packages/react/kibana_context/theme/theme_provider.tsx rename to src/platform/packages/shared/react/kibana_context/theme/theme_provider.tsx diff --git a/packages/react/kibana_context/theme/tsconfig.json b/src/platform/packages/shared/react/kibana_context/theme/tsconfig.json similarity index 88% rename from packages/react/kibana_context/theme/tsconfig.json rename to src/platform/packages/shared/react/kibana_context/theme/tsconfig.json index cfc672666e4c0..720e386873d7b 100644 --- a/packages/react/kibana_context/theme/tsconfig.json +++ b/src/platform/packages/shared/react/kibana_context/theme/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/react/kibana_context/theme/with_theme.tsx b/src/platform/packages/shared/react/kibana_context/theme/with_theme.tsx similarity index 100% rename from packages/react/kibana_context/theme/with_theme.tsx rename to src/platform/packages/shared/react/kibana_context/theme/with_theme.tsx diff --git a/packages/react/kibana_mount/README.md b/src/platform/packages/shared/react/kibana_mount/README.md similarity index 100% rename from packages/react/kibana_mount/README.md rename to src/platform/packages/shared/react/kibana_mount/README.md diff --git a/packages/react/kibana_mount/index.ts b/src/platform/packages/shared/react/kibana_mount/index.ts similarity index 100% rename from packages/react/kibana_mount/index.ts rename to src/platform/packages/shared/react/kibana_mount/index.ts diff --git a/packages/home/sample_data_tab/jest.config.js b/src/platform/packages/shared/react/kibana_mount/jest.config.js similarity index 83% rename from packages/home/sample_data_tab/jest.config.js rename to src/platform/packages/shared/react/kibana_mount/jest.config.js index 1d081809f82b7..c855005ddf41e 100644 --- a/packages/home/sample_data_tab/jest.config.js +++ b/src/platform/packages/shared/react/kibana_mount/jest.config.js @@ -9,6 +9,6 @@ module.exports = { preset: '@kbn/test', - rootDir: '../../..', - roots: ['/packages/home/sample_data_tab'], + rootDir: '../../../../../..', + roots: ['/src/platform/packages/shared/react/kibana_mount'], }; diff --git a/packages/react/kibana_mount/kibana.jsonc b/src/platform/packages/shared/react/kibana_mount/kibana.jsonc similarity index 100% rename from packages/react/kibana_mount/kibana.jsonc rename to src/platform/packages/shared/react/kibana_mount/kibana.jsonc diff --git a/packages/react/kibana_mount/mount_point_portal.test.tsx b/src/platform/packages/shared/react/kibana_mount/mount_point_portal.test.tsx similarity index 100% rename from packages/react/kibana_mount/mount_point_portal.test.tsx rename to src/platform/packages/shared/react/kibana_mount/mount_point_portal.test.tsx diff --git a/packages/react/kibana_mount/mount_point_portal.tsx b/src/platform/packages/shared/react/kibana_mount/mount_point_portal.tsx similarity index 100% rename from packages/react/kibana_mount/mount_point_portal.tsx rename to src/platform/packages/shared/react/kibana_mount/mount_point_portal.tsx diff --git a/packages/react/kibana_mount/package.json b/src/platform/packages/shared/react/kibana_mount/package.json similarity index 100% rename from packages/react/kibana_mount/package.json rename to src/platform/packages/shared/react/kibana_mount/package.json diff --git a/packages/react/kibana_mount/test_helpers/react_mount_serializer.ts b/src/platform/packages/shared/react/kibana_mount/test_helpers/react_mount_serializer.ts similarity index 100% rename from packages/react/kibana_mount/test_helpers/react_mount_serializer.ts rename to src/platform/packages/shared/react/kibana_mount/test_helpers/react_mount_serializer.ts diff --git a/packages/react/kibana_mount/to_mount_point.test.tsx b/src/platform/packages/shared/react/kibana_mount/to_mount_point.test.tsx similarity index 100% rename from packages/react/kibana_mount/to_mount_point.test.tsx rename to src/platform/packages/shared/react/kibana_mount/to_mount_point.test.tsx diff --git a/packages/react/kibana_mount/to_mount_point.tsx b/src/platform/packages/shared/react/kibana_mount/to_mount_point.tsx similarity index 100% rename from packages/react/kibana_mount/to_mount_point.tsx rename to src/platform/packages/shared/react/kibana_mount/to_mount_point.tsx diff --git a/packages/react/kibana_mount/tsconfig.json b/src/platform/packages/shared/react/kibana_mount/tsconfig.json similarity index 90% rename from packages/react/kibana_mount/tsconfig.json rename to src/platform/packages/shared/react/kibana_mount/tsconfig.json index 15dc55d36b052..6f882c96aa274 100644 --- a/packages/react/kibana_mount/tsconfig.json +++ b/src/platform/packages/shared/react/kibana_mount/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.base.json", + "extends": "../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/packages/react/kibana_mount/utils.ts b/src/platform/packages/shared/react/kibana_mount/utils.ts similarity index 100% rename from packages/react/kibana_mount/utils.ts rename to src/platform/packages/shared/react/kibana_mount/utils.ts diff --git a/packages/serverless/settings/observability_project/README.mdx b/src/platform/packages/shared/serverless/settings/observability_project/README.mdx similarity index 100% rename from packages/serverless/settings/observability_project/README.mdx rename to src/platform/packages/shared/serverless/settings/observability_project/README.mdx diff --git a/packages/serverless/settings/observability_project/index.ts b/src/platform/packages/shared/serverless/settings/observability_project/index.ts similarity index 100% rename from packages/serverless/settings/observability_project/index.ts rename to src/platform/packages/shared/serverless/settings/observability_project/index.ts diff --git a/packages/serverless/settings/observability_project/kibana.jsonc b/src/platform/packages/shared/serverless/settings/observability_project/kibana.jsonc similarity index 100% rename from packages/serverless/settings/observability_project/kibana.jsonc rename to src/platform/packages/shared/serverless/settings/observability_project/kibana.jsonc diff --git a/packages/serverless/settings/observability_project/package.json b/src/platform/packages/shared/serverless/settings/observability_project/package.json similarity index 100% rename from packages/serverless/settings/observability_project/package.json rename to src/platform/packages/shared/serverless/settings/observability_project/package.json diff --git a/packages/serverless/settings/observability_project/tsconfig.json b/src/platform/packages/shared/serverless/settings/observability_project/tsconfig.json similarity index 81% rename from packages/serverless/settings/observability_project/tsconfig.json rename to src/platform/packages/shared/serverless/settings/observability_project/tsconfig.json index 16d6022e3d9bc..16a9ba9ba4b5d 100644 --- a/packages/serverless/settings/observability_project/tsconfig.json +++ b/src/platform/packages/shared/serverless/settings/observability_project/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/src/platform/plugins/shared/content_management/server/rpc/routes/routes.ts b/src/platform/plugins/shared/content_management/server/rpc/routes/routes.ts index 36bfb42f7cccc..021fd224c7fe6 100644 --- a/src/platform/plugins/shared/content_management/server/rpc/routes/routes.ts +++ b/src/platform/plugins/shared/content_management/server/rpc/routes/routes.ts @@ -42,6 +42,13 @@ export function initRpcRoutes( router.post( { path: '/api/content_management/rpc/{name}', + security: { + authz: { + enabled: false, + reason: + "This route is opted out from authorization, because it's a wrapper around Saved Object client", + }, + }, validate: { params: schema.object({ // @ts-ignore We validate above that procedureNames has at least one item diff --git a/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_documents.test.tsx b/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_documents.test.tsx index 5ebe81da80a79..27bdcd46c3eb0 100644 --- a/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_documents.test.tsx +++ b/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_documents.test.tsx @@ -46,6 +46,17 @@ async function mountComponent(fetchStatus: FetchStatus, hits: EsHitRecord[]) { stateContainer.appState.update({ dataSource: createDataViewDataSource({ dataViewId: dataViewMock.id! }), }); + stateContainer.internalState.transitions.setDataRequestParams({ + timeRangeRelative: { + from: '2020-05-14T11:05:13.590', + to: '2020-05-14T11:20:13.590', + }, + timeRangeAbsolute: { + from: '2020-05-14T11:05:13.590', + to: '2020-05-14T11:20:13.590', + }, + }); + stateContainer.dataState.data$.documents$ = documents$; const props = { diff --git a/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_documents.tsx b/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_documents.tsx index 18996a7cdf9ca..ee00abbe5659d 100644 --- a/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_documents.tsx +++ b/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_documents.tsx @@ -46,7 +46,6 @@ import useObservable from 'react-use/lib/useObservable'; import type { DocViewFilterFn } from '@kbn/unified-doc-viewer/types'; import { DiscoverGridSettings } from '@kbn/saved-search-plugin/common'; import { useQuerySubscriber } from '@kbn/unified-field-list'; -import { map } from 'rxjs'; import { DiscoverGrid } from '../../../../components/discover_grid'; import { getDefaultRowsPerPage } from '../../../../../common/constants'; import { useInternalStateSelector } from '../../state_management/discover_internal_state_container'; @@ -112,6 +111,7 @@ function DiscoverDocumentsComponent({ const documents$ = stateContainer.dataState.data$.documents$; const savedSearch = useSavedSearchInitial(); const { dataViews, capabilities, uiSettings, uiActions, ebtManager, fieldsMetadata } = services; + const requestParams = useInternalStateSelector((state) => state.dataRequestParams); const [ dataSource, query, @@ -269,20 +269,14 @@ function DiscoverDocumentsComponent({ : undefined, [documentState.esqlQueryColumns] ); - const { filters } = useQuerySubscriber({ data: services.data }); - const timeRange = useObservable( - services.timefilter.getTimeUpdate$().pipe(map(() => services.timefilter.getTime())), - services.timefilter.getTime() - ); - const cellActionsMetadata = useAdditionalCellActions({ dataSource, dataView, query, filters, - timeRange, + timeRange: requestParams.timeRangeAbsolute, }); const renderDocumentView = useCallback( diff --git a/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_histogram_layout.test.tsx b/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_histogram_layout.test.tsx index 9aec3589c753e..121954410a90b 100644 --- a/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_histogram_layout.test.tsx +++ b/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_histogram_layout.test.tsx @@ -38,14 +38,25 @@ import { createDataViewDataSource } from '../../../../../common/data_sources'; function getStateContainer(savedSearch?: SavedSearch) { const stateContainer = getDiscoverStateMock({ isTimeBased: true, savedSearch }); const dataView = savedSearch?.searchSource?.getField('index') as DataView; - - stateContainer.appState.update({ + const appState = { dataSource: createDataViewDataSource({ dataViewId: dataView?.id! }), interval: 'auto', hideChart: false, - }); + }; + + stateContainer.appState.update(appState); stateContainer.internalState.transitions.setDataView(dataView); + stateContainer.internalState.transitions.setDataRequestParams({ + timeRangeAbsolute: { + from: '2020-05-14T11:05:13.590', + to: '2020-05-14T11:20:13.590', + }, + timeRangeRelative: { + from: '2020-05-14T11:05:13.590', + to: '2020-05-14T11:20:13.590', + }, + }); return stateContainer; } @@ -65,16 +76,7 @@ const mountComponent = async ({ const dataView = savedSearch?.searchSource?.getField('index') as DataView; let services = discoverServiceMock; - services.data.query.timefilter.timefilter.getAbsoluteTime = () => { - return { from: '2020-05-14T11:05:13.590', to: '2020-05-14T11:20:13.590' }; - }; - services.data.query.timefilter.timefilter.getTime = () => { - return { from: '2020-05-14T11:05:13.590', to: '2020-05-14T11:20:13.590' }; - }; - (services.data.query.queryString.getDefaultQuery as jest.Mock).mockReturnValue({ - language: 'kuery', - query: '', - }); + (searchSourceInstanceMock.fetch$ as jest.Mock).mockImplementation( jest.fn().mockReturnValue(of({ rawResponse: { hits: { total: 2 } } })) ); diff --git a/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_layout.test.tsx b/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_layout.test.tsx index c0b94760b61d3..c08b5539dd1c0 100644 --- a/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_layout.test.tsx +++ b/src/platform/plugins/shared/discover/public/application/main/components/layout/discover_layout.test.tsx @@ -105,6 +105,10 @@ async function mountComponent( query, }); stateContainer.internalState.transitions.setDataView(dataView); + stateContainer.internalState.transitions.setDataRequestParams({ + timeRangeAbsolute: time, + timeRangeRelative: time, + }); const props = { dataView, diff --git a/src/platform/plugins/shared/discover/public/application/main/components/layout/use_discover_histogram.test.tsx b/src/platform/plugins/shared/discover/public/application/main/components/layout/use_discover_histogram.test.tsx index c8f829d442444..863a162c63a93 100644 --- a/src/platform/plugins/shared/discover/public/application/main/components/layout/use_discover_histogram.test.tsx +++ b/src/platform/plugins/shared/discover/public/application/main/components/layout/use_discover_histogram.test.tsx @@ -379,6 +379,23 @@ describe('useDiscoverHistogram', () => { }); expect(hook.result.current.isChartLoading).toBe(true); }); + + it('should use timerange + timeRangeRelative + query given by the internalState container', async () => { + const fetch$ = new Subject(); + const stateContainer = getStateContainer(); + const timeRangeAbs = { from: '2021-05-01T20:00:00Z', to: '2021-05-02T20:00:00Z' }; + const timeRangeRel = { from: 'now-15m', to: 'now' }; + stateContainer.internalState.transitions.setDataRequestParams({ + timeRangeAbsolute: timeRangeAbs, + timeRangeRelative: timeRangeRel, + }); + const { hook } = await renderUseDiscoverHistogram({ stateContainer }); + act(() => { + fetch$.next(); + }); + expect(hook.result.current.timeRange).toBe(timeRangeAbs); + expect(hook.result.current.relativeTimeRange).toBe(timeRangeRel); + }); }); describe('refetching', () => { diff --git a/src/platform/plugins/shared/discover/public/application/main/components/layout/use_discover_histogram.ts b/src/platform/plugins/shared/discover/public/application/main/components/layout/use_discover_histogram.ts index 3f2acf0ce933b..8f0a0fdf33dc1 100644 --- a/src/platform/plugins/shared/discover/public/application/main/components/layout/use_discover_histogram.ts +++ b/src/platform/plugins/shared/discover/public/application/main/components/layout/use_discover_histogram.ts @@ -217,14 +217,9 @@ export const useDiscoverHistogram = ({ * Request params */ const { query, filters } = useQuerySubscriber({ data: services.data }); + const requestParams = useInternalStateSelector((state) => state.dataRequestParams); const customFilters = useInternalStateSelector((state) => state.customFilters); - const timefilter = services.data.query.timefilter.timefilter; - const timeRange = timefilter.getAbsoluteTime(); - const relativeTimeRange = useObservable( - timefilter.getTimeUpdate$().pipe(map(() => timefilter.getTime())), - timefilter.getTime() - ); - + const { timeRangeRelative: relativeTimeRange, timeRangeAbsolute: timeRange } = requestParams; // When in ES|QL mode, update the data view, query, and // columns only when documents are done fetching so the Lens suggestions // don't frequently change, such as when the user modifies the table diff --git a/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_all.test.ts b/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_all.test.ts index ce2edba5d231e..0f620dab03654 100644 --- a/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_all.test.ts +++ b/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_all.test.ts @@ -81,6 +81,7 @@ describe('test fetchAll', () => { rowHeight: false, breakdownField: false, }, + dataRequestParams: {}, }), searchSessionId: '123', initialFetchStatus: FetchStatus.UNINITIALIZED, @@ -273,6 +274,7 @@ describe('test fetchAll', () => { rowHeight: false, breakdownField: false, }, + dataRequestParams: {}, }), }; fetchAll(subjects, false, deps); @@ -396,6 +398,7 @@ describe('test fetchAll', () => { rowHeight: false, breakdownField: false, }, + dataRequestParams: {}, }), }; fetchAll(subjects, false, deps); diff --git a/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_all.ts b/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_all.ts index 0e5a4e050f2fd..4f4af2f289d05 100644 --- a/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_all.ts +++ b/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_all.ts @@ -97,6 +97,7 @@ export function fetchAll( services, sort: getAppState().sort as SortOrder[], customFilters: getInternalState().customFilters, + inputTimeRange: getInternalState().dataRequestParams.timeRangeAbsolute, }); } @@ -117,6 +118,7 @@ export function fetchAll( data, expressions, profilesManager, + timeRange: getInternalState().dataRequestParams.timeRangeAbsolute, }) : fetchDocuments(searchSource, fetchDeps); const fetchType = isEsqlQuery ? 'fetchTextBased' : 'fetchDocuments'; diff --git a/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_esql.test.ts b/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_esql.test.ts index f4f2d6e4fa4af..ab96d22f24189 100644 --- a/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_esql.test.ts +++ b/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_esql.test.ts @@ -13,13 +13,23 @@ import { RequestAdapter } from '@kbn/inspector-plugin/common'; import { of } from 'rxjs'; import { dataViewWithTimefieldMock } from '../../../__mocks__/data_view_with_timefield'; import { discoverServiceMock } from '../../../__mocks__/services'; -import { fetchEsql } from './fetch_esql'; +import { fetchEsql, getTextBasedQueryStateToAstProps } from './fetch_esql'; +import { TimeRange } from '@kbn/es-query'; describe('fetchEsql', () => { beforeEach(() => { jest.clearAllMocks(); }); + const fetchEsqlMockProps = { + query: { esql: 'from *' }, + dataView: dataViewWithTimefieldMock, + inspectorAdapters: { requests: new RequestAdapter() }, + data: discoverServiceMock.data, + expressions: discoverServiceMock.expressions, + profilesManager: discoverServiceMock.profilesManager, + }; + it('resolves with returned records', async () => { const hits = [ { _id: '1', foo: 'bar' }, @@ -46,16 +56,7 @@ describe('fetchEsql', () => { discoverServiceMock.profilesManager, 'resolveDocumentProfile' ); - expect( - await fetchEsql({ - query: { esql: 'from *' }, - dataView: dataViewWithTimefieldMock, - inspectorAdapters: { requests: new RequestAdapter() }, - data: discoverServiceMock.data, - expressions: discoverServiceMock.expressions, - profilesManager: discoverServiceMock.profilesManager, - }) - ).toEqual({ + expect(await fetchEsql(fetchEsqlMockProps)).toEqual({ records, esqlQueryColumns: ['_id', 'foo'], esqlHeaderWarning: undefined, @@ -64,4 +65,24 @@ describe('fetchEsql', () => { expect(resolveDocumentProfileSpy).toHaveBeenCalledWith({ record: records[0] }); expect(resolveDocumentProfileSpy).toHaveBeenCalledWith({ record: records[1] }); }); + + it('should use inputTimeRange if provided', () => { + const timeRange: TimeRange = { from: 'now-15m', to: 'now' }; + const result = getTextBasedQueryStateToAstProps({ ...fetchEsqlMockProps, timeRange }); + expect(result.time).toEqual(timeRange); + }); + + it('should use absolute time from data if inputTimeRange is not provided', () => { + const absoluteTimeRange: TimeRange = { + from: '2021-08-31T22:00:00.000Z', + to: '2021-09-01T22:00:00.000Z', + }; + jest + .spyOn(discoverServiceMock.data.query.timefilter.timefilter, 'getAbsoluteTime') + .mockReturnValue(absoluteTimeRange); + + const result = getTextBasedQueryStateToAstProps(fetchEsqlMockProps); + + expect(result.time).toEqual(absoluteTimeRange); + }); }); diff --git a/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_esql.ts b/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_esql.ts index d7cad10b177f6..9c5540443f86d 100644 --- a/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_esql.ts +++ b/src/platform/plugins/shared/discover/public/application/main/data_fetching/fetch_esql.ts @@ -32,7 +32,7 @@ export function fetchEsql({ query, inputQuery, filters, - inputTimeRange, + timeRange, dataView, abortSignal, inspectorAdapters, @@ -43,7 +43,7 @@ export function fetchEsql({ query: Query | AggregateQuery; inputQuery?: Query; filters?: Filter[]; - inputTimeRange?: TimeRange; + timeRange?: TimeRange; dataView: DataView; abortSignal?: AbortSignal; inspectorAdapters: Adapters; @@ -51,20 +51,15 @@ export function fetchEsql({ expressions: ExpressionsStart; profilesManager: ProfilesManager; }): Promise { - const timeRange = inputTimeRange ?? data.query.timefilter.timefilter.getTime(); - return textBasedQueryStateToAstWithValidation({ - filters, + const props = getTextBasedQueryStateToAstProps({ query, - time: timeRange, - timeFieldName: dataView.timeFieldName, inputQuery, - titleForInspector: i18n.translate('discover.inspectorEsqlRequestTitle', { - defaultMessage: 'Table', - }), - descriptionForInspector: i18n.translate('discover.inspectorEsqlRequestDescription', { - defaultMessage: 'This request queries Elasticsearch to fetch results for the table.', - }), - }) + filters, + timeRange, + dataView, + data, + }); + return textBasedQueryStateToAstWithValidation(props) .then((ast) => { if (ast) { const contract = expressions.execute(ast, null, { @@ -118,3 +113,32 @@ export function fetchEsql({ throw new Error(err.message); }); } +export function getTextBasedQueryStateToAstProps({ + query, + inputQuery, + filters, + timeRange, + dataView, + data, +}: { + query: Query | AggregateQuery; + inputQuery?: Query; + filters?: Filter[]; + timeRange?: TimeRange; + dataView: DataView; + data: DataPublicPluginStart; +}) { + return { + filters, + query, + time: timeRange ?? data.query.timefilter.timefilter.getAbsoluteTime(), + timeFieldName: dataView.timeFieldName, + inputQuery, + titleForInspector: i18n.translate('discover.inspectorEsqlRequestTitle', { + defaultMessage: 'Table', + }), + descriptionForInspector: i18n.translate('discover.inspectorEsqlRequestDescription', { + defaultMessage: 'This request queries Elasticsearch to fetch results for the table.', + }), + }; +} diff --git a/src/platform/plugins/shared/discover/public/application/main/data_fetching/update_search_source.ts b/src/platform/plugins/shared/discover/public/application/main/data_fetching/update_search_source.ts index ad79e93ec37e4..05ba512d0e716 100644 --- a/src/platform/plugins/shared/discover/public/application/main/data_fetching/update_search_source.ts +++ b/src/platform/plugins/shared/discover/public/application/main/data_fetching/update_search_source.ts @@ -7,9 +7,9 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { ISearchSource } from '@kbn/data-plugin/public'; -import { DataViewType, DataView } from '@kbn/data-views-plugin/public'; -import { Filter } from '@kbn/es-query'; +import type { ISearchSource } from '@kbn/data-plugin/public'; +import { DataViewType, type DataView } from '@kbn/data-views-plugin/public'; +import type { Filter, TimeRange } from '@kbn/es-query'; import type { SortOrder } from '@kbn/saved-search-plugin/public'; import { SORT_DEFAULT_ORDER_SETTING } from '@kbn/discover-utils'; import { DiscoverServices } from '../../../build_services'; @@ -25,11 +25,13 @@ export function updateVolatileSearchSource( services, sort, customFilters, + inputTimeRange, }: { dataView: DataView; services: DiscoverServices; sort?: SortOrder[]; customFilters: Filter[]; + inputTimeRange?: TimeRange; } ) { const { uiSettings, data } = services; @@ -48,7 +50,7 @@ export function updateVolatileSearchSource( if (dataView.type !== DataViewType.ROLLUP) { // Set the date range filter fields from timeFilter using the absolute format. Search sessions requires that it be converted from a relative range - const timeFilter = data.query.timefilter.timefilter.createFilter(dataView); + const timeFilter = data.query.timefilter.timefilter.createFilter(dataView, inputTimeRange); filters = timeFilter ? [...filters, timeFilter] : filters; } diff --git a/src/platform/plugins/shared/discover/public/application/main/state_management/discover_data_state_container.ts b/src/platform/plugins/shared/discover/public/application/main/state_management/discover_data_state_container.ts index 59220d7def3c1..029cbf1b229d4 100644 --- a/src/platform/plugins/shared/discover/public/application/main/state_management/discover_data_state_container.ts +++ b/src/platform/plugins/shared/discover/public/application/main/state_management/discover_data_state_container.ts @@ -254,6 +254,11 @@ export function getDataStateContainer({ return; } + internalStateContainer.transitions.setDataRequestParams({ + timeRangeAbsolute: timefilter.getAbsoluteTime(), + timeRangeRelative: timefilter.getTime(), + }); + await profilesManager.resolveDataSourceProfile({ dataSource: appStateContainer.getState().dataSource, dataView: getSavedSearch().searchSource.getField('index'), diff --git a/src/platform/plugins/shared/discover/public/application/main/state_management/discover_internal_state_container.ts b/src/platform/plugins/shared/discover/public/application/main/state_management/discover_internal_state_container.ts index 8aad8eb91738b..74815ad816daf 100644 --- a/src/platform/plugins/shared/discover/public/application/main/state_management/discover_internal_state_container.ts +++ b/src/platform/plugins/shared/discover/public/application/main/state_management/discover_internal_state_container.ts @@ -14,10 +14,15 @@ import { ReduxLikeStateContainer, } from '@kbn/kibana-utils-plugin/common'; import type { DataView, DataViewListItem } from '@kbn/data-views-plugin/common'; -import type { Filter } from '@kbn/es-query'; +import type { Filter, TimeRange } from '@kbn/es-query'; import type { DataTableRecord } from '@kbn/discover-utils/types'; import type { UnifiedHistogramVisContext } from '@kbn/unified-histogram-plugin/public'; +interface InternalStateDataRequestParams { + timeRangeAbsolute?: TimeRange; + timeRangeRelative?: TimeRange; +} + export interface InternalState { dataView: DataView | undefined; isDataViewLoading: boolean; @@ -33,6 +38,7 @@ export interface InternalState { rowHeight: boolean; breakdownField: boolean; }; + dataRequestParams: InternalStateDataRequestParams; } export interface InternalStateTransitions { @@ -65,6 +71,9 @@ export interface InternalStateTransitions { ) => ( resetDefaultProfileState: Omit ) => InternalState; + setDataRequestParams: ( + state: InternalState + ) => (params: InternalStateDataRequestParams) => InternalState; } export type DiscoverInternalStateContainer = ReduxLikeStateContainer< @@ -91,6 +100,7 @@ export function getInternalStateContainer() { rowHeight: false, breakdownField: false, }, + dataRequestParams: {}, }, { setDataView: (prevState: InternalState) => (nextDataView: DataView) => ({ @@ -162,6 +172,11 @@ export function getInternalStateContainer() { overriddenVisContextAfterInvalidation: undefined, expandedDoc: undefined, }), + setDataRequestParams: + (prevState: InternalState) => (params: InternalStateDataRequestParams) => ({ + ...prevState, + dataRequestParams: params, + }), setResetDefaultProfileState: (prevState: InternalState) => (resetDefaultProfileState: Omit) => ({ diff --git a/src/platform/plugins/shared/discover/public/embeddable/initialize_fetch.ts b/src/platform/plugins/shared/discover/public/embeddable/initialize_fetch.ts index 445b7da7dd984..261966931e320 100644 --- a/src/platform/plugins/shared/discover/public/embeddable/initialize_fetch.ts +++ b/src/platform/plugins/shared/discover/public/embeddable/initialize_fetch.ts @@ -148,7 +148,7 @@ export function initializeFetch({ // Request ES|QL data const result = await fetchEsql({ query: searchSourceQuery, - inputTimeRange: getTimeRangeFromFetchContext(fetchContext), + timeRange: getTimeRangeFromFetchContext(fetchContext), inputQuery: fetchContext.query, filters: fetchContext.filters, dataView, diff --git a/src/platform/plugins/shared/guided_onboarding/README.md b/src/platform/plugins/shared/guided_onboarding/README.md index e9d8ac5215b60..1d0f87b32ff8f 100755 --- a/src/platform/plugins/shared/guided_onboarding/README.md +++ b/src/platform/plugins/shared/guided_onboarding/README.md @@ -29,7 +29,7 @@ For example, when a user goes through the SIEM guide they are first taken to the There is also a server side in the guided onboarding plugin that creates several endpoints for plugin only internal use. The endpoints are for fetching the guide configs, the state of the guided onboarding and to update the state. The server side also exposes a function ([link](https://github.com/elastic/kibana/blob/main/src/platform/plugins/shared/guided_onboarding/server/plugin.ts#L40)) that is used by consumers to register their guide configs. That way the config files are a part of the consumers code and the guided onboarding is only used as a framework. -Another part of the guided onboarding code is in the home plugin where the code for the landing page ([link](https://github.com/elastic/kibana/tree/main/src/platform/plugins/shared/home/public/application/components/guided_onboarding)) is situated. The landing page can be found under `/app/home#/getting_started` and there is some logic ([link](https://github.com/elastic/kibana/blob/main/src/platform/plugins/shared/home/public/application/components/home.tsx#L200)) that redirects the user to the landing page when the deployment is new (i.e. there is no data in the deployment). Some of the static components for the landing page were extracted to the `kbn-guided-onboarding` package ([link](https://github.com/elastic/kibana/tree/main/packages/kbn-guided-onboarding)). +Another part of the guided onboarding code is in the home plugin where the code for the landing page ([link](https://github.com/elastic/kibana/tree/main/src/platform/plugins/shared/home/public/application/components/guided_onboarding)) is situated. The landing page can be found under `/app/home#/getting_started` and there is some logic ([link](https://github.com/elastic/kibana/blob/main/src/platform/plugins/shared/home/public/application/components/home.tsx#L200)) that redirects the user to the landing page when the deployment is new (i.e. there is no data in the deployment). Some of the static components for the landing page were extracted to the `kbn-guided-onboarding` package ([link](https://github.com/elastic/kibana/tree/main/src/platform/packages/shared/kbn-guided-onboarding)). When starting Kibana with `yarn start --run-examples` the `guided_onboarding_example` plugin ([link](https://github.com/elastic/kibana/tree/main/examples/guided_onboarding_example)) can be found under `/app/guidedOnboardingExample`. This page displays the current state of the guided onboarding and allows setting the state to any point in the guide. Otherwise, it can be difficult and time consuming to reach a specific step in a production guide during dev work. The example plugin also registers a config for a test guide that can be completed on the pages of the example plugin. The test guide is also used for unit and functional tests of the guided onboarding plugin. @@ -133,8 +133,8 @@ The guided onboarding exposes a function `registerGuideConfig(guideId: GuideId, Follow these simple steps to add a new guide to the guided onboarding framework. For more detailed information about framework functionality and architecture and about API services exposed by the plugin, please read the full readme. 1. Declare the `guidedOnboarding` plugin as an optional dependency in your plugin's `kibana.json` file. Add the guided onboarding plugin's client-side start contract to your plugin's client-side start dependencies and the guided onboarding plugin's server-side setup contract to your plugin's server-side dependencies. -2. Define the configuration for your guide. At a high level, this includes a title, description, and list of steps. See this [example config](https://github.com/elastic/kibana/blob/main/packages/kbn-guided-onboarding/src/common/test_guide_config.ts) or consult the `GuideConfig` interface. +2. Define the configuration for your guide. At a high level, this includes a title, description, and list of steps. See this [example config](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-guided-onboarding/src/common/test_guide_config.ts) or consult the `GuideConfig` interface. 3. Register your guide during your plugin's server-side setup by calling a function exposed by the guided onboarding plugin: `registerGuideConfig(guideId: GuideId, guideConfig: GuideConfig)`. For an example, see this [example plugin](https://github.com/elastic/kibana/blob/main/examples/guided_onboarding_example/server/plugin.ts). -4. Update the cards on the landing page to include your guide in the use case selection. Make sure that the card doesn't have the property `navigateTo` because that is only used for cards that redirect to Kibana pages and don't start a guide. Also add the same value to the property `guideId` as used in the guide config. Landing page cards are configured in this [kbn-guided-onboarding package](https://github.com/elastic/kibana/blob/main/packages/kbn-guided-onboarding/src/components/landing_page/guide_cards.constants.tsx). +4. Update the cards on the landing page to include your guide in the use case selection. Make sure that the card doesn't have the property `navigateTo` because that is only used for cards that redirect to Kibana pages and don't start a guide. Also add the same value to the property `guideId` as used in the guide config. Landing page cards are configured in this [kbn-guided-onboarding package](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-guided-onboarding/src/components/landing_page/guide_cards.constants.tsx). 5. Integrate the new guide into your Kibana pages by using the guided onboarding client-side API service. Make sure your Kibana pages correctly display UI elements depending on the active guide step and the UI flow is straight forward to complete the guide. See existing guides for an example and read more about the API service in this file, the section "Client-side: API service". 6. Optionally, update the example plugin's [form](https://github.com/elastic/kibana/blob/main/examples/guided_onboarding_example/public/components/main.tsx#L38) to be able to start your guide from that page and activate any step in your guide (useful to test your guide steps). diff --git a/src/platform/plugins/shared/guided_onboarding/server/routes/config_routes.ts b/src/platform/plugins/shared/guided_onboarding/server/routes/config_routes.ts index 36194c4677786..5880aecb6679f 100644 --- a/src/platform/plugins/shared/guided_onboarding/server/routes/config_routes.ts +++ b/src/platform/plugins/shared/guided_onboarding/server/routes/config_routes.ts @@ -18,6 +18,13 @@ export const registerGetConfigRoute = (router: IRouter, guidesConfig: GuidesConf router.get( { path: `${API_BASE_PATH}/configs/{guideId}`, + security: { + authz: { + enabled: false, + reason: + 'This route is opted out from authorization, as it returns config for guided onboarding, the guide onboarding is not security sensitive', + }, + }, validate: { params: schema.object({ guideId: schema.string(), diff --git a/src/platform/plugins/shared/guided_onboarding/server/routes/guide_state_routes.ts b/src/platform/plugins/shared/guided_onboarding/server/routes/guide_state_routes.ts index 1601094afdf6a..b380203bfeda8 100644 --- a/src/platform/plugins/shared/guided_onboarding/server/routes/guide_state_routes.ts +++ b/src/platform/plugins/shared/guided_onboarding/server/routes/guide_state_routes.ts @@ -17,6 +17,13 @@ export const registerGetGuideStateRoute = (router: IRouter) => { router.get( { path: `${API_BASE_PATH}/guides`, + security: { + authz: { + enabled: false, + reason: + "This route is opted out from authorization, because it's a wrapper around the Saved Object client", + }, + }, validate: false, }, async (context, request, response) => { diff --git a/src/platform/plugins/shared/guided_onboarding/server/routes/plugin_state_routes.ts b/src/platform/plugins/shared/guided_onboarding/server/routes/plugin_state_routes.ts index 0db93943f821c..ff30b0a421aa6 100644 --- a/src/platform/plugins/shared/guided_onboarding/server/routes/plugin_state_routes.ts +++ b/src/platform/plugins/shared/guided_onboarding/server/routes/plugin_state_routes.ts @@ -19,6 +19,13 @@ export const registerGetPluginStateRoute = (router: IRouter) => { router.get( { path: `${API_BASE_PATH}/state`, + security: { + authz: { + enabled: false, + reason: + "This route is opted out from authorization because it's a wrapper around the Saved Object client", + }, + }, validate: false, }, async (context, request, response) => { @@ -40,6 +47,13 @@ export const registerPutPluginStateRoute = (router: IRouter) => { router.put( { path: `${API_BASE_PATH}/state`, + security: { + authz: { + enabled: false, + reason: + "This route is opted out from authorization because it's a wrapper around the Saved Object client", + }, + }, validate: { body: schema.object({ status: schema.maybe(schema.string()), diff --git a/src/platform/plugins/shared/home/.storybook/main.ts b/src/platform/plugins/shared/home/.storybook/main.ts index dcf2d844567bd..5a6718ce1ab4a 100644 --- a/src/platform/plugins/shared/home/.storybook/main.ts +++ b/src/platform/plugins/shared/home/.storybook/main.ts @@ -12,7 +12,7 @@ import { defaultConfig } from '@kbn/storybook'; module.exports = { ...defaultConfig, stories: [ - '../../../../../../packages/home/**/*.stories.+(tsx|mdx)', + '../../../../../../src/platform/packages/shared/home/**/*.stories.+(tsx|mdx)', '../**/*.stories.+(tsx|mdx)', ], reactOptions: { diff --git a/src/platform/plugins/shared/home/server/services/sample_data/routes/install.ts b/src/platform/plugins/shared/home/server/services/sample_data/routes/install.ts index 9c90fa4e843b9..e4ea014a48a1b 100644 --- a/src/platform/plugins/shared/home/server/services/sample_data/routes/install.ts +++ b/src/platform/plugins/shared/home/server/services/sample_data/routes/install.ts @@ -26,6 +26,13 @@ export function createInstallRoute( router.post( { path: '/api/sample_data/{id}', + security: { + authz: { + enabled: false, + reason: + 'This route is opted out from authorization because the sample data installer is a wrapper around the Saved Object client', + }, + }, validate: { params: schema.object({ id: schema.string() }), // TODO validate now as date diff --git a/src/platform/plugins/shared/home/server/services/sample_data/routes/list.ts b/src/platform/plugins/shared/home/server/services/sample_data/routes/list.ts index 4fe2710786d1b..4e406342cf7d5 100644 --- a/src/platform/plugins/shared/home/server/services/sample_data/routes/list.ts +++ b/src/platform/plugins/shared/home/server/services/sample_data/routes/list.ts @@ -26,47 +26,60 @@ export const createListRoute = ( appLinksMap: Map, logger: Logger ) => { - router.get({ path: '/api/sample_data', validate: false }, async (context, _req, res) => { - const allExistingObjects = await findExistingSampleObjects(context, logger, sampleDatasets); + router.get( + { + path: '/api/sample_data', + security: { + authz: { + enabled: false, + reason: + 'This route is opted out from authorization because the data retrieved is derived and fetched from the saved objects client', + }, + }, + validate: false, + }, + async (context, _req, res) => { + const allExistingObjects = await findExistingSampleObjects(context, logger, sampleDatasets); - const registeredSampleDatasets = await Promise.all( - sampleDatasets.map(async (sampleDataset) => { - const existingObjects = allExistingObjects.get(sampleDataset.id)!; - const findObjectId = (type: string, id: string) => - existingObjects.find((object) => object.type === type && object.id === id) - ?.foundObjectId ?? id; + const registeredSampleDatasets = await Promise.all( + sampleDatasets.map(async (sampleDataset) => { + const existingObjects = allExistingObjects.get(sampleDataset.id)!; + const findObjectId = (type: string, id: string) => + existingObjects.find((object) => object.type === type && object.id === id) + ?.foundObjectId ?? id; - const appLinks = (appLinksMap.get(sampleDataset.id) ?? []).map((data) => { - const { sampleObject, getPath, label, icon, order } = data; - if (sampleObject === null) { - return { path: getPath(''), label, icon, order }; - } - const objectId = findObjectId(sampleObject.type, sampleObject.id); - return { path: getPath(objectId), label, icon, order }; - }); - const sampleDataStatus = await getSampleDatasetStatus( - context, - allExistingObjects, - sampleDataset - ); + const appLinks = (appLinksMap.get(sampleDataset.id) ?? []).map((data) => { + const { sampleObject, getPath, label, icon, order } = data; + if (sampleObject === null) { + return { path: getPath(''), label, icon, order }; + } + const objectId = findObjectId(sampleObject.type, sampleObject.id); + return { path: getPath(objectId), label, icon, order }; + }); + const sampleDataStatus = await getSampleDatasetStatus( + context, + allExistingObjects, + sampleDataset + ); - return { - id: sampleDataset.id, - name: sampleDataset.name, - description: sampleDataset.description, - previewImagePath: sampleDataset.previewImagePath, - darkPreviewImagePath: sampleDataset.darkPreviewImagePath, - overviewDashboard: findObjectId('dashboard', sampleDataset.overviewDashboard), - appLinks: sortBy(appLinks, 'order'), - defaultIndex: findObjectId('index-pattern', sampleDataset.defaultIndex), - dataIndices: sampleDataset.dataIndices.map(({ id }) => ({ id })), - ...sampleDataStatus, - }; - }) - ); + return { + id: sampleDataset.id, + name: sampleDataset.name, + description: sampleDataset.description, + previewImagePath: sampleDataset.previewImagePath, + darkPreviewImagePath: sampleDataset.darkPreviewImagePath, + overviewDashboard: findObjectId('dashboard', sampleDataset.overviewDashboard), + appLinks: sortBy(appLinks, 'order'), + defaultIndex: findObjectId('index-pattern', sampleDataset.defaultIndex), + dataIndices: sampleDataset.dataIndices.map(({ id }) => ({ id })), + ...sampleDataStatus, + }; + }) + ); - return res.ok({ body: registeredSampleDatasets }); - }); + return res.ok({ body: registeredSampleDatasets }); + } + ); }; type ExistingSampleObjects = Map; diff --git a/src/platform/plugins/shared/home/server/services/sample_data/routes/uninstall.ts b/src/platform/plugins/shared/home/server/services/sample_data/routes/uninstall.ts index 3f2fffebb3926..c17580d1d49ce 100644 --- a/src/platform/plugins/shared/home/server/services/sample_data/routes/uninstall.ts +++ b/src/platform/plugins/shared/home/server/services/sample_data/routes/uninstall.ts @@ -26,6 +26,13 @@ export function createUninstallRoute( router.delete( { path: '/api/sample_data/{id}', + security: { + authz: { + enabled: false, + reason: + 'This route is opted out from authorization because the uninstaller route is a wrapper around the Saved Object client', + }, + }, validate: { params: schema.object({ id: schema.string() }), }, diff --git a/src/platform/plugins/shared/home/server/services/tutorials/tutorials_registry.ts b/src/platform/plugins/shared/home/server/services/tutorials/tutorials_registry.ts index 1b7a27a766e8b..7f2a800aa6b59 100644 --- a/src/platform/plugins/shared/home/server/services/tutorials/tutorials_registry.ts +++ b/src/platform/plugins/shared/home/server/services/tutorials/tutorials_registry.ts @@ -81,7 +81,17 @@ export class TutorialsRegistry { const router = core.http.createRouter(); router.get( - { path: '/api/kibana/home/tutorials', validate: false }, + { + path: '/api/kibana/home/tutorials', + security: { + authz: { + enabled: false, + reason: + 'This route is opted out from authorization, because tutorials are public and ideally should be available to all users.', + }, + }, + validate: false, + }, async (context, req, res) => { const initialContext = this.baseTutorialContext; const scopedContext = this.scopedTutorialContextFactories.reduce( diff --git a/src/platform/plugins/shared/saved_objects_finder/server/ui_settings.ts b/src/platform/plugins/shared/saved_objects_finder/server/ui_settings.ts index caf064232abbb..f2ba0a4475014 100644 --- a/src/platform/plugins/shared/saved_objects_finder/server/ui_settings.ts +++ b/src/platform/plugins/shared/saved_objects_finder/server/ui_settings.ts @@ -23,6 +23,7 @@ export const uiSettings: Record = { description: i18n.translate('savedObjectsFinder.advancedSettings.perPageText', { defaultMessage: 'Number of objects to show per page in the load dialog', }), + requiresPageReload: true, schema: schema.number(), }, [LISTING_LIMIT_SETTING]: { diff --git a/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_create_route.ts b/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_create_route.ts index 1ecdb7ad65ce7..92b6519a95ea5 100644 --- a/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_create_route.ts +++ b/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_create_route.ts @@ -16,6 +16,13 @@ export const registerCreateRoute = (router: IRouter, url: ServerUrlService) => { router.post( { path: '/api/short_url', + security: { + authz: { + enabled: false, + reason: + 'This route is opted out from authorization, because the url service is a wrapper around the Saved Object client', + }, + }, options: { access: 'public', summary: `Create a short URL`, diff --git a/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_delete_route.ts b/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_delete_route.ts index 64a3dfaa098a5..7f148962e1d29 100644 --- a/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_delete_route.ts +++ b/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_delete_route.ts @@ -15,6 +15,13 @@ export const registerDeleteRoute = (router: IRouter, url: ServerUrlService) => { router.delete( { path: '/api/short_url/{id}', + security: { + authz: { + enabled: false, + reason: + 'This route is opted out from authorization, because the url service is a wrapper around the Saved Object client', + }, + }, options: { access: 'public', summary: `Delete a short URL`, diff --git a/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_get_route.ts b/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_get_route.ts index 92e8fcbdf414b..840886213786d 100644 --- a/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_get_route.ts +++ b/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_get_route.ts @@ -15,6 +15,13 @@ export const registerGetRoute = (router: IRouter, url: ServerUrlService) => { router.get( { path: '/api/short_url/{id}', + security: { + authz: { + enabled: false, + reason: + 'This route is opted out from authorization, because the url service is a wrapper around the Saved Object client', + }, + }, options: { access: 'public', summary: `Get a short URL`, diff --git a/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_resolve_route.ts b/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_resolve_route.ts index 0fa129a6aada9..4201d21b47596 100644 --- a/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_resolve_route.ts +++ b/src/platform/plugins/shared/share/server/url_service/http/short_urls/register_resolve_route.ts @@ -16,6 +16,13 @@ export const registerResolveRoute = (router: IRouter, url: ServerUrlService) => router.get( { path: '/api/short_url/_slug/{slug}', + security: { + authz: { + enabled: false, + reason: + 'This route is opted out from authorization, because the url service is a wrapper around the Saved Object client', + }, + }, options: { access: 'public', summary: `Resolve a short URL`, diff --git a/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_local_stats.test.ts b/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_local_stats.test.ts index d07743c2fc1aa..17a984841bb38 100644 --- a/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_local_stats.test.ts +++ b/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_local_stats.test.ts @@ -8,7 +8,7 @@ */ import { merge, omit } from 'lodash'; -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type * as estypes from '@elastic/elasticsearch/lib/api/types'; import { getLocalStats, handleLocalStats } from './get_local_stats'; import { diff --git a/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_local_stats.ts b/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_local_stats.ts index a0d54d043d11c..df3fc3d154ede 100644 --- a/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_local_stats.ts +++ b/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_local_stats.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type * as estypes from '@elastic/elasticsearch/lib/api/types'; import { StatsGetter, StatsCollectionContext, diff --git a/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_nodes_usage.ts b/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_nodes_usage.ts index 4fc70b95532d3..aaa27dd1ee98a 100644 --- a/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_nodes_usage.ts +++ b/src/platform/plugins/shared/telemetry/server/telemetry_collection/get_nodes_usage.ts @@ -8,7 +8,7 @@ */ import type { ElasticsearchClient } from '@kbn/core/server'; -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type * as estypes from '@elastic/elasticsearch/lib/api/types'; import { TIMEOUT } from './constants'; /** diff --git a/test/functional/apps/discover/group3/_request_counts.ts b/test/functional/apps/discover/group3/_request_counts.ts index 4be360f5a7e8c..03fdab88e2f23 100644 --- a/test/functional/apps/discover/group3/_request_counts.ts +++ b/test/functional/apps/discover/group3/_request_counts.ts @@ -138,16 +138,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it(`should send no more than ${expectedRequests} requests (documents + chart) when changing the time range`, async () => { - await expectSearches( - type, - type === 'esql' ? expectedRequests + 1 : expectedRequests, - async () => { - await timePicker.setAbsoluteRange( - 'Sep 21, 2015 @ 06:31:44.000', - 'Sep 23, 2015 @ 00:00:00.000' - ); - } - ); + await expectSearches(type, expectedRequests, async () => { + await timePicker.setAbsoluteRange( + 'Sep 21, 2015 @ 06:31:44.000', + 'Sep 23, 2015 @ 00:00:00.000' + ); + }); }); it(`should send ${savedSearchesRequests} requests for saved search changes`, async () => { diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index 1bda105ba07a6..8e6921407a7bf 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -250,6 +250,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'xpack.cloud.performance_url (string?)', 'xpack.cloud.users_and_roles_url (string?)', 'xpack.cloud.projects_url (string?|never)', + 'xpack.cloudSecurityPosture.enableExperimental (array?)', // can't be used to infer urls or customer id from the outside 'xpack.cloud.serverless.project_id (string?)', 'xpack.cloud.serverless.project_name (string?)', diff --git a/tsconfig.base.json b/tsconfig.base.json index 97d73eaa868f5..cc0418edae2f0 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -282,8 +282,8 @@ "@kbn/core-capabilities-server-internal/*": ["src/core/packages/capabilities/server-internal/*"], "@kbn/core-capabilities-server-mocks": ["packages/core/capabilities/core-capabilities-server-mocks"], "@kbn/core-capabilities-server-mocks/*": ["packages/core/capabilities/core-capabilities-server-mocks/*"], - "@kbn/core-chrome-browser": ["packages/core/chrome/core-chrome-browser"], - "@kbn/core-chrome-browser/*": ["packages/core/chrome/core-chrome-browser/*"], + "@kbn/core-chrome-browser": ["src/core/packages/chrome/browser"], + "@kbn/core-chrome-browser/*": ["src/core/packages/chrome/browser/*"], "@kbn/core-chrome-browser-internal": ["src/core/packages/chrome/browser-internal"], "@kbn/core-chrome-browser-internal/*": ["src/core/packages/chrome/browser-internal/*"], "@kbn/core-chrome-browser-mocks": ["packages/core/chrome/core-chrome-browser-mocks"], @@ -744,8 +744,8 @@ "@kbn/deeplinks-search/*": ["src/platform/packages/shared/deeplinks/search/*"], "@kbn/deeplinks-security": ["src/platform/packages/shared/deeplinks/security"], "@kbn/deeplinks-security/*": ["src/platform/packages/shared/deeplinks/security/*"], - "@kbn/deeplinks-shared": ["packages/deeplinks/shared"], - "@kbn/deeplinks-shared/*": ["packages/deeplinks/shared/*"], + "@kbn/deeplinks-shared": ["src/platform/packages/shared/deeplinks/shared"], + "@kbn/deeplinks-shared/*": ["src/platform/packages/shared/deeplinks/shared/*"], "@kbn/default-nav-analytics": ["src/platform/packages/private/default-nav/analytics"], "@kbn/default-nav-analytics/*": ["src/platform/packages/private/default-nav/analytics/*"], "@kbn/default-nav-devtools": ["src/platform/packages/private/default-nav/devtools"], @@ -1008,8 +1008,8 @@ "@kbn/grokdebugger-plugin/*": ["x-pack/platform/plugins/private/grokdebugger/*"], "@kbn/grouping": ["src/platform/packages/shared/kbn-grouping"], "@kbn/grouping/*": ["src/platform/packages/shared/kbn-grouping/*"], - "@kbn/guided-onboarding": ["packages/kbn-guided-onboarding"], - "@kbn/guided-onboarding/*": ["packages/kbn-guided-onboarding/*"], + "@kbn/guided-onboarding": ["src/platform/packages/shared/kbn-guided-onboarding"], + "@kbn/guided-onboarding/*": ["src/platform/packages/shared/kbn-guided-onboarding/*"], "@kbn/guided-onboarding-example-plugin": ["examples/guided_onboarding_example"], "@kbn/guided-onboarding-example-plugin/*": ["examples/guided_onboarding_example/*"], "@kbn/guided-onboarding-plugin": ["src/platform/plugins/shared/guided_onboarding"], @@ -1026,12 +1026,12 @@ "@kbn/hello-world-plugin/*": ["examples/hello_world/*"], "@kbn/home-plugin": ["src/platform/plugins/shared/home"], "@kbn/home-plugin/*": ["src/platform/plugins/shared/home/*"], - "@kbn/home-sample-data-card": ["packages/home/sample_data_card"], - "@kbn/home-sample-data-card/*": ["packages/home/sample_data_card/*"], - "@kbn/home-sample-data-tab": ["packages/home/sample_data_tab"], - "@kbn/home-sample-data-tab/*": ["packages/home/sample_data_tab/*"], - "@kbn/home-sample-data-types": ["packages/home/sample_data_types"], - "@kbn/home-sample-data-types/*": ["packages/home/sample_data_types/*"], + "@kbn/home-sample-data-card": ["src/platform/packages/shared/home/sample_data_card"], + "@kbn/home-sample-data-card/*": ["src/platform/packages/shared/home/sample_data_card/*"], + "@kbn/home-sample-data-tab": ["src/platform/packages/shared/home/sample_data_tab"], + "@kbn/home-sample-data-tab/*": ["src/platform/packages/shared/home/sample_data_tab/*"], + "@kbn/home-sample-data-types": ["src/platform/packages/shared/home/sample_data_types"], + "@kbn/home-sample-data-types/*": ["src/platform/packages/shared/home/sample_data_types/*"], "@kbn/i18n": ["src/platform/packages/shared/kbn-i18n"], "@kbn/i18n/*": ["src/platform/packages/shared/kbn-i18n/*"], "@kbn/i18n-react": ["src/platform/packages/shared/kbn-i18n-react"], @@ -1096,8 +1096,8 @@ "@kbn/io-ts-utils/*": ["src/platform/packages/shared/kbn-io-ts-utils/*"], "@kbn/ipynb": ["x-pack/solutions/search/packages/kbn-ipynb"], "@kbn/ipynb/*": ["x-pack/solutions/search/packages/kbn-ipynb/*"], - "@kbn/item-buffer": ["packages/kbn-item-buffer"], - "@kbn/item-buffer/*": ["packages/kbn-item-buffer/*"], + "@kbn/item-buffer": ["src/platform/packages/private/kbn-item-buffer"], + "@kbn/item-buffer/*": ["src/platform/packages/private/kbn-item-buffer/*"], "@kbn/jest-serializers": ["packages/kbn-jest-serializers"], "@kbn/jest-serializers/*": ["packages/kbn-jest-serializers/*"], "@kbn/journeys": ["packages/kbn-journeys"], @@ -1198,10 +1198,10 @@ "@kbn/management-settings-components-form/*": ["src/platform/packages/private/kbn-management/settings/components/form/*"], "@kbn/management-settings-field-definition": ["src/platform/packages/shared/kbn-management/settings/field_definition"], "@kbn/management-settings-field-definition/*": ["src/platform/packages/shared/kbn-management/settings/field_definition/*"], - "@kbn/management-settings-ids": ["packages/kbn-management/settings/setting_ids"], - "@kbn/management-settings-ids/*": ["packages/kbn-management/settings/setting_ids/*"], - "@kbn/management-settings-section-registry": ["packages/kbn-management/settings/section_registry"], - "@kbn/management-settings-section-registry/*": ["packages/kbn-management/settings/section_registry/*"], + "@kbn/management-settings-ids": ["src/platform/packages/shared/kbn-management/settings/setting_ids"], + "@kbn/management-settings-ids/*": ["src/platform/packages/shared/kbn-management/settings/setting_ids/*"], + "@kbn/management-settings-section-registry": ["src/platform/packages/shared/kbn-management/settings/section_registry"], + "@kbn/management-settings-section-registry/*": ["src/platform/packages/shared/kbn-management/settings/section_registry/*"], "@kbn/management-settings-types": ["src/platform/packages/shared/kbn-management/settings/types"], "@kbn/management-settings-types/*": ["src/platform/packages/shared/kbn-management/settings/types/*"], "@kbn/management-settings-utilities": ["src/platform/packages/shared/kbn-management/settings/utilities"], @@ -1308,6 +1308,8 @@ "@kbn/no-data-page-plugin/*": ["src/platform/plugins/private/no_data_page/*"], "@kbn/notifications-plugin": ["x-pack/platform/plugins/shared/notifications"], "@kbn/notifications-plugin/*": ["x-pack/platform/plugins/shared/notifications/*"], + "@kbn/object-utils": ["src/platform/packages/shared/kbn-object-utils"], + "@kbn/object-utils/*": ["src/platform/packages/shared/kbn-object-utils/*"], "@kbn/object-versioning": ["src/platform/packages/shared/kbn-object-versioning"], "@kbn/object-versioning/*": ["src/platform/packages/shared/kbn-object-versioning/*"], "@kbn/object-versioning-utils": ["src/platform/packages/shared/kbn-object-versioning-utils"], @@ -1336,8 +1338,6 @@ "@kbn/observability-logs-explorer-plugin/*": ["x-pack/solutions/observability/plugins/observability_logs_explorer/*"], "@kbn/observability-logs-overview": ["x-pack/platform/packages/shared/observability/logs_overview"], "@kbn/observability-logs-overview/*": ["x-pack/platform/packages/shared/observability/logs_overview/*"], - "@kbn/observability-onboarding-e2e": ["x-pack/solutions/observability/plugins/observability_onboarding/e2e"], - "@kbn/observability-onboarding-e2e/*": ["x-pack/solutions/observability/plugins/observability_onboarding/e2e/*"], "@kbn/observability-onboarding-plugin": ["x-pack/solutions/observability/plugins/observability_onboarding"], "@kbn/observability-onboarding-plugin/*": ["x-pack/solutions/observability/plugins/observability_onboarding/*"], "@kbn/observability-plugin": ["x-pack/solutions/observability/plugins/observability"], @@ -1422,20 +1422,20 @@ "@kbn/react-field/*": ["src/platform/packages/shared/kbn-react-field/*"], "@kbn/react-hooks": ["src/platform/packages/shared/kbn-react-hooks"], "@kbn/react-hooks/*": ["src/platform/packages/shared/kbn-react-hooks/*"], - "@kbn/react-kibana-context-common": ["packages/react/kibana_context/common"], - "@kbn/react-kibana-context-common/*": ["packages/react/kibana_context/common/*"], - "@kbn/react-kibana-context-render": ["packages/react/kibana_context/render"], - "@kbn/react-kibana-context-render/*": ["packages/react/kibana_context/render/*"], - "@kbn/react-kibana-context-root": ["packages/react/kibana_context/root"], - "@kbn/react-kibana-context-root/*": ["packages/react/kibana_context/root/*"], - "@kbn/react-kibana-context-styled": ["packages/react/kibana_context/styled"], - "@kbn/react-kibana-context-styled/*": ["packages/react/kibana_context/styled/*"], - "@kbn/react-kibana-context-theme": ["packages/react/kibana_context/theme"], - "@kbn/react-kibana-context-theme/*": ["packages/react/kibana_context/theme/*"], - "@kbn/react-kibana-mount": ["packages/react/kibana_mount"], - "@kbn/react-kibana-mount/*": ["packages/react/kibana_mount/*"], - "@kbn/react-mute-legacy-root-warning": ["packages/kbn-react-mute-legacy-root-warning"], - "@kbn/react-mute-legacy-root-warning/*": ["packages/kbn-react-mute-legacy-root-warning/*"], + "@kbn/react-kibana-context-common": ["src/platform/packages/shared/react/kibana_context/common"], + "@kbn/react-kibana-context-common/*": ["src/platform/packages/shared/react/kibana_context/common/*"], + "@kbn/react-kibana-context-render": ["src/platform/packages/shared/react/kibana_context/render"], + "@kbn/react-kibana-context-render/*": ["src/platform/packages/shared/react/kibana_context/render/*"], + "@kbn/react-kibana-context-root": ["src/platform/packages/shared/react/kibana_context/root"], + "@kbn/react-kibana-context-root/*": ["src/platform/packages/shared/react/kibana_context/root/*"], + "@kbn/react-kibana-context-styled": ["src/platform/packages/shared/react/kibana_context/styled"], + "@kbn/react-kibana-context-styled/*": ["src/platform/packages/shared/react/kibana_context/styled/*"], + "@kbn/react-kibana-context-theme": ["src/platform/packages/shared/react/kibana_context/theme"], + "@kbn/react-kibana-context-theme/*": ["src/platform/packages/shared/react/kibana_context/theme/*"], + "@kbn/react-kibana-mount": ["src/platform/packages/shared/react/kibana_mount"], + "@kbn/react-kibana-mount/*": ["src/platform/packages/shared/react/kibana_mount/*"], + "@kbn/react-mute-legacy-root-warning": ["src/platform/packages/private/kbn-react-mute-legacy-root-warning"], + "@kbn/react-mute-legacy-root-warning/*": ["src/platform/packages/private/kbn-react-mute-legacy-root-warning/*"], "@kbn/recently-accessed": ["src/platform/packages/shared/kbn-recently-accessed"], "@kbn/recently-accessed/*": ["src/platform/packages/shared/kbn-recently-accessed/*"], "@kbn/relocate": ["packages/kbn-relocate"], @@ -1538,8 +1538,8 @@ "@kbn/saved-objects-management-plugin/*": ["src/platform/plugins/shared/saved_objects_management/*"], "@kbn/saved-objects-plugin": ["src/platform/plugins/shared/saved_objects"], "@kbn/saved-objects-plugin/*": ["src/platform/plugins/shared/saved_objects/*"], - "@kbn/saved-objects-settings": ["packages/kbn-saved-objects-settings"], - "@kbn/saved-objects-settings/*": ["packages/kbn-saved-objects-settings/*"], + "@kbn/saved-objects-settings": ["src/platform/packages/private/kbn-saved-objects-settings"], + "@kbn/saved-objects-settings/*": ["src/platform/packages/private/kbn-saved-objects-settings/*"], "@kbn/saved-objects-tagging-oss-plugin": ["src/platform/plugins/shared/saved_objects_tagging_oss"], "@kbn/saved-objects-tagging-oss-plugin/*": ["src/platform/plugins/shared/saved_objects_tagging_oss/*"], "@kbn/saved-objects-tagging-plugin": ["x-pack/platform/plugins/shared/saved_objects_tagging"], @@ -1700,14 +1700,14 @@ "@kbn/server-route-repository-utils/*": ["src/platform/packages/shared/kbn-server-route-repository-utils/*"], "@kbn/serverless": ["x-pack/platform/plugins/shared/serverless"], "@kbn/serverless/*": ["x-pack/platform/plugins/shared/serverless/*"], - "@kbn/serverless-common-settings": ["packages/serverless/settings/common"], - "@kbn/serverless-common-settings/*": ["packages/serverless/settings/common/*"], + "@kbn/serverless-common-settings": ["src/platform/packages/private/serverless/settings/common"], + "@kbn/serverless-common-settings/*": ["src/platform/packages/private/serverless/settings/common/*"], "@kbn/serverless-observability": ["x-pack/solutions/observability/plugins/serverless_observability"], "@kbn/serverless-observability/*": ["x-pack/solutions/observability/plugins/serverless_observability/*"], - "@kbn/serverless-observability-settings": ["packages/serverless/settings/observability_project"], - "@kbn/serverless-observability-settings/*": ["packages/serverless/settings/observability_project/*"], - "@kbn/serverless-project-switcher": ["packages/serverless/project_switcher"], - "@kbn/serverless-project-switcher/*": ["packages/serverless/project_switcher/*"], + "@kbn/serverless-observability-settings": ["src/platform/packages/shared/serverless/settings/observability_project"], + "@kbn/serverless-observability-settings/*": ["src/platform/packages/shared/serverless/settings/observability_project/*"], + "@kbn/serverless-project-switcher": ["src/platform/packages/private/serverless/project_switcher"], + "@kbn/serverless-project-switcher/*": ["src/platform/packages/private/serverless/project_switcher/*"], "@kbn/serverless-search": ["x-pack/solutions/search/plugins/serverless_search"], "@kbn/serverless-search/*": ["x-pack/solutions/search/plugins/serverless_search/*"], "@kbn/serverless-search-settings": ["src/platform/packages/shared/serverless/settings/search_project"], @@ -1716,8 +1716,8 @@ "@kbn/serverless-security-settings/*": ["src/platform/packages/shared/serverless/settings/security_project/*"], "@kbn/serverless-storybook-config": ["packages/serverless/storybook/config"], "@kbn/serverless-storybook-config/*": ["packages/serverless/storybook/config/*"], - "@kbn/serverless-types": ["packages/serverless/types"], - "@kbn/serverless-types/*": ["packages/serverless/types/*"], + "@kbn/serverless-types": ["src/platform/packages/private/serverless/types"], + "@kbn/serverless-types/*": ["src/platform/packages/private/serverless/types/*"], "@kbn/session-notifications-plugin": ["test/plugin_functional/plugins/session_notifications"], "@kbn/session-notifications-plugin/*": ["test/plugin_functional/plugins/session_notifications/*"], "@kbn/session-view-plugin": ["x-pack/solutions/security/plugins/session_view"], @@ -2002,8 +2002,8 @@ "@kbn/upgrade-assistant-plugin/*": ["x-pack/platform/plugins/private/upgrade_assistant/*"], "@kbn/uptime-plugin": ["x-pack/solutions/observability/plugins/uptime"], "@kbn/uptime-plugin/*": ["x-pack/solutions/observability/plugins/uptime/*"], - "@kbn/url-drilldown-plugin": ["x-pack/plugins/drilldowns/url_drilldown"], - "@kbn/url-drilldown-plugin/*": ["x-pack/plugins/drilldowns/url_drilldown/*"], + "@kbn/url-drilldown-plugin": ["x-pack/platform/plugins/private/drilldowns/url_drilldown"], + "@kbn/url-drilldown-plugin/*": ["x-pack/platform/plugins/private/drilldowns/url_drilldown/*"], "@kbn/url-forwarding-plugin": ["src/platform/plugins/private/url_forwarding"], "@kbn/url-forwarding-plugin/*": ["src/platform/plugins/private/url_forwarding/*"], "@kbn/usage-collection-plugin": ["src/platform/plugins/shared/usage_collection"], diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index e90a31e284c07..2f5ba408dcdd5 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -176,7 +176,7 @@ "xpack.ux": [ "solutions/observability/plugins/ux" ], - "xpack.urlDrilldown": "plugins/drilldowns/url_drilldown", + "xpack.urlDrilldown": "platform/plugins/private/drilldowns/url_drilldown", "xpack.watcher": "platform/plugins/private/watcher" }, "exclude": [ diff --git a/x-pack/packages/kbn-streams-schema/src/apis/list_streams_response.ts b/x-pack/packages/kbn-streams-schema/src/apis/list_streams_response.ts index f1f42f7e90ae2..57077c98c1ad3 100644 --- a/x-pack/packages/kbn-streams-schema/src/apis/list_streams_response.ts +++ b/x-pack/packages/kbn-streams-schema/src/apis/list_streams_response.ts @@ -5,10 +5,10 @@ * 2.0. */ import { z } from '@kbn/zod'; -import { streamDefintionSchema } from '../models'; +import { streamDefinitionSchema } from '../models'; export const listStreamsResponseSchema = z.object({ - streams: z.array(streamDefintionSchema), + streams: z.array(streamDefinitionSchema), }); export type ListStreamsResponse = z.infer; diff --git a/x-pack/packages/kbn-streams-schema/src/helpers/index.ts b/x-pack/packages/kbn-streams-schema/src/helpers/index.ts index d1f9a8ff0c50a..d9cb94d020d13 100644 --- a/x-pack/packages/kbn-streams-schema/src/helpers/index.ts +++ b/x-pack/packages/kbn-streams-schema/src/helpers/index.ts @@ -5,4 +5,5 @@ * 2.0. */ +export * from './processing'; export * from './type_guards'; diff --git a/x-pack/packages/kbn-streams-schema/src/helpers/processing.ts b/x-pack/packages/kbn-streams-schema/src/helpers/processing.ts new file mode 100644 index 0000000000000..95d7aa0b23aac --- /dev/null +++ b/x-pack/packages/kbn-streams-schema/src/helpers/processing.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Condition, ProcessingDefinition } from '../models'; +import { + isGrokProcessor, + isDissectProcessor, + isFilterCondition, + isAndCondition, + isOrCondition, +} from './type_guards'; + +export function getProcessorType(processor: ProcessingDefinition) { + if (isGrokProcessor(processor.config)) { + return 'grok'; + } + if (isDissectProcessor(processor.config)) { + return 'dissect'; + } + throw new Error('Unknown processor type'); +} + +export function isCompleteCondition(condition: Condition): boolean { + if (isFilterCondition(condition)) { + return condition.field !== undefined && condition.field !== ''; + } + if (isAndCondition(condition)) { + return condition.and.every(isCompleteCondition); + } + if (isOrCondition(condition)) { + return condition.or.every(isCompleteCondition); + } + return false; +} diff --git a/x-pack/packages/kbn-streams-schema/src/helpers/type_guards.ts b/x-pack/packages/kbn-streams-schema/src/helpers/type_guards.ts index 6e3fb3418b853..3c3be21f794d0 100644 --- a/x-pack/packages/kbn-streams-schema/src/helpers/type_guards.ts +++ b/x-pack/packages/kbn-streams-schema/src/helpers/type_guards.ts @@ -10,7 +10,7 @@ import { AndCondition, conditionSchema, dissectProcessingDefinitionSchema, - DissectProcssingDefinition, + DissectProcessingDefinition, FilterCondition, filterConditionSchema, GrokProcessingDefinition, @@ -23,7 +23,7 @@ import { ReadStreamDefinition, readStreamDefinitonSchema, StreamDefinition, - streamDefintionSchema, + streamDefinitionSchema, WiredReadStreamDefinition, wiredReadStreamDefinitonSchema, WiredStreamDefinition, @@ -60,7 +60,7 @@ export function isIngestReadStream(subject: any): subject is IngestReadStreamDef } export function isStream(subject: any): subject is StreamDefinition { - return isSchema(streamDefintionSchema, subject); + return isSchema(streamDefinitionSchema, subject); } export function isIngestStream(subject: StreamDefinition): subject is IngestStreamDefinition { @@ -97,7 +97,7 @@ export function isGrokProcessor(subject: any): subject is GrokProcessingDefiniti return isSchema(grokProcessingDefinitionSchema, subject); } -export function isDissectProcessor(subject: any): subject is DissectProcssingDefinition { +export function isDissectProcessor(subject: any): subject is DissectProcessingDefinition { return isSchema(dissectProcessingDefinitionSchema, subject); } diff --git a/x-pack/packages/kbn-streams-schema/src/models/common.ts b/x-pack/packages/kbn-streams-schema/src/models/common.ts index f3c967e52605a..4b3a8628a38ec 100644 --- a/x-pack/packages/kbn-streams-schema/src/models/common.ts +++ b/x-pack/packages/kbn-streams-schema/src/models/common.ts @@ -52,6 +52,8 @@ export const grokProcessingDefinitionSchema = z.object({ field: z.string(), patterns: z.array(z.string()), pattern_definitions: z.optional(z.record(z.string())), + ignore_failure: z.optional(z.boolean()), + ignore_missing: z.optional(z.boolean()), }), }); @@ -61,10 +63,13 @@ export const dissectProcessingDefinitionSchema = z.object({ dissect: z.object({ field: z.string(), pattern: z.string(), + append_separator: z.optional(z.string()), + ignore_failure: z.optional(z.boolean()), + ignore_missing: z.optional(z.boolean()), }), }); -export type DissectProcssingDefinition = z.infer; +export type DissectProcessingDefinition = z.infer; export const processingConfigSchema = z.union([ grokProcessingDefinitionSchema, @@ -78,8 +83,24 @@ export const processingDefinitionSchema = z.object({ export type ProcessingDefinition = z.infer; +export type ProcessorType = ProcessingDefinition['config'] extends infer U + ? U extends { [key: string]: any } + ? keyof U + : never + : never; + +export const FIELD_DEFINITION_TYPES = [ + 'keyword', + 'match_only_text', + 'long', + 'double', + 'date', + 'boolean', + 'ip', +] as const; + export const fieldDefinitionConfigSchema = z.object({ - type: z.enum(['keyword', 'match_only_text', 'long', 'double', 'date', 'boolean', 'ip']), + type: z.enum(FIELD_DEFINITION_TYPES), format: z.optional(z.string()), }); diff --git a/x-pack/packages/kbn-streams-schema/src/models/streams/stream.ts b/x-pack/packages/kbn-streams-schema/src/models/streams/stream.ts index 152397060e51b..a5e411f1674c6 100644 --- a/x-pack/packages/kbn-streams-schema/src/models/streams/stream.ts +++ b/x-pack/packages/kbn-streams-schema/src/models/streams/stream.ts @@ -9,9 +9,9 @@ import { z } from '@kbn/zod'; import { wiredStreamDefinitonSchema } from './wired_stream'; import { ingestStreamDefinitonSchema } from './ingest_stream'; -export const streamDefintionSchema = z.union([ +export const streamDefinitionSchema = z.union([ wiredStreamDefinitonSchema, ingestStreamDefinitonSchema, ]); -export type StreamDefinition = z.infer; +export type StreamDefinition = z.infer; diff --git a/x-pack/platform/plugins/shared/logs_shared/public/containers/logs/log_highlights/index.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/const.ts similarity index 65% rename from x-pack/platform/plugins/shared/logs_shared/public/containers/logs/log_highlights/index.ts rename to x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/const.ts index e448689aa281f..89ccf285229da 100644 --- a/x-pack/platform/plugins/shared/logs_shared/public/containers/logs/log_highlights/index.ts +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/const.ts @@ -5,4 +5,7 @@ * 2.0. */ -export * from './log_highlights'; +export const REACT_QUERY_KEYS = { + GET_PRODUCT_DOC_STATUS: 'get_product_doc_status', + INSTALL_PRODUCT_DOC: 'install_product_doc', +}; diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_get_product_doc_status.test.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_get_product_doc_status.test.ts new file mode 100644 index 0000000000000..1a6dc829c767a --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_get_product_doc_status.test.ts @@ -0,0 +1,62 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { waitFor, renderHook } from '@testing-library/react'; +import { useGetProductDocStatus } from './use_get_product_doc_status'; +import { useAssistantContext } from '../../../..'; +import { TestProviders } from '../../../mock/test_providers/test_providers'; + +jest.mock('../../../..', () => ({ + useAssistantContext: jest.fn(), +})); + +describe('useGetProductDocStatus', () => { + const mockGetStatus = jest.fn(); + + beforeEach(() => { + (useAssistantContext as jest.Mock).mockReturnValue({ + productDocBase: { + installation: { + getStatus: mockGetStatus, + }, + }, + }); + }); + + it('returns loading state initially', async () => { + mockGetStatus.mockResolvedValueOnce('status'); + const { result } = renderHook(() => useGetProductDocStatus(), { + wrapper: TestProviders, + }); + + expect(result.current.isLoading).toBe(true); + await waitFor(() => result.current.isSuccess); + }); + + it('returns success state with data', async () => { + mockGetStatus.mockResolvedValueOnce('status'); + const { result } = renderHook(() => useGetProductDocStatus(), { + wrapper: TestProviders, + }); + + await waitFor(() => { + expect(result.current.status).toBe('status'); + expect(result.current.isSuccess).toBe(true); + }); + }); + + it('returns error state when query fails', async () => { + mockGetStatus.mockRejectedValueOnce(new Error('error')); + const { result } = renderHook(() => useGetProductDocStatus(), { + wrapper: TestProviders, + }); + + await waitFor(() => { + expect(result.current.isError).toBe(true); + }); + }); +}); diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_get_product_doc_status.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_get_product_doc_status.ts new file mode 100644 index 0000000000000..5e516a4207cfa --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_get_product_doc_status.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useQuery } from '@tanstack/react-query'; +import { REACT_QUERY_KEYS } from './const'; +import { useAssistantContext } from '../../../..'; + +export function useGetProductDocStatus() { + const { productDocBase } = useAssistantContext(); + + const { isLoading, isError, isSuccess, isRefetching, data, refetch } = useQuery({ + queryKey: [REACT_QUERY_KEYS.GET_PRODUCT_DOC_STATUS], + queryFn: async () => { + return productDocBase.installation.getStatus(); + }, + keepPreviousData: false, + refetchOnWindowFocus: false, + }); + + return { + status: data, + refetch, + isLoading, + isRefetching, + isSuccess, + isError, + }; +} diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_install_product_doc.test.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_install_product_doc.test.ts new file mode 100644 index 0000000000000..3b3c12d6b9dc8 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_install_product_doc.test.ts @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { waitFor, renderHook } from '@testing-library/react'; +import { useInstallProductDoc } from './use_install_product_doc'; +import { useAssistantContext } from '../../../..'; +import { TestProviders } from '../../../mock/test_providers/test_providers'; + +jest.mock('../../../..', () => ({ + useAssistantContext: jest.fn(), +})); + +describe('useInstallProductDoc', () => { + const mockInstall = jest.fn(); + const mockAddSuccess = jest.fn(); + const mockAddError = jest.fn(); + + beforeEach(() => { + (useAssistantContext as jest.Mock).mockReturnValue({ + productDocBase: { + installation: { + install: mockInstall, + }, + }, + toasts: { + addSuccess: mockAddSuccess, + addError: mockAddError, + }, + }); + }); + + it('returns success state and shows success toast on successful installation', async () => { + mockInstall.mockResolvedValueOnce({}); + const { result } = renderHook(() => useInstallProductDoc(), { + wrapper: TestProviders, + }); + + result.current.mutate(); + await waitFor(() => result.current.isSuccess); + + expect(mockAddSuccess).toHaveBeenCalledWith( + 'The Elastic documentation was successfully installed' + ); + }); + + it('returns error state and shows error toast on failed installation', async () => { + const error = new Error('error message'); + mockInstall.mockRejectedValueOnce(error); + const { result } = renderHook(() => useInstallProductDoc(), { + wrapper: TestProviders, + }); + + result.current.mutate(); + await waitFor(() => result.current.isError); + + expect(mockAddError).toHaveBeenCalledWith( + expect.objectContaining({ + message: 'error message', + }), + { title: 'Something went wrong while installing the Elastic documentation' } + ); + }); +}); diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_install_product_doc.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_install_product_doc.ts new file mode 100644 index 0000000000000..b17dab7826c48 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/product_docs/use_install_product_doc.ts @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { i18n } from '@kbn/i18n'; +import type { IHttpFetchError, ResponseErrorBody } from '@kbn/core/public'; +import type { PerformInstallResponse } from '@kbn/product-doc-base-plugin/common/http_api/installation'; +import { REACT_QUERY_KEYS } from './const'; +import { useAssistantContext } from '../../../..'; + +type ServerError = IHttpFetchError; + +export function useInstallProductDoc() { + const { productDocBase, toasts } = useAssistantContext(); + const queryClient = useQueryClient(); + + return useMutation( + [REACT_QUERY_KEYS.INSTALL_PRODUCT_DOC], + () => { + return productDocBase.installation.install(); + }, + { + onSuccess: () => { + toasts?.addSuccess( + i18n.translate('xpack.elasticAssistant.kb.installProductDoc.successNotification', { + defaultMessage: 'The Elastic documentation was successfully installed', + }) + ); + + queryClient.invalidateQueries({ + queryKey: [REACT_QUERY_KEYS.GET_PRODUCT_DOC_STATUS], + refetchType: 'all', + }); + }, + onError: (error) => { + toasts?.addError(new Error(error.body?.message ?? error.message), { + title: i18n.translate('xpack.elasticAssistant.kb.installProductDoc.errorNotification', { + defaultMessage: 'Something went wrong while installing the Elastic documentation', + }), + }); + }, + } + ); +} diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/product_documentation/index.test.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/product_documentation/index.test.tsx new file mode 100644 index 0000000000000..c8700f995862f --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/product_documentation/index.test.tsx @@ -0,0 +1,87 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { ProductDocumentationManagement } from '.'; +import * as i18n from './translations'; +import { useInstallProductDoc } from '../../api/product_docs/use_install_product_doc'; +import { useGetProductDocStatus } from '../../api/product_docs/use_get_product_doc_status'; + +jest.mock('../../api/product_docs/use_install_product_doc'); +jest.mock('../../api/product_docs/use_get_product_doc_status'); + +describe('ProductDocumentationManagement', () => { + const mockInstallProductDoc = jest.fn().mockResolvedValue({}); + + beforeEach(() => { + (useInstallProductDoc as jest.Mock).mockReturnValue({ mutateAsync: mockInstallProductDoc }); + (useGetProductDocStatus as jest.Mock).mockReturnValue({ status: null, isLoading: false }); + jest.clearAllMocks(); + }); + + it('renders loading spinner when status is loading', async () => { + (useGetProductDocStatus as jest.Mock).mockReturnValue({ + status: { overall: 'not_installed' }, + isLoading: true, + }); + render(); + expect(screen.getByTestId('statusLoading')).toBeInTheDocument(); + }); + + it('renders install button when not installed', () => { + (useGetProductDocStatus as jest.Mock).mockReturnValue({ + status: { overall: 'not_installed' }, + isLoading: false, + }); + render(); + expect(screen.getByText(i18n.INSTALL)).toBeInTheDocument(); + }); + + it('does not render anything when already installed', () => { + (useGetProductDocStatus as jest.Mock).mockReturnValue({ + status: { overall: 'installed' }, + isLoading: false, + }); + const { container } = render(); + expect(container).toBeEmptyDOMElement(); + }); + + it('shows installing spinner and text when installing', async () => { + (useGetProductDocStatus as jest.Mock).mockReturnValue({ + status: { overall: 'not_installed' }, + isLoading: false, + }); + render(); + fireEvent.click(screen.getByText(i18n.INSTALL)); + await waitFor(() => { + expect(screen.getByTestId('installing')).toBeInTheDocument(); + expect(screen.getByText(i18n.INSTALLING)).toBeInTheDocument(); + }); + }); + + it('sets installed state to true after successful installation', async () => { + (useGetProductDocStatus as jest.Mock).mockReturnValue({ + status: { overall: 'not_installed' }, + isLoading: false, + }); + mockInstallProductDoc.mockResolvedValueOnce({}); + render(); + fireEvent.click(screen.getByText(i18n.INSTALL)); + await waitFor(() => expect(screen.queryByText(i18n.INSTALL)).not.toBeInTheDocument()); + }); + + it('sets installed state to false after failed installation', async () => { + (useGetProductDocStatus as jest.Mock).mockReturnValue({ + status: { overall: 'not_installed' }, + isLoading: false, + }); + mockInstallProductDoc.mockRejectedValueOnce(new Error('Installation failed')); + render(); + fireEvent.click(screen.getByText(i18n.INSTALL)); + await waitFor(() => expect(screen.getByText(i18n.INSTALL)).toBeInTheDocument()); + }); +}); diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/product_documentation/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/product_documentation/index.tsx new file mode 100644 index 0000000000000..45dc67c59784f --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/product_documentation/index.tsx @@ -0,0 +1,94 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + EuiButton, + EuiCallOut, + EuiFlexGroup, + EuiFlexItem, + EuiLoadingSpinner, + EuiSpacer, + EuiText, +} from '@elastic/eui'; +import React, { useEffect, useState, useCallback, useMemo } from 'react'; +import { useInstallProductDoc } from '../../api/product_docs/use_install_product_doc'; +import { useGetProductDocStatus } from '../../api/product_docs/use_get_product_doc_status'; +import * as i18n from './translations'; + +export const ProductDocumentationManagement: React.FC = React.memo(() => { + const [{ isInstalled, isInstalling }, setState] = useState({ + isInstalled: true, + isInstalling: false, + }); + + const { mutateAsync: installProductDoc } = useInstallProductDoc(); + const { status, isLoading: isStatusLoading } = useGetProductDocStatus(); + + useEffect(() => { + if (status) { + setState((prevState) => ({ + ...prevState, + isInstalled: status.overall === 'installed', + })); + } + }, [status]); + + const onClickInstall = useCallback(async () => { + setState((prevState) => ({ ...prevState, isInstalling: true })); + try { + await installProductDoc(); + setState({ isInstalled: true, isInstalling: false }); + } catch { + setState({ isInstalled: false, isInstalling: false }); + } + }, [installProductDoc]); + + const content = useMemo(() => { + if (isStatusLoading) { + return ; + } + if (isInstalling) { + return ( + + + {i18n.INSTALLING} + + ); + } + return ( + + + + {i18n.INSTALL} + + + + ); + }, [isInstalling, isStatusLoading, onClickInstall]); + + if (isInstalled) { + return null; + } + return ( + <> + + + {i18n.DESCRIPTION} + + + {content} + + + + ); +}); + +ProductDocumentationManagement.displayName = 'ProductDocumentationManagement'; diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/product_documentation/translations.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/product_documentation/translations.ts new file mode 100644 index 0000000000000..196eef04a2fdf --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/product_documentation/translations.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; + +export const LABEL = i18n.translate('xpack.elasticAssistant.assistant.settings.productDocLabel', { + defaultMessage: 'Elastic documentation is not installed', +}); +export const DESCRIPTION = i18n.translate( + 'xpack.elasticAssistant.assistant.settings.productDocDescription', + { + defaultMessage: + 'The Elastic Documentation has been uninstalled. Please reinstall to ensure the most accurate results from the AI Assistant.', + } +); + +export const INSTALL = i18n.translate( + 'xpack.elasticAssistant.assistant.settings.installProductDocButtonLabel', + { defaultMessage: 'Install' } +); + +export const INSTALLING = i18n.translate( + 'xpack.elasticAssistant.assistant.settings.installingText', + { defaultMessage: 'Installing...' } +); diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant_context/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant_context/index.tsx index b6fa6a4859f41..ebf85e0f86a90 100644 --- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant_context/index.tsx +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant_context/index.tsx @@ -15,6 +15,7 @@ import useSessionStorage from 'react-use/lib/useSessionStorage'; import type { DocLinksStart } from '@kbn/core-doc-links-browser'; import { AssistantFeatures, defaultAssistantFeatures } from '@kbn/elastic-assistant-common'; import { ChromeStart, NavigateToAppOptions, UserProfileService } from '@kbn/core/public'; +import type { ProductDocBasePluginStart } from '@kbn/product-doc-base-plugin/public'; import { useQuery } from '@tanstack/react-query'; import { updatePromptContexts } from './helpers'; import type { @@ -78,6 +79,7 @@ export interface AssistantProviderProps { title?: string; toasts?: IToasts; currentAppId: string; + productDocBase: ProductDocBasePluginStart; userProfileService: UserProfileService; chrome: ChromeStart; } @@ -131,6 +133,7 @@ export interface UseAssistantContext { unRegisterPromptContext: UnRegisterPromptContext; currentAppId: string; codeBlockRef: React.MutableRefObject<(codeBlock: string) => void>; + productDocBase: ProductDocBasePluginStart; userProfileService: UserProfileService; chrome: ChromeStart; } @@ -153,6 +156,7 @@ export const AssistantProvider: React.FC = ({ baseConversations, navigateToApp, nameSpace = DEFAULT_ASSISTANT_NAMESPACE, + productDocBase, title = DEFAULT_ASSISTANT_TITLE, toasts, currentAppId, @@ -291,6 +295,7 @@ export const AssistantProvider: React.FC = ({ promptContexts, navigateToApp, nameSpace, + productDocBase, registerPromptContext, selectedSettingsTab, // can be undefined from localStorage, if not defined, default to true @@ -331,6 +336,7 @@ export const AssistantProvider: React.FC = ({ promptContexts, navigateToApp, nameSpace, + productDocBase, registerPromptContext, selectedSettingsTab, localStorageStreaming, diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings_management/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings_management/index.tsx index 183e74a18247a..b47c7649dcefd 100644 --- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings_management/index.tsx +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/knowledge_base/knowledge_base_settings_management/index.tsx @@ -31,6 +31,7 @@ import { import { css } from '@emotion/react'; import { DataViewsContract } from '@kbn/data-views-plugin/public'; import useAsync from 'react-use/lib/useAsync'; +import { ProductDocumentationManagement } from '../../assistant/settings/product_documentation'; import { KnowledgeBaseTour } from '../../tour/knowledge_base'; import { AlertsSettingsManagement } from '../../assistant/settings/alerts_settings/alerts_settings_management'; import { useKnowledgeBaseEntries } from '../../assistant/api/knowledge_base/entries/use_knowledge_base_entries'; @@ -332,6 +333,7 @@ export const KnowledgeBaseSettingsManagement: React.FC = React.memo(({ d return ( <> + = ({ navigateToApp={mockNavigateToApp} {...providerContext} currentAppId={'test'} + productDocBase={{ + installation: { getStatus: jest.fn(), install: jest.fn(), uninstall: jest.fn() }, + }} userProfileService={jest.fn() as unknown as UserProfileService} chrome={chrome} > diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json b/x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json index c3513b4537f68..95c51c0d85119 100644 --- a/x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json @@ -37,5 +37,6 @@ "@kbn/core-chrome-browser-mocks", "@kbn/core-chrome-browser", "@kbn/ai-assistant-icon", + "@kbn/product-doc-base-plugin", ] } diff --git a/x-pack/platform/plugins/private/banners/server/routes/info.ts b/x-pack/platform/plugins/private/banners/server/routes/info.ts index 17d60cdbc532f..110ddf9b53872 100644 --- a/x-pack/platform/plugins/private/banners/server/routes/info.ts +++ b/x-pack/platform/plugins/private/banners/server/routes/info.ts @@ -15,6 +15,12 @@ export const registerInfoRoute = (router: BannersRouter, config: BannersConfigTy router.get( { path: '/api/banners/info', + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: false, options: { authRequired: 'optional', diff --git a/x-pack/platform/plugins/private/custom_branding/server/routes/info.ts b/x-pack/platform/plugins/private/custom_branding/server/routes/info.ts index 83921db247782..d856f7959bb2f 100644 --- a/x-pack/platform/plugins/private/custom_branding/server/routes/info.ts +++ b/x-pack/platform/plugins/private/custom_branding/server/routes/info.ts @@ -13,6 +13,13 @@ export const registerInfoRoute = (router: CustomBrandingRouter) => { router.get( { path: '/api/custom_branding/info', + security: { + authz: { + enabled: false, + reason: + 'This route is opted out from authorization, because this route is rather a status check route than a data fetching route', + }, + }, validate: false, options: { authRequired: 'optional', diff --git a/x-pack/plugins/drilldowns/url_drilldown/README.md b/x-pack/platform/plugins/private/drilldowns/url_drilldown/README.md similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/README.md rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/README.md diff --git a/x-pack/platform/plugins/private/drilldowns/url_drilldown/jest.config.js b/x-pack/platform/plugins/private/drilldowns/url_drilldown/jest.config.js new file mode 100644 index 0000000000000..0dfd29be8e328 --- /dev/null +++ b/x-pack/platform/plugins/private/drilldowns/url_drilldown/jest.config.js @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../../../../..', + roots: ['/x-pack/platform/plugins/private/drilldowns/url_drilldown'], + coverageDirectory: + '/target/kibana-coverage/jest/x-pack/platform/plugins/private/drilldowns/url_drilldown', + coverageReporters: ['text', 'html'], + collectCoverageFrom: [ + '/x-pack/platform/plugins/private/drilldowns/url_drilldown/{common,public,server}/**/*.{ts,tsx}', + ], +}; diff --git a/x-pack/plugins/drilldowns/url_drilldown/kibana.jsonc b/x-pack/platform/plugins/private/drilldowns/url_drilldown/kibana.jsonc similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/kibana.jsonc rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/kibana.jsonc diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/index.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/index.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/index.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/index.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/i18n.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/i18n.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/i18n.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/i18n.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/index.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/index.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/index.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/index.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/test/data.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/test/data.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/test/data.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/test/data.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/url_drilldown.test.tsx b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/url_drilldown.test.tsx similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/url_drilldown.test.tsx rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/url_drilldown.test.tsx diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/url_drilldown.tsx b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/url_drilldown.tsx similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/url_drilldown.tsx rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/url_drilldown.tsx diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/context_variables.test.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/context_variables.test.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/context_variables.test.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/context_variables.test.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/context_variables.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/context_variables.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/context_variables.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/context_variables.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/event_variables.test.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/event_variables.test.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/event_variables.test.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/event_variables.test.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/event_variables.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/event_variables.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/event_variables.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/event_variables.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/global_variables.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/global_variables.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/global_variables.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/global_variables.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/i18n.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/i18n.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/i18n.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/i18n.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/util.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/util.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/lib/variables/util.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/lib/variables/util.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/plugin.ts b/x-pack/platform/plugins/private/drilldowns/url_drilldown/public/plugin.ts similarity index 100% rename from x-pack/plugins/drilldowns/url_drilldown/public/plugin.ts rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/public/plugin.ts diff --git a/x-pack/plugins/drilldowns/url_drilldown/tsconfig.json b/x-pack/platform/plugins/private/drilldowns/url_drilldown/tsconfig.json similarity index 92% rename from x-pack/plugins/drilldowns/url_drilldown/tsconfig.json rename to x-pack/platform/plugins/private/drilldowns/url_drilldown/tsconfig.json index 7da816978edcf..8c018bb451e39 100644 --- a/x-pack/plugins/drilldowns/url_drilldown/tsconfig.json +++ b/x-pack/platform/plugins/private/drilldowns/url_drilldown/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", }, diff --git a/x-pack/platform/plugins/private/reporting/server/routes/internal/deprecations/deprecations.ts b/x-pack/platform/plugins/private/reporting/server/routes/internal/deprecations/deprecations.ts index 407d126940ae4..daf56d7233b40 100644 --- a/x-pack/platform/plugins/private/reporting/server/routes/internal/deprecations/deprecations.ts +++ b/x-pack/platform/plugins/private/reporting/server/routes/internal/deprecations/deprecations.ts @@ -63,6 +63,12 @@ export const registerDeprecationsRoutes = (reporting: ReportingCore, logger: Log router.get( { path: getStatusPath, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: false, options: { access: 'internal' }, }, @@ -100,6 +106,12 @@ export const registerDeprecationsRoutes = (reporting: ReportingCore, logger: Log router.put( { path: migrateApiPath, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: false, options: { access: 'internal' }, }, diff --git a/x-pack/platform/plugins/private/reporting/server/routes/internal/diagnostic/browser.ts b/x-pack/platform/plugins/private/reporting/server/routes/internal/diagnostic/browser.ts index 71d8e1e15e74f..f90cca1125515 100644 --- a/x-pack/platform/plugins/private/reporting/server/routes/internal/diagnostic/browser.ts +++ b/x-pack/platform/plugins/private/reporting/server/routes/internal/diagnostic/browser.ts @@ -51,6 +51,12 @@ export const registerDiagnoseBrowser = (reporting: ReportingCore, logger: Logger router.get( { path, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: false, options: { access: 'internal' }, }, diff --git a/x-pack/platform/plugins/private/reporting/server/routes/internal/generate/generate_from_jobparams.ts b/x-pack/platform/plugins/private/reporting/server/routes/internal/generate/generate_from_jobparams.ts index f8ee55cc12fb5..bd26c88bf6a0a 100644 --- a/x-pack/platform/plugins/private/reporting/server/routes/internal/generate/generate_from_jobparams.ts +++ b/x-pack/platform/plugins/private/reporting/server/routes/internal/generate/generate_from_jobparams.ts @@ -18,15 +18,23 @@ export function registerGenerationRoutesInternal(reporting: ReportingCore, logge const setupDeps = reporting.getPluginSetupDeps(); const { router } = setupDeps; - const kibanaAccessControlTags = ['access:generateReport']; + const kibanaAccessControlTags = ['generateReport']; const registerInternalPostGenerationEndpoint = () => { const path = `${GENERATE_PREFIX}/{exportType}`; router.post( { path, + security: { + authz: { + requiredPrivileges: kibanaAccessControlTags, + }, + }, validate: RequestHandler.getValidation(), - options: { tags: kibanaAccessControlTags, access: 'internal' }, + options: { + tags: kibanaAccessControlTags.map((accessControlTag) => `access:${accessControlTag}`), + access: 'internal', + }, }, authorizedUserPreRouting(reporting, async (user, context, req, res) => { try { diff --git a/x-pack/platform/plugins/private/reporting/server/routes/internal/management/jobs.ts b/x-pack/platform/plugins/private/reporting/server/routes/internal/management/jobs.ts index c501f73d43698..492d579727c51 100644 --- a/x-pack/platform/plugins/private/reporting/server/routes/internal/management/jobs.ts +++ b/x-pack/platform/plugins/private/reporting/server/routes/internal/management/jobs.ts @@ -30,6 +30,12 @@ export function registerJobInfoRoutesInternal(reporting: ReportingCore) { router.get( { path, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: { query: schema.object({ page: schema.string({ defaultValue: '0' }), @@ -72,6 +78,12 @@ export function registerJobInfoRoutesInternal(reporting: ReportingCore) { router.get( { path, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: false, options: { access: 'internal' }, }, @@ -107,6 +119,12 @@ export function registerJobInfoRoutesInternal(reporting: ReportingCore) { router.get( { path, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: jobHandlers.validate, options: { access: 'internal' }, }, @@ -145,6 +163,12 @@ export function registerJobInfoRoutesInternal(reporting: ReportingCore) { router.get( { path, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: jobHandlers.validate, options: { tags: [ROUTE_TAG_CAN_REDIRECT], access: 'internal' }, }, @@ -161,6 +185,12 @@ export function registerJobInfoRoutesInternal(reporting: ReportingCore) { router.delete( { path, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: jobHandlers.validate, options: { access: 'internal' }, }, diff --git a/x-pack/platform/plugins/private/reporting/server/routes/public/generate_from_jobparams.ts b/x-pack/platform/plugins/private/reporting/server/routes/public/generate_from_jobparams.ts index 1f901634f3f00..f547faa9cab52 100644 --- a/x-pack/platform/plugins/private/reporting/server/routes/public/generate_from_jobparams.ts +++ b/x-pack/platform/plugins/private/reporting/server/routes/public/generate_from_jobparams.ts @@ -16,15 +16,23 @@ export function registerGenerationRoutesPublic(reporting: ReportingCore, logger: const setupDeps = reporting.getPluginSetupDeps(); const { router } = setupDeps; - const kibanaAccessControlTags = ['access:generateReport']; + const kibanaAccessControlTags = ['generateReport']; const registerPublicPostGenerationEndpoint = () => { const path = `${PUBLIC_ROUTES.GENERATE_PREFIX}/{exportType}`; router.post( { path, + security: { + authz: { + requiredPrivileges: kibanaAccessControlTags, + }, + }, validate: RequestHandler.getValidation(), - options: { tags: kibanaAccessControlTags, access: 'public' }, + options: { + tags: kibanaAccessControlTags.map((controlAccessTag) => `access:${controlAccessTag}`), + access: 'public', + }, }, authorizedUserPreRouting(reporting, async (user, context, req, res) => { try { @@ -56,6 +64,12 @@ export function registerGenerationRoutesPublic(reporting: ReportingCore, logger: router.get( { path: `${PUBLIC_ROUTES.GENERATE_PREFIX}/{p*}`, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: false, options: { access: 'public' }, }, diff --git a/x-pack/platform/plugins/private/reporting/server/routes/public/jobs.ts b/x-pack/platform/plugins/private/reporting/server/routes/public/jobs.ts index 04d417c4eb89f..cf2b13fafffd8 100644 --- a/x-pack/platform/plugins/private/reporting/server/routes/public/jobs.ts +++ b/x-pack/platform/plugins/private/reporting/server/routes/public/jobs.ts @@ -24,6 +24,12 @@ export function registerJobInfoRoutesPublic(reporting: ReportingCore) { router.get( { path, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: jobHandlers.validate, options: { tags: [ROUTE_TAG_CAN_REDIRECT], access: 'public' }, }, @@ -39,6 +45,12 @@ export function registerJobInfoRoutesPublic(reporting: ReportingCore) { router.delete( { path, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: jobHandlers.validate, options: { access: 'public' }, }, diff --git a/x-pack/platform/plugins/private/telemetry_collection_xpack/server/telemetry_collection/get_license.ts b/x-pack/platform/plugins/private/telemetry_collection_xpack/server/telemetry_collection/get_license.ts index 11f2b1359ab13..4a13dd72f8cef 100644 --- a/x-pack/platform/plugins/private/telemetry_collection_xpack/server/telemetry_collection/get_license.ts +++ b/x-pack/platform/plugins/private/telemetry_collection_xpack/server/telemetry_collection/get_license.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type * as estypes from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchClient } from '@kbn/core/server'; export type ESLicense = estypes.LicenseGetLicenseInformation; diff --git a/x-pack/platform/plugins/private/telemetry_collection_xpack/server/telemetry_collection/get_stats_with_xpack.test.ts b/x-pack/platform/plugins/private/telemetry_collection_xpack/server/telemetry_collection/get_stats_with_xpack.test.ts index f2adb257f9cb6..436acb643d8a4 100644 --- a/x-pack/platform/plugins/private/telemetry_collection_xpack/server/telemetry_collection/get_stats_with_xpack.test.ts +++ b/x-pack/platform/plugins/private/telemetry_collection_xpack/server/telemetry_collection/get_stats_with_xpack.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type * as estypes from '@elastic/elasticsearch/lib/api/types'; import { coreMock, elasticsearchServiceMock } from '@kbn/core/server/mocks'; import { getStatsWithXpack } from './get_stats_with_xpack'; import { SavedObjectsClient } from '@kbn/core/server'; diff --git a/x-pack/platform/plugins/private/translations/translations/fr-FR.json b/x-pack/platform/plugins/private/translations/translations/fr-FR.json index 3cc5b90ac84c2..4f2e66adc349a 100644 --- a/x-pack/platform/plugins/private/translations/translations/fr-FR.json +++ b/x-pack/platform/plugins/private/translations/translations/fr-FR.json @@ -593,7 +593,6 @@ "contentManagement.tableList.listing.userFilter.errorMessage": "Échec de chargement des utilisateurs", "contentManagement.tableList.listing.userFilter.filterLabel": "Créé par", "contentManagement.tableList.listing.userFilter.noCreators": "Aucun créateur", - "contentManagement.tableList.mainColumnName": "Nom, description, balises", "contentManagement.tableList.managedItemNoEdit": "Elastic gère cet objet. Clonez-le pour effectuer des modifications.", "contentManagement.tableList.tabsFilter.allTabLabel": "Tous", "contentManagement.tableList.tabsFilter.favoriteTabLabel": "Éléments avec étoiles", @@ -21965,7 +21964,6 @@ "xpack.infra.analysisSetup.steps.setupProcess.viewResultsButton": "Afficher les résultats", "xpack.infra.analysisSetup.timeRangeDescription": "Par défaut, le Machine Learning analyse les messages de logs dans vos index de logs n'excédant pas quatre semaines et continue indéfiniment. Vous pouvez spécifier une date de début, de fin ou les deux différente.", "xpack.infra.analysisSetup.timeRangeTitle": "Choisir une plage temporelle", - "xpack.infra.appName": "Logs Infra", "xpack.infra.assetDetails.alerts.tooltip.alertsLabel": "Affichage des alertes pour cet hôte. Vous pouvez créer et gérer les alertes dans {alerts}", "xpack.infra.assetDetails.alerts.tooltip.documentationLabel": "Pour en savoir plus, consultez la {documentation}", "xpack.infra.assetDetails.alerts.tooltip.documentationLink": "documentation", @@ -22375,7 +22373,6 @@ "xpack.infra.logs.analysis.logEntryCategoriesModuleName": "Catégorisation", "xpack.infra.logs.analysis.logEntryExamplesViewAnomalyInMlLabel": "Afficher l'anomalie dans le Machine Learning", "xpack.infra.logs.analysis.logEntryExamplesViewDetailsLabel": "Afficher les détails", - "xpack.infra.logs.analysis.logEntryExamplesViewInStreamLabel": "Afficher dans le flux", "xpack.infra.logs.analysis.logEntryRateModuleDescription": "Utilisez le Machine Learning pour détecter automatiquement les taux d'entrées de logs anormaux.", "xpack.infra.logs.analysis.logEntryRateModuleName": "Taux du log", "xpack.infra.logs.analysis.manageMlJobsButtonLabel": "Gérer les tâches ML", @@ -22399,23 +22396,9 @@ "xpack.infra.logs.analysisPage.unavailable.mlAppLink": "Application de Machine Learning", "xpack.infra.logs.anomaliesPageTitle": "Anomalies", "xpack.infra.logs.categoryExample.viewInContextText": "Afficher en contexte", - "xpack.infra.logs.categoryExample.viewInStreamText": "Afficher dans le flux", - "xpack.infra.logs.common.invalidStateCalloutTitle": "État non valide rencontré", - "xpack.infra.logs.common.invalidStateMessage": "Impossible de traiter l'état {stateValue}.", - "xpack.infra.logs.customizeLogs.customizeButtonLabel": "Personnaliser", - "xpack.infra.logs.customizeLogs.lineWrappingFormRowLabel": "Retour automatique à la ligne", - "xpack.infra.logs.customizeLogs.textSizeFormRowLabel": "Taille du texte", - "xpack.infra.logs.customizeLogs.textSizeRadioGroup": "{textScale, select, small {Petit} medium {Moyen} large {Grand} other {{textScale}} }", - "xpack.infra.logs.customizeLogs.wrapLongLinesSwitchLabel": "Formater les longues lignes", - "xpack.infra.logs.highlights.clearHighlightTermsButtonLabel": "Effacer les termes à mettre en surbrillance", - "xpack.infra.logs.highlights.goToNextHighlightButtonLabel": "Passer au surlignage suivant", - "xpack.infra.logs.highlights.goToPreviousHighlightButtonLabel": "Passer au surlignage précédent", - "xpack.infra.logs.highlights.highlightsPopoverButtonLabel": "Surlignages", - "xpack.infra.logs.highlights.highlightTermsFieldLabel": "Termes à mettre en surbrillance", "xpack.infra.logs.index.anomaliesTabTitle": "Anomalies des logs", "xpack.infra.logs.index.logCategoriesBetaBadgeTitle": "Catégories de logs", "xpack.infra.logs.index.settingsTabTitle": "Paramètres", - "xpack.infra.logs.index.streamTabTitle": "Flux", "xpack.infra.logs.logCategoriesTitle": "Catégories", "xpack.infra.logs.logEntryCategories.analyzeCategoryInMlButtonLabel": "Analyse dans ML", "xpack.infra.logs.logEntryCategories.analyzeCategoryInMlTooltipDescription": "Analysez cette catégorie dans l'application ML.", @@ -22451,42 +22434,10 @@ "xpack.infra.logs.noDataConfig.beatsCard.title": "Ajouter une intégration au logging", "xpack.infra.logs.noDataConfig.solutionName": "Observabilité", "xpack.infra.logs.pluginTitle": "Logs", - "xpack.infra.logs.search.nextButtonLabel": "Suivant", - "xpack.infra.logs.search.previousButtonLabel": "Précédent", - "xpack.infra.logs.search.searchInLogsAriaLabel": "rechercher", - "xpack.infra.logs.search.searchInLogsPlaceholder": "Recherche", - "xpack.infra.logs.searchResultTooltip": "{bucketCount, plural, one {# entrée mise en surbrillance} other {# entrées mises en surbrillance}}", - "xpack.infra.logs.settings.inlineLogViewCalloutButtonText": "Revenir à la vue par défaut du flux de logs", - "xpack.infra.logs.settings.inlineLogViewCalloutWidgetDescription": "Les modifications seront synchronisées avec l'URL, mais elles ne seront pas conservées dans la vue par défaut du flux de logs.", - "xpack.infra.logs.settings.inlineLogViewCalloutWidgetTitle": "Vous configurez un widget intégré", - "xpack.infra.logs.startStreamingButtonLabel": "Diffuser en direct", - "xpack.infra.logs.stopStreamingButtonLabel": "Arrêter la diffusion", - "xpack.infra.logs.streamPageTitle": "Flux", "xpack.infra.logs.viewInContext.logsFromContainerTitle": "Les logs affichés proviennent du conteneur {container}", "xpack.infra.logs.viewInContext.logsFromFileTitle": "Les logs affichés proviennent du fichier {file} et de l'hôte {host}", "xpack.infra.logsDeprecationCallout.euiCallOut.discoverANewLogLabel": "Il existe une nouvelle (et meilleure) façon d'explorer vos logs !", "xpack.infra.logsHeaderAddDataButtonLabel": "Ajouter des données", - "xpack.infra.logSourceConfiguration.childFormElementErrorMessage": "L'état d'au moins un champ du formulaire est non valide.", - "xpack.infra.logSourceConfiguration.dataViewDescription": "Vue de données contenant les données de log", - "xpack.infra.logSourceConfiguration.dataViewLabel": "Vue de données de log", - "xpack.infra.logSourceConfiguration.dataViewSectionTitle": "Vue de données (déclassée)", - "xpack.infra.logSourceConfiguration.dataViewSelectorPlaceholder": "Choisir une vue de données", - "xpack.infra.logSourceConfiguration.dataViewsManagementLinkText": "écran de gestion des vues de données", - "xpack.infra.logSourceConfiguration.dataViewTitle": "Vue de données de log", - "xpack.infra.logSourceConfiguration.emptyColumnListErrorMessage": "La liste de colonnes ne doit pas être vide.", - "xpack.infra.logSourceConfiguration.emptyFieldErrorMessage": "Le champ \"{fieldName}\" ne doit pas être vide.", - "xpack.infra.logSourceConfiguration.includesSpacesErrorMessage": "Le champ \"{fieldName}\" ne doit pas contenir d’espaces.", - "xpack.infra.logSourceConfiguration.invalidMessageFieldTypeErrorMessage": "Le champ {messageField} doit être un champ textuel.", - "xpack.infra.logSourceConfiguration.kibanaAdvancedSettingSectionTitle": "Paramètres avancés des sources de logs Kibana", - "xpack.infra.logSourceConfiguration.logDataViewHelpText": "Les vues de données sont partagées entre les applications dans l'espace Kibana et peuvent être gérées via l’{dataViewsManagementLink}. Une vue de données peut cibler plusieurs index.", - "xpack.infra.logSourceConfiguration.logSourceConfigurationFormErrorsCalloutTitle": "Configuration de la source incohérente", - "xpack.infra.logSourceConfiguration.logSourcesTitle": "Sources de log", - "xpack.infra.logSourceConfiguration.missingDataViewErrorMessage": "La vue de données {dataViewId} doit exister.", - "xpack.infra.logSourceConfiguration.missingDataViewsLabel": "Vue de données {indexPatternId} manquante", - "xpack.infra.logSourceConfiguration.missingMessageFieldErrorMessage": "La vue de données doit contenir un champ {messageField}.", - "xpack.infra.logSourceConfiguration.missingTimestampFieldErrorMessage": "La vue de données doit être basée sur le temps.", - "xpack.infra.logSourceConfiguration.rollupIndexPatternErrorMessage": "La vue de données ne doit pas être un modèle d'indexation de cumul.", - "xpack.infra.logSourceConfiguration.unsavedFormPromptMessage": "Voulez-vous vraiment quitter ? Les modifications seront perdues", "xpack.infra.logSourceErrorPage.failedToLoadSourceMessage": "Des erreurs se sont produites lors du chargement de la configuration. Réessayez ou modifiez la configuration pour résoudre le problème.", "xpack.infra.logSourceErrorPage.failedToLoadSourceTitle": "Impossible de charger la configuration", "xpack.infra.logSourceErrorPage.fetchLogSourceConfigurationErrorTitle": "Impossible de charger la configuration de la source de logs", @@ -22495,13 +22446,7 @@ "xpack.infra.logSourceErrorPage.resolveLogSourceConfigurationErrorTitle": "Impossible de résoudre la configuration de la source de logs", "xpack.infra.logSourceErrorPage.savedObjectNotFoundErrorMessage": "Impossible de localiser ce {savedObjectType} : {savedObjectId}", "xpack.infra.logSourceErrorPage.tryAgainButtonLabel": "Réessayer", - "xpack.infra.logsPage.toolbar.kqlSearchFieldPlaceholder": "Recherche d'entrées de log… (par ex. host.name:host-1)", - "xpack.infra.logsPage.toolbar.logFilterErrorToastTitle": "Erreur de filtrage du log", - "xpack.infra.logsSettingsPage.loadingButtonLabel": "Chargement", "xpack.infra.logsStreamEmbeddable.deprecationWarningDescription": "La maintenance des panneaux de flux de logs n'est plus assurée. Essayez d'utiliser {savedSearchDocsLink} pour une visualisation similaire.", - "xpack.infra.logStreamPageTemplate.backtoLogsStream": "Retour au flux de logs", - "xpack.infra.logStreamPageTemplate.widgetBadge": "Widget", - "xpack.infra.logStreamPageTemplate.widgetDescription": "Vous visionnez un widget intégré. Les modifications seront synchronisées avec l'URL, mais elles ne seront pas conservées dans la vue par défaut du flux de logs.", "xpack.infra.metadata.pinAriaLabel": "Champ épinglé", "xpack.infra.metadataEmbeddable.AddFilterAriaLabel": "Ajouter un filtre", "xpack.infra.metadataEmbeddable.errorAction": "récupérer de nouveau les métadonnées", @@ -22856,9 +22801,6 @@ "xpack.infra.ml.aomalyFlyout.jobSetup.flyoutHeader": "Activer le Machine Learning pour {nodeType}", "xpack.infra.ml.metricsHostModuleDescription": "Utilisez le Machine Learning pour détecter automatiquement les taux d'entrées de logs anormaux.", "xpack.infra.ml.metricsModuleName": "Détection des anomalies d'indicateurs", - "xpack.infra.ml.splash.inlineLogView.buttonText": "Revenir à la vue de log (persistante) par défaut", - "xpack.infra.ml.splash.inlineLogView.description": "Cette fonctionnalité ne prend pas en charge les vues de journal en ligne.", - "xpack.infra.ml.splash.inlineLogView.title": "Basculer vers la vue de log persistante", "xpack.infra.ml.splash.loadingMessage": "Vérification de la licence...", "xpack.infra.ml.splash.startTrialCta": "Démarrer l'essai", "xpack.infra.ml.splash.startTrialDescription": "Notre essai gratuit inclut les fonctionnalités de Machine Learning, qui vous permettent de détecter les anomalies dans vos logs.", @@ -22949,28 +22891,14 @@ "xpack.infra.savedView.updateView": "Mettre à jour la vue", "xpack.infra.showHistory": "Afficher l'historique", "xpack.infra.snapshot.missingSnapshotMetricError": "L'agrégation de {metric} pour {nodeType} n'est pas disponible.", - "xpack.infra.sourceConfiguration.addLogColumnButtonLabel": "Ajouter une colonne", "xpack.infra.sourceConfiguration.anomalyThresholdDescription": "Définit le score de sévérité minimal requis pour afficher les anomalies dans l'application Metrics.", "xpack.infra.sourceConfiguration.anomalyThresholdLabel": "Score de sévérité minimal", "xpack.infra.sourceConfiguration.anomalyThresholdTitle": "Seuil de sévérité d'anomalie", - "xpack.infra.sourceConfiguration.applySettingsButtonLabel": "Appliquer", - "xpack.infra.sourceConfiguration.discardSettingsButtonLabel": "Abandonner", "xpack.infra.sourceConfiguration.featuresSectionTitle": "Fonctionnalités", "xpack.infra.sourceConfiguration.fieldContainEmptyEntryErrorMessage": "Le champ ne doit pas inclure de valeurs vides séparées par des virgules.", "xpack.infra.sourceConfiguration.fieldContainSpacesErrorMessage": "Le champ ne doit pas contenir d'espaces.", "xpack.infra.sourceConfiguration.fieldEmptyErrorMessage": "Le champ ne doit pas être vide.", - "xpack.infra.sourceConfiguration.fieldLogColumnTitle": "Champ", "xpack.infra.sourceConfiguration.indicesSectionTitle": "Index", - "xpack.infra.sourceConfiguration.logColumnsSectionTitle": "Colonnes de log", - "xpack.infra.sourceConfiguration.logIndices.viewAffectedRulesLink": "Afficher les règles affectées", - "xpack.infra.sourceConfiguration.logIndicesDescription": "Modèle d'indexation pour la correspondance d'index contenant des données de log", - "xpack.infra.sourceConfiguration.logIndicesLabel": "Index de log", - "xpack.infra.sourceConfiguration.logIndicesRecommendedValue": "La valeur recommandée est {defaultValue}", - "xpack.infra.sourceConfiguration.logIndicesTitle": "Index de log", - "xpack.infra.sourceConfiguration.logsIndicesSectionTitle": "Index (déclassés)", - "xpack.infra.sourceConfiguration.logsIndicesUsedByRulesMessage": "Une ou plusieurs règles d’alerte reposent sur ce paramètre de source de données. La modification de ce paramètre modifiera les données utilisées pour générer des alertes.", - "xpack.infra.sourceConfiguration.logsIndicesUsedByRulesTitle": "Les règles d'alerte utilisent ce paramètre de source de données", - "xpack.infra.sourceConfiguration.messageLogColumnDescription": "Ce champ système affiche le message d'entrée de log dérivé des champs de document.", "xpack.infra.sourceConfiguration.metricIndices.viewAffectedRulesLink": "Afficher les règles affectées", "xpack.infra.sourceConfiguration.metricIndicesDescription": "Modèle d'indexation pour la correspondance d'index contenant des données d'indicateurs", "xpack.infra.sourceConfiguration.metricIndicesDoNotExist": "Impossible de trouver des données d’indicateurs car le modèle saisi ne correspond à aucun index.", @@ -22985,16 +22913,11 @@ "xpack.infra.sourceConfiguration.nameDescription": "Nom descriptif pour la configuration de la source", "xpack.infra.sourceConfiguration.nameLabel": "Nom", "xpack.infra.sourceConfiguration.nameSectionTitle": "Nom", - "xpack.infra.sourceConfiguration.noLogColumnsDescription": "Ajoutez une colonne à cette liste à l'aide du bouton ci-dessus.", - "xpack.infra.sourceConfiguration.noLogColumnsTitle": "Aucune colonne", "xpack.infra.sourceConfiguration.noRemoteClusterMessage": "Nous ne parvenons pas à nous connecter au cluster distant, ce qui nous empêche de récupérer les indicateurs et les données dont vous avez besoin. Pour résoudre ce problème, vérifiez la configuration de vos index et assurez-vous qu'elle est correctement effectuée.", "xpack.infra.sourceConfiguration.noRemoteClusterTitle": "Impossible de se connecter au serveur distant", "xpack.infra.sourceConfiguration.remoteClusterConnectionDoNotExist": "Vérifiez que le cluster distant est disponible ou que les paramètres de connexion à distance sont corrects.", "xpack.infra.sourceConfiguration.remoteClusterConnectionDoNotExistTitle": "Impossible de se connecter au cluster distant", - "xpack.infra.sourceConfiguration.removeLogColumnButtonLabel": "Retirer la colonne {columnDescription}", "xpack.infra.sourceConfiguration.saveButton": "Enregistrer les modifications", - "xpack.infra.sourceConfiguration.systemColumnBadgeLabel": "Système", - "xpack.infra.sourceConfiguration.timestampLogColumnDescription": "Ce champ système affiche l'heure de l'entrée de log telle que déterminée par le paramètre du champ {timestampSetting}.", "xpack.infra.sourceConfiguration.unsavedFormPrompt": "Voulez-vous vraiment quitter ? Les modifications seront perdues", "xpack.infra.sourceConfiguration.updateFailureBody": "Nous n'avons pas pu appliquer les modifications à la configuration des indicateurs. Réessayez plus tard.", "xpack.infra.sourceConfiguration.updateFailureTitle": "La mise à jour de la configuration a échoué", @@ -23922,7 +23845,6 @@ "xpack.ingestPipelines.testPipelineFlyout.successNotificationText": "Pipeline exécuté", "xpack.ingestPipelines.testPipelineFlyout.title": "Pipeline de test", "xpack.integrationAssistant.bottomBar.addToElastic": "Ajouter à Elastic", - "xpack.integrationAssistant.bottomBar.analyzeCel": "Générer la configuration d'entrée CEL", "xpack.integrationAssistant.bottomBar.analyzeLogs": "Analyser les logs", "xpack.integrationAssistant.bottomBar.close": "Fermer", "xpack.integrationAssistant.bottomBar.loading": "Chargement", @@ -23978,17 +23900,6 @@ "xpack.integrationAssistant.missingPrivileges.title": "Privilèges manquants", "xpack.integrationAssistant.pages.header.avatarTitle": "Alimenté par l’IA générative", "xpack.integrationAssistant.pages.header.title": "Nouvelle intégration", - "xpack.integrationAssistant.step.celInput.apiDefinition.description": "Glissez et déposez un fichier ou parcourez les fichiers.", - "xpack.integrationAssistant.step.celInput.apiDefinition.description2": "Spécifications relatives à OpenAPI", - "xpack.integrationAssistant.step.celInput.apiDefinition.label": "Spéc. relatives à OpenAPI", - "xpack.integrationAssistant.step.celInput.celInputDescription": "Chargez un fichier de spécifications OpenAPI pour générer une configuration pour l'entrée CEL", - "xpack.integrationAssistant.step.celInput.celInputTitle": "Générer la configuration d'entrée CEL", - "xpack.integrationAssistant.step.celInput.generationError": "Une erreur s'est produite durant : Génération d'entrée CEL", - "xpack.integrationAssistant.step.celInput.openapiSpec.errorCanNotRead": "Impossible de lire le fichier de logs exemple", - "xpack.integrationAssistant.step.celInput.openapiSpec.errorCanNotReadWithReason": "Une erreur s'est produite lors de la lecture du fichier de spécifications : {reason}", - "xpack.integrationAssistant.step.celInput.openapiSpec.errorTooLargeToParse": "Ce fichier de spécifications est trop volumineux pour être analysé", - "xpack.integrationAssistant.step.celInput.progress.relatedGraph": "Génération de la configuration d'entrée CEL", - "xpack.integrationAssistant.step.celInput.retryButtonLabel": "Réessayer", "xpack.integrationAssistant.step.connector": "Connecteur", "xpack.integrationAssistant.step.dataStream": "Flux de données", "xpack.integrationAssistant.step.dataStream.analyzing": "Analyse", @@ -24040,12 +23951,6 @@ "xpack.integrationAssistant.step.review.ingestPipelineTitle": "Pipeline d'ingestion", "xpack.integrationAssistant.step.review.save": "Enregistrer", "xpack.integrationAssistant.step.review.title": "Examiner les résultats", - "xpack.integrationAssistant.step.reviewCel.description": "Vérifiez les paramètres de configuration d'entrée CEL générés pour votre intégration. Ces paramètres seront automatiquement renseignés dans la configuration d'intégration où la modification sera possible.", - "xpack.integrationAssistant.step.reviewCel.program": "Le programme CEL à exécuter pour chaque sondage", - "xpack.integrationAssistant.step.reviewCel.redact": "Champs à adapter", - "xpack.integrationAssistant.step.reviewCel.save": "Enregistrer", - "xpack.integrationAssistant.step.reviewCel.state": "État initial de l'évaluation du CEL", - "xpack.integrationAssistant.step.reviewCel.title": "Examiner les résultats", "xpack.integrationAssistant.steps.connector.createConnectorLabel": "Créer un nouveau connecteur", "xpack.integrationAssistant.steps.connector.description": "Sélectionnez un connecteur d’IA pour vous aider à créer votre intégration personnalisée", "xpack.integrationAssistant.steps.connector.supportedModelsInfo": "Pour une expérience optimale, nous recommandons actuellement d'utiliser un fournisseur prenant en charge les nouveaux modèles Claude. Nous travaillons actuellement à l'ajout d'une meilleure prise en charge de GPT-4 et de modèles similaires", diff --git a/x-pack/platform/plugins/private/translations/translations/ja-JP.json b/x-pack/platform/plugins/private/translations/translations/ja-JP.json index b3350c31ef305..dd966042483a8 100644 --- a/x-pack/platform/plugins/private/translations/translations/ja-JP.json +++ b/x-pack/platform/plugins/private/translations/translations/ja-JP.json @@ -595,7 +595,6 @@ "contentManagement.tableList.listing.userFilter.errorMessage": "ユーザーの読み込みに失敗しました", "contentManagement.tableList.listing.userFilter.filterLabel": "作成者", "contentManagement.tableList.listing.userFilter.noCreators": "作成担当なし", - "contentManagement.tableList.mainColumnName": "名前、説明、タグ", "contentManagement.tableList.managedItemNoEdit": "Elasticはこの項目を管理します。変更するには、複製してください。", "contentManagement.tableList.tabsFilter.allTabLabel": "すべて", "contentManagement.tableList.tabsFilter.favoriteTabLabel": "スター付き", @@ -21826,7 +21825,6 @@ "xpack.infra.analysisSetup.steps.setupProcess.viewResultsButton": "結果を表示", "xpack.infra.analysisSetup.timeRangeDescription": "デフォルトで、機械学習は 4 週間以内のログインデックスのログメッセージを分析し、永久に継続します。別の開始日、終了日、または両方を指定できます。", "xpack.infra.analysisSetup.timeRangeTitle": "時間範囲の選択", - "xpack.infra.appName": "インフラログ", "xpack.infra.assetDetails.alerts.tooltip.alertsLabel": "このホストのアラートを表示しています。{alerts}でアラートを作成および管理できます", "xpack.infra.assetDetails.alerts.tooltip.documentationLabel": "詳細については、{documentation}を参照してください", "xpack.infra.assetDetails.alerts.tooltip.documentationLink": "ドキュメンテーション", @@ -22238,7 +22236,6 @@ "xpack.infra.logs.analysis.logEntryCategoriesModuleName": "カテゴリー分け", "xpack.infra.logs.analysis.logEntryExamplesViewAnomalyInMlLabel": "機械学習で異常を表示", "xpack.infra.logs.analysis.logEntryExamplesViewDetailsLabel": "詳細を表示", - "xpack.infra.logs.analysis.logEntryExamplesViewInStreamLabel": "ストリームで表示", "xpack.infra.logs.analysis.logEntryRateModuleDescription": "機械学習を使用して自動的に異常ログエントリ率を検出します。", "xpack.infra.logs.analysis.logEntryRateModuleName": "ログレート", "xpack.infra.logs.analysis.manageMlJobsButtonLabel": "MLジョブの管理", @@ -22262,23 +22259,9 @@ "xpack.infra.logs.analysisPage.unavailable.mlAppLink": "機械学習アプリ", "xpack.infra.logs.anomaliesPageTitle": "異常", "xpack.infra.logs.categoryExample.viewInContextText": "コンテキストで表示", - "xpack.infra.logs.categoryExample.viewInStreamText": "ストリームで表示", - "xpack.infra.logs.common.invalidStateCalloutTitle": "無効な状態が発生しました", - "xpack.infra.logs.common.invalidStateMessage": "状態{stateValue}を処理できません。", - "xpack.infra.logs.customizeLogs.customizeButtonLabel": "カスタマイズ", - "xpack.infra.logs.customizeLogs.lineWrappingFormRowLabel": "改行", - "xpack.infra.logs.customizeLogs.textSizeFormRowLabel": "テキストサイズ", - "xpack.infra.logs.customizeLogs.textSizeRadioGroup": "{textScale, select, small {小} Medium {中} Large {大} other {{textScale}} }", - "xpack.infra.logs.customizeLogs.wrapLongLinesSwitchLabel": "長い行を改行", - "xpack.infra.logs.highlights.clearHighlightTermsButtonLabel": "ハイライトする用語をクリア", - "xpack.infra.logs.highlights.goToNextHighlightButtonLabel": "次のハイライトにスキップ", - "xpack.infra.logs.highlights.goToPreviousHighlightButtonLabel": "前のハイライトにスキップ", - "xpack.infra.logs.highlights.highlightsPopoverButtonLabel": "ハイライト", - "xpack.infra.logs.highlights.highlightTermsFieldLabel": "ハイライトする用語", "xpack.infra.logs.index.anomaliesTabTitle": "Logs異常", "xpack.infra.logs.index.logCategoriesBetaBadgeTitle": "Logsカテゴリ", "xpack.infra.logs.index.settingsTabTitle": "設定", - "xpack.infra.logs.index.streamTabTitle": "ストリーム", "xpack.infra.logs.logCategoriesTitle": "カテゴリー", "xpack.infra.logs.logEntryCategories.analyzeCategoryInMlButtonLabel": "ML で分析", "xpack.infra.logs.logEntryCategories.analyzeCategoryInMlTooltipDescription": "ML アプリでこのカテゴリーを分析します。", @@ -22314,41 +22297,10 @@ "xpack.infra.logs.noDataConfig.beatsCard.title": "ロギング統合を追加", "xpack.infra.logs.noDataConfig.solutionName": "Observability", "xpack.infra.logs.pluginTitle": "ログ", - "xpack.infra.logs.search.nextButtonLabel": "次へ", - "xpack.infra.logs.search.previousButtonLabel": "前へ", - "xpack.infra.logs.search.searchInLogsAriaLabel": "検索", - "xpack.infra.logs.search.searchInLogsPlaceholder": "検索", - "xpack.infra.logs.searchResultTooltip": "{bucketCount, plural, other {# 件のハイライトされたエントリー}}", - "xpack.infra.logs.settings.inlineLogViewCalloutButtonText": "デフォルトログストリームビューに戻す", - "xpack.infra.logs.settings.inlineLogViewCalloutWidgetDescription": "変更はURLと同期されますが、デフォルトログストリームビューには永続しません。", - "xpack.infra.logs.settings.inlineLogViewCalloutWidgetTitle": "埋め込まれたウィジェットを構成しています", - "xpack.infra.logs.startStreamingButtonLabel": "ライブストリーム", - "xpack.infra.logs.stopStreamingButtonLabel": "ストリーム停止", - "xpack.infra.logs.streamPageTitle": "ストリーム", "xpack.infra.logs.viewInContext.logsFromContainerTitle": "表示されたログはコンテナー{container}から取得されました", "xpack.infra.logs.viewInContext.logsFromFileTitle": "表示されたログは、ファイル{file}およびホスト{host}から取得されました", "xpack.infra.logsDeprecationCallout.euiCallOut.discoverANewLogLabel": "ログの探索には、新しく、もっと効果的な方法があります。", "xpack.infra.logsHeaderAddDataButtonLabel": "データの追加", - "xpack.infra.logSourceConfiguration.childFormElementErrorMessage": "1つ以上のフォームフィールドが無効な状態です。", - "xpack.infra.logSourceConfiguration.dataViewDescription": "ログデータを含むデータビュー", - "xpack.infra.logSourceConfiguration.dataViewLabel": "ログデータビュー", - "xpack.infra.logSourceConfiguration.dataViewSectionTitle": "データビュー(廃止予定)", - "xpack.infra.logSourceConfiguration.dataViewSelectorPlaceholder": "データビューを選択", - "xpack.infra.logSourceConfiguration.dataViewsManagementLinkText": "データビュー管理画面", - "xpack.infra.logSourceConfiguration.dataViewTitle": "ログデータビュー", - "xpack.infra.logSourceConfiguration.emptyColumnListErrorMessage": "列リストは未入力のままにできません。", - "xpack.infra.logSourceConfiguration.emptyFieldErrorMessage": "フィールド''{fieldName}''は未入力のままにできません。", - "xpack.infra.logSourceConfiguration.includesSpacesErrorMessage": "フィールド''{fieldName}''にはスペースを入力できません。", - "xpack.infra.logSourceConfiguration.invalidMessageFieldTypeErrorMessage": "{messageField}フィールドはテキストフィールドでなければなりません。", - "xpack.infra.logSourceConfiguration.kibanaAdvancedSettingSectionTitle": "Kibanaログソース詳細設定", - "xpack.infra.logSourceConfiguration.logSourceConfigurationFormErrorsCalloutTitle": "一貫しないソース構成", - "xpack.infra.logSourceConfiguration.logSourcesTitle": "ログソース", - "xpack.infra.logSourceConfiguration.missingDataViewErrorMessage": "データビュー{dataViewId}が存在する必要があります。", - "xpack.infra.logSourceConfiguration.missingDataViewsLabel": "データビュー{indexPatternId}が見つかりません", - "xpack.infra.logSourceConfiguration.missingMessageFieldErrorMessage": "データビューには{messageField}フィールドが必要です。", - "xpack.infra.logSourceConfiguration.missingTimestampFieldErrorMessage": "データビューは時間に基づく必要があります。", - "xpack.infra.logSourceConfiguration.rollupIndexPatternErrorMessage": "データビューがロールアップインデックスパターンであってはなりません。", - "xpack.infra.logSourceConfiguration.unsavedFormPromptMessage": "終了してよろしいですか?変更内容は失われます", "xpack.infra.logSourceErrorPage.failedToLoadSourceMessage": "構成の読み込み試行中にエラーが発生しました。再試行するか、構成を変更して問題を修正してください。", "xpack.infra.logSourceErrorPage.failedToLoadSourceTitle": "構成を読み込めませんでした", "xpack.infra.logSourceErrorPage.fetchLogSourceConfigurationErrorTitle": "ログソース構成を読み込めませんでした", @@ -22357,13 +22309,7 @@ "xpack.infra.logSourceErrorPage.resolveLogSourceConfigurationErrorTitle": "ログソース構成を解決できませんでした", "xpack.infra.logSourceErrorPage.savedObjectNotFoundErrorMessage": "{savedObjectType}:{savedObjectId}が見つかりませんでした", "xpack.infra.logSourceErrorPage.tryAgainButtonLabel": "再試行", - "xpack.infra.logsPage.toolbar.kqlSearchFieldPlaceholder": "ログエントリーを検索中…(例:host.name:host-1)", - "xpack.infra.logsPage.toolbar.logFilterErrorToastTitle": "ログフィルターエラー", - "xpack.infra.logsSettingsPage.loadingButtonLabel": "読み込み中", "xpack.infra.logsStreamEmbeddable.deprecationWarningDescription": "ログストリームパネルは管理されていません。{savedSearchDocsLink}を同様の視覚化に活用してください。", - "xpack.infra.logStreamPageTemplate.backtoLogsStream": "ログストリームに戻る", - "xpack.infra.logStreamPageTemplate.widgetBadge": "ウィジェット", - "xpack.infra.logStreamPageTemplate.widgetDescription": "埋め込まれたウィジェットを表示しています。変更はURLと同期されますが、デフォルトログストリームビューには永続しません。", "xpack.infra.metadata.pinAriaLabel": "固定されたフィールド", "xpack.infra.metadataEmbeddable.AddFilterAriaLabel": "フィルターを追加", "xpack.infra.metadataEmbeddable.errorAction": "メタデータを再取得", @@ -22717,9 +22663,6 @@ "xpack.infra.ml.aomalyFlyout.jobSetup.flyoutHeader": "{nodeType}の機械学習を有効にする", "xpack.infra.ml.metricsHostModuleDescription": "機械学習を使用して自動的に異常ログエントリ率を検出します。", "xpack.infra.ml.metricsModuleName": "メトリック異常検知", - "xpack.infra.ml.splash.inlineLogView.buttonText": "デフォルト(永続)ログビューに戻す", - "xpack.infra.ml.splash.inlineLogView.description": "この機能はインラインログビューをサポートしていません", - "xpack.infra.ml.splash.inlineLogView.title": "永続ログビューに切り替える", "xpack.infra.ml.splash.loadingMessage": "ライセンスを確認しています...", "xpack.infra.ml.splash.startTrialCta": "トライアルを開始", "xpack.infra.ml.splash.startTrialDescription": "無料の試用版には、機械学習機能が含まれており、ログで異常を検出することができます。", @@ -22809,28 +22752,14 @@ "xpack.infra.savedView.updateView": "ビューの更新", "xpack.infra.showHistory": "履歴を表示", "xpack.infra.snapshot.missingSnapshotMetricError": "{nodeType}の{metric}の集約を使用できません。", - "xpack.infra.sourceConfiguration.addLogColumnButtonLabel": "列を追加", "xpack.infra.sourceConfiguration.anomalyThresholdDescription": "メトリックアプリケーションで異常値を表示するために必要な最低重要度スコアを設定します。", "xpack.infra.sourceConfiguration.anomalyThresholdLabel": "最低重要度スコア", "xpack.infra.sourceConfiguration.anomalyThresholdTitle": "異常重要度しきい値", - "xpack.infra.sourceConfiguration.applySettingsButtonLabel": "適用", - "xpack.infra.sourceConfiguration.discardSettingsButtonLabel": "破棄", "xpack.infra.sourceConfiguration.featuresSectionTitle": "機能", "xpack.infra.sourceConfiguration.fieldContainEmptyEntryErrorMessage": "フィールドには空のカンマ区切り値を含めることはできません。", "xpack.infra.sourceConfiguration.fieldContainSpacesErrorMessage": "フィールドにはスペースを入力できません。", "xpack.infra.sourceConfiguration.fieldEmptyErrorMessage": "このフィールドは未入力のままにできません。", - "xpack.infra.sourceConfiguration.fieldLogColumnTitle": "フィールド", "xpack.infra.sourceConfiguration.indicesSectionTitle": "インデックス", - "xpack.infra.sourceConfiguration.logColumnsSectionTitle": "ログ列", - "xpack.infra.sourceConfiguration.logIndices.viewAffectedRulesLink": "影響を受けるルールを表示", - "xpack.infra.sourceConfiguration.logIndicesDescription": "ログデータを含む一致するインデックスのインデックスパターンです", - "xpack.infra.sourceConfiguration.logIndicesLabel": "ログインデックス", - "xpack.infra.sourceConfiguration.logIndicesRecommendedValue": "推奨値は {defaultValue} です", - "xpack.infra.sourceConfiguration.logIndicesTitle": "ログインデックス", - "xpack.infra.sourceConfiguration.logsIndicesSectionTitle": "インデックス(廃止予定)", - "xpack.infra.sourceConfiguration.logsIndicesUsedByRulesMessage": "1つ以上のアラートルールがこのデータソース設定に依存しています。この設定を変更すると、アラートを生成するために使用されるデータが変更されます。", - "xpack.infra.sourceConfiguration.logsIndicesUsedByRulesTitle": "アラートルールはこのデータソース設定を使用します。", - "xpack.infra.sourceConfiguration.messageLogColumnDescription": "このシステムフィールドは、ドキュメントフィールドから取得されたログエントリーメッセージを表示します。", "xpack.infra.sourceConfiguration.metricIndices.viewAffectedRulesLink": "影響を受けるルールを表示", "xpack.infra.sourceConfiguration.metricIndicesDescription": "メトリックデータを含む一致するインデックスのインデックスパターンです", "xpack.infra.sourceConfiguration.metricIndicesDoNotExist": "入力されたパターンがインデックスと一致しないため、メトリックデータを検索できませんでした。", @@ -22845,16 +22774,11 @@ "xpack.infra.sourceConfiguration.nameDescription": "ソース構成を説明する名前です", "xpack.infra.sourceConfiguration.nameLabel": "名前", "xpack.infra.sourceConfiguration.nameSectionTitle": "名前", - "xpack.infra.sourceConfiguration.noLogColumnsDescription": "上のボタンでこのリストに列を追加します。", - "xpack.infra.sourceConfiguration.noLogColumnsTitle": "列がありません", "xpack.infra.sourceConfiguration.noRemoteClusterMessage": "リモートクラスターに接続できません。このため、必要なメトリックとデータを取得できません。この問題を解決するには、インデックス構成を確認し、構成が正しいことを確かめてください。", "xpack.infra.sourceConfiguration.noRemoteClusterTitle": "リモートクラスターに接続できませんでした", "xpack.infra.sourceConfiguration.remoteClusterConnectionDoNotExist": "リモートクラスターが利用可能であるか、リモート接続の設定が正しいことを確認します。", "xpack.infra.sourceConfiguration.remoteClusterConnectionDoNotExistTitle": "リモートクラスターに接続できませんでした", - "xpack.infra.sourceConfiguration.removeLogColumnButtonLabel": "{columnDescription} 列を削除", "xpack.infra.sourceConfiguration.saveButton": "変更を保存", - "xpack.infra.sourceConfiguration.systemColumnBadgeLabel": "システム", - "xpack.infra.sourceConfiguration.timestampLogColumnDescription": "このシステムフィールドは、{timestampSetting} フィールド設定から判断されたログエントリーの時刻を表示します。", "xpack.infra.sourceConfiguration.unsavedFormPrompt": "終了してよろしいですか?変更内容は失われます", "xpack.infra.sourceConfiguration.updateFailureBody": "変更をメトリック構成に適用できませんでした。しばらくたってから再試行してください。", "xpack.infra.sourceConfiguration.updateFailureTitle": "構成の更新が失敗しました", @@ -23782,7 +23706,6 @@ "xpack.ingestPipelines.testPipelineFlyout.successNotificationText": "パイプラインが実行されました", "xpack.ingestPipelines.testPipelineFlyout.title": "パイプラインをテスト", "xpack.integrationAssistant.bottomBar.addToElastic": "Elasticに追加", - "xpack.integrationAssistant.bottomBar.analyzeCel": "CEL入力構成を生成", "xpack.integrationAssistant.bottomBar.analyzeLogs": "ログを分析", "xpack.integrationAssistant.bottomBar.close": "閉じる", "xpack.integrationAssistant.bottomBar.loading": "読み込み中", @@ -23838,17 +23761,6 @@ "xpack.integrationAssistant.missingPrivileges.title": "不足している権限", "xpack.integrationAssistant.pages.header.avatarTitle": "生成AIを活用", "xpack.integrationAssistant.pages.header.title": "新しい統合", - "xpack.integrationAssistant.step.celInput.apiDefinition.description": "ファイルをドラッグアンドドロップするか、ファイルを参照します。", - "xpack.integrationAssistant.step.celInput.apiDefinition.description2": "OpenAPI仕様", - "xpack.integrationAssistant.step.celInput.apiDefinition.label": "OpenAPI仕様", - "xpack.integrationAssistant.step.celInput.celInputDescription": "OpenAPI仕様ファイルをアップロードして、CEL入力の構成を生成", - "xpack.integrationAssistant.step.celInput.celInputTitle": "CEL入力構成を生成", - "xpack.integrationAssistant.step.celInput.generationError": "エラーが発生しました:CEL入力生成", - "xpack.integrationAssistant.step.celInput.openapiSpec.errorCanNotRead": "ログサンプルファイルを読み取れませんでした", - "xpack.integrationAssistant.step.celInput.openapiSpec.errorCanNotReadWithReason": "仕様ファイルの読み取り中にエラーが発生しました:{reason}", - "xpack.integrationAssistant.step.celInput.openapiSpec.errorTooLargeToParse": "この仕様ファイルは大きすぎて解析できません", - "xpack.integrationAssistant.step.celInput.progress.relatedGraph": "CEL入力構成を生成中", - "xpack.integrationAssistant.step.celInput.retryButtonLabel": "再試行", "xpack.integrationAssistant.step.connector": "コネクター", "xpack.integrationAssistant.step.dataStream": "データストリーム", "xpack.integrationAssistant.step.dataStream.analyzing": "分析中", @@ -23900,12 +23812,6 @@ "xpack.integrationAssistant.step.review.ingestPipelineTitle": "パイプラインを投入", "xpack.integrationAssistant.step.review.save": "保存", "xpack.integrationAssistant.step.review.title": "結果を確認", - "xpack.integrationAssistant.step.reviewCel.description": "統合の生成されたCEL入力構成設定を確認してください。これらの設定は、編集が可能な場合、統合構成に自動的に入力されます。", - "xpack.integrationAssistant.step.reviewCel.program": "各ポーリングで実行されるCELプログラム", - "xpack.integrationAssistant.step.reviewCel.redact": "改訂されたフィールド", - "xpack.integrationAssistant.step.reviewCel.save": "保存", - "xpack.integrationAssistant.step.reviewCel.state": "初期CEL評価状態", - "xpack.integrationAssistant.step.reviewCel.title": "結果を確認", "xpack.integrationAssistant.steps.connector.createConnectorLabel": "新しいコネクターを作成", "xpack.integrationAssistant.steps.connector.description": "カスタム統合の作成を支援するAIコネクターを選択", "xpack.integrationAssistant.steps.connector.supportedModelsInfo": "現在、最高のエクスペリエンスが得られるように、新しいClaudeモデルをサポートするプロバイダーを利用することをお勧めします。現在、GPT-4や類似モデルへの改善されたサポートの追加に取り組んでいます。", diff --git a/x-pack/platform/plugins/private/translations/translations/zh-CN.json b/x-pack/platform/plugins/private/translations/translations/zh-CN.json index 515d8bb135659..c722363c6b6c9 100644 --- a/x-pack/platform/plugins/private/translations/translations/zh-CN.json +++ b/x-pack/platform/plugins/private/translations/translations/zh-CN.json @@ -617,7 +617,6 @@ "contentManagement.tableList.listing.userFilter.errorMessage": "无法加载用户", "contentManagement.tableList.listing.userFilter.filterLabel": "创建者", "contentManagement.tableList.listing.userFilter.noCreators": "无创建者", - "contentManagement.tableList.mainColumnName": "名称、描述、标签", "contentManagement.tableList.managedItemNoEdit": "Elastic 将管理此项目。进行克隆以做出更改。", "contentManagement.tableList.tabsFilter.allTabLabel": "全部", "contentManagement.tableList.tabsFilter.favoriteTabLabel": "带星标", @@ -21475,7 +21474,6 @@ "xpack.infra.analysisSetup.steps.setupProcess.viewResultsButton": "查看结果", "xpack.infra.analysisSetup.timeRangeDescription": "默认情况下,Machine Learning 分析日志索引中不超过 4 周的日志消息,并无限持续下去。您可以指定不同的开始日期或/和结束日期。", "xpack.infra.analysisSetup.timeRangeTitle": "选择时间范围", - "xpack.infra.appName": "基础架构日志", "xpack.infra.assetDetails.alerts.tooltip.alertsLabel": "正在显示此主机的告警。可以在 {alerts} 中创建和管理告警", "xpack.infra.assetDetails.alerts.tooltip.documentationLabel": "请参阅{documentation}了解更多信息", "xpack.infra.assetDetails.alerts.tooltip.documentationLink": "文档", @@ -21879,7 +21877,6 @@ "xpack.infra.logs.analysis.logEntryCategoriesModuleName": "归类", "xpack.infra.logs.analysis.logEntryExamplesViewAnomalyInMlLabel": "在 Machine Learning 中查看异常", "xpack.infra.logs.analysis.logEntryExamplesViewDetailsLabel": "查看详情", - "xpack.infra.logs.analysis.logEntryExamplesViewInStreamLabel": "在流中查看", "xpack.infra.logs.analysis.logEntryRateModuleDescription": "使用 Machine Learning 自动检测异常日志条目速率。", "xpack.infra.logs.analysis.logEntryRateModuleName": "日志速率", "xpack.infra.logs.analysis.manageMlJobsButtonLabel": "管理 ML 作业", @@ -21903,23 +21900,9 @@ "xpack.infra.logs.analysisPage.unavailable.mlAppLink": "Machine Learning 应用", "xpack.infra.logs.anomaliesPageTitle": "异常", "xpack.infra.logs.categoryExample.viewInContextText": "在上下文中查看", - "xpack.infra.logs.categoryExample.viewInStreamText": "在流中查看", - "xpack.infra.logs.common.invalidStateCalloutTitle": "遇到无效状态", - "xpack.infra.logs.common.invalidStateMessage": "无法处理状态 {stateValue}。", - "xpack.infra.logs.customizeLogs.customizeButtonLabel": "定制", - "xpack.infra.logs.customizeLogs.lineWrappingFormRowLabel": "换行", - "xpack.infra.logs.customizeLogs.textSizeFormRowLabel": "文本大小", - "xpack.infra.logs.customizeLogs.textSizeRadioGroup": "{textScale, select, small {小} medium {Medium} large {Large} other {{textScale}} }", - "xpack.infra.logs.customizeLogs.wrapLongLinesSwitchLabel": "长行换行", - "xpack.infra.logs.highlights.clearHighlightTermsButtonLabel": "清除要突出显示的词", - "xpack.infra.logs.highlights.goToNextHighlightButtonLabel": "跳转到下一高亮条目", - "xpack.infra.logs.highlights.goToPreviousHighlightButtonLabel": "跳转到上一高亮条目", - "xpack.infra.logs.highlights.highlightsPopoverButtonLabel": "突出显示", - "xpack.infra.logs.highlights.highlightTermsFieldLabel": "要突出显示的词", "xpack.infra.logs.index.anomaliesTabTitle": "日志异常", "xpack.infra.logs.index.logCategoriesBetaBadgeTitle": "日志类别", "xpack.infra.logs.index.settingsTabTitle": "设置", - "xpack.infra.logs.index.streamTabTitle": "流式传输", "xpack.infra.logs.logCategoriesTitle": "类别", "xpack.infra.logs.logEntryCategories.analyzeCategoryInMlButtonLabel": "在 ML 中分析", "xpack.infra.logs.logEntryCategories.analyzeCategoryInMlTooltipDescription": "在 ML 应用中分析此类别。", @@ -21955,40 +21938,10 @@ "xpack.infra.logs.noDataConfig.beatsCard.title": "添加日志记录集成", "xpack.infra.logs.noDataConfig.solutionName": "Observability", "xpack.infra.logs.pluginTitle": "日志", - "xpack.infra.logs.search.nextButtonLabel": "下一步", - "xpack.infra.logs.search.previousButtonLabel": "上一页", - "xpack.infra.logs.search.searchInLogsAriaLabel": "搜索", - "xpack.infra.logs.search.searchInLogsPlaceholder": "搜索", - "xpack.infra.logs.searchResultTooltip": "{bucketCount, plural, other {# 个高亮条目}}", - "xpack.infra.logs.settings.inlineLogViewCalloutButtonText": "恢复为默认日志流视图", - "xpack.infra.logs.settings.inlineLogViewCalloutWidgetDescription": "更改将同步到 URL,但不会持续存在于默认日志流视图。", - "xpack.infra.logs.settings.inlineLogViewCalloutWidgetTitle": "您正在配置嵌入式小组件", - "xpack.infra.logs.startStreamingButtonLabel": "实时流式传输", - "xpack.infra.logs.stopStreamingButtonLabel": "停止流式传输", - "xpack.infra.logs.streamPageTitle": "流式传输", "xpack.infra.logs.viewInContext.logsFromContainerTitle": "显示的日志来自容器 {container}", "xpack.infra.logs.viewInContext.logsFromFileTitle": "显示的日志来自文件 {file} 和主机 {host}", "xpack.infra.logsDeprecationCallout.euiCallOut.discoverANewLogLabel": "这是浏览日志的更有效的新方法!", "xpack.infra.logsHeaderAddDataButtonLabel": "添加数据", - "xpack.infra.logSourceConfiguration.childFormElementErrorMessage": "至少一个表单字段处于无效状态。", - "xpack.infra.logSourceConfiguration.dataViewDescription": "包含日志数据的数据视图", - "xpack.infra.logSourceConfiguration.dataViewLabel": "日志数据视图", - "xpack.infra.logSourceConfiguration.dataViewSectionTitle": "数据视图(已过时)", - "xpack.infra.logSourceConfiguration.dataViewSelectorPlaceholder": "选择数据视图", - "xpack.infra.logSourceConfiguration.dataViewsManagementLinkText": "数据视图管理屏幕", - "xpack.infra.logSourceConfiguration.dataViewTitle": "日志数据视图", - "xpack.infra.logSourceConfiguration.emptyColumnListErrorMessage": "列列表不得为空。", - "xpack.infra.logSourceConfiguration.invalidMessageFieldTypeErrorMessage": "{messageField} 字段必须是文本字段。", - "xpack.infra.logSourceConfiguration.kibanaAdvancedSettingSectionTitle": "Kibana 日志源高级设置", - "xpack.infra.logSourceConfiguration.logDataViewHelpText": "数据视图在 Kibana 工作区中的应用间共享,并可以通过 {dataViewsManagementLink} 进行管理。单一数据视图可以针对多个索引。", - "xpack.infra.logSourceConfiguration.logSourceConfigurationFormErrorsCalloutTitle": "内容配置不一致", - "xpack.infra.logSourceConfiguration.logSourcesTitle": "日志源", - "xpack.infra.logSourceConfiguration.missingDataViewErrorMessage": "数据视图 {dataViewId} 必须存在。", - "xpack.infra.logSourceConfiguration.missingDataViewsLabel": "缺少数据视图 {indexPatternId}", - "xpack.infra.logSourceConfiguration.missingMessageFieldErrorMessage": "数据视图必须包含 {messageField} 字段。", - "xpack.infra.logSourceConfiguration.missingTimestampFieldErrorMessage": "数据视图必须基于时间。", - "xpack.infra.logSourceConfiguration.rollupIndexPatternErrorMessage": "数据视图不得为汇总/打包索引模式。", - "xpack.infra.logSourceConfiguration.unsavedFormPromptMessage": "是否确定要离开?更改将丢失", "xpack.infra.logSourceErrorPage.failedToLoadSourceMessage": "尝试加载配置时出错。请重试或更改配置以解决问题。", "xpack.infra.logSourceErrorPage.failedToLoadSourceTitle": "无法加载配置", "xpack.infra.logSourceErrorPage.fetchLogSourceConfigurationErrorTitle": "无法加载日志源配置", @@ -21997,13 +21950,7 @@ "xpack.infra.logSourceErrorPage.resolveLogSourceConfigurationErrorTitle": "无法解决日志源配置", "xpack.infra.logSourceErrorPage.savedObjectNotFoundErrorMessage": "无法找到该{savedObjectType}:{savedObjectId}", "xpack.infra.logSourceErrorPage.tryAgainButtonLabel": "重试", - "xpack.infra.logsPage.toolbar.kqlSearchFieldPlaceholder": "搜索日志条目……(例如 host.name:host-1)", - "xpack.infra.logsPage.toolbar.logFilterErrorToastTitle": "日志筛选错误", - "xpack.infra.logsSettingsPage.loadingButtonLabel": "正在加载", "xpack.infra.logsStreamEmbeddable.deprecationWarningDescription": "将不再维护日志流面板。尝试将 {savedSearchDocsLink} 用于类似可视化。", - "xpack.infra.logStreamPageTemplate.backtoLogsStream": "返回到日志流", - "xpack.infra.logStreamPageTemplate.widgetBadge": "小组件", - "xpack.infra.logStreamPageTemplate.widgetDescription": "您正在查看嵌入式小组件。更改将同步到 URL,但不会持续存在于默认日志流视图。", "xpack.infra.metadata.pinAriaLabel": "已固定字段", "xpack.infra.metadataEmbeddable.AddFilterAriaLabel": "添加筛选", "xpack.infra.metadataEmbeddable.errorAction": "重新提取元数据", @@ -22355,9 +22302,6 @@ "xpack.infra.ml.aomalyFlyout.jobSetup.flyoutHeader": "为 {nodeType} 启用 Machine Learning", "xpack.infra.ml.metricsHostModuleDescription": "使用 Machine Learning 自动检测异常日志条目速率。", "xpack.infra.ml.metricsModuleName": "指标异常检测", - "xpack.infra.ml.splash.inlineLogView.buttonText": "恢复到默认(持久化)日志视图", - "xpack.infra.ml.splash.inlineLogView.description": "此功能不支持内联日志视图", - "xpack.infra.ml.splash.inlineLogView.title": "切换到持久化日志视图", "xpack.infra.ml.splash.loadingMessage": "正在检查许可证......", "xpack.infra.ml.splash.startTrialCta": "开始试用", "xpack.infra.ml.splash.startTrialDescription": "我们的免费试用版包含 Machine Learning 功能,可用于检测日志中的异常。", @@ -22448,28 +22392,14 @@ "xpack.infra.savedView.updateView": "更新视图", "xpack.infra.showHistory": "显示历史记录", "xpack.infra.snapshot.missingSnapshotMetricError": "{nodeType} 的 {metric} 聚合不可用。", - "xpack.infra.sourceConfiguration.addLogColumnButtonLabel": "添加列", "xpack.infra.sourceConfiguration.anomalyThresholdDescription": "设置在 Metrics 应用程序中显示异常所需的最低严重性分数。", "xpack.infra.sourceConfiguration.anomalyThresholdLabel": "最低严重性分数", "xpack.infra.sourceConfiguration.anomalyThresholdTitle": "异常严重性阈值", - "xpack.infra.sourceConfiguration.applySettingsButtonLabel": "应用", - "xpack.infra.sourceConfiguration.discardSettingsButtonLabel": "丢弃", "xpack.infra.sourceConfiguration.featuresSectionTitle": "功能", "xpack.infra.sourceConfiguration.fieldContainEmptyEntryErrorMessage": "字段不得包含逗号分隔的空值。", "xpack.infra.sourceConfiguration.fieldContainSpacesErrorMessage": "字段不得包括空格。", "xpack.infra.sourceConfiguration.fieldEmptyErrorMessage": "字段不得为空。", - "xpack.infra.sourceConfiguration.fieldLogColumnTitle": "字段", "xpack.infra.sourceConfiguration.indicesSectionTitle": "索引", - "xpack.infra.sourceConfiguration.logColumnsSectionTitle": "日志列", - "xpack.infra.sourceConfiguration.logIndices.viewAffectedRulesLink": "查看受影响的规则", - "xpack.infra.sourceConfiguration.logIndicesDescription": "用于匹配包含日志数据的索引的索引模式", - "xpack.infra.sourceConfiguration.logIndicesLabel": "日志索引", - "xpack.infra.sourceConfiguration.logIndicesRecommendedValue": "推荐值为 {defaultValue}", - "xpack.infra.sourceConfiguration.logIndicesTitle": "日志索引", - "xpack.infra.sourceConfiguration.logsIndicesSectionTitle": "索引(已过时)", - "xpack.infra.sourceConfiguration.logsIndicesUsedByRulesMessage": "一个或多个告警规则依赖于此数据源设置。更改此设置会更改用于生成告警的数据。", - "xpack.infra.sourceConfiguration.logsIndicesUsedByRulesTitle": "告警规则使用此数据源设置", - "xpack.infra.sourceConfiguration.messageLogColumnDescription": "此系统字段显示派生自文档字段的日志条目消息。", "xpack.infra.sourceConfiguration.metricIndices.viewAffectedRulesLink": "查看受影响的规则", "xpack.infra.sourceConfiguration.metricIndicesDescription": "用于匹配包含指标数据的索引的索引模式", "xpack.infra.sourceConfiguration.metricIndicesDoNotExist": "找不到任何指标数据,因为输入的模式不匹配任何索引。", @@ -22484,15 +22414,11 @@ "xpack.infra.sourceConfiguration.nameDescription": "源配置的描述性名称", "xpack.infra.sourceConfiguration.nameLabel": "名称", "xpack.infra.sourceConfiguration.nameSectionTitle": "名称", - "xpack.infra.sourceConfiguration.noLogColumnsDescription": "使用上面的按钮将列添加到此列表。", - "xpack.infra.sourceConfiguration.noLogColumnsTitle": "无列", "xpack.infra.sourceConfiguration.noRemoteClusterMessage": "无法连接到远程集群,这导致我们无法检索您所需的指标和数据。要解决此问题,请检查您的索引配置,并确保进行了正确配置。", "xpack.infra.sourceConfiguration.noRemoteClusterTitle": "无法连接到远程集群", "xpack.infra.sourceConfiguration.remoteClusterConnectionDoNotExist": "检查远程集群是否可用,或远程连接设置是否正确。", "xpack.infra.sourceConfiguration.remoteClusterConnectionDoNotExistTitle": "无法连接到远程集群", "xpack.infra.sourceConfiguration.saveButton": "保存更改", - "xpack.infra.sourceConfiguration.systemColumnBadgeLabel": "系统", - "xpack.infra.sourceConfiguration.timestampLogColumnDescription": "此系统字段显示 {timestampSetting} 字段设置所确定的日志条目时间。", "xpack.infra.sourceConfiguration.unsavedFormPrompt": "是否确定要离开?更改将丢失", "xpack.infra.sourceConfiguration.updateFailureBody": "无法对指标配置应用更改。请稍后重试。", "xpack.infra.sourceConfiguration.updateFailureTitle": "配置更新失败", @@ -23371,7 +23297,6 @@ "xpack.ingestPipelines.testPipelineFlyout.successNotificationText": "管道已执行", "xpack.ingestPipelines.testPipelineFlyout.title": "测试管道", "xpack.integrationAssistant.bottomBar.addToElastic": "添加到 Elastic", - "xpack.integrationAssistant.bottomBar.analyzeCel": "生成 CEL 输入配置", "xpack.integrationAssistant.bottomBar.analyzeLogs": "分析日志", "xpack.integrationAssistant.bottomBar.close": "关闭", "xpack.integrationAssistant.bottomBar.loading": "正在加载", @@ -23427,17 +23352,6 @@ "xpack.integrationAssistant.missingPrivileges.title": "缺少权限", "xpack.integrationAssistant.pages.header.avatarTitle": "由生成式 AI 提供支持", "xpack.integrationAssistant.pages.header.title": "新集成", - "xpack.integrationAssistant.step.celInput.apiDefinition.description": "拖放文件或浏览文件。", - "xpack.integrationAssistant.step.celInput.apiDefinition.description2": "OpenAPI 规范", - "xpack.integrationAssistant.step.celInput.apiDefinition.label": "OpenAPI 规范", - "xpack.integrationAssistant.step.celInput.celInputDescription": "上传 OpenAPI 规范文件以为 CEL 输入生成配置", - "xpack.integrationAssistant.step.celInput.celInputTitle": "生成 CEL 输入配置", - "xpack.integrationAssistant.step.celInput.generationError": "以下期间发生错误:CEL 输入生成", - "xpack.integrationAssistant.step.celInput.openapiSpec.errorCanNotRead": "无法读取日志样例文件", - "xpack.integrationAssistant.step.celInput.openapiSpec.errorCanNotReadWithReason": "读取规范文件时发生错误:{reason}", - "xpack.integrationAssistant.step.celInput.openapiSpec.errorTooLargeToParse": "此规范文件太大,无法解析", - "xpack.integrationAssistant.step.celInput.progress.relatedGraph": "正在生成 CEL 输入配置", - "xpack.integrationAssistant.step.celInput.retryButtonLabel": "重试", "xpack.integrationAssistant.step.connector": "连接器", "xpack.integrationAssistant.step.dataStream": "数据流", "xpack.integrationAssistant.step.dataStream.analyzing": "正在分析", @@ -23489,12 +23403,6 @@ "xpack.integrationAssistant.step.review.ingestPipelineTitle": "采集管道", "xpack.integrationAssistant.step.review.save": "保存", "xpack.integrationAssistant.step.review.title": "复查结果", - "xpack.integrationAssistant.step.reviewCel.description": "查看为您的集成生成的 CEL 输入配置设置。在可以进行编辑的情况下,会将这些设置自动填充到集成配置中。", - "xpack.integrationAssistant.step.reviewCel.program": "要为每次轮询运行的 CEL 程序", - "xpack.integrationAssistant.step.reviewCel.redact": "已编辑字段", - "xpack.integrationAssistant.step.reviewCel.save": "保存", - "xpack.integrationAssistant.step.reviewCel.state": "初始 CEL 评估状态", - "xpack.integrationAssistant.step.reviewCel.title": "复查结果", "xpack.integrationAssistant.steps.connector.createConnectorLabel": "创建新连接器", "xpack.integrationAssistant.steps.connector.description": "选择 AI 连接器以帮助您创建定制集成", "xpack.integrationAssistant.steps.connector.supportedModelsInfo": "当前,我们建议使用支持更新 Claude 模型的提供商,以获得最佳体验。目前,我们正努力为 GPT-4 和类似模型添加更全面的支持", diff --git a/x-pack/platform/plugins/shared/cases/public/components/create/templates.tsx b/x-pack/platform/plugins/shared/cases/public/components/create/templates.tsx index 93dd30cfb40a9..9e707aaf43d74 100644 --- a/x-pack/platform/plugins/shared/cases/public/components/create/templates.tsx +++ b/x-pack/platform/plugins/shared/cases/public/components/create/templates.tsx @@ -7,15 +7,8 @@ import React, { useCallback, useState } from 'react'; import type { EuiSelectOption } from '@elastic/eui'; -import { - EuiFlexItem, - EuiFormRow, - EuiSelect, - EuiFlexGroup, - useIsWithinMaxBreakpoint, -} from '@elastic/eui'; +import { EuiFlexItem, EuiFormRow, EuiSelect, EuiFlexGroup } from '@elastic/eui'; import { css } from '@emotion/react'; -import { ExperimentalBadge } from '../experimental_badge/experimental_badge'; import type { CasesConfigurationUI, CasesConfigurationUITemplate } from '../../containers/types'; import { OptionalFieldLabel } from '../optional_field_label'; import { TEMPLATE_HELP_TEXT, TEMPLATE_LABEL } from './translations'; @@ -39,7 +32,6 @@ export const TemplateSelectorComponent: React.FC = ({ const [selectedTemplate, onSelectTemplate] = useState( initialTemplate?.key ?? undefined ); - const isSmallScreen = useIsWithinMaxBreakpoint('s'); const options: EuiSelectOption[] = templates.map((template) => ({ text: template.name, @@ -72,14 +64,6 @@ export const TemplateSelectorComponent: React.FC = ({ `} responsive={false} > - - - {OptionalFieldLabel} } diff --git a/x-pack/platform/plugins/shared/cases/public/components/templates/index.test.tsx b/x-pack/platform/plugins/shared/cases/public/components/templates/index.test.tsx index 4cfa7a22750b4..516263923b69e 100644 --- a/x-pack/platform/plugins/shared/cases/public/components/templates/index.test.tsx +++ b/x-pack/platform/plugins/shared/cases/public/components/templates/index.test.tsx @@ -111,12 +111,6 @@ describe.skip('Templates', () => { }); }); - it('shows the experimental badge', async () => { - appMockRender.render(); - - expect(await screen.findByTestId('case-experimental-badge')).toBeInTheDocument(); - }); - it('shows error when templates reaches the limit', async () => { const mockTemplates = []; diff --git a/x-pack/platform/plugins/shared/cases/public/components/templates/index.tsx b/x-pack/platform/plugins/shared/cases/public/components/templates/index.tsx index 6c15f1e9ef464..f8c2fcb659a7c 100644 --- a/x-pack/platform/plugins/shared/cases/public/components/templates/index.tsx +++ b/x-pack/platform/plugins/shared/cases/public/components/templates/index.tsx @@ -17,7 +17,6 @@ import { } from '@elastic/eui'; import { MAX_TEMPLATES_LENGTH } from '../../../common/constants'; import type { CasesConfigurationUITemplate } from '../../../common/ui'; -import { ExperimentalBadge } from '../experimental_badge/experimental_badge'; import * as i18n from './translations'; import { TemplatesList } from './templates_list'; @@ -72,9 +71,6 @@ const TemplatesComponent: React.FC = ({ title={ {i18n.TEMPLATE_TITLE} - - - } description={

{i18n.TEMPLATE_DESCRIPTION}

} diff --git a/x-pack/platform/plugins/shared/fleet/jest.config.js b/x-pack/platform/plugins/shared/fleet/common/jest.config.js similarity index 58% rename from x-pack/platform/plugins/shared/fleet/jest.config.js rename to x-pack/platform/plugins/shared/fleet/common/jest.config.js index dbdcca9bb0570..0711e6f7f317e 100644 --- a/x-pack/platform/plugins/shared/fleet/jest.config.js +++ b/x-pack/platform/plugins/shared/fleet/common/jest.config.js @@ -7,14 +7,13 @@ module.exports = { preset: '@kbn/test', - rootDir: '../../../../..', - roots: ['/x-pack/platform/plugins/shared/fleet'], + rootDir: '../../../../../..', + roots: ['/x-pack/platform/plugins/shared/fleet/common'], transform: { '^.+\\.stories\\.tsx?$': '@storybook/addon-storyshots/injectFileName', }, - coverageDirectory: '/target/kibana-coverage/jest/x-pack/platform/plugins/shared/fleet', + coverageDirectory: + '/target/kibana-coverage/jest/x-pack/platform/plugins/shared/fleet/common', coverageReporters: ['text', 'html'], - collectCoverageFrom: [ - '/x-pack/platform/plugins/shared/fleet/{common,public,server}/**/*.{ts,tsx}', - ], + collectCoverageFrom: ['/x-pack/platform/plugins/shared/fleet/common/**/*.{ts,tsx}'], }; diff --git a/x-pack/platform/plugins/shared/fleet/jest.config.dev.js b/x-pack/platform/plugins/shared/fleet/jest.config.dev.js new file mode 100644 index 0000000000000..ff985be3a5d6e --- /dev/null +++ b/x-pack/platform/plugins/shared/fleet/jest.config.dev.js @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +module.exports = { + preset: '@kbn/test/jest', + rootDir: '../../../../..', + roots: ['/x-pack/platform/plugins/shared/fleet'], + projects: [ + '/x-pack/platform/plugins/shared/fleet/common/*/jest.config.js', + '/x-pack/platform/plugins/shared/fleet/server/*/jest.config.js', + '/x-pack/platform/plugins/shared/fleet/public/*/jest.config.js', + ], +}; diff --git a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx index b0889f825727f..1ac7186be665e 100644 --- a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx @@ -129,7 +129,7 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent = agentPolicy.is_managed === true || agentPolicy?.supports_agentless === true; const userHasAccessToAllPolicySpaces = useMemo( - () => 'space_ids' in agentPolicy && !agentPolicy.space_ids?.includes(UNKNOWN_SPACE), + () => ('space_ids' in agentPolicy ? !agentPolicy.space_ids?.includes(UNKNOWN_SPACE) : true), [agentPolicy] ); diff --git a/x-pack/platform/plugins/shared/fleet/public/jest.config.js b/x-pack/platform/plugins/shared/fleet/public/jest.config.js new file mode 100644 index 0000000000000..bb555a56943b8 --- /dev/null +++ b/x-pack/platform/plugins/shared/fleet/public/jest.config.js @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../../../../..', + roots: ['/x-pack/platform/plugins/shared/fleet/public'], + transform: { + '^.+\\.stories\\.tsx?$': '@storybook/addon-storyshots/injectFileName', + }, + coverageDirectory: + '/target/kibana-coverage/jest/x-pack/platform/plugins/shared/fleet/public', + coverageReporters: ['text', 'html'], + collectCoverageFrom: ['/x-pack/platform/plugins/shared/fleet/public/**/*.{ts,tsx}'], +}; diff --git a/x-pack/platform/plugins/shared/fleet/scripts/jest.config.js b/x-pack/platform/plugins/shared/fleet/scripts/jest.config.js new file mode 100644 index 0000000000000..e68dcd69cc3e3 --- /dev/null +++ b/x-pack/platform/plugins/shared/fleet/scripts/jest.config.js @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../../../../..', + roots: ['/x-pack/platform/plugins/shared/fleet/scripts'], + transform: { + '^.+\\.stories\\.tsx?$': '@storybook/addon-storyshots/injectFileName', + }, + coverageDirectory: + '/target/kibana-coverage/jest/x-pack/platform/plugins/shared/fleet/scripts', + coverageReporters: ['text', 'html'], + collectCoverageFrom: ['/x-pack/platform/plugins/shared/fleet/scripts/**/*.{ts,tsx}'], +}; diff --git a/x-pack/plugins/drilldowns/jest.config.js b/x-pack/platform/plugins/shared/fleet/server/jest.config.js similarity index 52% rename from x-pack/plugins/drilldowns/jest.config.js rename to x-pack/platform/plugins/shared/fleet/server/jest.config.js index a5db93a916ebb..648eb2d326e44 100644 --- a/x-pack/plugins/drilldowns/jest.config.js +++ b/x-pack/platform/plugins/shared/fleet/server/jest.config.js @@ -7,9 +7,10 @@ module.exports = { preset: '@kbn/test', - rootDir: '../../..', - roots: ['/x-pack/plugins/drilldowns'], - coverageDirectory: '/target/kibana-coverage/jest/x-pack/plugins/drilldowns', + rootDir: '../../../../../..', + roots: ['/x-pack/platform/plugins/shared/fleet/server'], + coverageDirectory: + '/target/kibana-coverage/jest/x-pack/platform/plugins/shared/fleet/server', coverageReporters: ['text', 'html'], - collectCoverageFrom: ['/x-pack/plugins/drilldowns/url_drilldown/public/**/*.{ts,tsx}'], + collectCoverageFrom: ['/x-pack/platform/plugins/shared/fleet/{server}/**/*.{ts,tsx}'], }; diff --git a/x-pack/platform/plugins/shared/fleet/server/mocks/index.ts b/x-pack/platform/plugins/shared/fleet/server/mocks/index.ts index db100c5fcf7ec..8aa3d96ae43b8 100644 --- a/x-pack/platform/plugins/shared/fleet/server/mocks/index.ts +++ b/x-pack/platform/plugins/shared/fleet/server/mocks/index.ts @@ -228,8 +228,10 @@ export const createPackagePolicyServiceMock = (): jest.Mocked => { return { + create: jest.fn().mockReturnValue(Promise.resolve()), get: jest.fn().mockReturnValue(Promise.resolve()), list: jest.fn().mockReturnValue(Promise.resolve()), + delete: jest.fn().mockReturnValue(Promise.resolve()), getFullAgentPolicy: jest.fn().mockReturnValue(Promise.resolve()), getByIds: jest.fn().mockReturnValue(Promise.resolve()), turnOffAgentTamperProtections: jest.fn().mockReturnValue(Promise.resolve()), diff --git a/x-pack/platform/plugins/shared/fleet/server/plugin.ts b/x-pack/platform/plugins/shared/fleet/server/plugin.ts index 1620df27b82c3..d1e4691fb48b5 100644 --- a/x-pack/platform/plugins/shared/fleet/server/plugin.ts +++ b/x-pack/platform/plugins/shared/fleet/server/plugin.ts @@ -816,16 +816,7 @@ export class FleetPlugin core.elasticsearch.client.asInternalUser, internalSoClient ), - agentPolicyService: { - get: agentPolicyService.get, - list: agentPolicyService.list, - getFullAgentPolicy: agentPolicyService.getFullAgentPolicy, - getByIds: agentPolicyService.getByIDs, - turnOffAgentTamperProtections: - agentPolicyService.turnOffAgentTamperProtections.bind(agentPolicyService), - fetchAllAgentPolicies: agentPolicyService.fetchAllAgentPolicies, - fetchAllAgentPolicyIds: agentPolicyService.fetchAllAgentPolicyIds, - }, + agentPolicyService, packagePolicyService, registerExternalCallback: (type: ExternalCallback[0], callback: ExternalCallback[1]) => { return appContextService.addExternalCallback(type, callback); diff --git a/x-pack/platform/plugins/shared/fleet/server/routes/agent_policy/handlers.ts b/x-pack/platform/plugins/shared/fleet/server/routes/agent_policy/handlers.ts index 6d5587e283878..218920d029c6b 100644 --- a/x-pack/platform/plugins/shared/fleet/server/routes/agent_policy/handlers.ts +++ b/x-pack/platform/plugins/shared/fleet/server/routes/agent_policy/handlers.ts @@ -196,7 +196,7 @@ export const bulkGetAgentPoliciesHandler: FleetRequestHandler< 'full query parameter require agent policies read permissions' ); } - let items = await agentPolicyService.getByIDs(soClient, ids, { + let items = await agentPolicyService.getByIds(soClient, ids, { withPackagePolicies, ignoreMissing, }); @@ -327,8 +327,12 @@ export const createAgentPolicyHandler: FleetRequestHandler< const body: CreateAgentPolicyResponse = { item: agentPolicy, }; - - if (spaceIds && spaceIds.length > 1 && authorizedSpaces) { + // Update spaces if there is more than one space ID assigned to that policy or if there the space that policy is created is different than the current space + if ( + spaceIds && + authorizedSpaces && + (spaceIds.length > 1 || (spaceIds.length === 0 && spaceIds[0]) !== spaceId) + ) { await updateAgentPolicySpaces({ agentPolicyId: agentPolicy.id, currentSpaceId: spaceId, @@ -687,7 +691,7 @@ export const GetListAgentPolicyOutputsHandler: FleetRequestHandler< body: { items: [] }, }); } - const agentPolicies = await agentPolicyService.getByIDs(soClient, ids, { + const agentPolicies = await agentPolicyService.getByIds(soClient, ids, { withPackagePolicies: true, }); diff --git a/x-pack/platform/plugins/shared/fleet/server/routes/settings/enrollment_settings_handler.test.ts b/x-pack/platform/plugins/shared/fleet/server/routes/settings/enrollment_settings_handler.test.ts index 029efc146e09b..d8d2bdc2f2411 100644 --- a/x-pack/platform/plugins/shared/fleet/server/routes/settings/enrollment_settings_handler.test.ts +++ b/x-pack/platform/plugins/shared/fleet/server/routes/settings/enrollment_settings_handler.test.ts @@ -22,7 +22,7 @@ import { jest.mock('../../services', () => ({ agentPolicyService: { get: jest.fn(), - getByIDs: jest.fn(), + getByIds: jest.fn(), }, appContextService: { getInternalUserSOClientWithoutSpaceExtension: jest.fn(), diff --git a/x-pack/platform/plugins/shared/fleet/server/routes/settings/settings_handler.test.ts b/x-pack/platform/plugins/shared/fleet/server/routes/settings/settings_handler.test.ts index 151a0a2ba2af8..2d263a4b66686 100644 --- a/x-pack/platform/plugins/shared/fleet/server/routes/settings/settings_handler.test.ts +++ b/x-pack/platform/plugins/shared/fleet/server/routes/settings/settings_handler.test.ts @@ -42,7 +42,7 @@ jest.mock('../../services', () => ({ }, agentPolicyService: { get: jest.fn(), - getByIDs: jest.fn(), + getByIds: jest.fn(), }, })); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/__snapshots__/full_agent_policy.test.ts.snap b/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/__snapshots__/full_agent_policy.test.ts.snap index d5ae12c00a9ff..9d93fd5df3c81 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/__snapshots__/full_agent_policy.test.ts.snap +++ b/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/__snapshots__/full_agent_policy.test.ts.snap @@ -1,5 +1,159 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`getFullAgentPolicy should return the right outputs and permissions when package policies use their own outputs (with default output) 1`] = ` +Object { + "agent": Object { + "download": Object { + "sourceURI": "http://default-registry.co", + }, + "features": Object {}, + "monitoring": Object { + "enabled": false, + "logs": false, + "metrics": false, + "traces": false, + }, + "protection": Object { + "enabled": false, + "signing_key": "", + "uninstall_token_hash": "", + }, + }, + "fleet": Object { + "hosts": Array [ + "http://fleetserver:8220", + ], + }, + "id": "integration-output-policy", + "inputs": Array [ + Object { + "data_stream": Object { + "namespace": "policyspace", + }, + "id": "test-logs-package-policy-using-output", + "meta": Object { + "package": Object { + "name": "test_package", + "version": "0.0.0", + }, + }, + "name": "test-policy-1", + "package_policy_id": "package-policy-using-output", + "revision": 1, + "streams": Array [ + Object { + "data_stream": Object { + "dataset": "some-logs", + "type": "logs", + }, + "id": "test-logs", + }, + ], + "type": "test-logs", + "use_output": "default", + }, + Object { + "data_stream": Object { + "namespace": "defaultspace", + }, + "id": "test-logs-package-policy-no-output", + "meta": Object { + "package": Object { + "name": "system", + "version": "1.0.0", + }, + }, + "name": "test-policy-2", + "package_policy_id": "package-policy-no-output", + "revision": 1, + "streams": Array [ + Object { + "data_stream": Object { + "dataset": "some-logs", + "type": "logs", + }, + "id": "test-logs", + }, + ], + "type": "test-logs", + "use_output": "data-output-id", + }, + ], + "output_permissions": Object { + "data-output-id": Object { + "_elastic_agent_checks": Object { + "cluster": Array [ + "monitor", + ], + }, + "package-policy-no-output": Object { + "indices": Array [ + Object { + "names": Array [ + "logs-some-logs-defaultspace", + ], + "privileges": Array [ + "auto_configure", + "create_doc", + ], + }, + ], + }, + }, + "default": Object { + "_elastic_agent_checks": Object { + "cluster": Array [ + "monitor", + ], + }, + "_elastic_agent_monitoring": Object { + "indices": Array [ + Object { + "names": Array [], + "privileges": Array [], + }, + ], + }, + "package-policy-using-output": Object { + "indices": Array [ + Object { + "names": Array [ + "logs-some-logs-policyspace", + ], + "privileges": Array [ + "auto_configure", + "create_doc", + ], + }, + ], + }, + }, + }, + "outputs": Object { + "data-output-id": Object { + "hosts": Array [ + "http://es-data.co:9201", + ], + "preset": "balanced", + "type": "elasticsearch", + }, + "default": Object { + "hosts": Array [ + "http://127.0.0.1:9201", + ], + "preset": "balanced", + "type": "elasticsearch", + }, + }, + "revision": 1, + "secret_references": Array [], + "signed": Object { + "data": "", + "signature": "", + }, +} +`; + exports[`getFullAgentPolicy should return the right outputs and permissions when package policies use their own outputs 1`] = ` Object { "agent": Object { diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/full_agent_policy.test.ts b/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/full_agent_policy.test.ts index 96fd29b9534c6..d96393f56b7ef 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/full_agent_policy.test.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/full_agent_policy.test.ts @@ -564,6 +564,126 @@ describe('getFullAgentPolicy', () => { expect(agentPolicy).toMatchSnapshot(); }); + it('should return the right outputs and permissions when package policies use their own outputs (with default output)', async () => { + mockedGetPackageInfo.mockResolvedValue({ + data_streams: [ + { + type: 'logs', + dataset: 'elastic_agent.metricbeat', + }, + { + type: 'metrics', + dataset: 'elastic_agent.metricbeat', + }, + { + type: 'logs', + dataset: 'elastic_agent.filebeat', + }, + { + type: 'metrics', + dataset: 'elastic_agent.filebeat', + }, + ], + } as PackageInfo); + mockAgentPolicy({ + id: 'integration-output-policy', + status: 'active', + package_policies: [ + { + id: 'package-policy-using-output', + name: 'test-policy-1', + namespace: 'policyspace', + enabled: true, + package: { name: 'test_package', version: '0.0.0', title: 'Test Package' }, + output_id: 'test-id', + inputs: [ + { + type: 'test-logs', + enabled: true, + streams: [ + { + id: 'test-logs', + enabled: true, + data_stream: { type: 'logs', dataset: 'some-logs' }, + }, + ], + }, + { + type: 'test-metrics', + enabled: false, + streams: [ + { + id: 'test-logs', + enabled: false, + data_stream: { type: 'metrics', dataset: 'some-metrics' }, + }, + ], + }, + ], + created_at: '', + updated_at: '', + created_by: '', + updated_by: '', + revision: 1, + policy_id: '', + policy_ids: [''], + }, + { + id: 'package-policy-no-output', + name: 'test-policy-2', + namespace: '', + enabled: true, + package: { name: 'system', version: '1.0.0', title: 'System' }, + inputs: [ + { + type: 'test-logs', + enabled: true, + streams: [ + { + id: 'test-logs', + enabled: true, + data_stream: { type: 'logs', dataset: 'some-logs' }, + }, + ], + }, + { + type: 'test-metrics', + enabled: false, + streams: [ + { + id: 'test-logs', + enabled: false, + data_stream: { type: 'metrics', dataset: 'some-metrics' }, + }, + ], + }, + ], + created_at: '', + updated_at: '', + created_by: '', + updated_by: '', + revision: 1, + policy_id: '', + policy_ids: [''], + }, + ], + is_managed: false, + namespace: 'defaultspace', + revision: 1, + name: 'Policy', + updated_at: '2020-01-01', + updated_by: 'qwerty', + is_protected: false, + data_output_id: 'data-output-id', + }); + + const agentPolicy = await getFullAgentPolicy( + savedObjectsClientMock.create(), + 'integration-output-policy' + ); + expect(agentPolicy).toMatchSnapshot(); + }); + it('should return the sourceURI from the agent policy', async () => { mockAgentPolicy({ namespace: 'default', diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/full_agent_policy.ts b/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/full_agent_policy.ts index 8116856265157..ea14167bb324a 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/full_agent_policy.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agent_policies/full_agent_policy.ts @@ -120,13 +120,23 @@ export async function getFullAgentPolicy( }) ); - const inputs = await storedPackagePoliciesToAgentInputs( - agentPolicy.package_policies as PackagePolicy[], - packageInfoCache, - getOutputIdForAgentPolicy(dataOutput), - agentPolicy.namespace, - agentPolicy.global_data_tags - ); + const inputs = ( + await storedPackagePoliciesToAgentInputs( + agentPolicy.package_policies as PackagePolicy[], + packageInfoCache, + getOutputIdForAgentPolicy(dataOutput), + agentPolicy.namespace, + agentPolicy.global_data_tags + ) + ).map((input) => { + // fix output id for default output + const output = outputs.find(({ id: outputId }) => input.use_output === outputId); + if (output) { + input.use_output = getOutputIdForAgentPolicy(output); + } + + return input; + }); const features = (agentPolicy.agent_features || []).reduce((acc, { name, ...featureConfig }) => { acc[name] = featureConfig; return acc; diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agent_policy.test.ts b/x-pack/platform/plugins/shared/fleet/server/services/agent_policy.test.ts index 76d2727b65e85..68fde28107340 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agent_policy.test.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agent_policy.test.ts @@ -504,7 +504,7 @@ describe('Agent policy', () => { }); }); - describe('getByIDs', () => { + describe('getByIds', () => { it('should call audit logger', async () => { const soClient = savedObjectsClientMock.create(); @@ -525,7 +525,7 @@ describe('Agent policy', () => { ], }); - await agentPolicyService.getByIDs(soClient, ['test-agent-policy-1', 'test-agent-policy-2']); + await agentPolicyService.getByIds(soClient, ['test-agent-policy-1', 'test-agent-policy-2']); expect(mockedAuditLoggingService.writeCustomSoAuditLog).toHaveBeenNthCalledWith(1, { action: 'get', diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agent_policy.ts b/x-pack/platform/plugins/shared/fleet/server/services/agent_policy.ts index 3a3273383ad38..5cf805008d967 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agent_policy.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agent_policy.ts @@ -507,7 +507,7 @@ class AgentPolicyService { return agentPolicy; } - public async getByIDs( + public async getByIds( soClient: SavedObjectsClientContract, ids: Array, options: { fields?: string[]; withPackagePolicies?: boolean; ignoreMissing?: boolean } = {} @@ -1345,7 +1345,7 @@ class AgentPolicyService { }); } - const policies = await agentPolicyService.getByIDs(soClient, agentPolicyIds); + const policies = await agentPolicyService.getByIds(soClient, agentPolicyIds); const policiesMap = keyBy(policies, 'id'); const fullPolicies = await pMap( agentPolicyIds, diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agents/action_runner.ts b/x-pack/platform/plugins/shared/fleet/server/services/agents/action_runner.ts index f7eea6f3ac560..0b09658a2aeea 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agents/action_runner.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agents/action_runner.ts @@ -63,13 +63,8 @@ export abstract class ActionRunner { protected abstract processAgents(agents: Agent[]): Promise<{ actionId: string }>; - /** - * Common runner logic accross all agent bulk actions - * Starts action execution immeditalely, asynchronously - * On errors, starts a task with Task Manager to retry max 3 times - * If the last batch was stored in state, retry continues from there (searchAfter) - */ - public async runActionAsyncWithRetry(): Promise<{ actionId: string }> { + // first attempt to run bulk action async in a task, called from API handlers + public async runActionAsyncTask(): Promise<{ actionId: string }> { appContextService .getLogger() .info( @@ -82,6 +77,33 @@ export abstract class ActionRunner { this.bulkActionsResolver = await appContextService.getBulkActionsResolver(); } + const taskId = this.bulkActionsResolver!.getTaskId( + this.actionParams.actionId!, + this.getTaskType() + ); + await this.bulkActionsResolver!.run( + this.actionParams, + { + ...this.retryParams, + retryCount: (this.retryParams.retryCount ?? 0) + 1, + }, + this.getTaskType(), + taskId + ); + return { actionId: this.actionParams.actionId! }; + } + + /** + * Common runner logic accross all agent bulk actions + * Starts action execution immeditalely, asynchronously + * On errors, starts a task with Task Manager to retry max 3 times + * If the last batch was stored in state, retry continues from there (searchAfter) + */ + public async runActionAsyncWithRetry(): Promise<{ actionId: string }> { + if (!this.bulkActionsResolver) { + this.bulkActionsResolver = await appContextService.getBulkActionsResolver(); + } + // create task to check result with some delay, this runs in case of kibana crash too this.checkTaskId = await this.createCheckResultTask(); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agents/bulk_actions_resolver.ts b/x-pack/platform/plugins/shared/fleet/server/services/agents/bulk_actions_resolver.ts index b68bae611252a..fdb03ff4edd38 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agents/bulk_actions_resolver.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agents/bulk_actions_resolver.ts @@ -144,7 +144,11 @@ export function createRetryTask( appContextService .getLogger() - .debug(`Retry #${retryParams.retryCount} of task ${taskInstance.id}`); + .debug( + retryParams.retryCount === 1 + ? `Running task ${taskInstance.id}` + : `Retry #${retryParams.retryCount} of task ${taskInstance.id}` + ); if (retryParams.searchAfter) { appContextService.getLogger().info('Continuing task from batch ' + retryParams.searchAfter); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agents/hosted_agent.test.ts b/x-pack/platform/plugins/shared/fleet/server/services/agents/hosted_agent.test.ts index 997bb0817351c..f92d2b00656d5 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agents/hosted_agent.test.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agents/hosted_agent.test.ts @@ -14,7 +14,7 @@ import { getHostedPolicies, isHostedAgent } from './hosted_agent'; jest.mock('../agent_policy', () => { return { agentPolicyService: { - getByIDs: jest.fn().mockResolvedValue([ + getByIds: jest.fn().mockResolvedValue([ { id: 'hosted-policy', is_managed: true }, { id: 'regular-policy', is_managed: false }, ]), diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agents/hosted_agent.ts b/x-pack/platform/plugins/shared/fleet/server/services/agents/hosted_agent.ts index 4acba8551e86d..06c85805d88dd 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agents/hosted_agent.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agents/hosted_agent.ts @@ -20,7 +20,7 @@ export async function getHostedPolicies( ); // get the agent policies for those ids - const agentPolicies = await agentPolicyService.getByIDs(soClient, Array.from(policyIdsToGet), { + const agentPolicies = await agentPolicyService.getByIds(soClient, Array.from(policyIdsToGet), { fields: ['is_managed'], ignoreMissing: true, }); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agents/reassign.ts b/x-pack/platform/plugins/shared/fleet/server/services/agents/reassign.ts index 89222f4773f90..62cce9fbdeeec 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agents/reassign.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agents/reassign.ts @@ -143,7 +143,7 @@ export async function reassignAgents( newAgentPolicyId, }, { pitId: await openPointInTime(esClient) } - ).runActionAsyncWithRetry(); + ).runActionAsyncTask(); } } diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agents/request_diagnostics.ts b/x-pack/platform/plugins/shared/fleet/server/services/agents/request_diagnostics.ts index c4f0e1f0591ad..d78c4b191de75 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agents/request_diagnostics.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agents/request_diagnostics.ts @@ -88,6 +88,6 @@ export async function bulkRequestDiagnostics( spaceId: currentSpaceId, }, { pitId: await openPointInTime(esClient) } - ).runActionAsyncWithRetry(); + ).runActionAsyncTask(); } } diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agents/unenroll.ts b/x-pack/platform/plugins/shared/fleet/server/services/agents/unenroll.ts index 01b26d1f40fcd..ac92cea8fdaca 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agents/unenroll.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agents/unenroll.ts @@ -116,7 +116,7 @@ export async function unenrollAgents( total: res.total, }, { pitId: await openPointInTime(esClient) } - ).runActionAsyncWithRetry(); + ).runActionAsyncTask(); } } diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agents/update_agent_tags.test.ts b/x-pack/platform/plugins/shared/fleet/server/services/agents/update_agent_tags.test.ts index 6a2410dfa3c16..2e6348876868d 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agents/update_agent_tags.test.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agents/update_agent_tags.test.ts @@ -34,7 +34,7 @@ jest.mock('../agent_policy', () => { return { agentPolicyService: { getInactivityTimeouts: jest.fn().mockResolvedValue([]), - getByIDs: jest.fn().mockResolvedValue([{ id: 'hosted-agent-policy', is_managed: true }]), + getByIds: jest.fn().mockResolvedValue([{ id: 'hosted-agent-policy', is_managed: true }]), list: jest.fn().mockResolvedValue({ items: [] }), }, }; @@ -44,7 +44,7 @@ const mockRunAsync = jest.fn().mockResolvedValue({}); jest.mock('./update_agent_tags_action_runner', () => ({ ...jest.requireActual('./update_agent_tags_action_runner'), UpdateAgentTagsActionRunner: jest.fn().mockImplementation(() => { - return { runActionAsyncWithRetry: mockRunAsync }; + return { runActionAsyncWithRetry: mockRunAsync, runActionAsyncTask: mockRunAsync }; }), })); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agents/update_agent_tags.ts b/x-pack/platform/plugins/shared/fleet/server/services/agents/update_agent_tags.ts index 2293130ed5148..a26c72f4b2b57 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agents/update_agent_tags.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agents/update_agent_tags.ts @@ -80,7 +80,7 @@ export async function updateAgentTags( total: res.total, }, { pitId } - ).runActionAsyncWithRetry(); + ).runActionAsyncTask(); } return await updateTagsBatch(soClient, esClient, givenAgents, outgoingErrors, { diff --git a/x-pack/platform/plugins/shared/fleet/server/services/agents/upgrade.ts b/x-pack/platform/plugins/shared/fleet/server/services/agents/upgrade.ts index c5e4fdc1134f0..89f77bd9fb46e 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/agents/upgrade.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/agents/upgrade.ts @@ -118,7 +118,7 @@ export async function sendUpgradeAgentsActions( spaceId: currentSpaceId, }, { pitId: await openPointInTime(esClient) } - ).runActionAsyncWithRetry(); + ).runActionAsyncTask(); } } diff --git a/x-pack/platform/plugins/shared/fleet/server/services/fleet_server/index.test.ts b/x-pack/platform/plugins/shared/fleet/server/services/fleet_server/index.test.ts index 5b9155a756645..1832ba78e8dd7 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/fleet_server/index.test.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/fleet_server/index.test.ts @@ -204,7 +204,7 @@ describe('getFleetServerPolicies', () => { page: 1, perPage: mockPackagePolicies.length, }); - (mockedAgentPolicyService.getByIDs as jest.Mock).mockResolvedValueOnce(mockFleetServerPolicies); + (mockedAgentPolicyService.getByIds as jest.Mock).mockResolvedValueOnce(mockFleetServerPolicies); const result = await getFleetServerPolicies(soClient); expect(result).toEqual(mockFleetServerPolicies); }); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/fleet_server/index.ts b/x-pack/platform/plugins/shared/fleet/server/services/fleet_server/index.ts index e596709523351..034db5fdb0c1d 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/fleet_server/index.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/fleet_server/index.ts @@ -41,7 +41,7 @@ export const getFleetServerPolicies = async ( // Retrieve associated agent policies const fleetServerAgentPolicies = fleetServerAgentPolicyIds.length - ? await agentPolicyService.getByIDs( + ? await agentPolicyService.getByIds( soClient, uniqBy(fleetServerAgentPolicyIds, (p) => p.id) ) diff --git a/x-pack/platform/plugins/shared/fleet/server/services/index.ts b/x-pack/platform/plugins/shared/fleet/server/services/index.ts index deb902914a190..9db62cc61c2ed 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/index.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/index.ts @@ -15,10 +15,12 @@ export { getRegistryUrl } from './epm/registry/registry_url'; */ export interface AgentPolicyServiceInterface { + create: (typeof agentPolicyService)['create']; get: (typeof agentPolicyService)['get']; list: (typeof agentPolicyService)['list']; + delete: (typeof agentPolicyService)['delete']; getFullAgentPolicy: (typeof agentPolicyService)['getFullAgentPolicy']; - getByIds: (typeof agentPolicyService)['getByIDs']; + getByIds: (typeof agentPolicyService)['getByIds']; turnOffAgentTamperProtections: (typeof agentPolicyService)['turnOffAgentTamperProtections']; fetchAllAgentPolicyIds: (typeof agentPolicyService)['fetchAllAgentPolicyIds']; fetchAllAgentPolicies: (typeof agentPolicyService)['fetchAllAgentPolicies']; diff --git a/x-pack/platform/plugins/shared/fleet/server/services/output.test.ts b/x-pack/platform/plugins/shared/fleet/server/services/output.test.ts index f2dab8401e641..6b7da2744ffc5 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/output.test.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/output.test.ts @@ -316,7 +316,7 @@ describe('Output Service', () => { } as unknown as ReturnType; beforeEach(() => { - mockedAgentPolicyService.getByIDs.mockResolvedValue([]); + mockedAgentPolicyService.getByIds.mockResolvedValue([]); mockedAgentPolicyService.list.mockClear(); mockedPackagePolicyService.list.mockReset(); mockedAgentPolicyService.hasAPMIntegration.mockClear(); @@ -334,7 +334,7 @@ describe('Output Service', () => { }); afterEach(() => { - mockedAgentPolicyService.getByIDs.mockClear(); + mockedAgentPolicyService.getByIds.mockClear(); }); describe('create', () => { @@ -688,7 +688,7 @@ describe('Output Service', () => { mockedPackagePolicyService.list.mockResolvedValue( mockedPackagePolicyWithFleetServerResolvedValue ); - mockedAgentPolicyService.getByIDs.mockResolvedValue( + mockedAgentPolicyService.getByIds.mockResolvedValue( (await mockedAgentPolicyWithFleetServerResolvedValue).items ); @@ -727,7 +727,7 @@ describe('Output Service', () => { mockedPackagePolicyService.list.mockResolvedValue( mockedPackagePolicyWithSyntheticsResolvedValue ); - mockedAgentPolicyService.getByIDs.mockResolvedValue( + mockedAgentPolicyService.getByIds.mockResolvedValue( (await mockedAgentPolicyWithSyntheticsResolvedValue).items ); @@ -845,7 +845,7 @@ describe('Output Service', () => { mockedPackagePolicyService.list.mockResolvedValue( mockedPackagePolicyWithFleetServerResolvedValue ); - mockedAgentPolicyService.getByIDs.mockResolvedValue( + mockedAgentPolicyService.getByIds.mockResolvedValue( (await mockedAgentPolicyWithFleetServerResolvedValue).items ); @@ -884,7 +884,7 @@ describe('Output Service', () => { mockedPackagePolicyService.list.mockResolvedValue( mockedPackagePolicyWithSyntheticsResolvedValue ); - mockedAgentPolicyService.getByIDs.mockResolvedValue( + mockedAgentPolicyService.getByIds.mockResolvedValue( (await mockedAgentPolicyWithSyntheticsResolvedValue).items ); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/output.ts b/x-pack/platform/plugins/shared/fleet/server/services/output.ts index 0b30890ee566d..f7f211862a896 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/output.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/output.ts @@ -176,7 +176,7 @@ async function getAgentPoliciesPerOutput(outputId?: string, isDefault?: boolean) }, []) ), ]; - const agentPoliciesFromPackagePolicies = await agentPolicyService.getByIDs( + const agentPoliciesFromPackagePolicies = await agentPolicyService.getByIds( internalSoClientWithoutSpaceExtension, agentPolicyIdsFromPackagePolicies ); @@ -245,7 +245,7 @@ async function findPoliciesWithFleetServerOrSynthetics(outputId?: string, isDefa ); const agentPolicyIds = _.uniq(packagePolicies.flatMap((p) => p.policy_ids)); if (agentPolicyIds.length) { - agentPolicies = await agentPolicyService.getByIDs( + agentPolicies = await agentPolicyService.getByIds( internalSoClientWithoutSpaceExtension, agentPolicyIds ); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/package_policy.test.ts b/x-pack/platform/plugins/shared/fleet/server/services/package_policy.test.ts index 7ea6ae290708b..29d9142d13ed8 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/package_policy.test.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/package_policy.test.ts @@ -227,7 +227,7 @@ const mockAgentPolicyGet = (spaceIds: string[] = ['default']) => { }); } ); - mockAgentPolicyService.getByIDs.mockImplementation( + mockAgentPolicyService.getByIds.mockImplementation( // @ts-ignore (_soClient: SavedObjectsClientContract, ids: string[]) => { return Promise.resolve( diff --git a/x-pack/platform/plugins/shared/fleet/server/services/package_policy.ts b/x-pack/platform/plugins/shared/fleet/server/services/package_policy.ts index 3ff369994c5c7..7caba78ab862a 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/package_policy.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/package_policy.ts @@ -518,7 +518,7 @@ class PackagePolicyClientImpl implements PackagePolicyClient { const agentPolicyIds = new Set(packagePolicies.flatMap((pkgPolicy) => pkgPolicy.policy_ids)); - const agentPolicies = await agentPolicyService.getByIDs(soClient, [...agentPolicyIds]); + const agentPolicies = await agentPolicyService.getByIds(soClient, [...agentPolicyIds]); const agentPoliciesIndexById = indexBy('id', agentPolicies); for (const agentPolicy of agentPolicies) { validateIsNotHostedPolicy(agentPolicy, options?.force); @@ -1551,7 +1551,7 @@ class PackagePolicyClientImpl implements PackagePolicyClient { return acc; }, new Set()); - const agentPolicies = await agentPolicyService.getByIDs(soClient, uniquePolicyIdsR); + const agentPolicies = await agentPolicyService.getByIds(soClient, uniquePolicyIdsR); for (const policyId of uniquePolicyIdsR) { const agentPolicy = agentPolicies.find((p) => p.id === policyId); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/security/uninstall_token_service/index.test.ts b/x-pack/platform/plugins/shared/fleet/server/services/security/uninstall_token_service/index.test.ts index d2daf3ff46ae5..e3f6f3369bfc0 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/security/uninstall_token_service/index.test.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/security/uninstall_token_service/index.test.ts @@ -217,7 +217,7 @@ describe('UninstallTokenService', () => { agentPolicyService.deployPolicies = jest.fn(); getAgentPoliciesByIDsMock = jest.fn().mockResolvedValue([]); - agentPolicyService.getByIDs = getAgentPoliciesByIDsMock; + agentPolicyService.getByIds = getAgentPoliciesByIDsMock; if (scoppedInSpace) { soClientMock.getCurrentNamespace.mockReturnValue(scoppedInSpace); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/security/uninstall_token_service/index.ts b/x-pack/platform/plugins/shared/fleet/server/services/security/uninstall_token_service/index.ts index 275dcfc3a281d..4cbb0874a39a5 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/security/uninstall_token_service/index.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/security/uninstall_token_service/index.ts @@ -305,7 +305,7 @@ export class UninstallTokenService implements UninstallTokenServiceInterface { } private async getPolicyIdNameDictionary(policyIds: string[]): Promise> { - const agentPolicies = await agentPolicyService.getByIDs(this.soClient, policyIds, { + const agentPolicies = await agentPolicyService.getByIds(this.soClient, policyIds, { ignoreMissing: true, }); @@ -615,7 +615,7 @@ export class UninstallTokenService implements UninstallTokenServiceInterface { const batchSize = config?.setup?.agentPolicySchemaUpgradeBatchSize ?? 100; await asyncForEach(chunk(policyIds, batchSize), async (policyIdsBatch) => { - const policies = await agentPolicyService.getByIDs( + const policies = await agentPolicyService.getByIds( appContextService.getInternalUserSOClientWithoutSpaceExtension(), policyIds.map((id) => ({ id, spaceId: '*' })) ); diff --git a/x-pack/platform/plugins/shared/fleet/server/services/spaces/agent_policy.ts b/x-pack/platform/plugins/shared/fleet/server/services/spaces/agent_policy.ts index dce40f4cc3ff4..ed3bfa2619134 100644 --- a/x-pack/platform/plugins/shared/fleet/server/services/spaces/agent_policy.ts +++ b/x-pack/platform/plugins/shared/fleet/server/services/spaces/agent_policy.ts @@ -154,21 +154,6 @@ export async function updateAgentPolicySpaces({ ignore_unavailable: true, refresh: true, }); - await esClient.updateByQuery({ - index: AGENTS_INDEX, - query: { - bool: { - must: { - terms: { - policy_id: [agentPolicyId], - }, - }, - }, - }, - script: `ctx._source.namespaces = [${newSpaceIds.map((spaceId) => `"${spaceId}"`).join(',')}]`, - ignore_unavailable: true, - refresh: true, - }); const agentIndexExists = await esClient.indices.exists({ index: AGENTS_INDEX, @@ -195,6 +180,21 @@ export async function updateAgentPolicySpaces({ break; } + const agentBulkRes = await esClient.bulk({ + operations: agents.flatMap(({ id }) => [ + { update: { _id: id, _index: AGENTS_INDEX, retry_on_conflict: 5 } }, + { doc: { namespaces: newSpaceIds } }, + ]), + refresh: 'wait_for', + index: AGENTS_INDEX, + }); + + for (const item of agentBulkRes.items) { + if (item.update?.error) { + throw item.update?.error; + } + } + const lastAgent = agents[agents.length - 1]; searchAfter = lastAgent.sort; diff --git a/x-pack/platform/plugins/shared/global_search/server/routes/find.ts b/x-pack/platform/plugins/shared/global_search/server/routes/find.ts index ee151dc1c4856..9772c849b6f22 100644 --- a/x-pack/platform/plugins/shared/global_search/server/routes/find.ts +++ b/x-pack/platform/plugins/shared/global_search/server/routes/find.ts @@ -14,6 +14,12 @@ export const registerInternalFindRoute = (router: GlobalSearchRouter) => { router.post( { path: '/internal/global_search/find', + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: { body: schema.object({ params: schema.object({ diff --git a/x-pack/platform/plugins/shared/global_search/server/routes/get_searchable_types.ts b/x-pack/platform/plugins/shared/global_search/server/routes/get_searchable_types.ts index f456c0e665f19..4b4c44973dd46 100644 --- a/x-pack/platform/plugins/shared/global_search/server/routes/get_searchable_types.ts +++ b/x-pack/platform/plugins/shared/global_search/server/routes/get_searchable_types.ts @@ -11,6 +11,12 @@ export const registerInternalSearchableTypesRoute = (router: GlobalSearchRouter) router.get( { path: '/internal/global_search/searchable_types', + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: false, }, async (ctx, req, res) => { diff --git a/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/api_analysis.ts b/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/api_analysis.ts new file mode 100644 index 0000000000000..e181160624af1 --- /dev/null +++ b/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/api_analysis.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ApiAnalysisState } from '../../server/types'; + +export const apiAnalysisTestState: ApiAnalysisState = { + dataStreamName: 'testDataStream', + lastExecutedChain: 'testchain', + results: { test: 'testResults' }, + pathOptions: { '/path1': 'path1 description', '/path2': 'path2 description' }, + suggestedPaths: ['/path1'], +}; + +export const apiAnalysisPathSuggestionsMockedResponse = ['/path1', '/path2', '/path3', '/path4']; + +export const apiAnalysisExpectedResults = { + suggestedPaths: ['/path1', '/path2', '/path3', '/path4'], +}; diff --git a/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/cel.ts b/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/cel.ts index e13c4216fbcdd..ff29e575baf6c 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/cel.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/cel.ts @@ -5,18 +5,25 @@ * 2.0. */ -export const celTestState = { +import { CelInputState } from '../../server/types'; + +export const celTestState: CelInputState = { dataStreamName: 'testDataStream', - apiDefinition: 'apiDefinition', lastExecutedChain: 'testchain', finalized: false, apiQuerySummary: 'testQuerySummary', - exampleCelPrograms: [], currentProgram: 'testProgram', stateVarNames: ['testVar'], stateSettings: { test: 'testDetails' }, + configFields: { test: { config1: 'config1testDetails' } }, redactVars: ['testRedact'], results: { test: 'testResults' }, + path: './testPath', + authType: 'basic', + openApiPathDetails: {}, + openApiSchemas: {}, + openApiAuthSchema: {}, + hasProgramHeaders: false, }; export const celQuerySummaryMockedResponse = `To cover all events in a chronological manner for the device_tasks endpoint, you should use the /v1/device_tasks GET route with pagination parameters. Specifically, use the pageSize and pageToken query parameters. Start with a large pageSize and use the nextPageToken from each response to fetch subsequent pages until all events are retrieved. @@ -83,16 +90,25 @@ export const celStateDetailsMockedResponse = [ name: 'config1', default: 50, redact: false, + configurable: true, + description: 'config1 description', + type: 'number', }, { name: 'config2', default: '', redact: true, + configurable: false, + description: 'config2 description', + type: 'string', }, { name: 'config3', default: 'event', redact: false, + configurable: false, + description: 'config3 description', + type: 'string', }, ]; @@ -102,6 +118,14 @@ export const celStateSettings = { config3: 'event', }; +export const celConfigFields = { + config1: { + default: 50, + type: 'number', + description: 'config1 description', + }, +}; + export const celRedact = ['config2']; export const celExpectedResults = { @@ -111,5 +135,13 @@ export const celExpectedResults = { config2: '', config3: 'event', }, + configFields: { + config1: { + default: 50, + type: 'number', + description: 'config1 description', + }, + }, + needsAuthConfigBlock: false, redactVars: ['config2'], }; diff --git a/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/index.ts b/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/index.ts index a25e3d6cf43a7..6bfb32a61d3d6 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/index.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/__jest__/fixtures/index.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import type { Pipeline } from '../../common'; +import type { CelAuthType, Pipeline } from '../../common'; const currentPipelineMock: Pipeline = { description: 'Pipeline to process mysql_enterprise audit logs', processors: [ @@ -53,7 +53,16 @@ export const mockedRequestWithPipeline = { currentPipeline: currentPipelineMock, }; -export const mockedRequestWithApiDefinition = { - apiDefinition: '{ "openapi": "3.0.0" }', +export const mockedRequestWithCelDetails = { + dataStreamTitle: 'audit', + path: '/events', + authType: 'basic' as CelAuthType, + openApiDetails: {}, + openApiSchema: {}, + openApiAuthSchema: {}, +}; + +export const mockedApiAnalysisRequest = { dataStreamName: 'audit', + pathOptions: { '/path1': 'path1 description' }, }; diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/api/analyze_api/analyze_api_route.gen.ts b/x-pack/platform/plugins/shared/integration_assistant/common/api/analyze_api/analyze_api_route.gen.ts new file mode 100644 index 0000000000000..1db062322e7b1 --- /dev/null +++ b/x-pack/platform/plugins/shared/integration_assistant/common/api/analyze_api/analyze_api_route.gen.ts @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/* + * NOTICE: Do not edit this file manually. + * This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. + * + * info: + * title: Automatic Import Analyze API specifications API endpoint + * version: 1 + */ + +import { z } from '@kbn/zod'; + +import { DataStreamTitle, Connector, LangSmithOptions } from '../model/common_attributes.gen'; +import { PathOptions } from '../model/cel_input_attributes.gen'; +import { AnalyzeApiAPIResponse } from '../model/response_schemas.gen'; + +export type AnalyzeApiRequestBody = z.infer; +export const AnalyzeApiRequestBody = z.object({ + dataStreamTitle: DataStreamTitle, + pathOptions: PathOptions, + connectorId: Connector, + langSmithOptions: LangSmithOptions.optional(), +}); +export type AnalyzeApiRequestBodyInput = z.input; + +export type AnalyzeApiResponse = z.infer; +export const AnalyzeApiResponse = AnalyzeApiAPIResponse; diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/api/analyze_api/analyze_api_route.schema.yaml b/x-pack/platform/plugins/shared/integration_assistant/common/api/analyze_api/analyze_api_route.schema.yaml new file mode 100644 index 0000000000000..1478355e4ce92 --- /dev/null +++ b/x-pack/platform/plugins/shared/integration_assistant/common/api/analyze_api/analyze_api_route.schema.yaml @@ -0,0 +1,39 @@ +openapi: 3.0.3 +info: + title: Automatic Import Analyze API specifications API endpoint + version: "1" +paths: + /internal/automatic_import/analyzeapi: + post: + summary: Analyzes API specifications. + operationId: AnalyzeApi + x-codegen-enabled: true + description: Analyzes API specifications. + tags: + - Analyze API spec + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - dataStreamTitle + - pathOptions + - connectorId + properties: + dataStreamTitle: + $ref: "../model/common_attributes.schema.yaml#/components/schemas/DataStreamTitle" + pathOptions: + $ref: "../model/cel_input_attributes.schema.yaml#/components/schemas/PathOptions" + connectorId: + $ref: "../model/common_attributes.schema.yaml#/components/schemas/Connector" + langSmithOptions: + $ref: "../model/common_attributes.schema.yaml#/components/schemas/LangSmithOptions" + responses: + 200: + description: Indicates a successful call. + content: + application/json: + schema: + $ref: "../model/response_schemas.schema.yaml#/components/schemas/AnalyzeApiAPIResponse" \ No newline at end of file diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/api/analyze_api/analyze_api_route.test.ts b/x-pack/platform/plugins/shared/integration_assistant/common/api/analyze_api/analyze_api_route.test.ts new file mode 100644 index 0000000000000..4ea2ce6e3d84c --- /dev/null +++ b/x-pack/platform/plugins/shared/integration_assistant/common/api/analyze_api/analyze_api_route.test.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { expectParseSuccess } from '@kbn/zod-helpers'; +import { AnalyzeApiRequestBody } from './analyze_api_route.gen'; +import { getAnalyzeApiRequestBody } from '../model/api_test.mock'; + +describe('Analyze API request schema', () => { + test('full request validate', () => { + const payload: AnalyzeApiRequestBody = getAnalyzeApiRequestBody(); + + const result = AnalyzeApiRequestBody.safeParse(payload); + expectParseSuccess(result); + expect(result.data).toEqual(payload); + }); +}); diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/api/cel/cel_input_route.gen.ts b/x-pack/platform/plugins/shared/integration_assistant/common/api/cel/cel_input_route.gen.ts index 276fd27072c98..78acca695dcbc 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/common/api/cel/cel_input_route.gen.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/common/api/cel/cel_input_route.gen.ts @@ -16,14 +16,14 @@ import { z } from '@kbn/zod'; -import { DataStreamName, Connector, LangSmithOptions } from '../model/common_attributes.gen'; -import { ApiDefinition } from '../model/cel_input_attributes.gen'; +import { DataStreamTitle, Connector, LangSmithOptions } from '../model/common_attributes.gen'; +import { CelDetails } from '../model/cel_input_attributes.gen'; import { CelInputAPIResponse } from '../model/response_schemas.gen'; export type CelInputRequestBody = z.infer; export const CelInputRequestBody = z.object({ - dataStreamName: DataStreamName, - apiDefinition: ApiDefinition, + dataStreamTitle: DataStreamTitle, + celDetails: CelDetails, connectorId: Connector, langSmithOptions: LangSmithOptions.optional(), }); diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/api/cel/cel_input_route.schema.yaml b/x-pack/platform/plugins/shared/integration_assistant/common/api/cel/cel_input_route.schema.yaml index dc33d9ac69e3e..3cf96994fee63 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/common/api/cel/cel_input_route.schema.yaml +++ b/x-pack/platform/plugins/shared/integration_assistant/common/api/cel/cel_input_route.schema.yaml @@ -18,14 +18,14 @@ paths: schema: type: object required: - - apiDefinition - - dataStreamName + - dataStreamTitle + - celDetails - connectorId properties: - dataStreamName: - $ref: "../model/common_attributes.schema.yaml#/components/schemas/DataStreamName" - apiDefinition: - $ref: "../model/cel_input_attributes.schema.yaml#/components/schemas/ApiDefinition" + dataStreamTitle: + $ref: "../model/common_attributes.schema.yaml#/components/schemas/DataStreamTitle" + celDetails: + $ref: "../model/cel_input_attributes.schema.yaml#/components/schemas/CelDetails" connectorId: $ref: "../model/common_attributes.schema.yaml#/components/schemas/Connector" langSmithOptions: diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/api/model/api_test.mock.ts b/x-pack/platform/plugins/shared/integration_assistant/common/api/model/api_test.mock.ts index c8f6967503ac3..5eebe4db17f75 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/common/api/model/api_test.mock.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/common/api/model/api_test.mock.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { AnalyzeApiRequestBody } from '../analyze_api/analyze_api_route.gen'; import type { AnalyzeLogsRequestBody } from '../analyze_logs/analyze_logs_route.gen'; import type { BuildIntegrationRequestBody } from '../build_integration/build_integration.gen'; import type { CategorizationRequestBody } from '../categorization/categorization_route.gen'; @@ -67,9 +68,17 @@ export const getCategorizationRequestMock = (): CategorizationRequestBody => ({ }); export const getCelRequestMock = (): CelInputRequestBody => ({ - dataStreamName: 'test-data-stream-name', - apiDefinition: 'test-api-definition', + dataStreamTitle: 'test-data-stream-title', connectorId: 'test-connector-id', + celDetails: { + path: 'test-cel-path', + auth: 'basic', + openApiDetails: { + operation: 'test-open-api-operation', + schemas: 'test-open-api-schemas', + auth: 'test-open-api-auth', + }, + }, }); export const getBuildIntegrationRequestMock = (): BuildIntegrationRequestBody => ({ @@ -101,3 +110,9 @@ export const getAnalyzeLogsRequestBody = (): AnalyzeLogsRequestBody => ({ connectorId: 'test-connector-id', logSamples: rawSamples, }); + +export const getAnalyzeApiRequestBody = (): AnalyzeApiRequestBody => ({ + connectorId: 'test-connector-id', + dataStreamTitle: 'test-data-stream-name', + pathOptions: { '/v1/events': 'the path for events', '/v1/logs': 'the path for logs' }, +}); diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/api/model/cel_input_attributes.gen.ts b/x-pack/platform/plugins/shared/integration_assistant/common/api/model/cel_input_attributes.gen.ts index 9ee1ee2ed290f..ed73099f9e74c 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/common/api/model/cel_input_attributes.gen.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/common/api/model/cel_input_attributes.gen.ts @@ -16,18 +16,59 @@ import { z } from '@kbn/zod'; +export type PathOptions = z.infer; +export const PathOptions = z.object({}).catchall(z.unknown()); + +/** + * The type of auth utilized for the input. + */ +export type CelAuthType = z.infer; +export const CelAuthType = z.enum(['basic', 'digest', 'oauth2', 'header']); +export type CelAuthTypeEnum = typeof CelAuthType.enum; +export const CelAuthTypeEnum = CelAuthType.enum; + +/** + * Necessary OpenAPI spec details for building a CEL program. + */ +export type OpenApiDetails = z.infer; +export const OpenApiDetails = z.object({ + operation: z.string(), + schemas: z.string(), + auth: z.string().optional(), +}); + /** - * String form of the Open API schema. + * Details for building a CEL program. */ -export type ApiDefinition = z.infer; -export const ApiDefinition = z.string(); +export type CelDetails = z.infer; +export const CelDetails = z.object({ + path: z.string(), + auth: CelAuthType, + openApiDetails: OpenApiDetails.optional(), +}); + +/** + * Generated CEL details. + */ +export type GeneratedCelDetails = z.infer; +export const GeneratedCelDetails = z.object({ + configFields: z.object({}).catchall(z.unknown()), + program: z.string(), + needsAuthConfigBlock: z.boolean(), + stateSettings: z.object({}).catchall(z.unknown()), + redactVars: z.array(z.string()), +}); /** * Optional CEL input details. */ export type CelInput = z.infer; export const CelInput = z.object({ + authType: CelAuthType, + configFields: z.object({}).catchall(z.unknown()), + needsAuthConfigBlock: z.boolean(), program: z.string(), stateSettings: z.object({}).catchall(z.unknown()), redactVars: z.array(z.string()), + url: z.string(), }); diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/api/model/cel_input_attributes.schema.yaml b/x-pack/platform/plugins/shared/integration_assistant/common/api/model/cel_input_attributes.schema.yaml index cd05202ddfda0..a4d575927a106 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/common/api/model/cel_input_attributes.schema.yaml +++ b/x-pack/platform/plugins/shared/integration_assistant/common/api/model/cel_input_attributes.schema.yaml @@ -6,18 +6,82 @@ paths: {} components: x-codegen-enabled: true schemas: - ApiDefinition: - type: string - description: String form of the Open API schema. + PathOptions: + type: object + additionalProperties: true + + CelDetails: + type: object + description: Details for building a CEL program. + required: + - path + - auth + properties: + path: + type: string + auth: + $ref: "#/components/schemas/CelAuthType" + openApiDetails: + $ref: "#/components/schemas/OpenApiDetails" + + OpenApiDetails: + type: object + description: Necessary OpenAPI spec details for building a CEL program. + required: + - operation + - schemas + properties: + operation: + type: string + schemas: + type: string + auth: + type: string + GeneratedCelDetails: + type: object + description: Generated CEL details. + required: + - configFields + - program + - needsAuthConfigBlock + - stateSettings + - redactVars + properties: + configFields: + type: object + additionalProperties: true + program: + type: string + needsAuthConfigBlock: + type: boolean + stateSettings: + type: object + additionalProperties: true + redactVars: + type: array + items: + type: string + CelInput: type: object description: Optional CEL input details. required: + - authType + - configFields - program + - needsAuthConfigBlock - stateSettings - redactVars + - url properties: + authType: + $ref: "#/components/schemas/CelAuthType" + configFields: + type: object + additionalProperties: true + needsAuthConfigBlock: + type: boolean program: type: string stateSettings: @@ -27,4 +91,15 @@ components: type: array items: type: string + url: + type: string + + CelAuthType: + type: string + description: The type of auth utilized for the input. + enum: + - basic + - digest + - oauth2 + - header \ No newline at end of file diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/api/model/response_schemas.gen.ts b/x-pack/platform/plugins/shared/integration_assistant/common/api/model/response_schemas.gen.ts index f13b6fc537235..407e865f3625a 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/common/api/model/response_schemas.gen.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/common/api/model/response_schemas.gen.ts @@ -18,7 +18,7 @@ import { z } from '@kbn/zod'; import { Mapping, Pipeline, Docs, SamplesFormat } from './common_attributes.gen'; import { ESProcessorItem } from './processor_attributes.gen'; -import { CelInput } from './cel_input_attributes.gen'; +import { GeneratedCelDetails } from './cel_input_attributes.gen'; export type EcsMappingAPIResponse = z.infer; export const EcsMappingAPIResponse = z.object({ @@ -62,5 +62,12 @@ export const AnalyzeLogsAPIResponse = z.object({ export type CelInputAPIResponse = z.infer; export const CelInputAPIResponse = z.object({ - results: CelInput, + results: GeneratedCelDetails, +}); + +export type AnalyzeApiAPIResponse = z.infer; +export const AnalyzeApiAPIResponse = z.object({ + results: z.object({ + suggestedPaths: z.array(z.string()), + }), }); diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/api/model/response_schemas.schema.yaml b/x-pack/platform/plugins/shared/integration_assistant/common/api/model/response_schemas.schema.yaml index 62776b9dc5c13..b784bda3e6a95 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/common/api/model/response_schemas.schema.yaml +++ b/x-pack/platform/plugins/shared/integration_assistant/common/api/model/response_schemas.schema.yaml @@ -95,4 +95,19 @@ components: - results properties: results: - $ref: "./cel_input_attributes.schema.yaml#/components/schemas/CelInput" \ No newline at end of file + $ref: "./cel_input_attributes.schema.yaml#/components/schemas/GeneratedCelDetails" + + AnalyzeApiAPIResponse: + type: object + required: + - results + properties: + results: + type: object + required: + - suggestedPaths + properties: + suggestedPaths: + type: array + items: + type: string \ No newline at end of file diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/constants.ts b/x-pack/platform/plugins/shared/integration_assistant/common/constants.ts index e05692f4ac085..352a84a96eabf 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/common/constants.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/common/constants.ts @@ -20,6 +20,7 @@ export const ECS_GRAPH_PATH = `${INTEGRATION_ASSISTANT_BASE_PATH}/ecs`; export const CATEGORIZATION_GRAPH_PATH = `${INTEGRATION_ASSISTANT_BASE_PATH}/categorization`; export const ANALYZE_LOGS_PATH = `${INTEGRATION_ASSISTANT_BASE_PATH}/analyzelogs`; export const RELATED_GRAPH_PATH = `${INTEGRATION_ASSISTANT_BASE_PATH}/related`; +export const ANALYZE_API_PATH = `${INTEGRATION_ASSISTANT_BASE_PATH}/analyzeapi`; export const CEL_INPUT_GRAPH_PATH = `${INTEGRATION_ASSISTANT_BASE_PATH}/cel`; export const CHECK_PIPELINE_PATH = `${INTEGRATION_ASSISTANT_BASE_PATH}/pipeline`; export const INTEGRATION_BUILDER_PATH = `${INTEGRATION_ASSISTANT_BASE_PATH}/build`; diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/experimental_features.ts b/x-pack/platform/plugins/shared/integration_assistant/common/experimental_features.ts index 76b4ed6f28fee..d4c5a48b0e9ec 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/common/experimental_features.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/common/experimental_features.ts @@ -9,6 +9,7 @@ export type ExperimentalFeatures = typeof allowedExperimentalValues; const _allowedExperimentalValues = { /** + * -- Deprecated -- * Enables whether the user is able to utilize the LLM to generate the CEL input configuration. */ generateCel: false, diff --git a/x-pack/platform/plugins/shared/integration_assistant/common/index.ts b/x-pack/platform/plugins/shared/integration_assistant/common/index.ts index 0b13f7f692695..60ee134cf9acf 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/common/index.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/common/index.ts @@ -19,6 +19,7 @@ export { AnalyzeLogsRequestBody, AnalyzeLogsResponse, } from './api/analyze_logs/analyze_logs_route.gen'; +export { AnalyzeApiRequestBody, AnalyzeApiResponse } from './api/analyze_api/analyze_api_route.gen'; export { CelInputRequestBody, CelInputResponse } from './api/cel/cel_input_route.gen'; export { partialShuffleArray } from './utils'; @@ -33,7 +34,7 @@ export type { } from './api/model/common_attributes.gen'; export { SamplesFormat, SamplesFormatName } from './api/model/common_attributes.gen'; export type { ESProcessorItem } from './api/model/processor_attributes.gen'; -export type { CelInput } from './api/model/cel_input_attributes.gen'; +export type { CelInput, CelAuthType } from './api/model/cel_input_attributes.gen'; export { CATEGORIZATION_GRAPH_PATH, @@ -46,4 +47,5 @@ export { RELATED_GRAPH_PATH, CHECK_PIPELINE_PATH, ANALYZE_LOGS_PATH, + ANALYZE_API_PATH, } from './constants'; diff --git a/x-pack/platform/plugins/shared/integration_assistant/docs/imgs/analyze_api_graph.png b/x-pack/platform/plugins/shared/integration_assistant/docs/imgs/analyze_api_graph.png new file mode 100644 index 0000000000000..085e4ae161c54 Binary files /dev/null and b/x-pack/platform/plugins/shared/integration_assistant/docs/imgs/analyze_api_graph.png differ diff --git a/x-pack/platform/plugins/shared/integration_assistant/docs/imgs/cel_graph.png b/x-pack/platform/plugins/shared/integration_assistant/docs/imgs/cel_graph.png index 8b339caa83798..7ae98632553e9 100644 Binary files a/x-pack/platform/plugins/shared/integration_assistant/docs/imgs/cel_graph.png and b/x-pack/platform/plugins/shared/integration_assistant/docs/imgs/cel_graph.png differ diff --git a/x-pack/platform/plugins/shared/integration_assistant/public/common/lib/api.ts b/x-pack/platform/plugins/shared/integration_assistant/public/common/lib/api.ts index 0a6d91375219e..3694715b4d31b 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/public/common/lib/api.ts +++ b/x-pack/platform/plugins/shared/integration_assistant/public/common/lib/api.ts @@ -20,6 +20,8 @@ import type { AnalyzeLogsResponse, CelInputRequestBody, CelInputResponse, + AnalyzeApiRequestBody, + AnalyzeApiResponse, } from '../../../common'; import { INTEGRATION_BUILDER_PATH, @@ -29,7 +31,11 @@ import { CEL_INPUT_GRAPH_PATH, CHECK_PIPELINE_PATH, } from '../../../common'; -import { ANALYZE_LOGS_PATH, FLEET_PACKAGES_PATH } from '../../../common/constants'; +import { + ANALYZE_API_PATH, + ANALYZE_LOGS_PATH, + FLEET_PACKAGES_PATH, +} from '../../../common/constants'; export interface EpmPackageResponse { items: [{ id: string; type: string }]; @@ -47,6 +53,16 @@ export interface RequestDeps { abortSignal: AbortSignal; } +export const runAnalyzeApiGraph = async ( + body: AnalyzeApiRequestBody, + { http, abortSignal }: RequestDeps +): Promise => + http.post(ANALYZE_API_PATH, { + headers: defaultHeaders, + body: JSON.stringify(body), + signal: abortSignal, + }); + export const runAnalyzeLogsGraph = async ( body: AnalyzeLogsRequestBody, { http, abortSignal }: RequestDeps diff --git a/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/create_integration_assistant.test.tsx b/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/create_integration_assistant.test.tsx index 133da383e4e99..5e40b2dcbc86a 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/create_integration_assistant.test.tsx +++ b/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/create_integration_assistant.test.tsx @@ -10,7 +10,6 @@ import { render, act } from '@testing-library/react'; import { TestProvider } from '../../../mocks/test_provider'; import { CreateIntegrationAssistant } from './create_integration_assistant'; import type { State } from './state'; -import { ExperimentalFeaturesService } from '../../../services'; import { mockReportEvent } from '../../../services/telemetry/mocks/service'; import { TelemetryEventType } from '../../../services/telemetry/types'; @@ -19,8 +18,9 @@ export const defaultInitialState: State = { connector: undefined, integrationSettings: undefined, isGenerating: false, - hasCelInput: false, result: undefined, + showCelCreateFlyout: false, + isFlyoutGenerating: false, }; const mockInitialState = jest.fn((): State => defaultInitialState); @@ -31,23 +31,17 @@ jest.mock('./state', () => ({ }, })); -jest.mock('../../../services'); -const mockedExperimentalFeaturesService = jest.mocked(ExperimentalFeaturesService); - const mockConnectorStep = jest.fn(() =>
); const mockIntegrationStep = jest.fn(() =>
); const mockDataStreamStep = jest.fn(() =>
); +const mockCelCreateFlyout = jest.fn(() =>
); const mockReviewStep = jest.fn(() =>
); -const mockCelInputStep = jest.fn(() =>
); -const mockReviewCelStep = jest.fn(() =>
); const mockDeployStep = jest.fn(() =>
); const mockIsConnectorStepReadyToComplete = jest.fn(); const mockIsIntegrationStepReadyToComplete = jest.fn(); const mockIsDataStreamStepReadyToComplete = jest.fn(); const mockIsReviewStepReadyToComplete = jest.fn(); -const mockIsCelInputStepReadyToComplete = jest.fn(); -const mockIsCelReviewStepReadyToComplete = jest.fn(); jest.mock('./steps/connector_step', () => ({ ConnectorStep: () => mockConnectorStep(), @@ -61,18 +55,13 @@ jest.mock('./steps/data_stream_step', () => ({ DataStreamStep: () => mockDataStreamStep(), isDataStreamStepReadyToComplete: () => mockIsDataStreamStepReadyToComplete(), })); +jest.mock('./flyout/cel_configuration', () => ({ + CreateCelConfigFlyout: () => mockCelCreateFlyout(), +})); jest.mock('./steps/review_step', () => ({ ReviewStep: () => mockReviewStep(), isReviewStepReadyToComplete: () => mockIsReviewStepReadyToComplete(), })); -jest.mock('./steps/cel_input_step', () => ({ - CelInputStep: () => mockCelInputStep(), - isCelInputStepReadyToComplete: () => mockIsCelInputStepReadyToComplete(), -})); -jest.mock('./steps/review_cel_step', () => ({ - ReviewCelStep: () => mockReviewCelStep(), - isCelReviewStepReadyToComplete: () => mockIsCelReviewStepReadyToComplete(), -})); jest.mock('./steps/deploy_step', () => ({ DeployStep: () => mockDeployStep() })); const mockNavigate = jest.fn(); @@ -87,10 +76,6 @@ const renderIntegrationAssistant = () => describe('CreateIntegration', () => { beforeEach(() => { jest.clearAllMocks(); - - mockedExperimentalFeaturesService.get.mockReturnValue({ - generateCel: false, - } as never); }); describe('when step is 1', () => { @@ -440,6 +425,21 @@ describe('CreateIntegration', () => { }); }); + describe('when step is 3 and showCelCreateFlyout=true', () => { + beforeEach(() => { + mockInitialState.mockReturnValueOnce({ + ...defaultInitialState, + step: 3, + showCelCreateFlyout: true, + }); + }); + + it('should render cel creation flyout', () => { + const result = renderIntegrationAssistant(); + expect(result.queryByTestId('celCreateFlyoutMock')).toBeInTheDocument(); + }); + }); + describe('when step is 4', () => { beforeEach(() => { mockInitialState.mockReturnValueOnce({ ...defaultInitialState, step: 4 }); @@ -567,289 +567,3 @@ describe('CreateIntegration', () => { }); }); }); - -describe('CreateIntegration with generateCel enabled', () => { - beforeEach(() => { - jest.clearAllMocks(); - - mockedExperimentalFeaturesService.get.mockReturnValue({ - generateCel: true, - } as never); - }); - - describe('when step is 5 and has celInput', () => { - beforeEach(() => { - mockInitialState.mockReturnValueOnce({ ...defaultInitialState, step: 5, hasCelInput: true }); - }); - - it('should render cel input', () => { - const result = renderIntegrationAssistant(); - expect(result.queryByTestId('celInputStepMock')).toBeInTheDocument(); - }); - - it('should call isCelInputStepReadyToComplete', () => { - renderIntegrationAssistant(); - expect(mockIsCelInputStepReadyToComplete).toHaveBeenCalled(); - }); - - it('should show "Generate CEL input configuration" on the next button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-nextButton')).toHaveTextContent( - 'Generate CEL input configuration' - ); - }); - - it('should enable the back button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-backButton')).toBeEnabled(); - }); - - describe('when cel input step is not done', () => { - beforeEach(() => { - mockIsCelInputStepReadyToComplete.mockReturnValue(false); - }); - - it('should disable the next button', () => { - const result = renderIntegrationAssistant(); - // Not sure why there are two buttons when testing. - const nextButton = result - .getAllByTestId('buttonsFooter-nextButton') - .filter((button) => button.textContent !== 'Next')[0]; - expect(nextButton).toBeDisabled(); - }); - }); - - describe('when cel input step is done', () => { - beforeEach(() => { - mockIsCelInputStepReadyToComplete.mockReturnValue(true); - }); - - it('should enable the next button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-nextButton')).toBeEnabled(); - }); - - describe('when next button is clicked', () => { - beforeEach(() => { - const result = renderIntegrationAssistant(); - mockReportEvent.mockClear(); - act(() => { - result.getByTestId('buttonsFooter-nextButton').click(); - }); - }); - - it('should report telemetry for cel input step completion', () => { - expect(mockReportEvent).toHaveBeenCalledWith( - TelemetryEventType.IntegrationAssistantStepComplete, - { - sessionId: expect.any(String), - step: 5, - stepName: 'CEL Input Step', - durationMs: expect.any(Number), - sessionElapsedTime: expect.any(Number), - } - ); - }); - - it('should show loader on the next button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('generatingLoader')).toBeInTheDocument(); - }); - - it('should disable the next button', () => { - const result = renderIntegrationAssistant(); - // Not sure why there are two buttons when testing. - const nextButton = result - .getAllByTestId('buttonsFooter-nextButton') - .filter((button) => button.textContent !== 'Next')[0]; - expect(nextButton).toBeDisabled(); - }); - }); - }); - - describe('when back button is clicked', () => { - let result: ReturnType; - beforeEach(() => { - result = renderIntegrationAssistant(); - mockReportEvent.mockClear(); - act(() => { - result.getByTestId('buttonsFooter-backButton').click(); - }); - }); - - it('should not report telemetry', () => { - expect(mockReportEvent).not.toHaveBeenCalled(); - }); - - it('should show review step', () => { - expect(result.queryByTestId('reviewStepMock')).toBeInTheDocument(); - }); - - it('should enable the next button', () => { - expect(result.getByTestId('buttonsFooter-nextButton')).toBeEnabled(); - }); - }); - }); - - describe('when step is 5 and does not have celInput', () => { - beforeEach(() => { - mockInitialState.mockReturnValueOnce({ ...defaultInitialState, step: 5 }); - }); - - it('should render deploy', () => { - const result = renderIntegrationAssistant(); - expect(result.queryByTestId('deployStepMock')).toBeInTheDocument(); - }); - - it('should hide the back button', () => { - const result = renderIntegrationAssistant(); - expect(result.queryByTestId('buttonsFooter-backButton')).toBe(null); - }); - - it('should hide the next button', () => { - const result = renderIntegrationAssistant(); - expect(result.queryByTestId('buttonsFooter-backButton')).toBe(null); - }); - - it('should enable the cancel button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-cancelButton')).toBeEnabled(); - }); - - it('should show "Close" on the cancel button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-cancelButton')).toHaveTextContent('Close'); - }); - }); - - describe('when step is 6', () => { - beforeEach(() => { - mockInitialState.mockReturnValueOnce({ - ...defaultInitialState, - step: 6, - celInputResult: { program: 'program', stateSettings: {}, redactVars: [] }, - }); - }); - - it('should render review', () => { - const result = renderIntegrationAssistant(); - expect(result.queryByTestId('reviewCelStepMock')).toBeInTheDocument(); - }); - - it('should call isReviewCelStepReadyToComplete', () => { - renderIntegrationAssistant(); - expect(mockIsCelReviewStepReadyToComplete).toHaveBeenCalled(); - }); - - it('should show the "Add to Elastic" on the next button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-nextButton')).toHaveTextContent('Add to Elastic'); - }); - - describe('when cel review step is not done', () => { - beforeEach(() => { - mockIsCelReviewStepReadyToComplete.mockReturnValue(false); - }); - - it('should disable the next button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-nextButton')).toBeDisabled(); - }); - - it('should still enable the back button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-backButton')).toBeEnabled(); - }); - - it('should still enable the cancel button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-cancelButton')).toBeEnabled(); - }); - }); - - describe('when cel review step is done', () => { - beforeEach(() => { - mockIsCelReviewStepReadyToComplete.mockReturnValue(true); - }); - - it('should enable the next button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-nextButton')).toBeEnabled(); - }); - - it('should enable the back button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-backButton')).toBeEnabled(); - }); - - it('should enable the cancel button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-cancelButton')).toBeEnabled(); - }); - - describe('when next button is clicked', () => { - beforeEach(() => { - const result = renderIntegrationAssistant(); - mockReportEvent.mockClear(); - act(() => { - result.getByTestId('buttonsFooter-nextButton').click(); - }); - }); - - it('should report telemetry for review step completion', () => { - expect(mockReportEvent).toHaveBeenCalledWith( - TelemetryEventType.IntegrationAssistantStepComplete, - { - sessionId: expect.any(String), - step: 6, - stepName: 'CEL Review Step', - durationMs: expect.any(Number), - sessionElapsedTime: expect.any(Number), - } - ); - }); - - it('should show deploy step', () => { - const result = renderIntegrationAssistant(); - expect(result.queryByTestId('deployStepMock')).toBeInTheDocument(); - }); - - it('should enable the next button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-nextButton')).toBeEnabled(); - }); - }); - }); - }); - - describe('when step is 7', () => { - beforeEach(() => { - mockInitialState.mockReturnValueOnce({ ...defaultInitialState, step: 7 }); - }); - - it('should render deploy', () => { - const result = renderIntegrationAssistant(); - expect(result.queryByTestId('deployStepMock')).toBeInTheDocument(); - }); - - it('should hide the back button', () => { - const result = renderIntegrationAssistant(); - expect(result.queryByTestId('buttonsFooter-backButton')).toBe(null); - }); - - it('should hide the next button', () => { - const result = renderIntegrationAssistant(); - expect(result.queryByTestId('buttonsFooter-backButton')).toBe(null); - }); - - it('should enable the cancel button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-cancelButton')).toBeEnabled(); - }); - - it('should show "Close" on the cancel button', () => { - const result = renderIntegrationAssistant(); - expect(result.getByTestId('buttonsFooter-cancelButton')).toHaveTextContent('Close'); - }); - }); -}); diff --git a/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/create_integration_assistant.tsx b/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/create_integration_assistant.tsx index 81cb5a9b3b137..1f353f187bb2a 100644 --- a/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/create_integration_assistant.tsx +++ b/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/create_integration_assistant.tsx @@ -9,48 +9,29 @@ import React, { useReducer, useMemo, useEffect, useCallback } from 'react'; import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; import { Header } from './header'; import { Footer } from './footer'; +import { CreateCelConfigFlyout } from './flyout/cel_configuration'; import { useNavigate, Page } from '../../../common/hooks/use_navigate'; import { ConnectorStep, isConnectorStepReadyToComplete } from './steps/connector_step'; import { IntegrationStep, isIntegrationStepReadyToComplete } from './steps/integration_step'; import { DataStreamStep, isDataStreamStepReadyToComplete } from './steps/data_stream_step'; import { ReviewStep, isReviewStepReadyToComplete } from './steps/review_step'; -import { CelInputStep, isCelInputStepReadyToComplete } from './steps/cel_input_step'; -import { ReviewCelStep, isCelReviewStepReadyToComplete } from './steps/review_cel_step'; import { DeployStep } from './steps/deploy_step'; import { reducer, initialState, ActionsProvider, type Actions } from './state'; import { useTelemetry } from '../telemetry'; -import { ExperimentalFeaturesService } from '../../../services'; const stepNames: Record = { 1: 'Connector Step', 2: 'Integration Step', 3: 'DataStream Step', 4: 'Review Step', - cel_input: 'CEL Input Step', - cel_review: 'CEL Review Step', - deploy: 'Deploy Step', + 5: 'Deploy Step', }; export const CreateIntegrationAssistant = React.memo(() => { const [state, dispatch] = useReducer(reducer, initialState); const navigate = useNavigate(); - const { generateCel: isGenerateCelEnabled } = ExperimentalFeaturesService.get(); - const celInputStepIndex = isGenerateCelEnabled && state.hasCelInput ? 5 : null; - const celReviewStepIndex = isGenerateCelEnabled && state.celInputResult ? 6 : null; - const deployStepIndex = - celInputStepIndex !== null || celReviewStepIndex !== null || state.step === 7 ? 7 : 5; - - const stepName = - state.step === deployStepIndex - ? stepNames.deploy - : state.step === celReviewStepIndex - ? stepNames.cel_review - : state.step === celInputStepIndex - ? stepNames.cel_input - : state.step in stepNames - ? stepNames[state.step] - : 'Unknown Step'; + const stepName = stepNames[state.step]; const telemetry = useTelemetry(); useEffect(() => { @@ -66,13 +47,9 @@ export const CreateIntegrationAssistant = React.memo(() => { return isDataStreamStepReadyToComplete(state); } else if (state.step === 4) { return isReviewStepReadyToComplete(state); - } else if (isGenerateCelEnabled && state.step === 5) { - return isCelInputStepReadyToComplete(state); - } else if (isGenerateCelEnabled && state.step === 6) { - return isCelReviewStepReadyToComplete(state); } return false; - }, [state, isGenerateCelEnabled]); + }, [state]); const goBackStep = useCallback(() => { if (state.step === 1) { @@ -88,12 +65,12 @@ export const CreateIntegrationAssistant = React.memo(() => { return; } telemetry.reportAssistantStepComplete({ step: state.step, stepName }); - if (state.step === 3 || state.step === celInputStepIndex) { + if (state.step === 3) { dispatch({ type: 'SET_IS_GENERATING', payload: true }); } else { dispatch({ type: 'SET_STEP', payload: state.step + 1 }); } - }, [telemetry, state.step, stepName, celInputStepIndex, isThisStepReadyToComplete]); + }, [telemetry, state.step, stepName, isThisStepReadyToComplete]); const actions = useMemo( () => ({ @@ -109,8 +86,11 @@ export const CreateIntegrationAssistant = React.memo(() => { setIsGenerating: (payload) => { dispatch({ type: 'SET_IS_GENERATING', payload }); }, - setHasCelInput: (payload) => { - dispatch({ type: 'SET_HAS_CEL_INPUT', payload }); + setShowCelCreateFlyout: (payload) => { + dispatch({ type: 'SET_SHOW_CEL_CREATE_FLYOUT', payload }); + }, + setIsFlyoutGenerating: (payload) => { + dispatch({ type: 'SET_IS_FLYOUT_GENERATING', payload }); }, setResult: (payload) => { dispatch({ type: 'SET_GENERATED_RESULT', payload }); @@ -133,32 +113,26 @@ export const CreateIntegrationAssistant = React.memo(() => { {state.step === 3 && ( )} - {state.step === 4 && ( - - )} - {state.step === celInputStepIndex && ( - )} - {state.step === celReviewStepIndex && ( - )} - - {state.step === deployStepIndex && ( + {state.step === 5 && ( {