diff --git a/.buildkite/pipelines/hourly.yml b/.buildkite/pipelines/hourly.yml index b03a46b5b5c667..4b2b17d272d17e 100644 --- a/.buildkite/pipelines/hourly.yml +++ b/.buildkite/pipelines/hourly.yml @@ -147,6 +147,13 @@ steps: key: linting timeout_in_minutes: 90 + - command: .buildkite/scripts/steps/lint_with_types.sh + label: 'Linting (with types)' + agents: + queue: c2-16 + key: linting_with_types + timeout_in_minutes: 90 + - command: .buildkite/scripts/steps/checks.sh label: 'Checks' agents: diff --git a/.buildkite/pipelines/pull_request/base.yml b/.buildkite/pipelines/pull_request/base.yml index 1013a841dfd271..0f2a4a1026af87 100644 --- a/.buildkite/pipelines/pull_request/base.yml +++ b/.buildkite/pipelines/pull_request/base.yml @@ -145,6 +145,13 @@ steps: key: linting timeout_in_minutes: 90 + - command: .buildkite/scripts/steps/lint_with_types.sh + label: 'Linting (with types)' + agents: + queue: c2-16 + key: linting_with_types + timeout_in_minutes: 90 + - command: .buildkite/scripts/steps/checks.sh label: 'Checks' agents: diff --git a/.buildkite/scripts/steps/lint_with_types.sh b/.buildkite/scripts/steps/lint_with_types.sh new file mode 100755 index 00000000000000..81d5ef03f4989d --- /dev/null +++ b/.buildkite/scripts/steps/lint_with_types.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +export BUILD_TS_REFS_DISABLE=false +.buildkite/scripts/bootstrap.sh + +echo '--- Lint: eslint (with types)' +checks-reporter-with-killswitch "Lint: eslint (with types)" \ + node scripts/eslint_with_types diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 227041522ac782..e807885e17294f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -232,6 +232,7 @@ /src/core/ @elastic/kibana-core /src/plugins/saved_objects_tagging_oss @elastic/kibana-core /config/kibana.yml @elastic/kibana-core +/typings/ @elastic/kibana-core /x-pack/plugins/banners/ @elastic/kibana-core /x-pack/plugins/features/ @elastic/kibana-core /x-pack/plugins/licensing/ @elastic/kibana-core diff --git a/.gitignore b/.gitignore index c08ae529c2c36d..cd79644e5d060c 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ target .idea *.iml *.log +types.eslint.config.js # Ignore example plugin builds /examples/*/build diff --git a/dev_docs/contributing/how_we_use_github.mdx b/dev_docs/contributing/how_we_use_github.mdx index ff7901fdf08dab..3b455b7682c33a 100644 --- a/dev_docs/contributing/how_we_use_github.mdx +++ b/dev_docs/contributing/how_we_use_github.mdx @@ -37,6 +37,28 @@ Pull requests are made into the master branch and then backported when it is saf - Resolve merge conflicts by rebasing the target branch over your feature branch, and force-pushing (see below for instructions). - When merging, we’ll squash your commits into a single commit. +### Commit using your `@elastic.co` email address + +In order to assist with developer tooling we ask that all Elastic engineers use their `@elastic.co` email address when committing to the Kibana repo. We have implemented a CI check that validates any PR opened by a member of the `@elastic` organization has at least one commit that is attributed to an `@elastic.co` email address. If you have a PR that is failing because of this check you can fix your PR by following these steps: + + 1. Ensure that you don't have any staged changes + 1. Checkout the branch for your PR + 1. Update the git config for your current repository to commit with your `@elastic.co` email: + + ```bash + git config --local user.email YOUR_ELASTIC_EMAIL@elastic.co + ``` + + 1. Create a commit using the new email address + + ```bash + git commit -m 'commit using @elastic.co' --allow-empty + ``` + + 1. Push the new commit to your PR and the status should now be green + +**Note:** If doing this prevents your commits from being attributed to your Github account then make sure to add your `@elastic.co` address at [https://github.com/settings/emails](https://github.com/settings/emails). + ### Rebasing and fixing merge conflicts Rebasing can be tricky, and fixing merge conflicts can be even trickier because it involves force pushing. This is all compounded by the fact that attempting to push a rebased branch remotely will be rejected by git, and you’ll be prompted to do a pull, which is not at all what you should do (this will really mess up your branch’s history). diff --git a/docs/CHANGELOG.asciidoc b/docs/CHANGELOG.asciidoc index 9fce6285bfa3de..81111728937954 100644 --- a/docs/CHANGELOG.asciidoc +++ b/docs/CHANGELOG.asciidoc @@ -846,7 +846,7 @@ The default values for the session timeout `xpack.security.session.{lifespan|idl *Impact* + Use the following default values: -* `xpack.security.session.idleTimeout: 1h` +* `xpack.security.session.idleTimeout: 8h` * `xpack.security.session.lifespan: 30d` ==== diff --git a/docs/developer/contributing/development-github.asciidoc b/docs/developer/contributing/development-github.asciidoc index c5a3d942f2af36..44736bf4027c10 100644 --- a/docs/developer/contributing/development-github.asciidoc +++ b/docs/developer/contributing/development-github.asciidoc @@ -42,6 +42,28 @@ explanation of _why_ you made the changes that you did. feature branch, and force-pushing (see below for instructions). * When merging, we'll squash your commits into a single commit. +[discrete] +==== Commit using your `@elastic.co` email address + +In order to assist with developer tooling we ask that all Elastic engineers use their `@elastic.co` email address when committing to the Kibana repo. We have implemented a CI check that validates any PR opened by a member of the `@elastic` organization has at least one commit that is attributed to an `@elastic.co` email address. If you have a PR that is failing because of this check you can fix your PR by following these steps: + + 1. Ensure that you don't have any staged changes + 2. Checkout the branch for your PR + 3. Update the git config for your current repository to commit with your `@elastic.co` email: ++ +["source","shell"] +----------- +git config --local user.email YOUR_ELASTIC_EMAIL@elastic.co +----------- + 4. Create a commit using the new email address ++ +["source","shell"] +----------- +git commit -m 'commit using @elastic.co' --allow-empty +----------- ++ + 5. Push the new commit to your PR and the status should now be green + [discrete] ==== Rebasing and fixing merge conflicts diff --git a/docs/user/security/audit-logging.asciidoc b/docs/user/security/audit-logging.asciidoc index 5391e883509439..926331008e9909 100644 --- a/docs/user/security/audit-logging.asciidoc +++ b/docs/user/security/audit-logging.asciidoc @@ -144,6 +144,10 @@ Refer to the corresponding {es} logs for potential write errors. | `unknown` | User is updating a space. | `failure` | User is not authorized to update a space. +.2+| `alert_update` +| `unknown` | User is updating an alert. +| `failure` | User is not authorized to update an alert. + 3+a| ====== Type: deletion @@ -214,6 +218,14 @@ Refer to the corresponding {es} logs for potential write errors. | `success` | User has accessed a space as part of a search operation. | `failure` | User is not authorized to search for spaces. +.2+| `alert_get` +| `success` | User has accessed an alert. +| `failure` | User is not authorized to access an alert. + +.2+| `alert_find` +| `success` | User has accessed an alert as part of a search operation. +| `failure` | User is not authorized to access alerts. + 3+a| ===== Category: web diff --git a/examples/developer_examples/public/index.ts b/examples/developer_examples/public/index.ts index a6e5748765ab69..8fcbda387abf0c 100644 --- a/examples/developer_examples/public/index.ts +++ b/examples/developer_examples/public/index.ts @@ -10,4 +10,4 @@ import { DeveloperExamplesPlugin } from './plugin'; export const plugin = () => new DeveloperExamplesPlugin(); -export { DeveloperExamplesSetup } from './plugin'; +export type { DeveloperExamplesSetup } from './plugin'; diff --git a/examples/embeddable_examples/common/index.ts b/examples/embeddable_examples/common/index.ts index bea814e5a3ed08..4ff60ffb3afcf7 100644 --- a/examples/embeddable_examples/common/index.ts +++ b/examples/embeddable_examples/common/index.ts @@ -6,5 +6,6 @@ * Side Public License, v 1. */ -export { TodoSavedObjectAttributes } from './todo_saved_object_attributes'; -export { BookSavedObjectAttributes, BOOK_SAVED_OBJECT } from './book_saved_object_attributes'; +export type { TodoSavedObjectAttributes } from './todo_saved_object_attributes'; +export type { BookSavedObjectAttributes } from './book_saved_object_attributes'; +export { BOOK_SAVED_OBJECT } from './book_saved_object_attributes'; diff --git a/examples/embeddable_examples/public/index.ts b/examples/embeddable_examples/public/index.ts index 365c001559843b..43d8db39692c7f 100644 --- a/examples/embeddable_examples/public/index.ts +++ b/examples/embeddable_examples/public/index.ts @@ -6,14 +6,16 @@ * Side Public License, v 1. */ +export type { HelloWorldEmbeddableFactory } from './hello_world'; export { HELLO_WORLD_EMBEDDABLE, HelloWorldEmbeddable, HelloWorldEmbeddableFactoryDefinition, - HelloWorldEmbeddableFactory, } from './hello_world'; -export { ListContainer, LIST_CONTAINER, ListContainerFactory } from './list_container'; -export { TODO_EMBEDDABLE, TodoEmbeddableFactory } from './todo'; +export type { ListContainerFactory } from './list_container'; +export { ListContainer, LIST_CONTAINER } from './list_container'; +export type { TodoEmbeddableFactory } from './todo'; +export { TODO_EMBEDDABLE } from './todo'; export { BOOK_EMBEDDABLE } from './book'; @@ -21,10 +23,8 @@ export { SIMPLE_EMBEDDABLE } from './migrations'; import { EmbeddableExamplesPlugin } from './plugin'; -export { - SearchableListContainer, - SEARCHABLE_LIST_CONTAINER, - SearchableListContainerFactory, -} from './searchable_list_container'; -export { MULTI_TASK_TODO_EMBEDDABLE, MultiTaskTodoEmbeddableFactory } from './multi_task_todo'; +export type { SearchableListContainerFactory } from './searchable_list_container'; +export { SearchableListContainer, SEARCHABLE_LIST_CONTAINER } from './searchable_list_container'; +export type { MultiTaskTodoEmbeddableFactory } from './multi_task_todo'; +export { MULTI_TASK_TODO_EMBEDDABLE } from './multi_task_todo'; export const plugin = () => new EmbeddableExamplesPlugin(); diff --git a/examples/embeddable_examples/public/list_container/index.ts b/examples/embeddable_examples/public/list_container/index.ts index cda0e55e59eef4..299c3eeae42cd4 100644 --- a/examples/embeddable_examples/public/list_container/index.ts +++ b/examples/embeddable_examples/public/list_container/index.ts @@ -7,4 +7,5 @@ */ export { ListContainer, LIST_CONTAINER } from './list_container'; -export { ListContainerFactoryDefinition, ListContainerFactory } from './list_container_factory'; +export type { ListContainerFactory } from './list_container_factory'; +export { ListContainerFactoryDefinition } from './list_container_factory'; diff --git a/examples/embeddable_examples/public/searchable_list_container/index.ts b/examples/embeddable_examples/public/searchable_list_container/index.ts index 5448731abf2c14..cea0154be812d4 100644 --- a/examples/embeddable_examples/public/searchable_list_container/index.ts +++ b/examples/embeddable_examples/public/searchable_list_container/index.ts @@ -7,7 +7,5 @@ */ export { SearchableListContainer, SEARCHABLE_LIST_CONTAINER } from './searchable_list_container'; -export { - SearchableListContainerFactoryDefinition, - SearchableListContainerFactory, -} from './searchable_list_container_factory'; +export type { SearchableListContainerFactory } from './searchable_list_container_factory'; +export { SearchableListContainerFactoryDefinition } from './searchable_list_container_factory'; diff --git a/examples/locator_examples/public/index.ts b/examples/locator_examples/public/index.ts index 50da3501805fa4..e71d6bf1e5b015 100644 --- a/examples/locator_examples/public/index.ts +++ b/examples/locator_examples/public/index.ts @@ -8,12 +8,12 @@ import { LocatorExamplesPlugin } from './plugin'; -export { +export type { HelloLocator, HelloLocatorV1Params, HelloLocatorV2Params, HelloLocatorParams, - HELLO_LOCATOR, } from './locator'; +export { HELLO_LOCATOR } from './locator'; export const plugin = () => new LocatorExamplesPlugin(); diff --git a/examples/search_examples/public/index.ts b/examples/search_examples/public/index.ts index fd557f752a38ed..c1361facc29414 100644 --- a/examples/search_examples/public/index.ts +++ b/examples/search_examples/public/index.ts @@ -15,4 +15,4 @@ import { SearchExamplesPlugin } from './plugin'; export function plugin() { return new SearchExamplesPlugin(); } -export { SearchExamplesPluginSetup, SearchExamplesPluginStart } from './types'; +export type { SearchExamplesPluginSetup, SearchExamplesPluginStart } from './types'; diff --git a/examples/search_examples/server/index.ts b/examples/search_examples/server/index.ts index f351681a1041a3..75c23e8e892579 100644 --- a/examples/search_examples/server/index.ts +++ b/examples/search_examples/server/index.ts @@ -13,4 +13,4 @@ export function plugin(initializerContext: PluginInitializerContext) { return new SearchExamplesPlugin(initializerContext); } -export { SearchExamplesPluginSetup, SearchExamplesPluginStart } from './types'; +export type { SearchExamplesPluginSetup, SearchExamplesPluginStart } from './types'; diff --git a/package.json b/package.json index f35800746095a1..b77c88f7a2ba33 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "@elastic/apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace", "@elastic/apm-rum": "^5.9.1", "@elastic/apm-rum-react": "^1.3.1", - "@elastic/charts": "38.1.0", + "@elastic/charts": "38.1.3", "@elastic/datemath": "link:bazel-bin/packages/elastic-datemath", "@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.35", "@elastic/ems-client": "8.0.0", @@ -633,9 +633,9 @@ "@types/xml2js": "^0.4.5", "@types/yauzl": "^2.9.1", "@types/zen-observable": "^0.8.0", - "@typescript-eslint/eslint-plugin": "^4.31.2", - "@typescript-eslint/parser": "^4.31.2", - "@typescript-eslint/typescript-estree": "^4.31.2", + "@typescript-eslint/eslint-plugin": "^5.2.0", + "@typescript-eslint/parser": "^5.2.0", + "@typescript-eslint/typescript-estree": "^5.2.0", "@yarnpkg/lockfile": "^1.1.0", "abab": "^2.0.4", "aggregate-error": "^3.1.0", diff --git a/packages/kbn-config-schema/src/duration/index.ts b/packages/kbn-config-schema/src/duration/index.ts index 6a05a00c9e8719..1b1d47a24abd35 100644 --- a/packages/kbn-config-schema/src/duration/index.ts +++ b/packages/kbn-config-schema/src/duration/index.ts @@ -7,7 +7,8 @@ */ import { Duration, duration as momentDuration, DurationInputArg2, isDuration } from 'moment'; -export { Duration, isDuration }; +export type { Duration }; +export { isDuration }; const timeFormatRegex = /^(0|[1-9][0-9]*)(ms|s|m|h|d|w|M|Y)$/; diff --git a/packages/kbn-config-schema/src/index.ts b/packages/kbn-config-schema/src/index.ts index 68500a18530bc6..8635421beb0a18 100644 --- a/packages/kbn-config-schema/src/index.ts +++ b/packages/kbn-config-schema/src/index.ts @@ -49,7 +49,8 @@ import { StreamType, } from './types'; -export { ObjectType, TypeOf, Type, Props, NullableProps }; +export type { TypeOf, Props, NullableProps }; +export { ObjectType, Type }; export { ByteSizeValue } from './byte_size_value'; export { SchemaTypeError, ValidationError } from './errors'; export { isConfigSchema } from './typeguards'; diff --git a/packages/kbn-config-schema/src/types/index.ts b/packages/kbn-config-schema/src/types/index.ts index d4098a2abf352c..5152137985ff31 100644 --- a/packages/kbn-config-schema/src/types/index.ts +++ b/packages/kbn-config-schema/src/types/index.ts @@ -6,23 +6,35 @@ * Side Public License, v 1. */ -export { Type, TypeOptions } from './type'; +export type { TypeOptions } from './type'; +export { Type } from './type'; export { AnyType } from './any_type'; -export { ArrayOptions, ArrayType } from './array_type'; +export type { ArrayOptions } from './array_type'; +export { ArrayType } from './array_type'; export { BooleanType } from './boolean_type'; export { BufferType } from './buffer_type'; -export { ByteSizeOptions, ByteSizeType } from './byte_size_type'; -export { ConditionalType, ConditionalTypeValue } from './conditional_type'; -export { DurationOptions, DurationType } from './duration_type'; +export type { ByteSizeOptions } from './byte_size_type'; +export { ByteSizeType } from './byte_size_type'; +export type { ConditionalTypeValue } from './conditional_type'; +export { ConditionalType } from './conditional_type'; +export type { DurationOptions } from './duration_type'; +export { DurationType } from './duration_type'; export { LiteralType } from './literal_type'; export { MaybeType } from './maybe_type'; -export { MapOfOptions, MapOfType } from './map_type'; -export { NumberOptions, NumberType } from './number_type'; -export { ObjectType, ObjectTypeOptions, Props, NullableProps, TypeOf } from './object_type'; -export { RecordOfOptions, RecordOfType } from './record_type'; +export type { MapOfOptions } from './map_type'; +export { MapOfType } from './map_type'; +export type { NumberOptions } from './number_type'; +export { NumberType } from './number_type'; +export type { ObjectTypeOptions, Props, NullableProps, TypeOf } from './object_type'; +export { ObjectType } from './object_type'; +export type { RecordOfOptions } from './record_type'; +export { RecordOfType } from './record_type'; export { StreamType } from './stream_type'; -export { StringOptions, StringType } from './string_type'; +export type { StringOptions } from './string_type'; +export { StringType } from './string_type'; export { UnionType } from './union_type'; -export { URIOptions, URIType } from './uri_type'; +export type { URIOptions } from './uri_type'; +export { URIType } from './uri_type'; export { NeverType } from './never_type'; -export { IpType, IpOptions } from './ip_type'; +export type { IpOptions } from './ip_type'; +export { IpType } from './ip_type'; diff --git a/packages/kbn-config/src/index.ts b/packages/kbn-config/src/index.ts index 0068fc87855b0c..272ee7598570cb 100644 --- a/packages/kbn-config/src/index.ts +++ b/packages/kbn-config/src/index.ts @@ -19,16 +19,15 @@ export type { export { applyDeprecations, configDeprecationFactory } from './deprecation'; -export { - RawConfigurationProvider, - RawConfigService, - RawConfigAdapter, - getConfigFromFiles, -} from './raw'; +export type { RawConfigurationProvider, RawConfigAdapter } from './raw'; +export { RawConfigService, getConfigFromFiles } from './raw'; -export { ConfigService, IConfigService, ConfigValidateParameters } from './config_service'; -export { Config, ConfigPath, isConfigPath, hasConfigPathIntersection } from './config'; +export type { IConfigService, ConfigValidateParameters } from './config_service'; +export { ConfigService } from './config_service'; +export type { Config, ConfigPath } from './config'; +export { isConfigPath, hasConfigPathIntersection } from './config'; export { ObjectToConfigAdapter } from './object_to_config_adapter'; -export { CliArgs, Env, RawPackageInfo } from './env'; -export { EnvironmentMode, PackageInfo } from './types'; +export type { CliArgs, RawPackageInfo } from './env'; +export { Env } from './env'; +export type { EnvironmentMode, PackageInfo } from './types'; export { getPluginSearchPaths } from './plugins'; diff --git a/packages/kbn-config/src/raw/index.ts b/packages/kbn-config/src/raw/index.ts index 01ad83728aa085..be0a206e16b66b 100644 --- a/packages/kbn-config/src/raw/index.ts +++ b/packages/kbn-config/src/raw/index.ts @@ -6,5 +6,6 @@ * Side Public License, v 1. */ -export { RawConfigService, RawConfigurationProvider, RawConfigAdapter } from './raw_config_service'; +export type { RawConfigurationProvider, RawConfigAdapter } from './raw_config_service'; +export { RawConfigService } from './raw_config_service'; export { getConfigFromFiles } from './read_config'; diff --git a/packages/kbn-dev-utils/src/proc_runner/errors.ts b/packages/kbn-dev-utils/src/proc_runner/errors.ts deleted file mode 100644 index d4d252476b76e9..00000000000000 --- a/packages/kbn-dev-utils/src/proc_runner/errors.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -const $isCliError = Symbol('isCliError'); - -interface CliError extends Error { - [$isCliError]: boolean; -} - -export function createCliError(message: string) { - const error: Partial = new Error(message); - error[$isCliError] = true; - return error as CliError; -} - -export function isCliError(error: any): error is CliError { - return error && !!error[$isCliError]; -} diff --git a/packages/kbn-dev-utils/src/proc_runner/proc.ts b/packages/kbn-dev-utils/src/proc_runner/proc.ts index c9a520de6eb4d1..8238e294133092 100644 --- a/packages/kbn-dev-utils/src/proc_runner/proc.ts +++ b/packages/kbn-dev-utils/src/proc_runner/proc.ts @@ -19,7 +19,7 @@ const treeKillAsync = promisify((...args: [number, string, any]) => treeKill(... import { ToolingLog } from '../tooling_log'; import { observeLines } from '../stdio'; -import { createCliError } from './errors'; +import { createFailError } from '../run'; const SECOND = 1000; const STOP_TIMEOUT = 30 * SECOND; @@ -57,7 +57,7 @@ export type Proc = ReturnType; export function startProc(name: string, options: ProcOptions, log: ToolingLog) { const { cmd, args, cwd, env, stdin } = options; - log.info('[%s] > %s', name, cmd, args.join(' ')); + log.info('[%s] > %s', name, cmd === process.execPath ? 'node' : cmd, args.join(' ')); // spawn fails with ENOENT when either the // cmd or cwd don't exist, so we check for the cwd @@ -97,7 +97,9 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) { } // JVM exits with 143 on SIGTERM and 130 on SIGINT, dont' treat then as errors if (code > 0 && !(code === 143 || code === 130)) { - throw createCliError(`[${name}] exited with code ${code}`); + throw createFailError(`[${name}] exited with code ${code}`, { + exitCode: code, + }); } return code; diff --git a/packages/kbn-dev-utils/src/proc_runner/proc_runner.ts b/packages/kbn-dev-utils/src/proc_runner/proc_runner.ts index 8ef32411621f8d..cb2ac2604e035c 100644 --- a/packages/kbn-dev-utils/src/proc_runner/proc_runner.ts +++ b/packages/kbn-dev-utils/src/proc_runner/proc_runner.ts @@ -11,7 +11,7 @@ import { filter, first, catchError, map } from 'rxjs/operators'; import exitHook from 'exit-hook'; import { ToolingLog } from '../tooling_log'; -import { createCliError } from './errors'; +import { createFailError } from '../run'; import { Proc, ProcOptions, startProc } from './proc'; const SECOND = 1000; @@ -61,7 +61,6 @@ export class ProcRunner { */ async run(name: string, options: RunOptions) { const { - cmd, args = [], cwd = process.cwd(), stdin = undefined, @@ -69,6 +68,7 @@ export class ProcRunner { waitTimeout = 15 * MINUTE, env = process.env, } = options; + const cmd = options.cmd === 'node' ? process.execPath : options.cmd; if (this.closing) { throw new Error('ProcRunner is closing'); @@ -99,7 +99,7 @@ export class ProcRunner { first(), catchError((err) => { if (err.name !== 'EmptyError') { - throw createCliError(`[${name}] exited without matching pattern: ${wait}`); + throw createFailError(`[${name}] exited without matching pattern: ${wait}`); } else { throw err; } @@ -110,7 +110,7 @@ export class ProcRunner { : Rx.timer(waitTimeout).pipe( map(() => { const sec = waitTimeout / SECOND; - throw createCliError( + throw createFailError( `[${name}] failed to match pattern within ${sec} seconds [pattern=${wait}]` ); }) diff --git a/packages/kbn-dev-utils/src/tooling_log/index.ts b/packages/kbn-dev-utils/src/tooling_log/index.ts index 4da54ee9bfeaed..2c7216c87c4191 100644 --- a/packages/kbn-dev-utils/src/tooling_log/index.ts +++ b/packages/kbn-dev-utils/src/tooling_log/index.ts @@ -8,8 +8,10 @@ export { ToolingLog } from './tooling_log'; export type { ToolingLogOptions } from './tooling_log'; -export { ToolingLogTextWriter, ToolingLogTextWriterConfig } from './tooling_log_text_writer'; -export { pickLevelFromFlags, parseLogLevel, LogLevel, ParsedLogLevel } from './log_levels'; +export type { ToolingLogTextWriterConfig } from './tooling_log_text_writer'; +export { ToolingLogTextWriter } from './tooling_log_text_writer'; +export type { LogLevel, ParsedLogLevel } from './log_levels'; +export { pickLevelFromFlags, parseLogLevel } from './log_levels'; export { ToolingLogCollectingWriter } from './tooling_log_collecting_writer'; export type { Writer } from './writer'; export type { Message } from './message'; diff --git a/packages/kbn-dev-utils/src/vscode_config/managed_config_keys.ts b/packages/kbn-dev-utils/src/vscode_config/managed_config_keys.ts index 32cc91ad74c508..63a05910653af6 100644 --- a/packages/kbn-dev-utils/src/vscode_config/managed_config_keys.ts +++ b/packages/kbn-dev-utils/src/vscode_config/managed_config_keys.ts @@ -37,6 +37,8 @@ export const MANAGED_CONFIG_KEYS: ManagedConfigKey[] = [ value: { ['**/packages/kbn-pm/dist/index.js']: true, ['**/api_docs']: true, + ['**/tsconfig.tsbuildinfo']: true, + ['**/*.map']: true, }, }, { diff --git a/packages/kbn-es-archiver/src/lib/index.ts b/packages/kbn-es-archiver/src/lib/index.ts index 0e47294909add7..ee37591e1f2c30 100644 --- a/packages/kbn-es-archiver/src/lib/index.ts +++ b/packages/kbn-es-archiver/src/lib/index.ts @@ -20,7 +20,8 @@ export { export { createFilterRecordsStream } from './records'; -export { createStats, Stats } from './stats'; +export type { Stats } from './stats'; +export { createStats } from './stats'; export { isGzip, diff --git a/packages/kbn-es-query/src/es_query/index.ts b/packages/kbn-es-query/src/es_query/index.ts index 8045b625cd921a..192834c9fd485a 100644 --- a/packages/kbn-es-query/src/es_query/index.ts +++ b/packages/kbn-es-query/src/es_query/index.ts @@ -7,11 +7,12 @@ */ export { migrateFilter } from './migrate_filter'; -export { buildEsQuery, EsQueryConfig } from './build_es_query'; +export type { EsQueryConfig } from './build_es_query'; +export { buildEsQuery } from './build_es_query'; export { buildQueryFromFilters } from './from_filters'; export { luceneStringToDsl } from './lucene_string_to_dsl'; export { decorateQuery } from './decorate_query'; -export { +export type { IndexPatternBase, IndexPatternFieldBase, IFieldSubType, diff --git a/packages/kbn-es-query/src/filters/index.ts b/packages/kbn-es-query/src/filters/index.ts index 21011db9462ca1..c202892cd9c3f3 100644 --- a/packages/kbn-es-query/src/filters/index.ts +++ b/packages/kbn-es-query/src/filters/index.ts @@ -6,12 +6,12 @@ * Side Public License, v 1. */ +export type { FilterCompareOptions } from './helpers'; export { dedupFilters, uniqFilters, compareFilters, COMPARE_ALL_OPTIONS, - FilterCompareOptions, cleanFilter, isFilter, isFilters, @@ -53,7 +53,7 @@ export { getFilterParams, } from './build_filters'; -export { +export type { Query, Filter, LatLon, diff --git a/packages/kbn-es-query/src/kuery/index.ts b/packages/kbn-es-query/src/kuery/index.ts index 6e03b3cb18f4cf..868904125dc44f 100644 --- a/packages/kbn-es-query/src/kuery/index.ts +++ b/packages/kbn-es-query/src/kuery/index.ts @@ -23,4 +23,4 @@ export const toElasticsearchQuery = (...params: Parameters index) { + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + } + } + + if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') { + closeCurlyIndex = str.indexOf('}', index); + if (closeCurlyIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { + return true; + } + } + } + + if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') { + closeParenIndex = str.indexOf(')', index); + if (closeParenIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + + if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') { + if (pipeIndex < index) { + pipeIndex = str.indexOf('|', index); + } + if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') { + closeParenIndex = str.indexOf(')', pipeIndex); + if (closeParenIndex > pipeIndex) { + backSlashIndex = str.indexOf('\\', pipeIndex); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; + +var relaxedCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + while (index < str.length) { + if (/[*?{}()[\]]/.test(str[index])) { + return true; + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; module.exports = function isGlob(str, options) { if (typeof str !== 'string' || str === '') { @@ -22209,32 +22309,14 @@ module.exports = function isGlob(str, options) { return true; } - var regex = strictRegex; - var match; + var check = strictCheck; - // optionally relax regex + // optionally relax check if (options && options.strict === false) { - regex = relaxedRegex; + check = relaxedCheck; } - while ((match = regex.exec(str))) { - if (match[2]) return true; - var idx = match.index + match[0].length; - - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - var open = match[1]; - var close = open ? chars[open] : null; - if (open && close) { - var n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - - str = str.slice(idx); - } - return false; + return check(str); }; diff --git a/packages/kbn-pm/src/utils/log.ts b/packages/kbn-pm/src/utils/log.ts index 9dbfad2895793e..ba4ee6941f5402 100644 --- a/packages/kbn-pm/src/utils/log.ts +++ b/packages/kbn-pm/src/utils/log.ts @@ -38,4 +38,5 @@ class Log extends ToolingLog { } export const log = new Log(); -export { LogLevel, Log }; +export type { LogLevel }; +export { Log }; diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.mock.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.mock.ts new file mode 100644 index 00000000000000..703c26ffc3ff16 --- /dev/null +++ b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.mock.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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ExportExceptionDetails } from '.'; + +export interface ExportExceptionDetailsMock { + listCount?: number; + missingListsCount?: number; + missingLists?: Array>; + itemCount?: number; + missingItemCount?: number; + missingItems?: Array>; +} + +export const getExceptionExportDetailsMock = ( + details?: ExportExceptionDetailsMock +): ExportExceptionDetails => ({ + exported_exception_list_count: details?.listCount ?? 0, + exported_exception_list_item_count: details?.itemCount ?? 0, + missing_exception_list_item_count: details?.missingItemCount ?? 0, + missing_exception_list_items: details?.missingItems ?? [], + missing_exception_lists: details?.missingLists ?? [], + missing_exception_lists_count: details?.missingListsCount ?? 0, +}); diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.test.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.test.ts new file mode 100644 index 00000000000000..96e25a024c71b5 --- /dev/null +++ b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.test.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { pipe } from 'fp-ts/lib/pipeable'; +import { left } from 'fp-ts/lib/Either'; +import { getExceptionExportDetailsMock } from './index.mock'; +import { exportExceptionDetailsSchema, ExportExceptionDetails } from '.'; +import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils'; + +describe('exportExceptionDetails', () => { + test('it should validate export meta', () => { + const payload = getExceptionExportDetailsMock(); + const decoded = exportExceptionDetailsSchema.decode(payload); + const message = pipe(decoded, foldLeftRight); + + expect(getPaths(left(message.errors))).toEqual([]); + expect(message.schema).toEqual(payload); + }); + + test('it should strip out extra keys', () => { + const payload: ExportExceptionDetails & { + extraKey?: string; + } = getExceptionExportDetailsMock(); + payload.extraKey = 'some extra key'; + const decoded = exportExceptionDetailsSchema.decode(payload); + const message = pipe(decoded, foldLeftRight); + + expect(getPaths(left(message.errors))).toEqual([]); + expect(message.schema).toEqual(getExceptionExportDetailsMock()); + }); +}); diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.ts new file mode 100644 index 00000000000000..3617ae8c9b8b42 --- /dev/null +++ b/packages/kbn-securitysolution-io-ts-list-types/src/common/exception_export_details/index.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import * as t from 'io-ts'; +import { NonEmptyString } from '@kbn/securitysolution-io-ts-types'; + +export const exportExceptionDetails = { + exported_exception_list_count: t.number, + exported_exception_list_item_count: t.number, + missing_exception_list_item_count: t.number, + missing_exception_list_items: t.array( + t.exact( + t.type({ + item_id: NonEmptyString, + }) + ) + ), + missing_exception_lists: t.array( + t.exact( + t.type({ + list_id: NonEmptyString, + }) + ) + ), + missing_exception_lists_count: t.number, +}; + +export const exportExceptionDetailsSchema = t.exact(t.type(exportExceptionDetails)); + +export type ExportExceptionDetails = t.TypeOf; diff --git a/packages/kbn-securitysolution-io-ts-list-types/src/common/index.ts b/packages/kbn-securitysolution-io-ts-list-types/src/common/index.ts index 51b32f3fafa77c..81ecd58cb397c9 100644 --- a/packages/kbn-securitysolution-io-ts-list-types/src/common/index.ts +++ b/packages/kbn-securitysolution-io-ts-list-types/src/common/index.ts @@ -23,6 +23,7 @@ export * from './entry_match'; export * from './entry_match_any'; export * from './entry_match_wildcard'; export * from './entry_nested'; +export * from './exception_export_details'; export * from './exception_list'; export * from './exception_list_item_type'; export * from './filter'; diff --git a/packages/kbn-server-route-repository/src/index.ts b/packages/kbn-server-route-repository/src/index.ts index 23621c5b213bcf..1cc7bd0fdeebe2 100644 --- a/packages/kbn-server-route-repository/src/index.ts +++ b/packages/kbn-server-route-repository/src/index.ts @@ -12,7 +12,7 @@ export { formatRequest } from './format_request'; export { parseEndpoint } from './parse_endpoint'; export { decodeRequestParams } from './decode_request_params'; export { routeValidationObject } from './route_validation_object'; -export { +export type { RouteRepositoryClient, ReturnOf, EndpointOf, diff --git a/packages/kbn-std/src/index.ts b/packages/kbn-std/src/index.ts index 33b40c20039f2c..66fb98888444ff 100644 --- a/packages/kbn-std/src/index.ts +++ b/packages/kbn-std/src/index.ts @@ -7,13 +7,15 @@ */ export { assertNever } from './assert_never'; -export { deepFreeze, Freezable } from './deep_freeze'; +export type { Freezable } from './deep_freeze'; +export { deepFreeze } from './deep_freeze'; export { get } from './get'; export { mapToObject } from './map_to_object'; export { merge } from './merge'; export { pick } from './pick'; export { withTimeout, isPromise } from './promise'; -export { isRelativeUrl, modifyUrl, getUrlOrigin, URLMeaningfulParts } from './url'; +export type { URLMeaningfulParts } from './url'; +export { isRelativeUrl, modifyUrl, getUrlOrigin } from './url'; export { unset } from './unset'; export { getFlattenedObject } from './get_flattened_object'; export { ensureNoUnsafeProperties } from './ensure_no_unsafe_properties'; diff --git a/packages/kbn-test/src/functional_test_runner/public_types.ts b/packages/kbn-test/src/functional_test_runner/public_types.ts index d94f61e23b8b80..d1a0f7998b0a98 100644 --- a/packages/kbn-test/src/functional_test_runner/public_types.ts +++ b/packages/kbn-test/src/functional_test_runner/public_types.ts @@ -103,4 +103,4 @@ export interface FtrConfigProviderContext { readConfigFile(path: string): Promise; } -export { Test, Suite }; +export type { Test, Suite }; diff --git a/packages/kbn-test/src/functional_tests/lib/index.ts b/packages/kbn-test/src/functional_tests/lib/index.ts index 93700a692dc816..bf2cc431595269 100644 --- a/packages/kbn-test/src/functional_tests/lib/index.ts +++ b/packages/kbn-test/src/functional_tests/lib/index.ts @@ -8,6 +8,7 @@ export { runKibanaServer } from './run_kibana_server'; export { runElasticsearch } from './run_elasticsearch'; -export { runFtr, hasTests, assertNoneExcluded, CreateFtrOptions, CreateFtrParams } from './run_ftr'; +export type { CreateFtrOptions, CreateFtrParams } from './run_ftr'; +export { runFtr, hasTests, assertNoneExcluded } from './run_ftr'; export { KIBANA_ROOT, KIBANA_FTR_SCRIPT, FUNCTIONAL_CONFIG_PATH, API_CONFIG_PATH } from './paths'; export { runCli } from './run_cli'; diff --git a/packages/kbn-test/src/index.ts b/packages/kbn-test/src/index.ts index 0ef9fbfed07a0a..29e7e775ec1718 100644 --- a/packages/kbn-test/src/index.ts +++ b/packages/kbn-test/src/index.ts @@ -25,14 +25,8 @@ export { runTests, startServers } from './functional_tests/tasks'; // @internal export { KIBANA_ROOT } from './functional_tests/lib/paths'; -export { - esTestConfig, - createTestEsCluster, - CreateTestEsClusterOptions, - EsTestCluster, - ICluster, - convertToKibanaClient, -} from './es'; +export type { CreateTestEsClusterOptions, EsTestCluster, ICluster } from './es'; +export { esTestConfig, createTestEsCluster, convertToKibanaClient } from './es'; export { kbnTestConfig, kibanaServerTestUser, kibanaTestUser, adminTestUser } from './kbn'; diff --git a/packages/kbn-test/src/jest/utils/testbed/index.ts b/packages/kbn-test/src/jest/utils/testbed/index.ts index 7abd4f000ab587..dfa5f011853c05 100644 --- a/packages/kbn-test/src/jest/utils/testbed/index.ts +++ b/packages/kbn-test/src/jest/utils/testbed/index.ts @@ -7,4 +7,4 @@ */ export { registerTestBed } from './testbed'; -export { TestBed, TestBedConfig, SetupFunc, UnwrapPromise } from './types'; +export type { TestBed, TestBedConfig, SetupFunc, UnwrapPromise } from './types'; diff --git a/packages/kbn-utility-types/src/index.ts b/packages/kbn-utility-types/src/index.ts index 921f056c6b7551..92aa8d7ecc9892 100644 --- a/packages/kbn-utility-types/src/index.ts +++ b/packages/kbn-utility-types/src/index.ts @@ -7,7 +7,7 @@ */ import { PromiseType } from 'utility-types'; -export { $Values, Assign, Class, Optional, Required } from 'utility-types'; +export type { $Values, Assign, Class, Optional, Required } from 'utility-types'; export type { JsonArray, diff --git a/scripts/eslint_with_types.js b/scripts/eslint_with_types.js new file mode 100644 index 00000000000000..e0371bc5321701 --- /dev/null +++ b/scripts/eslint_with_types.js @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +require('../src/setup_node_env'); +require('../src/dev/eslint').runEslintWithTypes(); diff --git a/src/core/public/apm_resource_counter.ts b/src/core/public/apm_resource_counter.ts new file mode 100644 index 00000000000000..2c4216c3ddeabe --- /dev/null +++ b/src/core/public/apm_resource_counter.ts @@ -0,0 +1,47 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export class CachedResourceObserver { + private loaded = { + networkOrDisk: 0, + memory: 0, + }; + private observer?: PerformanceObserver; + + constructor() { + if (!window.PerformanceObserver) return; + + const cb = (entries: PerformanceObserverEntryList) => { + const e = entries.getEntries(); + e.forEach((entry: Record) => { + if (entry.initiatorType === 'script' || entry.initiatorType === 'link') { + // If the resource is fetched from a local cache, or if it is a cross-origin resource, this property returns zero. + // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/transferSize + if (entry.name.indexOf(window.location.host) > -1 && entry.transferSize === 0) { + this.loaded.memory++; + } else { + this.loaded.networkOrDisk++; + } + } + }); + }; + this.observer = new PerformanceObserver(cb); + this.observer.observe({ + type: 'resource', + buffered: true, + }); + } + + public getCounts() { + return this.loaded; + } + + public destroy() { + this.observer?.disconnect(); + } +} diff --git a/src/core/public/apm_system.test.ts b/src/core/public/apm_system.test.ts index 85d5406c924e6a..f62421cb55abc9 100644 --- a/src/core/public/apm_system.test.ts +++ b/src/core/public/apm_system.test.ts @@ -7,9 +7,11 @@ */ jest.mock('@elastic/apm-rum'); -import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; +import type { DeeplyMockedKeys, MockedKeys } from '@kbn/utility-types/jest'; import { init, apm } from '@elastic/apm-rum'; import { ApmSystem } from './apm_system'; +import { Subject } from 'rxjs'; +import { InternalApplicationStart } from './application/types'; const initMock = init as jest.Mocked; const apmMock = apm as DeeplyMockedKeys; @@ -39,6 +41,119 @@ describe('ApmSystem', () => { expect(apm.addLabels).toHaveBeenCalledWith({ alpha: 'one' }); }); + describe('manages the page load transaction', () => { + it('does nothing if theres no transaction', async () => { + const apmSystem = new ApmSystem({ active: true }); + const mockTransaction: MockedKeys = { + type: 'wrong', + // @ts-expect-error 2345 + block: jest.fn(), + mark: jest.fn(), + }; + apmMock.getCurrentTransaction.mockReturnValue(mockTransaction); + await apmSystem.setup(); + expect(mockTransaction.mark).not.toHaveBeenCalled(); + // @ts-expect-error 2345 + expect(mockTransaction.block).not.toHaveBeenCalled(); + }); + + it('blocks a page load transaction', async () => { + const apmSystem = new ApmSystem({ active: true }); + const mockTransaction: MockedKeys = { + type: 'page-load', + // @ts-expect-error 2345 + block: jest.fn(), + mark: jest.fn(), + }; + apmMock.getCurrentTransaction.mockReturnValue(mockTransaction); + await apmSystem.setup(); + expect(mockTransaction.mark).toHaveBeenCalledTimes(1); + expect(mockTransaction.mark).toHaveBeenCalledWith('apm-setup'); + // @ts-expect-error 2345 + expect(mockTransaction.block).toHaveBeenCalledTimes(1); + }); + + it('marks apm start', async () => { + const apmSystem = new ApmSystem({ active: true }); + const currentAppId$ = new Subject(); + const mark = jest.fn(); + const mockTransaction: MockedKeys = { + type: 'page-load', + mark, + // @ts-expect-error 2345 + block: jest.fn(), + end: jest.fn(), + addLabels: jest.fn(), + }; + + apmMock.getCurrentTransaction.mockReturnValue(mockTransaction); + await apmSystem.setup(); + + mark.mockReset(); + + await apmSystem.start({ + application: { + currentAppId$, + } as any as InternalApplicationStart, + }); + + expect(mark).toHaveBeenCalledWith('apm-start'); + }); + + it('closes the page load transaction once', async () => { + const apmSystem = new ApmSystem({ active: true }); + const currentAppId$ = new Subject(); + const mockTransaction: MockedKeys = { + type: 'page-load', + // @ts-expect-error 2345 + block: jest.fn(), + mark: jest.fn(), + end: jest.fn(), + addLabels: jest.fn(), + }; + apmMock.getCurrentTransaction.mockReturnValue(mockTransaction); + await apmSystem.setup(); + await apmSystem.start({ + application: { + currentAppId$, + } as any as InternalApplicationStart, + }); + currentAppId$.next('myapp'); + + expect(mockTransaction.end).toHaveBeenCalledTimes(1); + + currentAppId$.next('another-app'); + + expect(mockTransaction.end).toHaveBeenCalledTimes(1); + }); + + it('adds resource load labels', async () => { + const apmSystem = new ApmSystem({ active: true }); + const currentAppId$ = new Subject(); + const mockTransaction: Transaction = { + type: 'page-load', + // @ts-expect-error 2345 + block: jest.fn(), + mark: jest.fn(), + end: jest.fn(), + addLabels: jest.fn(), + }; + apmMock.getCurrentTransaction.mockReturnValue(mockTransaction); + await apmSystem.setup(); + await apmSystem.start({ + application: { + currentAppId$, + } as any as InternalApplicationStart, + }); + currentAppId$.next('myapp'); + + expect(mockTransaction.addLabels).toHaveBeenCalledWith({ + 'loaded-resources': 0, + 'cached-resources': 0, + }); + }); + }); + describe('http request normalization', () => { let windowSpy: any; diff --git a/src/core/public/apm_system.ts b/src/core/public/apm_system.ts index c64c1923f1131d..5201b7005c66e1 100644 --- a/src/core/public/apm_system.ts +++ b/src/core/public/apm_system.ts @@ -8,6 +8,7 @@ import type { ApmBase, AgentConfigOptions } from '@elastic/apm-rum'; import { modifyUrl } from '@kbn/std'; +import { CachedResourceObserver } from './apm_resource_counter'; import type { InternalApplicationStart } from './application'; /** "GET protocol://hostname:port/pathname" */ @@ -31,17 +32,21 @@ interface StartDeps { export class ApmSystem { private readonly enabled: boolean; private pageLoadTransaction?: Transaction; + private resourceObserver: CachedResourceObserver; + private apm?: ApmBase; /** * `apmConfig` would be populated with relevant APM RUM agent * configuration if server is started with elastic.apm.* config. */ constructor(private readonly apmConfig?: ApmConfig, private readonly basePath = '') { this.enabled = apmConfig != null && !!apmConfig.active; + this.resourceObserver = new CachedResourceObserver(); } async setup() { if (!this.enabled) return; const { init, apm } = await import('@elastic/apm-rum'); + this.apm = apm; const { globalLabels, ...apmConfig } = this.apmConfig!; if (globalLabels) { apm.addLabels(globalLabels); @@ -50,36 +55,23 @@ export class ApmSystem { this.addHttpRequestNormalization(apm); init(apmConfig); - this.pageLoadTransaction = apm.getCurrentTransaction(); - - // Keep the page load transaction open until all resources finished loading - if (this.pageLoadTransaction && this.pageLoadTransaction.type === 'page-load') { - // @ts-expect-error 2339 - this.pageLoadTransaction.block(true); - this.pageLoadTransaction.mark('apm-setup'); - } + // hold page load transaction blocks a transaction implicitly created by init. + this.holdPageLoadTransaction(apm); } async start(start?: StartDeps) { if (!this.enabled || !start) return; - if (this.pageLoadTransaction && this.pageLoadTransaction.type === 'page-load') { - this.pageLoadTransaction.mark('apm-start'); - } + this.markPageLoadStart(); /** * Register listeners for navigation changes and capture them as * route-change transactions after Kibana app is bootstrapped */ start.application.currentAppId$.subscribe((appId) => { - const apmInstance = (window as any).elasticApm; - if (appId && apmInstance && typeof apmInstance.startTransaction === 'function') { - // Close the page load transaction - if (this.pageLoadTransaction && this.pageLoadTransaction.type === 'page-load') { - this.pageLoadTransaction.end(); - this.pageLoadTransaction = undefined; - } - apmInstance.startTransaction(`/app/${appId}`, 'route-change', { + if (appId && this.apm) { + this.closePageLoadTransaction(); + this.apm.startTransaction(`/app/${appId}`, 'route-change', { managed: true, canReuse: true, }); @@ -87,6 +79,39 @@ export class ApmSystem { }); } + /* Hold the page load transaction open, until all resources actually finish loading */ + private holdPageLoadTransaction(apm: ApmBase) { + const transaction = apm.getCurrentTransaction(); + + // Keep the page load transaction open until all resources finished loading + if (transaction && transaction.type === 'page-load') { + this.pageLoadTransaction = transaction; + // @ts-expect-error 2339 block is a private property of Transaction interface + this.pageLoadTransaction.block(true); + this.pageLoadTransaction.mark('apm-setup'); + } + } + + /* Close and clear the page load transaction */ + private closePageLoadTransaction() { + if (this.pageLoadTransaction) { + const loadCounts = this.resourceObserver.getCounts(); + this.pageLoadTransaction.addLabels({ + 'loaded-resources': loadCounts.networkOrDisk, + 'cached-resources': loadCounts.memory, + }); + this.resourceObserver.destroy(); + this.pageLoadTransaction.end(); + this.pageLoadTransaction = undefined; + } + } + + private markPageLoadStart() { + if (this.pageLoadTransaction) { + this.pageLoadTransaction.mark('apm-start'); + } + } + /** * Adds an observer to the APM configuration for normalizing transactions of the 'http-request' type to remove the * hostname, protocol, port, and base path. Allows for coorelating data cross different deployments. diff --git a/src/core/server/saved_objects/object_types/registration.ts b/src/core/server/saved_objects/object_types/registration.ts index ce108967471783..a199ce947f96b2 100644 --- a/src/core/server/saved_objects/object_types/registration.ts +++ b/src/core/server/saved_objects/object_types/registration.ts @@ -16,8 +16,9 @@ const legacyUrlAliasType: SavedObjectsType = { dynamic: false, properties: { sourceId: { type: 'keyword' }, - targetType: { type: 'keyword' }, targetNamespace: { type: 'keyword' }, + targetType: { type: 'keyword' }, + targetId: { type: 'keyword' }, resolveCounter: { type: 'long' }, disabled: { type: 'boolean' }, // other properties exist, but we aren't querying or aggregating on those, so we don't need to specify them (because we use `dynamic: false` above) diff --git a/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.test.mock.ts b/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.test.mock.ts index 382212cfbbd11f..728f3b847b6317 100644 --- a/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.test.mock.ts +++ b/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.test.mock.ts @@ -6,14 +6,14 @@ * Side Public License, v 1. */ -import type { findLegacyUrlAliases } from './find_legacy_url_aliases'; +import type { findLegacyUrlAliases } from './legacy_url_aliases'; import type * as InternalUtils from './internal_utils'; export const mockFindLegacyUrlAliases = jest.fn() as jest.MockedFunction< typeof findLegacyUrlAliases >; -jest.mock('./find_legacy_url_aliases', () => { +jest.mock('./legacy_url_aliases', () => { return { findLegacyUrlAliases: mockFindLegacyUrlAliases }; }); diff --git a/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.ts b/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.ts index 87bb5017aab956..fd2afea999a079 100644 --- a/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.ts +++ b/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.ts @@ -9,7 +9,7 @@ import type { ISavedObjectTypeRegistry } from '../../saved_objects_type_registry'; import type { SavedObjectsSerializer } from '../../serialization'; import type { SavedObject, SavedObjectsBaseOptions } from '../../types'; -import { findLegacyUrlAliases } from './find_legacy_url_aliases'; +import { findLegacyUrlAliases } from './legacy_url_aliases'; import { getRootFields } from './included_fields'; import { getObjectKey, diff --git a/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.test.mock.ts b/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.test.mock.ts new file mode 100644 index 00000000000000..9585c40e6a161a --- /dev/null +++ b/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.test.mock.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { getErrorMessage } from '../../../../elasticsearch'; + +export const mockGetEsErrorMessage = jest.fn() as jest.MockedFunction; + +jest.mock('../../../../elasticsearch', () => { + return { getErrorMessage: mockGetEsErrorMessage }; +}); + +// Mock these functions to return empty results, as this simplifies test cases and we don't need to exercise alternate code paths for these +jest.mock('@kbn/es-query', () => { + return { nodeTypes: { function: { buildNode: jest.fn() } } }; +}); +jest.mock('../search_dsl', () => { + return { getSearchDsl: jest.fn() }; +}); diff --git a/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.test.ts b/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.test.ts new file mode 100644 index 00000000000000..22c57fe3f280f4 --- /dev/null +++ b/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.test.ts @@ -0,0 +1,152 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { mockGetEsErrorMessage } from './delete_legacy_url_aliases.test.mock'; // Note: importing this file applies default mocks for other functions too + +import { errors as EsErrors } from '@elastic/elasticsearch'; + +import { elasticsearchClientMock } from '../../../../elasticsearch/client/mocks'; +import { typeRegistryMock } from '../../../saved_objects_type_registry.mock'; +import { ALL_NAMESPACES_STRING } from '../utils'; +import { deleteLegacyUrlAliases } from './delete_legacy_url_aliases'; +import type { DeleteLegacyUrlAliasesParams } from './delete_legacy_url_aliases'; + +type SetupParams = Pick< + DeleteLegacyUrlAliasesParams, + 'type' | 'id' | 'namespaces' | 'deleteBehavior' +>; + +describe('deleteLegacyUrlAliases', () => { + function setup(setupParams: SetupParams) { + return { + mappings: { properties: {} }, // doesn't matter, only used as an argument to getSearchDsl which is mocked + registry: typeRegistryMock.create(), // doesn't matter, only used as an argument to getSearchDsl which is mocked + client: elasticsearchClientMock.createElasticsearchClient(), + getIndexForType: jest.fn(), // doesn't matter + ...setupParams, + }; + } + + const type = 'obj-type'; + const id = 'obj-id'; + + it('throws an error if namespaces includes the "all namespaces" string', async () => { + const namespaces = [ALL_NAMESPACES_STRING]; + const params = setup({ type, id, namespaces, deleteBehavior: 'inclusive' }); + + await expect(() => deleteLegacyUrlAliases(params)).rejects.toThrowError( + `Failed to delete legacy URL aliases for ${type}/${id}: "namespaces" cannot include the * string` + ); + expect(params.client.updateByQuery).not.toHaveBeenCalled(); + }); + + it('throws an error if updateByQuery fails', async () => { + const namespaces = ['space-a', 'space-b']; + const params = setup({ type, id, namespaces, deleteBehavior: 'inclusive' }); + const esError = new EsErrors.ResponseError( + elasticsearchClientMock.createApiResponse({ + statusCode: 500, + body: { error: { type: 'es_type', reason: 'es_reason' } }, + }) + ); + params.client.updateByQuery.mockResolvedValueOnce( + elasticsearchClientMock.createErrorTransportRequestPromise(esError) + ); + mockGetEsErrorMessage.mockClear(); + mockGetEsErrorMessage.mockReturnValue('Oh no!'); + + await expect(() => deleteLegacyUrlAliases(params)).rejects.toThrowError( + `Failed to delete legacy URL aliases for ${type}/${id}: Oh no!` + ); + expect(params.client.updateByQuery).toHaveBeenCalledTimes(1); + expect(mockGetEsErrorMessage).toHaveBeenCalledTimes(1); + expect(mockGetEsErrorMessage).toHaveBeenCalledWith(esError); + }); + + describe('deleteBehavior "inclusive"', () => { + const deleteBehavior = 'inclusive' as const; + + it('when filtered namespaces is not empty, returns early', async () => { + const namespaces = ['default']; + const params = setup({ type, id, namespaces, deleteBehavior }); + + await deleteLegacyUrlAliases(params); + expect(params.client.updateByQuery).not.toHaveBeenCalled(); + }); + + it('when filtered namespaces is not empty, calls updateByQuery with expected script params', async () => { + const namespaces = ['space-a', 'default', 'space-b']; + const params = setup({ type, id, namespaces, deleteBehavior }); + + await deleteLegacyUrlAliases(params); + expect(params.client.updateByQuery).toHaveBeenCalledTimes(1); + expect(params.client.updateByQuery).toHaveBeenCalledWith( + expect.objectContaining({ + body: expect.objectContaining({ + script: expect.objectContaining({ + params: { + namespaces: ['space-a', 'space-b'], // 'default' is filtered out + matchTargetNamespaceOp: 'delete', + notMatchTargetNamespaceOp: 'noop', + }, + }), + }), + }), + expect.anything() + ); + }); + }); + + describe('deleteBehavior "exclusive"', () => { + const deleteBehavior = 'exclusive' as const; + + it('when filtered namespaces is empty, calls updateByQuery with expected script params', async () => { + const namespaces = ['default']; + const params = setup({ type, id, namespaces, deleteBehavior }); + + await deleteLegacyUrlAliases(params); + expect(params.client.updateByQuery).toHaveBeenCalledTimes(1); + expect(params.client.updateByQuery).toHaveBeenCalledWith( + expect.objectContaining({ + body: expect.objectContaining({ + script: expect.objectContaining({ + params: { + namespaces: [], // 'default' is filtered out + matchTargetNamespaceOp: 'noop', + notMatchTargetNamespaceOp: 'delete', + }, + }), + }), + }), + expect.anything() + ); + }); + + it('when filtered namespaces is not empty, calls updateByQuery with expected script params', async () => { + const namespaces = ['space-a', 'default', 'space-b']; + const params = setup({ type, id, namespaces, deleteBehavior }); + + await deleteLegacyUrlAliases(params); + expect(params.client.updateByQuery).toHaveBeenCalledTimes(1); + expect(params.client.updateByQuery).toHaveBeenCalledWith( + expect.objectContaining({ + body: expect.objectContaining({ + script: expect.objectContaining({ + params: { + namespaces: ['space-a', 'space-b'], // 'default' is filtered out + matchTargetNamespaceOp: 'noop', + notMatchTargetNamespaceOp: 'delete', + }, + }), + }), + }), + expect.anything() + ); + }); + }); +}); diff --git a/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.ts b/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.ts new file mode 100644 index 00000000000000..59c73d1f781a23 --- /dev/null +++ b/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.ts @@ -0,0 +1,113 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import * as esKuery from '@kbn/es-query'; + +import { getErrorMessage as getEsErrorMessage } from '../../../../elasticsearch'; +import type { ISavedObjectTypeRegistry } from '../../../saved_objects_type_registry'; +import type { IndexMapping } from '../../../mappings'; +import { LEGACY_URL_ALIAS_TYPE } from '../../../object_types'; +import type { RepositoryEsClient } from '../repository_es_client'; +import { getSearchDsl } from '../search_dsl'; +import { ALL_NAMESPACES_STRING, DEFAULT_NAMESPACE_STRING } from '../utils'; + +/** @internal */ +export interface DeleteLegacyUrlAliasesParams { + mappings: IndexMapping; + registry: ISavedObjectTypeRegistry; + client: RepositoryEsClient; + getIndexForType: (type: string) => string; + /** The object type. */ + type: string; + /** The object ID. */ + id: string; + /** + * The namespaces to include or exclude when searching for legacy URL alias targets (depends on the `deleteBehavior` parameter). + * Note that using `namespaces: [], deleteBehavior: 'exclusive'` will delete all aliases for this object in all spaces. + */ + namespaces: string[]; + /** + * If this is equal to 'inclusive', all aliases with a `targetNamespace` in the `namespaces` array will be deleted. + * If this is equal to 'exclusive', all aliases with a `targetNamespace` _not_ in the `namespaces` array will be deleted. + */ + deleteBehavior: 'inclusive' | 'exclusive'; +} + +/** + * Deletes legacy URL aliases that point to a given object. + * + * Note that aliases are only created when an object is converted to become share-capable, and each targetId is deterministically generated + * with uuidv5 -- this means that the chances of there actually being _multiple_ legacy URL aliases that target a given type/ID are slim to + * none. However, we don't always know exactly what space an alias could be in (if an object exists in multiple spaces, or in all spaces), + * so the most straightforward way for us to ensure that aliases are reliably deleted is to use updateByQuery, which is what this function + * does. + * + * @internal + */ +export async function deleteLegacyUrlAliases(params: DeleteLegacyUrlAliasesParams) { + const { mappings, registry, client, getIndexForType, type, id, namespaces, deleteBehavior } = + params; + + if (namespaces.includes(ALL_NAMESPACES_STRING)) { + throwError(type, id, '"namespaces" cannot include the * string'); + } + + // Legacy URL aliases cannot exist in the default space; filter that out + const filteredNamespaces = namespaces.filter( + (namespace) => namespace !== DEFAULT_NAMESPACE_STRING + ); + if (!filteredNamespaces.length && deleteBehavior === 'inclusive') { + // nothing to do, return early + return; + } + + const { buildNode } = esKuery.nodeTypes.function; + const match1 = buildNode('is', `${LEGACY_URL_ALIAS_TYPE}.targetType`, type); + const match2 = buildNode('is', `${LEGACY_URL_ALIAS_TYPE}.targetId`, id); + const kueryNode = buildNode('and', [match1, match2]); + + try { + await client.updateByQuery( + { + 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, + }), + 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: filteredNamespaces, + matchTargetNamespaceOp: deleteBehavior === 'inclusive' ? 'delete' : 'noop', + notMatchTargetNamespaceOp: deleteBehavior === 'inclusive' ? 'noop' : 'delete', + }, + lang: 'painless', + }, + conflicts: 'proceed', + }, + }, + { ignore: [404] } + ); + } catch (err) { + const errorMessage = getEsErrorMessage(err); + throwError(type, id, `${errorMessage}`); + } +} + +function throwError(type: string, id: string, message: string) { + throw new Error(`Failed to delete legacy URL aliases for ${type}/${id}: ${message}`); +} diff --git a/src/core/server/saved_objects/service/lib/find_legacy_url_aliases.test.ts b/src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.test.ts similarity index 94% rename from src/core/server/saved_objects/service/lib/find_legacy_url_aliases.test.ts rename to src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.test.ts index 134ea26d53b7de..755fa5794b5755 100644 --- a/src/core/server/saved_objects/service/lib/find_legacy_url_aliases.test.ts +++ b/src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.test.ts @@ -8,12 +8,12 @@ import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; -import { LegacyUrlAlias, LEGACY_URL_ALIAS_TYPE } from '../../object_types'; +import { LegacyUrlAlias, LEGACY_URL_ALIAS_TYPE } from '../../../object_types'; +import type { CreatePointInTimeFinderFn, PointInTimeFinder } from '../point_in_time_finder'; +import { savedObjectsPointInTimeFinderMock } from '../point_in_time_finder.mock'; +import type { ISavedObjectsRepository } from '../repository'; +import { savedObjectsRepositoryMock } from '../repository.mock'; import { findLegacyUrlAliases } from './find_legacy_url_aliases'; -import type { CreatePointInTimeFinderFn, PointInTimeFinder } from './point_in_time_finder'; -import { savedObjectsPointInTimeFinderMock } from './point_in_time_finder.mock'; -import type { ISavedObjectsRepository } from './repository'; -import { savedObjectsRepositoryMock } from './repository.mock'; describe('findLegacyUrlAliases', () => { let savedObjectsMock: jest.Mocked; diff --git a/src/core/server/saved_objects/service/lib/find_legacy_url_aliases.ts b/src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.ts similarity index 87% rename from src/core/server/saved_objects/service/lib/find_legacy_url_aliases.ts rename to src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.ts index aac022fc320984..7c1ce82129710c 100644 --- a/src/core/server/saved_objects/service/lib/find_legacy_url_aliases.ts +++ b/src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.ts @@ -7,9 +7,9 @@ */ import * as esKuery from '@kbn/es-query'; -import { LegacyUrlAlias, LEGACY_URL_ALIAS_TYPE } from '../../object_types'; -import { getObjectKey } from './internal_utils'; -import type { CreatePointInTimeFinderFn } from './point_in_time_finder'; +import { LegacyUrlAlias, LEGACY_URL_ALIAS_TYPE } from '../../../object_types'; +import { getObjectKey } from '../internal_utils'; +import type { CreatePointInTimeFinderFn } from '../point_in_time_finder'; interface FindLegacyUrlAliasesObject { type: string; @@ -68,6 +68,7 @@ export async function findLegacyUrlAliases( function createAliasKueryFilter(objects: Array<{ type: string; id: string }>) { const { buildNode } = esKuery.nodeTypes.function; + // Note: these nodes include '.attributes' for type-level fields because these are eventually passed to `validateConvertFilterToKueryNode`, which requires it const kueryNodes = objects.reduce((acc, { type, id }) => { const match1 = buildNode('is', `${LEGACY_URL_ALIAS_TYPE}.attributes.targetType`, type); const match2 = buildNode('is', `${LEGACY_URL_ALIAS_TYPE}.attributes.sourceId`, id); diff --git a/src/core/server/saved_objects/service/lib/legacy_url_aliases/index.ts b/src/core/server/saved_objects/service/lib/legacy_url_aliases/index.ts new file mode 100644 index 00000000000000..ec10668940d721 --- /dev/null +++ b/src/core/server/saved_objects/service/lib/legacy_url_aliases/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { findLegacyUrlAliases } from './find_legacy_url_aliases'; + +export { deleteLegacyUrlAliases } from './delete_legacy_url_aliases'; +export type { DeleteLegacyUrlAliasesParams } from './delete_legacy_url_aliases'; diff --git a/src/core/server/saved_objects/service/lib/preflight_check_for_create.test.mock.ts b/src/core/server/saved_objects/service/lib/preflight_check_for_create.test.mock.ts index e774a178abd492..fe8076b51e5dd4 100644 --- a/src/core/server/saved_objects/service/lib/preflight_check_for_create.test.mock.ts +++ b/src/core/server/saved_objects/service/lib/preflight_check_for_create.test.mock.ts @@ -6,14 +6,14 @@ * Side Public License, v 1. */ -import type { findLegacyUrlAliases } from './find_legacy_url_aliases'; +import type { findLegacyUrlAliases } from './legacy_url_aliases'; import type * as InternalUtils from './internal_utils'; export const mockFindLegacyUrlAliases = jest.fn() as jest.MockedFunction< typeof findLegacyUrlAliases >; -jest.mock('./find_legacy_url_aliases', () => { +jest.mock('./legacy_url_aliases', () => { return { findLegacyUrlAliases: mockFindLegacyUrlAliases }; }); diff --git a/src/core/server/saved_objects/service/lib/preflight_check_for_create.ts b/src/core/server/saved_objects/service/lib/preflight_check_for_create.ts index 6788cd8aa3abf6..e5b96a22631c17 100644 --- a/src/core/server/saved_objects/service/lib/preflight_check_for_create.ts +++ b/src/core/server/saved_objects/service/lib/preflight_check_for_create.ts @@ -13,7 +13,7 @@ import type { SavedObjectsRawDocSource, SavedObjectsSerializer, } from '../../serialization'; -import { findLegacyUrlAliases } from './find_legacy_url_aliases'; +import { findLegacyUrlAliases } from './legacy_url_aliases'; import { Either, rawDocExistsInNamespaces } from './internal_utils'; import { getObjectKey, isLeft, isRight } from './internal_utils'; import type { CreatePointInTimeFinderFn } from './point_in_time_finder'; diff --git a/src/core/server/saved_objects/service/lib/repository.test.js b/src/core/server/saved_objects/service/lib/repository.test.js index 51ec81503956a3..f61a79ca9de662 100644 --- a/src/core/server/saved_objects/service/lib/repository.test.js +++ b/src/core/server/saved_objects/service/lib/repository.test.js @@ -14,6 +14,7 @@ import { mockUpdateObjectsSpaces, mockGetCurrentTime, mockPreflightCheckForCreate, + mockDeleteLegacyUrlAliases, } from './repository.test.mock'; import { SavedObjectsRepository } from './repository'; @@ -2394,9 +2395,11 @@ describe('SavedObjectsRepository', () => { const id = 'logstash-*'; const namespace = 'foo-namespace'; - const deleteSuccess = async (type, id, options) => { + const deleteSuccess = async (type, id, options, internalOptions = {}) => { + const { mockGetResponseValue } = internalOptions; if (registry.isMultiNamespace(type)) { - const mockGetResponse = getMockGetResponse({ type, id }, options?.namespace); + const mockGetResponse = + mockGetResponseValue ?? getMockGetResponse({ type, id }, options?.namespace); client.get.mockResolvedValueOnce( elasticsearchClientMock.createSuccessTransportRequestPromise(mockGetResponse) ); @@ -2409,6 +2412,11 @@ describe('SavedObjectsRepository', () => { return result; }; + beforeEach(() => { + mockDeleteLegacyUrlAliases.mockClear(); + mockDeleteLegacyUrlAliases.mockResolvedValue(); + }); + describe('client calls', () => { it(`should use the ES delete action when not using a multi-namespace type`, async () => { await deleteSuccess(type, id); @@ -2482,6 +2490,64 @@ describe('SavedObjectsRepository', () => { }); }); + describe('legacy URL aliases', () => { + it(`doesn't delete legacy URL aliases for single-namespace object types`, async () => { + await deleteSuccess(type, id, { namespace }); + expect(mockDeleteLegacyUrlAliases).not.toHaveBeenCalled(); + }); + + // We intentionally do not include a test case for a multi-namespace object with a "not found" preflight result, because that throws + // an error (without deleting aliases) and we already have a test case for that + + it(`deletes legacy URL aliases for multi-namespace object types (all spaces)`, async () => { + const internalOptions = { + mockGetResponseValue: getMockGetResponse( + { type: MULTI_NAMESPACE_TYPE, id }, + ALL_NAMESPACES_STRING + ), + }; + await deleteSuccess(MULTI_NAMESPACE_TYPE, id, { namespace, force: true }, internalOptions); + expect(mockDeleteLegacyUrlAliases).toHaveBeenCalledWith( + expect.objectContaining({ + type: MULTI_NAMESPACE_TYPE, + id, + namespaces: [], + deleteBehavior: 'exclusive', + }) + ); + }); + + it(`deletes legacy URL aliases for multi-namespace object types (specific spaces)`, async () => { + await deleteSuccess(MULTI_NAMESPACE_TYPE, id, { namespace }); // this function mocks a preflight response with the given namespace by default + expect(mockDeleteLegacyUrlAliases).toHaveBeenCalledWith( + expect.objectContaining({ + type: MULTI_NAMESPACE_TYPE, + id, + namespaces: [namespace], + deleteBehavior: 'inclusive', + }) + ); + }); + + it(`logs a message when deleteLegacyUrlAliases returns an error`, async () => { + client.get.mockResolvedValueOnce( + elasticsearchClientMock.createSuccessTransportRequestPromise( + getMockGetResponse({ type: MULTI_NAMESPACE_ISOLATED_TYPE, id, namespace }) + ) + ); + client.delete.mockResolvedValueOnce( + elasticsearchClientMock.createSuccessTransportRequestPromise({ result: 'deleted' }) + ); + mockDeleteLegacyUrlAliases.mockRejectedValueOnce(new Error('Oh no!')); + await savedObjectsRepository.delete(MULTI_NAMESPACE_ISOLATED_TYPE, id, { namespace }); + expect(client.get).toHaveBeenCalledTimes(1); + expect(logger.error).toHaveBeenCalledTimes(1); + expect(logger.error).toHaveBeenCalledWith( + 'Unable to delete aliases when deleting an object: Oh no!' + ); + }); + }); + describe('errors', () => { const expectNotFoundError = async (type, id, options) => { await expect(savedObjectsRepository.delete(type, id, options)).rejects.toThrowError( diff --git a/src/core/server/saved_objects/service/lib/repository.test.mock.ts b/src/core/server/saved_objects/service/lib/repository.test.mock.ts index 88eb13e3ca46b8..3ec2cb0a5d8b95 100644 --- a/src/core/server/saved_objects/service/lib/repository.test.mock.ts +++ b/src/core/server/saved_objects/service/lib/repository.test.mock.ts @@ -11,6 +11,7 @@ import type { internalBulkResolve } from './internal_bulk_resolve'; import type * as InternalUtils from './internal_utils'; import type { preflightCheckForCreate } from './preflight_check_for_create'; import type { updateObjectsSpaces } from './update_objects_spaces'; +import type { deleteLegacyUrlAliases } from './legacy_url_aliases'; export const mockCollectMultiNamespaceReferences = jest.fn() as jest.MockedFunction< typeof collectMultiNamespaceReferences @@ -60,3 +61,10 @@ export const pointInTimeFinderMock = jest.fn(); jest.doMock('./point_in_time_finder', () => ({ PointInTimeFinder: pointInTimeFinderMock, })); + +export const mockDeleteLegacyUrlAliases = jest.fn() as jest.MockedFunction< + typeof deleteLegacyUrlAliases +>; +jest.mock('./legacy_url_aliases', () => ({ + deleteLegacyUrlAliases: mockDeleteLegacyUrlAliases, +})); diff --git a/src/core/server/saved_objects/service/lib/repository.ts b/src/core/server/saved_objects/service/lib/repository.ts index ab802d2f366778..d538690fb19203 100644 --- a/src/core/server/saved_objects/service/lib/repository.ts +++ b/src/core/server/saved_objects/service/lib/repository.ts @@ -100,6 +100,7 @@ import { preflightCheckForCreate, PreflightCheckForCreateObject, } from './preflight_check_for_create'; +import { deleteLegacyUrlAliases } from './legacy_url_aliases'; // BEWARE: The SavedObjectClient depends on the implementation details of the SavedObjectsRepository // so any breaking changes to this repository are considered breaking changes to the SavedObjectsClient. @@ -717,6 +718,25 @@ export class SavedObjectsRepository { const deleted = body.result === 'deleted'; if (deleted) { + const namespaces = preflightResult?.savedObjectNamespaces; + if (namespaces) { + // This is a multi-namespace object type, and it might have legacy URL aliases that need to be deleted. + await deleteLegacyUrlAliases({ + mappings: this._mappings, + registry: this._registry, + client: this.client, + getIndexForType: this.getIndexForType.bind(this), + type, + id, + ...(namespaces.includes(ALL_NAMESPACES_STRING) + ? { namespaces: [], deleteBehavior: 'exclusive' } // delete legacy URL aliases for this type/ID for all spaces + : { namespaces, deleteBehavior: 'inclusive' }), // delete legacy URL aliases for this type/ID for these specific spaces + }).catch((err) => { + // The object has already been deleted, but we caught an error when attempting to delete aliases. + // A consumer cannot attempt to delete the object again, so just log the error and swallow it. + this._logger.error(`Unable to delete aliases when deleting an object: ${err.message}`); + }); + } return {}; } @@ -1344,10 +1364,12 @@ export class SavedObjectsRepository { options?: SavedObjectsUpdateObjectsSpacesOptions ) { return updateObjectsSpaces({ + mappings: this._mappings, registry: this._registry, allowedTypes: this._allowedTypes, client: this.client, serializer: this._serializer, + logger: this._logger, getIndexForType: this.getIndexForType.bind(this), objects, spacesToAdd, diff --git a/src/core/server/saved_objects/service/lib/update_objects_spaces.test.mock.ts b/src/core/server/saved_objects/service/lib/update_objects_spaces.test.mock.ts index d7aa762e01aab7..043975d5bb52b1 100644 --- a/src/core/server/saved_objects/service/lib/update_objects_spaces.test.mock.ts +++ b/src/core/server/saved_objects/service/lib/update_objects_spaces.test.mock.ts @@ -7,6 +7,7 @@ */ import type * as InternalUtils from './internal_utils'; +import type { deleteLegacyUrlAliases } from './legacy_url_aliases'; export const mockGetBulkOperationError = jest.fn() as jest.MockedFunction< typeof InternalUtils['getBulkOperationError'] @@ -27,3 +28,10 @@ jest.mock('./internal_utils', () => { rawDocExistsInNamespace: mockRawDocExistsInNamespace, }; }); + +export const mockDeleteLegacyUrlAliases = jest.fn() as jest.MockedFunction< + typeof deleteLegacyUrlAliases +>; +jest.mock('./legacy_url_aliases', () => ({ + deleteLegacyUrlAliases: mockDeleteLegacyUrlAliases, +})); diff --git a/src/core/server/saved_objects/service/lib/update_objects_spaces.test.ts b/src/core/server/saved_objects/service/lib/update_objects_spaces.test.ts index 11dbe6149878c1..d5b79b70a55a12 100644 --- a/src/core/server/saved_objects/service/lib/update_objects_spaces.test.ts +++ b/src/core/server/saved_objects/service/lib/update_objects_spaces.test.ts @@ -10,12 +10,14 @@ import { mockGetBulkOperationError, mockGetExpectedVersionProperties, mockRawDocExistsInNamespace, + mockDeleteLegacyUrlAliases, } from './update_objects_spaces.test.mock'; import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; import type { ElasticsearchClient } from 'src/core/server/elasticsearch'; import { elasticsearchClientMock } from 'src/core/server/elasticsearch/client/mocks'; +import { loggerMock } from '../../../logging/logger.mock'; import { typeRegistryMock } from '../../saved_objects_type_registry.mock'; import { SavedObjectsSerializer } from '../../serialization'; import type { @@ -23,6 +25,7 @@ import type { UpdateObjectsSpacesParams, } from './update_objects_spaces'; import { updateObjectsSpaces } from './update_objects_spaces'; +import { ALL_NAMESPACES_STRING } from './utils'; type SetupParams = Partial< Pick @@ -53,6 +56,8 @@ beforeEach(() => { mockGetExpectedVersionProperties.mockReturnValue(EXPECTED_VERSION_PROPS); mockRawDocExistsInNamespace.mockReset(); mockRawDocExistsInNamespace.mockReturnValue(true); // return true by default + mockDeleteLegacyUrlAliases.mockReset(); + mockDeleteLegacyUrlAliases.mockResolvedValue(); // resolve an empty promise by default }); afterAll(() => { @@ -71,10 +76,12 @@ describe('#updateObjectsSpaces', () => { client = elasticsearchClientMock.createElasticsearchClient(); const serializer = new SavedObjectsSerializer(registry); return { + mappings: { properties: {} }, // doesn't matter, only used as an argument to deleteLegacyUrlAliases which is mocked registry, allowedTypes: [SHAREABLE_OBJ_TYPE, NON_SHAREABLE_OBJ_TYPE], // SHAREABLE_HIDDEN_OBJ_TYPE is excluded client, serializer, + logger: loggerMock.create(), getIndexForType: (type: string) => `index-for-${type}`, objects, spacesToAdd, @@ -382,6 +389,149 @@ describe('#updateObjectsSpaces', () => { expect(client.bulk).not.toHaveBeenCalled(); }); }); + + describe('legacy URL aliases', () => { + it('does not delete aliases for objects that were not removed from any spaces', async () => { + const space1 = 'space-to-add'; + const space2 = 'space-to-remove'; + const space3 = 'other-space'; + const obj1 = { type: SHAREABLE_OBJ_TYPE, id: 'id-1', spaces: [space1] }; // will not be changed + const obj2 = { type: SHAREABLE_OBJ_TYPE, id: 'id-2', spaces: [space3] }; // will be updated + + const objects = [obj1, obj2]; + const spacesToAdd = [space1]; + const spacesToRemove = [space2]; + const params = setup({ objects, spacesToAdd, spacesToRemove }); + // this test case does not call mget + mockBulkResults({ error: false }); // result for obj2 + + await updateObjectsSpaces(params); + expect(client.bulk).toHaveBeenCalledTimes(1); + expectBulkArgs({ action: 'update', object: { ...obj2, namespaces: [space3, space1] } }); + expect(mockDeleteLegacyUrlAliases).not.toHaveBeenCalled(); + expect(params.logger.error).not.toHaveBeenCalled(); + }); + + it('does not delete aliases for objects that were removed from spaces but were also added to All Spaces (*)', async () => { + const space2 = 'space-to-remove'; + const obj1 = { type: SHAREABLE_OBJ_TYPE, id: 'id-1', spaces: [space2] }; + + const objects = [obj1]; + const spacesToAdd = [ALL_NAMESPACES_STRING]; + const spacesToRemove = [space2]; + const params = setup({ objects, spacesToAdd, spacesToRemove }); + // this test case does not call mget + mockBulkResults({ error: false }); // result for obj1 + + await updateObjectsSpaces(params); + expect(client.bulk).toHaveBeenCalledTimes(1); + expectBulkArgs({ + action: 'update', + object: { ...obj1, namespaces: [ALL_NAMESPACES_STRING] }, + }); + expect(mockDeleteLegacyUrlAliases).not.toHaveBeenCalled(); + expect(params.logger.error).not.toHaveBeenCalled(); + }); + + it('deletes aliases for objects that were removed from specific spaces using "deleteBehavior: exclusive"', async () => { + const space1 = 'space-to-remove'; + const space2 = 'another-space-to-remove'; + const space3 = 'other-space'; + const obj1 = { type: SHAREABLE_OBJ_TYPE, id: 'id-1', spaces: [space3] }; // will not be changed + const obj2 = { type: SHAREABLE_OBJ_TYPE, id: 'id-1', spaces: [space1, space2, space3] }; // will be updated + const obj3 = { type: SHAREABLE_OBJ_TYPE, id: 'id-1', spaces: [space1] }; // will be deleted + + const objects = [obj1, obj2, obj3]; + const spacesToRemove = [space1, space2]; + const params = setup({ objects, spacesToRemove }); + // this test case does not call mget + mockBulkResults({ error: false }, { error: false }); // result2 for obj2 and obj3 + + await updateObjectsSpaces(params); + expect(client.bulk).toHaveBeenCalledTimes(1); + expectBulkArgs( + { action: 'update', object: { ...obj2, namespaces: [space3] } }, + { action: 'delete', object: obj3 } + ); + expect(mockDeleteLegacyUrlAliases).toHaveBeenCalledTimes(2); + expect(mockDeleteLegacyUrlAliases).toHaveBeenNthCalledWith( + 1, // the first call resulted in an error which generated a log message (see assertion below) + expect.objectContaining({ + type: obj2.type, + id: obj2.id, + namespaces: [space1, space2], + deleteBehavior: 'inclusive', + }) + ); + expect(mockDeleteLegacyUrlAliases).toHaveBeenNthCalledWith( + 2, + expect.objectContaining({ + type: obj3.type, + id: obj3.id, + namespaces: [space1], + deleteBehavior: 'inclusive', + }) + ); + expect(params.logger.error).not.toHaveBeenCalled(); + }); + + it('deletes aliases for objects that were removed from all spaces using "deleteBehavior: inclusive"', async () => { + const space1 = 'space-to-add'; + const space2 = 'other-space'; + const obj1 = { type: SHAREABLE_OBJ_TYPE, id: 'id-1', spaces: [space2] }; // will be updated to add space1 + const obj2 = { + type: SHAREABLE_OBJ_TYPE, + id: 'id-2', + spaces: [space2, ALL_NAMESPACES_STRING], // will be updated to add space1 and remove * + }; + + const objects = [obj1, obj2]; + const spacesToAdd = [space1]; + const spacesToRemove = [ALL_NAMESPACES_STRING]; + const params = setup({ objects, spacesToAdd, spacesToRemove }); + // this test case does not call mget + mockBulkResults({ error: false }); // result for obj1 + + await updateObjectsSpaces(params); + expect(client.bulk).toHaveBeenCalledTimes(1); + expectBulkArgs( + { action: 'update', object: { ...obj1, namespaces: [space2, space1] } }, + { action: 'update', object: { ...obj2, namespaces: [space2, space1] } } + ); + expect(mockDeleteLegacyUrlAliases).toHaveBeenCalledTimes(1); + expect(mockDeleteLegacyUrlAliases).toHaveBeenCalledWith( + expect.objectContaining({ + type: obj2.type, + id: obj2.id, + namespaces: [space2, space1], + deleteBehavior: 'exclusive', + }) + ); + expect(params.logger.error).not.toHaveBeenCalled(); + }); + + it('logs a message when deleteLegacyUrlAliases returns an error', async () => { + const space1 = 'space-to-remove'; + const space2 = 'other-space'; + const obj1 = { type: SHAREABLE_OBJ_TYPE, id: 'id-1', spaces: [space1, space2] }; // will be updated + + const objects = [obj1]; + const spacesToRemove = [space1]; + const params = setup({ objects, spacesToRemove }); + // this test case does not call mget + mockBulkResults({ error: false }); // result for obj1 + mockDeleteLegacyUrlAliases.mockRejectedValueOnce(new Error('Oh no!')); // result for deleting aliases for obj1 + + await updateObjectsSpaces(params); + expect(client.bulk).toHaveBeenCalledTimes(1); + expectBulkArgs({ action: 'update', object: { ...obj1, namespaces: [space2] } }); + expect(mockDeleteLegacyUrlAliases).toHaveBeenCalledTimes(1); // don't assert deleteLegacyUrlAliases args, we have tests for that above + expect(params.logger.error).toHaveBeenCalledTimes(1); + expect(params.logger.error).toHaveBeenCalledWith( + 'Unable to delete aliases when unsharing an object: Oh no!' + ); + }); + }); }); describe('returns expected results', () => { diff --git a/src/core/server/saved_objects/service/lib/update_objects_spaces.ts b/src/core/server/saved_objects/service/lib/update_objects_spaces.ts index d88bf700a900e6..90e914b9796c33 100644 --- a/src/core/server/saved_objects/service/lib/update_objects_spaces.ts +++ b/src/core/server/saved_objects/service/lib/update_objects_spaces.ts @@ -6,9 +6,12 @@ * Side Public License, v 1. */ +import pMap from 'p-map'; import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import intersection from 'lodash/intersection'; +import type { Logger } from '../../../logging'; +import type { IndexMapping } from '../../mappings'; import type { ISavedObjectTypeRegistry } from '../../saved_objects_type_registry'; import type { SavedObjectsRawDocSource, SavedObjectsSerializer } from '../../serialization'; import type { @@ -28,6 +31,9 @@ import { } from './internal_utils'; import { DEFAULT_REFRESH_SETTING } from './repository'; import type { RepositoryEsClient } from './repository_es_client'; +import { ALL_NAMESPACES_STRING } from './utils'; +import type { DeleteLegacyUrlAliasesParams } from './legacy_url_aliases'; +import { deleteLegacyUrlAliases } from './legacy_url_aliases'; /** * An object that should have its spaces updated. @@ -94,10 +100,12 @@ export interface SavedObjectsUpdateObjectsSpacesResponseObject { * @internal */ export interface UpdateObjectsSpacesParams { + mappings: IndexMapping; registry: ISavedObjectTypeRegistry; allowedTypes: string[]; client: RepositoryEsClient; serializer: SavedObjectsSerializer; + logger: Logger; getIndexForType: (type: string) => string; objects: SavedObjectsUpdateObjectsSpacesObject[]; spacesToAdd: string[]; @@ -105,15 +113,24 @@ export interface UpdateObjectsSpacesParams { options?: SavedObjectsUpdateObjectsSpacesOptions; } +type ObjectToDeleteAliasesFor = Pick< + DeleteLegacyUrlAliasesParams, + 'type' | 'id' | 'namespaces' | 'deleteBehavior' +>; + +const MAX_CONCURRENT_ALIAS_DELETIONS = 10; + /** * Gets all references and transitive references of the given objects. Ignores any object and/or reference that is not a multi-namespace * type. */ export async function updateObjectsSpaces({ + mappings, registry, allowedTypes, client, serializer, + logger, getIndexForType, objects, spacesToAdd, @@ -190,8 +207,12 @@ export async function updateObjectsSpaces({ const time = new Date().toISOString(); let bulkOperationRequestIndexCounter = 0; const bulkOperationParams: estypes.BulkOperationContainer[] = []; + const objectsToDeleteAliasesFor: ObjectToDeleteAliasesFor[] = []; const expectedBulkOperationResults: Array< - Either> + Either< + SavedObjectsUpdateObjectsSpacesResponseObject, + { type: string; id: string; updatedSpaces: string[]; esRequestIndex?: number } + > > = expectedBulkGetResults.map((expectedBulkGetResult) => { if (isLeft(expectedBulkGetResult)) { return expectedBulkGetResult; @@ -225,7 +246,7 @@ export async function updateObjectsSpaces({ versionProperties = getExpectedVersionProperties(version); } - const { newSpaces, isUpdateRequired } = getNewSpacesArray( + const { updatedSpaces, removedSpaces, isUpdateRequired } = analyzeSpaceChanges( currentSpaces, spacesToAdd, spacesToRemove @@ -233,7 +254,7 @@ export async function updateObjectsSpaces({ const expectedResult = { type, id, - newSpaces, + updatedSpaces, ...(isUpdateRequired && { esRequestIndex: bulkOperationRequestIndexCounter++ }), }; @@ -243,13 +264,24 @@ export async function updateObjectsSpaces({ _index: getIndexForType(type), ...versionProperties, }; - if (newSpaces.length) { - const documentToSave = { updated_at: time, namespaces: newSpaces }; + if (updatedSpaces.length) { + const documentToSave = { updated_at: time, namespaces: updatedSpaces }; // @ts-expect-error BulkOperation.retry_on_conflict, BulkOperation.routing. BulkOperation.version, and BulkOperation.version_type are optional bulkOperationParams.push({ update: documentMetadata }, { doc: documentToSave }); } else { bulkOperationParams.push({ delete: documentMetadata }); } + + if (removedSpaces.length && !updatedSpaces.includes(ALL_NAMESPACES_STRING)) { + // The object is being removed from at least one space; make sure to delete aliases appropriately + objectsToDeleteAliasesFor.push({ + type, + id, + ...(removedSpaces.includes(ALL_NAMESPACES_STRING) + ? { namespaces: updatedSpaces, deleteBehavior: 'exclusive' } + : { namespaces: removedSpaces, deleteBehavior: 'inclusive' }), + }); + } } return { tag: 'Right', value: expectedResult }; @@ -260,6 +292,24 @@ export async function updateObjectsSpaces({ ? await client.bulk({ refresh, body: bulkOperationParams, require_alias: true }) : undefined; + // Delete aliases if necessary, ensuring we don't have too many concurrent operations running. + const mapper = async ({ type, id, namespaces, deleteBehavior }: ObjectToDeleteAliasesFor) => + deleteLegacyUrlAliases({ + mappings, + registry, + client, + getIndexForType, + type, + id, + namespaces, + deleteBehavior, + }).catch((err) => { + // The object has already been unshared, but we caught an error when attempting to delete aliases. + // A consumer cannot attempt to unshare the object again, so just log the error and swallow it. + logger.error(`Unable to delete aliases when unsharing an object: ${err.message}`); + }); + await pMap(objectsToDeleteAliasesFor, mapper, { concurrency: MAX_CONCURRENT_ALIAS_DELETIONS }); + return { objects: expectedBulkOperationResults.map( (expectedResult) => { @@ -267,7 +317,7 @@ export async function updateObjectsSpaces({ return expectedResult.value; } - const { type, id, newSpaces, esRequestIndex } = expectedResult.value; + const { type, id, updatedSpaces, esRequestIndex } = expectedResult.value; if (esRequestIndex !== undefined) { const response = bulkOperationResponse?.body.items[esRequestIndex] ?? {}; const rawResponse = Object.values(response)[0] as any; @@ -277,7 +327,7 @@ export async function updateObjectsSpaces({ } } - return { id, type, spaces: newSpaces }; + return { id, type, spaces: updatedSpaces }; } ), }; @@ -289,17 +339,22 @@ function errorContent(error: DecoratedError) { } /** Gets the remaining spaces for an object after adding new ones and removing old ones. */ -function getNewSpacesArray( +function analyzeSpaceChanges( existingSpaces: string[], spacesToAdd: string[], spacesToRemove: string[] ) { const addSet = new Set(spacesToAdd); const removeSet = new Set(spacesToRemove); - const newSpaces = existingSpaces + const removedSpaces: string[] = []; + const updatedSpaces = existingSpaces .filter((x) => { addSet.delete(x); - return !removeSet.delete(x); + const removed = removeSet.delete(x); + if (removed) { + removedSpaces.push(x); + } + return !removed; }) .concat(Array.from(addSet)); @@ -307,5 +362,5 @@ function getNewSpacesArray( const isAnySpaceRemoved = removeSet.size < spacesToRemove.length; const isUpdateRequired = isAnySpaceAdded || isAnySpaceRemoved; - return { newSpaces, isUpdateRequired }; + return { updatedSpaces, removedSpaces, isUpdateRequired }; } diff --git a/src/core/server/ui_settings/integration_tests/index.test.ts b/src/core/server/ui_settings/integration_tests/index.test.ts index 44d98afdf54f51..ef635e90dac704 100644 --- a/src/core/server/ui_settings/integration_tests/index.test.ts +++ b/src/core/server/ui_settings/integration_tests/index.test.ts @@ -20,9 +20,9 @@ describe('uiSettings/routes', function () { jest.setTimeout(120_000); beforeAll(startServers); - /* eslint-disable jest/valid-describe */ + // eslint-disable-next-line jest/valid-describe describe('doc missing', docMissingSuite(savedObjectIndex)); + // eslint-disable-next-line jest/valid-describe describe('doc exists', docExistsSuite(savedObjectIndex)); - /* eslint-enable jest/valid-describe */ afterAll(stopServers); }); diff --git a/src/dev/bazel/index.bzl b/src/dev/bazel/index.bzl index e38d3d78c0071b..313cc9f06236c2 100644 --- a/src/dev/bazel/index.bzl +++ b/src/dev/bazel/index.bzl @@ -11,5 +11,7 @@ Please do not import from any other files when looking to use a custom rule """ load("//src/dev/bazel:jsts_transpiler.bzl", _jsts_transpiler = "jsts_transpiler") +load("//src/dev/bazel:ts_project.bzl", _ts_project = "ts_project") jsts_transpiler = _jsts_transpiler +ts_project = _ts_project diff --git a/src/dev/bazel/ts_project.bzl b/src/dev/bazel/ts_project.bzl new file mode 100644 index 00000000000000..afd28fa513164a --- /dev/null +++ b/src/dev/bazel/ts_project.bzl @@ -0,0 +1,16 @@ +"Simple wrapper over the general ts_project rule from rules_nodejs so we can override some configs" + +load("@npm//@bazel/typescript:index.bzl", _ts_project = "ts_project") + +def ts_project(validate = False, **kwargs): + """A macro around the upstream ts_project rule. + + Args: + validate: boolean; whether to check that the tsconfig JSON settings match the attributes on this target. Defaults to false + **kwargs: the rest + """ + + _ts_project( + validate = validate, + **kwargs + ) diff --git a/src/dev/eslint/index.ts b/src/dev/eslint/index.ts index 765c7dfce9ed0c..5aeb83c45ad057 100644 --- a/src/dev/eslint/index.ts +++ b/src/dev/eslint/index.ts @@ -8,3 +8,4 @@ export { pickFilesToLint } from './pick_files_to_lint'; export { lintFiles } from './lint_files'; +export { runEslintWithTypes } from './run_eslint_with_types'; diff --git a/src/dev/eslint/run_eslint_with_types.ts b/src/dev/eslint/run_eslint_with_types.ts new file mode 100644 index 00000000000000..750011dea10316 --- /dev/null +++ b/src/dev/eslint/run_eslint_with_types.ts @@ -0,0 +1,171 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import Path from 'path'; +import Fs from 'fs'; +import Os from 'os'; + +import execa from 'execa'; +import * as Rx from 'rxjs'; +import { mergeMap, reduce } from 'rxjs/operators'; +import { supportsColor } from 'chalk'; +import { REPO_ROOT, run, createFailError } from '@kbn/dev-utils'; +import { lastValueFrom } from '@kbn/std'; + +import { PROJECTS } from '../typescript/projects'; +import { Project } from '../typescript/project'; + +export function runEslintWithTypes() { + run( + async ({ log, flags }) => { + const eslintPath = require.resolve('eslint/bin/eslint'); + const ignoreFilePath = Path.resolve(REPO_ROOT, '.eslintignore'); + const configTemplate = Fs.readFileSync( + Path.resolve(__dirname, 'types.eslint.config.template.js'), + 'utf8' + ); + + const projectFilter = + flags.project && typeof flags.project === 'string' + ? Path.resolve(flags.project) + : undefined; + + const projects = PROJECTS.filter((project) => { + if (project.disableTypeCheck) { + log.verbose(`[${project.name}] skipping project with type checking disabled`); + return false; + } + + if (projectFilter && project.tsConfigPath !== projectFilter) { + log.verbose(`[${project.name}] skipping because it doesn't match --project`); + return false; + } + + return true; + }); + + if (!projects.length) { + if (projectFilter) { + throw createFailError(`[${projectFilter}] is not a valid tsconfig project`); + } + + throw createFailError('unable to find projects to lint'); + } + + const concurrency = Math.max(1, Math.round((Os.cpus() || []).length / 2) || 1) || 1; + log.info(`Linting ${projects.length} projects, ${concurrency} at a time`); + + const failures = await lastValueFrom( + Rx.from(projects).pipe( + mergeMap(async (project) => { + const configFilePath = Path.resolve(project.directory, 'types.eslint.config.js'); + + Fs.writeFileSync( + configFilePath, + configTemplate.replace( + `'{PACKAGE_CONFIG}'`, + JSON.stringify(JSON.stringify({ rootDir: project.directory })) + ), + 'utf8' + ); + + const proc = await execa( + process.execPath, + [ + Path.relative(project.directory, eslintPath), + ...project.getIncludePatterns().map((p) => (p.endsWith('*') ? `${p}.{ts,tsx}` : p)), + ...project.getExcludePatterns().flatMap((p) => ['--ignore-pattern', p]), + ...['--ignore-pattern', '**/*.json'], + ...['--ext', '.ts,.tsx'], + '--no-error-on-unmatched-pattern', + '--no-inline-config', + '--no-eslintrc', + ...['--config', Path.relative(project.directory, configFilePath)], + ...['--ignore-path', Path.relative(project.directory, ignoreFilePath)], + ...(flags.verbose ? ['--debug'] : []), + ...(flags.fix ? ['--fix'] : []), + ], + { + cwd: project.directory, + env: { + ...(supportsColor ? { FORCE_COLOR: 'true' } : {}), + ...process.env, + }, + buffer: true, + all: true, + reject: false, + } + ); + + if (proc.exitCode === 0) { + Fs.unlinkSync(configFilePath); + log.success(project.name); + return undefined; + } else { + log.error(`${project.name} failed`); + log.indent(4); + log.write(proc.all); + log.indent(-4); + return project; + } + }, concurrency), + reduce((acc: Project[], project) => { + if (project) { + return [...acc, project]; + } else { + return acc; + } + }, []) + ) + ); + + if (!failures.length) { + log.success(`All projects validated successfully!`); + if (flags.fix) { + log.info(` +❗️ After staging your changes, don't forget to run eslint/prettier on them with: + + node scripts/precommit_hook --fix +`); + } + + return; + } + + throw createFailError( + ` + ${ + failures.length + } projects failed, run the following commands locally to try auto-fixing them: + + ${failures + .map( + (p) => + `node scripts/eslint_with_types --fix --project ${Path.relative( + REPO_ROOT, + p.tsConfigPath + )}` + ) + .join('\n ')} + ` + ); + }, + { + description: + 'Run ESLint in each TS project, feeding it the TS config so it can validate our code using the type information', + flags: { + string: ['project'], + boolean: ['fix'], + help: ` + --project Only run eslint on a specific ts project + --fix Run eslint in --fix mode + `, + }, + } + ); +} diff --git a/src/dev/eslint/types.eslint.config.template.js b/src/dev/eslint/types.eslint.config.template.js new file mode 100644 index 00000000000000..08cbaf3b023250 --- /dev/null +++ b/src/dev/eslint/types.eslint.config.template.js @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * THIS FILE IS WRITTEN AUTOMATICALLY by `node scripts/eslint_with_types` and + * should be deleted automatically unless something goes wrong + */ + +const config = JSON.parse('{PACKAGE_CONFIG}'); + +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: config.rootDir, + project: ['./tsconfig.json'], + }, + plugins: ['@typescript-eslint'], + rules: { + '@typescript-eslint/consistent-type-exports': 'error', + }, +}; diff --git a/src/dev/i18n/index.ts b/src/dev/i18n/index.ts index 111dc6b688e9f7..54ea36a9f82c4a 100644 --- a/src/dev/i18n/index.ts +++ b/src/dev/i18n/index.ts @@ -12,10 +12,6 @@ export { extractMessagesFromPathToMap } from './extract_default_translations'; export { matchEntriesWithExctractors } from './extract_default_translations'; export { arrayify, writeFileAsync, readFileAsync, normalizePath, ErrorReporter } from './utils'; export { serializeToJson, serializeToJson5 } from './serializers'; -export { - I18nConfig, - filterConfigPaths, - assignConfigFromPath, - checkConfigNamespacePrefix, -} from './config'; +export type { I18nConfig } from './config'; +export { filterConfigPaths, assignConfigFromPath, checkConfigNamespacePrefix } from './config'; export { integrateLocaleFiles } from './integrate_locale_files'; diff --git a/src/dev/typescript/project.ts b/src/dev/typescript/project.ts index a0c196dd8e9192..baeaf39ec288de 100644 --- a/src/dev/typescript/project.ts +++ b/src/dev/typescript/project.ts @@ -66,8 +66,10 @@ export class Project { const disableTypeCheck = projectOptions?.disableTypeCheck || false; const name = projectOptions?.name || Path.relative(REPO_ROOT, directory) || Path.basename(directory); - const include = config.include ? makeMatchers(directory, config.include) : undefined; - const exclude = config.exclude ? makeMatchers(directory, config.exclude) : undefined; + const includePatterns = config.include; + const include = includePatterns ? makeMatchers(directory, includePatterns) : undefined; + const excludePatterns = config.exclude; + const exclude = excludePatterns ? makeMatchers(directory, excludePatterns) : undefined; let baseProject; if (config.extends) { @@ -99,7 +101,9 @@ export class Project { disableTypeCheck, baseProject, include, - exclude + includePatterns, + exclude, + excludePatterns ); cache.set(tsConfigPath, project); return project; @@ -114,9 +118,22 @@ export class Project { public readonly baseProject?: Project, private readonly include?: IMinimatch[], - private readonly exclude?: IMinimatch[] + private readonly includePatterns?: string[], + private readonly exclude?: IMinimatch[], + private readonly excludePatterns?: string[] ) {} + public getIncludePatterns(): string[] { + return this.includePatterns + ? this.includePatterns + : this.baseProject?.getIncludePatterns() ?? []; + } + public getExcludePatterns(): string[] { + return this.excludePatterns + ? this.excludePatterns + : this.baseProject?.getExcludePatterns() ?? []; + } + private getInclude(): IMinimatch[] { return this.include ? this.include : this.baseProject?.getInclude() ?? []; } diff --git a/src/plugins/advanced_settings/public/index.ts b/src/plugins/advanced_settings/public/index.ts index be57576d176c63..83676b4f7c38d3 100644 --- a/src/plugins/advanced_settings/public/index.ts +++ b/src/plugins/advanced_settings/public/index.ts @@ -9,7 +9,7 @@ import React from 'react'; import { PluginInitializerContext } from 'kibana/public'; import { AdvancedSettingsPlugin } from './plugin'; -export { AdvancedSettingsSetup, AdvancedSettingsStart } from './types'; +export type { AdvancedSettingsSetup, AdvancedSettingsStart } from './types'; export { ComponentRegistry } from './component_registry'; /** diff --git a/src/plugins/bfetch/public/batching/index.ts b/src/plugins/bfetch/public/batching/index.ts index 115fd84cbe979f..e3a8d0169af273 100644 --- a/src/plugins/bfetch/public/batching/index.ts +++ b/src/plugins/bfetch/public/batching/index.ts @@ -6,7 +6,5 @@ * Side Public License, v 1. */ -export { - createStreamingBatchedFunction, - StreamingBatchedFunctionParams, -} from './create_streaming_batched_function'; +export type { StreamingBatchedFunctionParams } from './create_streaming_batched_function'; +export { createStreamingBatchedFunction } from './create_streaming_batched_function'; diff --git a/src/plugins/bfetch/public/index.ts b/src/plugins/bfetch/public/index.ts index 59ee2d63ac57ec..6ab5480327538b 100644 --- a/src/plugins/bfetch/public/index.ts +++ b/src/plugins/bfetch/public/index.ts @@ -9,10 +9,10 @@ import { PluginInitializerContext } from '../../../core/public'; import { BfetchPublicPlugin } from './plugin'; -export { BfetchPublicSetup, BfetchPublicStart, BfetchPublicContract } from './plugin'; +export type { BfetchPublicSetup, BfetchPublicStart, BfetchPublicContract } from './plugin'; export { split } from './streaming'; -export { BatchedFunc } from './batching/types'; +export type { BatchedFunc } from './batching/types'; export function plugin(initializerContext: PluginInitializerContext) { return new BfetchPublicPlugin(initializerContext); diff --git a/src/plugins/bfetch/server/index.ts b/src/plugins/bfetch/server/index.ts index f4c41d10e42cb1..76f86e69750706 100644 --- a/src/plugins/bfetch/server/index.ts +++ b/src/plugins/bfetch/server/index.ts @@ -9,7 +9,7 @@ import { PluginInitializerContext } from '../../../core/server'; import { BfetchServerPlugin } from './plugin'; -export { BfetchServerSetup, BfetchServerStart, BatchProcessingRouteParams } from './plugin'; +export type { BfetchServerSetup, BfetchServerStart, BatchProcessingRouteParams } from './plugin'; export function plugin(initializerContext: PluginInitializerContext) { return new BfetchServerPlugin(initializerContext); diff --git a/src/plugins/charts/common/index.ts b/src/plugins/charts/common/index.ts index d06dbc73e29b1e..825fd74e24041d 100644 --- a/src/plugins/charts/common/index.ts +++ b/src/plugins/charts/common/index.ts @@ -9,23 +9,19 @@ export const COLOR_MAPPING_SETTING = 'visualization:colorMapping'; export const LEGACY_TIME_AXIS = 'visualization:useLegacyTimeAxis'; -export { +export type { CustomPaletteArguments, CustomPaletteState, SystemPaletteArguments, PaletteOutput, - defaultCustomColors, - palette, - systemPalette, } from './palette'; +export { defaultCustomColors, palette, systemPalette } from './palette'; export { paletteIds } from './constants'; +export type { ColorSchema, RawColorSchema, ColorMap } from './static'; export { ColorSchemas, - ColorSchema, - RawColorSchema, - ColorMap, vislibColorMaps, colorSchemas, getHeatmapColors, @@ -34,6 +30,7 @@ export { ColorMode, LabelRotation, defaultCountLabel, + MULTILAYER_TIME_AXIS_STYLE, } from './static'; -export { ColorSchemaParams, Labels, Style } from './types'; +export type { ColorSchemaParams, Labels, Style } from './types'; diff --git a/src/plugins/charts/common/static/color_maps/index.ts b/src/plugins/charts/common/static/color_maps/index.ts index c624c5ceb66858..115758988f04bb 100644 --- a/src/plugins/charts/common/static/color_maps/index.ts +++ b/src/plugins/charts/common/static/color_maps/index.ts @@ -6,13 +6,7 @@ * Side Public License, v 1. */ -export { - ColorSchemas, - ColorSchema, - RawColorSchema, - ColorMap, - vislibColorMaps, - colorSchemas, -} from './color_maps'; +export type { ColorSchema, RawColorSchema, ColorMap } from './color_maps'; +export { ColorSchemas, vislibColorMaps, colorSchemas } from './color_maps'; export { getHeatmapColors } from './heatmap_color'; export { truncatedColorMaps, truncatedColorSchemas } from './truncated_color_maps'; diff --git a/src/plugins/charts/common/static/index.ts b/src/plugins/charts/common/static/index.ts index 9cde3bafe59e43..4a6b3ec2b52bb3 100644 --- a/src/plugins/charts/common/static/index.ts +++ b/src/plugins/charts/common/static/index.ts @@ -6,11 +6,9 @@ * Side Public License, v 1. */ +export type { ColorSchema, RawColorSchema, ColorMap } from './color_maps'; export { ColorSchemas, - ColorSchema, - RawColorSchema, - ColorMap, vislibColorMaps, colorSchemas, getHeatmapColors, @@ -19,3 +17,5 @@ export { } from './color_maps'; export { ColorMode, LabelRotation, defaultCountLabel } from './components'; + +export * from './styles'; diff --git a/src/plugins/charts/common/static/styles/index.ts b/src/plugins/charts/common/static/styles/index.ts new file mode 100644 index 00000000000000..688103322c53f4 --- /dev/null +++ b/src/plugins/charts/common/static/styles/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './multilayer_timeaxis'; diff --git a/src/plugins/charts/common/static/styles/multilayer_timeaxis.ts b/src/plugins/charts/common/static/styles/multilayer_timeaxis.ts new file mode 100644 index 00000000000000..02a5533f53fca5 --- /dev/null +++ b/src/plugins/charts/common/static/styles/multilayer_timeaxis.ts @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { Position, RecursivePartial, AxisStyle } from '@elastic/charts'; + +export const MULTILAYER_TIME_AXIS_STYLE: RecursivePartial = { + tickLabel: { + visible: true, + padding: 0, + rotation: 0, + alignment: { + vertical: Position.Bottom, + horizontal: Position.Left, + }, + }, + tickLine: { + visible: true, + size: 0.0001, + padding: 4, + }, +}; diff --git a/src/plugins/charts/public/index.ts b/src/plugins/charts/public/index.ts index e3d38b797c576a..51d2722e3a24fa 100644 --- a/src/plugins/charts/public/index.ts +++ b/src/plugins/charts/public/index.ts @@ -13,23 +13,28 @@ import { ChartsPlugin } from './plugin'; export const plugin = () => new ChartsPlugin(); -export { ChartsPluginSetup, ChartsPluginStart } from './plugin'; +export type { ChartsPluginSetup, ChartsPluginStart } from './plugin'; export * from './static'; export * from './services/palettes/types'; export { lightenColor } from './services/palettes/lighten_color'; export { useActiveCursor } from './services/active_cursor'; -export { +export type { PaletteOutput, CustomPaletteArguments, CustomPaletteState, SystemPaletteArguments, - paletteIds, - ColorSchemas, ColorSchema, RawColorSchema, ColorMap, + ColorSchemaParams, + Labels, + Style, +} from '../common'; +export { + paletteIds, + ColorSchemas, vislibColorMaps, colorSchemas, getHeatmapColors, @@ -38,7 +43,4 @@ export { ColorMode, LabelRotation, defaultCountLabel, - ColorSchemaParams, - Labels, - Style, } from '../common'; diff --git a/src/plugins/charts/public/services/theme/theme.ts b/src/plugins/charts/public/services/theme/theme.ts index dfea367327e7af..1aad4f0ab6328f 100644 --- a/src/plugins/charts/public/services/theme/theme.ts +++ b/src/plugins/charts/public/services/theme/theme.ts @@ -39,10 +39,8 @@ export class ThemeService { /** A React hook for consuming the dark mode value */ public useDarkMode = (): boolean => { - // eslint-disable-next-line react-hooks/rules-of-hooks const [value, update] = useState(false); - // eslint-disable-next-line react-hooks/rules-of-hooks useEffect(() => { const s = this.darkModeEnabled$.subscribe(update); return () => s.unsubscribe(); @@ -53,12 +51,9 @@ export class ThemeService { /** A React hook for consuming the charts theme */ public useChartsTheme = (): PartialTheme => { - // eslint-disable-next-line react-hooks/rules-of-hooks const [value, update] = useState(this._chartsTheme$.getValue()); - // eslint-disable-next-line react-hooks/rules-of-hooks const ref = useRef(value); - // eslint-disable-next-line react-hooks/rules-of-hooks useEffect(() => { const s = this.chartsTheme$.subscribe((val) => { if (val !== ref.current) { @@ -74,12 +69,9 @@ export class ThemeService { /** A React hook for consuming the charts theme */ public useChartsBaseTheme = (): Theme => { - // eslint-disable-next-line react-hooks/rules-of-hooks const [value, update] = useState(this._chartsBaseTheme$.getValue()); - // eslint-disable-next-line react-hooks/rules-of-hooks const ref = useRef(value); - // eslint-disable-next-line react-hooks/rules-of-hooks useEffect(() => { const s = this.chartsBaseTheme$.subscribe((val) => { if (val !== ref.current) { diff --git a/src/plugins/charts/public/static/index.ts b/src/plugins/charts/public/static/index.ts index 6f5c87ce0df4d3..53078eebe9c56f 100644 --- a/src/plugins/charts/public/static/index.ts +++ b/src/plugins/charts/public/static/index.ts @@ -9,3 +9,4 @@ export * from './colors'; export * from './components'; export * from './utils'; +export * from '../../common/static/styles'; diff --git a/src/plugins/charts/server/index.ts b/src/plugins/charts/server/index.ts index e65318747224d2..73524964efb9bf 100644 --- a/src/plugins/charts/server/index.ts +++ b/src/plugins/charts/server/index.ts @@ -7,12 +7,12 @@ */ import { ChartsServerPlugin } from './plugin'; -export { +export type { PaletteOutput, CustomPaletteArguments, CustomPaletteState, SystemPaletteArguments, - paletteIds, } from '../common'; +export { paletteIds } from '../common'; export const plugin = () => new ChartsServerPlugin(); diff --git a/src/plugins/console/public/application/components/index.ts b/src/plugins/console/public/application/components/index.ts index 7bf3bc8a9c33b8..8f8292477cb943 100644 --- a/src/plugins/console/public/application/components/index.ts +++ b/src/plugins/console/public/application/components/index.ts @@ -8,9 +8,11 @@ export { NetworkRequestStatusBar } from './network_request_status_bar'; export { SomethingWentWrongCallout } from './something_went_wrong_callout'; -export { TopNavMenuItem, TopNavMenu } from './top_nav_menu'; +export type { TopNavMenuItem } from './top_nav_menu'; +export { TopNavMenu } from './top_nav_menu'; export { ConsoleMenu } from './console_menu'; export { WelcomePanel } from './welcome_panel'; -export { AutocompleteOptions, DevToolsSettingsModal } from './settings_modal'; +export type { AutocompleteOptions } from './settings_modal'; +export { DevToolsSettingsModal } from './settings_modal'; export { HelpPanel } from './help_panel'; export { EditorContentSpinner } from './editor_content_spinner'; diff --git a/src/plugins/console/public/application/contexts/index.ts b/src/plugins/console/public/application/contexts/index.ts index 693056ec23af6f..2239c4f3354c21 100644 --- a/src/plugins/console/public/application/contexts/index.ts +++ b/src/plugins/console/public/application/contexts/index.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -export { useServicesContext, ServicesContextProvider, ContextValue } from './services_context'; +export type { ContextValue } from './services_context'; +export { useServicesContext, ServicesContextProvider } from './services_context'; export { useRequestActionContext, diff --git a/src/plugins/console/public/application/lib/index.ts b/src/plugins/console/public/application/lib/index.ts index 3c67718d170ee6..8eba0159103628 100644 --- a/src/plugins/console/public/application/lib/index.ts +++ b/src/plugins/console/public/application/lib/index.ts @@ -6,5 +6,6 @@ * Side Public License, v 1. */ -export { createApi, Api } from './api'; +export type { Api } from './api'; +export { createApi } from './api'; export { createEsHostService, EsHostService } from './es_host_service'; diff --git a/src/plugins/console/public/services/index.ts b/src/plugins/console/public/services/index.ts index 2b1e64525d0f9f..c37c9d9359a165 100644 --- a/src/plugins/console/public/services/index.ts +++ b/src/plugins/console/public/services/index.ts @@ -8,4 +8,5 @@ export { createHistory, History } from './history'; export { createStorage, Storage, StorageKeys } from './storage'; -export { createSettings, Settings, DevToolsSettings, DEFAULT_SETTINGS } from './settings'; +export type { DevToolsSettings } from './settings'; +export { createSettings, Settings, DEFAULT_SETTINGS } from './settings'; diff --git a/src/plugins/console/public/types/index.ts b/src/plugins/console/public/types/index.ts index d8b6aaf7b12c45..2a86e53e55b800 100644 --- a/src/plugins/console/public/types/index.ts +++ b/src/plugins/console/public/types/index.ts @@ -11,5 +11,5 @@ export * from './core_editor'; export * from './token'; export * from './tokens_provider'; export * from './common'; -export { ClientConfigType } from './config'; -export { ConsoleUILocatorParams } from './locator'; +export type { ClientConfigType } from './config'; +export type { ConsoleUILocatorParams } from './locator'; diff --git a/src/plugins/console/server/index.ts b/src/plugins/console/server/index.ts index b270b89a3d45a6..598dfa23958c92 100644 --- a/src/plugins/console/server/index.ts +++ b/src/plugins/console/server/index.ts @@ -10,7 +10,7 @@ import { PluginInitializerContext } from 'kibana/server'; import { ConsoleServerPlugin } from './plugin'; -export { ConsoleSetup, ConsoleStart } from './types'; +export type { ConsoleSetup, ConsoleStart } from './types'; export { config } from './config'; diff --git a/src/plugins/custom_integrations/public/components/replacement_card/index.ts b/src/plugins/custom_integrations/public/components/replacement_card/index.ts index 631dc1fcb2ba2c..3c378d7603f951 100644 --- a/src/plugins/custom_integrations/public/components/replacement_card/index.ts +++ b/src/plugins/custom_integrations/public/components/replacement_card/index.ts @@ -8,7 +8,8 @@ import { ReplacementCard } from './replacement_card'; -export { ReplacementCard, Props } from './replacement_card'; +export type { Props } from './replacement_card'; +export { ReplacementCard } from './replacement_card'; // required for dynamic import using React.lazy() // eslint-disable-next-line import/no-default-export diff --git a/src/plugins/custom_integrations/public/index.ts b/src/plugins/custom_integrations/public/index.ts index 91da75c634a44a..27176c4c5acbe9 100755 --- a/src/plugins/custom_integrations/public/index.ts +++ b/src/plugins/custom_integrations/public/index.ts @@ -14,7 +14,7 @@ export function plugin() { return new CustomIntegrationsPlugin(); } -export { CustomIntegrationsSetup, CustomIntegrationsStart } from './types'; +export type { CustomIntegrationsSetup, CustomIntegrationsStart } from './types'; export { withSuspense, LazyReplacementCard } from './components'; export { filterCustomIntegrations } from './services/find'; diff --git a/src/plugins/custom_integrations/server/index.ts b/src/plugins/custom_integrations/server/index.ts index 00372df501435c..e2da055e745c24 100755 --- a/src/plugins/custom_integrations/server/index.ts +++ b/src/plugins/custom_integrations/server/index.ts @@ -17,7 +17,7 @@ export function plugin(initializerContext: PluginInitializerContext) { return new CustomIntegrationsPlugin(initializerContext); } -export { CustomIntegrationsPluginSetup, CustomIntegrationsPluginStart } from './types'; +export type { CustomIntegrationsPluginSetup, CustomIntegrationsPluginStart } from './types'; export type { IntegrationCategory, CustomIntegration } from '../common'; diff --git a/src/plugins/dashboard/common/index.ts b/src/plugins/dashboard/common/index.ts index 1ed5bfba3abb91..73e01693977d99 100644 --- a/src/plugins/dashboard/common/index.ts +++ b/src/plugins/dashboard/common/index.ts @@ -6,14 +6,14 @@ * Side Public License, v 1. */ -export { GridData } from './embeddable/types'; -export { +export type { GridData } from './embeddable/types'; +export type { RawSavedDashboardPanel730ToLatest, DashboardDoc730ToLatest, DashboardDoc700To720, DashboardDocPre700, } from './bwc/types'; -export { +export type { DashboardContainerStateWithType, SavedDashboardPanelTo60, SavedDashboardPanel610, diff --git a/src/plugins/dashboard/public/application/actions/index.ts b/src/plugins/dashboard/public/application/actions/index.ts index 827ae5bcb4419b..2c6263314cb25b 100644 --- a/src/plugins/dashboard/public/application/actions/index.ts +++ b/src/plugins/dashboard/public/application/actions/index.ts @@ -6,39 +6,22 @@ * Side Public License, v 1. */ +export type { ExpandPanelActionContext } from './expand_panel_action'; +export { ExpandPanelAction, ACTION_EXPAND_PANEL } from './expand_panel_action'; +export type { ReplacePanelActionContext } from './replace_panel_action'; +export { ReplacePanelAction, ACTION_REPLACE_PANEL } from './replace_panel_action'; +export type { ClonePanelActionContext } from './clone_panel_action'; +export { ClonePanelAction, ACTION_CLONE_PANEL } from './clone_panel_action'; +export type { AddToLibraryActionContext } from './add_to_library_action'; +export { AddToLibraryAction, ACTION_ADD_TO_LIBRARY } from './add_to_library_action'; +export type { UnlinkFromLibraryActionContext } from './unlink_from_library_action'; +export { UnlinkFromLibraryAction, ACTION_UNLINK_FROM_LIBRARY } from './unlink_from_library_action'; +export type { CopyToDashboardActionContext } from './copy_to_dashboard_action'; +export { CopyToDashboardAction, ACTION_COPY_TO_DASHBOARD } from './copy_to_dashboard_action'; +export type { LibraryNotificationActionContext } from './library_notification_action'; export { - ExpandPanelAction, - ExpandPanelActionContext, - ACTION_EXPAND_PANEL, -} from './expand_panel_action'; -export { - ReplacePanelAction, - ReplacePanelActionContext, - ACTION_REPLACE_PANEL, -} from './replace_panel_action'; -export { - ClonePanelAction, - ClonePanelActionContext, - ACTION_CLONE_PANEL, -} from './clone_panel_action'; -export { - AddToLibraryAction, - AddToLibraryActionContext, - ACTION_ADD_TO_LIBRARY, -} from './add_to_library_action'; -export { - UnlinkFromLibraryAction, - UnlinkFromLibraryActionContext, - ACTION_UNLINK_FROM_LIBRARY, -} from './unlink_from_library_action'; -export { - CopyToDashboardAction, - CopyToDashboardActionContext, - ACTION_COPY_TO_DASHBOARD, -} from './copy_to_dashboard_action'; -export { - LibraryNotificationActionContext, LibraryNotificationAction, ACTION_LIBRARY_NOTIFICATION, } from './library_notification_action'; -export { ExportContext, ExportCSVAction, ACTION_EXPORT_CSV } from './export_csv_action'; +export type { ExportContext } from './export_csv_action'; +export { ExportCSVAction, ACTION_EXPORT_CSV } from './export_csv_action'; diff --git a/src/plugins/dashboard/public/application/embeddable/index.ts b/src/plugins/dashboard/public/application/embeddable/index.ts index b3ee0f83ee8523..ce8bb5b7169ac0 100644 --- a/src/plugins/dashboard/public/application/embeddable/index.ts +++ b/src/plugins/dashboard/public/application/embeddable/index.ts @@ -6,10 +6,8 @@ * Side Public License, v 1. */ -export { - DashboardContainerFactoryDefinition, - DashboardContainerFactory, -} from './dashboard_container_factory'; +export type { DashboardContainerFactory } from './dashboard_container_factory'; +export { DashboardContainerFactoryDefinition } from './dashboard_container_factory'; export type { DashboardContainer } from './dashboard_container'; export { createPanelState } from './panel'; diff --git a/src/plugins/dashboard/public/index.ts b/src/plugins/dashboard/public/index.ts index ff7708689c2211..f25a92275d7236 100644 --- a/src/plugins/dashboard/public/index.ts +++ b/src/plugins/dashboard/public/index.ts @@ -16,22 +16,19 @@ export { } from './application'; export { DashboardConstants, createDashboardEditUrl } from './dashboard_constants'; -export { +export type { DashboardSetup, DashboardStart, DashboardUrlGenerator, DashboardFeatureFlagConfig, } from './plugin'; -export { - DASHBOARD_APP_URL_GENERATOR, - createDashboardUrlGenerator, - DashboardUrlGeneratorState, -} from './url_generator'; -export { DashboardAppLocator, DashboardAppLocatorParams } from './locator'; +export type { DashboardUrlGeneratorState } from './url_generator'; +export { DASHBOARD_APP_URL_GENERATOR, createDashboardUrlGenerator } from './url_generator'; +export type { DashboardAppLocator, DashboardAppLocatorParams } from './locator'; -export { DashboardSavedObject } from './saved_dashboards'; -export { SavedDashboardPanel, DashboardContainerInput } from './types'; +export type { DashboardSavedObject } from './saved_dashboards'; +export type { SavedDashboardPanel, DashboardContainerInput } from './types'; export function plugin(initializerContext: PluginInitializerContext) { return new DashboardPlugin(initializerContext); diff --git a/src/plugins/dashboard/public/services/core.ts b/src/plugins/dashboard/public/services/core.ts index e805c6cd706a99..38c91842de4f29 100644 --- a/src/plugins/dashboard/public/services/core.ts +++ b/src/plugins/dashboard/public/services/core.ts @@ -6,12 +6,12 @@ * Side Public License, v 1. */ -export { +export type { AppMountParameters, CoreSetup, Capabilities, PluginInitializerContext, - ScopedHistory, NotificationsStart, ApplicationStart, } from '../../../../core/public'; +export { ScopedHistory } from '../../../../core/public'; diff --git a/src/plugins/dashboard/public/services/home.ts b/src/plugins/dashboard/public/services/home.ts index 692a1218b9535d..ebbb715e53ca69 100644 --- a/src/plugins/dashboard/public/services/home.ts +++ b/src/plugins/dashboard/public/services/home.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { FeatureCatalogueCategory, HomePublicPluginSetup } from '../../../home/public'; +export type { HomePublicPluginSetup } from '../../../home/public'; +export { FeatureCatalogueCategory } from '../../../home/public'; diff --git a/src/plugins/dashboard/public/services/kibana_react.ts b/src/plugins/dashboard/public/services/kibana_react.ts index 203b6aa9cd2cbf..4d5a3a5b576579 100644 --- a/src/plugins/dashboard/public/services/kibana_react.ts +++ b/src/plugins/dashboard/public/services/kibana_react.ts @@ -6,6 +6,11 @@ * Side Public License, v 1. */ +export type { + KibanaReactContext, + KibanaReactContextValue, + ExitFullScreenButtonProps, +} from '../../../kibana_react/public'; export { context, useKibana, @@ -13,9 +18,6 @@ export { toMountPoint, TableListView, reactToUiComponent, - KibanaReactContext, ExitFullScreenButton, KibanaContextProvider, - KibanaReactContextValue, - ExitFullScreenButtonProps, } from '../../../kibana_react/public'; diff --git a/src/plugins/dashboard/public/services/kibana_utils.ts b/src/plugins/dashboard/public/services/kibana_utils.ts index 94128f902df02c..599e9b73f504f9 100644 --- a/src/plugins/dashboard/public/services/kibana_utils.ts +++ b/src/plugins/dashboard/public/services/kibana_utils.ts @@ -6,19 +6,21 @@ * Side Public License, v 1. */ +export type { + ISyncStateRef, + IKbnUrlStateStorage, + ReduxLikeStateContainer, +} from '../../../kibana_utils/public'; export { Storage, unhashUrl, syncState, - ISyncStateRef, getQueryParams, setStateToKbnUrl, removeQueryParam, withNotifyOnErrors, - IKbnUrlStateStorage, createKbnUrlTracker, SavedObjectNotFound, createStateContainer, - ReduxLikeStateContainer, createKbnUrlStateStorage, } from '../../../kibana_utils/public'; diff --git a/src/plugins/dashboard/public/services/navigation.ts b/src/plugins/dashboard/public/services/navigation.ts index 60373b0eb44ec4..eb1622eba35e04 100644 --- a/src/plugins/dashboard/public/services/navigation.ts +++ b/src/plugins/dashboard/public/services/navigation.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { NavigationPublicPluginStart } from '../../../navigation/public'; +export type { NavigationPublicPluginStart } from '../../../navigation/public'; diff --git a/src/plugins/dashboard/public/services/presentation_util.ts b/src/plugins/dashboard/public/services/presentation_util.ts index 17bc97db9ac633..d640b6326729d2 100644 --- a/src/plugins/dashboard/public/services/presentation_util.ts +++ b/src/plugins/dashboard/public/services/presentation_util.ts @@ -6,9 +6,5 @@ * Side Public License, v 1. */ -export { - PresentationUtilPluginStart, - LazyDashboardPicker, - withSuspense, - useLabs, -} from '../../../presentation_util/public'; +export type { PresentationUtilPluginStart } from '../../../presentation_util/public'; +export { LazyDashboardPicker, withSuspense, useLabs } from '../../../presentation_util/public'; diff --git a/src/plugins/dashboard/public/services/saved_objects.ts b/src/plugins/dashboard/public/services/saved_objects.ts index bd4a73f8ed8173..305ff3c2014f87 100644 --- a/src/plugins/dashboard/public/services/saved_objects.ts +++ b/src/plugins/dashboard/public/services/saved_objects.ts @@ -6,14 +6,16 @@ * Side Public License, v 1. */ -export { +export type { SaveResult, SavedObject, - showSaveModal, - SavedObjectLoader, SavedObjectsStart, SavedObjectSaveOpts, + SavedObjectLoaderFindOptions, +} from '../../../saved_objects/public'; +export { + showSaveModal, + SavedObjectLoader, SavedObjectSaveModal, getSavedObjectFinder, - SavedObjectLoaderFindOptions, } from '../../../saved_objects/public'; diff --git a/src/plugins/dashboard/public/services/share.ts b/src/plugins/dashboard/public/services/share.ts index 38a516ff80ecb2..7ed9b86571596c 100644 --- a/src/plugins/dashboard/public/services/share.ts +++ b/src/plugins/dashboard/public/services/share.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ -export { +export type { SharePluginStart, SharePluginSetup, - downloadMultipleAs, UrlGeneratorContract, } from '../../../share/public'; +export { downloadMultipleAs } from '../../../share/public'; diff --git a/src/plugins/dashboard/public/services/spaces.ts b/src/plugins/dashboard/public/services/spaces.ts index 89a0acaf611bd0..4ebe6644e23932 100644 --- a/src/plugins/dashboard/public/services/spaces.ts +++ b/src/plugins/dashboard/public/services/spaces.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { SpacesPluginStart } from '../../../../../x-pack/plugins/spaces/public'; +export type { SpacesPluginStart } from '../../../../../x-pack/plugins/spaces/public'; diff --git a/src/plugins/dashboard/public/services/ui_actions.ts b/src/plugins/dashboard/public/services/ui_actions.ts index 017f5b232d11ed..5dc2e016a121c0 100644 --- a/src/plugins/dashboard/public/services/ui_actions.ts +++ b/src/plugins/dashboard/public/services/ui_actions.ts @@ -6,9 +6,5 @@ * Side Public License, v 1. */ -export { - Action, - IncompatibleActionError, - UiActionsSetup, - UiActionsStart, -} from '../../../ui_actions/public'; +export type { Action, UiActionsSetup, UiActionsStart } from '../../../ui_actions/public'; +export { IncompatibleActionError } from '../../../ui_actions/public'; diff --git a/src/plugins/dashboard/public/services/usage_collection.ts b/src/plugins/dashboard/public/services/usage_collection.ts index 4bf43106f4e8fd..dee7499c611384 100644 --- a/src/plugins/dashboard/public/services/usage_collection.ts +++ b/src/plugins/dashboard/public/services/usage_collection.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { UsageCollectionSetup } from '../../../usage_collection/public'; +export type { UsageCollectionSetup } from '../../../usage_collection/public'; diff --git a/src/plugins/dashboard/public/types.ts b/src/plugins/dashboard/public/types.ts index c4cc00838a3438..d4a6cb20bc5519 100644 --- a/src/plugins/dashboard/public/types.ts +++ b/src/plugins/dashboard/public/types.ts @@ -39,7 +39,7 @@ import { DashboardAppLocatorParams } from './locator'; import { SpacesPluginStart } from './services/spaces'; import type { DashboardControlGroupInput } from './application/lib/dashboard_control_group'; -export { SavedDashboardPanel }; +export type { SavedDashboardPanel }; export type NavAction = (anchorElement?: any) => void; export interface SavedDashboardPanelMap { diff --git a/src/plugins/dashboard/server/index.ts b/src/plugins/dashboard/server/index.ts index 3af8833d5e4a41..c99ca43ad835e5 100644 --- a/src/plugins/dashboard/server/index.ts +++ b/src/plugins/dashboard/server/index.ts @@ -24,5 +24,5 @@ export function plugin(initializerContext: PluginInitializerContext) { return new DashboardPlugin(initializerContext); } -export { DashboardPluginSetup, DashboardPluginStart } from './types'; +export type { DashboardPluginSetup, DashboardPluginStart } from './types'; export { findByValueEmbeddables } from './usage/find_by_value_embeddables'; diff --git a/src/plugins/data/common/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index 7029e9d064b214..28361114be6e17 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -373,6 +373,21 @@ type EsQueryConfig = oldEsQueryConfig; * @removeBy 8.1 */ +export type { + Filter, + RangeFilterMeta, + RangeFilterParams, + ExistsFilter, + PhrasesFilter, + PhraseFilter, + MatchAllFilter, + CustomFilter, + RangeFilter, + KueryNode, + FilterMeta, + IFieldSubType, + EsQueryConfig, +}; export { COMPARE_ALL_OPTIONS, compareFilters, @@ -414,17 +429,4 @@ export { onlyDisabledFiltersChanged, uniqFilters, FilterStateStore, - Filter, - RangeFilterMeta, - RangeFilterParams, - ExistsFilter, - PhrasesFilter, - PhraseFilter, - MatchAllFilter, - CustomFilter, - RangeFilter, - KueryNode, - FilterMeta, - IFieldSubType, - EsQueryConfig, }; diff --git a/src/plugins/data/common/index.ts b/src/plugins/data/common/index.ts index 34a75f8f24dc6a..9a58b73d2c49c6 100644 --- a/src/plugins/data/common/index.ts +++ b/src/plugins/data/common/index.ts @@ -51,6 +51,12 @@ export type { IndexPatternLoadStartDependencies, IndexPatternLoadExpressionFunctionDefinition, } from '../../data_views/common'; +export type { + IndexPatternsContract, + DataViewsContract, + IndexPatternListItem, + DataViewListItem, +} from '../../data_views/common'; export { RUNTIME_FIELD_TYPES, FLEET_ASSETS_TO_IGNORE, @@ -64,13 +70,9 @@ export { DataViewType, IndexPatternType, IndexPatternsService, - IndexPatternsContract, DataViewsService, - DataViewsContract, IndexPattern, - IndexPatternListItem, DataView, - DataViewListItem, DuplicateDataViewError, DataViewSavedObjectConflictError, getIndexPatternLoadMeta, diff --git a/src/plugins/data/common/kbn_field_types/types.ts b/src/plugins/data/common/kbn_field_types/types.ts index cea35a53e9da1b..29471e95a36b8d 100644 --- a/src/plugins/data/common/kbn_field_types/types.ts +++ b/src/plugins/data/common/kbn_field_types/types.ts @@ -8,4 +8,5 @@ import { KbnFieldTypeOptions, ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/field-types'; -export { KbnFieldTypeOptions, ES_FIELD_TYPES, KBN_FIELD_TYPES }; +export type { KbnFieldTypeOptions }; +export { ES_FIELD_TYPES, KBN_FIELD_TYPES }; diff --git a/src/plugins/data/common/search/aggs/types.ts b/src/plugins/data/common/search/aggs/types.ts index fec02a5ae23fda..34c4f0fbf98c50 100644 --- a/src/plugins/data/common/search/aggs/types.ts +++ b/src/plugins/data/common/search/aggs/types.ts @@ -89,14 +89,14 @@ import { aggSinglePercentile, } from './'; -export { IAggConfig, AggConfigSerialized } from './agg_config'; -export { CreateAggConfigParams, IAggConfigs } from './agg_configs'; -export { IAggType } from './agg_type'; -export { AggParam, AggParamOption } from './agg_params'; -export { IFieldParamType } from './param_types'; -export { IMetricAggType } from './metrics/metric_agg_type'; -export { IpRangeKey } from './buckets/lib/ip_range'; -export { OptionedValueProp } from './param_types/optioned'; +export type { IAggConfig, AggConfigSerialized } from './agg_config'; +export type { CreateAggConfigParams, IAggConfigs } from './agg_configs'; +export type { IAggType } from './agg_type'; +export type { AggParam, AggParamOption } from './agg_params'; +export type { IFieldParamType } from './param_types'; +export type { IMetricAggType } from './metrics/metric_agg_type'; +export type { IpRangeKey } from './buckets/lib/ip_range'; +export type { OptionedValueProp } from './param_types/optioned'; /** @internal */ export interface AggsCommonSetup { diff --git a/src/plugins/data/public/actions/index.ts b/src/plugins/data/public/actions/index.ts index cb4eff5c274bbc..0ec33f7e46523f 100644 --- a/src/plugins/data/public/actions/index.ts +++ b/src/plugins/data/public/actions/index.ts @@ -6,11 +6,8 @@ * Side Public License, v 1. */ -export { - ACTION_GLOBAL_APPLY_FILTER, - createFilterAction, - ApplyGlobalFilterActionContext, -} from './apply_filter_action'; +export type { ApplyGlobalFilterActionContext } from './apply_filter_action'; +export { ACTION_GLOBAL_APPLY_FILTER, createFilterAction } from './apply_filter_action'; export { createFiltersFromValueClickAction } from './filters/create_filters_from_value_click'; export { createFiltersFromRangeSelectAction } from './filters/create_filters_from_range_select'; export * from './select_range_action'; diff --git a/src/plugins/data/public/autocomplete/collectors/index.ts b/src/plugins/data/public/autocomplete/collectors/index.ts index 5cfaab19787dab..e9b5736008ab15 100644 --- a/src/plugins/data/public/autocomplete/collectors/index.ts +++ b/src/plugins/data/public/autocomplete/collectors/index.ts @@ -7,4 +7,5 @@ */ export { createUsageCollector } from './create_usage_collector'; -export { AUTOCOMPLETE_EVENT_TYPE, AutocompleteUsageCollector } from './types'; +export type { AutocompleteUsageCollector } from './types'; +export { AUTOCOMPLETE_EVENT_TYPE } from './types'; diff --git a/src/plugins/data/public/autocomplete/index.ts b/src/plugins/data/public/autocomplete/index.ts index 00aa14b86409a0..b36af8f12eb52f 100644 --- a/src/plugins/data/public/autocomplete/index.ts +++ b/src/plugins/data/public/autocomplete/index.ts @@ -6,13 +6,14 @@ * Side Public License, v 1. */ -export { +export type { QuerySuggestion, - QuerySuggestionTypes, QuerySuggestionGetFn, QuerySuggestionGetFnArgs, QuerySuggestionBasic, QuerySuggestionField, } from './providers/query_suggestion_provider'; +export { QuerySuggestionTypes } from './providers/query_suggestion_provider'; -export { AutocompleteService, AutocompleteSetup, AutocompleteStart } from './autocomplete_service'; +export type { AutocompleteSetup, AutocompleteStart } from './autocomplete_service'; +export { AutocompleteService } from './autocomplete_service'; diff --git a/src/plugins/data/public/deprecated.ts b/src/plugins/data/public/deprecated.ts index 163d3298582932..8b90f92b932e03 100644 --- a/src/plugins/data/public/deprecated.ts +++ b/src/plugins/data/public/deprecated.ts @@ -137,7 +137,7 @@ export const esFilters = { /** * Deprecated type exports */ -export { +export type { KueryNode, RangeFilter, RangeFilterMeta, @@ -149,9 +149,8 @@ export { MatchAllFilter, IFieldSubType, EsQueryConfig, - isFilter, - isFilters, }; +export { isFilter, isFilters }; /** * @deprecated Import helpers from the "@kbn/es-query" package directly instead. diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 4d51a7ae0ad772..0b749d90f71523 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -70,29 +70,26 @@ export const indexPatterns = { validate: validateDataView, }; -export { - IndexPatternsContract, - DataViewsContract, - IndexPattern, - IndexPatternField, - TypeMeta, -} from './data_views'; +export type { IndexPatternsContract, DataViewsContract, TypeMeta } from './data_views'; +export { IndexPattern, IndexPatternField } from './data_views'; -export { +export type { IIndexPattern, IFieldType, - ES_FIELD_TYPES, - KBN_FIELD_TYPES, IndexPatternAttributes, - UI_SETTINGS, AggregationRestrictions as IndexPatternAggRestrictions, IndexPatternSpec, IndexPatternLoadExpressionFunctionDefinition, - fieldList, GetFieldsOptions, AggregationRestrictions, - IndexPatternType, IndexPatternListItem, +} from '../common'; +export { + ES_FIELD_TYPES, + KBN_FIELD_TYPES, + UI_SETTINGS, + fieldList, + IndexPatternType, DuplicateDataViewError, } from '../common'; @@ -217,7 +214,8 @@ export type { SearchUsageCollector, } from './search'; -export { ISearchOptions, isErrorResponse, isCompleteResponse, isPartialResponse } from '../common'; +export type { ISearchOptions } from '../common'; +export { isErrorResponse, isCompleteResponse, isPartialResponse } from '../common'; // Search namespace export const search = { @@ -301,7 +299,8 @@ export { export { isTimeRange, isQuery } from '../common'; -export { ACTION_GLOBAL_APPLY_FILTER, ApplyGlobalFilterActionContext } from './actions'; +export type { ApplyGlobalFilterActionContext } from './actions'; +export { ACTION_GLOBAL_APPLY_FILTER } from './actions'; export { APPLY_FILTER_TRIGGER } from './triggers'; /* diff --git a/src/plugins/data/public/now_provider/index.ts b/src/plugins/data/public/now_provider/index.ts index 4d22d674b60b41..b3bfd31fca2c41 100644 --- a/src/plugins/data/public/now_provider/index.ts +++ b/src/plugins/data/public/now_provider/index.ts @@ -6,8 +6,5 @@ * Side Public License, v 1. */ -export { - NowProvider, - NowProviderInternalContract, - NowProviderPublicContract, -} from './now_provider'; +export type { NowProviderInternalContract, NowProviderPublicContract } from './now_provider'; +export { NowProvider } from './now_provider'; diff --git a/src/plugins/data/public/query/query_string/index.ts b/src/plugins/data/public/query/query_string/index.ts index feef1965f8b244..63cc777f6688d5 100644 --- a/src/plugins/data/public/query/query_string/index.ts +++ b/src/plugins/data/public/query/query_string/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { QueryStringContract, QueryStringManager } from './query_string_manager'; +export type { QueryStringContract } from './query_string_manager'; +export { QueryStringManager } from './query_string_manager'; diff --git a/src/plugins/data/public/query/saved_query/index.ts b/src/plugins/data/public/query/saved_query/index.ts index 6cde77c7a77227..03d8f0b35b9b11 100644 --- a/src/plugins/data/public/query/saved_query/index.ts +++ b/src/plugins/data/public/query/saved_query/index.ts @@ -6,5 +6,10 @@ * Side Public License, v 1. */ -export { SavedQuery, SavedQueryAttributes, SavedQueryService, SavedQueryTimeFilter } from './types'; +export type { + SavedQuery, + SavedQueryAttributes, + SavedQueryService, + SavedQueryTimeFilter, +} from './types'; export { createSavedQueryService } from './saved_query_service'; diff --git a/src/plugins/data/public/query/state_sync/index.ts b/src/plugins/data/public/query/state_sync/index.ts index dac51411dfd400..58740cfab06d00 100644 --- a/src/plugins/data/public/query/state_sync/index.ts +++ b/src/plugins/data/public/query/state_sync/index.ts @@ -8,4 +8,4 @@ export { connectToQueryState } from './connect_to_query_state'; export { syncQueryStateWithUrl } from './sync_state_with_url'; -export { QueryState, QueryStateChange } from './types'; +export type { QueryState, QueryStateChange } from './types'; diff --git a/src/plugins/data/public/query/timefilter/index.ts b/src/plugins/data/public/query/timefilter/index.ts index 3dfd4e0fe514f5..604213054fd023 100644 --- a/src/plugins/data/public/query/timefilter/index.ts +++ b/src/plugins/data/public/query/timefilter/index.ts @@ -6,11 +6,14 @@ * Side Public License, v 1. */ -export { TimefilterService, TimefilterSetup } from './timefilter_service'; +export type { TimefilterSetup } from './timefilter_service'; +export { TimefilterService } from './timefilter_service'; export * from './types'; -export { Timefilter, TimefilterContract, AutoRefreshDoneFn } from './timefilter'; -export { TimeHistory, TimeHistoryContract } from './time_history'; +export type { TimefilterContract, AutoRefreshDoneFn } from './timefilter'; +export { Timefilter } from './timefilter'; +export type { TimeHistoryContract } from './time_history'; +export { TimeHistory } from './time_history'; export { changeTimeFilter, convertRangeFilterToTimeRangeString } from './lib/change_time_filter'; export { extractTimeFilter, extractTimeRange } from './lib/extract_time_filter'; export { validateTimeRange } from './lib/validate_timerange'; diff --git a/src/plugins/data/public/query/timefilter/timefilter.ts b/src/plugins/data/public/query/timefilter/timefilter.ts index 3b537562586a7b..f3520abb2f46ec 100644 --- a/src/plugins/data/public/query/timefilter/timefilter.ts +++ b/src/plugins/data/public/query/timefilter/timefilter.ts @@ -25,7 +25,7 @@ import { import { TimeHistoryContract } from './time_history'; import { createAutoRefreshLoop, AutoRefreshDoneFn } from './lib/auto_refresh_loop'; -export { AutoRefreshDoneFn }; +export type { AutoRefreshDoneFn }; // TODO: remove! export class Timefilter { diff --git a/src/plugins/data/public/query/timefilter/types.ts b/src/plugins/data/public/query/timefilter/types.ts index 66584358ccb343..3c35ae2d79ae5f 100644 --- a/src/plugins/data/public/query/timefilter/types.ts +++ b/src/plugins/data/public/query/timefilter/types.ts @@ -23,4 +23,4 @@ export type InputTimeRange = to: Moment; }; -export { TimeRangeBounds } from '../../../common'; +export type { TimeRangeBounds } from '../../../common'; diff --git a/src/plugins/data/public/search/aggs/types.ts b/src/plugins/data/public/search/aggs/types.ts index 34ec3415427d34..5a8110034bbc12 100644 --- a/src/plugins/data/public/search/aggs/types.ts +++ b/src/plugins/data/public/search/aggs/types.ts @@ -9,4 +9,4 @@ import { AggsCommonSetup } from '../../../common'; export type AggsSetup = AggsCommonSetup; -export { AggsStart } from '../../../common'; +export type { AggsStart } from '../../../common'; diff --git a/src/plugins/data/public/search/collectors/index.ts b/src/plugins/data/public/search/collectors/index.ts index b6640a8e61f6c5..9eb96be5a04551 100644 --- a/src/plugins/data/public/search/collectors/index.ts +++ b/src/plugins/data/public/search/collectors/index.ts @@ -7,4 +7,5 @@ */ export { createUsageCollector } from './create_usage_collector'; -export { SEARCH_EVENT_TYPE, SearchUsageCollector } from './types'; +export type { SearchUsageCollector } from './types'; +export { SEARCH_EVENT_TYPE } from './types'; diff --git a/src/plugins/data/public/search/index.ts b/src/plugins/data/public/search/index.ts index 21d607eedb1524..821f16e0cf68ae 100644 --- a/src/plugins/data/public/search/index.ts +++ b/src/plugins/data/public/search/index.ts @@ -8,46 +8,51 @@ export * from './expressions'; -export { +export type { ISearchSetup, ISearchStart, ISearchStartSearchSource, SearchUsageCollector, } from './types'; -export { - ES_SEARCH_STRATEGY, +export type { EsQuerySortValue, - extractReferences as extractSearchSourceReferences, - getSearchParamsFromRequest, IEsSearchRequest, IEsSearchResponse, IKibanaSearchRequest, IKibanaSearchResponse, - injectReferences as injectSearchSourceReferences, ISearchGeneric, ISearchSource, - parseSearchSourceJSON, SearchError, SearchRequest, - SearchSource, SearchSourceDependencies, SearchSourceFields, - SortDirection, } from '../../common/search'; export { - SessionService, + ES_SEARCH_STRATEGY, + extractReferences as extractSearchSourceReferences, + getSearchParamsFromRequest, + injectReferences as injectSearchSourceReferences, + parseSearchSourceJSON, + SearchSource, + SortDirection, +} from '../../common/search'; +export type { ISessionService, SearchSessionInfoProvider, + ISessionsClient, + WaitUntilNextSessionCompletesOptions, +} from './session'; +export { + SessionService, SearchSessionState, SessionsClient, - ISessionsClient, noSearchSessionStorageCapabilityMessage, SEARCH_SESSIONS_MANAGEMENT_ID, waitUntilNextSessionCompletes$, - WaitUntilNextSessionCompletesOptions, } from './session'; export { getEsPreference } from './es_search'; -export { SearchInterceptor, SearchInterceptorDeps } from './search_interceptor'; +export type { SearchInterceptorDeps } from './search_interceptor'; +export { SearchInterceptor } from './search_interceptor'; export * from './errors'; diff --git a/src/plugins/data/public/search/search_interceptor/index.ts b/src/plugins/data/public/search/search_interceptor/index.ts index 411c4beefe96ca..bf6930276020e5 100644 --- a/src/plugins/data/public/search/search_interceptor/index.ts +++ b/src/plugins/data/public/search/search_interceptor/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { SearchInterceptor, ISearchInterceptor, SearchInterceptorDeps } from './search_interceptor'; +export type { ISearchInterceptor, SearchInterceptorDeps } from './search_interceptor'; +export { SearchInterceptor } from './search_interceptor'; diff --git a/src/plugins/data/public/search/session/index.ts b/src/plugins/data/public/search/session/index.ts index ce578378a2fe81..c48362538a5fda 100644 --- a/src/plugins/data/public/search/session/index.ts +++ b/src/plugins/data/public/search/session/index.ts @@ -6,12 +6,12 @@ * Side Public License, v 1. */ -export { SessionService, ISessionService, SearchSessionInfoProvider } from './session_service'; +export type { ISessionService, SearchSessionInfoProvider } from './session_service'; +export { SessionService } from './session_service'; export { SearchSessionState } from './search_session_state'; -export { SessionsClient, ISessionsClient } from './sessions_client'; +export type { ISessionsClient } from './sessions_client'; +export { SessionsClient } from './sessions_client'; export { noSearchSessionStorageCapabilityMessage } from './i18n'; export { SEARCH_SESSIONS_MANAGEMENT_ID } from './constants'; -export { - waitUntilNextSessionCompletes$, - WaitUntilNextSessionCompletesOptions, -} from './session_helpers'; +export type { WaitUntilNextSessionCompletesOptions } from './session_helpers'; +export { waitUntilNextSessionCompletes$ } from './session_helpers'; diff --git a/src/plugins/data/public/search/types.ts b/src/plugins/data/public/search/types.ts index 764933d15e065b..3dacad42273aea 100644 --- a/src/plugins/data/public/search/types.ts +++ b/src/plugins/data/public/search/types.ts @@ -14,7 +14,7 @@ import { IndexPatternsContract } from '../../common'; import { UsageCollectionSetup } from '../../../usage_collection/public'; import { ISessionsClient, ISessionService } from './session'; -export { ISearchStartSearchSource, SearchUsageCollector }; +export type { ISearchStartSearchSource, SearchUsageCollector }; /** * The setup contract exposed by the Search plugin exposes the search strategy extension diff --git a/src/plugins/data/public/ui/index.ts b/src/plugins/data/public/ui/index.ts index 1c8df359602b95..026db1b7c09ee6 100644 --- a/src/plugins/data/public/ui/index.ts +++ b/src/plugins/data/public/ui/index.ts @@ -6,8 +6,10 @@ * Side Public License, v 1. */ -export { IndexPatternSelectProps } from './index_pattern_select'; +export type { IndexPatternSelectProps } from './index_pattern_select'; export { FilterLabel, FilterItem } from './filter_bar'; -export { QueryStringInput, QueryStringInputProps } from './query_string_input'; -export { SearchBar, SearchBarProps, StatefulSearchBarProps } from './search_bar'; +export type { QueryStringInputProps } from './query_string_input'; +export { QueryStringInput } from './query_string_input'; +export type { SearchBarProps, StatefulSearchBarProps } from './search_bar'; +export { SearchBar } from './search_bar'; export { SuggestionsComponent } from './typeahead'; diff --git a/src/plugins/data/public/ui/saved_query_form/index.ts b/src/plugins/data/public/ui/saved_query_form/index.ts index f440294dc6eb75..1590b8fc989277 100644 --- a/src/plugins/data/public/ui/saved_query_form/index.ts +++ b/src/plugins/data/public/ui/saved_query_form/index.ts @@ -7,4 +7,5 @@ */ // @internal -export { SavedQueryMeta, SaveQueryForm } from '../saved_query_form/save_query_form'; +export type { SavedQueryMeta } from '../saved_query_form/save_query_form'; +export { SaveQueryForm } from '../saved_query_form/save_query_form'; diff --git a/src/plugins/data/public/ui/search_bar/index.tsx b/src/plugins/data/public/ui/search_bar/index.tsx index 64dacee4ad3637..fac421dd743d79 100644 --- a/src/plugins/data/public/ui/search_bar/index.tsx +++ b/src/plugins/data/public/ui/search_bar/index.tsx @@ -21,5 +21,5 @@ const WrappedSearchBar = (props: SearchBarProps) => ( ); export const SearchBar = injectI18n(withKibana(WrappedSearchBar)); -export { StatefulSearchBarProps } from './create_search_bar'; +export type { StatefulSearchBarProps } from './create_search_bar'; export type { SearchBarProps, SearchBarOwnProps } from './search_bar'; diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index fce73e65dc699d..939d4a9fa32378 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -36,20 +36,18 @@ export { DATA_VIEW_SAVED_OBJECT_TYPE } from '../common'; * Index patterns: */ +export type { FieldDescriptor, IndexPatternsServiceStart } from './data_views'; export { IndexPatternsFetcher, - shouldReadFieldFromDocValues, // used only in logstash_fields fixture - FieldDescriptor, + shouldReadFieldFromDocValues, getCapabilitiesForRollupIndices, - IndexPatternsServiceStart, } from './data_views'; +export type { IFieldType, IndexPatternAttributes } from '../common'; export { IndexPatternField, - IFieldType, ES_FIELD_TYPES, KBN_FIELD_TYPES, - IndexPatternAttributes, UI_SETTINGS, IndexPattern, IndexPatternsService, @@ -72,29 +70,24 @@ import { } from '../common'; import { autocompleteConfigDeprecationProvider } from './config_deprecations'; -export { - // aggs - METRIC_TYPES, +export type { ParsedInterval, - // search ISearchOptions, IEsSearchRequest, IEsSearchResponse, - ES_SEARCH_STRATEGY, } from '../common'; +export { METRIC_TYPES, ES_SEARCH_STRATEGY } from '../common'; -export { +export type { IScopedSearchClient, ISearchStrategy, SearchStrategyDependencies, - shimHitsTotal, - SearchSessionService, ISearchSessionService, SearchRequestHandlerContext, DataRequestHandlerContext, AsyncSearchStatusResponse, - NoSearchIdInSessionError, } from './search'; +export { shimHitsTotal, SearchSessionService, NoSearchIdInSessionError } from './search'; // Search namespace export const search = { @@ -112,14 +105,8 @@ export const search = { * @public */ -export { - castEsToKbnFieldTypeName, - getTime, - // timefilter - TimeRange, - // utils - parseInterval, -} from '../common'; +export type { TimeRange } from '../common'; +export { castEsToKbnFieldTypeName, getTime, parseInterval } from '../common'; /** * Static code to be shared externally @@ -130,11 +117,8 @@ export function plugin(initializerContext: PluginInitializerContext = { deprecations: autocompleteConfigDeprecationProvider, diff --git a/src/plugins/data/server/search/index.ts b/src/plugins/data/server/search/index.ts index b9affe96ea2ddd..b7087e95c0a2c0 100644 --- a/src/plugins/data/server/search/index.ts +++ b/src/plugins/data/server/search/index.ts @@ -10,7 +10,8 @@ export * from './types'; export * from './strategies/es_search'; export * from './strategies/ese_search'; export * from './strategies/eql_search'; -export { usageProvider, SearchUsage, searchUsageObserver } from './collectors'; +export type { SearchUsage } from './collectors'; +export { usageProvider, searchUsageObserver } from './collectors'; export * from './aggs'; export * from './session'; export * from './errors/no_search_id_in_session'; diff --git a/src/plugins/data/server/search/strategies/es_search/index.ts b/src/plugins/data/server/search/strategies/es_search/index.ts index d43fab0a86e69a..53a791455e64e5 100644 --- a/src/plugins/data/server/search/strategies/es_search/index.ts +++ b/src/plugins/data/server/search/strategies/es_search/index.ts @@ -9,4 +9,5 @@ export { esSearchStrategyProvider } from './es_search_strategy'; export * from './request_utils'; export * from './response_utils'; -export { ES_SEARCH_STRATEGY, IEsSearchRequest, IEsSearchResponse } from '../../../../common'; +export type { IEsSearchRequest, IEsSearchResponse } from '../../../../common'; +export { ES_SEARCH_STRATEGY } from '../../../../common'; diff --git a/src/plugins/data_views/common/index.ts b/src/plugins/data_views/common/index.ts index b057a1ba84174e..b3123df2597cce 100644 --- a/src/plugins/data_views/common/index.ts +++ b/src/plugins/data_views/common/index.ts @@ -55,13 +55,10 @@ export type { SourceFilter, } from './types'; export { DataViewType, IndexPatternType } from './types'; -export { - IndexPatternsService, - IndexPatternsContract, - DataViewsService, - DataViewsContract, -} from './data_views'; -export { IndexPattern, IndexPatternListItem, DataView, DataViewListItem } from './data_views'; +export type { IndexPatternsContract, DataViewsContract } from './data_views'; +export { IndexPatternsService, DataViewsService } from './data_views'; +export type { IndexPatternListItem, DataViewListItem } from './data_views'; +export { IndexPattern, DataView } from './data_views'; export { DuplicateDataViewError, DataViewSavedObjectConflictError } from './errors'; export type { IndexPatternExpressionType, diff --git a/src/plugins/data_views/public/index.ts b/src/plugins/data_views/public/index.ts index 3a6b5ccb237f29..650d2132212f8f 100644 --- a/src/plugins/data_views/public/index.ts +++ b/src/plugins/data_views/public/index.ts @@ -15,15 +15,15 @@ export { } from '../common/lib'; export { onRedirectNoIndexPattern } from './data_views'; -export { IndexPatternField, IIndexPatternFieldList, TypeMeta } from '../common'; +export type { IIndexPatternFieldList, TypeMeta } from '../common'; +export { IndexPatternField } from '../common'; +export type { IndexPatternsContract, DataViewsContract } from './data_views'; export { IndexPatternsService, - IndexPatternsContract, IndexPattern, DataViewsApiClient, DataViewsService, - DataViewsContract, DataView, } from './data_views'; export { UiSettingsPublicToCommon } from './ui_settings_wrapper'; diff --git a/src/plugins/data_views/server/index.ts b/src/plugins/data_views/server/index.ts index 1c7eeb073bbe21..7a4df9518b435a 100644 --- a/src/plugins/data_views/server/index.ts +++ b/src/plugins/data_views/server/index.ts @@ -7,14 +7,14 @@ */ export { getFieldByName, findIndexPatternById } from './utils'; +export type { FieldDescriptor } from './fetcher'; export { IndexPatternsFetcher, - FieldDescriptor, shouldReadFieldFromDocValues, mergeCapabilitiesWithFields, getCapabilitiesForRollupIndices, } from './fetcher'; -export { IndexPatternsServiceStart } from './types'; +export type { IndexPatternsServiceStart } from './types'; import { PluginInitializerContext } from 'src/core/server'; import { DataViewsServerPlugin } from './plugin'; @@ -30,8 +30,8 @@ export function plugin(initializerContext: PluginInitializerContext) { return new DataViewsServerPlugin(initializerContext); } -export { - DataViewsServerPlugin as Plugin, +export type { DataViewsServerPluginSetup as PluginSetup, DataViewsServerPluginStart as PluginStart, }; +export { DataViewsServerPlugin as Plugin }; diff --git a/src/plugins/discover/public/application/apps/main/components/chart/histogram.tsx b/src/plugins/discover/public/application/apps/main/components/chart/histogram.tsx index d1bc7a7cd7dbc6..315ab7bad40f1d 100644 --- a/src/plugins/discover/public/application/apps/main/components/chart/histogram.tsx +++ b/src/plugins/discover/public/application/apps/main/components/chart/histogram.tsx @@ -8,7 +8,14 @@ import './histogram.scss'; import moment, { unitOfTime } from 'moment-timezone'; import React, { useCallback, useMemo } from 'react'; -import { EuiLoadingChart, EuiSpacer, EuiText } from '@elastic/eui'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiIconTip, + EuiLoadingChart, + EuiSpacer, + EuiText, +} from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import dateMath from '@elastic/datemath'; import { @@ -23,11 +30,9 @@ import { Settings, TooltipType, XYChartElementEvent, - GridLineStyle, - AxisStyle, - RecursivePartial, } from '@elastic/charts'; import { IUiSettingsClient } from 'kibana/public'; +import { i18n } from '@kbn/i18n'; import { CurrentTime, Endzones, @@ -38,7 +43,7 @@ import { DataCharts$, DataChartsMessage } from '../../services/use_saved_search' import { FetchStatus } from '../../../../types'; import { DiscoverServices } from '../../../../../build_services'; import { useDataState } from '../../utils/use_data_state'; -import { LEGACY_TIME_AXIS } from '../../../../../../../charts/common'; +import { LEGACY_TIME_AXIS, MULTILAYER_TIME_AXIS_STYLE } from '../../../../../../../charts/common'; export interface DiscoverHistogramProps { savedSearchData$: DataCharts$; @@ -68,7 +73,7 @@ export function DiscoverHistogram({ const uiSettings = services.uiSettings; const timeZone = getTimezone(uiSettings); - const { chartData, fetchStatus } = dataState; + const { chartData, fetchStatus, bucketInterval } = dataState; const onBrushEnd = useCallback( ({ x }: XYBrushEvent) => { @@ -184,46 +189,47 @@ export function DiscoverHistogram({ const xAxisFormatter = services.data.fieldFormats.deserialize(chartData.yAxisFormat); const useLegacyTimeAxis = uiSettings.get(LEGACY_TIME_AXIS, false); - const gridLineStyle: RecursivePartial = useLegacyTimeAxis - ? {} - : { strokeWidth: 0.1, stroke: isDarkMode ? 'white' : 'black' }; - const verticalAxisStyle: RecursivePartial = useLegacyTimeAxis - ? {} - : { - axisLine: { - visible: false, - }, - tickLabel: { - fontSize: 11, - }, - }; - const xAxisStyle: RecursivePartial = useLegacyTimeAxis - ? {} - : { - axisLine: { - stroke: isDarkMode ? 'lightgray' : 'darkgray', - strokeWidth: 1, - }, - tickLine: { - size: 12, - strokeWidth: 0.15, - stroke: isDarkMode ? 'white' : 'black', - padding: -10, - visible: true, - }, - tickLabel: { - fontSize: 11, - padding: 0, - alignment: { - vertical: Position.Bottom, - horizontal: Position.Left, - }, - offset: { - x: 1.5, - y: 0, - }, - }, - }; + + const toolTipTitle = i18n.translate('discover.timeIntervalWithValueWarning', { + defaultMessage: 'Warning', + }); + + const toolTipContent = i18n.translate('discover.bucketIntervalTooltip', { + defaultMessage: + 'This interval creates {bucketsDescription} to show in the selected time range, so it has been scaled to {bucketIntervalDescription}.', + values: { + bucketsDescription: + bucketInterval!.scale && bucketInterval!.scale > 1 + ? i18n.translate('discover.bucketIntervalTooltip.tooLargeBucketsText', { + defaultMessage: 'buckets that are too large', + }) + : i18n.translate('discover.bucketIntervalTooltip.tooManyBucketsText', { + defaultMessage: 'too many buckets', + }), + bucketIntervalDescription: bucketInterval?.description, + }, + }); + + let timeRange = ( + + {timeRangeText} + + ); + if (bucketInterval?.scaled) { + timeRange = ( + + {timeRange} + + + + + ); + } return ( @@ -244,16 +250,13 @@ export function DiscoverHistogram({ ticks={2} integersOnly tickFormat={(value) => xAxisFormatter.convert(value)} - gridLine={gridLineStyle} - style={verticalAxisStyle} /> - - {timeRangeText} - + {timeRange} ); } diff --git a/src/plugins/discover/public/application/apps/main/components/chart/use_chart_panels.ts b/src/plugins/discover/public/application/apps/main/components/chart/use_chart_panels.ts index 72f921bca5f533..3660173ef761dc 100644 --- a/src/plugins/discover/public/application/apps/main/components/chart/use_chart_panels.ts +++ b/src/plugins/discover/public/application/apps/main/components/chart/use_chart_panels.ts @@ -12,8 +12,7 @@ import type { } from '@elastic/eui'; import { search } from '../../../../../../../data/public'; import { AppState } from '../../services/discover_state'; -import { DataCharts$, DataChartsMessage } from '../../services/use_saved_search'; -import { useDataState } from '../../utils/use_data_state'; +import { DataCharts$ } from '../../services/use_saved_search'; export function useChartPanels( state: AppState, @@ -22,8 +21,6 @@ export function useChartPanels( onChangeInterval: (value: string) => void, closePopover: () => void ) { - const dataState: DataChartsMessage = useDataState(savedSearchDataChart$); - const { bucketInterval } = dataState; const { interval, hideChart } = state; const selectedOptionIdx = search.aggs.intervalOptions.findIndex((opt) => opt.val === interval); const intervalDisplay = @@ -56,29 +53,6 @@ export function useChartPanels( timeInterval: intervalDisplay, }, }), - icon: bucketInterval?.scaled ? 'alert' : '', - toolTipTitle: bucketInterval?.scaled - ? i18n.translate('discover.timeIntervalWithValueWarning', { - defaultMessage: 'Warning', - }) - : '', - toolTipContent: bucketInterval?.scaled - ? i18n.translate('discover.bucketIntervalTooltip', { - defaultMessage: - 'This interval creates {bucketsDescription} to show in the selected time range, so it has been scaled to {bucketIntervalDescription}.', - values: { - bucketsDescription: - bucketInterval!.scale && bucketInterval!.scale > 1 - ? i18n.translate('discover.bucketIntervalTooltip.tooLargeBucketsText', { - defaultMessage: 'buckets that are too large', - }) - : i18n.translate('discover.bucketIntervalTooltip.tooManyBucketsText', { - defaultMessage: 'too many buckets', - }), - bucketIntervalDescription: bucketInterval?.description, - }, - }) - : '', panel: 1, 'data-test-subj': 'discoverTimeIntervalPanel', }); diff --git a/src/plugins/discover/public/application/apps/main/components/layout/discover_layout.scss b/src/plugins/discover/public/application/apps/main/components/layout/discover_layout.scss index 37ff50e3331241..1d074c002e340c 100644 --- a/src/plugins/discover/public/application/apps/main/components/layout/discover_layout.scss +++ b/src/plugins/discover/public/application/apps/main/components/layout/discover_layout.scss @@ -82,8 +82,8 @@ discover-app { } .dscHistogram { - height: $euiSize * 8; - padding: $euiSizeS $euiSizeS $euiSizeS $euiSizeS; + height: $euiSize * 7; + padding: 0 $euiSizeS $euiSizeS * 2 $euiSizeS; } .dscHistogramTimeRange { diff --git a/src/plugins/discover/public/application/components/table/table_columns.tsx b/src/plugins/discover/public/application/components/table/table_columns.tsx index 5944f9bede6466..9f502b44919773 100644 --- a/src/plugins/discover/public/application/components/table/table_columns.tsx +++ b/src/plugins/discover/public/application/components/table/table_columns.tsx @@ -52,6 +52,7 @@ export const MAIN_COLUMNS: Array> = [ field: 'field', className: 'kbnDocViewer__tableFieldNameCell', mobileOptions: { header: false }, + width: '30%', name: ( diff --git a/src/plugins/discover/public/index.ts b/src/plugins/discover/public/index.ts index 21f1c31e774ee5..cb7b29afe3f9ac 100644 --- a/src/plugins/discover/public/index.ts +++ b/src/plugins/discover/public/index.ts @@ -9,22 +9,24 @@ import { PluginInitializerContext } from 'kibana/public'; import { DiscoverPlugin } from './plugin'; +export type { SavedSearch } from './saved_searches'; export { getSavedSearch, getSavedSearchFullPathUrl, getSavedSearchUrl, getSavedSearchUrlConflictMessage, throwErrorOnSavedSearchUrlConflict, - SavedSearch, } from './saved_searches'; -export { DiscoverSetup, DiscoverStart } from './plugin'; +export type { DiscoverSetup, DiscoverStart } from './plugin'; export function plugin(initializerContext: PluginInitializerContext) { return new DiscoverPlugin(initializerContext); } -export { ISearchEmbeddable, SEARCH_EMBEDDABLE_TYPE, SearchInput } from './application/embeddable'; +export type { ISearchEmbeddable, SearchInput } from './application/embeddable'; +export { SEARCH_EMBEDDABLE_TYPE } from './application/embeddable'; export { loadSharingDataHelpers } from './shared'; -export { DISCOVER_APP_URL_GENERATOR, DiscoverUrlGeneratorState } from './url_generator'; -export { DiscoverAppLocator, DiscoverAppLocatorParams } from './locator'; +export type { DiscoverUrlGeneratorState } from './url_generator'; +export { DISCOVER_APP_URL_GENERATOR } from './url_generator'; +export type { DiscoverAppLocator, DiscoverAppLocatorParams } from './locator'; diff --git a/src/plugins/discover/public/saved_searches/index.ts b/src/plugins/discover/public/saved_searches/index.ts index da9dd047fb5ac3..c41c92df300846 100644 --- a/src/plugins/discover/public/saved_searches/index.ts +++ b/src/plugins/discover/public/saved_searches/index.ts @@ -15,6 +15,7 @@ export { } from './saved_searches_utils'; export { useSavedSearchAliasMatchRedirect } from './saved_search_alias_match_redirect'; export { SavedSearchURLConflictCallout } from './saved_search_url_conflict_callout'; -export { saveSavedSearch, SaveSavedSearchOptions } from './save_saved_searches'; +export type { SaveSavedSearchOptions } from './save_saved_searches'; +export { saveSavedSearch } from './save_saved_searches'; export { SAVED_SEARCH_TYPE } from './constants'; export type { SavedSearch, SortOrder } from './types'; diff --git a/src/plugins/embeddable/public/index.ts b/src/plugins/embeddable/public/index.ts index 80171e1ad2faba..6a6b5b2df2ddde 100644 --- a/src/plugins/embeddable/public/index.ts +++ b/src/plugins/embeddable/public/index.ts @@ -11,76 +11,78 @@ import './index.scss'; import { PluginInitializerContext } from 'src/core/public'; import { EmbeddablePublicPlugin } from './plugin'; -export { - ACTION_ADD_PANEL, - ACTION_EDIT_PANEL, +export type { Adapters, - AddPanelAction, ReferenceOrValueEmbeddable, - isReferenceOrValueEmbeddable, ChartActionContext, - Container, ContainerInput, ContainerOutput, - CONTEXT_MENU_TRIGGER, - contextMenuTrigger, - defaultEmbeddableFactoryProvider, - EditPanelAction, - Embeddable, - EmbeddableChildPanel, EmbeddableChildPanelProps, EmbeddableContext, EmbeddableFactory, EmbeddableFactoryDefinition, - EmbeddableFactoryNotFoundError, EmbeddableInput, EmbeddableInstanceConfiguration, EmbeddableOutput, - EmbeddablePanel, - EmbeddableRoot, ValueClickContext, RangeSelectContext, - ErrorEmbeddable, IContainer, IEmbeddable, + OutputSpec, + PanelState, + PropertySpec, + SavedObjectEmbeddableInput, + EmbeddableEditorState, + EmbeddablePackageState, + EmbeddableRendererProps, +} from './lib'; +export { + ACTION_ADD_PANEL, + ACTION_EDIT_PANEL, + AddPanelAction, + isReferenceOrValueEmbeddable, + Container, + CONTEXT_MENU_TRIGGER, + contextMenuTrigger, + defaultEmbeddableFactoryProvider, + EditPanelAction, + Embeddable, + EmbeddableChildPanel, + EmbeddableFactoryNotFoundError, + EmbeddablePanel, + EmbeddableRoot, + ErrorEmbeddable, isEmbeddable, isErrorEmbeddable, openAddPanelFlyout, - OutputSpec, PANEL_BADGE_TRIGGER, panelBadgeTrigger, PANEL_NOTIFICATION_TRIGGER, panelNotificationTrigger, PanelNotFoundError, - PanelState, - PropertySpec, SELECT_RANGE_TRIGGER, VALUE_CLICK_TRIGGER, ViewMode, withEmbeddableSubscription, - SavedObjectEmbeddableInput, isSavedObjectEmbeddableInput, isRangeSelectTriggerContext, isValueClickTriggerContext, isRowClickTriggerContext, isContextMenuTriggerContext, EmbeddableStateTransfer, - EmbeddableEditorState, - EmbeddablePackageState, EmbeddableRenderer, - EmbeddableRendererProps, useEmbeddableFactory, } from './lib'; export { AttributeService, ATTRIBUTE_SERVICE_KEY } from './lib/attribute_service'; -export { EnhancementRegistryDefinition } from './types'; +export type { EnhancementRegistryDefinition } from './types'; export function plugin(initializerContext: PluginInitializerContext) { return new EmbeddablePublicPlugin(initializerContext); } -export { +export type { EmbeddableSetup, EmbeddableStart, EmbeddableSetupDependencies, diff --git a/src/plugins/embeddable/public/lib/containers/i_container.ts b/src/plugins/embeddable/public/lib/containers/i_container.ts index f68a3ada33c07d..c4593cac4969a1 100644 --- a/src/plugins/embeddable/public/lib/containers/i_container.ts +++ b/src/plugins/embeddable/public/lib/containers/i_container.ts @@ -15,7 +15,7 @@ import { } from '../embeddables'; import { PanelState } from '../../../common/types'; -export { PanelState }; +export type { PanelState }; export interface ContainerOutput extends EmbeddableOutput { embeddableLoaded: { [key: string]: boolean }; diff --git a/src/plugins/embeddable/public/lib/containers/index.ts b/src/plugins/embeddable/public/lib/containers/index.ts index cc2c0bfa58223b..041923188e1759 100644 --- a/src/plugins/embeddable/public/lib/containers/index.ts +++ b/src/plugins/embeddable/public/lib/containers/index.ts @@ -6,6 +6,6 @@ * Side Public License, v 1. */ -export { IContainer, PanelState, ContainerInput, ContainerOutput } from './i_container'; +export type { IContainer, PanelState, ContainerInput, ContainerOutput } from './i_container'; export { Container } from './container'; export * from './embeddable_child_panel'; diff --git a/src/plugins/embeddable/public/lib/embeddables/i_embeddable.ts b/src/plugins/embeddable/public/lib/embeddables/i_embeddable.ts index bbac617d415903..b53f036024259d 100644 --- a/src/plugins/embeddable/public/lib/embeddables/i_embeddable.ts +++ b/src/plugins/embeddable/public/lib/embeddables/i_embeddable.ts @@ -16,7 +16,7 @@ export interface EmbeddableError { message: string; } -export { EmbeddableInput }; +export type { EmbeddableInput }; export interface EmbeddableOutput { // Whether the embeddable is actively loading. diff --git a/src/plugins/embeddable/public/lib/embeddables/index.ts b/src/plugins/embeddable/public/lib/embeddables/index.ts index eede745f317941..1745c64c73bf57 100644 --- a/src/plugins/embeddable/public/lib/embeddables/index.ts +++ b/src/plugins/embeddable/public/lib/embeddables/index.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -export { EmbeddableOutput, EmbeddableInput, IEmbeddable } from './i_embeddable'; +export type { EmbeddableOutput, EmbeddableInput, IEmbeddable } from './i_embeddable'; export { isEmbeddable } from './is_embeddable'; export { Embeddable } from './embeddable'; export * from './embeddable_factory'; @@ -16,8 +16,5 @@ export { ErrorEmbeddable, isErrorEmbeddable } from './error_embeddable'; export { withEmbeddableSubscription } from './with_subscription'; export { EmbeddableRoot } from './embeddable_root'; export * from '../../../common/lib/saved_object_embeddable'; -export { - EmbeddableRenderer, - EmbeddableRendererProps, - useEmbeddableFactory, -} from './embeddable_renderer'; +export type { EmbeddableRendererProps } from './embeddable_renderer'; +export { EmbeddableRenderer, useEmbeddableFactory } from './embeddable_renderer'; diff --git a/src/plugins/embeddable/public/lib/reference_or_value_embeddable/index.ts b/src/plugins/embeddable/public/lib/reference_or_value_embeddable/index.ts index a448eb1319ab48..41554e8efce1dc 100644 --- a/src/plugins/embeddable/public/lib/reference_or_value_embeddable/index.ts +++ b/src/plugins/embeddable/public/lib/reference_or_value_embeddable/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { ReferenceOrValueEmbeddable, isReferenceOrValueEmbeddable } from './types'; +export type { ReferenceOrValueEmbeddable } from './types'; +export { isReferenceOrValueEmbeddable } from './types'; diff --git a/src/plugins/embeddable/public/lib/state_transfer/index.ts b/src/plugins/embeddable/public/lib/state_transfer/index.ts index 6643f048d6425d..009b2994f9caa7 100644 --- a/src/plugins/embeddable/public/lib/state_transfer/index.ts +++ b/src/plugins/embeddable/public/lib/state_transfer/index.ts @@ -7,4 +7,4 @@ */ export { EmbeddableStateTransfer } from './embeddable_state_transfer'; -export { EmbeddableEditorState, EmbeddablePackageState } from './types'; +export type { EmbeddableEditorState, EmbeddablePackageState } from './types'; diff --git a/src/plugins/embeddable/public/lib/types.ts b/src/plugins/embeddable/public/lib/types.ts index 2def03c742e7b7..d22bcbd12bef90 100644 --- a/src/plugins/embeddable/public/lib/types.ts +++ b/src/plugins/embeddable/public/lib/types.ts @@ -22,4 +22,4 @@ export interface PropertySpec { value?: string; } export { ViewMode } from '../../common/types'; -export { Adapters }; +export type { Adapters }; diff --git a/src/plugins/embeddable/server/index.ts b/src/plugins/embeddable/server/index.ts index aac081f9467b60..8d88f35a4be224 100644 --- a/src/plugins/embeddable/server/index.ts +++ b/src/plugins/embeddable/server/index.ts @@ -8,8 +8,8 @@ import { EmbeddableServerPlugin, EmbeddableSetup, EmbeddableStart } from './plugin'; -export { EmbeddableSetup, EmbeddableStart }; +export type { EmbeddableSetup, EmbeddableStart }; -export { EnhancementRegistryDefinition, EmbeddableRegistryDefinition } from './types'; +export type { EnhancementRegistryDefinition, EmbeddableRegistryDefinition } from './types'; export const plugin = () => new EmbeddableServerPlugin(); diff --git a/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/components/index.ts b/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/components/index.ts index 75d79a204f141b..a43e7c1b31e45a 100644 --- a/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/components/index.ts +++ b/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/components/index.ts @@ -6,11 +6,11 @@ * Side Public License, v 1. */ +export type { Authorization } from './authorization_provider'; export { AuthorizationProvider, AuthorizationContext, useAuthorizationContext, - Authorization, } from './authorization_provider'; export { WithPrivileges } from './with_privileges'; diff --git a/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/index.ts b/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/index.ts index 9ccbc5a5cd3dfa..57d5cd88d3e4ad 100644 --- a/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/index.ts +++ b/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/index.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +export type { Authorization } from './components'; export { WithPrivileges, NotAuthorizedSection, @@ -14,7 +15,6 @@ export { SectionError, PageError, useAuthorizationContext, - Authorization, } from './components'; -export { Privileges, MissingPrivileges, Error } from './types'; +export type { Privileges, MissingPrivileges, Error } from './types'; diff --git a/src/plugins/es_ui_shared/common/index.ts b/src/plugins/es_ui_shared/common/index.ts index 1c2955b8e5e28a..4f0185ba110d92 100644 --- a/src/plugins/es_ui_shared/common/index.ts +++ b/src/plugins/es_ui_shared/common/index.ts @@ -6,4 +6,7 @@ * Side Public License, v 1. */ -export { Privileges, MissingPrivileges } from '../__packages_do_not_import__/authorization/types'; +export type { + Privileges, + MissingPrivileges, +} from '../__packages_do_not_import__/authorization/types'; diff --git a/src/plugins/es_ui_shared/public/authorization/index.ts b/src/plugins/es_ui_shared/public/authorization/index.ts index b8fb2f45794ee8..8175d6b80d2986 100644 --- a/src/plugins/es_ui_shared/public/authorization/index.ts +++ b/src/plugins/es_ui_shared/public/authorization/index.ts @@ -6,16 +6,18 @@ * Side Public License, v 1. */ +export type { + Error, + MissingPrivileges, + Privileges, + Authorization, +} from '../../__packages_do_not_import__/authorization'; export { AuthorizationContext, AuthorizationProvider, - Error, - MissingPrivileges, NotAuthorizedSection, - Privileges, SectionError, PageError, useAuthorizationContext, WithPrivileges, - Authorization, } from '../../__packages_do_not_import__/authorization'; diff --git a/src/plugins/es_ui_shared/public/components/cron_editor/index.ts b/src/plugins/es_ui_shared/public/components/cron_editor/index.ts index 88176c429fcf3b..bee0bc412fb559 100644 --- a/src/plugins/es_ui_shared/public/components/cron_editor/index.ts +++ b/src/plugins/es_ui_shared/public/components/cron_editor/index.ts @@ -6,5 +6,5 @@ * Side Public License, v 1. */ -export { Frequency } from './types'; +export type { Frequency } from './types'; export { CronEditor } from './cron_editor'; diff --git a/src/plugins/es_ui_shared/public/components/cron_editor/services/index.ts b/src/plugins/es_ui_shared/public/components/cron_editor/services/index.ts index 85d650994b33c0..8988c640cd09ee 100644 --- a/src/plugins/es_ui_shared/public/components/cron_editor/services/index.ts +++ b/src/plugins/es_ui_shared/public/components/cron_editor/services/index.ts @@ -7,10 +7,5 @@ */ export { cronExpressionToParts, cronPartsToExpression } from './cron'; -export { - getOrdinalValue, - getDayName, - getMonthName, - DayOrdinal, - MonthOrdinal, -} from './humanized_numbers'; +export type { DayOrdinal, MonthOrdinal } from './humanized_numbers'; +export { getOrdinalValue, getDayName, getMonthName } from './humanized_numbers'; diff --git a/src/plugins/es_ui_shared/public/components/json_editor/index.ts b/src/plugins/es_ui_shared/public/components/json_editor/index.ts index bf7697523d3fe0..f31f586f1033e7 100644 --- a/src/plugins/es_ui_shared/public/components/json_editor/index.ts +++ b/src/plugins/es_ui_shared/public/components/json_editor/index.ts @@ -8,4 +8,4 @@ export * from './json_editor'; -export { OnJsonEditorUpdateHandler, JsonEditorState } from './use_json'; +export type { OnJsonEditorUpdateHandler, JsonEditorState } from './use_json'; diff --git a/src/plugins/es_ui_shared/public/forms/form_wizard/index.ts b/src/plugins/es_ui_shared/public/forms/form_wizard/index.ts index 6c4912f7e4b333..0f868712553c72 100644 --- a/src/plugins/es_ui_shared/public/forms/form_wizard/index.ts +++ b/src/plugins/es_ui_shared/public/forms/form_wizard/index.ts @@ -10,12 +10,12 @@ export { FormWizard } from './form_wizard'; export { FormWizardStep } from './form_wizard_step'; +export type { Step, Steps } from './form_wizard_context'; export { FormWizardProvider, FormWizardConsumer, useFormWizardContext, - Step, - Steps, } from './form_wizard_context'; -export { FormWizardNav, NavTexts } from './form_wizard_nav'; +export type { NavTexts } from './form_wizard_nav'; +export { FormWizardNav } from './form_wizard_nav'; diff --git a/src/plugins/es_ui_shared/public/forms/multi_content/index.ts b/src/plugins/es_ui_shared/public/forms/multi_content/index.ts index 76ff8a9ff30662..bae46ad0abfd82 100644 --- a/src/plugins/es_ui_shared/public/forms/multi_content/index.ts +++ b/src/plugins/es_ui_shared/public/forms/multi_content/index.ts @@ -13,6 +13,7 @@ export { useContent, } from './multi_content_context'; -export { useMultiContent, HookProps, Content, MultiContent } from './use_multi_content'; +export type { HookProps, Content, MultiContent } from './use_multi_content'; +export { useMultiContent } from './use_multi_content'; export { WithMultiContent } from './with_multi_content'; diff --git a/src/plugins/es_ui_shared/public/index.ts b/src/plugins/es_ui_shared/public/index.ts index 2dc50536ca6311..c21587c9a60408 100644 --- a/src/plugins/es_ui_shared/public/index.ts +++ b/src/plugins/es_ui_shared/public/index.ts @@ -15,37 +15,36 @@ import * as ace from './ace'; import * as GlobalFlyout from './global_flyout'; import * as XJson from './xjson'; -export { JsonEditor, OnJsonEditorUpdateHandler, JsonEditorState } from './components/json_editor'; +export type { OnJsonEditorUpdateHandler, JsonEditorState } from './components/json_editor'; +export { JsonEditor } from './components/json_editor'; export { PageLoading } from './components/page_loading'; export { SectionLoading } from './components/section_loading'; -export { EuiCodeEditor, EuiCodeEditorProps } from './components/code_editor'; -export { Frequency, CronEditor } from './components/cron_editor'; +export type { EuiCodeEditorProps } from './components/code_editor'; +export { EuiCodeEditor } from './components/code_editor'; +export type { Frequency } from './components/cron_editor'; +export { CronEditor } from './components/cron_editor'; -export { +export type { SendRequestConfig, SendRequestResponse, UseRequestConfig, UseRequestResponse, - sendRequest, - useRequest, } from './request'; +export { sendRequest, useRequest } from './request'; export { indices } from './indices'; +export type { Privileges, MissingPrivileges, Error, Authorization } from './authorization'; export { AuthorizationContext, AuthorizationProvider, NotAuthorizedSection, WithPrivileges, - Privileges, - MissingPrivileges, SectionError, PageError, - Error, useAuthorizationContext, - Authorization, } from './authorization'; export { Forms, ace, GlobalFlyout, XJson }; diff --git a/src/plugins/es_ui_shared/public/request/index.ts b/src/plugins/es_ui_shared/public/request/index.ts index da407d00130379..5cfcc77f8e117a 100644 --- a/src/plugins/es_ui_shared/public/request/index.ts +++ b/src/plugins/es_ui_shared/public/request/index.ts @@ -6,5 +6,7 @@ * Side Public License, v 1. */ -export { SendRequestConfig, SendRequestResponse, sendRequest } from './send_request'; -export { UseRequestConfig, UseRequestResponse, useRequest } from './use_request'; +export type { SendRequestConfig, SendRequestResponse } from './send_request'; +export { sendRequest } from './send_request'; +export type { UseRequestConfig, UseRequestResponse } from './use_request'; +export { useRequest } from './use_request'; diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/index.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/index.ts index 8438e5de871bd9..6f2dc768508ec1 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/index.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/index.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -export { useField, InternalFieldConfig } from './use_field'; +export type { InternalFieldConfig } from './use_field'; +export { useField } from './use_field'; export { useForm } from './use_form'; export { useFormData } from './use_form_data'; export { useFormIsModified } from './use_form_is_modified'; diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/lib/index.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/lib/index.ts index 79d1067cd36b2a..0bbaedcf2e90e1 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/lib/index.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/lib/index.ts @@ -6,5 +6,6 @@ * Side Public License, v 1. */ -export { Subject, Subscription } from './subject'; +export type { Subscription } from './subject'; +export { Subject } from './subject'; export * from './utils'; diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts index c57333d788ef5f..cd9bb97cab8d91 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts @@ -7,7 +7,9 @@ */ // eslint-disable-next-line import/no-extraneous-dependencies -export { registerTestBed, TestBed } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test/jest'; +// eslint-disable-next-line import/no-extraneous-dependencies +export { registerTestBed } from '@kbn/test/jest'; // eslint-disable-next-line import/no-extraneous-dependencies export { getRandomString } from '@kbn/test/jest'; diff --git a/src/plugins/expressions/common/expression_functions/specs/index.ts b/src/plugins/expressions/common/expression_functions/specs/index.ts index de9a1dedd82480..0e473e4a79e5a6 100644 --- a/src/plugins/expressions/common/expression_functions/specs/index.ts +++ b/src/plugins/expressions/common/expression_functions/specs/index.ts @@ -17,6 +17,9 @@ export * from './overall_metric'; export * from './derivative'; export * from './moving_average'; export * from './ui_setting'; -export { mapColumn, MapColumnArguments } from './map_column'; -export { math, MathArguments, MathInput } from './math'; -export { mathColumn, MathColumnArguments } from './math_column'; +export type { MapColumnArguments } from './map_column'; +export { mapColumn } from './map_column'; +export type { MathArguments, MathInput } from './math'; +export { math } from './math'; +export type { MathColumnArguments } from './math_column'; +export { mathColumn } from './math_column'; diff --git a/src/plugins/expressions/common/types/index.ts b/src/plugins/expressions/common/types/index.ts index 00a79289c0b5fe..a7fc51d88c236d 100644 --- a/src/plugins/expressions/common/types/index.ts +++ b/src/plugins/expressions/common/types/index.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -export { TypeToString, KnownTypeToString, TypeString, UnmappedTypeStrings } from './common'; +export type { TypeToString, KnownTypeToString, TypeString, UnmappedTypeStrings } from './common'; export * from './style'; export * from './registry'; diff --git a/src/plugins/expressions/server/index.ts b/src/plugins/expressions/server/index.ts index 7c0662ad54e4b0..db94ed6dbd440b 100644 --- a/src/plugins/expressions/server/index.ts +++ b/src/plugins/expressions/server/index.ts @@ -12,7 +12,7 @@ import { PluginInitializerContext } from 'src/core/server'; import { ExpressionsServerPlugin } from './plugin'; -export { ExpressionsServerSetup, ExpressionsServerStart } from './plugin'; +export type { ExpressionsServerSetup, ExpressionsServerStart } from './plugin'; // Kibana Platform. export { ExpressionsServerPlugin as Plugin }; @@ -22,22 +22,18 @@ export function plugin(initializerContext: PluginInitializerContext) { } // Static exports. -export { +export type { AnyExpressionFunctionDefinition, AnyExpressionTypeDefinition, ArgumentType, - buildExpression, - buildExpressionFunction, Datatable, DatatableColumn, DatatableColumnType, DatatableRow, - Execution, ExecutionContainer, ExecutionContext, ExecutionParams, ExecutionState, - Executor, ExecutorContainer, ExecutorState, ExpressionAstArgument, @@ -46,15 +42,10 @@ export { ExpressionAstFunction, ExpressionAstFunctionBuilder, ExpressionAstNode, - ExpressionFunction, ExpressionFunctionDefinition, ExpressionFunctionDefinitions, - ExpressionFunctionParameter, ExpressionImage, ExpressionRenderDefinition, - ExpressionRenderer, - ExpressionRendererRegistry, - ExpressionType, ExpressionTypeDefinition, ExpressionTypeStyle, ExpressionValue, @@ -67,20 +58,11 @@ export { ExpressionValueFilter, Font, FontLabel, - FontStyle, FontValue, - FontWeight, - format, - formatExpression, - FunctionsRegistry, IInterpreterRenderHandlers, InterpreterErrorType, IRegistry, - isExpressionAstBuilder, KnownTypeToString, - Overflow, - parse, - parseExpression, PointSeries, PointSeriesColumn, PointSeriesColumnName, @@ -89,11 +71,31 @@ export { Range, SerializedDatatable, Style, - TextAlignment, - TextDecoration, - TypesRegistry, TypeString, TypeToString, UnmappedTypeStrings, ExpressionValueRender as Render, } from '../common'; +export { + buildExpression, + buildExpressionFunction, + Execution, + Executor, + ExpressionFunction, + ExpressionFunctionParameter, + ExpressionRenderer, + ExpressionRendererRegistry, + ExpressionType, + FontStyle, + FontWeight, + format, + formatExpression, + FunctionsRegistry, + isExpressionAstBuilder, + Overflow, + parse, + parseExpression, + TextAlignment, + TextDecoration, + TypesRegistry, +} from '../common'; diff --git a/src/plugins/field_formats/common/index.ts b/src/plugins/field_formats/common/index.ts index aeb5e0af220db2..5863bf79adcbaf 100644 --- a/src/plugins/field_formats/common/index.ts +++ b/src/plugins/field_formats/common/index.ts @@ -12,7 +12,8 @@ import { FieldFormatsRegistry } from './field_formats_registry'; /** @public */ type IFieldFormatsRegistry = PublicMethodsOf; -export { FieldFormatsRegistry, IFieldFormatsRegistry }; +export type { IFieldFormatsRegistry }; +export { FieldFormatsRegistry }; export { FieldFormat } from './field_format'; export { baseFormatters } from './constants/base_formatters'; export { @@ -39,7 +40,7 @@ export { FORMATS_UI_SETTINGS } from './constants/ui_settings'; export { FIELD_FORMAT_IDS } from './types'; export { HTML_CONTEXT_TYPE, TEXT_CONTEXT_TYPE } from './content_types'; -export { +export type { FieldFormatsGetConfigFn, FieldFormatsContentType, FieldFormatConfig, diff --git a/src/plugins/field_formats/public/index.ts b/src/plugins/field_formats/public/index.ts index f765513fb4c4c4..f4f7019fe772d9 100755 --- a/src/plugins/field_formats/public/index.ts +++ b/src/plugins/field_formats/public/index.ts @@ -12,4 +12,4 @@ export { DateFormat, DateNanosFormat } from './lib/converters'; export function plugin() { return new FieldFormatsPlugin(); } -export { FieldFormatsSetup, FieldFormatsStart } from './plugin'; +export type { FieldFormatsSetup, FieldFormatsStart } from './plugin'; diff --git a/src/plugins/field_formats/server/index.ts b/src/plugins/field_formats/server/index.ts index 44de8fde558ec4..d3cac3bfb00c23 100755 --- a/src/plugins/field_formats/server/index.ts +++ b/src/plugins/field_formats/server/index.ts @@ -14,4 +14,4 @@ export function plugin(initializerContext: PluginInitializerContext) { return new FieldFormatsPlugin(initializerContext); } -export { FieldFormatsSetup, FieldFormatsStart } from './types'; +export type { FieldFormatsSetup, FieldFormatsStart } from './types'; diff --git a/src/plugins/home/public/application/components/add_data/__snapshots__/add_data.test.tsx.snap b/src/plugins/home/public/application/components/add_data/__snapshots__/add_data.test.tsx.snap index de6beab31247a3..fcc4b3e8f1d0f9 100644 --- a/src/plugins/home/public/application/components/add_data/__snapshots__/add_data.test.tsx.snap +++ b/src/plugins/home/public/application/components/add_data/__snapshots__/add_data.test.tsx.snap @@ -83,6 +83,21 @@ exports[`AddData render 1`] = ` /> + + + + + diff --git a/src/plugins/home/public/application/components/add_data/add_data.tsx b/src/plugins/home/public/application/components/add_data/add_data.tsx index 50d6079dd8df3e..ee38b2e6e5d20e 100644 --- a/src/plugins/home/public/application/components/add_data/add_data.tsx +++ b/src/plugins/home/public/application/components/add_data/add_data.tsx @@ -96,6 +96,19 @@ export const AddData: FC = ({ addBasePath, application, isDarkMode }) => /> + + + + + + diff --git a/src/plugins/index_pattern_editor/public/components/index.ts b/src/plugins/index_pattern_editor/public/components/index.ts index c32c4081e973f7..b78ac6946ad943 100644 --- a/src/plugins/index_pattern_editor/public/components/index.ts +++ b/src/plugins/index_pattern_editor/public/components/index.ts @@ -6,10 +6,8 @@ * Side Public License, v 1. */ -export { - IndexPatternEditorFlyoutContent, - Props as IndexPatternEditorFlyoutContentProps, -} from './index_pattern_editor_flyout_content'; +export type { Props as IndexPatternEditorFlyoutContentProps } from './index_pattern_editor_flyout_content'; +export { IndexPatternEditorFlyoutContent } from './index_pattern_editor_flyout_content'; export { IndexPatternEditor } from './index_pattern_editor'; diff --git a/src/plugins/index_pattern_editor/public/shared_imports.ts b/src/plugins/index_pattern_editor/public/shared_imports.ts index c99d32e0c8a28a..7edb7dfd0f599d 100644 --- a/src/plugins/index_pattern_editor/public/shared_imports.ts +++ b/src/plugins/index_pattern_editor/public/shared_imports.ts @@ -6,14 +6,13 @@ * Side Public License, v 1. */ -export { - IndexPattern, - IndexPatternField, +export type { DataPublicPluginStart, IndexPatternSpec, GetFieldsOptions, IndexPatternAggRestrictions, } from '../../data/public'; +export { IndexPattern, IndexPatternField } from '../../data/public'; export { createKibanaReactContext, @@ -22,18 +21,20 @@ export { useKibana, } from '../../kibana_react/public'; +export type { + FormSchema, + FormHook, + ValidationFunc, + FieldConfig, + ValidationConfig, +} from '../../es_ui_shared/static/forms/hook_form_lib'; export { useForm, useFormData, useFormContext, Form, - FormSchema, UseField, - FormHook, - ValidationFunc, - FieldConfig, getFieldValidityAndErrorMessage, - ValidationConfig, } from '../../es_ui_shared/static/forms/hook_form_lib'; export { fieldValidators } from '../../es_ui_shared/static/forms/helpers'; @@ -47,4 +48,4 @@ export { SuperSelectField, } from '../../es_ui_shared/static/forms/components'; -export { HttpStart } from '../../../core/public'; +export type { HttpStart } from '../../../core/public'; diff --git a/src/plugins/index_pattern_editor/public/test_utils/test_utils.ts b/src/plugins/index_pattern_editor/public/test_utils/test_utils.ts index c8e4aedc264716..311d93d31b5935 100644 --- a/src/plugins/index_pattern_editor/public/test_utils/test_utils.ts +++ b/src/plugins/index_pattern_editor/public/test_utils/test_utils.ts @@ -8,4 +8,5 @@ export { getRandomString } from '@kbn/test/jest'; -export { registerTestBed, TestBed } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test/jest'; +export { registerTestBed } from '@kbn/test/jest'; diff --git a/src/plugins/index_pattern_field_editor/__jest__/client_integration/helpers/index.ts b/src/plugins/index_pattern_field_editor/__jest__/client_integration/helpers/index.ts index 6a1f1aa74036a1..e8ff7eb7538f20 100644 --- a/src/plugins/index_pattern_field_editor/__jest__/client_integration/helpers/index.ts +++ b/src/plugins/index_pattern_field_editor/__jest__/client_integration/helpers/index.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -export { findTestSubject, TestBed } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test/jest'; +export { findTestSubject } from '@kbn/test/jest'; export { setupEnvironment, diff --git a/src/plugins/index_pattern_field_editor/kibana.json b/src/plugins/index_pattern_field_editor/kibana.json index 898e7c564e57f6..df09fd56136c3a 100644 --- a/src/plugins/index_pattern_field_editor/kibana.json +++ b/src/plugins/index_pattern_field_editor/kibana.json @@ -5,7 +5,7 @@ "ui": true, "requiredPlugins": ["data"], "optionalPlugins": ["usageCollection"], - "requiredBundles": ["kibanaReact", "esUiShared", "usageCollection", "fieldFormats"], + "requiredBundles": ["kibanaReact", "esUiShared", "fieldFormats"], "owner": { "name": "App Services", "githubTeam": "kibana-app-services" diff --git a/src/plugins/index_pattern_field_editor/public/components/field_editor/form_fields/index.ts b/src/plugins/index_pattern_field_editor/public/components/field_editor/form_fields/index.ts index e958e1362bb054..693709729ed92a 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_editor/form_fields/index.ts +++ b/src/plugins/index_pattern_field_editor/public/components/field_editor/form_fields/index.ts @@ -12,6 +12,7 @@ export { CustomLabelField } from './custom_label_field'; export { PopularityField } from './popularity_field'; -export { ScriptField, ScriptSyntaxError } from './script_field'; +export type { ScriptSyntaxError } from './script_field'; +export { ScriptField } from './script_field'; export { FormatField } from './format_field'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/index.ts b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/index.ts index 31d7e95897090a..4cadb6e837620f 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/index.ts +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/index.ts @@ -9,7 +9,8 @@ import { FieldFormatEditorFactory } from '../types'; import { formatId } from './constants'; -export { defaultState, FormatEditorState } from './default'; +export type { FormatEditorState } from './default'; +export { defaultState } from './default'; export type { FormatEditorProps } from '../types'; export type { DefaultFormatEditor } from './default'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/index.ts b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/index.ts index 34619f53e9eed6..0c23c8de616cfe 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/index.ts +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/index.ts @@ -6,5 +6,6 @@ * Side Public License, v 1. */ -export { FormatSelectEditor, FormatSelectEditorProps } from './field_format_editor'; +export type { FormatSelectEditorProps } from './field_format_editor'; +export { FormatSelectEditor } from './field_format_editor'; export * from './editors'; diff --git a/src/plugins/index_pattern_field_editor/public/components/index.ts b/src/plugins/index_pattern_field_editor/public/components/index.ts index 927e28a8e3adfb..e6fa42a591f5e2 100644 --- a/src/plugins/index_pattern_field_editor/public/components/index.ts +++ b/src/plugins/index_pattern_field_editor/public/components/index.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ -export { getDeleteFieldProvider, Props as DeleteFieldProviderProps } from './delete_field_provider'; +export type { Props as DeleteFieldProviderProps } from './delete_field_provider'; +export { getDeleteFieldProvider } from './delete_field_provider'; export * from './field_format_editor'; diff --git a/src/plugins/index_pattern_field_editor/public/index.ts b/src/plugins/index_pattern_field_editor/public/index.ts index 6546dabcb2c444..55af27fdb29eba 100644 --- a/src/plugins/index_pattern_field_editor/public/index.ts +++ b/src/plugins/index_pattern_field_editor/public/index.ts @@ -25,7 +25,7 @@ export type { PluginStart as IndexPatternFieldEditorStart, } from './types'; export { DefaultFormatEditor } from './components/field_format_editor/editors/default/default'; -export { FieldFormatEditorFactory, FieldFormatEditor, FormatEditorProps } from './components'; +export type { FieldFormatEditorFactory, FieldFormatEditor, FormatEditorProps } from './components'; export function plugin() { return new IndexPatternFieldEditorPlugin(); diff --git a/src/plugins/index_pattern_field_editor/public/lib/index.ts b/src/plugins/index_pattern_field_editor/public/lib/index.ts index 336de9574c460f..d9aaab77ff66ab 100644 --- a/src/plugins/index_pattern_field_editor/public/lib/index.ts +++ b/src/plugins/index_pattern_field_editor/public/lib/index.ts @@ -10,10 +10,8 @@ export { deserializeField } from './serialization'; export { getLinks } from './documentation'; -export { - getRuntimeFieldValidator, - RuntimeFieldPainlessError, - parseEsError, -} from './runtime_field_validation'; +export type { RuntimeFieldPainlessError } from './runtime_field_validation'; +export { getRuntimeFieldValidator, parseEsError } from './runtime_field_validation'; -export { initApi, ApiService } from './api'; +export type { ApiService } from './api'; +export { initApi } from './api'; diff --git a/src/plugins/index_pattern_field_editor/public/shared_imports.ts b/src/plugins/index_pattern_field_editor/public/shared_imports.ts index 2827928d1c060e..e2154800908cb0 100644 --- a/src/plugins/index_pattern_field_editor/public/shared_imports.ts +++ b/src/plugins/index_pattern_field_editor/public/shared_imports.ts @@ -6,27 +6,31 @@ * Side Public License, v 1. */ -export { IndexPattern, IndexPatternField, DataPublicPluginStart } from '../../data/public'; +export type { DataPublicPluginStart } from '../../data/public'; +export { IndexPattern, IndexPatternField } from '../../data/public'; -export { UsageCollectionStart } from '../../usage_collection/public'; +export type { UsageCollectionStart } from '../../usage_collection/public'; -export { RuntimeType, RuntimeField, KBN_FIELD_TYPES, ES_FIELD_TYPES } from '../../data/common'; +export type { RuntimeType, RuntimeField } from '../../data/common'; +export { KBN_FIELD_TYPES, ES_FIELD_TYPES } from '../../data/common'; export { createKibanaReactContext, toMountPoint, CodeEditor } from '../../kibana_react/public'; export { FieldFormat } from '../../field_formats/common'; +export type { + FormSchema, + FormHook, + ValidationFunc, + FieldConfig, +} from '../../es_ui_shared/static/forms/hook_form_lib'; export { useForm, useFormData, useFormContext, useFormIsModified, Form, - FormSchema, UseField, - FormHook, - ValidationFunc, - FieldConfig, } from '../../es_ui_shared/static/forms/hook_form_lib'; export { fieldValidators } from '../../es_ui_shared/static/forms/helpers'; diff --git a/src/plugins/index_pattern_management/public/index.ts b/src/plugins/index_pattern_management/public/index.ts index 45a2f0b5a468b4..65b71ee6053e3b 100644 --- a/src/plugins/index_pattern_management/public/index.ts +++ b/src/plugins/index_pattern_management/public/index.ts @@ -19,7 +19,7 @@ */ import { PluginInitializerContext } from 'src/core/public'; import { IndexPatternManagementPlugin } from './plugin'; -export { IndexPatternManagementSetup, IndexPatternManagementStart } from './plugin'; +export type { IndexPatternManagementSetup, IndexPatternManagementStart } from './plugin'; export function plugin(initializerContext: PluginInitializerContext) { return new IndexPatternManagementPlugin(initializerContext); diff --git a/src/plugins/inspector/common/adapters/request/index.ts b/src/plugins/inspector/common/adapters/request/index.ts index 807f11569ba2cf..d1654ea66b93d5 100644 --- a/src/plugins/inspector/common/adapters/request/index.ts +++ b/src/plugins/inspector/common/adapters/request/index.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ -export { Request, RequestStatistic, RequestStatistics, RequestStatus } from './types'; +export type { Request, RequestStatistic, RequestStatistics } from './types'; +export { RequestStatus } from './types'; export { RequestAdapter } from './request_adapter'; export { RequestResponder } from './request_responder'; diff --git a/src/plugins/inspector/common/index.ts b/src/plugins/inspector/common/index.ts index e92c9b670475a3..995846fadd921f 100644 --- a/src/plugins/inspector/common/index.ts +++ b/src/plugins/inspector/common/index.ts @@ -6,12 +6,5 @@ * Side Public License, v 1. */ -export { - Adapters, - Request, - RequestAdapter, - RequestStatistic, - RequestStatistics, - RequestStatus, - RequestResponder, -} from './adapters'; +export type { Adapters, Request, RequestStatistic, RequestStatistics } from './adapters'; +export { RequestAdapter, RequestStatus, RequestResponder } from './adapters'; diff --git a/src/plugins/inspector/public/index.ts b/src/plugins/inspector/public/index.ts index c611d13c06ca20..5ad7898550974b 100644 --- a/src/plugins/inspector/public/index.ts +++ b/src/plugins/inspector/public/index.ts @@ -18,6 +18,7 @@ export function plugin(initializerContext: PluginInitializerContext) { return new InspectorPublicPlugin(initializerContext); } -export { InspectorPublicPlugin as Plugin, Setup, Start } from './plugin'; +export type { Setup, Start } from './plugin'; +export { InspectorPublicPlugin as Plugin } from './plugin'; export * from './types'; export * from '../common/adapters'; diff --git a/src/plugins/kibana_overview/public/index.ts b/src/plugins/kibana_overview/public/index.ts index eae86edf1d426a..aef16587e3de56 100644 --- a/src/plugins/kibana_overview/public/index.ts +++ b/src/plugins/kibana_overview/public/index.ts @@ -15,4 +15,4 @@ import { KibanaOverviewPlugin } from './plugin'; export function plugin() { return new KibanaOverviewPlugin(); } -export { KibanaOverviewPluginSetup, KibanaOverviewPluginStart } from './types'; +export type { KibanaOverviewPluginSetup, KibanaOverviewPluginStart } from './types'; diff --git a/src/plugins/kibana_react/public/context/index.ts b/src/plugins/kibana_react/public/context/index.ts index b34951b298836e..8647a1414b9dd7 100644 --- a/src/plugins/kibana_react/public/context/index.ts +++ b/src/plugins/kibana_react/public/context/index.ts @@ -13,4 +13,4 @@ export { useKibana, withKibana, } from './context'; -export { KibanaReactContext, KibanaReactContextValue, KibanaServices } from './types'; +export type { KibanaReactContext, KibanaReactContextValue, KibanaServices } from './types'; diff --git a/src/plugins/kibana_react/public/exit_full_screen_button/index.tsx b/src/plugins/kibana_react/public/exit_full_screen_button/index.tsx index d2d7cbc2f570c9..16466f5c0f6a24 100644 --- a/src/plugins/kibana_react/public/exit_full_screen_button/index.tsx +++ b/src/plugins/kibana_react/public/exit_full_screen_button/index.tsx @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { ExitFullScreenButton, ExitFullScreenButtonProps } from './exit_full_screen_button'; +export type { ExitFullScreenButtonProps } from './exit_full_screen_button'; +export { ExitFullScreenButton } from './exit_full_screen_button'; diff --git a/src/plugins/kibana_react/public/index.ts b/src/plugins/kibana_react/public/index.ts index 6fccb804c357fe..03e2bb5f9c272c 100644 --- a/src/plugins/kibana_react/public/index.ts +++ b/src/plugins/kibana_react/public/index.ts @@ -23,7 +23,8 @@ export * from './toolbar_button'; export * from './split_panel'; export * from './react_router_navigate'; export * from './page_template'; -export { ValidatedDualRange, Value } from './validated_range'; +export type { Value } from './validated_range'; +export { ValidatedDualRange } from './validated_range'; export * from './notifications'; export { Markdown, MarkdownSimple } from './markdown'; export { reactToUiComponent, uiToReactComponent } from './adapters'; diff --git a/src/plugins/kibana_react/public/page_template/index.ts b/src/plugins/kibana_react/public/page_template/index.ts index 193dc8cd07eee7..41eeaab01ef39c 100644 --- a/src/plugins/kibana_react/public/page_template/index.ts +++ b/src/plugins/kibana_react/public/page_template/index.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ -export { KibanaPageTemplate, KibanaPageTemplateProps } from './page_template'; +export type { KibanaPageTemplateProps } from './page_template'; +export { KibanaPageTemplate } from './page_template'; export { KibanaPageTemplateSolutionNavAvatar } from './solution_nav'; export * from './no_data_page'; diff --git a/src/plugins/kibana_react/public/page_template/solution_nav/index.ts b/src/plugins/kibana_react/public/page_template/solution_nav/index.ts index 3dace6524fef50..81c2033a7ce7cf 100644 --- a/src/plugins/kibana_react/public/page_template/solution_nav/index.ts +++ b/src/plugins/kibana_react/public/page_template/solution_nav/index.ts @@ -6,12 +6,9 @@ * Side Public License, v 1. */ -export { KibanaPageTemplateSolutionNav, KibanaPageTemplateSolutionNavProps } from './solution_nav'; -export { - KibanaPageTemplateSolutionNavAvatar, - KibanaPageTemplateSolutionNavAvatarProps, -} from './solution_nav_avatar'; -export { - KibanaPageTemplateSolutionNavCollapseButton, - KibanaPageTemplateSolutionNavCollapseButtonProps, -} from './solution_nav_collapse_button'; +export type { KibanaPageTemplateSolutionNavProps } from './solution_nav'; +export { KibanaPageTemplateSolutionNav } from './solution_nav'; +export type { KibanaPageTemplateSolutionNavAvatarProps } from './solution_nav_avatar'; +export { KibanaPageTemplateSolutionNavAvatar } from './solution_nav_avatar'; +export type { KibanaPageTemplateSolutionNavCollapseButtonProps } from './solution_nav_collapse_button'; +export { KibanaPageTemplateSolutionNavCollapseButton } from './solution_nav_collapse_button'; diff --git a/src/plugins/kibana_react/public/validated_range/index.ts b/src/plugins/kibana_react/public/validated_range/index.ts index d5ecfd23382b8f..14f4333cde2400 100644 --- a/src/plugins/kibana_react/public/validated_range/index.ts +++ b/src/plugins/kibana_react/public/validated_range/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { ValidatedDualRange, Value } from './validated_dual_range'; +export type { Value } from './validated_dual_range'; +export { ValidatedDualRange } from './validated_dual_range'; diff --git a/src/plugins/kibana_utils/common/index.ts b/src/plugins/kibana_utils/common/index.ts index be00a13715fc79..365ff52ac9d4b3 100644 --- a/src/plugins/kibana_utils/common/index.ts +++ b/src/plugins/kibana_utils/common/index.ts @@ -16,7 +16,8 @@ export * from './ui'; export * from './state_containers'; export * from './errors'; export { AbortError, abortSignalToPromise } from './abort_utils'; -export { createGetterSetter, Get, Set } from './create_getter_setter'; +export type { Get, Set } from './create_getter_setter'; +export { createGetterSetter } from './create_getter_setter'; export { distinctUntilChangedWithInitialValue } from './distinct_until_changed_with_initial_value'; export { url } from './url'; export { now } from './now'; diff --git a/src/plugins/kibana_utils/common/state_containers/index.ts b/src/plugins/kibana_utils/common/state_containers/index.ts index c96b48cc045b75..8c4d3f87a0681b 100644 --- a/src/plugins/kibana_utils/common/state_containers/index.ts +++ b/src/plugins/kibana_utils/common/state_containers/index.ts @@ -13,7 +13,7 @@ * @packageDocumentation */ -export { +export type { BaseState, BaseStateContainer, TransitionDescription, @@ -37,7 +37,8 @@ export { PureTransition, Transition, } from './types'; -export { createStateContainer, CreateStateContainerOptions } from './create_state_container'; +export type { CreateStateContainerOptions } from './create_state_container'; +export { createStateContainer } from './create_state_container'; export { createStateContainerReactHelpers, useContainerSelector, diff --git a/src/plugins/kibana_utils/index.ts b/src/plugins/kibana_utils/index.ts index ecffc0544c7db7..9b7e91b747db82 100644 --- a/src/plugins/kibana_utils/index.ts +++ b/src/plugins/kibana_utils/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { createStateContainer, StateContainer, of } from './common'; +export type { StateContainer } from './common'; +export { createStateContainer, of } from './common'; diff --git a/src/plugins/kibana_utils/public/index.ts b/src/plugins/kibana_utils/public/index.ts index 0ac4c61f4a7119..090c33e1213706 100644 --- a/src/plugins/kibana_utils/public/index.ts +++ b/src/plugins/kibana_utils/public/index.ts @@ -12,6 +12,7 @@ import { KibanaUtilsPublicPlugin } from './plugin'; // TODO: https://github.com/elastic/kibana/issues/109893 /* eslint-disable @kbn/eslint/no_export_all */ +export type { Get, Set, UiComponent, UiComponentInstance } from '../common'; export { AbortError, abortSignalToPromise, @@ -20,11 +21,7 @@ export { Defer, fieldWildcardFilter, fieldWildcardMatcher, - Get, of, - Set, - UiComponent, - UiComponentInstance, url, createGetterSetter, } from '../common'; @@ -56,11 +53,7 @@ export { replaceUrlQuery, replaceUrlHashQuery, } from './state_management/url'; -export { - syncState, - syncStates, - createKbnUrlStateStorage, - createSessionStorageStateStorage, +export type { IStateSyncConfig, ISyncStateRef, IKbnUrlStateStorage, @@ -69,7 +62,13 @@ export { StartSyncStateFnType, StopSyncStateFnType, } from './state_sync'; -export { Configurable, CollectConfigProps } from './ui'; +export { + syncState, + syncStates, + createKbnUrlStateStorage, + createSessionStorageStateStorage, +} from './state_sync'; +export type { Configurable, CollectConfigProps } from './ui'; export { removeQueryParam, redirectWhenMissing, @@ -79,9 +78,10 @@ export { createQueryParamObservable, } from './history'; export { applyDiff } from './state_management/utils/diff_object'; -export { createStartServicesGetter, StartServicesGetter } from './core/create_start_service_getter'; +export type { StartServicesGetter } from './core/create_start_service_getter'; +export { createStartServicesGetter } from './core/create_start_service_getter'; -export { KibanaUtilsSetup } from './plugin'; +export type { KibanaUtilsSetup } from './plugin'; export function plugin(initializerContext: PluginInitializerContext) { return new KibanaUtilsPublicPlugin(initializerContext); diff --git a/src/plugins/kibana_utils/public/state_management/url/index.ts b/src/plugins/kibana_utils/public/state_management/url/index.ts index b180232b215263..7f39e9ac1b6982 100644 --- a/src/plugins/kibana_utils/public/state_management/url/index.ts +++ b/src/plugins/kibana_utils/public/state_management/url/index.ts @@ -7,12 +7,12 @@ */ export { hashUrl, hashQuery, unhashUrl, unhashQuery } from './hash_unhash_url'; +export type { IKbnUrlControls } from './kbn_url_storage'; export { createKbnUrlControls, setStateToKbnUrl, getStateFromKbnUrl, getStatesFromKbnUrl, - IKbnUrlControls, } from './kbn_url_storage'; export { createKbnUrlTracker } from './kbn_url_tracker'; export { createUrlTracker } from './url_tracker'; diff --git a/src/plugins/kibana_utils/public/state_sync/index.ts b/src/plugins/kibana_utils/public/state_sync/index.ts index 2e14096c239502..603e7582c7b169 100644 --- a/src/plugins/kibana_utils/public/state_sync/index.ts +++ b/src/plugins/kibana_utils/public/state_sync/index.ts @@ -26,18 +26,15 @@ * @packageDocumentation */ -export { - createSessionStorageStateStorage, - createKbnUrlStateStorage, +export type { IKbnUrlStateStorage, ISessionStorageStateStorage, IStateStorage, } from './state_sync_state_storage'; -export { IStateSyncConfig, INullableBaseStateContainer } from './types'; export { - syncState, - syncStates, - StopSyncStateFnType, - StartSyncStateFnType, - ISyncStateRef, -} from './state_sync'; + createSessionStorageStateStorage, + createKbnUrlStateStorage, +} from './state_sync_state_storage'; +export type { IStateSyncConfig, INullableBaseStateContainer } from './types'; +export type { StopSyncStateFnType, StartSyncStateFnType, ISyncStateRef } from './state_sync'; +export { syncState, syncStates } from './state_sync'; diff --git a/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/index.ts b/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/index.ts index 8ac6c4eaaf3d02..55f62b51833799 100644 --- a/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/index.ts +++ b/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/index.ts @@ -6,9 +6,8 @@ * Side Public License, v 1. */ -export { IStateStorage } from './types'; -export { createKbnUrlStateStorage, IKbnUrlStateStorage } from './create_kbn_url_state_storage'; -export { - createSessionStorageStateStorage, - ISessionStorageStateStorage, -} from './create_session_storage_state_storage'; +export type { IStateStorage } from './types'; +export type { IKbnUrlStateStorage } from './create_kbn_url_state_storage'; +export { createKbnUrlStateStorage } from './create_kbn_url_state_storage'; +export type { ISessionStorageStateStorage } from './create_session_storage_state_storage'; +export { createSessionStorageStateStorage } from './create_session_storage_state_storage'; diff --git a/src/plugins/kibana_utils/public/storage/index.ts b/src/plugins/kibana_utils/public/storage/index.ts index 94237411453191..26859bb86107e4 100644 --- a/src/plugins/kibana_utils/public/storage/index.ts +++ b/src/plugins/kibana_utils/public/storage/index.ts @@ -7,4 +7,4 @@ */ export { Storage } from './storage'; -export { IStorage, IStorageWrapper } from './types'; +export type { IStorage, IStorageWrapper } from './types'; diff --git a/src/plugins/kibana_utils/server/index.ts b/src/plugins/kibana_utils/server/index.ts index 42847042be151a..2e4f7c7cc52f18 100644 --- a/src/plugins/kibana_utils/server/index.ts +++ b/src/plugins/kibana_utils/server/index.ts @@ -6,14 +6,13 @@ * Side Public License, v 1. */ +export type { Get, Set } from '../common'; export { AbortError, abortSignalToPromise, createGetterSetter, fieldWildcardFilter, fieldWildcardMatcher, - Get, - Set, url, mergeMigrationFunctionMaps, } from '../common'; diff --git a/src/plugins/management/common/index.ts b/src/plugins/management/common/index.ts index c701ba846bcac0..77ae14c3c1d2d0 100644 --- a/src/plugins/management/common/index.ts +++ b/src/plugins/management/common/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { ManagementAppLocator } from './locator'; +export type { ManagementAppLocator } from './locator'; diff --git a/src/plugins/management/public/components/management_app/index.ts b/src/plugins/management/public/components/management_app/index.ts index 1a5cc3945344f6..aa768e38379226 100644 --- a/src/plugins/management/public/components/management_app/index.ts +++ b/src/plugins/management/public/components/management_app/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { ManagementApp, ManagementAppDependencies } from './management_app'; +export type { ManagementAppDependencies } from './management_app'; +export { ManagementApp } from './management_app'; diff --git a/src/plugins/management/public/index.ts b/src/plugins/management/public/index.ts index 2f5550acbaf6be..41d244ad44d5a3 100644 --- a/src/plugins/management/public/index.ts +++ b/src/plugins/management/public/index.ts @@ -13,9 +13,10 @@ export function plugin(initializerContext: PluginInitializerContext) { return new ManagementPlugin(initializerContext); } -export { RegisterManagementAppArgs, ManagementSection, ManagementApp } from './utils'; +export type { RegisterManagementAppArgs } from './utils'; +export { ManagementSection, ManagementApp } from './utils'; -export { +export type { ManagementAppMountParams, ManagementSetup, ManagementStart, diff --git a/src/plugins/management/public/utils/index.ts b/src/plugins/management/public/utils/index.ts index c51c6b050753af..4bdf6979c28f24 100644 --- a/src/plugins/management/public/utils/index.ts +++ b/src/plugins/management/public/utils/index.ts @@ -7,5 +7,7 @@ */ export { MANAGEMENT_BREADCRUMB } from './breadcrumbs'; -export { ManagementApp, RegisterManagementAppArgs } from './management_app'; -export { ManagementSection, RegisterManagementSectionArgs } from './management_section'; +export type { RegisterManagementAppArgs } from './management_app'; +export { ManagementApp } from './management_app'; +export type { RegisterManagementSectionArgs } from './management_section'; +export { ManagementSection } from './management_section'; diff --git a/src/plugins/maps_ems/public/index.ts b/src/plugins/maps_ems/public/index.ts index a4a0fc45d91649..74b831e058801d 100644 --- a/src/plugins/maps_ems/public/index.ts +++ b/src/plugins/maps_ems/public/index.ts @@ -12,7 +12,7 @@ import { IServiceSettings } from './service_settings'; import type { MapsEmsConfig } from '../config'; /** @public */ -export { +export type { VectorLayer, FileLayerField, FileLayer, diff --git a/src/plugins/navigation/public/index.ts b/src/plugins/navigation/public/index.ts index 21d63c72cdd628..91b68ecab644b1 100644 --- a/src/plugins/navigation/public/index.ts +++ b/src/plugins/navigation/public/index.ts @@ -13,9 +13,10 @@ export function plugin(initializerContext: PluginInitializerContext) { return new NavigationPublicPlugin(initializerContext); } -export { TopNavMenuData, TopNavMenu, TopNavMenuProps } from './top_nav_menu'; +export type { TopNavMenuData, TopNavMenuProps } from './top_nav_menu'; +export { TopNavMenu } from './top_nav_menu'; -export { NavigationPublicPluginSetup, NavigationPublicPluginStart } from './types'; +export type { NavigationPublicPluginSetup, NavigationPublicPluginStart } from './types'; // Export plugin after all other imports import { NavigationPublicPlugin } from './plugin'; diff --git a/src/plugins/navigation/public/top_nav_menu/index.ts b/src/plugins/navigation/public/top_nav_menu/index.ts index 19f359e60ba7aa..16c92aaaaf7122 100644 --- a/src/plugins/navigation/public/top_nav_menu/index.ts +++ b/src/plugins/navigation/public/top_nav_menu/index.ts @@ -7,9 +7,8 @@ */ export { createTopNav } from './create_top_nav_menu'; -export { TopNavMenu, TopNavMenuProps } from './top_nav_menu'; -export { TopNavMenuData } from './top_nav_menu_data'; -export { - TopNavMenuExtensionsRegistrySetup, - TopNavMenuExtensionsRegistry, -} from './top_nav_menu_extensions_registry'; +export type { TopNavMenuProps } from './top_nav_menu'; +export { TopNavMenu } from './top_nav_menu'; +export type { TopNavMenuData } from './top_nav_menu_data'; +export type { TopNavMenuExtensionsRegistrySetup } from './top_nav_menu_extensions_registry'; +export { TopNavMenuExtensionsRegistry } from './top_nav_menu_extensions_registry'; diff --git a/src/plugins/newsfeed/public/index.ts b/src/plugins/newsfeed/public/index.ts index 324306f889d15a..f9d59ca6d99dd3 100644 --- a/src/plugins/newsfeed/public/index.ts +++ b/src/plugins/newsfeed/public/index.ts @@ -15,13 +15,8 @@ import { import { FetchResult, NewsfeedItem } from './types'; import { NewsfeedApiEndpoint } from './lib/api'; -export { - NewsfeedPublicPluginSetup, - NewsfeedPublicPluginStart, - FetchResult, - NewsfeedItem, - NewsfeedApiEndpoint, -}; +export type { NewsfeedPublicPluginSetup, NewsfeedPublicPluginStart, FetchResult, NewsfeedItem }; +export { NewsfeedApiEndpoint }; export function plugin(initializerContext: PluginInitializerContext) { return new NewsfeedPublicPlugin(initializerContext); diff --git a/src/plugins/presentation_util/public/components/controls/control_group/index.ts b/src/plugins/presentation_util/public/components/controls/control_group/index.ts index 45a91a87a7962d..95988d2e8143c9 100644 --- a/src/plugins/presentation_util/public/components/controls/control_group/index.ts +++ b/src/plugins/presentation_util/public/components/controls/control_group/index.ts @@ -6,6 +6,6 @@ * Side Public License, v 1. */ -export { ControlGroupInput, ControlGroupOutput } from './types'; +export type { ControlGroupInput, ControlGroupOutput } from './types'; export type { ControlGroupContainer } from './embeddable/control_group_container'; export { ControlGroupContainerFactory } from './embeddable/control_group_container_factory'; diff --git a/src/plugins/presentation_util/public/components/solution_toolbar/items/index.ts b/src/plugins/presentation_util/public/components/solution_toolbar/items/index.ts index 654831e86d3f68..6076dbf8cf1235 100644 --- a/src/plugins/presentation_util/public/components/solution_toolbar/items/index.ts +++ b/src/plugins/presentation_util/public/components/solution_toolbar/items/index.ts @@ -9,6 +9,7 @@ export { SolutionToolbarButton } from './button'; export { SolutionToolbarPopover } from './popover'; export { AddFromLibraryButton } from './add_from_library'; -export { QuickButtonProps, QuickButtonGroup } from './quick_group'; +export type { QuickButtonProps } from './quick_group'; +export { QuickButtonGroup } from './quick_group'; export { PrimaryActionButton } from './primary_button'; export { PrimaryActionPopover } from './primary_popover'; diff --git a/src/plugins/presentation_util/public/index.ts b/src/plugins/presentation_util/public/index.ts index 478e8a7cda032b..91f1e3a937f62f 100644 --- a/src/plugins/presentation_util/public/index.ts +++ b/src/plugins/presentation_util/public/index.ts @@ -11,26 +11,25 @@ import { PresentationUtilPlugin } from './plugin'; -export { +export type { PresentationCapabilitiesService, PresentationDashboardsService, PresentationLabsService, - getStubPluginServices, } from './services'; +export { getStubPluginServices } from './services'; -export { +export type { KibanaPluginServiceFactory, PluginServiceFactory, - PluginServices, PluginServiceProviders, - PluginServiceProvider, - PluginServiceRegistry, KibanaPluginServiceParams, } from './services/create'; +export { PluginServices, PluginServiceProvider, PluginServiceRegistry } from './services/create'; -export { PresentationUtilPluginSetup, PresentationUtilPluginStart } from './types'; -export { SaveModalDashboardProps } from './components/types'; -export { projectIDs, ProjectID, Project } from '../common/labs'; +export type { PresentationUtilPluginSetup, PresentationUtilPluginStart } from './types'; +export type { SaveModalDashboardProps } from './components/types'; +export type { ProjectID, Project } from '../common/labs'; +export { projectIDs } from '../common/labs'; export * from '../common/lib'; export { @@ -43,12 +42,12 @@ export { export * from './components/types'; +export type { QuickButtonProps } from './components/solution_toolbar'; export { AddFromLibraryButton, PrimaryActionButton, PrimaryActionPopover, QuickButtonGroup, - QuickButtonProps, SolutionToolbar, SolutionToolbarButton, SolutionToolbarPopover, diff --git a/src/plugins/presentation_util/public/services/create/index.ts b/src/plugins/presentation_util/public/services/create/index.ts index 163e25e26babfa..d616d7bee20c89 100644 --- a/src/plugins/presentation_util/public/services/create/index.ts +++ b/src/plugins/presentation_util/public/services/create/index.ts @@ -9,8 +9,9 @@ import { PluginServiceRegistry } from './registry'; export { PluginServiceRegistry } from './registry'; -export { PluginServiceProvider, PluginServiceProviders } from './provider'; -export { +export type { PluginServiceProviders } from './provider'; +export { PluginServiceProvider } from './provider'; +export type { PluginServiceFactory, KibanaPluginServiceFactory, KibanaPluginServiceParams, diff --git a/src/plugins/presentation_util/public/services/index.ts b/src/plugins/presentation_util/public/services/index.ts index c7d8d2617888a2..cafb01594bd3c7 100644 --- a/src/plugins/presentation_util/public/services/index.ts +++ b/src/plugins/presentation_util/public/services/index.ts @@ -17,9 +17,9 @@ import { PresentationControlsService } from './controls'; import { PresentationDataViewsService } from './data_views'; import { PresentationDataService } from './data'; -export { PresentationCapabilitiesService } from './capabilities'; -export { PresentationDashboardsService } from './dashboards'; -export { PresentationLabsService } from './labs'; +export type { PresentationCapabilitiesService } from './capabilities'; +export type { PresentationDashboardsService } from './dashboards'; +export type { PresentationLabsService } from './labs'; export interface PresentationUtilServices { dashboards: PresentationDashboardsService; dataViews: PresentationDataViewsService; diff --git a/src/plugins/presentation_util/public/services/storybook/index.ts b/src/plugins/presentation_util/public/services/storybook/index.ts index 1639316a1fe19f..a2d729f6d730a4 100644 --- a/src/plugins/presentation_util/public/services/storybook/index.ts +++ b/src/plugins/presentation_util/public/services/storybook/index.ts @@ -21,8 +21,9 @@ import { controlsServiceFactory } from './controls'; import { dataViewsServiceFactory } from './data_views'; import { dataServiceFactory } from './data'; -export { PluginServiceProviders, PluginServiceProvider, PluginServiceRegistry } from '../create'; -export { PresentationUtilServices } from '..'; +export type { PluginServiceProviders } from '../create'; +export { PluginServiceProvider, PluginServiceRegistry } from '../create'; +export type { PresentationUtilServices } from '..'; export interface StorybookParams { canAccessDashboards?: boolean; diff --git a/src/plugins/saved_objects/public/finder/index.ts b/src/plugins/saved_objects/public/finder/index.ts index de6a54795fce51..aaf6259daca1d6 100644 --- a/src/plugins/saved_objects/public/finder/index.ts +++ b/src/plugins/saved_objects/public/finder/index.ts @@ -6,9 +6,5 @@ * Side Public License, v 1. */ -export { - SavedObjectMetaData, - SavedObjectFinderUi, - SavedObjectFinderUiProps, - getSavedObjectFinder, -} from './saved_object_finder'; +export type { SavedObjectMetaData, SavedObjectFinderUiProps } from './saved_object_finder'; +export { SavedObjectFinderUi, getSavedObjectFinder } from './saved_object_finder'; diff --git a/src/plugins/saved_objects/public/index.ts b/src/plugins/saved_objects/public/index.ts index bc84298a63717f..d63e20f5f56735 100644 --- a/src/plugins/saved_objects/public/index.ts +++ b/src/plugins/saved_objects/public/index.ts @@ -8,33 +8,24 @@ import { SavedObjectsPublicPlugin } from './plugin'; -export { - OnSaveProps, - SavedObjectSaveModal, - SavedObjectSaveModalOrigin, - OriginSaveModalProps, - SaveModalState, - SaveResult, - showSaveModal, -} from './save_modal'; -export { - getSavedObjectFinder, - SavedObjectFinderUi, - SavedObjectFinderUiProps, - SavedObjectMetaData, -} from './finder'; +export type { OnSaveProps, OriginSaveModalProps, SaveModalState, SaveResult } from './save_modal'; +export { SavedObjectSaveModal, SavedObjectSaveModalOrigin, showSaveModal } from './save_modal'; +export type { SavedObjectFinderUiProps, SavedObjectMetaData } from './finder'; +export { getSavedObjectFinder, SavedObjectFinderUi } from './finder'; +export type { + SavedObjectLoaderFindOptions, + SavedObjectDecorator, + SavedObjectDecoratorFactory, + SavedObjectDecoratorConfig, +} from './saved_object'; export { SavedObjectLoader, - SavedObjectLoaderFindOptions, checkForDuplicateTitle, saveWithConfirmation, isErrorNonFatal, - SavedObjectDecorator, - SavedObjectDecoratorFactory, - SavedObjectDecoratorConfig, } from './saved_object'; -export { SavedObjectSaveOpts, SavedObject, SavedObjectConfig } from './types'; +export type { SavedObjectSaveOpts, SavedObject, SavedObjectConfig } from './types'; export { PER_PAGE_SETTING, LISTING_LIMIT_SETTING } from '../common'; -export { SavedObjectsStart, SavedObjectSetup } from './plugin'; +export type { SavedObjectsStart, SavedObjectSetup } from './plugin'; export const plugin = () => new SavedObjectsPublicPlugin(); diff --git a/src/plugins/saved_objects/public/save_modal/index.ts b/src/plugins/saved_objects/public/save_modal/index.ts index cd10374e573438..8c23b797a05db1 100644 --- a/src/plugins/saved_objects/public/save_modal/index.ts +++ b/src/plugins/saved_objects/public/save_modal/index.ts @@ -6,6 +6,9 @@ * Side Public License, v 1. */ -export { SavedObjectSaveModal, OnSaveProps, SaveModalState } from './saved_object_save_modal'; -export { SavedObjectSaveModalOrigin, OriginSaveModalProps } from './saved_object_save_modal_origin'; -export { showSaveModal, SaveResult } from './show_saved_object_save_modal'; +export type { OnSaveProps, SaveModalState } from './saved_object_save_modal'; +export { SavedObjectSaveModal } from './saved_object_save_modal'; +export type { OriginSaveModalProps } from './saved_object_save_modal_origin'; +export { SavedObjectSaveModalOrigin } from './saved_object_save_modal_origin'; +export type { SaveResult } from './show_saved_object_save_modal'; +export { showSaveModal } from './show_saved_object_save_modal'; diff --git a/src/plugins/saved_objects/public/saved_object/decorators/index.ts b/src/plugins/saved_objects/public/saved_object/decorators/index.ts index d7aed32b5e2e77..1b43ae9808bf75 100644 --- a/src/plugins/saved_objects/public/saved_object/decorators/index.ts +++ b/src/plugins/saved_objects/public/saved_object/decorators/index.ts @@ -6,9 +6,6 @@ * Side Public License, v 1. */ -export { - ISavedObjectDecoratorRegistry, - SavedObjectDecoratorRegistry, - SavedObjectDecoratorConfig, -} from './registry'; -export { SavedObjectDecorator, SavedObjectDecoratorFactory } from './types'; +export type { ISavedObjectDecoratorRegistry, SavedObjectDecoratorConfig } from './registry'; +export { SavedObjectDecoratorRegistry } from './registry'; +export type { SavedObjectDecorator, SavedObjectDecoratorFactory } from './types'; diff --git a/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/index.ts b/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/index.ts index b8a7b7ecc31a1e..9a52f9b0e8458a 100644 --- a/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/index.ts +++ b/src/plugins/saved_objects/public/saved_object/helpers/field_mapping/index.ts @@ -6,5 +6,5 @@ * Side Public License, v 1. */ -export { FieldMappingSpec, MappingObject } from './types'; +export type { FieldMappingSpec, MappingObject } from './types'; export { expandShorthand } from './mapping_setup'; diff --git a/src/plugins/saved_objects/public/saved_object/index.ts b/src/plugins/saved_objects/public/saved_object/index.ts index 116999afb71aed..f30730a1c39ac9 100644 --- a/src/plugins/saved_objects/public/saved_object/index.ts +++ b/src/plugins/saved_objects/public/saved_object/index.ts @@ -7,13 +7,14 @@ */ export { createSavedObjectClass } from './saved_object'; -export { SavedObjectLoader, SavedObjectLoaderFindOptions } from './saved_object_loader'; +export type { SavedObjectLoaderFindOptions } from './saved_object_loader'; +export { SavedObjectLoader } from './saved_object_loader'; export { checkForDuplicateTitle } from './helpers/check_for_duplicate_title'; export { saveWithConfirmation } from './helpers/save_with_confirmation'; export { isErrorNonFatal } from './helpers/save_saved_object'; -export { - SavedObjectDecoratorRegistry, +export type { SavedObjectDecoratorFactory, SavedObjectDecorator, SavedObjectDecoratorConfig, } from './decorators'; +export { SavedObjectDecoratorRegistry } from './decorators'; diff --git a/src/plugins/saved_objects_management/public/index.ts b/src/plugins/saved_objects_management/public/index.ts index 92e01ab903699a..99ffae349bb487 100644 --- a/src/plugins/saved_objects_management/public/index.ts +++ b/src/plugins/saved_objects_management/public/index.ts @@ -9,18 +9,22 @@ import { PluginInitializerContext } from 'kibana/public'; import { SavedObjectsManagementPlugin } from './plugin'; -export { SavedObjectsManagementPluginSetup, SavedObjectsManagementPluginStart } from './plugin'; -export { +export type { + SavedObjectsManagementPluginSetup, + SavedObjectsManagementPluginStart, +} from './plugin'; +export type { SavedObjectsManagementActionServiceSetup, SavedObjectsManagementActionServiceStart, - SavedObjectsManagementAction, SavedObjectsManagementColumnServiceSetup, SavedObjectsManagementColumnServiceStart, SavedObjectsManagementColumn, SavedObjectsManagementRecord, } from './services'; -export { ProcessedImportResponse, processImportResponse, FailedImport } from './lib'; -export { SavedObjectRelation, SavedObjectWithMetadata, SavedObjectMetadata } from './types'; +export { SavedObjectsManagementAction } from './services'; +export type { ProcessedImportResponse, FailedImport } from './lib'; +export { processImportResponse } from './lib'; +export type { SavedObjectRelation, SavedObjectWithMetadata, SavedObjectMetadata } from './types'; export function plugin(initializerContext: PluginInitializerContext) { return new SavedObjectsManagementPlugin(); diff --git a/src/plugins/saved_objects_management/public/lib/index.ts b/src/plugins/saved_objects_management/public/lib/index.ts index e317bb5e39f735..258387c39ecd97 100644 --- a/src/plugins/saved_objects_management/public/lib/index.ts +++ b/src/plugins/saved_objects_management/public/lib/index.ts @@ -14,14 +14,12 @@ export { getSavedObjectLabel } from './get_saved_object_label'; export { importFile } from './import_file'; export { parseQuery } from './parse_query'; export { resolveImportErrors } from './resolve_import_errors'; -export { - processImportResponse, - ProcessedImportResponse, - FailedImport, -} from './process_import_response'; +export type { ProcessedImportResponse, FailedImport } from './process_import_response'; +export { processImportResponse } from './process_import_response'; export { getDefaultTitle } from './get_default_title'; export { findObjects } from './find_objects'; export { bulkGetObjects } from './bulk_get_objects'; -export { extractExportDetails, SavedObjectsExportResultDetails } from './extract_export_details'; +export type { SavedObjectsExportResultDetails } from './extract_export_details'; +export { extractExportDetails } from './extract_export_details'; export { getAllowedTypes } from './get_allowed_types'; export { getTagFindReferences } from './get_tag_references'; diff --git a/src/plugins/saved_objects_management/public/services/index.ts b/src/plugins/saved_objects_management/public/services/index.ts index f3c0100d615999..c45c81d3122adf 100644 --- a/src/plugins/saved_objects_management/public/services/index.ts +++ b/src/plugins/saved_objects_management/public/services/index.ts @@ -6,18 +6,15 @@ * Side Public License, v 1. */ -export { - SavedObjectsManagementActionService, +export type { SavedObjectsManagementActionServiceStart, SavedObjectsManagementActionServiceSetup, } from './action_service'; -export { - SavedObjectsManagementColumnService, +export { SavedObjectsManagementActionService } from './action_service'; +export type { SavedObjectsManagementColumnServiceStart, SavedObjectsManagementColumnServiceSetup, } from './column_service'; -export { - SavedObjectsManagementAction, - SavedObjectsManagementColumn, - SavedObjectsManagementRecord, -} from './types'; +export { SavedObjectsManagementColumnService } from './column_service'; +export type { SavedObjectsManagementColumn, SavedObjectsManagementRecord } from './types'; +export { SavedObjectsManagementAction } from './types'; diff --git a/src/plugins/saved_objects_management/public/services/types/index.ts b/src/plugins/saved_objects_management/public/services/types/index.ts index 457ade0a295e7c..82b45f9df33f08 100644 --- a/src/plugins/saved_objects_management/public/services/types/index.ts +++ b/src/plugins/saved_objects_management/public/services/types/index.ts @@ -7,5 +7,5 @@ */ export { SavedObjectsManagementAction } from './action'; -export { SavedObjectsManagementColumn } from './column'; -export { SavedObjectsManagementRecord } from './record'; +export type { SavedObjectsManagementColumn } from './column'; +export type { SavedObjectsManagementRecord } from './record'; diff --git a/src/plugins/saved_objects_management/public/types.ts b/src/plugins/saved_objects_management/public/types.ts index cd6e3e9eaa32c1..61766e1cb8c10b 100644 --- a/src/plugins/saved_objects_management/public/types.ts +++ b/src/plugins/saved_objects_management/public/types.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -export { +export type { SavedObjectMetadata, SavedObjectWithMetadata, SavedObjectRelationKind, diff --git a/src/plugins/saved_objects_management/server/index.ts b/src/plugins/saved_objects_management/server/index.ts index b56382113e1eaa..942d7b0734aee1 100644 --- a/src/plugins/saved_objects_management/server/index.ts +++ b/src/plugins/saved_objects_management/server/index.ts @@ -12,7 +12,7 @@ import { SavedObjectsManagementPlugin } from './plugin'; export const plugin = (context: PluginInitializerContext) => new SavedObjectsManagementPlugin(context); -export { +export type { SavedObjectsManagementPluginSetup, SavedObjectsManagementPluginStart, SavedObjectMetadata, diff --git a/src/plugins/saved_objects_management/server/services/index.ts b/src/plugins/saved_objects_management/server/services/index.ts index 7bee337f59a98c..f0f6d9e7fa9787 100644 --- a/src/plugins/saved_objects_management/server/services/index.ts +++ b/src/plugins/saved_objects_management/server/services/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { SavedObjectsManagement, ISavedObjectsManagement } from './management'; +export type { ISavedObjectsManagement } from './management'; +export { SavedObjectsManagement } from './management'; diff --git a/src/plugins/saved_objects_management/server/types.ts b/src/plugins/saved_objects_management/server/types.ts index 5779c6d98e35da..93f6f3d09547ab 100644 --- a/src/plugins/saved_objects_management/server/types.ts +++ b/src/plugins/saved_objects_management/server/types.ts @@ -12,7 +12,7 @@ export interface SavedObjectsManagementPluginSetup {} // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface SavedObjectsManagementPluginStart {} -export { +export type { SavedObjectMetadata, SavedObjectWithMetadata, SavedObjectRelationKind, diff --git a/src/plugins/saved_objects_tagging_oss/common/index.ts b/src/plugins/saved_objects_tagging_oss/common/index.ts index a892f41c69314c..0a8bd890614b75 100644 --- a/src/plugins/saved_objects_tagging_oss/common/index.ts +++ b/src/plugins/saved_objects_tagging_oss/common/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { Tag, TagAttributes, GetAllTagsOptions, ITagsClient } from './types'; +export type { Tag, TagAttributes, GetAllTagsOptions, ITagsClient } from './types'; diff --git a/src/plugins/saved_objects_tagging_oss/public/decorator/index.ts b/src/plugins/saved_objects_tagging_oss/public/decorator/index.ts index 6ea905b1db245e..7ca7c50505f27e 100644 --- a/src/plugins/saved_objects_tagging_oss/public/decorator/index.ts +++ b/src/plugins/saved_objects_tagging_oss/public/decorator/index.ts @@ -10,7 +10,7 @@ import { SavedObjectDecoratorConfig } from '../../../saved_objects/public'; import { tagDecoratorFactory, decoratorId } from './factory'; import { InternalTagDecoratedSavedObject } from './types'; -export { TagDecoratedSavedObject } from './types'; +export type { TagDecoratedSavedObject } from './types'; export const tagDecoratorConfig: SavedObjectDecoratorConfig = { id: decoratorId, diff --git a/src/plugins/saved_objects_tagging_oss/public/index.ts b/src/plugins/saved_objects_tagging_oss/public/index.ts index eb38614f905399..6e9a0bf3d832e5 100644 --- a/src/plugins/saved_objects_tagging_oss/public/index.ts +++ b/src/plugins/saved_objects_tagging_oss/public/index.ts @@ -9,9 +9,9 @@ import { PluginInitializerContext } from '../../../../src/core/public'; import { SavedObjectTaggingOssPlugin } from './plugin'; -export { SavedObjectTaggingOssPluginSetup, SavedObjectTaggingOssPluginStart } from './types'; +export type { SavedObjectTaggingOssPluginSetup, SavedObjectTaggingOssPluginStart } from './types'; -export { +export type { SavedObjectsTaggingApi, SavedObjectsTaggingApiUi, SavedObjectsTaggingApiUiComponent, @@ -25,7 +25,7 @@ export { SavedObjectTagDecoratorTypeGuard, } from './api'; -export { TagDecoratedSavedObject } from './decorator'; +export type { TagDecoratedSavedObject } from './decorator'; export const plugin = (initializerContext: PluginInitializerContext) => new SavedObjectTaggingOssPlugin(initializerContext); diff --git a/src/plugins/screenshot_mode/public/index.ts b/src/plugins/screenshot_mode/public/index.ts index 012f57e837f416..591ddbfdf49c5e 100644 --- a/src/plugins/screenshot_mode/public/index.ts +++ b/src/plugins/screenshot_mode/public/index.ts @@ -18,4 +18,4 @@ export { KBN_SCREENSHOT_MODE_ENABLED_KEY, } from '../common'; -export { ScreenshotModePluginSetup, ScreenshotModePluginStart } from './types'; +export type { ScreenshotModePluginSetup, ScreenshotModePluginStart } from './types'; diff --git a/src/plugins/screenshot_mode/server/index.ts b/src/plugins/screenshot_mode/server/index.ts index b9f19a474ccbe3..cc5d45b7be7327 100644 --- a/src/plugins/screenshot_mode/server/index.ts +++ b/src/plugins/screenshot_mode/server/index.ts @@ -14,7 +14,7 @@ export { KBN_SCREENSHOT_MODE_ENABLED_KEY, } from '../common'; -export { +export type { ScreenshotModeRequestHandlerContext, ScreenshotModePluginSetup, ScreenshotModePluginStart, diff --git a/src/plugins/share/common/index.ts b/src/plugins/share/common/index.ts index 992ec2447855f2..0269dda43b9c5d 100644 --- a/src/plugins/share/common/index.ts +++ b/src/plugins/share/common/index.ts @@ -6,5 +6,6 @@ * Side Public License, v 1. */ -export { LocatorDefinition, LocatorPublic, useLocatorUrl, formatSearchParams } from './url_service'; +export type { LocatorDefinition, LocatorPublic } from './url_service'; +export { useLocatorUrl } from './url_service'; export type { AnonymousAccessServiceContract, AnonymousAccessState } from './anonymous_access'; diff --git a/src/plugins/share/common/url_service/locators/locator.ts b/src/plugins/share/common/url_service/locators/locator.ts index 2d33f701df5953..2bacdd67875bd7 100644 --- a/src/plugins/share/common/url_service/locators/locator.ts +++ b/src/plugins/share/common/url_service/locators/locator.ts @@ -118,11 +118,9 @@ export class Locator

implements LocatorPublic

{ }); } - /* eslint-disable react-hooks/rules-of-hooks */ public readonly useUrl = ( params: P, getUrlParams?: LocatorGetUrlParams, deps: DependencyList = [] ): string => useLocatorUrl

(this, params, getUrlParams, deps); - /* eslint-enable react-hooks/rules-of-hooks */ } diff --git a/src/plugins/share/public/index.ts b/src/plugins/share/public/index.ts index 75f541dd5ae3d2..2e57a9347b0572 100644 --- a/src/plugins/share/public/index.ts +++ b/src/plugins/share/public/index.ts @@ -10,13 +10,13 @@ import type { PluginInitializerContext } from 'src/core/public'; export { CSV_QUOTE_VALUES_SETTING, CSV_SEPARATOR_SETTING } from '../common/constants'; -export { LocatorDefinition, LocatorPublic, KibanaLocation } from '../common/url_service'; +export type { LocatorDefinition, LocatorPublic, KibanaLocation } from '../common/url_service'; -export { UrlGeneratorStateMapping } from './url_generators/url_generator_definition'; +export type { UrlGeneratorStateMapping } from './url_generators/url_generator_definition'; -export { SharePluginSetup, SharePluginStart } from './plugin'; +export type { SharePluginSetup, SharePluginStart } from './plugin'; -export { +export type { ShareContext, ShareMenuProvider, ShareMenuItem, @@ -24,15 +24,15 @@ export { ShareContextMenuPanelItem, } from './types'; -export { +export type { UrlGeneratorId, UrlGeneratorState, UrlGeneratorsDefinition, UrlGeneratorContract, - UrlGeneratorsService, } from './url_generators'; +export { UrlGeneratorsService } from './url_generators'; -export { RedirectOptions } from '../common/url_service'; +export type { RedirectOptions } from '../common/url_service'; export { useLocatorUrl } from '../common/url_service/locators/use_locator_url'; import { SharePlugin } from './plugin'; diff --git a/src/plugins/share/public/url_generators/url_generator_contract.ts b/src/plugins/share/public/url_generators/url_generator_contract.ts index b21e0f2a35c881..22ccae8909a697 100644 --- a/src/plugins/share/public/url_generators/url_generator_contract.ts +++ b/src/plugins/share/public/url_generators/url_generator_contract.ts @@ -12,8 +12,4 @@ export interface UrlGeneratorContract { id: Id; createUrl(state: UrlGeneratorStateMapping[Id]['State']): Promise; isDeprecated: boolean; - migrate(state: UrlGeneratorStateMapping[Id]['State']): Promise<{ - state: UrlGeneratorStateMapping[Id]['MigratedState']; - id: UrlGeneratorStateMapping[Id]['MigratedId']; - }>; } diff --git a/src/plugins/share/public/url_generators/url_generator_internal.ts b/src/plugins/share/public/url_generators/url_generator_internal.ts index 9059a26566f921..7f7dc0f63f87b1 100644 --- a/src/plugins/share/public/url_generators/url_generator_internal.ts +++ b/src/plugins/share/public/url_generators/url_generator_internal.ts @@ -72,17 +72,6 @@ export class UrlGeneratorInternal { return this.spec.createUrl!(state); }, isDeprecated: !!this.spec.isDeprecated, - migrate: async (state: UrlGeneratorStateMapping[Id]['State']) => { - if (!this.spec.isDeprecated) { - throw new Error( - i18n.translate('share.urlGenerators.error.migrateCalledNotDeprecated', { - defaultMessage: 'You cannot call migrate on a non-deprecated generator.', - }) - ); - } - - return this.spec.migrate!(state); - }, }; } } diff --git a/src/plugins/share/public/url_generators/url_generator_service.test.ts b/src/plugins/share/public/url_generators/url_generator_service.test.ts index cb70f1af2c1956..c07aa3f915b2e4 100644 --- a/src/plugins/share/public/url_generators/url_generator_service.test.ts +++ b/src/plugins/share/public/url_generators/url_generator_service.test.ts @@ -29,12 +29,8 @@ test('Registering and retrieving a generator', async () => { "createUrl": [Function], "id": "TEST_GENERATOR", "isDeprecated": false, - "migrate": [Function], } `); - await expect(generator.migrate({})).rejects.toEqual( - new Error('You cannot call migrate on a non-deprecated generator.') - ); expect(await generator.createUrl({})).toBe('myurl'); const retrievedGenerator = start.getUrlGenerator('TEST_GENERATOR'); @@ -43,12 +39,8 @@ test('Registering and retrieving a generator', async () => { "createUrl": [Function], "id": "TEST_GENERATOR", "isDeprecated": false, - "migrate": [Function], } `); - await expect(generator.migrate({})).rejects.toEqual( - new Error('You cannot call migrate on a non-deprecated generator.') - ); expect(await generator.createUrl({})).toBe('myurl'); }); @@ -124,6 +116,5 @@ test('Generator returns migrated url', async () => { const generator = start.getUrlGenerator('v1'); expect(generator.isDeprecated).toBe(true); - expect(await generator.migrate({ bar: 'hi' })).toEqual({ id: 'v2', state: { foo: 'hi' } }); expect(await generator.createUrl({ bar: 'hi' })).toEqual('www.hi.com'); }); diff --git a/src/plugins/share/public/url_service/redirect/redirect_manager.test.ts b/src/plugins/share/public/url_service/redirect/redirect_manager.test.ts index 7296ef6d0c1374..1fde60d4389fa3 100644 --- a/src/plugins/share/public/url_service/redirect/redirect_manager.test.ts +++ b/src/plugins/share/public/url_service/redirect/redirect_manager.test.ts @@ -57,9 +57,12 @@ describe('on page mount', () => { }) )}` ); - expect(spy).toHaveBeenCalledWith({ - foo: 'bar', - }); + expect(spy).toHaveBeenCalledWith( + { + foo: 'bar', + }, + { replace: true } + ); }); test('migrates parameters on-the-fly to the latest version', async () => { @@ -73,9 +76,12 @@ describe('on page mount', () => { }) )}` ); - expect(spy).toHaveBeenCalledWith({ - num: 2, - }); + expect(spy).toHaveBeenCalledWith( + { + num: 2, + }, + { replace: true } + ); }); test('throws if locator does not exist', async () => { diff --git a/src/plugins/share/public/url_service/redirect/redirect_manager.ts b/src/plugins/share/public/url_service/redirect/redirect_manager.ts index 810977659bcf0e..e6f524347e48cf 100644 --- a/src/plugins/share/public/url_service/redirect/redirect_manager.ts +++ b/src/plugins/share/public/url_service/redirect/redirect_manager.ts @@ -66,7 +66,9 @@ export class RedirectManager { }); locator - .navigate(migratedParams) + .navigate(migratedParams, { + replace: true, // We do not want the redirect app URL to appear in browser navigation history + }) .then() .catch((error) => { // eslint-disable-next-line no-console diff --git a/src/plugins/share/server/index.ts b/src/plugins/share/server/index.ts index d820a362131a49..73cd4cc89af70f 100644 --- a/src/plugins/share/server/index.ts +++ b/src/plugins/share/server/index.ts @@ -9,7 +9,7 @@ import { PluginInitializerContext } from '../../../core/server'; import { SharePlugin } from './plugin'; -export { SharePluginSetup, SharePluginStart } from './plugin'; +export type { SharePluginSetup, SharePluginStart } from './plugin'; export { CSV_QUOTE_VALUES_SETTING, CSV_SEPARATOR_SETTING } from '../common/constants'; diff --git a/src/plugins/ui_actions/public/index.ts b/src/plugins/ui_actions/public/index.ts index 0804ed43cbe102..8a6b7ed9314909 100644 --- a/src/plugins/ui_actions/public/index.ts +++ b/src/plugins/ui_actions/public/index.ts @@ -13,33 +13,29 @@ export function plugin(initializerContext: PluginInitializerContext) { return new UiActionsPlugin(initializerContext); } -export { UiActionsSetup, UiActionsStart } from './plugin'; -export { UiActionsServiceParams, UiActionsService } from './service'; -export { - Action, - ActionDefinition as UiActionsActionDefinition, - createAction, - IncompatibleActionError, -} from './actions'; +export type { UiActionsSetup, UiActionsStart } from './plugin'; +export type { UiActionsServiceParams } from './service'; +export { UiActionsService } from './service'; +export type { Action, ActionDefinition as UiActionsActionDefinition } from './actions'; +export { createAction, IncompatibleActionError } from './actions'; export { buildContextMenuForActions } from './context_menu'; -export { +export type { Presentable as UiActionsPresentable, PresentableGrouping as UiActionsPresentableGrouping, } from './util'; +export type { Trigger, RowClickContext } from './triggers'; export { - Trigger, VISUALIZE_FIELD_TRIGGER, visualizeFieldTrigger, VISUALIZE_GEO_FIELD_TRIGGER, visualizeGeoFieldTrigger, ROW_CLICK_TRIGGER, rowClickTrigger, - RowClickContext, } from './triggers'; +export type { VisualizeFieldContext } from './types'; export { - VisualizeFieldContext, ACTION_VISUALIZE_FIELD, ACTION_VISUALIZE_GEO_FIELD, ACTION_VISUALIZE_LENS_FIELD, } from './types'; -export { ActionExecutionContext, ActionExecutionMeta } from './actions'; +export type { ActionExecutionContext, ActionExecutionMeta } from './actions'; diff --git a/src/plugins/vis_default_editor/public/components/options/index.ts b/src/plugins/vis_default_editor/public/components/options/index.ts index 62ce76014f9fcd..4d45da690c3c8b 100644 --- a/src/plugins/vis_default_editor/public/components/options/index.ts +++ b/src/plugins/vis_default_editor/public/components/options/index.ts @@ -9,8 +9,10 @@ export { BasicOptions } from './basic_options'; export { SwitchOption } from './switch'; export { SelectOption } from './select'; -export { ColorRanges, SetColorRangeValue } from './color_ranges'; -export { ColorSchemaOptions, SetColorSchemaOptionsValue } from './color_schema'; +export type { SetColorRangeValue } from './color_ranges'; +export { ColorRanges } from './color_ranges'; +export type { SetColorSchemaOptionsValue } from './color_schema'; +export { ColorSchemaOptions } from './color_schema'; export { NumberInputOption } from './number_input'; export { RangeOption } from './range'; export { RequiredNumberInputOption } from './required_number_input'; diff --git a/src/plugins/vis_default_editor/public/index.ts b/src/plugins/vis_default_editor/public/index.ts index ec1f514b9f2ff0..d89a898467b98e 100644 --- a/src/plugins/vis_default_editor/public/index.ts +++ b/src/plugins/vis_default_editor/public/index.ts @@ -17,7 +17,8 @@ export { DefaultEditorController }; export { useValidation } from './components/controls/utils'; export { PalettePicker } from './components/controls/palette_picker'; export * from './components/options'; -export { RangesParamEditor, RangeValues } from './components/controls/ranges'; +export type { RangeValues } from './components/controls/ranges'; +export { RangesParamEditor } from './components/controls/ranges'; export * from './editor_size'; export * from './utils'; diff --git a/src/plugins/vis_types/pie/public/index.ts b/src/plugins/vis_types/pie/public/index.ts index adf8b2d073f390..d7c5e9a2dfb2ad 100644 --- a/src/plugins/vis_types/pie/public/index.ts +++ b/src/plugins/vis_types/pie/public/index.ts @@ -9,6 +9,6 @@ import { VisTypePiePlugin } from './plugin'; export { pieVisType } from './vis_type'; -export { Dimensions, Dimension } from './types'; +export type { Dimensions, Dimension } from './types'; export const plugin = () => new VisTypePiePlugin(); diff --git a/src/plugins/vis_types/table/common/index.ts b/src/plugins/vis_types/table/common/index.ts index ad8e27c95a5ecb..c5737c58fdbb33 100644 --- a/src/plugins/vis_types/table/common/index.ts +++ b/src/plugins/vis_types/table/common/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { AggTypes, TableVisParams, VIS_TYPE_TABLE } from './types'; +export type { TableVisParams } from './types'; +export { AggTypes, VIS_TYPE_TABLE } from './types'; diff --git a/src/plugins/vis_types/timelion/public/index.ts b/src/plugins/vis_types/timelion/public/index.ts index 8161f844e8f735..960eda3dc558fc 100644 --- a/src/plugins/vis_types/timelion/public/index.ts +++ b/src/plugins/vis_types/timelion/public/index.ts @@ -13,4 +13,4 @@ export function plugin(initializerContext: PluginInitializerContext) { return new Plugin(initializerContext); } -export { VisTypeTimelionPluginStart } from './plugin'; +export type { VisTypeTimelionPluginStart } from './plugin'; diff --git a/src/plugins/vis_types/timelion/server/types.ts b/src/plugins/vis_types/timelion/server/types.ts index 06b6afa613b064..0cbf2b08820894 100644 --- a/src/plugins/vis_types/timelion/server/types.ts +++ b/src/plugins/vis_types/timelion/server/types.ts @@ -6,4 +6,7 @@ * Side Public License, v 1. */ -export { TimelionFunctionInterface, TimelionFunctionConfig } from './lib/classes/timelion_function'; +export type { + TimelionFunctionInterface, + TimelionFunctionConfig, +} from './lib/classes/timelion_function'; diff --git a/src/plugins/vis_types/timeseries/common/types/index.ts b/src/plugins/vis_types/timeseries/common/types/index.ts index 123b6723d8ccd1..5e04fee0d015ce 100644 --- a/src/plugins/vis_types/timeseries/common/types/index.ts +++ b/src/plugins/vis_types/timeseries/common/types/index.ts @@ -9,8 +9,8 @@ import { Filter, IndexPattern, Query } from '../../../../data/common'; import { Panel } from './panel_model'; -export { Metric, Series, Panel, MetricType } from './panel_model'; -export { TimeseriesVisData, PanelData, SeriesData, TableData } from './vis_data'; +export type { Metric, Series, Panel, MetricType } from './panel_model'; +export type { TimeseriesVisData, PanelData, SeriesData, TableData } from './vis_data'; export interface FetchedIndexPattern { indexPattern: IndexPattern | undefined | null; diff --git a/src/plugins/vis_types/timeseries/public/application/components/lib/index_pattern_select/index.ts b/src/plugins/vis_types/timeseries/public/application/components/lib/index_pattern_select/index.ts index 4920677a04a2ee..24b49ca8f4d47b 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/lib/index_pattern_select/index.ts +++ b/src/plugins/vis_types/timeseries/public/application/components/lib/index_pattern_select/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { IndexPatternSelect, IndexPatternSelectProps } from './index_pattern_select'; +export type { IndexPatternSelectProps } from './index_pattern_select'; +export { IndexPatternSelect } from './index_pattern_select'; diff --git a/src/plugins/vis_types/timeseries/public/application/visualizations/views/timeseries/index.js b/src/plugins/vis_types/timeseries/public/application/visualizations/views/timeseries/index.js index 5e98b74c0caa5b..9dfddd3457d445 100644 --- a/src/plugins/vis_types/timeseries/public/application/visualizations/views/timeseries/index.js +++ b/src/plugins/vis_types/timeseries/public/application/visualizations/views/timeseries/index.js @@ -32,7 +32,11 @@ import { getBaseTheme, getChartClasses } from './utils/theme'; import { TOOLTIP_MODES } from '../../../../../common/enums'; import { getValueOrEmpty } from '../../../../../common/empty_label'; import { getSplitByTermsColor } from '../../../lib/get_split_by_terms_color'; -import { renderEndzoneTooltip, useActiveCursor } from '../../../../../../../charts/public'; +import { + MULTILAYER_TIME_AXIS_STYLE, + renderEndzoneTooltip, + useActiveCursor, +} from '../../../../../../../charts/public'; import { getAxisLabelString } from '../../../components/lib/get_axis_label_string'; import { calculateDomainForSeries } from './utils/series_domain_calculation'; @@ -140,49 +144,15 @@ export const TimeSeries = ({ [palettesService, series, syncColors] ); - const darkMode = uiSettings.get('theme:darkMode'); - const gridLineStyle = !useLegacyTimeAxis - ? { - visible: showGrid, - strokeWidth: 0.1, - stroke: darkMode ? 'white' : 'black', - } - : { - ...GRID_LINE_CONFIG, - visible: showGrid, - }; - const xAxisStyle = !useLegacyTimeAxis - ? { - tickLabel: { - visible: true, - fontSize: 11, - padding: 0, - alignment: { - vertical: Position.Bottom, - horizontal: Position.Left, - }, - offset: { - x: 1.5, - y: 0, - }, - }, - axisLine: { - stroke: darkMode ? 'lightgray' : 'darkgray', - strokeWidth: 1, - }, - tickLine: { - size: 12, - strokeWidth: 0.15, - stroke: darkMode ? 'white' : 'black', - padding: -10, - visible: true, - }, - axisTitle: { - visible: true, - padding: 0, - }, - } - : {}; + const gridLineStyle = { + ...GRID_LINE_CONFIG, + visible: showGrid, + }; + + const shouldUseNewTimeAxis = + series.every( + ({ stack, bars, lines }) => (bars?.show && stack !== STACKED_OPTIONS.NONE) || lines?.show + ) && !useLegacyTimeAxis; return ( @@ -361,10 +331,8 @@ export const TimeSeries = ({ position={position} domain={domain} hide={hide} - gridLine={{ - ...GRID_LINE_CONFIG, - visible: showGrid, - }} + gridLine={gridLineStyle} + ticks={5} tickFormat={tickFormatter} /> ))} @@ -375,8 +343,8 @@ export const TimeSeries = ({ title={getAxisLabelString(interval)} tickFormat={xAxisFormatter} gridLine={gridLineStyle} - style={xAxisStyle} - timeAxisLayerCount={useLegacyTimeAxis ? 0 : 3} + style={shouldUseNewTimeAxis ? MULTILAYER_TIME_AXIS_STYLE : undefined} + timeAxisLayerCount={shouldUseNewTimeAxis ? 3 : 0} /> ); diff --git a/src/plugins/vis_types/timeseries/server/index.ts b/src/plugins/vis_types/timeseries/server/index.ts index 7a10740a53d325..d6b1174177bb6b 100644 --- a/src/plugins/vis_types/timeseries/server/index.ts +++ b/src/plugins/vis_types/timeseries/server/index.ts @@ -10,7 +10,7 @@ import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/serve import { VisTypeTimeseriesConfig, config as configSchema } from './config'; import { VisTypeTimeseriesPlugin } from './plugin'; -export { VisTypeTimeseriesSetup } from './plugin'; +export type { VisTypeTimeseriesSetup } from './plugin'; export const config: PluginConfigDescriptor = { schema: configSchema, @@ -20,5 +20,5 @@ export function plugin(initializerContext: PluginInitializerContext) { return new VisTypeTimeseriesPlugin(initializerContext); } -export { TimeseriesVisData } from '../common/types'; +export type { TimeseriesVisData } from '../common/types'; export { isVisSeriesData, isVisTableData } from '../common/vis_data_utils'; diff --git a/src/plugins/vis_types/vega/public/vega_inspector/index.ts b/src/plugins/vis_types/vega/public/vega_inspector/index.ts index e79d2ee356aefd..72dc539dc2ea72 100644 --- a/src/plugins/vis_types/vega/public/vega_inspector/index.ts +++ b/src/plugins/vis_types/vega/public/vega_inspector/index.ts @@ -6,8 +6,5 @@ * Side Public License, v 1. */ -export { - createInspectorAdapters, - getVegaInspectorView, - VegaInspectorAdapters, -} from './vega_inspector'; +export type { VegaInspectorAdapters } from './vega_inspector'; +export { createInspectorAdapters, getVegaInspectorView } from './vega_inspector'; diff --git a/src/plugins/vis_types/vega/server/index.ts b/src/plugins/vis_types/vega/server/index.ts index 9c448f6c618d3a..62bc9a1494acf1 100644 --- a/src/plugins/vis_types/vega/server/index.ts +++ b/src/plugins/vis_types/vega/server/index.ts @@ -22,4 +22,4 @@ export function plugin(initializerContext: PluginInitializerContext) { return new VisTypeVegaPlugin(initializerContext); } -export { VisTypeVegaPluginStart, VisTypeVegaPluginSetup } from './types'; +export type { VisTypeVegaPluginStart, VisTypeVegaPluginSetup } from './types'; diff --git a/src/plugins/vis_types/xy/public/config/get_axis.ts b/src/plugins/vis_types/xy/public/config/get_axis.ts index 796636ef2cb61f..23605feddd3811 100644 --- a/src/plugins/vis_types/xy/public/config/get_axis.ts +++ b/src/plugins/vis_types/xy/public/config/get_axis.ts @@ -8,16 +8,11 @@ import { identity } from 'lodash'; -import { - AxisSpec, - TickFormatter, - YDomainRange, - ScaleType as ECScaleType, - Position, -} from '@elastic/charts'; +import { AxisSpec, TickFormatter, YDomainRange, ScaleType as ECScaleType } from '@elastic/charts'; import { LabelRotation } from '../../../../charts/public'; import { BUCKET_TYPES } from '../../../../data/public'; +import { MULTILAYER_TIME_AXIS_STYLE } from '../../../../charts/common'; import { Aspect, @@ -164,29 +159,13 @@ function getAxisStyle( ): AxisSpec['style'] { return isMultiLayerTimeAxis ? { + ...MULTILAYER_TIME_AXIS_STYLE, tickLabel: { + ...MULTILAYER_TIME_AXIS_STYLE.tickLabel, visible: Boolean(ticks?.show), - rotation: 0, // rotation is disabled on new time axis - fontSize: 11, - padding: 0, - alignment: { - vertical: Position.Bottom, - horizontal: Position.Left, - }, - offset: { - x: 1.5, - y: 0, - }, - }, - axisLine: { - stroke: darkMode ? 'lightgray' : 'darkgray', - strokeWidth: 1, }, tickLine: { - size: 12, - strokeWidth: 0.15, - stroke: darkMode ? 'white' : 'black', - padding: -10, + ...MULTILAYER_TIME_AXIS_STYLE.tickLine, visible: Boolean(ticks?.show), }, axisTitle: { @@ -198,7 +177,7 @@ function getAxisStyle( visible: (title ?? '').trim().length > 0, }, tickLabel: { - visible: ticks?.show, + visible: Boolean(ticks?.show), rotation: -(ticks?.rotation ?? rotationFallback), }, }; diff --git a/src/plugins/vis_types/xy/public/editor/components/common/index.ts b/src/plugins/vis_types/xy/public/editor/components/common/index.ts index 5eec1fff7b7a68..5a91629c50611d 100644 --- a/src/plugins/vis_types/xy/public/editor/components/common/index.ts +++ b/src/plugins/vis_types/xy/public/editor/components/common/index.ts @@ -7,4 +7,5 @@ */ export { TruncateLabelsOption } from './truncate_labels'; -export { ValidationWrapper, ValidationVisOptionsProps } from './validation_wrapper'; +export type { ValidationVisOptionsProps } from './validation_wrapper'; +export { ValidationWrapper } from './validation_wrapper'; diff --git a/src/plugins/vis_types/xy/public/expression_functions/index.ts b/src/plugins/vis_types/xy/public/expression_functions/index.ts index 32c50e3adff1ea..4d6b2305a36514 100644 --- a/src/plugins/vis_types/xy/public/expression_functions/index.ts +++ b/src/plugins/vis_types/xy/public/expression_functions/index.ts @@ -8,10 +8,17 @@ export { visTypeXyVisFn } from './xy_vis_fn'; -export { categoryAxis, ExpressionValueCategoryAxis } from './category_axis'; -export { timeMarker, ExpressionValueTimeMarker } from './time_marker'; -export { valueAxis, ExpressionValueValueAxis } from './value_axis'; -export { seriesParam, ExpressionValueSeriesParam } from './series_param'; -export { thresholdLine, ExpressionValueThresholdLine } from './threshold_line'; -export { label, ExpressionValueLabel } from './label'; -export { visScale, ExpressionValueScale } from './vis_scale'; +export type { ExpressionValueCategoryAxis } from './category_axis'; +export { categoryAxis } from './category_axis'; +export type { ExpressionValueTimeMarker } from './time_marker'; +export { timeMarker } from './time_marker'; +export type { ExpressionValueValueAxis } from './value_axis'; +export { valueAxis } from './value_axis'; +export type { ExpressionValueSeriesParam } from './series_param'; +export { seriesParam } from './series_param'; +export type { ExpressionValueThresholdLine } from './threshold_line'; +export { thresholdLine } from './threshold_line'; +export type { ExpressionValueLabel } from './label'; +export { label } from './label'; +export type { ExpressionValueScale } from './vis_scale'; +export { visScale } from './vis_scale'; diff --git a/src/plugins/vis_types/xy/public/index.ts b/src/plugins/vis_types/xy/public/index.ts index 1ee96fab352539..41a8e08fa1ad25 100644 --- a/src/plugins/vis_types/xy/public/index.ts +++ b/src/plugins/vis_types/xy/public/index.ts @@ -11,11 +11,11 @@ import { VisTypeXyPlugin as Plugin } from './plugin'; -export { VisTypeXyPluginSetup } from './plugin'; +export type { VisTypeXyPluginSetup } from './plugin'; // TODO: Remove when vis_type_vislib is removed // https://github.com/elastic/kibana/issues/56143 -export { +export type { CategoryAxis, ThresholdLine, ValueAxis, @@ -23,9 +23,8 @@ export { SeriesParam, Dimension, Dimensions, - ScaleType, - AxisType, } from './types'; +export { ScaleType, AxisType } from './types'; export type { ValidationVisOptionsProps } from './editor/components/common/validation_wrapper'; export { TruncateLabelsOption } from './editor/components/common/truncate_labels'; export { getPositions } from './editor/positions'; diff --git a/src/plugins/visualizations/public/index.ts b/src/plugins/visualizations/public/index.ts index e6ea3cd4895560..8ae0c426689ac5 100644 --- a/src/plugins/visualizations/public/index.ts +++ b/src/plugins/visualizations/public/index.ts @@ -22,17 +22,17 @@ export { VisualizationContainer } from './components'; export { getVisSchemas } from './vis_schemas'; /** @public types */ -export { VisualizationsSetup, VisualizationsStart }; +export type { VisualizationsSetup, VisualizationsStart }; export { VisGroups } from './vis_types/vis_groups_enum'; export type { BaseVisType, VisTypeAlias, VisTypeDefinition, Schema, ISchemas } from './vis_types'; export type { Vis, SerializedVis, SerializedVisData, VisData } from './vis'; export type VisualizeEmbeddableFactoryContract = PublicContract; export type VisualizeEmbeddableContract = PublicContract; -export { VisualizeInput } from './embeddable'; -export { SchemaConfig } from './vis_schemas'; +export type { VisualizeInput } from './embeddable'; +export type { SchemaConfig } from './vis_schemas'; export { updateOldState } from './legacy/vis_update_state'; export type { PersistedState } from './persisted_state'; -export { +export type { ISavedVis, VisSavedObject, VisToExpressionAst, @@ -40,11 +40,15 @@ export { VisEditorOptionsProps, GetVisOptions, } from './types'; -export { VisualizationListItem, VisualizationStage } from './vis_types/vis_type_alias_registry'; +export type { + VisualizationListItem, + VisualizationStage, +} from './vis_types/vis_type_alias_registry'; export { VISUALIZE_ENABLE_LABS_SETTING } from '../common/constants'; -export { SavedVisState, VisParams, prepareLogTable, Dimension } from '../common'; -export { ExpressionValueVisDimension } from '../common/expression_functions/vis_dimension'; -export { +export type { SavedVisState, VisParams, Dimension } from '../common'; +export { prepareLogTable } from '../common'; +export type { ExpressionValueVisDimension } from '../common/expression_functions/vis_dimension'; +export type { ExpressionValueXYDimension, DateHistogramParams, FakeParams, diff --git a/src/plugins/visualizations/public/vis_types/types_service.ts b/src/plugins/visualizations/public/vis_types/types_service.ts index 567da272dfd0a2..ae8ba8b8ad518e 100644 --- a/src/plugins/visualizations/public/vis_types/types_service.ts +++ b/src/plugins/visualizations/public/vis_types/types_service.ts @@ -110,4 +110,4 @@ export type TypesSetup = ReturnType; export type TypesStart = ReturnType; /** @public types */ -export { VisTypeAlias }; +export type { VisTypeAlias }; diff --git a/src/plugins/visualizations/server/index.ts b/src/plugins/visualizations/server/index.ts index d093a6829f3073..f10caf44b3ccd7 100644 --- a/src/plugins/visualizations/server/index.ts +++ b/src/plugins/visualizations/server/index.ts @@ -18,4 +18,4 @@ export function plugin(initializerContext: PluginInitializerContext) { return new VisualizationsPlugin(initializerContext); } -export { VisualizationsPluginSetup, VisualizationsPluginStart } from './types'; +export type { VisualizationsPluginSetup, VisualizationsPluginStart } from './types'; diff --git a/src/plugins/visualize/public/application/types.ts b/src/plugins/visualize/public/application/types.ts index e77520c962d886..b15b521f6251df 100644 --- a/src/plugins/visualize/public/application/types.ts +++ b/src/plugins/visualize/public/application/types.ts @@ -145,4 +145,4 @@ export interface EditorRenderProps { linked: boolean; } -export { PureVisState }; +export type { PureVisState }; diff --git a/src/plugins/visualize/public/application/utils/get_top_nav_config.test.tsx b/src/plugins/visualize/public/application/utils/get_top_nav_config.test.tsx index 450654e42585d8..19b52d73661a3a 100644 --- a/src/plugins/visualize/public/application/utils/get_top_nav_config.test.tsx +++ b/src/plugins/visualize/public/application/utils/get_top_nav_config.test.tsx @@ -5,9 +5,18 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ - +import { Observable } from 'rxjs'; import { Capabilities } from 'src/core/public'; -import { showPublicUrlSwitch } from './get_top_nav_config'; +import { showPublicUrlSwitch, getTopNavConfig, TopNavConfigParams } from './get_top_nav_config'; +import type { + VisualizeEditorVisInstance, + VisualizeAppStateContainer, + VisualizeServices, +} from '../types'; +import { createVisualizeServicesMock } from './mocks'; +import { sharePluginMock } from '../../../../share/public/mocks'; +import { createEmbeddableStateTransferMock } from '../../../../embeddable/public/mocks'; +import { visualizeAppStateStub } from './stubs'; describe('showPublicUrlSwitch', () => { test('returns false if "visualize" app is not available', () => { @@ -49,3 +58,201 @@ describe('showPublicUrlSwitch', () => { expect(result).toBe(true); }); }); + +describe('getTopNavConfig', () => { + const stateContainerGetStateMock = jest.fn(() => visualizeAppStateStub); + const stateContainer = { + getState: stateContainerGetStateMock, + state$: new Observable(), + transitions: { + updateVisState: jest.fn(), + set: jest.fn(), + }, + } as unknown as VisualizeAppStateContainer; + const mockServices = createVisualizeServicesMock(); + const share = sharePluginMock.createStartContract(); + const services = { + ...mockServices, + dashboard: { + dashboardFeatureFlagConfig: { + allowByValueEmbeddables: true, + }, + }, + visualizeCapabilities: { + save: true, + }, + dashboardCapabilities: { + showWriteControls: true, + }, + share, + }; + test('returns correct links for by reference visualization', () => { + const vis = { + savedVis: { + id: 'test', + sharingSavedObjectProps: { + outcome: 'conflict', + aliasTargetId: 'alias_id', + }, + }, + vis: { + type: { + title: 'TSVB', + }, + }, + } as VisualizeEditorVisInstance; + const topNavLinks = getTopNavConfig( + { + hasUnsavedChanges: false, + setHasUnsavedChanges: jest.fn(), + hasUnappliedChanges: false, + onOpenInspector: jest.fn(), + originatingApp: 'dashboards', + setOriginatingApp: jest.fn(), + visInstance: vis, + stateContainer, + visualizationIdFromUrl: undefined, + stateTransfer: createEmbeddableStateTransferMock(), + } as unknown as TopNavConfigParams, + services as unknown as VisualizeServices + ); + + expect(topNavLinks).toMatchInlineSnapshot(` + Array [ + Object { + "description": "Open Inspector for visualization", + "disableButton": [Function], + "id": "inspector", + "label": "inspect", + "run": undefined, + "testId": "openInspectorButton", + "tooltip": [Function], + }, + Object { + "description": "Share Visualization", + "disableButton": false, + "id": "share", + "label": "share", + "run": [Function], + "testId": "shareTopNavButton", + }, + Object { + "description": "Return to the last app without saving changes", + "emphasize": false, + "id": "cancel", + "label": "Cancel", + "run": [Function], + "testId": "visualizeCancelAndReturnButton", + "tooltip": [Function], + }, + Object { + "description": "Save Visualization", + "disableButton": false, + "emphasize": false, + "iconType": undefined, + "id": "save", + "label": "Save as", + "run": [Function], + "testId": "visualizeSaveButton", + "tooltip": [Function], + }, + Object { + "description": "Finish editing visualization and return to the last app", + "disableButton": false, + "emphasize": true, + "iconType": "checkInCircleFilled", + "id": "saveAndReturn", + "label": "Save and return", + "run": [Function], + "testId": "visualizesaveAndReturnButton", + "tooltip": [Function], + }, + ] + `); + }); + + test('returns correct links for by value visualization', () => { + const vis = { + savedVis: { + id: undefined, + sharingSavedObjectProps: { + outcome: 'conflict', + aliasTargetId: 'alias_id', + }, + }, + vis: { + type: { + title: 'TSVB', + }, + }, + } as VisualizeEditorVisInstance; + const topNavLinks = getTopNavConfig( + { + hasUnsavedChanges: false, + setHasUnsavedChanges: jest.fn(), + hasUnappliedChanges: false, + onOpenInspector: jest.fn(), + originatingApp: 'dashboards', + setOriginatingApp: jest.fn(), + visInstance: vis, + stateContainer, + visualizationIdFromUrl: undefined, + stateTransfer: createEmbeddableStateTransferMock(), + } as unknown as TopNavConfigParams, + services as unknown as VisualizeServices + ); + + expect(topNavLinks).toMatchInlineSnapshot(` + Array [ + Object { + "description": "Open Inspector for visualization", + "disableButton": [Function], + "id": "inspector", + "label": "inspect", + "run": undefined, + "testId": "openInspectorButton", + "tooltip": [Function], + }, + Object { + "description": "Share Visualization", + "disableButton": true, + "id": "share", + "label": "share", + "run": [Function], + "testId": "shareTopNavButton", + }, + Object { + "description": "Return to the last app without saving changes", + "emphasize": false, + "id": "cancel", + "label": "Cancel", + "run": [Function], + "testId": "visualizeCancelAndReturnButton", + "tooltip": [Function], + }, + Object { + "description": "Save Visualization", + "disableButton": false, + "emphasize": false, + "iconType": undefined, + "id": "save", + "label": "Save to library", + "run": [Function], + "testId": "visualizeSaveButton", + "tooltip": [Function], + }, + Object { + "description": "Finish editing visualization and return to the last app", + "disableButton": false, + "emphasize": true, + "iconType": "checkInCircleFilled", + "id": "saveAndReturn", + "label": "Save and return", + "run": [Function], + "testId": "visualizesaveAndReturnButton", + "tooltip": [Function], + }, + ] + `); + }); +}); diff --git a/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx b/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx index 9d1c93f25645c9..772565734dac43 100644 --- a/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx +++ b/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx @@ -49,7 +49,7 @@ interface VisualizeCapabilities { show: boolean; } -interface TopNavConfigParams { +export interface TopNavConfigParams { hasUnsavedChanges: boolean; setHasUnsavedChanges: (value: boolean) => void; openInspector: () => void; @@ -243,18 +243,17 @@ export const getTopNavConfig = ( const allowByValue = dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables; const saveButtonLabel = - embeddableId || (!savedVis.id && allowByValue && originatingApp) + !savedVis.id && allowByValue && originatingApp ? i18n.translate('visualize.topNavMenu.saveVisualizationToLibraryButtonLabel', { defaultMessage: 'Save to library', }) - : originatingApp && (embeddableId || savedVis.id) + : originatingApp && savedVis.id ? i18n.translate('visualize.topNavMenu.saveVisualizationAsButtonLabel', { defaultMessage: 'Save as', }) : i18n.translate('visualize.topNavMenu.saveVisualizationButtonLabel', { defaultMessage: 'Save', }); - const showSaveAndReturn = originatingApp && (savedVis?.id || allowByValue); const showSaveButton = @@ -293,7 +292,7 @@ export const getTopNavConfig = ( }), testId: 'shareTopNavButton', run: (anchorElement) => { - if (share && !embeddableId) { + if (share) { const currentState = stateContainer.getState(); const searchParams = parse(history.location.search); const params: VisualizeLocatorParams = { @@ -336,8 +335,8 @@ export const getTopNavConfig = ( }); } }, - // disable the Share button if no action specified - disableButton: !share || !!embeddableId, + // disable the Share button if no action specified and fot byValue visualizations + disableButton: !share || Boolean(!savedVis.id && allowByValue && originatingApp), }, ...(originatingApp ? [ diff --git a/src/plugins/visualize/public/index.ts b/src/plugins/visualize/public/index.ts index ff1b2ba4c3bf5d..dd77987f6a722d 100644 --- a/src/plugins/visualize/public/index.ts +++ b/src/plugins/visualize/public/index.ts @@ -11,9 +11,9 @@ import { VisualizePlugin, VisualizePluginSetup } from './plugin'; export { VisualizeConstants } from './application/visualize_constants'; -export { IEditorController, EditorRenderProps } from './application/types'; +export type { IEditorController, EditorRenderProps } from './application/types'; -export { VisualizePluginSetup }; +export type { VisualizePluginSetup }; export const plugin = (context: PluginInitializerContext) => { return new VisualizePlugin(context); diff --git a/test/functional/apps/discover/_discover.ts b/test/functional/apps/discover/_discover.ts index 0a8f56ee250eae..8374ccbc389f7d 100644 --- a/test/functional/apps/discover/_discover.ts +++ b/test/functional/apps/discover/_discover.ts @@ -28,16 +28,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('discover test', function describeIndexTests() { before(async function () { log.debug('load kibana index with default index pattern'); - - await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json'); - + await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); // and load a set of makelogs data await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); await kibanaServer.uiSettings.replace(defaultSettings); await PageObjects.common.navigateToApp('discover'); await PageObjects.timePicker.setDefaultAbsoluteRange(); }); - + after(async () => { + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + }); describe('query', function () { const queryName1 = 'Query # 1'; diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts index a40465b00dbeb9..69fbf7e49df3c5 100644 --- a/test/functional/page_objects/common_page.ts +++ b/test/functional/page_objects/common_page.ts @@ -11,6 +11,7 @@ import expect from '@kbn/expect'; // @ts-ignore import fetch from 'node-fetch'; import { getUrl } from '@kbn/test'; +import moment from 'moment'; import { FtrService } from '../ftr_provider_context'; interface NavigateProps { @@ -502,11 +503,47 @@ export class CommonPageObject extends FtrService { } } - async setTime(time: { from: string; to: string }) { - await this.kibanaServer.uiSettings.replace({ 'timepicker:timeDefaults': JSON.stringify(time) }); + /** + * Due to a warning thrown, documented at: + * https://github.com/elastic/kibana/pull/114997#issuecomment-950823874 + * this fn formats time in a format specified, or defaulted + * to the same format in + * [getTimeDurationInHours()](https://github.com/elastic/kibana/blob/main/test/functional/page_objects/time_picker.ts#L256) + * @param time + * @param fmt + */ + formatTime(time: TimeStrings, fmt: string = 'MMM D, YYYY @ HH:mm:ss.SSS') { + return Object.keys(time) + .map((x) => moment(time[x], [fmt]).format()) + .reduce( + (acc, curr, idx) => { + if (idx === 0) acc.from = curr; + acc.to = curr; + return acc; + }, + { from: '', to: '' } + ); + } + + /** + * Previously, many tests were using the time picker. + * To speed things up, we are now setting time here. + * The formatting fn is called here, such that the tests + * that were using the time picker can use the same time + * parameters as before, but they are auto-formatted. + * @param time + */ + async setTime(time: TimeStrings) { + await this.kibanaServer.uiSettings.replace({ + 'timepicker:timeDefaults': JSON.stringify(this.formatTime(time)), + }); } async unsetTime() { await this.kibanaServer.uiSettings.unset('timepicker:timeDefaults'); } } +export interface TimeStrings extends Record { + from: string; + to: string; +} diff --git a/test/functional/services/common/index.ts b/test/functional/services/common/index.ts index 95f58027fd5fbc..c5f442c1915439 100644 --- a/test/functional/services/common/index.ts +++ b/test/functional/services/common/index.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -export { BrowserProvider, Browser } from './browser'; +export type { Browser } from './browser'; +export { BrowserProvider } from './browser'; export { FailureDebuggingProvider } from './failure_debugging'; export { FindProvider } from './find'; export { ScreenshotsService } from './screenshots'; diff --git a/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/index.ts b/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/index.ts index 22afda2fdce1bf..897fbf832d5614 100644 --- a/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/index.ts +++ b/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/index.ts @@ -8,7 +8,7 @@ import { PluginInitializer, PluginInitializerContext } from 'src/core/public'; import { Plugin, StartDeps } from './plugin'; -export { StartDeps }; +export type { StartDeps }; export const plugin: PluginInitializer = ( initializerContext: PluginInitializerContext diff --git a/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/types.ts b/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/types.ts index a9b597ebf1e055..02872843cf8bcc 100644 --- a/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/types.ts +++ b/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/types.ts @@ -9,4 +9,5 @@ import { ExpressionsStart, ExpressionRenderHandler } from 'src/plugins/expressions/public'; import { Adapters } from 'src/plugins/inspector/public'; -export { ExpressionsStart, ExpressionRenderHandler, Adapters }; +export type { ExpressionsStart, Adapters }; +export { ExpressionRenderHandler }; diff --git a/test/plugin_functional/plugins/core_plugin_a/server/index.ts b/test/plugin_functional/plugins/core_plugin_a/server/index.ts index f4b9f96f1bcdda..7fad3cf7a9e3bb 100644 --- a/test/plugin_functional/plugins/core_plugin_a/server/index.ts +++ b/test/plugin_functional/plugins/core_plugin_a/server/index.ts @@ -7,6 +7,6 @@ */ import { CorePluginAPlugin } from './plugin'; -export { PluginAApiRequestContext } from './plugin'; +export type { PluginAApiRequestContext } from './plugin'; export const plugin = () => new CorePluginAPlugin(); diff --git a/x-pack/examples/reporting_example/common/index.ts b/x-pack/examples/reporting_example/common/index.ts index 893bd4dee8ae1b..991ec30a03b144 100644 --- a/x-pack/examples/reporting_example/common/index.ts +++ b/x-pack/examples/reporting_example/common/index.ts @@ -8,10 +8,7 @@ export const PLUGIN_ID = 'reportingExample'; export const PLUGIN_NAME = 'reportingExample'; -export { MyForwardableState } from './types'; +export type { MyForwardableState } from './types'; -export { - REPORTING_EXAMPLE_LOCATOR_ID, - ReportingExampleLocatorDefinition, - ReportingExampleLocatorParams, -} from './locator'; +export type { ReportingExampleLocatorParams } from './locator'; +export { REPORTING_EXAMPLE_LOCATOR_ID, ReportingExampleLocatorDefinition } from './locator'; diff --git a/x-pack/examples/reporting_example/public/containers/main.tsx b/x-pack/examples/reporting_example/public/containers/main.tsx index 8673c476fdc7b2..e3f45b43595564 100644 --- a/x-pack/examples/reporting_example/public/containers/main.tsx +++ b/x-pack/examples/reporting_example/public/containers/main.tsx @@ -34,9 +34,12 @@ import { BrowserRouter as Router, useHistory } from 'react-router-dom'; import * as Rx from 'rxjs'; import { takeWhile } from 'rxjs/operators'; import { ScreenshotModePluginSetup } from 'src/plugins/screenshot_mode/public'; +import type { + JobAppParamsPDF, + JobParamsPDFV2, + JobParamsPNGV2, +} from '../../../../plugins/reporting/public'; import { constants, ReportingStart } from '../../../../plugins/reporting/public'; -import type { JobParamsPDFV2 } from '../../../../plugins/reporting/server/export_types/printable_pdf_v2/types'; -import type { JobParamsPNGV2 } from '../../../../plugins/reporting/server/export_types/png_v2/types'; import { REPORTING_EXAMPLE_LOCATOR_ID } from '../../common'; @@ -81,7 +84,7 @@ export const Main = ({ basename, reporting, screenshotMode }: ReportingExampleAp }); }); - const getPDFJobParamsDefault = () => { + const getPDFJobParamsDefault = (): JobAppParamsPDF => { return { layout: { id: constants.LAYOUT_TYPES.PRESERVE_LAYOUT, diff --git a/x-pack/examples/reporting_example/public/index.ts b/x-pack/examples/reporting_example/public/index.ts index f9f749e2b0cd02..c4c0a9b48f2cb6 100644 --- a/x-pack/examples/reporting_example/public/index.ts +++ b/x-pack/examples/reporting_example/public/index.ts @@ -10,4 +10,4 @@ import { ReportingExamplePlugin } from './plugin'; export function plugin() { return new ReportingExamplePlugin(); } -export { PluginSetup, PluginStart } from './types'; +export type { PluginSetup, PluginStart } from './types'; diff --git a/x-pack/examples/ui_actions_enhanced_examples/public/drilldowns/dashboard_to_discover_drilldown/index.ts b/x-pack/examples/ui_actions_enhanced_examples/public/drilldowns/dashboard_to_discover_drilldown/index.ts index f6e1f288641401..f6c6f48e1774cb 100644 --- a/x-pack/examples/ui_actions_enhanced_examples/public/drilldowns/dashboard_to_discover_drilldown/index.ts +++ b/x-pack/examples/ui_actions_enhanced_examples/public/drilldowns/dashboard_to_discover_drilldown/index.ts @@ -6,11 +6,9 @@ */ export { SAMPLE_DASHBOARD_TO_DISCOVER_DRILLDOWN } from './constants'; -export { - DashboardToDiscoverDrilldown, - Params as DashboardToDiscoverDrilldownParams, -} from './drilldown'; -export { +export type { Params as DashboardToDiscoverDrilldownParams } from './drilldown'; +export { DashboardToDiscoverDrilldown } from './drilldown'; +export type { ActionContext as DashboardToDiscoverActionContext, Config as DashboardToDiscoverConfig, } from './types'; diff --git a/x-pack/plugins/actions/server/builtin_action_types/index.ts b/x-pack/plugins/actions/server/builtin_action_types/index.ts index 3351a36b38344b..9988e951ae86db 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/index.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/index.ts @@ -25,36 +25,30 @@ import { getActionType as getJiraActionType } from './jira'; import { getActionType as getResilientActionType } from './resilient'; import { getActionType as getTeamsActionType } from './teams'; import { ENABLE_ITOM } from '../constants/connectors'; -export { ActionParamsType as EmailActionParams, ActionTypeId as EmailActionTypeId } from './email'; +export type { ActionParamsType as EmailActionParams } from './email'; +export { ActionTypeId as EmailActionTypeId } from './email'; +export type { ActionParamsType as IndexActionParams } from './es_index'; +export { ActionTypeId as IndexActionTypeId } from './es_index'; +export type { ActionParamsType as PagerDutyActionParams } from './pagerduty'; +export { ActionTypeId as PagerDutyActionTypeId } from './pagerduty'; +export type { ActionParamsType as ServerLogActionParams } from './server_log'; +export { ActionTypeId as ServerLogActionTypeId } from './server_log'; +export type { ActionParamsType as SlackActionParams } from './slack'; +export { ActionTypeId as SlackActionTypeId } from './slack'; +export type { ActionParamsType as WebhookActionParams } from './webhook'; +export { ActionTypeId as WebhookActionTypeId } from './webhook'; +export type { ActionParamsType as ServiceNowActionParams } from './servicenow'; export { - ActionParamsType as IndexActionParams, - ActionTypeId as IndexActionTypeId, -} from './es_index'; -export { - ActionParamsType as PagerDutyActionParams, - ActionTypeId as PagerDutyActionTypeId, -} from './pagerduty'; -export { - ActionParamsType as ServerLogActionParams, - ActionTypeId as ServerLogActionTypeId, -} from './server_log'; -export { ActionParamsType as SlackActionParams, ActionTypeId as SlackActionTypeId } from './slack'; -export { - ActionParamsType as WebhookActionParams, - ActionTypeId as WebhookActionTypeId, -} from './webhook'; -export { - ActionParamsType as ServiceNowActionParams, ServiceNowITSMActionTypeId, ServiceNowSIRActionTypeId, ServiceNowITOMActionTypeId, } from './servicenow'; -export { ActionParamsType as JiraActionParams, ActionTypeId as JiraActionTypeId } from './jira'; -export { - ActionParamsType as ResilientActionParams, - ActionTypeId as ResilientActionTypeId, -} from './resilient'; -export { ActionParamsType as TeamsActionParams, ActionTypeId as TeamsActionTypeId } from './teams'; +export type { ActionParamsType as JiraActionParams } from './jira'; +export { ActionTypeId as JiraActionTypeId } from './jira'; +export type { ActionParamsType as ResilientActionParams } from './resilient'; +export { ActionTypeId as ResilientActionTypeId } from './resilient'; +export type { ActionParamsType as TeamsActionParams } from './teams'; +export { ActionTypeId as TeamsActionTypeId } from './teams'; export function registerBuiltInActionTypes({ actionsConfigUtils: configurationUtilities, diff --git a/x-pack/plugins/actions/server/lib/errors/index.ts b/x-pack/plugins/actions/server/lib/errors/index.ts index e4035213359a36..bae42db6dd1e94 100644 --- a/x-pack/plugins/actions/server/lib/errors/index.ts +++ b/x-pack/plugins/actions/server/lib/errors/index.ts @@ -13,4 +13,5 @@ export function isErrorThatHandlesItsOwnResponse( return typeof (e as ErrorThatHandlesItsOwnResponse).sendResponse === 'function'; } -export { ActionTypeDisabledError, ActionTypeDisabledReason } from './action_type_disabled'; +export type { ActionTypeDisabledReason } from './action_type_disabled'; +export { ActionTypeDisabledError } from './action_type_disabled'; diff --git a/x-pack/plugins/actions/server/lib/index.ts b/x-pack/plugins/actions/server/lib/index.ts index c52a8b14ee6d8b..d981b3bcc82e04 100644 --- a/x-pack/plugins/actions/server/lib/index.ts +++ b/x-pack/plugins/actions/server/lib/index.ts @@ -13,8 +13,10 @@ export { validateConnector, } from './validate_with_schema'; export { TaskRunnerFactory } from './task_runner_factory'; -export { ActionExecutor, ActionExecutorContract } from './action_executor'; -export { ILicenseState, LicenseState } from './license_state'; +export type { ActionExecutorContract } from './action_executor'; +export { ActionExecutor } from './action_executor'; +export type { ILicenseState } from './license_state'; +export { LicenseState } from './license_state'; export { verifyApiAccess } from './verify_api_access'; export { getActionTypeFeatureUsageName } from './get_action_type_feature_usage_name'; export { spaceIdToNamespace } from './space_id_to_namespace'; @@ -22,13 +24,10 @@ export { extractSavedObjectReferences, injectSavedObjectReferences, } from './action_task_params_utils'; +export type { ActionTypeDisabledReason } from './errors'; +export { ActionTypeDisabledError, isErrorThatHandlesItsOwnResponse } from './errors'; +export type { ActionExecutionSource } from './action_execution_source'; export { - ActionTypeDisabledError, - ActionTypeDisabledReason, - isErrorThatHandlesItsOwnResponse, -} from './errors'; -export { - ActionExecutionSource, asSavedObjectExecutionSource, isSavedObjectExecutionSource, asHttpRequestExecutionSource, diff --git a/x-pack/plugins/actions/server/types.ts b/x-pack/plugins/actions/server/types.ts index 627cd7028e5b1d..9b7a8280cd27c5 100644 --- a/x-pack/plugins/actions/server/types.ts +++ b/x-pack/plugins/actions/server/types.ts @@ -20,11 +20,11 @@ import { } from '../../../../src/core/server'; import { ActionTypeExecutorResult } from '../common'; import { TaskInfo } from './lib/action_executor'; -export { ActionTypeExecutorResult } from '../common'; -export { GetFieldsByIssueTypeResponse as JiraGetFieldsResponse } from './builtin_action_types/jira/types'; -export { GetCommonFieldsResponse as ServiceNowGetFieldsResponse } from './builtin_action_types/servicenow/types'; -export { GetCommonFieldsResponse as ResilientGetFieldsResponse } from './builtin_action_types/resilient/types'; -export { SwimlanePublicConfigurationType } from './builtin_action_types/swimlane/types'; +export type { ActionTypeExecutorResult } from '../common'; +export type { GetFieldsByIssueTypeResponse as JiraGetFieldsResponse } from './builtin_action_types/jira/types'; +export type { GetCommonFieldsResponse as ServiceNowGetFieldsResponse } from './builtin_action_types/servicenow/types'; +export type { GetCommonFieldsResponse as ResilientGetFieldsResponse } from './builtin_action_types/resilient/types'; +export type { SwimlanePublicConfigurationType } from './builtin_action_types/swimlane/types'; export type WithoutQueryAndParams = Pick>; export type GetServicesFunction = (request: KibanaRequest) => Services; export type ActionTypeRegistryContract = PublicMethodsOf; diff --git a/x-pack/plugins/alerting/server/alert_instance/index.ts b/x-pack/plugins/alerting/server/alert_instance/index.ts index c342c2f6bd0518..7b5dd064c5dca3 100644 --- a/x-pack/plugins/alerting/server/alert_instance/index.ts +++ b/x-pack/plugins/alerting/server/alert_instance/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { AlertInstance, PublicAlertInstance } from './alert_instance'; +export type { PublicAlertInstance } from './alert_instance'; +export { AlertInstance } from './alert_instance'; export { createAlertInstanceFactory } from './create_alert_instance_factory'; diff --git a/x-pack/plugins/alerting/server/index.ts b/x-pack/plugins/alerting/server/index.ts index 2ddb6ff711c469..8ed91cc821412c 100644 --- a/x-pack/plugins/alerting/server/index.ts +++ b/x-pack/plugins/alerting/server/index.ts @@ -30,9 +30,9 @@ export type { RuleParamsAndRefs, } from './types'; export { DEFAULT_MAX_EPHEMERAL_ACTIONS_PER_ALERT } from './config'; -export { PluginSetupContract, PluginStartContract } from './plugin'; -export { FindResult } from './rules_client'; -export { PublicAlertInstance as AlertInstance } from './alert_instance'; +export type { PluginSetupContract, PluginStartContract } from './plugin'; +export type { FindResult } from './rules_client'; +export type { PublicAlertInstance as AlertInstance } from './alert_instance'; export { parseDuration } from './lib'; export { getEsErrorMessage } from './lib/errors'; export { diff --git a/x-pack/plugins/alerting/server/lib/errors/index.ts b/x-pack/plugins/alerting/server/lib/errors/index.ts index 66db39916832a1..36ca30bc95ba81 100644 --- a/x-pack/plugins/alerting/server/lib/errors/index.ts +++ b/x-pack/plugins/alerting/server/lib/errors/index.ts @@ -14,5 +14,7 @@ export function isErrorThatHandlesItsOwnResponse( return typeof (e as ErrorThatHandlesItsOwnResponse).sendResponse === 'function'; } -export { ErrorThatHandlesItsOwnResponse, ElasticsearchError, getEsErrorMessage }; -export { AlertTypeDisabledError, AlertTypeDisabledReason } from './alert_type_disabled'; +export type { ErrorThatHandlesItsOwnResponse, ElasticsearchError }; +export { getEsErrorMessage }; +export type { AlertTypeDisabledReason } from './alert_type_disabled'; +export { AlertTypeDisabledError } from './alert_type_disabled'; diff --git a/x-pack/plugins/alerting/server/lib/index.ts b/x-pack/plugins/alerting/server/lib/index.ts index ed55548307e7cf..24f2513e1c6503 100644 --- a/x-pack/plugins/alerting/server/lib/index.ts +++ b/x-pack/plugins/alerting/server/lib/index.ts @@ -6,18 +6,18 @@ */ export { parseDuration, validateDurationSchema } from '../../common/parse_duration'; -export { ILicenseState, LicenseState } from './license_state'; +export type { ILicenseState } from './license_state'; +export { LicenseState } from './license_state'; export { validateAlertTypeParams } from './validate_alert_type_params'; export { getAlertNotifyWhenType } from './get_alert_notify_when_type'; export { verifyApiAccess } from './license_api_access'; export { ErrorWithReason, getReasonFromError, isErrorWithReason } from './error_with_reason'; -export { - AlertTypeDisabledError, +export type { AlertTypeDisabledReason, ErrorThatHandlesItsOwnResponse, - isErrorThatHandlesItsOwnResponse, ElasticsearchError, } from './errors'; +export { AlertTypeDisabledError, isErrorThatHandlesItsOwnResponse } from './errors'; export { executionStatusFromState, executionStatusFromError, diff --git a/x-pack/plugins/alerting/server/routes/lib/index.ts b/x-pack/plugins/alerting/server/routes/lib/index.ts index dc8f3ac3b5de9e..2c14660ae47de0 100644 --- a/x-pack/plugins/alerting/server/routes/lib/index.ts +++ b/x-pack/plugins/alerting/server/routes/lib/index.ts @@ -11,6 +11,10 @@ export { isSecurityPluginDisabledError, } from './error_handler'; export { renameKeys } from './rename_keys'; -export { AsApiContract, RewriteRequestCase, RewriteResponseCase } from './rewrite_request_case'; +export type { + AsApiContract, + RewriteRequestCase, + RewriteResponseCase, +} from './rewrite_request_case'; export { verifyAccessAndContext } from './verify_access_and_context'; export { countUsageOfPredefinedIds } from './count_usage_of_predefined_ids'; diff --git a/x-pack/plugins/apm/dev_docs/routing_and_linking.md b/x-pack/plugins/apm/dev_docs/routing_and_linking.md index a1fdff3821c4c1..1f6160a6c4a99a 100644 --- a/x-pack/plugins/apm/dev_docs/routing_and_linking.md +++ b/x-pack/plugins/apm/dev_docs/routing_and_linking.md @@ -52,7 +52,7 @@ const { `useApmParams` will strip query parameters for which there is no validation. The route path should match exactly, but you can also use wildcards: `useApmParams('/*)`. In that case, the return type will be a union type of all possible matching routes. -Previously we used `useUrlParams` for path and query parameters, which we are trying to get away from. When possible, any usage of `useUrlParams` should be replaced by `useApmParams` or other custom hooks that use `useApmParams` internally. +Previously we used `useLegacyUrlParams` for path and query parameters, which we are trying to get away from. When possible, any usage of `useLegacyUrlParams` should be replaced by `useApmParams` or other custom hooks that use `useApmParams` internally. ## Linking diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/ActionMenu/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/ActionMenu/index.tsx index 593de7c3a6f705..3bf21de7487de2 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/ActionMenu/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/ActionMenu/index.tsx @@ -12,7 +12,7 @@ import { createExploratoryViewUrl, HeaderMenuPortal, } from '../../../../../../observability/public'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; import { AppMountParameters } from '../../../../../../../../src/core/public'; import { InspectorHeaderLink } from '../../../shared/apm_header_action_menu/inspector_header_link'; @@ -38,7 +38,7 @@ export function UXActionMenu({ const { services: { http }, } = useKibana(); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { rangeTo, rangeFrom, serviceName } = urlParams; const uxExploratoryViewLink = createExploratoryViewUrl( diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/Charts/PageViewsChart.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/Charts/PageViewsChart.tsx index 6be2eada6a9ec9..e5ee427e166771 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/Charts/PageViewsChart.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/Charts/PageViewsChart.tsx @@ -28,7 +28,7 @@ import moment from 'moment'; import React from 'react'; import { useHistory } from 'react-router-dom'; import { useUiSetting$ } from '../../../../../../../../src/plugins/kibana_react/public'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { fromQuery, toQuery } from '../../../shared/Links/url_helpers'; import { ChartWrapper } from '../ChartWrapper'; import { I18LABELS } from '../translations'; @@ -43,7 +43,7 @@ interface Props { export function PageViewsChart({ data, loading }: Props) { const history = useHistory(); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { start, end } = urlParams; const diffInDays = moment(new Date(end as string)).diff( diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/ClientMetrics/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/ClientMetrics/index.tsx index c525a71ea45891..7c48531d21990c 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/ClientMetrics/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/ClientMetrics/index.tsx @@ -15,13 +15,13 @@ import { } from '@elastic/eui'; import { I18LABELS } from '../translations'; import { getPercentileLabel } from '../UXMetrics/translations'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { Metrics } from './Metrics'; export function ClientMetrics() { const { urlParams: { percentile }, - } = useUrlParams(); + } = useLegacyUrlParams(); return ( diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/ImpactfulMetrics/JSErrors.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/ImpactfulMetrics/JSErrors.tsx index c8956c091d267e..b8bdc36ed4e0dc 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/ImpactfulMetrics/JSErrors.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/ImpactfulMetrics/JSErrors.tsx @@ -18,7 +18,7 @@ import { import numeral from '@elastic/numeral'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher'; import { I18LABELS } from '../translations'; import { CsmSharedContext } from '../CsmSharedContext'; @@ -31,7 +31,7 @@ interface JSErrorItem { } export function JSErrors() { - const { urlParams, uxUiFilters } = useUrlParams(); + const { urlParams, uxUiFilters } = useLegacyUrlParams(); const { start, end, serviceName, searchTerm } = urlParams; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/LocalUIFilters/SelectedFilters.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/LocalUIFilters/SelectedFilters.tsx index ee0827c4d81e55..d9f9154c5c100e 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/LocalUIFilters/SelectedFilters.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/LocalUIFilters/SelectedFilters.tsx @@ -9,7 +9,7 @@ import React, { Fragment } from 'react'; import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { FilterValueLabel } from '../../../../../../observability/public'; import { FiltersUIHook } from '../hooks/useLocalUIFilters'; import { UxLocalUIFilterName } from '../../../../../common/ux_ui_filter'; @@ -38,7 +38,7 @@ export function SelectedFilters({ const { uxUiFilters, urlParams: { searchTerm }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { transactionUrl } = uxUiFilters; const urlValues = transactionUrl ?? []; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/LocalUIFilters/selected_wildcards.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/LocalUIFilters/selected_wildcards.tsx index 1bc0807bd2f716..6a9dfd1fddd11a 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/LocalUIFilters/selected_wildcards.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/LocalUIFilters/selected_wildcards.tsx @@ -9,7 +9,7 @@ import * as React from 'react'; import { useCallback } from 'react'; import { useHistory } from 'react-router-dom'; import { FilterValueLabel } from '../../../../../../observability/public'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { fromQuery, toQuery } from '../../../shared/Links/url_helpers'; import { TRANSACTION_URL } from '../../../../../common/elasticsearch_fieldnames'; import { IndexPattern } from '../../../../../../../../src/plugins/data_views/common'; @@ -22,7 +22,7 @@ export function SelectedWildcards({ indexPattern }: Props) { const { urlParams: { searchTerm }, - } = useUrlParams(); + } = useLegacyUrlParams(); const updateSearchTerm = useCallback( (searchTermN: string) => { diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx index a9dac0a37c3533..f75d0fd093b5a2 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx @@ -14,7 +14,7 @@ import { EuiTitle, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useFetcher } from '../../../../hooks/use_fetcher'; import { I18LABELS } from '../translations'; import { BreakdownFilter } from '../Breakdowns/BreakdownFilter'; @@ -34,7 +34,7 @@ export function PageLoadDistribution() { services: { http }, } = useKibana(); - const { urlParams, uxUiFilters } = useUrlParams(); + const { urlParams, uxUiFilters } = useLegacyUrlParams(); const { start, end, rangeFrom, rangeTo, searchTerm } = urlParams; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/use_breakdowns.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/use_breakdowns.ts index e43ba9c7e557e5..0cfa293c878444 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/use_breakdowns.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/use_breakdowns.ts @@ -6,7 +6,7 @@ */ import { useFetcher } from '../../../../hooks/use_fetcher'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { PercentileRange } from './index'; interface Props { @@ -16,7 +16,7 @@ interface Props { } export const useBreakdowns = ({ percentileRange, field, value }: Props) => { - const { urlParams, uxUiFilters } = useUrlParams(); + const { urlParams, uxUiFilters } = useLegacyUrlParams(); const { start, end, searchTerm } = urlParams; const { min: minP, max: maxP } = percentileRange ?? {}; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx index 5f7c0738e56420..581260f5931e7a 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx @@ -14,7 +14,7 @@ import { EuiTitle, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useFetcher } from '../../../../hooks/use_fetcher'; import { I18LABELS } from '../translations'; import { BreakdownFilter } from '../Breakdowns/BreakdownFilter'; @@ -28,7 +28,7 @@ export function PageViewsTrend() { services: { http }, } = useKibana(); - const { urlParams, uxUiFilters } = useUrlParams(); + const { urlParams, uxUiFilters } = useLegacyUrlParams(); const { serviceName } = uxUiFilters; const { start, end, searchTerm, rangeTo, rangeFrom } = urlParams; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/Panels/WebApplicationSelect.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/Panels/WebApplicationSelect.tsx index 58cffb39d0a042..5b1cca0ec44fa0 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/Panels/WebApplicationSelect.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/Panels/WebApplicationSelect.tsx @@ -9,12 +9,12 @@ import React from 'react'; import { ServiceNameFilter } from '../URLFilter/ServiceNameFilter'; import { useFetcher } from '../../../../hooks/use_fetcher'; import { RUM_AGENT_NAMES } from '../../../../../common/agent_name'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; export function WebApplicationSelect() { const { urlParams: { start, end }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { data, status } = useFetcher( (callApmApi) => { diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/ServiceNameFilter/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/ServiceNameFilter/index.tsx index 5750dd9cf441e1..f6891a5d8fb672 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/ServiceNameFilter/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/ServiceNameFilter/index.tsx @@ -9,7 +9,7 @@ import { EuiSelect } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { useEffect, useCallback } from 'react'; import { useHistory } from 'react-router-dom'; -import { useUrlParams } from '../../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../../context/url_params_context/use_url_params'; import { fromQuery, toQuery } from '../../../../shared/Links/url_helpers'; interface Props { @@ -21,7 +21,7 @@ function ServiceNameFilter({ loading, serviceNames }: Props) { const history = useHistory(); const { urlParams: { serviceName: selectedServiceName }, - } = useUrlParams(); + } = useLegacyUrlParams(); const options = serviceNames.map((type) => ({ text: type, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/index.tsx index 7aa8d5d85e539b..e34270f963599d 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/index.tsx @@ -8,7 +8,7 @@ import React, { useEffect, useState } from 'react'; import { isEqual, map } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { useUrlParams } from '../../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../../context/url_params_context/use_url_params'; import { I18LABELS } from '../../translations'; import { formatToSec } from '../../UXMetrics/KeyUXMetrics'; import { getPercentileLabel } from '../../UXMetrics/translations'; @@ -93,7 +93,7 @@ export function URLSearch({ const { uxUiFilters: { transactionUrl, transactionUrlExcluded }, urlParams, - } = useUrlParams(); + } = useLegacyUrlParams(); const { searchTerm, percentile } = urlParams; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/use_url_search.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/use_url_search.tsx index 64f51714ed66eb..7b6b093c703673 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/use_url_search.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/use_url_search.tsx @@ -9,7 +9,7 @@ import useDebounce from 'react-use/lib/useDebounce'; import { useState } from 'react'; import { useFetcher } from '../../../../../hooks/use_fetcher'; import { useUxQuery } from '../../hooks/useUxQuery'; -import { useUrlParams } from '../../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../../context/url_params_context/use_url_params'; interface Props { popoverIsOpen: boolean; @@ -19,7 +19,7 @@ interface Props { export const useUrlSearch = ({ popoverIsOpen, query }: Props) => { const uxQuery = useUxQuery(); - const { uxUiFilters } = useUrlParams(); + const { uxUiFilters } = useLegacyUrlParams(); const { transactionUrl, transactionUrlExcluded, ...restFilters } = uxUiFilters; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/index.tsx index dd93a0143c05a9..673f045ecfb978 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/index.tsx @@ -20,13 +20,13 @@ import { useFetcher } from '../../../../hooks/use_fetcher'; import { useUxQuery } from '../hooks/useUxQuery'; import { getCoreVitalsComponent } from '../../../../../../observability/public'; import { CsmSharedContext } from '../CsmSharedContext'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { getPercentileLabel } from './translations'; export function UXMetrics() { const { urlParams: { percentile }, - } = useUrlParams(); + } = useLegacyUrlParams(); const uxQuery = useUxQuery(); diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/UserPercentile/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/UserPercentile/index.tsx index 0a5669095c2e52..7d05b188e9bbed 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/UserPercentile/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/UserPercentile/index.tsx @@ -9,7 +9,7 @@ import React, { useCallback, useEffect } from 'react'; import { EuiSelect } from '@elastic/eui'; import { useHistory } from 'react-router-dom'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { fromQuery, toQuery } from '../../../shared/Links/url_helpers'; import { I18LABELS } from '../translations'; @@ -20,7 +20,7 @@ export function UserPercentile() { const { urlParams: { percentile }, - } = useUrlParams(); + } = useLegacyUrlParams(); const updatePercentile = useCallback( (percentileN?: number, replaceHistory?: boolean) => { diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdown/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdown/index.tsx index a4edd56310ea11..f044890a9b6499 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdown/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdown/index.tsx @@ -10,10 +10,10 @@ import { EuiFlexGroup, EuiFlexItem, EuiTitle, EuiSpacer } from '@elastic/eui'; import { VisitorBreakdownChart } from '../Charts/VisitorBreakdownChart'; import { I18LABELS, VisitorBreakdownLabel } from '../translations'; import { useFetcher } from '../../../../hooks/use_fetcher'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; export function VisitorBreakdown() { - const { urlParams, uxUiFilters } = useUrlParams(); + const { urlParams, uxUiFilters } = useLegacyUrlParams(); const { start, end, searchTerm } = urlParams; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx index b468b5c9133875..17a380f4d5e35c 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx @@ -21,7 +21,7 @@ import { isErrorEmbeddable, } from '../../../../../../../../src/plugins/embeddable/public'; import { useLayerList } from './useLayerList'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; import type { RenderTooltipContentParams } from '../../../../../../maps/public'; import { MapToolTip } from './MapToolTip'; @@ -50,7 +50,7 @@ interface KibanaDeps { embeddable: EmbeddableStart; } export function EmbeddedMapComponent() { - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const apmPluginContext = useApmPluginContext(); const { start, end, serviceName } = urlParams; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useLayerList.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useLayerList.ts index ce42b530b80f57..7f81e9d1051867 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useLayerList.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useLayerList.ts @@ -22,7 +22,7 @@ import { } from '../../../../../../maps/common'; import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../common/index_pattern_constants'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { SERVICE_NAME, TRANSACTION_TYPE, @@ -84,7 +84,7 @@ interface VectorLayerDescriptor extends BaseVectorLayerDescriptor { } export function useLayerList() { - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { serviceName } = urlParams; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts index c9e8b41c26ea05..0c1b7b6b9e7ee9 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/useMapFilters.ts @@ -7,7 +7,7 @@ import { useMemo } from 'react'; import { FieldFilter as Filter } from '@kbn/es-query'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { CLIENT_GEO_COUNTRY_ISO_CODE, SERVICE_NAME, @@ -92,7 +92,7 @@ const existFilter: Filter = { }; export const useMapFilters = (): Filter[] => { - const { urlParams, uxUiFilters } = useUrlParams(); + const { urlParams, uxUiFilters } = useLegacyUrlParams(); const { serviceName, searchTerm } = urlParams; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/hooks/useLocalUIFilters.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/hooks/useLocalUIFilters.ts index 28c9488d7c82ce..8045e4947dcb0b 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/hooks/useLocalUIFilters.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/hooks/useLocalUIFilters.ts @@ -17,7 +17,7 @@ import { toQuery, } from '../../../../components/shared/Links/url_helpers'; import { removeUndefinedProps } from '../../../../context/url_params_context/helpers'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { getExcludedName } from '../LocalUIFilters'; export type FiltersUIHook = ReturnType; @@ -28,7 +28,7 @@ export function useLocalUIFilters({ filterNames: UxLocalUIFilterName[]; }) { const history = useHistory(); - const { uxUiFilters } = useUrlParams(); + const { uxUiFilters } = useLegacyUrlParams(); const setFilterValue = (name: UxLocalUIFilterName, value: string[]) => { const search = omit(toQuery(history.location.search), name); diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/hooks/useUxQuery.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/hooks/useUxQuery.ts index 585070d479fa82..e3f697e02a2952 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/hooks/useUxQuery.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/hooks/useUxQuery.ts @@ -6,10 +6,10 @@ */ import { useMemo } from 'react'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; export function useUxQuery() { - const { urlParams, uxUiFilters } = useUrlParams(); + const { urlParams, uxUiFilters } = useLegacyUrlParams(); const { start, end, searchTerm, percentile } = urlParams; diff --git a/x-pack/plugins/apm/public/components/app/backend_detail_overview/backend_detail_dependencies_table.tsx b/x-pack/plugins/apm/public/components/app/backend_detail_overview/backend_detail_dependencies_table.tsx index 72273bf8c9e19d..4e3f7f4bee8113 100644 --- a/x-pack/plugins/apm/public/components/app/backend_detail_overview/backend_detail_dependencies_table.tsx +++ b/x-pack/plugins/apm/public/components/app/backend_detail_overview/backend_detail_dependencies_table.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { getNodeName, NodeType } from '../../../../common/connections'; import { useApmParams } from '../../../hooks/use_apm_params'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { useFetcher } from '../../../hooks/use_fetcher'; import { getTimeRangeComparison } from '../../shared/time_comparison/get_time_range_comparison'; import { DependenciesTable } from '../../shared/dependencies_table'; @@ -19,7 +19,7 @@ import { useTimeRange } from '../../../hooks/use_time_range'; export function BackendDetailDependenciesTable() { const { urlParams: { comparisonEnabled, comparisonType }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { query: { backendName, rangeFrom, rangeTo, kuery, environment }, diff --git a/x-pack/plugins/apm/public/components/app/backend_inventory/backend_inventory_dependencies_table/index.tsx b/x-pack/plugins/apm/public/components/app/backend_inventory/backend_inventory_dependencies_table/index.tsx index b84e8830aae5fc..9782afc8df3e84 100644 --- a/x-pack/plugins/apm/public/components/app/backend_inventory/backend_inventory_dependencies_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/backend_inventory/backend_inventory_dependencies_table/index.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { useUiTracker } from '../../../../../../observability/public'; import { getNodeName, NodeType } from '../../../../../common/connections'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../../hooks/use_apm_params'; import { useFetcher } from '../../../../hooks/use_fetcher'; import { useTimeRange } from '../../../../hooks/use_time_range'; @@ -21,7 +21,7 @@ import { getTimeRangeComparison } from '../../../shared/time_comparison/get_time export function BackendInventoryDependenciesTable() { const { urlParams: { comparisonEnabled, comparisonType }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { query: { rangeFrom, rangeTo, environment, kuery }, diff --git a/x-pack/plugins/apm/public/components/app/error_group_details/Distribution/index.tsx b/x-pack/plugins/apm/public/components/app/error_group_details/Distribution/index.tsx index abff0504573599..4c6aa78278093f 100644 --- a/x-pack/plugins/apm/public/components/app/error_group_details/Distribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/error_group_details/Distribution/index.tsx @@ -29,7 +29,7 @@ import { getAlertAnnotations } from '../../../shared/charts/helper/get_alert_ann import { ChartContainer } from '../../../shared/charts/chart_container'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; import { LazyAlertsFlyout } from '../../../../../../observability/public'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { getTimeZone } from '../../../shared/charts/helper/timezone'; const ALERT_RULE_TYPE_ID: typeof ALERT_RULE_TYPE_ID_TYPED = @@ -48,7 +48,7 @@ export function ErrorDistribution({ distribution, title, fetchStatus }: Props) { const { core } = useApmPluginContext(); const theme = useTheme(); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { comparisonEnabled } = urlParams; const timeseries = [ diff --git a/x-pack/plugins/apm/public/components/app/error_group_details/index.tsx b/x-pack/plugins/apm/public/components/app/error_group_details/index.tsx index bc12b0c64f1792..f3bd8812dfd36c 100644 --- a/x-pack/plugins/apm/public/components/app/error_group_details/index.tsx +++ b/x-pack/plugins/apm/public/components/app/error_group_details/index.tsx @@ -20,7 +20,7 @@ import { euiStyled } from '../../../../../../../src/plugins/kibana_react/common' import { NOT_AVAILABLE_LABEL } from '../../../../common/i18n'; import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context'; import { useBreadcrumb } from '../../../context/breadcrumbs/use_breadcrumb'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../hooks/use_apm_params'; import { useApmRouter } from '../../../hooks/use_apm_router'; import { useErrorGroupDistributionFetcher } from '../../../hooks/use_error_group_distribution_fetcher'; @@ -94,7 +94,7 @@ function ErrorGroupHeader({ } export function ErrorGroupDetails() { - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { serviceName } = useApmServiceContext(); diff --git a/x-pack/plugins/apm/public/components/app/error_group_overview/error_group_list/index.tsx b/x-pack/plugins/apm/public/components/app/error_group_overview/error_group_list/index.tsx index d7c5b1f4bc3580..7facc9a4ca3765 100644 --- a/x-pack/plugins/apm/public/components/app/error_group_overview/error_group_list/index.tsx +++ b/x-pack/plugins/apm/public/components/app/error_group_overview/error_group_list/index.tsx @@ -16,7 +16,7 @@ import { i18n } from '@kbn/i18n'; import React, { useMemo } from 'react'; import { euiStyled } from '../../../../../../../../src/plugins/kibana_react/common'; import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { truncate, unit } from '../../../../utils/style'; import { ErrorDetailLink } from '../../../shared/Links/apm/ErrorDetailLink'; @@ -56,7 +56,7 @@ interface Props { } function ErrorGroupList({ items, serviceName }: Props) { - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const columns = useMemo(() => { return [ diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx index aea7c1faab6011..155de8fbdd9473 100644 --- a/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx @@ -17,7 +17,7 @@ import uuid from 'uuid'; import { toMountPoint } from '../../../../../../../src/plugins/kibana_react/public'; import { useAnomalyDetectionJobsContext } from '../../../context/anomaly_detection_jobs/use_anomaly_detection_jobs_context'; import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { useLocalStorage } from '../../../hooks/useLocalStorage'; import { useApmParams } from '../../../hooks/use_apm_params'; import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher'; @@ -42,7 +42,7 @@ let hasDisplayedToast = false; function useServicesFetcher() { const { urlParams: { comparisonEnabled, comparisonType }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { query: { rangeFrom, rangeTo, environment, kuery }, diff --git a/x-pack/plugins/apm/public/components/app/service_map/Controls.tsx b/x-pack/plugins/apm/public/components/app/service_map/Controls.tsx index 69644216fc2674..4605952a6f3960 100644 --- a/x-pack/plugins/apm/public/components/app/service_map/Controls.tsx +++ b/x-pack/plugins/apm/public/components/app/service_map/Controls.tsx @@ -11,8 +11,8 @@ import React, { useContext, useEffect, useState } from 'react'; import { euiStyled } from '../../../../../../../src/plugins/kibana_react/common'; import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; import { useTheme } from '../../../hooks/use_theme'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; import { getLegacyApmHref } from '../../shared/Links/apm/APMLink'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { APMQueryParams } from '../../shared/Links/url_helpers'; import { CytoscapeContext } from './Cytoscape'; import { getAnimationOptions, getNodeHeight } from './cytoscape_options'; @@ -103,7 +103,7 @@ export function Controls() { const { basePath } = core.http; const theme = useTheme(); const cy = useContext(CytoscapeContext); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { query: { kuery }, diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_dependencies_table/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_dependencies_table/index.tsx index 208d1a30a46d11..cbf60b7b59e4d8 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_dependencies_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_dependencies_table/index.tsx @@ -11,7 +11,7 @@ import React, { ReactNode } from 'react'; import { useUiTracker } from '../../../../../../observability/public'; import { getNodeName, NodeType } from '../../../../../common/connections'; import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../../hooks/use_apm_params'; import { useFetcher } from '../../../../hooks/use_fetcher'; import { useTimeRange } from '../../../../hooks/use_time_range'; @@ -33,7 +33,7 @@ export function ServiceOverviewDependenciesTable({ }: ServiceOverviewDependenciesTableProps) { const { urlParams: { comparisonEnabled, comparisonType, latencyAggregationType }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { query: { environment, kuery, rangeFrom, rangeTo }, diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx index d7116763780398..ce4ba85b233e2a 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx @@ -16,7 +16,7 @@ import { orderBy } from 'lodash'; import React, { useState } from 'react'; import uuid from 'uuid'; import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher'; import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { ErrorOverviewLink } from '../../../shared/Links/apm/ErrorOverviewLink'; @@ -61,7 +61,7 @@ const INITIAL_STATE_DETAILED_STATISTICS: ErrorGroupDetailedStatistics = { export function ServiceOverviewErrorsTable({ serviceName }: Props) { const { urlParams: { comparisonType, comparisonEnabled }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { transactionType } = useApmServiceContext(); const [tableOptions, setTableOptions] = useState<{ pageIndex: number; diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx index 74a9a60afd9157..07e4e81e4d2161 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx @@ -10,7 +10,7 @@ import { orderBy } from 'lodash'; import React, { useState } from 'react'; import uuid from 'uuid'; import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../hooks/use_apm_params'; import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher'; import { useTimeRange } from '../../../hooks/use_time_range'; @@ -78,7 +78,7 @@ export function ServiceOverviewInstancesChartAndTable({ const { urlParams: { latencyAggregationType, comparisonType, comparisonEnabled }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { start, end } = useTimeRange({ rangeFrom, rangeTo }); diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx index 9084ffdda59f85..71ea1412c64265 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx @@ -14,7 +14,7 @@ import { import { i18n } from '@kbn/i18n'; import React, { ReactNode, useEffect, useState } from 'react'; import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { FETCH_STATUS } from '../../../../hooks/use_fetcher'; import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { @@ -76,7 +76,7 @@ export function ServiceOverviewInstancesTable({ const { urlParams: { latencyAggregationType, comparisonEnabled }, - } = useUrlParams(); + } = useLegacyUrlParams(); const [itemIdToOpenActionMenuRowMap, setItemIdToOpenActionMenuRowMap] = useState>({}); diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx index 6648eaec80fa6a..058c7d97b43ccc 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx @@ -16,7 +16,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { asExactTransactionRate } from '../../../../common/utils/formatters'; import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../hooks/use_apm_params'; import { useFetcher } from '../../../hooks/use_fetcher'; import { useTheme } from '../../../hooks/use_theme'; @@ -48,7 +48,7 @@ export function ServiceOverviewThroughputChart({ const { urlParams: { comparisonEnabled, comparisonType }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { query: { rangeFrom, rangeTo }, diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx index 8862596fd6d2ac..ad52adfa13a529 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx @@ -25,7 +25,7 @@ import { useUiTracker } from '../../../../../../observability/public'; import { getDurationFormatter } from '../../../../../common/utils/formatters'; import { DEFAULT_PERCENTILE_THRESHOLD } from '../../../../../common/search_strategies/constants'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { FETCH_STATUS } from '../../../../hooks/use_fetcher'; import { TransactionDistributionChart } from '../../../shared/charts/transaction_distribution_chart'; @@ -69,7 +69,7 @@ export function TransactionDistribution({ traceSamples, }: TransactionDistributionProps) { const transactionColors = useTransactionColors(); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { waterfall, status: waterfallStatus } = useWaterfallFetcher(); const markerCurrentTransaction = diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/distribution/use_transaction_distribution_chart_data.ts b/x-pack/plugins/apm/public/components/app/transaction_details/distribution/use_transaction_distribution_chart_data.ts index 0edf5f648a980d..9fb945100414fa 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/distribution/use_transaction_distribution_chart_data.ts +++ b/x-pack/plugins/apm/public/components/app/transaction_details/distribution/use_transaction_distribution_chart_data.ts @@ -16,7 +16,7 @@ import { EventOutcome } from '../../../../../common/event_outcome'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../../hooks/use_apm_params'; import { useFetcher, FETCH_STATUS } from '../../../../hooks/use_fetcher'; import { useTimeRange } from '../../../../hooks/use_time_range'; @@ -37,7 +37,7 @@ export const useTransactionDistributionChartData = () => { core: { notifications }, } = useApmPluginContext(); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { transactionName } = urlParams; const { diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/transaction_details_tabs.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/transaction_details_tabs.tsx index 9ccca9886e6799..f379369e86643c 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/transaction_details_tabs.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/transaction_details_tabs.tsx @@ -13,7 +13,7 @@ import { useHistory } from 'react-router-dom'; import { XYBrushEvent } from '@elastic/charts'; import { EuiPanel, EuiSpacer, EuiTabs, EuiTab } from '@elastic/eui'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../hooks/use_apm_params'; import { useTransactionTraceSamplesFetcher } from '../../../hooks/use_transaction_trace_samples_fetcher'; @@ -34,7 +34,7 @@ const tabs = [ export function TransactionDetailsTabs() { const { query } = useApmParams('/services/{serviceName}/transactions/view'); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const history = useHistory(); const [currentTab, setCurrentTab] = useState(traceSamplesTab.key); diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/use_waterfall_fetcher.ts b/x-pack/plugins/apm/public/components/app/transaction_details/use_waterfall_fetcher.ts index e7fbc315522e46..4f26a5875347ca 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/use_waterfall_fetcher.ts +++ b/x-pack/plugins/apm/public/components/app/transaction_details/use_waterfall_fetcher.ts @@ -6,7 +6,7 @@ */ import { useMemo } from 'react'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../hooks/use_apm_params'; import { useFetcher } from '../../../hooks/use_fetcher'; import { useTimeRange } from '../../../hooks/use_time_range'; @@ -19,7 +19,7 @@ const INITIAL_DATA = { }; export function useWaterfallFetcher() { - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { traceId, transactionId } = urlParams; const { diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/MaybeViewTraceLink.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/MaybeViewTraceLink.tsx index 359dcdfda0a146..c18bc42a98b2c3 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/MaybeViewTraceLink.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/MaybeViewTraceLink.tsx @@ -9,7 +9,7 @@ import { EuiButton, EuiFlexItem, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import { getNextEnvironmentUrlParam } from '../../../../../common/environment_filter_values'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { Transaction as ITransaction } from '../../../../../typings/es_schemas/ui/transaction'; import { TransactionDetailLink } from '../../../shared/Links/apm/transaction_detail_link'; import { IWaterfall } from './waterfall_container/Waterfall/waterfall_helpers/waterfall_helpers'; @@ -26,7 +26,7 @@ export function MaybeViewTraceLink({ }) { const { urlParams: { latencyAggregationType }, - } = useUrlParams(); + } = useLegacyUrlParams(); const viewFullTraceButtonLabel = i18n.translate( 'xpack.apm.transactionDetails.viewFullTraceButtonLabel', diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/FlyoutTopLevelProperties.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/FlyoutTopLevelProperties.tsx index 8954081f9ab473..e34fdd893ff7f8 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/FlyoutTopLevelProperties.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/FlyoutTopLevelProperties.tsx @@ -13,7 +13,7 @@ import { } from '../../../../../../../common/elasticsearch_fieldnames'; import { getNextEnvironmentUrlParam } from '../../../../../../../common/environment_filter_values'; import { Transaction } from '../../../../../../../typings/es_schemas/ui/transaction'; -import { useUrlParams } from '../../../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../../../../hooks/use_apm_params'; import { TransactionDetailLink } from '../../../../../shared/Links/apm/transaction_detail_link'; import { ServiceLink } from '../../../../../shared/service_link'; @@ -26,7 +26,7 @@ interface Props { export function FlyoutTopLevelProperties({ transaction }: Props) { const { urlParams: { latencyAggregationType }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { query } = useApmParams('/services/{serviceName}/transactions/view'); if (!transaction) { diff --git a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_definition/apm_settings.ts b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_definition/apm_settings.ts index 2b88e1a1df9ed4..ec9f7409323760 100644 --- a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_definition/apm_settings.ts +++ b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_definition/apm_settings.ts @@ -33,7 +33,7 @@ export function getApmSettings({ 'xpack.apm.fleet_integration.settings.apm.hostDescription', { defaultMessage: - 'Choose a name and description to help identify how this integration will be used.', + 'Host defines the host and port the server is listening on. URL is the unchangeable, publicly reachable server URL for deployments on Elastic Cloud or ECK.', } ), @@ -164,10 +164,7 @@ export function getApmSettings({ ), rowDescription: i18n.translate( 'xpack.apm.fleet_integration.settings.apm.responseHeadersDescription', - { - defaultMessage: - 'Set limits on request headers sizes and timing configurations.', - } + { defaultMessage: 'Custom HTTP headers added to HTTP responses' } ), }, { diff --git a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/typings.ts b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/typings.ts index 7df1ccf1fb18fa..4f741ceb46f491 100644 --- a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/typings.ts +++ b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/typings.ts @@ -7,12 +7,12 @@ import * as t from 'io-ts'; import { PackagePolicyConfigRecordEntry } from '../../../../../fleet/common'; -export { +export type { PackagePolicyCreateExtensionComponentProps, PackagePolicyEditExtensionComponentProps, } from '../../../../../fleet/public'; -export { +export type { NewPackagePolicy, PackagePolicy, PackagePolicyConfigRecordEntry, diff --git a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLExplorerLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLExplorerLink.tsx index 11b29f00155fcd..72a29a079bc679 100644 --- a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLExplorerLink.tsx +++ b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLExplorerLink.tsx @@ -10,7 +10,7 @@ import { EuiLink } from '@elastic/eui'; import { UI_SETTINGS } from '../../../../../../../../src/plugins/data/common'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; import { useMlHref, ML_PAGES } from '../../../../../../ml/public'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { TimePickerRefreshInterval } from '../../DatePicker/typings'; interface Props { @@ -37,7 +37,7 @@ export function useExplorerHref({ jobId }: { jobId: string }) { core, plugins: { ml }, } = useApmPluginContext(); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const timePickerRefreshIntervalDefaults = core.uiSettings.get( diff --git a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLManageJobsLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLManageJobsLink.tsx index 5c8d4642040904..eb7b5311217538 100644 --- a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLManageJobsLink.tsx +++ b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLManageJobsLink.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { UI_SETTINGS } from '../../../../../../../../src/plugins/data/common'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; import { useMlHref, ML_PAGES } from '../../../../../../ml/public'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { TimePickerRefreshInterval } from '../../DatePicker/typings'; interface Props { @@ -24,7 +24,7 @@ export function MLManageJobsLink({ children, external }: Props) { plugins: { ml }, } = useApmPluginContext(); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const timePickerRefreshIntervalDefaults = core.uiSettings.get( diff --git a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLSingleMetricLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLSingleMetricLink.tsx index a36beccd16be5c..2964a8e2578c70 100644 --- a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLSingleMetricLink.tsx +++ b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLSingleMetricLink.tsx @@ -10,7 +10,7 @@ import { EuiLink } from '@elastic/eui'; import { UI_SETTINGS } from '../../../../../../../../src/plugins/data/common'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; import { useMlHref, ML_PAGES } from '../../../../../../ml/public'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { TimePickerRefreshInterval } from '../../DatePicker/typings'; interface Props { @@ -53,7 +53,7 @@ export function useSingleMetricHref({ core, plugins: { ml }, } = useApmPluginContext(); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const timePickerRefreshIntervalDefaults = core.uiSettings.get( diff --git a/x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.tsx index fbf4dff24fbf49..bcb305bd38ec34 100644 --- a/x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.tsx +++ b/x-pack/plugins/apm/public/components/shared/Links/apm/APMLink.tsx @@ -13,7 +13,7 @@ import { useLocation } from 'react-router-dom'; import url from 'url'; import { pickKeys } from '../../../../../common/utils/pick_keys'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { APMQueryParams, fromQuery, toQuery } from '../url_helpers'; interface Props extends EuiLinkAnchorProps { @@ -46,7 +46,7 @@ export function useAPMHref({ persistedFilters?: Array; query?: APMQueryParams; }) { - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { basePath } = useApmPluginContext().core.http; const { search } = useLocation(); const nextQuery = { diff --git a/x-pack/plugins/apm/public/components/shared/Links/apm/ErrorOverviewLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/ErrorOverviewLink.tsx index b06de47472a110..ccd9bdff960b60 100644 --- a/x-pack/plugins/apm/public/components/shared/Links/apm/ErrorOverviewLink.tsx +++ b/x-pack/plugins/apm/public/components/shared/Links/apm/ErrorOverviewLink.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { pickKeys } from '../../../../../common/utils/pick_keys'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { APMQueryParams } from '../url_helpers'; import { APMLink, APMLinkExtendProps } from './APMLink'; @@ -24,7 +24,7 @@ interface Props extends APMLinkExtendProps { } export function ErrorOverviewLink({ serviceName, query, ...rest }: Props) { - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); return ( showPopover(!isPopoverOpen); diff --git a/x-pack/plugins/apm/public/components/shared/charts/failed_transaction_rate_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/failed_transaction_rate_chart/index.tsx index cda0058bdacd3e..a5952a363a9e06 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/failed_transaction_rate_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/failed_transaction_rate_chart/index.tsx @@ -14,7 +14,7 @@ import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { asPercent } from '../../../../../common/utils/formatters'; import { useFetcher } from '../../../../hooks/use_fetcher'; import { useTheme } from '../../../../hooks/use_theme'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { TimeseriesChart } from '../timeseries_chart'; import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; import { @@ -58,7 +58,7 @@ export function FailedTransactionRateChart({ const theme = useTheme(); const { urlParams: { transactionName, comparisonEnabled, comparisonType }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { query: { rangeFrom, rangeTo }, diff --git a/x-pack/plugins/apm/public/components/shared/charts/latency_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/latency_chart/index.tsx index 3cee9c22174adc..e19f78006d9fea 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/latency_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/latency_chart/index.tsx @@ -17,7 +17,7 @@ import { useApmServiceContext } from '../../../../context/apm_service/use_apm_se import { LatencyAggregationType } from '../../../../../common/latency_aggregation_types'; import { getDurationFormatter } from '../../../../../common/utils/formatters'; import { useLicenseContext } from '../../../../context/license/use_license_context'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useTheme } from '../../../../hooks/use_theme'; import { useTransactionLatencyChartsFetcher } from '../../../../hooks/use_transaction_latency_chart_fetcher'; import { TimeseriesChart } from '../../../shared/charts/timeseries_chart'; @@ -52,7 +52,7 @@ export function LatencyChart({ height, kuery, environment }: Props) { const history = useHistory(); const theme = useTheme(); const comparisonChartTheme = getComparisonChartTheme(theme); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { latencyAggregationType, comparisonEnabled } = urlParams; const license = useLicenseContext(); diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/use_transaction_breakdown.ts b/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/use_transaction_breakdown.ts index 079b8455de7ad2..a32f7ededea400 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/use_transaction_breakdown.ts +++ b/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/use_transaction_breakdown.ts @@ -6,7 +6,7 @@ */ import { useFetcher } from '../../../../hooks/use_fetcher'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; import { useApmParams } from '../../../../hooks/use_apm_params'; import { useTimeRange } from '../../../../hooks/use_time_range'; @@ -20,7 +20,7 @@ export function useTransactionBreakdown({ }) { const { urlParams: { transactionName }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { query: { rangeFrom, rangeTo }, diff --git a/x-pack/plugins/apm/public/components/shared/kuery_bar/index.tsx b/x-pack/plugins/apm/public/components/shared/kuery_bar/index.tsx index 4dc24567259e67..20484e691d50b8 100644 --- a/x-pack/plugins/apm/public/components/shared/kuery_bar/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/kuery_bar/index.tsx @@ -16,7 +16,7 @@ import { QuerySuggestion, } from '../../../../../../../src/plugins/data/public'; import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../hooks/use_apm_params'; import { useDynamicDataViewFetcher } from '../../../hooks/use_dynamic_data_view'; import { fromQuery, toQuery } from '../Links/url_helpers'; @@ -52,7 +52,7 @@ export function KueryBar(props: { suggestions: [], isLoadingSuggestions: false, }); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const location = useLocation(); const { data } = useApmPluginContext().plugins; diff --git a/x-pack/plugins/apm/public/components/shared/managed_table/index.tsx b/x-pack/plugins/apm/public/components/shared/managed_table/index.tsx index f1776abe83e970..5d49f1d9a8f18e 100644 --- a/x-pack/plugins/apm/public/components/shared/managed_table/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/managed_table/index.tsx @@ -10,7 +10,7 @@ import { EuiBasicTable, EuiBasicTableColumn } from '@elastic/eui'; import { orderBy } from 'lodash'; import React, { ReactNode, useCallback, useMemo } from 'react'; import { useHistory } from 'react-router-dom'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { fromQuery, toQuery } from '../Links/url_helpers'; // TODO: this should really be imported from EUI @@ -79,7 +79,7 @@ function UnoptimizedManagedTable(props: Props) { sortField = initialSortField, sortDirection = initialSortDirection, }, - } = useUrlParams(); + } = useLegacyUrlParams(); const renderedItems = useMemo(() => { const sortedItems = sortItems diff --git a/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx b/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx index 35a6bc76348136..9d077713ff12ec 100644 --- a/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx @@ -13,7 +13,7 @@ import { useHistory } from 'react-router-dom'; import { euiStyled } from '../../../../../../../src/plugins/kibana_react/common'; import { useUiTracker } from '../../../../../observability/public'; import { TimeRangeComparisonEnum } from '../../../../common/runtime_types/comparison_type_rt'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { useApmParams } from '../../../hooks/use_apm_params'; import { useBreakpoints } from '../../../hooks/use_breakpoints'; import { useTimeRange } from '../../../hooks/use_time_range'; @@ -127,7 +127,7 @@ export function TimeComparison() { const { urlParams: { comparisonEnabled, comparisonType }, - } = useUrlParams(); + } = useLegacyUrlParams(); const comparisonTypes = getComparisonTypes({ start: exactStart, diff --git a/x-pack/plugins/apm/public/components/shared/transaction_action_menu/TransactionActionMenu.tsx b/x-pack/plugins/apm/public/components/shared/transaction_action_menu/TransactionActionMenu.tsx index a4f7c2b6634846..2f856dce387bfd 100644 --- a/x-pack/plugins/apm/public/components/shared/transaction_action_menu/TransactionActionMenu.tsx +++ b/x-pack/plugins/apm/public/components/shared/transaction_action_menu/TransactionActionMenu.tsx @@ -21,7 +21,7 @@ import { import { Transaction } from '../../../../typings/es_schemas/ui/transaction'; import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; import { useLicenseContext } from '../../../context/license/use_license_context'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { CustomLinkMenuSection } from './custom_link_menu_section'; import { getSections } from './sections'; @@ -45,7 +45,7 @@ export function TransactionActionMenu({ transaction }: Props) { const { core } = useApmPluginContext(); const location = useLocation(); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const [isActionPopoverOpen, setIsActionPopoverOpen] = useState(false); diff --git a/x-pack/plugins/apm/public/components/shared/transactions_table/index.tsx b/x-pack/plugins/apm/public/components/shared/transactions_table/index.tsx index d6d955b8ef5abe..6c934cc51e2f7a 100644 --- a/x-pack/plugins/apm/public/components/shared/transactions_table/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/transactions_table/index.tsx @@ -20,7 +20,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiCode } from '@elastic/eui'; import { APIReturnType } from '../../../services/rest/createCallApmApi'; import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../../../context/url_params_context/use_url_params'; import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher'; import { TransactionOverviewLink } from '../Links/apm/transaction_overview_link'; import { getTimeRangeComparison } from '../time_comparison/get_time_range_comparison'; @@ -100,7 +100,7 @@ export function TransactionsTable({ const { transactionType, serviceName } = useApmServiceContext(); const { urlParams: { latencyAggregationType, comparisonType, comparisonEnabled }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { comparisonStart, comparisonEnd } = getTimeRangeComparison({ start, diff --git a/x-pack/plugins/apm/public/context/url_params_context/use_url_params.tsx b/x-pack/plugins/apm/public/context/url_params_context/use_url_params.tsx index 5e91bfd1549ed1..7c7a00da728ad4 100644 --- a/x-pack/plugins/apm/public/context/url_params_context/use_url_params.tsx +++ b/x-pack/plugins/apm/public/context/url_params_context/use_url_params.tsx @@ -10,7 +10,7 @@ import { useMemo, useContext } from 'react'; import type { ApmUrlParams } from './types'; import { UrlParamsContext } from './url_params_context'; -export function useUrlParams(): Assign< +export function useLegacyUrlParams(): Assign< React.ContextType, { urlParams: ApmUrlParams } > { diff --git a/x-pack/plugins/apm/public/hooks/use_comparison.ts b/x-pack/plugins/apm/public/hooks/use_comparison.ts index 2875d973a5e18a..dbd37c25784cf9 100644 --- a/x-pack/plugins/apm/public/hooks/use_comparison.ts +++ b/x-pack/plugins/apm/public/hooks/use_comparison.ts @@ -9,7 +9,7 @@ import { getComparisonChartTheme, getTimeRangeComparison, } from '../components/shared/time_comparison/get_time_range_comparison'; -import { useUrlParams } from '../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../context/url_params_context/use_url_params'; import { useApmParams } from './use_apm_params'; import { useTheme } from './use_theme'; import { useTimeRange } from './use_time_range'; @@ -31,7 +31,7 @@ export function useComparison() { const { urlParams: { comparisonType, comparisonEnabled }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { offset } = getTimeRangeComparison({ start, diff --git a/x-pack/plugins/apm/public/hooks/use_search_strategy.ts b/x-pack/plugins/apm/public/hooks/use_search_strategy.ts index 275eddb68ae003..95bc8cb7435a22 100644 --- a/x-pack/plugins/apm/public/hooks/use_search_strategy.ts +++ b/x-pack/plugins/apm/public/hooks/use_search_strategy.ts @@ -31,7 +31,7 @@ import { APM_SEARCH_STRATEGIES, } from '../../common/search_strategies/constants'; import { useApmServiceContext } from '../context/apm_service/use_apm_service_context'; -import { useUrlParams } from '../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../context/url_params_context/use_url_params'; import { ApmPluginStartDeps } from '../plugin'; @@ -103,7 +103,7 @@ export function useSearchStrategy< query: { kuery, environment, rangeFrom, rangeTo }, } = useApmParams('/services/{serviceName}/transactions/view'); const { start, end } = useTimeRange({ rangeFrom, rangeTo }); - const { urlParams } = useUrlParams(); + const { urlParams } = useLegacyUrlParams(); const { transactionName } = urlParams; const [rawResponse, setRawResponse] = useReducer( diff --git a/x-pack/plugins/apm/public/hooks/use_transaction_latency_chart_fetcher.ts b/x-pack/plugins/apm/public/hooks/use_transaction_latency_chart_fetcher.ts index d44ec853a242cb..0ed3de14c129f8 100644 --- a/x-pack/plugins/apm/public/hooks/use_transaction_latency_chart_fetcher.ts +++ b/x-pack/plugins/apm/public/hooks/use_transaction_latency_chart_fetcher.ts @@ -7,7 +7,7 @@ import { useMemo } from 'react'; import { useFetcher } from './use_fetcher'; -import { useUrlParams } from '../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../context/url_params_context/use_url_params'; import { useApmServiceContext } from '../context/apm_service/use_apm_service_context'; import { getLatencyChartSelector } from '../selectors/latency_chart_selectors'; import { useTheme } from './use_theme'; @@ -31,7 +31,7 @@ export function useTransactionLatencyChartsFetcher({ comparisonType, comparisonEnabled, }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { query: { rangeFrom, rangeTo }, diff --git a/x-pack/plugins/apm/public/hooks/use_transaction_trace_samples_fetcher.ts b/x-pack/plugins/apm/public/hooks/use_transaction_trace_samples_fetcher.ts index 741100aca16e97..93349d3f955b88 100644 --- a/x-pack/plugins/apm/public/hooks/use_transaction_trace_samples_fetcher.ts +++ b/x-pack/plugins/apm/public/hooks/use_transaction_trace_samples_fetcher.ts @@ -6,7 +6,7 @@ */ import { useFetcher } from './use_fetcher'; -import { useUrlParams } from '../context/url_params_context/use_url_params'; +import { useLegacyUrlParams } from '../context/url_params_context/use_url_params'; import { useApmServiceContext } from '../context/apm_service/use_apm_service_context'; import { useApmParams } from './use_apm_params'; import { useTimeRange } from './use_time_range'; @@ -39,7 +39,7 @@ export function useTransactionTraceSamplesFetcher({ const { urlParams: { transactionId, traceId, sampleRangeFrom, sampleRangeTo }, - } = useUrlParams(); + } = useLegacyUrlParams(); const { data = INITIAL_DATA, diff --git a/x-pack/plugins/apm/public/index.ts b/x-pack/plugins/apm/public/index.ts index 2734269b9cff9e..9b2175dd465bcc 100644 --- a/x-pack/plugins/apm/public/index.ts +++ b/x-pack/plugins/apm/public/index.ts @@ -23,4 +23,4 @@ export const plugin: PluginInitializer = ( pluginInitializerContext: PluginInitializerContext ) => new ApmPlugin(pluginInitializerContext); -export { ApmPluginSetup, ApmPluginStart }; +export type { ApmPluginSetup, ApmPluginStart }; diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index 4b5c2b5d6134d6..bd30f9e2126871 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -37,7 +37,7 @@ const configSchema = schema.object({ schema.literal(SearchAggregatedTransactionSetting.always), schema.literal(SearchAggregatedTransactionSetting.never), ], - { defaultValue: SearchAggregatedTransactionSetting.never } + { defaultValue: SearchAggregatedTransactionSetting.auto } ), telemetryCollectionEnabled: schema.boolean({ defaultValue: true }), metricsInterval: schema.number({ defaultValue: 30 }), @@ -112,11 +112,11 @@ export const plugin = (initContext: PluginInitializerContext) => export { APM_SERVER_FEATURE_ID } from '../common/alert_types'; export { APMPlugin } from './plugin'; -export { APMPluginSetup } from './types'; -export { +export type { APMPluginSetup } from './types'; +export type { APMServerRouteRepository, APIEndpoint, } from './routes/get_global_apm_server_route_repository'; -export { APMRouteHandlerResources } from './routes/typings'; +export type { APMRouteHandlerResources } from './routes/typings'; export type { ProcessorEvent } from '../common/processor_event'; diff --git a/x-pack/plugins/apm/server/lib/helpers/transactions/index.ts b/x-pack/plugins/apm/server/lib/helpers/transactions/index.ts index 473d34cd5b6fc0..edaae8cadc1d51 100644 --- a/x-pack/plugins/apm/server/lib/helpers/transactions/index.ts +++ b/x-pack/plugins/apm/server/lib/helpers/transactions/index.ts @@ -63,18 +63,23 @@ export async function getSearchAggregatedTransactions({ apmEventClient: APMEventClient; kuery: string; }): Promise { - const searchAggregatedTransactions = config.searchAggregatedTransactions; + switch (config.searchAggregatedTransactions) { + case SearchAggregatedTransactionSetting.always: + return kuery + ? getHasAggregatedTransactions({ start, end, apmEventClient, kuery }) + : true; - if ( - kuery || - searchAggregatedTransactions === SearchAggregatedTransactionSetting.auto - ) { - return getHasAggregatedTransactions({ start, end, apmEventClient, kuery }); - } + case SearchAggregatedTransactionSetting.auto: + return getHasAggregatedTransactions({ + start, + end, + apmEventClient, + kuery, + }); - return ( - searchAggregatedTransactions === SearchAggregatedTransactionSetting.always - ); + case SearchAggregatedTransactionSetting.never: + return false; + } } export function getTransactionDurationFieldForTransactions( diff --git a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts index 107493af1a0c05..a37720cbc3790c 100644 --- a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts +++ b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts @@ -16,7 +16,7 @@ import { APMRouteHandlerResources } from '../../../routes/typings'; import { withApmSpan } from '../../../utils/with_apm_span'; import { ApmIndicesConfig } from '../../../../../observability/common/typings'; -export { ApmIndicesConfig }; +export type { ApmIndicesConfig }; type ISavedObjectsClient = Pick; diff --git a/x-pack/plugins/banners/common/index.ts b/x-pack/plugins/banners/common/index.ts index a4c38a58ab5726..348d42adb7d8f3 100644 --- a/x-pack/plugins/banners/common/index.ts +++ b/x-pack/plugins/banners/common/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { BannerInfoResponse, BannerPlacement, BannerConfiguration } from './types'; +export type { BannerInfoResponse, BannerPlacement, BannerConfiguration } from './types'; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/expression_types/embeddable.ts b/x-pack/plugins/canvas/canvas_plugin_src/expression_types/embeddable.ts index ac2e8e8babee1e..66cb95a4a210a7 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/expression_types/embeddable.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/expression_types/embeddable.ts @@ -10,7 +10,8 @@ import { EmbeddableInput } from '../../../../../src/plugins/embeddable/common/'; import { EmbeddableTypes } from './embeddable_types'; export const EmbeddableExpressionType = 'embeddable'; -export { EmbeddableTypes, EmbeddableInput }; +export type { EmbeddableInput }; +export { EmbeddableTypes }; export interface EmbeddableExpression { /** diff --git a/x-pack/plugins/canvas/common/index.ts b/x-pack/plugins/canvas/common/index.ts index 5bae69e8601b2b..51a661f6e8d1ee 100644 --- a/x-pack/plugins/canvas/common/index.ts +++ b/x-pack/plugins/canvas/common/index.ts @@ -9,4 +9,5 @@ export const UI_SETTINGS = { ENABLE_LABS_UI: 'labs:canvas:enable_ui', }; -export { CANVAS_APP_LOCATOR, CanvasAppLocator, CanvasAppLocatorParams } from './locator'; +export type { CanvasAppLocator, CanvasAppLocatorParams } from './locator'; +export { CANVAS_APP_LOCATOR } from './locator'; diff --git a/x-pack/plugins/canvas/public/components/color_manager/index.ts b/x-pack/plugins/canvas/public/components/color_manager/index.ts index 17856a88bcc003..937afeb438006a 100644 --- a/x-pack/plugins/canvas/public/components/color_manager/index.ts +++ b/x-pack/plugins/canvas/public/components/color_manager/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { ColorManager, Props } from './color_manager'; +export type { Props } from './color_manager'; +export { ColorManager } from './color_manager'; diff --git a/x-pack/plugins/canvas/public/components/color_picker/index.ts b/x-pack/plugins/canvas/public/components/color_picker/index.ts index ba411db1129e50..709b3535b5d582 100644 --- a/x-pack/plugins/canvas/public/components/color_picker/index.ts +++ b/x-pack/plugins/canvas/public/components/color_picker/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { ColorPicker, Props } from './color_picker'; +export type { Props } from './color_picker'; +export { ColorPicker } from './color_picker'; diff --git a/x-pack/plugins/canvas/public/components/color_picker_popover/index.ts b/x-pack/plugins/canvas/public/components/color_picker_popover/index.ts index 76663397ff6953..08bf41f2fbc03a 100644 --- a/x-pack/plugins/canvas/public/components/color_picker_popover/index.ts +++ b/x-pack/plugins/canvas/public/components/color_picker_popover/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { ColorPickerPopover, Props } from './color_picker_popover'; +export type { Props } from './color_picker_popover'; +export { ColorPickerPopover } from './color_picker_popover'; diff --git a/x-pack/plugins/canvas/public/components/embeddable_flyout/index.ts b/x-pack/plugins/canvas/public/components/embeddable_flyout/index.ts index 6acc4051e1ecc1..98943a820e37a1 100644 --- a/x-pack/plugins/canvas/public/components/embeddable_flyout/index.ts +++ b/x-pack/plugins/canvas/public/components/embeddable_flyout/index.ts @@ -6,7 +6,5 @@ */ export { EmbeddableFlyoutPortal, AddEmbeddablePanel } from './flyout'; -export { - AddEmbeddableFlyout as AddEmbeddableFlyoutComponent, - Props as AddEmbeddableFlyoutComponentProps, -} from './flyout.component'; +export type { Props as AddEmbeddableFlyoutComponentProps } from './flyout.component'; +export { AddEmbeddableFlyout as AddEmbeddableFlyoutComponent } from './flyout.component'; diff --git a/x-pack/plugins/canvas/public/components/paginate/index.tsx b/x-pack/plugins/canvas/public/components/paginate/index.tsx index f320860bd903b9..12717a07f4cf9b 100644 --- a/x-pack/plugins/canvas/public/components/paginate/index.tsx +++ b/x-pack/plugins/canvas/public/components/paginate/index.tsx @@ -9,7 +9,7 @@ import React, { useState, useEffect, useRef } from 'react'; import PropTypes from 'prop-types'; import { Paginate as Component, PaginateProps, PaginateChildProps } from './paginate'; -export { PaginateProps, PaginateChildProps }; +export type { PaginateProps, PaginateChildProps }; export interface InPaginateProps { perPage?: number; startPage?: number; diff --git a/x-pack/plugins/canvas/public/components/popover/index.ts b/x-pack/plugins/canvas/public/components/popover/index.ts index e1d8a5c63c28ba..f9d7e3c0501a85 100644 --- a/x-pack/plugins/canvas/public/components/popover/index.ts +++ b/x-pack/plugins/canvas/public/components/popover/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { Popover, ClosePopoverFn } from './popover'; +export type { ClosePopoverFn } from './popover'; +export { Popover } from './popover'; diff --git a/x-pack/plugins/canvas/public/components/saved_elements_modal/index.ts b/x-pack/plugins/canvas/public/components/saved_elements_modal/index.ts index 9656dfa8ad4875..b4b5d78646aa47 100644 --- a/x-pack/plugins/canvas/public/components/saved_elements_modal/index.ts +++ b/x-pack/plugins/canvas/public/components/saved_elements_modal/index.ts @@ -6,7 +6,5 @@ */ export { SavedElementsModal } from './saved_elements_modal'; -export { - SavedElementsModal as SavedElementsModalComponent, - Props as SavedElementsModalComponentProps, -} from './saved_elements_modal.component'; +export type { Props as SavedElementsModalComponentProps } from './saved_elements_modal.component'; +export { SavedElementsModal as SavedElementsModalComponent } from './saved_elements_modal.component'; diff --git a/x-pack/plugins/canvas/public/components/workpad/workpad.component.tsx b/x-pack/plugins/canvas/public/components/workpad/workpad.component.tsx index 1ac737bc543eb0..740f71eab085a8 100644 --- a/x-pack/plugins/canvas/public/components/workpad/workpad.component.tsx +++ b/x-pack/plugins/canvas/public/components/workpad/workpad.component.tsx @@ -11,7 +11,11 @@ import Style from 'style-it'; // @ts-expect-error import { WorkpadPage } from '../workpad_page'; import { Fullscreen } from '../fullscreen'; -import { HEADER_BANNER_HEIGHT, WORKPAD_CANVAS_BUFFER } from '../../../common/lib/constants'; +import { + HEADER_BANNER_HEIGHT, + WORKPAD_CANVAS_BUFFER, + DEFAULT_WORKPAD_CSS, +} from '../../../common/lib/constants'; import { CommitFn, CanvasPage } from '../../../types'; import { WorkpadShortcuts } from './workpad_shortcuts.component'; @@ -122,7 +126,7 @@ export const Workpad: FC = ({ // NOTE: the data-shared-* attributes here are used for reporting return Style.it( - workpadCss, + workpadCss || DEFAULT_WORKPAD_CSS,

{ const renderers: string[] = []; diff --git a/x-pack/plugins/canvas/public/components/workpad_header/share_menu/utils.ts b/x-pack/plugins/canvas/public/components/workpad_header/share_menu/utils.ts index 311ef73e1c9732..bee0e1f3a5177d 100644 --- a/x-pack/plugins/canvas/public/components/workpad_header/share_menu/utils.ts +++ b/x-pack/plugins/canvas/public/components/workpad_header/share_menu/utils.ts @@ -9,6 +9,7 @@ import type { RedirectOptions } from 'src/plugins/share/public'; import { CANVAS_APP_LOCATOR } from '../../../../common/locator'; import { CanvasAppLocatorParams } from '../../../../common/locator'; import { CanvasWorkpad } from '../../../../types'; +import { JobAppParamsPDFV2 } from '../../../../../reporting/public'; export interface CanvasWorkpadSharingData { workpad: Pick; @@ -18,7 +19,7 @@ export interface CanvasWorkpadSharingData { export function getPdfJobParams( { workpad: { id, name: title, width, height }, pageCount }: CanvasWorkpadSharingData, version: string -) { +): JobAppParamsPDFV2 { // The viewport in Reporting by specifying the dimensions. In order for things to work, // we need a viewport that will include all of the pages in the workpad. The viewport // also needs to include any offset values from the 0,0 position, otherwise the cropped diff --git a/x-pack/plugins/canvas/public/index.ts b/x-pack/plugins/canvas/public/index.ts index a15b15fcae3337..95d4333c6e9e53 100644 --- a/x-pack/plugins/canvas/public/index.ts +++ b/x-pack/plugins/canvas/public/index.ts @@ -10,7 +10,7 @@ import { CoreStart } from '../../../../src/core/public'; import { CanvasServices } from './services'; import { CanvasSetup, CanvasStart, CanvasStartDeps, CanvasPlugin } from './plugin'; -export { CanvasSetup, CanvasStart }; +export type { CanvasSetup, CanvasStart }; export interface WithKibanaProps { kibana: { diff --git a/x-pack/plugins/canvas/public/plugin.tsx b/x-pack/plugins/canvas/public/plugin.tsx index 723d1afea2860f..5d1f05fdbe8bf5 100644 --- a/x-pack/plugins/canvas/public/plugin.tsx +++ b/x-pack/plugins/canvas/public/plugin.tsx @@ -37,7 +37,7 @@ import { getPluginApi, CanvasApi } from './plugin_api'; import { setupExpressions } from './setup_expressions'; import { pluginServiceRegistry } from './services/kibana'; -export { CoreStart, CoreSetup }; +export type { CoreStart, CoreSetup }; /** * These are the private interfaces for the services your plugin depends on. diff --git a/x-pack/plugins/canvas/public/routes/workpad/index.tsx b/x-pack/plugins/canvas/public/routes/workpad/index.tsx index 0b6153bc06afdc..1b46a5cf78df1b 100644 --- a/x-pack/plugins/canvas/public/routes/workpad/index.tsx +++ b/x-pack/plugins/canvas/public/routes/workpad/index.tsx @@ -9,7 +9,8 @@ import { RouteComponentProps } from 'react-router-dom'; export { WorkpadRoute, ExportWorkpadRoute } from './workpad_route'; -export { WorkpadRoutingContext, WorkpadRoutingContextType } from './workpad_routing_context'; +export type { WorkpadRoutingContextType } from './workpad_routing_context'; +export { WorkpadRoutingContext } from './workpad_routing_context'; export interface WorkpadRouteParams { id: string; diff --git a/x-pack/plugins/canvas/public/services/legacy/index.ts b/x-pack/plugins/canvas/public/services/legacy/index.ts index fdc4e30cabe51b..82ef3f248f7fdf 100644 --- a/x-pack/plugins/canvas/public/services/legacy/index.ts +++ b/x-pack/plugins/canvas/public/services/legacy/index.ts @@ -10,7 +10,7 @@ import { CoreSetup, CoreStart, AppUpdater } from '../../../../../../src/core/pub import { CanvasSetupDeps, CanvasStartDeps } from '../../plugin'; import { searchServiceFactory } from './search'; -export { SearchService } from './search'; +export type { SearchService } from './search'; export { ExpressionsService } from '../../../../../../src/plugins/expressions/common'; export * from './context'; diff --git a/x-pack/plugins/canvas/server/mocks/index.ts b/x-pack/plugins/canvas/server/mocks/index.ts index 1cb39c690df979..f3d3ef955d0e48 100644 --- a/x-pack/plugins/canvas/server/mocks/index.ts +++ b/x-pack/plugins/canvas/server/mocks/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { workpadRouteContextMock, MockWorkpadRouteContext } from './workpad_route_context'; +export type { MockWorkpadRouteContext } from './workpad_route_context'; +export { workpadRouteContextMock } from './workpad_route_context'; diff --git a/x-pack/plugins/cases/common/ui/types.ts b/x-pack/plugins/cases/common/ui/types.ts index b4ed4f7db177eb..402e44618c7ccf 100644 --- a/x-pack/plugins/cases/common/ui/types.ts +++ b/x-pack/plugins/cases/common/ui/types.ts @@ -255,10 +255,19 @@ export interface SignalEcs { threshold_result?: unknown; } +export type SignalEcsAAD = Exclude & { + rule?: Exclude & { uuid: string[] }; + building_block_type?: string[]; + workflow_status?: string[]; +}; + export interface Ecs { _id: string; _index?: string; signal?: SignalEcs; + kibana?: { + alert: SignalEcsAAD; + }; } export type CaseActionConnector = ActionConnector; diff --git a/x-pack/plugins/cases/public/common/shared_imports.ts b/x-pack/plugins/cases/public/common/shared_imports.ts index 4641fcfa2167cb..21040543fae699 100644 --- a/x-pack/plugins/cases/public/common/shared_imports.ts +++ b/x-pack/plugins/cases/public/common/shared_imports.ts @@ -5,31 +5,33 @@ * 2.0. */ +export type { + FieldHook, + FieldValidateResponse, + FormData, + FormHook, + FormSchema, + ValidationError, + ValidationFunc, + FieldConfig, + ValidationConfig, +} from '../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; export { getUseField, getFieldValidityAndErrorMessage, - FieldHook, - FieldValidateResponse, FIELD_TYPES, Form, - FormData, FormDataProvider, - FormHook, - FormSchema, UseField, UseMultiFields, useForm, useFormContext, useFormData, - ValidationError, - ValidationFunc, VALIDATION_TYPES, - FieldConfig, - ValidationConfig, } from '../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; export { Field, SelectField, } from '../../../../../src/plugins/es_ui_shared/static/forms/components'; export { fieldValidators } from '../../../../../src/plugins/es_ui_shared/static/forms/helpers'; -export { ERROR_CODE } from '../../../../../src/plugins/es_ui_shared/static/forms/helpers/field_validators/types'; +export type { ERROR_CODE } from '../../../../../src/plugins/es_ui_shared/static/forms/helpers/field_validators/types'; diff --git a/x-pack/plugins/cases/public/components/connectors/types.ts b/x-pack/plugins/cases/public/components/connectors/types.ts index 5bbd77c7909012..8bc978152b7966 100644 --- a/x-pack/plugins/cases/public/components/connectors/types.ts +++ b/x-pack/plugins/cases/public/components/connectors/types.ts @@ -15,7 +15,7 @@ import { } from '../../../common'; import { CaseActionConnector } from '../types'; -export { ThirdPartyField as AllThirdPartyFields } from '../../../common'; +export type { ThirdPartyField as AllThirdPartyFields } from '../../../common'; export interface ThirdPartyField { label: string; diff --git a/x-pack/plugins/cases/public/components/types.ts b/x-pack/plugins/cases/public/components/types.ts index 07ab5814b082b9..71c846eb922d7e 100644 --- a/x-pack/plugins/cases/public/components/types.ts +++ b/x-pack/plugins/cases/public/components/types.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { CaseActionConnector } from '../../common'; +export type { CaseActionConnector } from '../../common'; diff --git a/x-pack/plugins/cases/public/components/user_action_tree/index.tsx b/x-pack/plugins/cases/public/components/user_action_tree/index.tsx index 92640a34548e8b..24fc393715f768 100644 --- a/x-pack/plugins/cases/public/components/user_action_tree/index.tsx +++ b/x-pack/plugins/cases/public/components/user_action_tree/index.tsx @@ -12,8 +12,10 @@ import { EuiCommentList, EuiCommentProps, } from '@elastic/eui'; +import { ALERT_RULE_NAME, ALERT_RULE_UUID } from '@kbn/rule-data-utils'; + import classNames from 'classnames'; -import { isEmpty } from 'lodash'; +import { get, isEmpty } from 'lodash'; import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react'; import { useParams } from 'react-router-dom'; import styled from 'styled-components'; @@ -421,9 +423,15 @@ export const UserActionTree = React.memo( } const ruleId = - comment?.rule?.id ?? manualAlertsData[alertId]?.signal?.rule?.id?.[0] ?? null; + comment?.rule?.id ?? + manualAlertsData[alertId]?.signal?.rule?.id?.[0] ?? + get(manualAlertsData[alertId], ALERT_RULE_UUID)[0] ?? + null; const ruleName = - comment?.rule?.name ?? manualAlertsData[alertId]?.signal?.rule?.name?.[0] ?? null; + comment?.rule?.name ?? + manualAlertsData[alertId]?.signal?.rule?.name?.[0] ?? + get(manualAlertsData[alertId], ALERT_RULE_NAME)[0] ?? + null; return [ ...comments, diff --git a/x-pack/plugins/cases/public/containers/configure/types.ts b/x-pack/plugins/cases/public/containers/configure/types.ts index 61c81a8ce97c1e..5ee09add196bd7 100644 --- a/x-pack/plugins/cases/public/containers/configure/types.ts +++ b/x-pack/plugins/cases/public/containers/configure/types.ts @@ -17,7 +17,7 @@ import { ThirdPartyField, } from '../../../common'; -export { +export type { ActionConnector, ActionTypeConnector, ActionType, diff --git a/x-pack/plugins/cases/server/client/index.ts b/x-pack/plugins/cases/server/client/index.ts index 7904e65ca62766..5560d535f971ac 100644 --- a/x-pack/plugins/cases/server/client/index.ts +++ b/x-pack/plugins/cases/server/client/index.ts @@ -7,6 +7,6 @@ export { CasesClient } from './client'; export { CasesClientInternal } from './client_internal'; -export { CasesClientArgs } from './types'; +export type { CasesClientArgs } from './types'; export { createCasesClient } from './client'; export { createCasesClientInternal } from './client_internal'; diff --git a/x-pack/plugins/cases/server/connectors/types.ts b/x-pack/plugins/cases/server/connectors/types.ts index a8673c12625803..62b2c8e6f1551a 100644 --- a/x-pack/plugins/cases/server/connectors/types.ts +++ b/x-pack/plugins/cases/server/connectors/types.ts @@ -11,7 +11,7 @@ import { CasesClientGetAlertsResponse } from '../client/alerts/types'; import { CasesClientFactory } from '../client/factory'; import { RegisterActionType } from '../types'; -export { +export type { ContextTypeGeneratedAlertType, CommentSchemaType, ContextTypeAlertSchemaType, diff --git a/x-pack/plugins/cases/server/index.ts b/x-pack/plugins/cases/server/index.ts index 5e433b46b80e5a..57db6e5565fff3 100644 --- a/x-pack/plugins/cases/server/index.ts +++ b/x-pack/plugins/cases/server/index.ts @@ -22,4 +22,4 @@ export const config: PluginConfigDescriptor = { export const plugin = (initializerContext: PluginInitializerContext) => new CasePlugin(initializerContext); -export { PluginStartContract } from './plugin'; +export type { PluginStartContract } from './plugin'; diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/index.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/index.ts index a4f50fbfcde5b2..b0f9c7d2145de7 100644 --- a/x-pack/plugins/cases/server/saved_object_types/migrations/index.ts +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/index.ts @@ -14,7 +14,8 @@ import { SECURITY_SOLUTION_OWNER } from '../../../common'; export { caseMigrations } from './cases'; export { configureMigrations } from './configuration'; export { userActionsMigrations } from './user_actions'; -export { createCommentsMigrations, CreateCommentsMigrationsDeps } from './comments'; +export type { CreateCommentsMigrationsDeps } from './comments'; +export { createCommentsMigrations } from './comments'; export interface SanitizedCaseOwner { owner: string; diff --git a/x-pack/plugins/cases/server/services/index.ts b/x-pack/plugins/cases/server/services/index.ts index f910099c0cc206..a1cb5d8138c400 100644 --- a/x-pack/plugins/cases/server/services/index.ts +++ b/x-pack/plugins/cases/server/services/index.ts @@ -12,7 +12,8 @@ export { CasesService } from './cases'; export { CaseConfigureService } from './configure'; export { CaseUserActionService } from './user_actions'; export { ConnectorMappingsService } from './connector_mappings'; -export { AlertService, AlertServiceContract } from './alerts'; +export type { AlertServiceContract } from './alerts'; +export { AlertService } from './alerts'; export { AttachmentService } from './attachments'; export interface ClientArgs { diff --git a/x-pack/plugins/cloud/public/index.ts b/x-pack/plugins/cloud/public/index.ts index 9f4f6b979c344e..d51def6fa66414 100644 --- a/x-pack/plugins/cloud/public/index.ts +++ b/x-pack/plugins/cloud/public/index.ts @@ -8,7 +8,7 @@ import { PluginInitializerContext } from '../../../../src/core/public'; import { CloudPlugin } from './plugin'; -export { CloudSetup, CloudConfigType } from './plugin'; +export type { CloudSetup, CloudConfigType } from './plugin'; export function plugin(initializerContext: PluginInitializerContext) { return new CloudPlugin(initializerContext); } diff --git a/x-pack/plugins/cloud/server/index.ts b/x-pack/plugins/cloud/server/index.ts index 8d212bb4e15938..eda2fa0a7324e5 100644 --- a/x-pack/plugins/cloud/server/index.ts +++ b/x-pack/plugins/cloud/server/index.ts @@ -8,7 +8,7 @@ import { PluginInitializerContext } from 'src/core/server'; import { CloudPlugin } from './plugin'; -export { CloudSetup } from './plugin'; +export type { CloudSetup } from './plugin'; export { config } from './config'; export const plugin = (initializerContext: PluginInitializerContext) => { return new CloudPlugin(initializerContext); diff --git a/x-pack/plugins/dashboard_enhanced/common/drilldowns/dashboard_drilldown/index.ts b/x-pack/plugins/dashboard_enhanced/common/drilldowns/dashboard_drilldown/index.ts index dae19cf02e230b..fde3b5b06de2da 100644 --- a/x-pack/plugins/dashboard_enhanced/common/drilldowns/dashboard_drilldown/index.ts +++ b/x-pack/plugins/dashboard_enhanced/common/drilldowns/dashboard_drilldown/index.ts @@ -7,4 +7,4 @@ export { createExtract, createInject } from './dashboard_drilldown_persistable_state'; export { EMBEDDABLE_TO_DASHBOARD_DRILLDOWN } from './constants'; -export { DrilldownConfig } from './types'; +export type { DrilldownConfig } from './types'; diff --git a/x-pack/plugins/dashboard_enhanced/public/index.ts b/x-pack/plugins/dashboard_enhanced/public/index.ts index 82b0fc322bb834..545696abb0ac57 100644 --- a/x-pack/plugins/dashboard_enhanced/public/index.ts +++ b/x-pack/plugins/dashboard_enhanced/public/index.ts @@ -8,18 +8,18 @@ import { PluginInitializerContext } from 'src/core/public'; import { DashboardEnhancedPlugin } from './plugin'; -export { +export type { SetupContract as DashboardEnhancedSetupContract, SetupDependencies as DashboardEnhancedSetupDependencies, StartContract as DashboardEnhancedStartContract, StartDependencies as DashboardEnhancedStartDependencies, } from './plugin'; -export { - AbstractDashboardDrilldown as DashboardEnhancedAbstractDashboardDrilldown, +export type { AbstractDashboardDrilldownConfig as DashboardEnhancedAbstractDashboardDrilldownConfig, AbstractDashboardDrilldownParams as DashboardEnhancedAbstractDashboardDrilldownParams, } from './services/drilldowns/abstract_dashboard_drilldown'; +export { AbstractDashboardDrilldown as DashboardEnhancedAbstractDashboardDrilldown } from './services/drilldowns/abstract_dashboard_drilldown'; export function plugin(context: PluginInitializerContext) { return new DashboardEnhancedPlugin(context); diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/components/index.ts b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/components/index.ts index ffdce9e91d1564..9215f067fc8510 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/components/index.ts +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/components/index.ts @@ -5,7 +5,5 @@ * 2.0. */ -export { - CollectConfigContainer, - DashboardDrilldownCollectConfigProps, -} from './collect_config_container'; +export type { DashboardDrilldownCollectConfigProps } from './collect_config_container'; +export { CollectConfigContainer } from './collect_config_container'; diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/index.ts b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/index.ts index 3acea2f76d73cb..3b76303bda388b 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/index.ts +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/index.ts @@ -5,8 +5,6 @@ * 2.0. */ -export { - AbstractDashboardDrilldown, - Params as AbstractDashboardDrilldownParams, -} from './abstract_dashboard_drilldown'; -export { Config as AbstractDashboardDrilldownConfig } from './types'; +export type { Params as AbstractDashboardDrilldownParams } from './abstract_dashboard_drilldown'; +export { AbstractDashboardDrilldown } from './abstract_dashboard_drilldown'; +export type { Config as AbstractDashboardDrilldownConfig } from './types'; diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/index.ts b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/index.ts index 3a0389ac2b546c..f7d98d7681396e 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/index.ts +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/index.ts @@ -5,8 +5,5 @@ * 2.0. */ -export { - FlyoutCreateDrilldownAction, - OpenFlyoutAddDrilldownParams, - OPEN_FLYOUT_ADD_DRILLDOWN, -} from './flyout_create_drilldown'; +export type { OpenFlyoutAddDrilldownParams } from './flyout_create_drilldown'; +export { FlyoutCreateDrilldownAction, OPEN_FLYOUT_ADD_DRILLDOWN } from './flyout_create_drilldown'; diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/index.tsx b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/index.tsx index c150c55120e594..76d61a7367d7e2 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/index.tsx +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/index.tsx @@ -5,8 +5,5 @@ * 2.0. */ -export { - FlyoutEditDrilldownAction, - FlyoutEditDrilldownParams, - OPEN_FLYOUT_EDIT_DRILLDOWN, -} from './flyout_edit_drilldown'; +export type { FlyoutEditDrilldownParams } from './flyout_edit_drilldown'; +export { FlyoutEditDrilldownAction, OPEN_FLYOUT_EDIT_DRILLDOWN } from './flyout_edit_drilldown'; diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/embeddable_to_dashboard_drilldown/index.ts b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/embeddable_to_dashboard_drilldown/index.ts index 423007d548db5d..3a34de6299fc41 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/embeddable_to_dashboard_drilldown/index.ts +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/embeddable_to_dashboard_drilldown/index.ts @@ -6,7 +6,5 @@ */ export { EMBEDDABLE_TO_DASHBOARD_DRILLDOWN } from './constants'; -export { - EmbeddableToDashboardDrilldown, - Params as EmbeddableToDashboardDrilldownParams, -} from './embeddable_to_dashboard_drilldown'; +export type { Params as EmbeddableToDashboardDrilldownParams } from './embeddable_to_dashboard_drilldown'; +export { EmbeddableToDashboardDrilldown } from './embeddable_to_dashboard_drilldown'; diff --git a/x-pack/plugins/dashboard_enhanced/server/index.ts b/x-pack/plugins/dashboard_enhanced/server/index.ts index 1f4659c2c781a8..3351cd95479036 100644 --- a/x-pack/plugins/dashboard_enhanced/server/index.ts +++ b/x-pack/plugins/dashboard_enhanced/server/index.ts @@ -8,7 +8,7 @@ import { PluginInitializerContext } from 'src/core/server'; import { DashboardEnhancedPlugin } from './plugin'; -export { +export type { SetupContract as DashboardEnhancedSetupContract, SetupDependencies as DashboardEnhancedSetupDependencies, StartContract as DashboardEnhancedStartContract, diff --git a/x-pack/plugins/data_enhanced/public/index.ts b/x-pack/plugins/data_enhanced/public/index.ts index c3adf19fabe138..38b8d7d5c5fdf4 100644 --- a/x-pack/plugins/data_enhanced/public/index.ts +++ b/x-pack/plugins/data_enhanced/public/index.ts @@ -12,7 +12,7 @@ import { ConfigSchema } from '../config'; export const plugin = (initializerContext: PluginInitializerContext) => new DataEnhancedPlugin(initializerContext); -export { DataEnhancedSetup, DataEnhancedStart }; +export type { DataEnhancedSetup, DataEnhancedStart }; export { ENHANCED_ES_SEARCH_STRATEGY, diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/index.tsx b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/index.tsx index f57ad73c3c760a..2970c75e651d6e 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/index.tsx +++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/index.tsx @@ -9,7 +9,8 @@ import { EuiLinkProps, EuiText, EuiTextProps } from '@elastic/eui'; import React from 'react'; import extendSessionIcon from '../icons/extend_session.svg'; -export { OnActionComplete, PopoverActionsMenu } from './actions'; +export type { OnActionComplete } from './actions'; +export { PopoverActionsMenu } from './actions'; export const TableText = ({ children, ...props }: EuiTextProps) => { return ( diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/index.ts b/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/index.ts index 122321691439d0..fec61f81154864 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/index.ts +++ b/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/index.ts @@ -5,7 +5,5 @@ * 2.0. */ -export { - SearchSessionIndicatorDeps, - createConnectedSearchSessionIndicator, -} from './connected_search_session_indicator'; +export type { SearchSessionIndicatorDeps } from './connected_search_session_indicator'; +export { createConnectedSearchSessionIndicator } from './connected_search_session_indicator'; diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/combined_fields/index.ts b/x-pack/plugins/data_visualizer/public/application/common/components/combined_fields/index.ts index 862128f2e856bf..834813ddc24112 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/combined_fields/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/combined_fields/index.ts @@ -13,4 +13,4 @@ export { export { CombinedFieldsReadOnlyForm } from './combined_fields_read_only_form'; export { CombinedFieldsForm } from './combined_fields_form'; -export { CombinedField } from './types'; +export type { CombinedField } from './types'; diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/document_count_content/document_count_chart/index.ts b/x-pack/plugins/data_visualizer/public/application/common/components/document_count_content/document_count_chart/index.ts index 97b42053b34e6f..1b69f9b825165e 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/document_count_content/document_count_chart/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/document_count_content/document_count_chart/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { DocumentCountChart, DocumentCountChartPoint } from './document_count_chart'; +export type { DocumentCountChartPoint } from './document_count_chart'; +export { DocumentCountChart } from './document_count_chart'; diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/multi_select_picker/index.ts b/x-pack/plugins/data_visualizer/public/application/common/components/multi_select_picker/index.ts index 9d32228e1c4bc9..a42ce68d9aa10c 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/multi_select_picker/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/multi_select_picker/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { MultiSelectPicker, Option } from './multi_select_picker'; +export type { Option } from './multi_select_picker'; +export { MultiSelectPicker } from './multi_select_picker'; diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/results_links/index.ts b/x-pack/plugins/data_visualizer/public/application/common/components/results_links/index.ts index 1dca4b7bf22541..24c36f97d76339 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/results_links/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/results_links/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { ResultsLinks, ResultLink } from './results_links'; +export type { ResultLink } from './results_links'; +export { ResultsLinks } from './results_links'; diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/field_count_stats/index.ts b/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/field_count_stats/index.ts index d841ee2959f620..ccd7c6b73a5770 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/field_count_stats/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/field_count_stats/index.ts @@ -5,9 +5,7 @@ * 2.0. */ -export { TotalFieldsCount, TotalFieldsCountProps, TotalFieldsStats } from './total_fields_count'; -export { - MetricFieldsCount, - MetricFieldsCountProps, - MetricFieldsStats, -} from './metric_fields_count'; +export type { TotalFieldsCountProps, TotalFieldsStats } from './total_fields_count'; +export { TotalFieldsCount } from './total_fields_count'; +export type { MetricFieldsCountProps, MetricFieldsStats } from './metric_fields_count'; +export { MetricFieldsCount } from './metric_fields_count'; diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/metric_distribution_chart/index.ts b/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/metric_distribution_chart/index.ts index 72947f2953cb83..5012426e8f7ca5 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/metric_distribution_chart/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/metric_distribution_chart/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { MetricDistributionChart, MetricDistributionChartData } from './metric_distribution_chart'; +export type { MetricDistributionChartData } from './metric_distribution_chart'; +export { MetricDistributionChart } from './metric_distribution_chart'; export { buildChartDataFromStats } from './metric_distribution_chart_data_builder'; diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/index.ts b/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/index.ts index 3009470af48589..a8aae70ccfc63b 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { DataVisualizerTable, ItemIdToExpandedRowMap } from './data_visualizer_stats_table'; +export type { ItemIdToExpandedRowMap } from './data_visualizer_stats_table'; +export { DataVisualizerTable } from './data_visualizer_stats_table'; diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/types/index.ts b/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/types/index.ts index 171d029482e270..00f8ac0c74eb90 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/types/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/types/index.ts @@ -5,11 +5,10 @@ * 2.0. */ -export { FieldDataRowProps } from './field_data_row'; -export { +export type { FieldDataRowProps } from './field_data_row'; +export type { FieldVisConfig, FileBasedFieldVisConfig, MetricFieldVisStats, - isFileBasedFieldVisConfig, - isIndexBasedFieldVisConfig, } from './field_vis_config'; +export { isFileBasedFieldVisConfig, isIndexBasedFieldVisConfig } from './field_vis_config'; diff --git a/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/import_progress/index.ts b/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/import_progress/index.ts index fe2d6ab7d826b3..65ebab329a83c2 100644 --- a/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/import_progress/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/import_progress/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { ImportProgress, IMPORT_STATUS, Statuses } from './import_progress'; +export type { Statuses } from './import_progress'; +export { ImportProgress, IMPORT_STATUS } from './import_progress'; diff --git a/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/index.ts b/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/index.ts index ca87d73b6a758c..4cd3755726ad28 100644 --- a/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { FileDataVisualizer, FileDataVisualizerSpec } from './file_data_visualizer'; +export type { FileDataVisualizerSpec } from './file_data_visualizer'; +export { FileDataVisualizer } from './file_data_visualizer'; diff --git a/x-pack/plugins/data_visualizer/public/application/index.ts b/x-pack/plugins/data_visualizer/public/application/index.ts index 6229f61be85e9a..7e84bd84adf6f7 100644 --- a/x-pack/plugins/data_visualizer/public/application/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/index.ts @@ -5,9 +5,10 @@ * 2.0. */ -export { FileDataVisualizer, FileDataVisualizerSpec } from './file_data_visualizer'; -export { - IndexDataVisualizer, +export type { FileDataVisualizerSpec } from './file_data_visualizer'; +export { FileDataVisualizer } from './file_data_visualizer'; +export type { IndexDataVisualizerSpec, IndexDataVisualizerViewProps, } from './index_data_visualizer'; +export { IndexDataVisualizer } from './index_data_visualizer'; diff --git a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/components/full_time_range_selector/index.tsx b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/components/full_time_range_selector/index.tsx index c79df59ee3f69f..14ad77e2adc3ad 100644 --- a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/components/full_time_range_selector/index.tsx +++ b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/components/full_time_range_selector/index.tsx @@ -6,4 +6,5 @@ */ export { FullTimeRangeSelector } from './full_time_range_selector'; -export { getTimeFilterRange, TimeRange } from './full_time_range_selector_service'; +export type { TimeRange } from './full_time_range_selector_service'; +export { getTimeFilterRange } from './full_time_range_selector_service'; diff --git a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/components/index_data_visualizer_view/index.ts b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/components/index_data_visualizer_view/index.ts index bcdef0966039d4..9bb579f7af55db 100644 --- a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/components/index_data_visualizer_view/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/components/index_data_visualizer_view/index.ts @@ -5,7 +5,5 @@ * 2.0. */ -export { - IndexDataVisualizerViewProps, - IndexDataVisualizerView, -} from './index_data_visualizer_view'; +export type { IndexDataVisualizerViewProps } from './index_data_visualizer_view'; +export { IndexDataVisualizerView } from './index_data_visualizer_view'; diff --git a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/index.ts b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/index.ts index 77b6f9b5ab18c6..82abdf185f9ab6 100644 --- a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/index.ts +++ b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { IndexDataVisualizer, IndexDataVisualizerSpec } from './index_data_visualizer'; +export type { IndexDataVisualizerSpec } from './index_data_visualizer'; +export { IndexDataVisualizer } from './index_data_visualizer'; export type { IndexDataVisualizerViewProps } from './components/index_data_visualizer_view'; diff --git a/x-pack/plugins/data_visualizer/public/index.ts b/x-pack/plugins/data_visualizer/public/index.ts index 1a045f144c0152..4a579f4e3abcc4 100644 --- a/x-pack/plugins/data_visualizer/public/index.ts +++ b/x-pack/plugins/data_visualizer/public/index.ts @@ -11,7 +11,7 @@ export function plugin() { return new DataVisualizerPlugin(); } -export { DataVisualizerPluginStart } from './plugin'; +export type { DataVisualizerPluginStart } from './plugin'; export type { FileDataVisualizerSpec, diff --git a/x-pack/plugins/data_visualizer/public/lazy_load_bundle/lazy/index.ts b/x-pack/plugins/data_visualizer/public/lazy_load_bundle/lazy/index.ts index a895a0eb98385d..0001f912bff0db 100644 --- a/x-pack/plugins/data_visualizer/public/lazy_load_bundle/lazy/index.ts +++ b/x-pack/plugins/data_visualizer/public/lazy_load_bundle/lazy/index.ts @@ -5,9 +5,5 @@ * 2.0. */ -export { - FileDataVisualizer, - IndexDataVisualizer, - FileDataVisualizerSpec, - IndexDataVisualizerSpec, -} from '../../application'; +export type { FileDataVisualizerSpec, IndexDataVisualizerSpec } from '../../application'; +export { FileDataVisualizer, IndexDataVisualizer } from '../../application'; diff --git a/x-pack/plugins/drilldowns/url_drilldown/public/lib/url_drilldown.tsx b/x-pack/plugins/drilldowns/url_drilldown/public/lib/url_drilldown.tsx index 4c46b840087668..163a2130f657cc 100644 --- a/x-pack/plugins/drilldowns/url_drilldown/public/lib/url_drilldown.tsx +++ b/x-pack/plugins/drilldowns/url_drilldown/public/lib/url_drilldown.tsx @@ -93,7 +93,6 @@ export class UrlDrilldown implements Drilldown { - // eslint-disable-next-line react-hooks/rules-of-hooks const variables = React.useMemo(() => this.getVariableList(context), [context]); return ( diff --git a/x-pack/plugins/embeddable_enhanced/public/index.ts b/x-pack/plugins/embeddable_enhanced/public/index.ts index 0512bedd2a57af..8c64f376754a57 100644 --- a/x-pack/plugins/embeddable_enhanced/public/index.ts +++ b/x-pack/plugins/embeddable_enhanced/public/index.ts @@ -8,7 +8,7 @@ import { PluginInitializerContext } from 'src/core/public'; import { EmbeddableEnhancedPlugin } from './plugin'; -export { +export type { SetupContract as EmbeddableEnhancedSetupContract, SetupDependencies as EmbeddableEnhancedSetupDependencies, StartContract as EmbeddableEnhancedStartContract, @@ -19,6 +19,6 @@ export function plugin(context: PluginInitializerContext) { return new EmbeddableEnhancedPlugin(context); } -export { EnhancedEmbeddable, EnhancedEmbeddableContext } from './types'; +export type { EnhancedEmbeddable, EnhancedEmbeddableContext } from './types'; export { isEnhancedEmbeddable } from './embeddables'; export { drilldownGrouping as embeddableEnhancedDrilldownGrouping } from './actions'; diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/index.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/index.ts index 31086f56c3b867..532702f2131920 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/crypto/index.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/index.ts @@ -5,12 +5,11 @@ * 2.0. */ -export { - EncryptedSavedObjectsService, +export type { EncryptedSavedObjectTypeRegistration, - descriptorToArray, SavedObjectDescriptor, } from './encrypted_saved_objects_service'; +export { EncryptedSavedObjectsService, descriptorToArray } from './encrypted_saved_objects_service'; export { EncryptionError, EncryptionErrorOperation } from './encryption_error'; export { EncryptedSavedObjectAttributesDefinition } from './encrypted_saved_object_type_definition'; export { EncryptionKeyRotationService } from './encryption_key_rotation_service'; diff --git a/x-pack/plugins/encrypted_saved_objects/server/index.ts b/x-pack/plugins/encrypted_saved_objects/server/index.ts index d462f06939f6b3..873c8c0d52cb55 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/index.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/index.ts @@ -10,9 +10,10 @@ import type { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/ import { ConfigSchema } from './config'; import { EncryptedSavedObjectsPlugin } from './plugin'; -export { EncryptedSavedObjectTypeRegistration, EncryptionError } from './crypto'; -export { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart } from './plugin'; -export { EncryptedSavedObjectsClient } from './saved_objects'; +export type { EncryptedSavedObjectTypeRegistration } from './crypto'; +export { EncryptionError } from './crypto'; +export type { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart } from './plugin'; +export type { EncryptedSavedObjectsClient } from './saved_objects'; export type { IsMigrationNeededPredicate } from './create_migration'; export const config: PluginConfigDescriptor = { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/suggested_documents_callout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/suggested_documents_callout.test.tsx index b1f02b960aa8a1..4fdce0bcd02997 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/suggested_documents_callout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/suggested_documents_callout.test.tsx @@ -28,7 +28,7 @@ const MOCK_VALUES = { }, // EngineLogic engine: { - search_relevance_suggestions_active: true, + adaptive_relevance_suggestions_active: true, }, }; @@ -53,7 +53,7 @@ describe('SuggestedDocumentsCallout', () => { }); it('is empty when suggestions are not active', () => { - const values = set('engine.search_relevance_suggestions_active', false, MOCK_VALUES); + const values = set('engine.adaptive_relevance_suggestions_active', false, MOCK_VALUES); setMockValues(values); const wrapper = shallow(); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/suggested_documents_callout.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/suggested_documents_callout.tsx index af76ebee16bad3..ec296089a10864 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/suggested_documents_callout.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/suggested_documents_callout.tsx @@ -22,13 +22,13 @@ export const SuggestedDocumentsCallout: React.FC = () => { curation: { suggestion, queries }, } = useValues(CurationLogic); const { - engine: { search_relevance_suggestions_active: searchRelevanceSuggestionsActive }, + engine: { adaptive_relevance_suggestions_active: adaptiveRelevanceSuggestionsActive }, } = useValues(EngineLogic); if ( typeof suggestion === 'undefined' || suggestion.status !== 'pending' || - searchRelevanceSuggestionsActive === false + adaptiveRelevanceSuggestionsActive === false ) { return null; } diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx index 49d48c8c05ba65..ba3ac33be3c47a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx @@ -55,7 +55,7 @@ describe('Curations', () => { }, // EngineLogic engine: { - search_relevance_suggestions_active: true, + adaptive_relevance_suggestions_active: true, }, }; @@ -89,7 +89,7 @@ describe('Curations', () => { }); it('renders less tabs when suggestions are not active', () => { - setMockValues(set('engine.search_relevance_suggestions_active', false, values)); + setMockValues(set('engine.adaptive_relevance_suggestions_active', false, values)); const wrapper = shallow(); expect(getPageTitle(wrapper)).toEqual('Curated results'); @@ -99,7 +99,7 @@ describe('Curations', () => { }); it('renders a New! badge when suggestions are not active', () => { - setMockValues(set('engine.search_relevance_suggestions_active', false, values)); + setMockValues(set('engine.adaptive_relevance_suggestions_active', false, values)); const wrapper = shallow(); expect(getPageTitle(wrapper)).toEqual('Curated results'); @@ -109,7 +109,7 @@ describe('Curations', () => { }); it('hides the badge when suggestions are active', () => { - setMockValues(set('engine.search_relevance_suggestions_active', true, values)); + setMockValues(set('engine.adaptive_relevance_suggestions_active', true, values)); const wrapper = shallow(); expect(getPageTitle(wrapper)).toEqual('Curated results'); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.tsx index b0f4f03789af22..048566409ab9f6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.tsx @@ -30,10 +30,10 @@ export const Curations: React.FC = () => { const { dataLoading, meta, selectedPageTab } = useValues(CurationsLogic); const { loadCurations, onSelectPageTab } = useActions(CurationsLogic); const { - engine: { search_relevance_suggestions_active: searchRelevanceSuggestionsActive }, + engine: { adaptive_relevance_suggestions_active: adaptiveRelevanceSuggestionsActive }, } = useValues(EngineLogic); - const suggestionsEnabled = searchRelevanceSuggestionsActive; + const suggestionsEnabled = adaptiveRelevanceSuggestionsActive; const OVERVIEW_TAB = { label: i18n.translate( @@ -72,7 +72,7 @@ export const Curations: React.FC = () => { ), }; - const pageTabs = searchRelevanceSuggestionsActive + const pageTabs = adaptiveRelevanceSuggestionsActive ? [OVERVIEW_TAB, HISTORY_TAB, SETTINGS_TAB] : [OVERVIEW_TAB, SETTINGS_TAB]; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_overview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_overview.test.tsx index 43ef9dfd7ad2bb..b7da6d64b6a8a0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_overview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_overview.test.tsx @@ -36,7 +36,7 @@ const MOCK_VALUES = { ], // EngineLogic engine: { - search_relevance_suggestions_active: true, + adaptive_relevance_suggestions_active: true, }, }; @@ -71,14 +71,14 @@ describe('CurationsOverview', () => { }); it('renders a suggestions table when suggestions are active', () => { - setMockValues(set('engine.search_relevance_suggestions_active', true, MOCK_VALUES)); + setMockValues(set('engine.adaptive_relevance_suggestions_active', true, MOCK_VALUES)); const wrapper = shallow(); expect(wrapper.find(SuggestionsTable).exists()).toBe(true); }); it('doesn\t render a suggestions table when suggestions are not active', () => { - setMockValues(set('engine.search_relevance_suggestions_active', false, MOCK_VALUES)); + setMockValues(set('engine.adaptive_relevance_suggestions_active', false, MOCK_VALUES)); const wrapper = shallow(); expect(wrapper.find(SuggestionsTable).exists()).toBe(false); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_overview.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_overview.tsx index a611ca88cefd43..f763c297ea1dec 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_overview.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_overview.tsx @@ -19,10 +19,10 @@ import { CurationsLogic } from '../curations_logic'; export const CurationsOverview: React.FC = () => { const { curations } = useValues(CurationsLogic); const { - engine: { search_relevance_suggestions_active: searchRelevanceSuggestionsActive }, + engine: { adaptive_relevance_suggestions_active: adaptiveRelevanceSuggestionsActive }, } = useValues(EngineLogic); - const shouldShowSuggestions = searchRelevanceSuggestionsActive; + const shouldShowSuggestions = adaptiveRelevanceSuggestionsActive; return ( <> diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts index bb30190833dd31..adcc6bc546629d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts @@ -43,7 +43,7 @@ describe('EngineLogic', () => { schema: { test: SchemaType.Text }, apiTokens: [], apiKey: 'some-key', - search_relevance_suggestions_active: true, + adaptive_relevance_suggestions_active: true, }; const DEFAULT_VALUES = { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/types.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/types.ts index 0bfbc185b85f32..6faa749f958646 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/types.ts @@ -53,8 +53,8 @@ export interface EngineDetails extends Engine { isMeta: boolean; engine_count?: number; includedEngines?: EngineDetails[]; - search_relevance_suggestions?: SearchRelevanceSuggestionDetails; - search_relevance_suggestions_active: boolean; + adaptive_relevance_suggestions?: SearchRelevanceSuggestionDetails; + adaptive_relevance_suggestions_active: boolean; } interface ResultField { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/suggested_curations_callout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/suggested_curations_callout.test.tsx index c65d95a5254ee4..2fb9bb255110dc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/suggested_curations_callout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/suggested_curations_callout.test.tsx @@ -19,12 +19,12 @@ import { SuggestedCurationsCallout } from './suggested_curations_callout'; const MOCK_VALUES = { engine: { - search_relevance_suggestions: { + adaptive_relevance_suggestions: { curation: { pending: 1, }, }, - search_relevance_suggestions_active: true, + adaptive_relevance_suggestions_active: true, }, }; @@ -44,7 +44,7 @@ describe('SuggestedCurationsCallout', () => { setMockValues({ ...MOCK_VALUES, engine: { - search_relevance_suggestions_active: true, + adaptive_relevance_suggestions_active: true, }, }); @@ -54,7 +54,7 @@ describe('SuggestedCurationsCallout', () => { }); it('is empty when suggestions are not active', () => { - const values = set('engine.search_relevance_suggestions_active', false, MOCK_VALUES); + const values = set('engine.adaptive_relevance_suggestions_active', false, MOCK_VALUES); setMockValues(values); const wrapper = shallow(); @@ -63,7 +63,7 @@ describe('SuggestedCurationsCallout', () => { }); it('is empty when no pending curations', () => { - const values = set('engine.search_relevance_suggestions.curation.pending', 0, MOCK_VALUES); + const values = set('engine.adaptive_relevance_suggestions.curation.pending', 0, MOCK_VALUES); setMockValues(values); const wrapper = shallow(); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/suggested_curations_callout.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/suggested_curations_callout.tsx index 04b2d2b207e94a..e1f984581438fb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/suggested_curations_callout.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/suggested_curations_callout.tsx @@ -17,17 +17,17 @@ import { EngineLogic, generateEnginePath } from '../../engine'; export const SuggestedCurationsCallout: React.FC = () => { const { engine: { - search_relevance_suggestions: searchRelevanceSuggestions, - search_relevance_suggestions_active: searchRelevanceSuggestionsActive, + adaptive_relevance_suggestions: adaptiveRelevanceSuggestions, + adaptive_relevance_suggestions_active: adaptiveRelevanceSuggestionsActive, }, } = useValues(EngineLogic); - const pendingCount = searchRelevanceSuggestions?.curation.pending; + const pendingCount = adaptiveRelevanceSuggestions?.curation.pending; if ( - typeof searchRelevanceSuggestions === 'undefined' || + typeof adaptiveRelevanceSuggestions === 'undefined' || pendingCount === 0 || - searchRelevanceSuggestionsActive === false + adaptiveRelevanceSuggestionsActive === false ) { return null; } @@ -46,7 +46,7 @@ export const SuggestedCurationsCallout: React.FC = () => { } )} buttonTo={generateEnginePath(ENGINE_CURATIONS_PATH)} - lastUpdatedTimestamp={searchRelevanceSuggestions.curation.last_updated} + lastUpdatedTimestamp={adaptiveRelevanceSuggestions.curation.last_updated} /> ); }; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/types.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/types.ts index ca3e67129846bb..0efa8880cca222 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/types.ts @@ -6,5 +6,5 @@ */ export * from '../../../common/types/app_search'; -export { Role, RoleTypes, AbilityTypes, ASRoleMapping, AdvanceRoleType } from './utils/role'; -export { Engine } from './components/engine/types'; +export type { Role, RoleTypes, AbilityTypes, ASRoleMapping, AdvanceRoleType } from './utils/role'; +export type { Engine } from './components/engine/types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts index 38a5d6e8b0b30f..097d38e0691c59 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts @@ -7,7 +7,7 @@ export { FlashMessages, Toasts } from './flash_messages'; export { FlashMessagesLogic, mountFlashMessagesLogic } from './flash_messages_logic'; -export { IFlashMessage } from './types'; +export type { IFlashMessage } from './types'; export { flashAPIErrors } from './handle_api_errors'; export { setSuccessMessage, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/layout/index.ts b/x-pack/plugins/enterprise_search/public/applications/shared/layout/index.ts index 41f8869ad5f61b..79919e925c625e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/layout/index.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/layout/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { EnterpriseSearchPageTemplate, PageTemplateProps } from './page_template'; +export type { PageTemplateProps } from './page_template'; +export { EnterpriseSearchPageTemplate } from './page_template'; export { generateNavLink } from './nav_link_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/index.ts b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/index.ts index fe76c13c2b7071..a05792d5fb5450 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/index.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/index.ts @@ -6,8 +6,10 @@ */ export { letBrowserHandleEvent } from './link_events'; -export { createHref, CreateHrefOptions } from './create_href'; -export { generateReactRouterProps, ReactRouterProps } from './generate_react_router_props'; +export type { CreateHrefOptions } from './create_href'; +export { createHref } from './create_href'; +export type { ReactRouterProps } from './generate_react_router_props'; +export { generateReactRouterProps } from './generate_react_router_props'; export { EuiLinkTo, EuiButtonTo, diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/index.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/index.ts index 9bc16553b1a0cb..7b0ba4206cff49 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/index.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { SourceRow, ISourceRow } from './source_row'; +export type { ISourceRow } from './source_row'; +export { SourceRow } from './source_row'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.ts index 06055e95626764..05a5fd5a73fe8f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.ts @@ -546,8 +546,8 @@ export const AddSourceLogic = kea { diff --git a/x-pack/plugins/event_log/server/es/index.ts b/x-pack/plugins/event_log/server/es/index.ts index 2631df882cc070..a5bc5dce7f2500 100644 --- a/x-pack/plugins/event_log/server/es/index.ts +++ b/x-pack/plugins/event_log/server/es/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { EsContext, createEsContext } from './context'; +export type { EsContext } from './context'; +export { createEsContext } from './context'; diff --git a/x-pack/plugins/event_log/server/index.ts b/x-pack/plugins/event_log/server/index.ts index 14c121664d4a8f..877c39a02edc50 100644 --- a/x-pack/plugins/event_log/server/index.ts +++ b/x-pack/plugins/event_log/server/index.ts @@ -9,7 +9,7 @@ import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/serve import { ConfigSchema, IEventLogConfig } from './types'; import { Plugin } from './plugin'; -export { +export type { IEventLogService, IEventLogger, IEventLogClientService, @@ -17,8 +17,8 @@ export { IValidatedEvent, IEventLogClient, QueryEventsBySavedObjectResult, - SAVED_OBJECT_REL_PRIMARY, } from './types'; +export { SAVED_OBJECT_REL_PRIMARY } from './types'; export { ClusterClientAdapter } from './es/cluster_client_adapter'; diff --git a/x-pack/plugins/event_log/server/types.ts b/x-pack/plugins/event_log/server/types.ts index 6ffde7fd6dbe01..0cc2e7a1451478 100644 --- a/x-pack/plugins/event_log/server/types.ts +++ b/x-pack/plugins/event_log/server/types.ts @@ -8,11 +8,12 @@ import { schema, TypeOf } from '@kbn/config-schema'; import type { IRouter, KibanaRequest, RequestHandlerContext } from 'src/core/server'; -export { IEvent, IValidatedEvent, EventSchema, ECS_VERSION } from '../generated/schemas'; +export type { IEvent, IValidatedEvent } from '../generated/schemas'; +export { EventSchema, ECS_VERSION } from '../generated/schemas'; import { IEvent } from '../generated/schemas'; import { FindOptionsType } from './event_log_client'; import { QueryEventsBySavedObjectResult } from './es/cluster_client_adapter'; -export { QueryEventsBySavedObjectResult } from './es/cluster_client_adapter'; +export type { QueryEventsBySavedObjectResult } from './es/cluster_client_adapter'; import { SavedObjectProvider } from './saved_object_provider_registry'; export const SAVED_OBJECT_REL_PRIMARY = 'primary'; diff --git a/x-pack/plugins/features/common/index.ts b/x-pack/plugins/features/common/index.ts index 450b474744fe9a..9db2a1073cd07e 100644 --- a/x-pack/plugins/features/common/index.ts +++ b/x-pack/plugins/features/common/index.ts @@ -5,14 +5,16 @@ * 2.0. */ -export { FeatureElasticsearchPrivileges } from './feature_elasticsearch_privileges'; -export { FeatureKibanaPrivileges } from './feature_kibana_privileges'; -export { ElasticsearchFeature, ElasticsearchFeatureConfig } from './elasticsearch_feature'; -export { KibanaFeature, KibanaFeatureConfig } from './kibana_feature'; -export { - SubFeature, +export type { FeatureElasticsearchPrivileges } from './feature_elasticsearch_privileges'; +export type { FeatureKibanaPrivileges } from './feature_kibana_privileges'; +export type { ElasticsearchFeatureConfig } from './elasticsearch_feature'; +export { ElasticsearchFeature } from './elasticsearch_feature'; +export type { KibanaFeatureConfig } from './kibana_feature'; +export { KibanaFeature } from './kibana_feature'; +export type { SubFeatureConfig, SubFeaturePrivilegeConfig, SubFeaturePrivilegeGroupConfig, SubFeaturePrivilegeGroupType, } from './sub_feature'; +export { SubFeature } from './sub_feature'; diff --git a/x-pack/plugins/features/public/index.ts b/x-pack/plugins/features/public/index.ts index d1a828f51029ae..2895d83ed114e7 100644 --- a/x-pack/plugins/features/public/index.ts +++ b/x-pack/plugins/features/public/index.ts @@ -8,15 +8,15 @@ import { PluginInitializer } from 'src/core/public'; import { FeaturesPlugin, FeaturesPluginSetup, FeaturesPluginStart } from './plugin'; -export { - KibanaFeature, +export type { KibanaFeatureConfig, FeatureKibanaPrivileges, SubFeatureConfig, SubFeaturePrivilegeConfig, } from '../common'; +export { KibanaFeature } from '../common'; -export { FeaturesPluginSetup, FeaturesPluginStart } from './plugin'; +export type { FeaturesPluginSetup, FeaturesPluginStart } from './plugin'; export const plugin: PluginInitializer = () => new FeaturesPlugin(); diff --git a/x-pack/plugins/features/server/index.ts b/x-pack/plugins/features/server/index.ts index 0890274fed950c..934fcd9d556f62 100644 --- a/x-pack/plugins/features/server/index.ts +++ b/x-pack/plugins/features/server/index.ts @@ -14,15 +14,14 @@ import { FeaturesPlugin } from './plugin'; // run-time contracts. export { uiCapabilitiesRegex } from './feature_schema'; -export { - KibanaFeature, +export type { KibanaFeatureConfig, FeatureKibanaPrivileges, - ElasticsearchFeature, ElasticsearchFeatureConfig, FeatureElasticsearchPrivileges, } from '../common'; -export { PluginSetupContract, PluginStartContract } from './plugin'; +export { KibanaFeature, ElasticsearchFeature } from '../common'; +export type { PluginSetupContract, PluginStartContract } from './plugin'; export const plugin = (initializerContext: PluginInitializerContext) => new FeaturesPlugin(initializerContext); diff --git a/x-pack/plugins/file_upload/public/components/geojson_upload_form/index.ts b/x-pack/plugins/file_upload/public/components/geojson_upload_form/index.ts index 6168835a3a1459..837c8a0f026949 100644 --- a/x-pack/plugins/file_upload/public/components/geojson_upload_form/index.ts +++ b/x-pack/plugins/file_upload/public/components/geojson_upload_form/index.ts @@ -6,4 +6,4 @@ */ export { GeoJsonUploadForm } from './geojson_upload_form'; -export { OnFileSelectParameters } from './geojson_file_picker'; +export type { OnFileSelectParameters } from './geojson_file_picker'; diff --git a/x-pack/plugins/file_upload/public/importer/geojson_importer/index.ts b/x-pack/plugins/file_upload/public/importer/geojson_importer/index.ts index b5f6845e283247..7d9d8e144fd258 100644 --- a/x-pack/plugins/file_upload/public/importer/geojson_importer/index.ts +++ b/x-pack/plugins/file_upload/public/importer/geojson_importer/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { GeoJsonImporter, GeoJsonPreview, GEOJSON_FILE_TYPES } from './geojson_importer'; +export type { GeoJsonPreview } from './geojson_importer'; +export { GeoJsonImporter, GEOJSON_FILE_TYPES } from './geojson_importer'; diff --git a/x-pack/plugins/file_upload/public/index.ts b/x-pack/plugins/file_upload/public/index.ts index b9e289ef00eebc..00b39dca1180d1 100644 --- a/x-pack/plugins/file_upload/public/index.ts +++ b/x-pack/plugins/file_upload/public/index.ts @@ -16,7 +16,7 @@ export function plugin() { export * from './importer/types'; -export { Props as IndexNameFormProps } from './components/geojson_upload_form/index_name_form'; +export type { Props as IndexNameFormProps } from './components/geojson_upload_form/index_name_form'; -export { FileUploadPluginStart } from './plugin'; -export { FileUploadComponentProps, FileUploadGeoResults } from './lazy_load_bundle'; +export type { FileUploadPluginStart } from './plugin'; +export type { FileUploadComponentProps, FileUploadGeoResults } from './lazy_load_bundle'; diff --git a/x-pack/plugins/fleet/common/services/index.ts b/x-pack/plugins/fleet/common/services/index.ts index a6f4cd319b9701..ba3fb447536433 100644 --- a/x-pack/plugins/fleet/common/services/index.ts +++ b/x-pack/plugins/fleet/common/services/index.ts @@ -21,10 +21,12 @@ export { isDiffPathProtocol } from './is_diff_path_protocol'; export { LicenseService } from './license'; export { isAgentUpgradeable } from './is_agent_upgradeable'; export { doesPackageHaveIntegrations } from './packages_with_integrations'; -export { +export type { PackagePolicyValidationResults, PackagePolicyConfigValidationResults, PackagePolicyInputValidationResults, +} from './validate_package_policy'; +export { validatePackagePolicy, validatePackagePolicyConfig, validationHasErrors, diff --git a/x-pack/plugins/fleet/kibana.json b/x-pack/plugins/fleet/kibana.json index 1ca88cac1cc11b..d516827ebf9a74 100644 --- a/x-pack/plugins/fleet/kibana.json +++ b/x-pack/plugins/fleet/kibana.json @@ -9,7 +9,7 @@ "ui": true, "configPath": ["xpack", "fleet"], "requiredPlugins": ["licensing", "data", "encryptedSavedObjects", "navigation", "customIntegrations", "share"], - "optionalPlugins": ["security", "features", "cloud", "usageCollection", "home", "globalSearch"], + "optionalPlugins": ["security", "features", "cloud", "usageCollection", "home", "globalSearch", "telemetry"], "extraPublicDirs": ["common"], "requiredBundles": ["kibanaReact", "esUiShared", "home", "infra", "kibanaUtils", "usageCollection"] } diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/services/index.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/services/index.ts index 0e1953316fd53c..38ef2a60e41d04 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/services/index.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/services/index.ts @@ -7,10 +7,12 @@ export { isAdvancedVar } from './is_advanced_var'; export { hasInvalidButRequiredVar } from './has_invalid_but_required_var'; -export { +export type { PackagePolicyValidationResults, PackagePolicyConfigValidationResults, PackagePolicyInputValidationResults, +} from '../../../../services'; +export { validatePackagePolicy, validatePackagePolicyConfig, validationHasErrors, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx index e11aaabb4fd951..63e9ba64ad7534 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx @@ -22,16 +22,12 @@ import { import styled from 'styled-components'; -import type { - AgentPolicy, - PackageInfo, - PackagePolicy, - NewPackagePolicy, - RegistryVarsEntry, -} from '../../../types'; +import type { AgentPolicy, PackageInfo, NewPackagePolicy, RegistryVarsEntry } from '../../../types'; import { packageToPackagePolicy, pkgKeyFromPackageInfo } from '../../../services'; import { Loading } from '../../../components'; -import { useStartServices } from '../../../hooks'; +import { useStartServices, useGetPackagePolicies } from '../../../hooks'; +import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../../../constants'; +import { SO_SEARCH_LIMIT } from '../../../../../../common'; import { isAdvancedVar } from './services'; import type { PackagePolicyValidationResults } from './services'; @@ -65,6 +61,14 @@ export const StepDefinePackagePolicy: React.FunctionComponent<{ submitAttempted, }) => { const { docLinks } = useStartServices(); + + // Fetch all packagePolicies having the package name + const { data: packagePolicyData, isLoading: isLoadingPackagePolicies } = useGetPackagePolicies({ + perPage: SO_SEARCH_LIMIT, + page: 1, + kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name:${packageInfo.name}`, + }); + // Form show/hide states const [isShowingAdvanced, setIsShowingAdvanced] = useState(false); @@ -84,33 +88,37 @@ export const StepDefinePackagePolicy: React.FunctionComponent<{ // Update package policy's package and agent policy info useEffect(() => { + if (isLoadingPackagePolicies) { + return; + } const pkg = packagePolicy.package; const currentPkgKey = pkg ? pkgKeyFromPackageInfo(pkg) : ''; const pkgKey = pkgKeyFromPackageInfo(packageInfo); // If package has changed, create shell package policy with input&stream values based on package info if (currentPkgKey !== pkgKey) { - // Existing package policies on the agent policy using the package name, retrieve highest number appended to package policy name + // Retrieve highest number appended to package policy name and increment it by one const pkgPoliciesNamePattern = new RegExp(`${packageInfo.name}-(\\d+)`); - const pkgPoliciesWithMatchingNames = agentPolicy - ? (agentPolicy.package_policies as PackagePolicy[]) + const pkgPoliciesWithMatchingNames = packagePolicyData?.items + ? packagePolicyData.items .filter((ds) => Boolean(ds.name.match(pkgPoliciesNamePattern))) .map((ds) => parseInt(ds.name.match(pkgPoliciesNamePattern)![1], 10)) .sort((a, b) => a - b) : []; + const incrementedName = `${packageInfo.name}-${ + pkgPoliciesWithMatchingNames.length + ? pkgPoliciesWithMatchingNames[pkgPoliciesWithMatchingNames.length - 1] + 1 + : 1 + }`; + updatePackagePolicy( packageToPackagePolicy( packageInfo, agentPolicy?.id || '', packagePolicy.output_id, packagePolicy.namespace, - packagePolicy.name || - `${packageInfo.name}-${ - pkgPoliciesWithMatchingNames.length - ? pkgPoliciesWithMatchingNames[pkgPoliciesWithMatchingNames.length - 1] + 1 - : 1 - }`, + packagePolicy.name || incrementedName, packagePolicy.description, integrationToEnable ) @@ -124,7 +132,15 @@ export const StepDefinePackagePolicy: React.FunctionComponent<{ namespace: agentPolicy.namespace, }); } - }, [packagePolicy, agentPolicy, packageInfo, updatePackagePolicy, integrationToEnable]); + }, [ + packagePolicy, + agentPolicy, + packageInfo, + updatePackagePolicy, + integrationToEnable, + packagePolicyData, + isLoadingPackagePolicies, + ]); return validationResults ? ( ( - - {children} - -); - -export const WithPermissionsAndSetup: React.FC = memo(({ children }) => { - useBreadcrumbs('integrations'); - - const [isPermissionsLoading, setIsPermissionsLoading] = useState(false); - const [isInitialized, setIsInitialized] = useState(false); - const [initializationError, setInitializationError] = useState(null); - - useEffect(() => { - (async () => { - setIsInitialized(false); - setInitializationError(null); - try { - // Attempt Fleet Setup if user has permissions, otherwise skip - setIsPermissionsLoading(true); - const permissionsResponse = await sendGetPermissionsCheck(); - setIsPermissionsLoading(false); - - if (permissionsResponse.data?.success) { - try { - const setupResponse = await sendSetup(); - if (setupResponse.error) { - setInitializationError(setupResponse.error); - } - } catch (err) { - setInitializationError(err); - } - setIsInitialized(true); - } else { - setIsInitialized(true); - } - } catch { - // If there's an error checking permissions, default to proceeding without running setup - // User will only have access to EPM endpoints if they actually have permission - setIsInitialized(true); - } - })(); - }, []); - - if (isPermissionsLoading) { - return ( - - - - ); - } - - if (!isInitialized || initializationError) { - return ( - - {initializationError ? ( - - } - error={initializationError} - /> - ) : ( - - )} - - ); - } - - return <>{children}; -}); - /** * Fleet Application context all the way down to the Router, but with no permissions or setup checks * and no routes defined diff --git a/x-pack/plugins/fleet/public/applications/integrations/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/index.tsx index 4099879538afa7..620cf83fd762de 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/index.tsx @@ -15,7 +15,7 @@ import type { FleetConfigType, FleetStartServices } from '../../plugin'; import { licenseService } from '../../hooks'; import type { UIExtensionsStorage } from '../../types'; -import { AppRoutes, IntegrationsAppContext, WithPermissionsAndSetup } from './app'; +import { AppRoutes, IntegrationsAppContext } from './app'; export interface ProtectedRouteProps extends RouteProps { isAllowed?: boolean; @@ -58,9 +58,7 @@ const IntegrationsApp = ({ extensions={extensions} setHeaderActionMenu={setHeaderActionMenu} > - - - + ); }; diff --git a/x-pack/plugins/fleet/public/components/index.ts b/x-pack/plugins/fleet/public/components/index.ts index 3252315312d029..9015071450bf04 100644 --- a/x-pack/plugins/fleet/public/components/index.ts +++ b/x-pack/plugins/fleet/public/components/index.ts @@ -13,7 +13,8 @@ export { LinkedAgentCount } from './linked_agent_count'; export { ExtensionWrapper } from './extension_wrapper'; export { AlphaMessaging } from './alpha_messaging'; export { AlphaFlyout } from './alpha_flyout'; -export { HeaderProps, Header } from './header'; +export type { HeaderProps } from './header'; +export { Header } from './header'; export { NewEnrollmentTokenModal } from './new_enrollment_key_modal'; export { AgentPolicyPackageBadges } from './agent_policy_package_badges'; export { DangerEuiContextMenuItem } from './danger_eui_context_menu_item'; diff --git a/x-pack/plugins/fleet/public/hooks/index.ts b/x-pack/plugins/fleet/public/hooks/index.ts index c41dd1ad42a726..16454a266c3c48 100644 --- a/x-pack/plugins/fleet/public/hooks/index.ts +++ b/x-pack/plugins/fleet/public/hooks/index.ts @@ -12,8 +12,10 @@ export { useKibanaVersion, KibanaVersionContext } from './use_kibana_version'; export { licenseService, useLicense } from './use_license'; export { useLink } from './use_link'; export { useKibanaLink, getHrefToObjectInKibanaApp } from './use_kibana_link'; -export { usePackageIconType, UsePackageIconType } from './use_package_icon_type'; -export { usePagination, Pagination, PAGE_SIZE_OPTIONS } from './use_pagination'; +export type { UsePackageIconType } from './use_package_icon_type'; +export { usePackageIconType } from './use_package_icon_type'; +export type { Pagination } from './use_pagination'; +export { usePagination, PAGE_SIZE_OPTIONS } from './use_pagination'; export { useUrlPagination } from './use_url_pagination'; export { useSorting } from './use_sorting'; export { useDebounce } from './use_debounce'; diff --git a/x-pack/plugins/fleet/public/index.ts b/x-pack/plugins/fleet/public/index.ts index b54d00eafdaabe..ee4fe526fb0e41 100644 --- a/x-pack/plugins/fleet/public/index.ts +++ b/x-pack/plugins/fleet/public/index.ts @@ -12,7 +12,7 @@ import type { PluginInitializerContext } from 'src/core/public'; import { FleetPlugin } from './plugin'; -export { FleetSetup, FleetStart } from './plugin'; +export type { FleetSetup, FleetStart } from './plugin'; export const plugin = (initializerContext: PluginInitializerContext) => { return new FleetPlugin(initializerContext); @@ -24,7 +24,5 @@ export * from './types/ui_extensions'; export { pagePathGetters } from './constants'; export { pkgKeyFromPackageInfo } from './services'; -export { - CustomAssetsAccordion, - CustomAssetsAccordionProps, -} from './components/custom_assets_accordion'; +export type { CustomAssetsAccordionProps } from './components/custom_assets_accordion'; +export { CustomAssetsAccordion } from './components/custom_assets_accordion'; diff --git a/x-pack/plugins/fleet/public/layouts/index.ts b/x-pack/plugins/fleet/public/layouts/index.ts index e6e366654a866b..62e3c5b889ca8e 100644 --- a/x-pack/plugins/fleet/public/layouts/index.ts +++ b/x-pack/plugins/fleet/public/layouts/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { WithHeaderLayout, WithHeaderLayoutProps } from './with_header'; +export type { WithHeaderLayoutProps } from './with_header'; +export { WithHeaderLayout } from './with_header'; export { WithoutHeaderLayout } from './without_header'; diff --git a/x-pack/plugins/fleet/public/plugin.ts b/x-pack/plugins/fleet/public/plugin.ts index b0e4e56aa344a0..039c1da9b934cc 100644 --- a/x-pack/plugins/fleet/public/plugin.ts +++ b/x-pack/plugins/fleet/public/plugin.ts @@ -52,7 +52,7 @@ import { createExtensionRegistrationCallback } from './services/ui_extensions'; import type { UIExtensionRegistrationCallback, UIExtensionsStorage } from './types'; import { LazyCustomLogsAssetsExtension } from './lazy_custom_logs_assets_extension'; -export { FleetConfigType } from '../common/types'; +export type { FleetConfigType } from '../common/types'; import { setCustomIntegrations } from './services/custom_integrations'; diff --git a/x-pack/plugins/fleet/public/services/index.ts b/x-pack/plugins/fleet/public/services/index.ts index fbd3bddde744b8..10dfe6b59d6ba3 100644 --- a/x-pack/plugins/fleet/public/services/index.ts +++ b/x-pack/plugins/fleet/public/services/index.ts @@ -7,6 +7,11 @@ export { getFlattenedObject } from '@kbn/std'; +export type { + PackagePolicyValidationResults, + PackagePolicyConfigValidationResults, + PackagePolicyInputValidationResults, +} from '../../common'; export { AgentStatusKueryHelper, agentPolicyRouteService, @@ -30,9 +35,6 @@ export { LicenseService, isAgentUpgradeable, doesPackageHaveIntegrations, - PackagePolicyValidationResults, - PackagePolicyConfigValidationResults, - PackagePolicyInputValidationResults, validatePackagePolicy, validatePackagePolicyConfig, validationHasErrors, diff --git a/x-pack/plugins/fleet/public/types/index.ts b/x-pack/plugins/fleet/public/types/index.ts index 3ff0a760b58828..d61223f0cebc78 100644 --- a/x-pack/plugins/fleet/public/types/index.ts +++ b/x-pack/plugins/fleet/public/types/index.ts @@ -5,10 +5,7 @@ * 2.0. */ -export { - // utility function - entries, - // Object types +export type { Agent, AgentMetadata, AgentPolicy, @@ -28,9 +25,7 @@ export { Output, DataStream, Settings, - // API schema - misc setup, status GetFleetStatusResponse, - // API schemas - Agent policy GetAgentPoliciesRequest, GetAgentPoliciesResponse, GetAgentPoliciesResponseItem, @@ -44,7 +39,6 @@ export { CopyAgentPolicyResponse, DeleteAgentPolicyRequest, DeleteAgentPolicyResponse, - // API schemas - Package policy CreatePackagePolicyRequest, CreatePackagePolicyResponse, UpdatePackagePolicyRequest, @@ -53,9 +47,7 @@ export { DryRunPackagePolicy, UpgradePackagePolicyResponse, UpgradePackagePolicyDryRunResponse, - // API schemas - Data streams GetDataStreamsResponse, - // API schemas - Agents GetAgentsResponse, GetAgentsRequest, GetOneAgentResponse, @@ -75,24 +67,19 @@ export { PostBulkAgentReassignResponse, PostNewAgentActionResponse, PostNewAgentActionRequest, - // API schemas - Enrollment API Keys GetEnrollmentAPIKeysResponse, GetEnrollmentAPIKeysRequest, GetOneEnrollmentAPIKeyResponse, PostEnrollmentAPIKeyRequest, PostEnrollmentAPIKeyResponse, - // API schemas - Outputs GetOutputsResponse, PutOutputRequest, PutOutputResponse, - // API schemas - Settings GetSettingsResponse, PutSettingsRequest, PutSettingsResponse, - // API schemas - app CheckPermissionsResponse, GenerateServiceTokenResponse, - // EPM types AssetReference, AssetsGroupedByServiceByType, AssetType, @@ -100,8 +87,6 @@ export { CategoryId, CategorySummaryItem, CategorySummaryList, - ElasticsearchAssetType, - KibanaAssetType, PackageInfo, RegistryVarsEntry, RegistryInput, @@ -123,7 +108,6 @@ export { InstallPackageResponse, DeletePackageResponse, DetailViewPanelName, - InstallStatus, InstallationStatus, Installable, RegistryRelease, @@ -131,6 +115,7 @@ export { UpdatePackageRequest, UpdatePackageResponse, } from '../../common'; +export { entries, ElasticsearchAssetType, KibanaAssetType, InstallStatus } from '../../common'; export * from './intra_app_route_state'; export * from './ui_extensions'; diff --git a/x-pack/plugins/fleet/server/index.ts b/x-pack/plugins/fleet/server/index.ts index cdc0dfddc01e5e..e1ee2652594cc6 100644 --- a/x-pack/plugins/fleet/server/index.ts +++ b/x-pack/plugins/fleet/server/index.ts @@ -18,18 +18,18 @@ import { import { FleetPlugin } from './plugin'; export { default as apm } from 'elastic-apm-node'; -export { +export type { AgentService, ESIndexPatternService, - getRegistryUrl, PackageService, AgentPolicyServiceInterface, ArtifactsClientInterface, Artifact, ListArtifactsProps, } from './services'; +export { getRegistryUrl } from './services'; -export { FleetSetupContract, FleetSetupDeps, FleetStartContract } from './plugin'; +export type { FleetSetupContract, FleetSetupDeps, FleetStartContract } from './plugin'; export type { ExternalCallback, PutPackagePolicyUpdateCallback, @@ -45,42 +45,59 @@ export const config: PluginConfigDescriptor = { }, deprecations: ({ renameFromRoot, unused, unusedFromRoot }) => [ // Fleet plugin was named ingestManager before - renameFromRoot('xpack.ingestManager.enabled', 'xpack.fleet.enabled'), - renameFromRoot('xpack.ingestManager.registryUrl', 'xpack.fleet.registryUrl'), - renameFromRoot('xpack.ingestManager.registryProxyUrl', 'xpack.fleet.registryProxyUrl'), - renameFromRoot('xpack.ingestManager.fleet', 'xpack.ingestManager.agents'), - renameFromRoot('xpack.ingestManager.agents.enabled', 'xpack.fleet.agents.enabled'), - renameFromRoot('xpack.ingestManager.agents.elasticsearch', 'xpack.fleet.agents.elasticsearch'), + renameFromRoot('xpack.ingestManager.enabled', 'xpack.fleet.enabled', { level: 'critical' }), + renameFromRoot('xpack.ingestManager.registryUrl', 'xpack.fleet.registryUrl', { + level: 'critical', + }), + renameFromRoot('xpack.ingestManager.registryProxyUrl', 'xpack.fleet.registryProxyUrl', { + level: 'critical', + }), + renameFromRoot('xpack.ingestManager.fleet', 'xpack.ingestManager.agents', { + level: 'critical', + }), + renameFromRoot('xpack.ingestManager.agents.enabled', 'xpack.fleet.agents.enabled', { + level: 'critical', + }), + renameFromRoot('xpack.ingestManager.agents.elasticsearch', 'xpack.fleet.agents.elasticsearch', { + level: 'critical', + }), renameFromRoot( 'xpack.ingestManager.agents.tlsCheckDisabled', - 'xpack.fleet.agents.tlsCheckDisabled' + 'xpack.fleet.agents.tlsCheckDisabled', + { level: 'critical' } ), renameFromRoot( 'xpack.ingestManager.agents.pollingRequestTimeout', - 'xpack.fleet.agents.pollingRequestTimeout' + 'xpack.fleet.agents.pollingRequestTimeout', + { level: 'critical' } ), renameFromRoot( 'xpack.ingestManager.agents.maxConcurrentConnections', - 'xpack.fleet.agents.maxConcurrentConnections' + 'xpack.fleet.agents.maxConcurrentConnections', + { level: 'critical' } ), - renameFromRoot('xpack.ingestManager.agents.kibana', 'xpack.fleet.agents.kibana'), + renameFromRoot('xpack.ingestManager.agents.kibana', 'xpack.fleet.agents.kibana', { + level: 'critical', + }), renameFromRoot( 'xpack.ingestManager.agents.agentPolicyRolloutRateLimitIntervalMs', - 'xpack.fleet.agents.agentPolicyRolloutRateLimitIntervalMs' + 'xpack.fleet.agents.agentPolicyRolloutRateLimitIntervalMs', + { level: 'critical' } ), renameFromRoot( 'xpack.ingestManager.agents.agentPolicyRolloutRateLimitRequestPerInterval', - 'xpack.fleet.agents.agentPolicyRolloutRateLimitRequestPerInterval' + 'xpack.fleet.agents.agentPolicyRolloutRateLimitRequestPerInterval', + { level: 'critical' } ), - unusedFromRoot('xpack.ingestManager'), + unusedFromRoot('xpack.ingestManager', { level: 'critical' }), // Unused settings before Fleet server exists - unused('agents.kibana'), - unused('agents.maxConcurrentConnections'), - unused('agents.agentPolicyRolloutRateLimitIntervalMs'), - unused('agents.agentPolicyRolloutRateLimitRequestPerInterval'), - unused('agents.pollingRequestTimeout'), - unused('agents.tlsCheckDisabled'), - unused('agents.fleetServerEnabled'), + unused('agents.kibana', { level: 'critical' }), + unused('agents.maxConcurrentConnections', { level: 'critical' }), + unused('agents.agentPolicyRolloutRateLimitIntervalMs', { level: 'critical' }), + unused('agents.agentPolicyRolloutRateLimitRequestPerInterval', { level: 'critical' }), + unused('agents.pollingRequestTimeout', { level: 'critical' }), + unused('agents.tlsCheckDisabled', { level: 'critical' }), + unused('agents.fleetServerEnabled', { level: 'critical' }), // Renaming elasticsearch.host => elasticsearch.hosts (fullConfig, fromPath, addDeprecation) => { const oldValue = fullConfig?.xpack?.fleet?.agents?.elasticsearch?.host; @@ -95,6 +112,7 @@ export const config: PluginConfigDescriptor = { `Use [xpack.fleet.agents.elasticsearch.hosts] with an array of host instead.`, ], }, + level: 'critical', }); } @@ -129,7 +147,7 @@ export const config: PluginConfigDescriptor = { export type FleetConfigType = TypeOf; -export { PackagePolicyServiceInterface } from './services/package_policy'; +export type { PackagePolicyServiceInterface } from './services/package_policy'; export { relativeDownloadUrlFromArtifact } from './services/artifacts/mappings'; diff --git a/x-pack/plugins/fleet/server/mocks/index.ts b/x-pack/plugins/fleet/server/mocks/index.ts index 282135c7b1bcdb..943f100c94f729 100644 --- a/x-pack/plugins/fleet/server/mocks/index.ts +++ b/x-pack/plugins/fleet/server/mocks/index.ts @@ -19,6 +19,7 @@ import { securityMock } from '../../../security/server/mocks'; import type { PackagePolicyServiceInterface } from '../services/package_policy'; import type { AgentPolicyServiceInterface, AgentService } from '../services'; import type { FleetAppContext } from '../plugin'; +import { createMockTelemetryEventsSender } from '../telemetry/__mocks__'; // Export all mocks from artifacts export * from '../services/artifacts/mocks'; @@ -59,6 +60,7 @@ export const createAppContextStartContractMock = (): MockedFleetAppContext => { config$, kibanaVersion: '8.99.0', // Fake version :) kibanaBranch: 'main', + telemetryEventsSender: createMockTelemetryEventsSender(), }; }; diff --git a/x-pack/plugins/fleet/server/plugin.ts b/x-pack/plugins/fleet/server/plugin.ts index 410682a13733cb..7cc1b8b1cfcc9a 100644 --- a/x-pack/plugins/fleet/server/plugin.ts +++ b/x-pack/plugins/fleet/server/plugin.ts @@ -18,6 +18,8 @@ import type { } from 'kibana/server'; import type { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; +import type { TelemetryPluginSetup, TelemetryPluginStart } from 'src/plugins/telemetry/server'; + import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server'; import type { PluginStart as DataPluginStart } from '../../../../src/plugins/data/server'; import type { LicensingPluginSetup, ILicense } from '../../licensing/server'; @@ -83,6 +85,7 @@ import { RouterWrappers } from './routes/security'; import { startFleetServerSetup } from './services/fleet_server'; import { FleetArtifactsClient } from './services/artifacts'; import type { FleetRouter } from './types/request_context'; +import { TelemetryEventsSender } from './telemetry/sender'; export interface FleetSetupDeps { licensing: LicensingPluginSetup; @@ -91,12 +94,14 @@ export interface FleetSetupDeps { encryptedSavedObjects: EncryptedSavedObjectsPluginSetup; cloud?: CloudSetup; usageCollection?: UsageCollectionSetup; + telemetry?: TelemetryPluginSetup; } export interface FleetStartDeps { data: DataPluginStart; encryptedSavedObjects: EncryptedSavedObjectsPluginStart; security?: SecurityPluginStart; + telemetry?: TelemetryPluginStart; } export interface FleetAppContext { @@ -115,6 +120,7 @@ export interface FleetAppContext { cloud?: CloudSetup; logger?: Logger; httpSetup?: HttpServiceSetup; + telemetryEventsSender: TelemetryEventsSender; } export type FleetSetupContract = void; @@ -176,6 +182,7 @@ export class FleetPlugin private httpSetup?: HttpServiceSetup; private securitySetup?: SecurityPluginSetup; private encryptedSavedObjectsSetup?: EncryptedSavedObjectsPluginSetup; + private readonly telemetryEventsSender: TelemetryEventsSender; constructor(private readonly initializerContext: PluginInitializerContext) { this.config$ = this.initializerContext.config.create(); @@ -184,6 +191,7 @@ export class FleetPlugin this.kibanaBranch = this.initializerContext.env.packageInfo.branch; this.logger = this.initializerContext.logger.get(); this.configInitialValue = this.initializerContext.config.get(); + this.telemetryEventsSender = new TelemetryEventsSender(this.logger.get('telemetry_events')); } public setup(core: CoreSetup, deps: FleetSetupDeps) { @@ -302,6 +310,8 @@ export class FleetPlugin }); } } + + this.telemetryEventsSender.setup(deps.telemetry); } public start(core: CoreStart, plugins: FleetStartDeps): FleetStartContract { @@ -321,11 +331,14 @@ export class FleetPlugin httpSetup: this.httpSetup, cloud: this.cloud, logger: this.logger, + telemetryEventsSender: this.telemetryEventsSender, }); licenseService.start(this.licensing$); const fleetServerSetup = startFleetServerSetup(); + this.telemetryEventsSender.start(plugins.telemetry, core); + return { fleetSetupCompleted: () => new Promise((resolve) => { @@ -362,5 +375,6 @@ export class FleetPlugin public async stop() { appContextService.stop(); licenseService.stop(); + this.telemetryEventsSender.stop(); } } diff --git a/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts b/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts index 77e7a2c4ede1aa..58463bfa5569d2 100644 --- a/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts @@ -146,7 +146,8 @@ export const updatePackagePolicyHandler: RequestHandler< esClient, request.params.packagePolicyId, { ...newData, package: pkg, inputs }, - { user } + { user }, + packagePolicy.package?.version ); return response.ok({ body: { item: updatedPackagePolicy }, diff --git a/x-pack/plugins/fleet/server/services/agent_policy.ts b/x-pack/plugins/fleet/server/services/agent_policy.ts index 321bc7f289594d..7de907b9a15fad 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.ts @@ -410,12 +410,16 @@ class AgentPolicyService { options ); - // Copy all package policies + // Copy all package policies and append (copy) to their names if (baseAgentPolicy.package_policies.length) { const newPackagePolicies = (baseAgentPolicy.package_policies as PackagePolicy[]).map( (packagePolicy: PackagePolicy) => { const { id: packagePolicyId, version, ...newPackagePolicy } = packagePolicy; - return newPackagePolicy; + const updatedPackagePolicy = { + ...newPackagePolicy, + name: `${packagePolicy.name} (copy)`, + }; + return updatedPackagePolicy; } ); await packagePolicyService.bulkCreate( diff --git a/x-pack/plugins/fleet/server/services/app_context.ts b/x-pack/plugins/fleet/server/services/app_context.ts index a1e6ef4545aefe..7ec1607598b8aa 100644 --- a/x-pack/plugins/fleet/server/services/app_context.ts +++ b/x-pack/plugins/fleet/server/services/app_context.ts @@ -33,6 +33,7 @@ import type { } from '../types'; import type { FleetAppContext } from '../plugin'; import type { CloudSetup } from '../../../cloud/server'; +import type { TelemetryEventsSender } from '../telemetry/sender'; class AppContextService { private encryptedSavedObjects: EncryptedSavedObjectsClient | undefined; @@ -51,6 +52,7 @@ class AppContextService { private logger: Logger | undefined; private httpSetup?: HttpServiceSetup; private externalCallbacks: ExternalCallbacksStorage = new Map(); + private telemetryEventsSender: TelemetryEventsSender | undefined; public start(appContext: FleetAppContext) { this.data = appContext.data; @@ -66,6 +68,7 @@ class AppContextService { this.kibanaVersion = appContext.kibanaVersion; this.kibanaBranch = appContext.kibanaBranch; this.httpSetup = appContext.httpSetup; + this.telemetryEventsSender = appContext.telemetryEventsSender; if (appContext.config$) { this.config$ = appContext.config$; @@ -203,6 +206,10 @@ class AppContextService { >; } } + + public getTelemetryEventsSender() { + return this.telemetryEventsSender; + } } export const appContextService = new AppContextService(); diff --git a/x-pack/plugins/fleet/server/services/epm/packages/get.ts b/x-pack/plugins/fleet/server/services/epm/packages/get.ts index 8d3c1fbe0daa4a..b6a1850fed5b8e 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/get.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/get.ts @@ -30,7 +30,8 @@ import { normalizeKuery } from '../../saved_object'; import { createInstallableFrom, isUnremovablePackage } from './index'; -export { getFile, SearchParams } from '../registry'; +export type { SearchParams } from '../registry'; +export { getFile } from '../registry'; function nameAsTitle(name: string) { return name.charAt(0).toUpperCase() + name.substr(1).toLowerCase(); diff --git a/x-pack/plugins/fleet/server/services/epm/packages/index.ts b/x-pack/plugins/fleet/server/services/epm/packages/index.ts index 58e7c9e8928d88..a6970a8d19db4e 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/index.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/index.ts @@ -12,6 +12,7 @@ import { KibanaAssetType } from '../../../types'; import type { AssetType, Installable, Installation } from '../../../types'; export { bulkInstallPackages, isBulkInstallError } from './bulk_install_packages'; +export type { SearchParams } from './get'; export { getCategories, getFile, @@ -21,16 +22,10 @@ export { getPackageInfo, getPackages, getLimitedPackages, - SearchParams, } from './get'; -export { - BulkInstallResponse, - IBulkInstallPackageError, - handleInstallPackageFailure, - installPackage, - ensureInstalledPackage, -} from './install'; +export type { BulkInstallResponse, IBulkInstallPackageError } from './install'; +export { handleInstallPackageFailure, installPackage, ensureInstalledPackage } from './install'; export { removeInstallation } from './remove'; export function isUnremovablePackage(value: string): boolean { diff --git a/x-pack/plugins/fleet/server/services/package_policy.test.ts b/x-pack/plugins/fleet/server/services/package_policy.test.ts index b6207316829ee7..dcc00251e70f4d 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.test.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.test.ts @@ -134,6 +134,12 @@ jest.mock('./epm/packages/cleanup', () => { }; }); +jest.mock('./upgrade_usage', () => { + return { + sendTelemetryEvents: jest.fn(), + }; +}); + const mockedFetchInfo = fetchInfo as jest.Mock>; type CombinedExternalCallback = PutPackagePolicyUpdateCallback | PostPackagePolicyCreateCallback; diff --git a/x-pack/plugins/fleet/server/services/package_policy.ts b/x-pack/plugins/fleet/server/services/package_policy.ts index 39902d35feb08f..985351c3e981b5 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.ts @@ -9,7 +9,7 @@ import { omit, partition } from 'lodash'; import { i18n } from '@kbn/i18n'; import semverLte from 'semver/functions/lte'; import { getFlattenedObject } from '@kbn/std'; -import type { KibanaRequest, LogMeta } from 'src/core/server'; +import type { KibanaRequest } from 'src/core/server'; import type { ElasticsearchClient, RequestHandlerContext, @@ -42,7 +42,6 @@ import type { } from '../../common'; import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../constants'; import { - HostedAgentPolicyRestrictionRelatedError, IngestManagerError, ingestErrorToResponseOptions, PackagePolicyIneligibleForUpgradeError, @@ -68,6 +67,8 @@ import { compileTemplate } from './epm/agent/agent'; import { normalizeKuery } from './saved_object'; import { appContextService } from '.'; import { removeOldAssets } from './epm/packages/cleanup'; +import type { PackagePolicyUpgradeUsage } from './upgrade_usage'; +import { sendTelemetryEvents } from './upgrade_usage'; export type InputsOverride = Partial & { vars?: Array; @@ -84,17 +85,6 @@ export const DATA_STREAM_ALLOWED_INDEX_PRIVILEGES = new Set([ 'read_cross_cluster', ]); -interface PackagePolicyUpgradeLogMeta extends LogMeta { - package_policy_upgrade: { - package_name: string; - current_version: string; - new_version: string; - status: 'success' | 'failure'; - error?: any[]; - dryRun?: boolean; - }; -} - class PackagePolicyService { public async create( soClient: SavedObjectsClientContract, @@ -108,24 +98,14 @@ class PackagePolicyService { skipEnsureInstalled?: boolean; } ): Promise { - // Check that its agent policy does not have a package policy with the same name - const parentAgentPolicy = await agentPolicyService.get(soClient, packagePolicy.policy_id); - if (!parentAgentPolicy) { - throw new Error('Agent policy not found'); - } - if (parentAgentPolicy.is_managed && !options?.force) { - throw new HostedAgentPolicyRestrictionRelatedError( - `Cannot add integrations to hosted agent policy ${parentAgentPolicy.id}` - ); - } - if ( - (parentAgentPolicy.package_policies as PackagePolicy[]).find( - (siblingPackagePolicy) => siblingPackagePolicy.name === packagePolicy.name - ) - ) { - throw new IngestManagerError( - 'There is already a package with the same name on this agent policy' - ); + const existingPoliciesWithName = await this.list(soClient, { + perPage: 1, + kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.name: "${packagePolicy.name}"`, + }); + + // Check that the name does not exist already + if (existingPoliciesWithName.items.length > 0) { + throw new IngestManagerError('There is already a package with the same name'); } let elasticsearch: PackagePolicy['elasticsearch']; // Add ids to stream @@ -329,12 +309,12 @@ class PackagePolicyService { }); return { - items: packagePolicies.saved_objects.map((packagePolicySO) => ({ + items: packagePolicies?.saved_objects.map((packagePolicySO) => ({ id: packagePolicySO.id, version: packagePolicySO.version, ...packagePolicySO.attributes, })), - total: packagePolicies.total, + total: packagePolicies?.total, page, perPage, }; @@ -369,7 +349,8 @@ class PackagePolicyService { esClient: ElasticsearchClient, id: string, packagePolicy: UpdatePackagePolicy, - options?: { user?: AuthenticatedUser } + options?: { user?: AuthenticatedUser }, + currentVersion?: string ): Promise { const oldPackagePolicy = await this.get(soClient, id); const { version, ...restOfPackagePolicy } = packagePolicy; @@ -377,19 +358,15 @@ class PackagePolicyService { if (!oldPackagePolicy) { throw new Error('Package policy not found'); } + // Check that the name does not exist already but exclude the current package policy + const existingPoliciesWithName = await this.list(soClient, { + perPage: 1, + kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.name: "${packagePolicy.name}"`, + }); + const filtered = (existingPoliciesWithName?.items || []).filter((p) => p.id !== id); - // Check that its agent policy does not have a package policy with the same name - const parentAgentPolicy = await agentPolicyService.get(soClient, packagePolicy.policy_id); - if (!parentAgentPolicy) { - throw new Error('Agent policy not found'); - } - if ( - (parentAgentPolicy.package_policies as PackagePolicy[]).find( - (siblingPackagePolicy) => - siblingPackagePolicy.id !== id && siblingPackagePolicy.name === packagePolicy.name - ) - ) { - throw new Error('There is already a package with the same name on this agent policy'); + if (filtered.length > 0) { + throw new IngestManagerError('There is already a package with the same name'); } let inputs = restOfPackagePolicy.inputs.map((input) => @@ -445,22 +422,22 @@ class PackagePolicyService { currentVersion: packagePolicy.package.version, }); - const upgradeMeta: PackagePolicyUpgradeLogMeta = { - package_policy_upgrade: { + if (packagePolicy.package.version !== currentVersion) { + const upgradeTelemetry: PackagePolicyUpgradeUsage = { package_name: packagePolicy.package.name, + current_version: currentVersion || 'unknown', new_version: packagePolicy.package.version, - current_version: 'unknown', status: 'success', dryRun: false, - }, - }; - - appContextService - .getLogger() - .info( - `Package policy successfully upgraded ${JSON.stringify(upgradeMeta)}`, - upgradeMeta + }; + sendTelemetryEvents( + appContextService.getLogger(), + appContextService.getTelemetryEventsSender(), + upgradeTelemetry ); + appContextService.getLogger().info(`Package policy upgraded successfully`); + appContextService.getLogger().debug(JSON.stringify(upgradeTelemetry)); + } } return newPolicy; @@ -629,7 +606,14 @@ class PackagePolicyService { ); updatePackagePolicy.elasticsearch = registryPkgInfo.elasticsearch; - await this.update(soClient, esClient, id, updatePackagePolicy, options); + await this.update( + soClient, + esClient, + id, + updatePackagePolicy, + options, + packagePolicy.package.version + ); result.push({ id, name: packagePolicy.name, @@ -691,24 +675,27 @@ class PackagePolicyService { const hasErrors = 'errors' in updatedPackagePolicy; if (packagePolicy.package.version !== packageInfo.version) { - const upgradeMeta: PackagePolicyUpgradeLogMeta = { - package_policy_upgrade: { - package_name: packageInfo.name, - current_version: packagePolicy.package.version, - new_version: packageInfo.version, - status: hasErrors ? 'failure' : 'success', - error: hasErrors ? updatedPackagePolicy.errors : undefined, - dryRun: true, - }, + const upgradeTelemetry: PackagePolicyUpgradeUsage = { + package_name: packageInfo.name, + current_version: packagePolicy.package.version, + new_version: packageInfo.version, + status: hasErrors ? 'failure' : 'success', + error: hasErrors ? updatedPackagePolicy.errors : undefined, + dryRun: true, }; + sendTelemetryEvents( + appContextService.getLogger(), + appContextService.getTelemetryEventsSender(), + upgradeTelemetry + ); appContextService .getLogger() - .info( + .info( `Package policy upgrade dry run ${ hasErrors ? 'resulted in errors' : 'ran successfully' - } ${JSON.stringify(upgradeMeta)}`, - upgradeMeta + }` ); + appContextService.getLogger().debug(JSON.stringify(upgradeTelemetry)); } return { diff --git a/x-pack/plugins/fleet/server/services/upgrade_usage.test.ts b/x-pack/plugins/fleet/server/services/upgrade_usage.test.ts new file mode 100644 index 00000000000000..5445ad233eddc1 --- /dev/null +++ b/x-pack/plugins/fleet/server/services/upgrade_usage.test.ts @@ -0,0 +1,70 @@ +/* + * Copyright 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 type { Logger } from 'src/core/server'; +import { loggingSystemMock } from 'src/core/server/mocks'; + +import type { TelemetryEventsSender } from '../telemetry/sender'; +import { createMockTelemetryEventsSender } from '../telemetry/__mocks__'; + +import { sendTelemetryEvents, capErrorSize } from './upgrade_usage'; +import type { PackagePolicyUpgradeUsage } from './upgrade_usage'; + +describe('sendTelemetryEvents', () => { + let eventsTelemetryMock: jest.Mocked; + let loggerMock: jest.Mocked; + + beforeEach(() => { + eventsTelemetryMock = createMockTelemetryEventsSender(); + loggerMock = loggingSystemMock.createLogger(); + }); + + it('should queue telemetry events with generic error', () => { + const upgardeMessage: PackagePolicyUpgradeUsage = { + package_name: 'aws', + current_version: '0.6.1', + new_version: '1.3.0', + status: 'failure', + error: [ + { key: 'queueUrl', message: ['Queue URL is required'] }, + { message: 'Invalid format' }, + ], + dryRun: true, + }; + + sendTelemetryEvents(loggerMock, eventsTelemetryMock, upgardeMessage); + + expect(eventsTelemetryMock.queueTelemetryEvents).toHaveBeenCalledWith('fleet-upgrades', [ + { + current_version: '0.6.1', + error: [ + { + key: 'queueUrl', + message: ['Queue URL is required'], + }, + { + message: 'Invalid format', + }, + ], + error_message: ['Field is required', 'Invalid format'], + new_version: '1.3.0', + package_name: 'aws', + status: 'failure', + dryRun: true, + }, + ]); + }); + + it('should cap error size', () => { + const maxSize = 2; + const errors = [{ message: '1' }, { message: '2' }, { message: '3' }]; + + const result = capErrorSize(errors, maxSize); + + expect(result.length).toEqual(maxSize); + }); +}); diff --git a/x-pack/plugins/fleet/server/services/upgrade_usage.ts b/x-pack/plugins/fleet/server/services/upgrade_usage.ts new file mode 100644 index 00000000000000..68bb126496e01d --- /dev/null +++ b/x-pack/plugins/fleet/server/services/upgrade_usage.ts @@ -0,0 +1,65 @@ +/* + * Copyright 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 type { Logger } from 'src/core/server'; + +import type { TelemetryEventsSender } from '../telemetry/sender'; + +export interface PackagePolicyUpgradeUsage { + package_name: string; + current_version: string; + new_version: string; + status: 'success' | 'failure'; + error?: UpgradeError[]; + dryRun?: boolean; + error_message?: string[]; +} + +export interface UpgradeError { + key?: string; + message: string | string[]; +} + +export const MAX_ERROR_SIZE = 100; +export const FLEET_UPGRADES_CHANNEL_NAME = 'fleet-upgrades'; + +export function sendTelemetryEvents( + logger: Logger, + eventsTelemetry: TelemetryEventsSender | undefined, + upgradeUsage: PackagePolicyUpgradeUsage +) { + if (eventsTelemetry === undefined) { + return; + } + + try { + const cappedErrors = capErrorSize(upgradeUsage.error || [], MAX_ERROR_SIZE); + eventsTelemetry.queueTelemetryEvents(FLEET_UPGRADES_CHANNEL_NAME, [ + { + ...upgradeUsage, + error: upgradeUsage.error ? cappedErrors : undefined, + error_message: makeErrorGeneric(cappedErrors), + }, + ]); + } catch (exc) { + logger.error(`queing telemetry events failed ${exc}`); + } +} + +export function capErrorSize(errors: UpgradeError[], maxSize: number): UpgradeError[] { + return errors.length > maxSize ? errors?.slice(0, maxSize) : errors; +} + +function makeErrorGeneric(errors: UpgradeError[]): string[] { + return errors.map((error) => { + if (Array.isArray(error.message)) { + const firstMessage = error.message[0]; + return firstMessage?.indexOf('is required') > -1 ? 'Field is required' : firstMessage; + } + return error.message as string; + }); +} diff --git a/x-pack/plugins/fleet/server/telemetry/__mocks__/index.ts b/x-pack/plugins/fleet/server/telemetry/__mocks__/index.ts new file mode 100644 index 00000000000000..2070aeca208617 --- /dev/null +++ b/x-pack/plugins/fleet/server/telemetry/__mocks__/index.ts @@ -0,0 +1,26 @@ +/* + * Copyright 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 type { TelemetryEventsSender } from '../sender'; + +/** + * Creates a mocked Telemetry Events Sender + */ +export const createMockTelemetryEventsSender = ( + enableTelemetry?: boolean +): jest.Mocked => { + return { + setup: jest.fn(), + start: jest.fn(), + stop: jest.fn(), + fetchTelemetryUrl: jest.fn(), + queueTelemetryEvents: jest.fn(), + isTelemetryOptedIn: jest.fn().mockReturnValue(enableTelemetry ?? jest.fn()), + sendIfDue: jest.fn(), + sendEvents: jest.fn(), + } as unknown as jest.Mocked; +}; diff --git a/x-pack/plugins/fleet/server/telemetry/queue.test.ts b/x-pack/plugins/fleet/server/telemetry/queue.test.ts new file mode 100644 index 00000000000000..510b8983870362 --- /dev/null +++ b/x-pack/plugins/fleet/server/telemetry/queue.test.ts @@ -0,0 +1,39 @@ +/* + * Copyright 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. + */ +/* eslint-disable dot-notation */ +import { TelemetryQueue } from './queue'; + +describe('TelemetryQueue', () => { + describe('queueTelemetryEvents', () => { + it('queues two events', () => { + const queue = new TelemetryQueue(); + queue.addEvents([{ 'event.kind': '1' }, { 'event.kind': '2' }]); + expect(queue['queue'].length).toBe(2); + }); + + it('queues more than maxQueueSize events', () => { + const queue = new TelemetryQueue(); + queue.addEvents([{ 'event.kind': '1' }, { 'event.kind': '2' }]); + queue['maxQueueSize'] = 5; + queue.addEvents([{ 'event.kind': '3' }, { 'event.kind': '4' }]); + queue.addEvents([{ 'event.kind': '5' }, { 'event.kind': '6' }]); + queue.addEvents([{ 'event.kind': '7' }, { 'event.kind': '8' }]); + expect(queue['queue'].length).toBe(5); + }); + + it('get and clear events', async () => { + const queue = new TelemetryQueue(); + queue.addEvents([{ 'event.kind': '1' }, { 'event.kind': '2' }]); + + expect(queue.getEvents().length).toBe(2); + + queue.clearEvents(); + + expect(queue['queue'].length).toBe(0); + }); + }); +}); diff --git a/x-pack/plugins/fleet/server/telemetry/queue.ts b/x-pack/plugins/fleet/server/telemetry/queue.ts new file mode 100644 index 00000000000000..3496cfb94915d3 --- /dev/null +++ b/x-pack/plugins/fleet/server/telemetry/queue.ts @@ -0,0 +1,40 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const TELEMETRY_MAX_QUEUE_SIZE = 100; + +export class TelemetryQueue { + private maxQueueSize = TELEMETRY_MAX_QUEUE_SIZE; + private queue: T[] = []; + + public addEvents(events: T[]) { + const qlength = this.queue.length; + + if (events.length === 0) { + return; + } + + if (qlength >= this.maxQueueSize) { + // we're full already + return; + } + + if (events.length > this.maxQueueSize - qlength) { + this.queue.push(...events.slice(0, this.maxQueueSize - qlength)); + } else { + this.queue.push(...events); + } + } + + public clearEvents() { + this.queue = []; + } + + public getEvents(): T[] { + return this.queue; + } +} diff --git a/x-pack/plugins/fleet/server/telemetry/sender.test.ts b/x-pack/plugins/fleet/server/telemetry/sender.test.ts new file mode 100644 index 00000000000000..8fe4c6e150ff94 --- /dev/null +++ b/x-pack/plugins/fleet/server/telemetry/sender.test.ts @@ -0,0 +1,143 @@ +/* + * Copyright 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. + */ + +/* eslint-disable dot-notation */ + +import { URL } from 'url'; + +import axios from 'axios'; + +import type { InfoResponse } from '@elastic/elasticsearch/lib/api/types'; + +import { loggingSystemMock } from 'src/core/server/mocks'; + +import { TelemetryEventsSender } from './sender'; + +jest.mock('axios', () => { + return { + post: jest.fn(), + }; +}); + +describe('TelemetryEventsSender', () => { + let logger: ReturnType; + let sender: TelemetryEventsSender; + + beforeEach(() => { + logger = loggingSystemMock.createLogger(); + sender = new TelemetryEventsSender(logger); + sender.start(undefined, { + elasticsearch: { client: { asInternalUser: { info: jest.fn(async () => ({})) } } }, + } as any); + }); + + describe('queueTelemetryEvents', () => { + it('queues two events', () => { + sender.queueTelemetryEvents('fleet-upgrades', [ + { package_name: 'system', current_version: '0.3', new_version: '1.0', status: 'success' }, + ]); + expect(sender['queuesPerChannel']['fleet-upgrades']).toBeDefined(); + }); + + it('should send events when due', async () => { + sender['telemetryStart'] = { + getIsOptedIn: jest.fn(async () => true), + }; + sender['telemetrySetup'] = { + getTelemetryUrl: jest.fn( + async () => new URL('https://telemetry-staging.elastic.co/v3/send/snapshot') + ), + }; + + sender.queueTelemetryEvents('fleet-upgrades', [ + { package_name: 'apache', current_version: '0.3', new_version: '1.0', status: 'success' }, + ]); + sender['sendEvents'] = jest.fn(); + + await sender['sendIfDue'](); + + expect(sender['sendEvents']).toHaveBeenCalledWith( + 'https://telemetry-staging.elastic.co/v3/send/fleet-upgrades', + undefined, + expect.anything() + ); + }); + + it("shouldn't send when telemetry is disabled", async () => { + const telemetryStart = { + getIsOptedIn: jest.fn(async () => false), + }; + sender['telemetryStart'] = telemetryStart; + + sender.queueTelemetryEvents('fleet-upgrades', [ + { package_name: 'system', current_version: '0.3', new_version: '1.0', status: 'success' }, + ]); + sender['sendEvents'] = jest.fn(); + + await sender['sendIfDue'](); + + expect(sender['sendEvents']).toBeCalledTimes(0); + }); + + it('should send events to separate channels', async () => { + sender['telemetryStart'] = { + getIsOptedIn: jest.fn(async () => true), + }; + sender['telemetrySetup'] = { + getTelemetryUrl: jest.fn( + async () => new URL('https://telemetry.elastic.co/v3/send/snapshot') + ), + }; + + sender['fetchClusterInfo'] = jest.fn(async () => { + return { + cluster_uuid: '1', + cluster_name: 'name', + version: { + number: '8.0.0', + }, + } as InfoResponse; + }); + + const myChannelEvents = [{ 'event.kind': '1' }, { 'event.kind': '2' }]; + // @ts-ignore + sender.queueTelemetryEvents('my-channel', myChannelEvents); + sender['queuesPerChannel']['my-channel']['getEvents'] = jest.fn(() => myChannelEvents); + + expect(sender['queuesPerChannel']['my-channel']['queue'].length).toBe(2); + + const myChannel2Events = [{ 'event.kind': '3' }]; + // @ts-ignore + sender.queueTelemetryEvents('my-channel2', myChannel2Events); + sender['queuesPerChannel']['my-channel2']['getEvents'] = jest.fn(() => myChannel2Events); + + expect(sender['queuesPerChannel']['my-channel2']['queue'].length).toBe(1); + + await sender['sendIfDue'](); + + expect(sender['queuesPerChannel']['my-channel']['getEvents']).toBeCalledTimes(1); + expect(sender['queuesPerChannel']['my-channel2']['getEvents']).toBeCalledTimes(1); + const headers = { + headers: { + 'Content-Type': 'application/x-ndjson', + 'X-Elastic-Cluster-ID': '1', + 'X-Elastic-Stack-Version': '8.0.0', + }, + }; + expect(axios.post).toHaveBeenCalledWith( + 'https://telemetry.elastic.co/v3/send/my-channel', + '{"event.kind":"1"}\n{"event.kind":"2"}\n', + headers + ); + expect(axios.post).toHaveBeenCalledWith( + 'https://telemetry.elastic.co/v3/send/my-channel2', + '{"event.kind":"3"}\n', + headers + ); + }); + }); +}); diff --git a/x-pack/plugins/fleet/server/telemetry/sender.ts b/x-pack/plugins/fleet/server/telemetry/sender.ts new file mode 100644 index 00000000000000..3bda17fbd1d79c --- /dev/null +++ b/x-pack/plugins/fleet/server/telemetry/sender.ts @@ -0,0 +1,192 @@ +/* + * Copyright 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 type { CoreStart, ElasticsearchClient, Logger } from 'src/core/server'; +import type { TelemetryPluginStart, TelemetryPluginSetup } from 'src/plugins/telemetry/server'; + +import { cloneDeep } from 'lodash'; + +import axios from 'axios'; + +import type { InfoResponse } from '@elastic/elasticsearch/lib/api/types'; + +import { TelemetryQueue } from './queue'; + +import type { FleetTelemetryChannel, FleetTelemetryChannelEvents } from './types'; + +/** + * Simplified version of https://github.com/elastic/kibana/blob/master/x-pack/plugins/security_solution/server/lib/telemetry/sender.ts + * Sends batched events to telemetry v3 api + */ +export class TelemetryEventsSender { + private readonly initialCheckDelayMs = 10 * 1000; + private readonly checkIntervalMs = 30 * 1000; + private readonly logger: Logger; + + private telemetryStart?: TelemetryPluginStart; + private telemetrySetup?: TelemetryPluginSetup; + private intervalId?: NodeJS.Timeout; + private isSending = false; + private queuesPerChannel: { [channel: string]: TelemetryQueue } = {}; + private isOptedIn?: boolean = true; // Assume true until the first check + private esClient?: ElasticsearchClient; + + constructor(logger: Logger) { + this.logger = logger; + } + + public setup(telemetrySetup?: TelemetryPluginSetup) { + this.telemetrySetup = telemetrySetup; + } + + public async start(telemetryStart?: TelemetryPluginStart, core?: CoreStart) { + this.telemetryStart = telemetryStart; + this.esClient = core?.elasticsearch.client.asInternalUser; + + this.logger.debug(`Starting local task`); + setTimeout(() => { + this.sendIfDue(); + this.intervalId = setInterval(() => this.sendIfDue(), this.checkIntervalMs); + }, this.initialCheckDelayMs); + } + + public stop() { + if (this.intervalId) { + clearInterval(this.intervalId); + } + } + + public queueTelemetryEvents( + channel: T, + events: Array + ) { + if (!this.queuesPerChannel[channel]) { + this.queuesPerChannel[channel] = new TelemetryQueue(); + } + this.queuesPerChannel[channel].addEvents(cloneDeep(events)); + } + + public async isTelemetryOptedIn() { + this.isOptedIn = await this.telemetryStart?.getIsOptedIn(); + return this.isOptedIn === true; + } + + private async sendIfDue() { + if (this.isSending) { + return; + } + + this.isSending = true; + + this.isOptedIn = await this.isTelemetryOptedIn(); + if (!this.isOptedIn) { + this.logger.debug(`Telemetry is not opted-in.`); + for (const channel of Object.keys(this.queuesPerChannel)) { + this.queuesPerChannel[channel].clearEvents(); + } + this.isSending = false; + return; + } + + const clusterInfo = await this.fetchClusterInfo(); + + for (const channel of Object.keys(this.queuesPerChannel)) { + await this.sendEvents( + await this.fetchTelemetryUrl(channel), + clusterInfo, + this.queuesPerChannel[channel] + ); + } + + this.isSending = false; + } + + private async fetchClusterInfo(): Promise { + if (this.esClient === undefined || this.esClient === null) { + throw Error('elasticsearch client is unavailable: cannot retrieve cluster infomation'); + } + + const { body } = await this.esClient.info(); + return body; + } + + public async sendEvents( + telemetryUrl: string, + clusterInfo: InfoResponse | undefined, + queue: TelemetryQueue + ) { + const events = queue.getEvents(); + if (events.length === 0) { + return; + } + + try { + this.logger.debug(`Telemetry URL: ${telemetryUrl}`); + + queue.clearEvents(); + + this.logger.debug(JSON.stringify(events)); + + await this.send( + events, + telemetryUrl, + clusterInfo?.cluster_uuid, + clusterInfo?.version?.number + ); + } catch (err) { + this.logger.warn(`Error sending telemetry events data: ${err}`); + queue.clearEvents(); + } + } + + // Forms URLs like: + // https://telemetry.elastic.co/v3/send/my-channel-name or + // https://telemetry-staging.elastic.co/v3/send/my-channel-name + private async fetchTelemetryUrl(channel: string): Promise { + const telemetryUrl = await this.telemetrySetup?.getTelemetryUrl(); + if (!telemetryUrl) { + throw Error("Couldn't get telemetry URL"); + } + telemetryUrl.pathname = `/v3/send/${channel}`; + return telemetryUrl.toString(); + } + + private async send( + events: unknown[], + telemetryUrl: string, + clusterUuid: string | undefined, + clusterVersionNumber: string | undefined + ) { + // using ndjson so that each line will be wrapped in json envelope on server side + // see https://github.com/elastic/infra/blob/master/docs/telemetry/telemetry-next-dataflow.md#json-envelope + const ndjson = this.transformDataToNdjson(events); + + try { + const resp = await axios.post(telemetryUrl, ndjson, { + headers: { + 'Content-Type': 'application/x-ndjson', + 'X-Elastic-Cluster-ID': clusterUuid, + 'X-Elastic-Stack-Version': clusterVersionNumber ? clusterVersionNumber : '7.16.0', + }, + }); + this.logger.debug(`Events sent!. Response: ${resp.status} ${JSON.stringify(resp.data)}`); + } catch (err) { + this.logger.warn( + `Error sending events: ${err.response.status} ${JSON.stringify(err.response.data)}` + ); + } + } + + private transformDataToNdjson = (data: unknown[]): string => { + if (data.length !== 0) { + const dataString = data.map((dataItem) => JSON.stringify(dataItem)).join('\n'); + return `${dataString}\n`; + } else { + return ''; + } + }; +} diff --git a/x-pack/plugins/fleet/server/telemetry/types.ts b/x-pack/plugins/fleet/server/telemetry/types.ts new file mode 100644 index 00000000000000..4351546ecdf02f --- /dev/null +++ b/x-pack/plugins/fleet/server/telemetry/types.ts @@ -0,0 +1,15 @@ +/* + * Copyright 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 type { PackagePolicyUpgradeUsage } from '../services/upgrade_usage'; + +export interface FleetTelemetryChannelEvents { + // channel name => event type + 'fleet-upgrades': PackagePolicyUpgradeUsage; +} + +export type FleetTelemetryChannel = keyof FleetTelemetryChannelEvents; diff --git a/x-pack/plugins/fleet/server/types/index.tsx b/x-pack/plugins/fleet/server/types/index.tsx index 5bdd95ef0b874a..174aac03d6a3cf 100644 --- a/x-pack/plugins/fleet/server/types/index.tsx +++ b/x-pack/plugins/fleet/server/types/index.tsx @@ -5,8 +5,7 @@ * 2.0. */ -export { - // Object types +export type { Agent, AgentMetadata, AgentSOAttributes, @@ -51,13 +50,10 @@ export { AssetReference, EsAssetReference, KibanaAssetReference, - ElasticsearchAssetType, RegistryPackage, InstallablePackage, AssetType, Installable, - KibanaAssetType, - KibanaSavedObjectType, AssetParts, AssetsGroupedByServiceByType, CategoryId, @@ -74,13 +70,17 @@ export { InstallResult, GetCategoriesRequest, DataType, - dataTypes, - // Fleet Server types FleetServerEnrollmentAPIKey, FleetServerAgent, FleetServerAgentAction, FleetServerPolicy, } from '../../common'; +export { + ElasticsearchAssetType, + KibanaAssetType, + KibanaSavedObjectType, + dataTypes, +} from '../../common'; export type AgentPolicyUpdateHandler = ( action: 'created' | 'updated' | 'deleted', @@ -96,4 +96,4 @@ export interface BulkActionResult { export * from './models'; export * from './rest_spec'; export * from './extensions'; -export { FleetRequestHandler, FleetRequestHandlerContext } from './request_context'; +export type { FleetRequestHandler, FleetRequestHandlerContext } from './request_context'; diff --git a/x-pack/plugins/global_search/public/index.ts b/x-pack/plugins/global_search/public/index.ts index adb392cc61a5a7..55a16407eb603b 100644 --- a/x-pack/plugins/global_search/public/index.ts +++ b/x-pack/plugins/global_search/public/index.ts @@ -20,7 +20,7 @@ export const plugin: PluginInitializer< GlobalSearchPluginStartDeps > = (context) => new GlobalSearchPlugin(context); -export { +export type { GlobalSearchBatchedResults, GlobalSearchProviderFindOptions, GlobalSearchProviderResult, @@ -29,9 +29,9 @@ export { GlobalSearchFindParams, GlobalSearchProviderFindParams, } from '../common/types'; -export { +export type { GlobalSearchPluginSetup, GlobalSearchPluginStart, GlobalSearchResultProvider, } from './types'; -export { GlobalSearchFindOptions } from './services/types'; +export type { GlobalSearchFindOptions } from './services/types'; diff --git a/x-pack/plugins/global_search/public/services/index.ts b/x-pack/plugins/global_search/public/services/index.ts index 0405a6d8899c8a..b178d3e76f849e 100644 --- a/x-pack/plugins/global_search/public/services/index.ts +++ b/x-pack/plugins/global_search/public/services/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { SearchService, SearchServiceSetup, SearchServiceStart } from './search_service'; -export { GlobalSearchFindOptions } from './types'; +export type { SearchServiceSetup, SearchServiceStart } from './search_service'; +export { SearchService } from './search_service'; +export type { GlobalSearchFindOptions } from './types'; diff --git a/x-pack/plugins/global_search/server/index.ts b/x-pack/plugins/global_search/server/index.ts index 1da9a10fad84ad..d98e10f4043065 100644 --- a/x-pack/plugins/global_search/server/index.ts +++ b/x-pack/plugins/global_search/server/index.ts @@ -22,14 +22,14 @@ export const plugin: PluginInitializer< export { config } from './config'; -export { +export type { GlobalSearchBatchedResults, GlobalSearchProviderFindOptions, GlobalSearchProviderResult, GlobalSearchProviderResultUrl, GlobalSearchResult, } from '../common/types'; -export { +export type { GlobalSearchFindOptions, GlobalSearchProviderContext, GlobalSearchPluginStart, diff --git a/x-pack/plugins/global_search/server/services/index.ts b/x-pack/plugins/global_search/server/services/index.ts index 32ae3805038db0..ac5b326dd5c058 100644 --- a/x-pack/plugins/global_search/server/services/index.ts +++ b/x-pack/plugins/global_search/server/services/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { SearchService, SearchServiceSetup, SearchServiceStart } from './search_service'; +export type { SearchServiceSetup, SearchServiceStart } from './search_service'; +export { SearchService } from './search_service'; diff --git a/x-pack/plugins/global_search_bar/public/search_syntax/index.ts b/x-pack/plugins/global_search_bar/public/search_syntax/index.ts index 87d370d0c9055c..7bf8ee39df1480 100644 --- a/x-pack/plugins/global_search_bar/public/search_syntax/index.ts +++ b/x-pack/plugins/global_search_bar/public/search_syntax/index.ts @@ -6,4 +6,4 @@ */ export { parseSearchParams } from './parse_search_params'; -export { ParsedSearchParams, FilterValues, FilterValueType } from './types'; +export type { ParsedSearchParams, FilterValues, FilterValueType } from './types'; diff --git a/x-pack/plugins/global_search_bar/public/suggestions/index.ts b/x-pack/plugins/global_search_bar/public/suggestions/index.ts index 0c19601f21ebb5..32fcdea79550f1 100644 --- a/x-pack/plugins/global_search_bar/public/suggestions/index.ts +++ b/x-pack/plugins/global_search_bar/public/suggestions/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { getSuggestions, SearchSuggestion } from './get_suggestions'; +export type { SearchSuggestion } from './get_suggestions'; +export { getSuggestions } from './get_suggestions'; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/index.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/index.ts index f31fedfac66813..0439e9d5ec13db 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/index.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/index.ts @@ -19,10 +19,7 @@ export { ConfigurationProvider, useConfiguration } from './configuration_context export { FormErrorsProvider, useFormErrorsContext } from './form_errors_context'; -export { - PhaseTimingsProvider, - usePhaseTimings, - PhaseTimingConfiguration, -} from './phase_timings_context'; +export type { PhaseTimingConfiguration } from './phase_timings_context'; +export { PhaseTimingsProvider, usePhaseTimings } from './phase_timings_context'; export { useGlobalFields, globalFields } from './global_fields_context'; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/lib/index.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/lib/index.ts index 607c62cd3ce8be..5bc887c5a3c73f 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/lib/index.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/lib/index.ts @@ -5,13 +5,15 @@ * 2.0. */ +export type { + AbsoluteTimings, + PhaseAgeInMilliseconds, + RelativePhaseTimingInMs, +} from './absolute_timing_to_relative_timing'; export { calculateRelativeFromAbsoluteMilliseconds, formDataToAbsoluteTimings, getPhaseMinAgeInMilliseconds, - AbsoluteTimings, - PhaseAgeInMilliseconds, - RelativePhaseTimingInMs, } from './absolute_timing_to_relative_timing'; export { getDefaultRepository } from './get_default_repository'; diff --git a/x-pack/plugins/index_lifecycle_management/public/index.ts b/x-pack/plugins/index_lifecycle_management/public/index.ts index cbd23a14a6114e..2b8573902781be 100644 --- a/x-pack/plugins/index_lifecycle_management/public/index.ts +++ b/x-pack/plugins/index_lifecycle_management/public/index.ts @@ -14,4 +14,5 @@ export const plugin = (initializerContext: PluginInitializerContext) => { return new IndexLifecycleManagementPlugin(initializerContext); }; -export { ILM_LOCATOR_ID, IlmLocatorParams } from './locator'; +export type { IlmLocatorParams } from './locator'; +export { ILM_LOCATOR_ID } from './locator'; diff --git a/x-pack/plugins/index_lifecycle_management/public/shared_imports.ts b/x-pack/plugins/index_lifecycle_management/public/shared_imports.ts index e191c4bd799a1c..dab299c476eea9 100644 --- a/x-pack/plugins/index_lifecycle_management/public/shared_imports.ts +++ b/x-pack/plugins/index_lifecycle_management/public/shared_imports.ts @@ -8,10 +8,7 @@ import { AppServicesContext } from './types'; import { useKibana as _useKibana } from '../../../../src/plugins/kibana_react/public'; -export { - useForm, - useFormData, - Form, +export type { FormHook, FieldHook, FormData, @@ -19,11 +16,16 @@ export { FieldConfig, OnFormUpdateArg, ValidationFunc, - getFieldValidityAndErrorMessage, - useFormContext, FormSchema, ValidationConfig, ValidationError, +} from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; +export { + useForm, + useFormData, + Form, + getFieldValidityAndErrorMessage, + useFormContext, UseMultiFields, } from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; diff --git a/x-pack/plugins/index_lifecycle_management/server/shared_imports.ts b/x-pack/plugins/index_lifecycle_management/server/shared_imports.ts index 5c91a0a57ce5e0..4598814d63c029 100644 --- a/x-pack/plugins/index_lifecycle_management/server/shared_imports.ts +++ b/x-pack/plugins/index_lifecycle_management/server/shared_imports.ts @@ -6,4 +6,4 @@ */ export { handleEsError } from '../../../../src/plugins/es_ui_shared/server'; -export { ILicense, LicenseType } from '../../licensing/common/types'; +export type { ILicense, LicenseType } from '../../licensing/common/types'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts index 997f234cf30906..79df6e8e9f20c1 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts @@ -7,7 +7,8 @@ import './mocks'; -export { nextTick, getRandomString, findTestSubject, TestBed } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test/jest'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; export { setupEnvironment, @@ -16,4 +17,4 @@ export { kibanaVersion, } from './setup_environment'; -export { TestSubjects } from './test_subjects'; +export type { TestSubjects } from './test_subjects'; diff --git a/x-pack/plugins/index_management/common/types/index.ts b/x-pack/plugins/index_management/common/types/index.ts index 9908e9598412bc..0cc514b47024f0 100644 --- a/x-pack/plugins/index_management/common/types/index.ts +++ b/x-pack/plugins/index_management/common/types/index.ts @@ -13,6 +13,6 @@ export * from './mappings'; export * from './templates'; -export { DataStreamFromEs, Health, DataStream, DataStreamIndex } from './data_streams'; +export type { DataStreamFromEs, Health, DataStream, DataStreamIndex } from './data_streams'; export * from './component_templates'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_details/index.ts b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_details/index.ts index 2545c47e47c22a..fd65eb04016081 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_details/index.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_details/index.ts @@ -5,8 +5,8 @@ * 2.0. */ +export type { Props as ComponentTemplateDetailsProps } from './component_template_details'; export { ComponentTemplateDetailsFlyoutContent, defaultFlyoutProps, - Props as ComponentTemplateDetailsProps, } from './component_template_details'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/shared_imports.ts b/x-pack/plugins/index_management/public/application/components/component_templates/shared_imports.ts index 15528f5b4e8e5b..2f5b98e59bb22a 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/shared_imports.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/shared_imports.ts @@ -5,11 +5,14 @@ * 2.0. */ -export { +export type { UseRequestConfig, UseRequestResponse, SendRequestConfig, SendRequestResponse, + Error, +} from '../../../../../../../src/plugins/es_ui_shared/public'; +export { sendRequest, useRequest, WithPrivileges, @@ -18,7 +21,6 @@ export { SectionLoading, PageLoading, PageError, - Error, useAuthorizationContext, NotAuthorizedSection, Forms, @@ -32,11 +34,13 @@ export { fieldFormatters, } from '../../../../../../../src/plugins/es_ui_shared/static/forms/helpers'; -export { +export type { FormSchema, + FieldConfig, +} from '../../../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; +export { FIELD_TYPES, VALIDATION_TYPES, - FieldConfig, useForm, Form, getUseField, @@ -50,17 +54,17 @@ export { export { isJSON } from '../../../../../../../src/plugins/es_ui_shared/static/validators/string'; +export type { CommonWizardSteps } from '../shared'; export { TabMappings, TabSettings, TabAliases, - CommonWizardSteps, StepSettingsContainer, StepMappingsContainer, StepAliasesContainer, } from '../shared'; -export { +export type { ComponentTemplateSerialized, ComponentTemplateDeserialized, ComponentTemplateListItem, diff --git a/x-pack/plugins/index_management/public/application/components/index.ts b/x-pack/plugins/index_management/public/application/components/index.ts index eeba6e16b543c5..fe3e41c34a8707 100644 --- a/x-pack/plugins/index_management/public/application/components/index.ts +++ b/x-pack/plugins/index_management/public/application/components/index.ts @@ -5,7 +5,8 @@ * 2.0. */ -export { SectionError, Error } from './section_error'; +export type { Error } from './section_error'; +export { SectionError } from './section_error'; export { NoMatch } from './no_match'; export { TemplateDeleteModal } from './template_delete_modal'; export { TemplateForm } from './template_form'; diff --git a/x-pack/plugins/index_management/public/application/components/index_templates/index.ts b/x-pack/plugins/index_management/public/application/components/index_templates/index.ts index d460175543ac53..f51fe3f5d6fe30 100644 --- a/x-pack/plugins/index_management/public/application/components/index_templates/index.ts +++ b/x-pack/plugins/index_management/public/application/components/index_templates/index.ts @@ -5,12 +5,11 @@ * 2.0. */ +export type { SimulateTemplateProps, SimulateTemplateFilters } from './simulate_template'; export { SimulateTemplateFlyoutContent, simulateTemplateFlyoutProps, - SimulateTemplateProps, SimulateTemplate, - SimulateTemplateFilters, } from './simulate_template'; export { LegacyIndexTemplatesDeprecation } from './legacy_index_template_deprecation'; diff --git a/x-pack/plugins/index_management/public/application/components/index_templates/simulate_template/index.ts b/x-pack/plugins/index_management/public/application/components/index_templates/simulate_template/index.ts index 91273dc82f902f..2837eb8f1f40cf 100644 --- a/x-pack/plugins/index_management/public/application/components/index_templates/simulate_template/index.ts +++ b/x-pack/plugins/index_management/public/application/components/index_templates/simulate_template/index.ts @@ -5,10 +5,11 @@ * 2.0. */ +export type { Props as SimulateTemplateProps } from './simulate_template_flyout'; export { SimulateTemplateFlyoutContent, defaultFlyoutProps as simulateTemplateFlyoutProps, - Props as SimulateTemplateProps, } from './simulate_template_flyout'; -export { SimulateTemplate, Filters as SimulateTemplateFilters } from './simulate_template'; +export type { Filters as SimulateTemplateFilters } from './simulate_template'; +export { SimulateTemplate } from './simulate_template'; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts index fbe24557ae6a16..d436492756659d 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts @@ -12,11 +12,12 @@ import { getMappingsEditorDataFactory, } from './mappings_editor.helpers'; -export { nextTick, getRandomString, findTestSubject, TestBed } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test/jest'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; export { kibanaVersion } from './setup_environment'; export const componentHelpers = { mappingsEditor: { setup: mappingsEditorSetup, getMappingsEditorDataFactory }, }; -export { MappingsEditorTestBed, DomFields }; +export type { MappingsEditorTestBed, DomFields }; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/index.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/index.ts index a171959daf2cbe..4b3e2657ba6ac7 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/index.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/index.ts @@ -5,11 +5,8 @@ * 2.0. */ -export { - EditFieldContainer, - defaultFlyoutProps, - Props as EditFieldContainerProps, -} from './edit_field_container'; +export type { Props as EditFieldContainerProps } from './edit_field_container'; +export { EditFieldContainer, defaultFlyoutProps } from './edit_field_container'; export * from './basic_parameters_section'; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/index.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/index.ts index 9692e5d6c22b02..2d284297041e79 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/index.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/index.ts @@ -13,4 +13,4 @@ export { LoadMappingsFromJsonButton, LoadMappingsProvider } from './components/l export { MappingsEditorProvider } from './mappings_editor_context'; -export { IndexSettings, OnUpdateHandler } from './types'; +export type { IndexSettings, OnUpdateHandler } from './types'; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/shared_imports.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/shared_imports.ts index 4ea8412d4ffe3d..de9c1985239f5a 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/shared_imports.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/shared_imports.ts @@ -5,26 +5,28 @@ * 2.0. */ -export { - FIELD_TYPES, +export type { FieldConfig, FieldHook, - Form, - FormDataProvider, FormHook, FormSchema, - getUseField, OnFormUpdateArg, SerializerFunc, + ArrayItem, + ValidationFunc, + ValidationFuncArg, +} from '../../../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; +export { + FIELD_TYPES, + Form, + FormDataProvider, + getUseField, UseField, UseArray, - ArrayItem, useForm, useFormContext, UseMultiFields, VALIDATION_TYPES, - ValidationFunc, - ValidationFuncArg, } from '../../../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; export { @@ -47,20 +49,17 @@ export { fieldValidators, } from '../../../../../../../src/plugins/es_ui_shared/static/forms/helpers'; -export { - JsonEditor, - OnJsonEditorUpdateHandler, - GlobalFlyout, -} from '../../../../../../../src/plugins/es_ui_shared/public'; +export type { OnJsonEditorUpdateHandler } from '../../../../../../../src/plugins/es_ui_shared/public'; +export { JsonEditor, GlobalFlyout } from '../../../../../../../src/plugins/es_ui_shared/public'; export { documentationService } from '../../services/documentation'; -export { +export type { RuntimeField, - RuntimeFieldEditorFlyoutContent, RuntimeFieldEditorFlyoutContentProps, } from '../../../../../runtime_fields/public'; +export { RuntimeFieldEditorFlyoutContent } from '../../../../../runtime_fields/public'; export { createKibanaReactContext } from '../../../../../../../src/plugins/kibana_react/public'; -export { DocLinksStart } from '../../../../../../../src/core/public'; +export type { DocLinksStart } from '../../../../../../../src/core/public'; diff --git a/x-pack/plugins/index_management/public/application/components/shared/components/index.ts b/x-pack/plugins/index_management/public/application/components/shared/components/index.ts index 6011bd6aed4f99..3c564c0caf6e37 100644 --- a/x-pack/plugins/index_management/public/application/components/shared/components/index.ts +++ b/x-pack/plugins/index_management/public/application/components/shared/components/index.ts @@ -7,11 +7,7 @@ export { TabAliases, TabMappings, TabSettings } from './details_panel'; -export { - StepAliasesContainer, - StepMappingsContainer, - StepSettingsContainer, - CommonWizardSteps, -} from './wizard_steps'; +export type { CommonWizardSteps } from './wizard_steps'; +export { StepAliasesContainer, StepMappingsContainer, StepSettingsContainer } from './wizard_steps'; export { TemplateContentIndicator } from './template_content_indicator'; diff --git a/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/index.ts b/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/index.ts index 224c753b823048..2197e5140fc982 100644 --- a/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/index.ts +++ b/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/index.ts @@ -9,4 +9,4 @@ export { StepAliasesContainer } from './step_aliases_container'; export { StepMappingsContainer } from './step_mappings_container'; export { StepSettingsContainer } from './step_settings_container'; -export { CommonWizardSteps } from './types'; +export type { CommonWizardSteps } from './types'; diff --git a/x-pack/plugins/index_management/public/application/components/shared/index.ts b/x-pack/plugins/index_management/public/application/components/shared/index.ts index 96b4131f8282db..06899e202ef82a 100644 --- a/x-pack/plugins/index_management/public/application/components/shared/index.ts +++ b/x-pack/plugins/index_management/public/application/components/shared/index.ts @@ -5,6 +5,7 @@ * 2.0. */ +export type { CommonWizardSteps } from './components'; export { TabAliases, TabMappings, @@ -12,6 +13,5 @@ export { StepAliasesContainer, StepMappingsContainer, StepSettingsContainer, - CommonWizardSteps, TemplateContentIndicator, } from './components'; diff --git a/x-pack/plugins/index_management/public/application/index.tsx b/x-pack/plugins/index_management/public/application/index.tsx index b7a4bd21351473..854826681adaef 100644 --- a/x-pack/plugins/index_management/public/application/index.tsx +++ b/x-pack/plugins/index_management/public/application/index.tsx @@ -93,4 +93,5 @@ const useKibana = () => { return useKibanaReactPlugin(); }; -export { AppDependencies, useKibana }; +export type { AppDependencies }; +export { useKibana }; diff --git a/x-pack/plugins/index_management/public/application/sections/home/components/index.ts b/x-pack/plugins/index_management/public/application/sections/home/components/index.ts index df1218f6f0686a..8cd35ead5d308e 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/components/index.ts +++ b/x-pack/plugins/index_management/public/application/sections/home/components/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { FilterListButton, Filters } from './filter_list_button'; +export type { Filters } from './filter_list_button'; +export { FilterListButton } from './filter_list_button'; diff --git a/x-pack/plugins/index_management/public/index.ts b/x-pack/plugins/index_management/public/index.ts index f9ccc788a36c09..01635ed2a9b8f5 100644 --- a/x-pack/plugins/index_management/public/index.ts +++ b/x-pack/plugins/index_management/public/index.ts @@ -14,7 +14,7 @@ export const plugin = (ctx: PluginInitializerContext) => { return new IndexMgmtUIPlugin(ctx); }; -export { IndexManagementPluginSetup } from './types'; +export type { IndexManagementPluginSetup } from './types'; export { getIndexListUri, getTemplateDetailsLink } from './application/services/routing'; diff --git a/x-pack/plugins/index_management/public/services/index.ts b/x-pack/plugins/index_management/public/services/index.ts index fe91e700236ccd..f32787a427b891 100644 --- a/x-pack/plugins/index_management/public/services/index.ts +++ b/x-pack/plugins/index_management/public/services/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { ExtensionsService, ExtensionsSetup } from './extensions_service'; +export type { ExtensionsSetup } from './extensions_service'; +export { ExtensionsService } from './extensions_service'; diff --git a/x-pack/plugins/index_management/public/shared_imports.ts b/x-pack/plugins/index_management/public/shared_imports.ts index 4e1c4207959042..7fadcd9e71502c 100644 --- a/x-pack/plugins/index_management/public/shared_imports.ts +++ b/x-pack/plugins/index_management/public/shared_imports.ts @@ -7,11 +7,14 @@ export { APP_WRAPPER_CLASS } from '../../../../src/core/public'; -export { +export type { SendRequestConfig, SendRequestResponse, UseRequestConfig, UseRequestResponse, + Error, +} from '../../../../src/plugins/es_ui_shared/public'; +export { sendRequest, useRequest, Forms, @@ -20,16 +23,17 @@ export { attemptToURIDecode, PageLoading, PageError, - Error, SectionLoading, EuiCodeEditor, } from '../../../../src/plugins/es_ui_shared/public'; -export { +export type { FormSchema, + FieldConfig, +} from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; +export { FIELD_TYPES, VALIDATION_TYPES, - FieldConfig, useForm, useFormData, Form, diff --git a/x-pack/plugins/index_management/server/index.ts b/x-pack/plugins/index_management/server/index.ts index 29291116e44fc2..8eb882d29de2df 100644 --- a/x-pack/plugins/index_management/server/index.ts +++ b/x-pack/plugins/index_management/server/index.ts @@ -14,7 +14,7 @@ export { config } from './config'; export const plugin = (context: PluginInitializerContext) => new IndexMgmtServerPlugin(context); /** @public */ -export { Dependencies } from './types'; -export { IndexManagementPluginSetup } from './plugin'; -export { Index, LegacyTemplateSerialized } from '../common'; -export { IndexManagementConfig } from './config'; +export type { Dependencies } from './types'; +export type { IndexManagementPluginSetup } from './plugin'; +export type { Index, LegacyTemplateSerialized } from '../common'; +export type { IndexManagementConfig } from './config'; diff --git a/x-pack/plugins/index_management/server/services/index.ts b/x-pack/plugins/index_management/server/services/index.ts index 576d7c46fa086a..bd62f2df80cc82 100644 --- a/x-pack/plugins/index_management/server/services/index.ts +++ b/x-pack/plugins/index_management/server/services/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { IndexDataEnricher, Enricher } from './index_data_enricher'; +export type { Enricher } from './index_data_enricher'; +export { IndexDataEnricher } from './index_data_enricher'; diff --git a/x-pack/plugins/infra/common/log_search_result/index.ts b/x-pack/plugins/infra/common/log_search_result/index.ts index d1b2672fbfbaf8..592b23dfc70ad7 100644 --- a/x-pack/plugins/infra/common/log_search_result/index.ts +++ b/x-pack/plugins/infra/common/log_search_result/index.ts @@ -5,9 +5,9 @@ * 2.0. */ +export type { SearchResult } from './log_search_result'; export { getSearchResultIndexBeforeTime, getSearchResultIndexAfterTime, getSearchResultKey, - SearchResult, } from './log_search_result'; diff --git a/x-pack/plugins/infra/common/log_search_summary/index.ts b/x-pack/plugins/infra/common/log_search_summary/index.ts index feb64dee7d31a9..32652753f7799a 100644 --- a/x-pack/plugins/infra/common/log_search_summary/index.ts +++ b/x-pack/plugins/infra/common/log_search_summary/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { SearchSummaryBucket } from './log_search_summary'; +export type { SearchSummaryBucket } from './log_search_summary'; diff --git a/x-pack/plugins/infra/common/typed_json.ts b/x-pack/plugins/infra/common/typed_json.ts index fee846b437a7ad..95d5d4274c3b63 100644 --- a/x-pack/plugins/infra/common/typed_json.ts +++ b/x-pack/plugins/infra/common/typed_json.ts @@ -8,7 +8,7 @@ import * as rt from 'io-ts'; import { JsonArray, JsonObject, JsonValue } from '@kbn/utility-types'; -export { JsonArray, JsonObject, JsonValue }; +export type { JsonArray, JsonObject, JsonValue }; export const jsonScalarRT = rt.union([rt.null, rt.boolean, rt.number, rt.string]); export type JsonScalar = rt.TypeOf; diff --git a/x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx index b78a63e61e5244..67b3fa164d90cb 100644 --- a/x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx @@ -9,7 +9,8 @@ import * as rt from 'io-ts'; import { ValidationIndicesError, validationIndicesErrorRT } from '../../../../../common/http_api'; import { DatasetFilter } from '../../../../../common/log_analysis'; -export { ValidationIndicesError, validationIndicesErrorRT }; +export type { ValidationIndicesError }; +export { validationIndicesErrorRT }; export const timeRangeValidationErrorRT = rt.strict({ error: rt.literal('INVALID_TIME_RANGE'), diff --git a/x-pack/plugins/infra/public/components/logging/log_text_stream/index.ts b/x-pack/plugins/infra/public/components/logging/log_text_stream/index.ts index c3716d8c97ae19..dbd5bd49d02407 100644 --- a/x-pack/plugins/infra/public/components/logging/log_text_stream/index.ts +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/index.ts @@ -5,12 +5,8 @@ * 2.0. */ -export { - LogEntryColumn, - LogEntryColumnWidths, - useColumnWidths, - iconColumnId, -} from './log_entry_column'; +export type { LogEntryColumnWidths } from './log_entry_column'; +export { LogEntryColumn, useColumnWidths, iconColumnId } from './log_entry_column'; export { LogEntryFieldColumn } from './log_entry_field_column'; export { LogEntryMessageColumn } from './log_entry_message_column'; export { LogEntryRowWrapper } from './log_entry_row'; diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/get_latest_categories_datasets_stats.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/get_latest_categories_datasets_stats.ts index bfabcdb4af7c1b..d715fb9f45194a 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/get_latest_categories_datasets_stats.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/get_latest_categories_datasets_stats.ts @@ -15,7 +15,7 @@ import { } from '../../../../../common/http_api'; import { decodeOrThrow } from '../../../../../common/runtime_types'; -export { LogEntryCategoriesDatasetStats }; +export type { LogEntryCategoriesDatasetStats }; export const callGetLatestCategoriesDatasetsStatsAPI = async ( { diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/index.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/index.ts index 40ac39e3fa22a4..5cccbdb78e46ee 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/index.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/index.ts @@ -14,4 +14,4 @@ export * from './log_analysis_module_status'; export * from './log_analysis_module_types'; export * from './log_analysis_setup_state'; -export { JobModelSizeStats, JobSummary } from './api/ml_get_jobs_summary_api'; +export type { JobModelSizeStats, JobSummary } from './api/ml_get_jobs_summary_api'; diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts index 4ff8c0c3c08e07..c8ce9a7b0127bb 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts @@ -17,7 +17,7 @@ import { FetchJobStatusResponsePayload } from './api/ml_get_jobs_summary_api'; import { GetMlModuleResponsePayload } from './api/ml_get_module'; import { SetupMlModuleResponsePayload } from './api/ml_setup_module_api'; -export { JobModelSizeStats, JobSummary } from './api/ml_get_jobs_summary_api'; +export type { JobModelSizeStats, JobSummary } from './api/ml_get_jobs_summary_api'; export interface ModuleDescriptor { moduleId: string; diff --git a/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts b/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts index 8f744a1d6df6d0..54f3f70b98a4bd 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts @@ -26,14 +26,14 @@ import { callFetchLogSourceConfigurationAPI } from './api/fetch_log_source_confi import { callFetchLogSourceStatusAPI } from './api/fetch_log_source_status'; import { callPatchLogSourceConfigurationAPI } from './api/patch_log_source_configuration'; -export { +export type { LogIndexField, LogSourceConfiguration, LogSourceConfigurationProperties, LogSourceConfigurationPropertiesPatch, LogSourceStatus, - ResolveLogSourceConfigurationError, }; +export { ResolveLogSourceConfigurationError }; export const useLogSource = ({ sourceId, diff --git a/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts b/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts index 5a5272f7830530..ca655f35f74668 100644 --- a/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts +++ b/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts @@ -15,7 +15,7 @@ import { FetchJobStatusResponsePayload } from './api/ml_get_jobs_summary_api'; import { GetMlModuleResponsePayload } from './api/ml_get_module'; import { SetupMlModuleResponsePayload } from './api/ml_setup_module_api'; -export { JobModelSizeStats, JobSummary } from './api/ml_get_jobs_summary_api'; +export type { JobModelSizeStats, JobSummary } from './api/ml_get_jobs_summary_api'; export interface SetUpModuleArgs { start?: number | undefined; diff --git a/x-pack/plugins/infra/public/utils/loading_state/index.ts b/x-pack/plugins/infra/public/utils/loading_state/index.ts index f0f42f1afa6a4a..f93d0638b33669 100644 --- a/x-pack/plugins/infra/public/utils/loading_state/index.ts +++ b/x-pack/plugins/infra/public/utils/loading_state/index.ts @@ -5,18 +5,21 @@ * 2.0. */ -export { initialLoadingState, LoadingState } from './loading_state'; +export type { LoadingState } from './loading_state'; +export { initialLoadingState } from './loading_state'; -export { isManualLoadingPolicy, isIntervalLoadingPolicy, LoadingPolicy } from './loading_policy'; +export type { LoadingPolicy } from './loading_policy'; +export { isManualLoadingPolicy, isIntervalLoadingPolicy } from './loading_policy'; +export type { LoadingProgress } from './loading_progress'; export { createRunningProgressReducer, createIdleProgressReducer, isIdleLoadingProgress, isRunningLoadingProgress, - LoadingProgress, } from './loading_progress'; +export type { LoadingResult } from './loading_result'; export { createFailureResult, createFailureResultReducer, @@ -27,5 +30,4 @@ export { isFailureLoadingResult, isSuccessLoadingResult, isUninitializedLoadingResult, - LoadingResult, } from './loading_result'; diff --git a/x-pack/plugins/infra/server/index.ts b/x-pack/plugins/infra/server/index.ts index a25bba48d673ec..93be23356dfc30 100644 --- a/x-pack/plugins/infra/server/index.ts +++ b/x-pack/plugins/infra/server/index.ts @@ -8,8 +8,9 @@ import { PluginInitializerContext } from 'src/core/server'; import { config, InfraConfig, InfraServerPlugin, InfraPluginSetup } from './plugin'; -export { config, InfraConfig, InfraPluginSetup }; -export { InfraRequestHandlerContext } from './types'; +export type { InfraConfig, InfraPluginSetup }; +export { config }; +export type { InfraRequestHandlerContext } from './types'; export function plugin(context: PluginInitializerContext) { return new InfraServerPlugin(context); diff --git a/x-pack/plugins/infra/server/lib/infra_ml/index.ts b/x-pack/plugins/infra/server/lib/infra_ml/index.ts index 82093b1a359d0a..853ef8d0d60b22 100644 --- a/x-pack/plugins/infra/server/lib/infra_ml/index.ts +++ b/x-pack/plugins/infra/server/lib/infra_ml/index.ts @@ -8,4 +8,4 @@ export * from './errors'; export * from './metrics_hosts_anomalies'; export * from './metrics_k8s_anomalies'; -export { MappedAnomalyHit } from './common'; +export type { MappedAnomalyHit } from './common'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/index.ts index 5c59e6c0e24490..0d63e9cd2462bf 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/index.ts @@ -5,9 +5,11 @@ * 2.0. */ -export { ProcessorForm, ProcessorFormOnSubmitArg, OnSubmitHandler } from './processor_form'; +export type { ProcessorFormOnSubmitArg, OnSubmitHandler } from './processor_form'; +export { ProcessorForm } from './processor_form'; -export { ProcessorsTree, ProcessorInfo, OnActionHandler } from './processors_tree'; +export type { ProcessorInfo, OnActionHandler } from './processors_tree'; +export { ProcessorsTree } from './processors_tree'; export { PipelineProcessorsEditor } from './pipeline_processors_editor'; @@ -15,11 +17,13 @@ export { PipelineProcessorsEditorItem } from './pipeline_processors_editor_item' export { ProcessorRemoveModal } from './processor_remove_modal'; -export { OnDoneLoadJsonHandler, LoadFromJsonButton } from './load_from_json'; +export type { OnDoneLoadJsonHandler } from './load_from_json'; +export { LoadFromJsonButton } from './load_from_json'; export { TestPipelineActions } from './test_pipeline'; -export { PipelineProcessorsItemTooltip, Position } from './pipeline_processors_editor_item_tooltip'; +export type { Position } from './pipeline_processors_editor_item_tooltip'; +export { PipelineProcessorsItemTooltip } from './pipeline_processors_editor_item_tooltip'; export { ProcessorsEmptyPrompt } from './processors_empty_prompt'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/load_from_json/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/load_from_json/index.ts index 2e89e4b907f075..1d8fd204b4583a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/load_from_json/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/load_from_json/index.ts @@ -6,4 +6,4 @@ */ export { LoadFromJsonButton } from './button'; -export { OnDoneLoadJsonHandler } from './modal_provider'; +export type { OnDoneLoadJsonHandler } from './modal_provider'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item/index.ts index a88f51cda2ebd4..8b029747c1cbff 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item/index.ts @@ -7,4 +7,4 @@ export { PipelineProcessorsEditorItem } from './pipeline_processors_editor_item.container'; -export { Handlers } from './types'; +export type { Handlers } from './types'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item_tooltip/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item_tooltip/index.ts index e51d286a2b0134..f8967a8945b2ae 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item_tooltip/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/pipeline_processors_editor_item_tooltip/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { PipelineProcessorsItemTooltip, Position } from './pipeline_processors_editor_item_tooltip'; +export type { Position } from './pipeline_processors_editor_item_tooltip'; +export { PipelineProcessorsItemTooltip } from './pipeline_processors_editor_item_tooltip'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/index.ts index 75c0e4ec7cccd7..1418c919cb6b1a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/index.ts @@ -5,8 +5,5 @@ * 2.0. */ -export { - ProcessorFormContainer as ProcessorForm, - ProcessorFormOnSubmitArg, - OnSubmitHandler, -} from './processor_form.container'; +export type { ProcessorFormOnSubmitArg, OnSubmitHandler } from './processor_form.container'; +export { ProcessorFormContainer as ProcessorForm } from './processor_form.container'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/index.ts index 1a2422b40d0b01..e3a0fae36e5773 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/index.ts @@ -45,4 +45,4 @@ export { UrlDecode } from './url_decode'; export { UserAgent } from './user_agent'; export { UriParts } from './uri_parts'; -export { FormFieldsComponent } from './shared'; +export type { FormFieldsComponent } from './shared'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processors_tree/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processors_tree/index.ts index e8ac8bce8c4c83..3cb4f1f0f3505d 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processors_tree/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processors_tree/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { ProcessorsTree, OnActionHandler, ProcessorInfo } from './processors_tree'; +export type { OnActionHandler, ProcessorInfo } from './processors_tree'; +export { ProcessorsTree } from './processors_tree'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/index.ts index d62ebab7c650c1..8d71908bca5e4b 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/index.ts @@ -5,10 +5,7 @@ * 2.0. */ -export { - getProcessorDescriptor, - mapProcessorTypeToDescriptor, - ProcessorType, -} from './map_processor_type_to_form'; +export type { ProcessorType } from './map_processor_type_to_form'; +export { getProcessorDescriptor, mapProcessorTypeToDescriptor } from './map_processor_type_to_form'; export { ErrorIcon, ErrorIgnoredIcon, SkippedIcon } from './status_icons'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/test_pipeline/test_pipeline_tabs/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/test_pipeline/test_pipeline_tabs/index.ts index 725f65f28ab917..82ba99a438522c 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/test_pipeline/test_pipeline_tabs/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/test_pipeline/test_pipeline_tabs/index.ts @@ -5,7 +5,8 @@ * 2.0. */ -export { Tabs, TestPipelineFlyoutTab } from './test_pipeline_tabs'; +export type { TestPipelineFlyoutTab } from './test_pipeline_tabs'; +export { Tabs } from './test_pipeline_tabs'; export { DocumentsTab } from './tab_documents'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/index.ts index 261393e35a2bb0..6a83b29dc0d065 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/index.ts @@ -7,15 +7,11 @@ export { ProcessorsEditorContextProvider } from './context'; -export { - TestPipelineContextProvider, - useTestPipelineContext, - TestPipelineData, - TestPipelineContext, -} from './test_pipeline_context'; +export type { TestPipelineData, TestPipelineContext } from './test_pipeline_context'; +export { TestPipelineContextProvider, useTestPipelineContext } from './test_pipeline_context'; +export type { Props } from './processors_context'; export { PipelineProcessorsContextProvider, usePipelineProcessorsContext, - Props, } from './processors_context'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/index.ts index 3149abeb8e1e67..a3996721ed748c 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/index.ts @@ -5,12 +5,13 @@ * 2.0. */ -export { Props, ProcessorsEditorContextProvider } from './context'; +export type { Props } from './context'; +export { ProcessorsEditorContextProvider } from './context'; -export { OnUpdateHandlerArg, OnUpdateHandler } from './types'; +export type { OnUpdateHandlerArg, OnUpdateHandler } from './types'; -export { SerializeResult } from './serialize'; +export type { SerializeResult } from './serialize'; -export { OnDoneLoadJsonHandler } from './components'; +export type { OnDoneLoadJsonHandler } from './components'; export { PipelineEditor } from './pipeline_editor'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/processors_reducer/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/processors_reducer/index.ts index 664e82e81a12c7..59753e5cfdbbad 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/processors_reducer/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/processors_reducer/index.ts @@ -5,13 +5,8 @@ * 2.0. */ -export { - State, - reducer, - useProcessorsState, - ProcessorsDispatch, - Action, -} from './processors_reducer'; +export type { State, ProcessorsDispatch, Action } from './processors_reducer'; +export { reducer, useProcessorsState } from './processors_reducer'; export * from './constants'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/types.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/types.ts index efb2c4a42c7631..fba905d8e26bf3 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/types.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/types.ts @@ -31,7 +31,7 @@ export interface ProcessorInternal { onFailure?: ProcessorInternal[]; } -export { OnFormUpdateArg }; +export type { OnFormUpdateArg }; export interface FormValidityState { validate: OnFormUpdateArg['validate']; diff --git a/x-pack/plugins/ingest_pipelines/public/shared_imports.ts b/x-pack/plugins/ingest_pipelines/public/shared_imports.ts index 29be11430bf646..bcc0060c1e5d44 100644 --- a/x-pack/plugins/ingest_pipelines/public/shared_imports.ts +++ b/x-pack/plugins/ingest_pipelines/public/shared_imports.ts @@ -10,51 +10,55 @@ import { AppServices } from './application'; export { CodeEditor }; +export type { + Error, + SendRequestConfig, + SendRequestResponse, + UseRequestConfig, + OnJsonEditorUpdateHandler, +} from '../../../../src/plugins/es_ui_shared/public/'; export { AuthorizationProvider, - Error, NotAuthorizedSection, SectionError, SectionLoading, sendRequest, - SendRequestConfig, - SendRequestResponse, useAuthorizationContext, useRequest, - UseRequestConfig, WithPrivileges, XJson, JsonEditor, - OnJsonEditorUpdateHandler, attemptToURIDecode, } from '../../../../src/plugins/es_ui_shared/public/'; -export { +export type { FormSchema, - FIELD_TYPES, FormConfig, - useForm, - Form, - getUseField, ValidationFuncArg, FormData, - UseField, - UseArray, ArrayItem, FormHook, - useFormContext, - UseMultiFields, - FormDataProvider, OnFormUpdateArg, FieldConfig, FieldHook, - getFieldValidityAndErrorMessage, ValidationFunc, ValidationConfig, - useFormData, FormOptions, SerializerFunc, } from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; +export { + FIELD_TYPES, + useForm, + Form, + getUseField, + UseField, + UseArray, + useFormContext, + UseMultiFields, + FormDataProvider, + getFieldValidityAndErrorMessage, + useFormData, +} from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; export { fieldFormatters, diff --git a/x-pack/plugins/lens/public/index.ts b/x-pack/plugins/lens/public/index.ts index 9be07a4f44dcdf..fb7cefb22d1753 100644 --- a/x-pack/plugins/lens/public/index.ts +++ b/x-pack/plugins/lens/public/index.ts @@ -58,6 +58,6 @@ export type { } from './indexpattern_datasource/types'; export type { LensEmbeddableInput } from './embeddable'; -export { LensPublicStart } from './plugin'; +export type { LensPublicStart } from './plugin'; export const plugin = () => new LensPlugin(); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx index d90dc83bc1fef5..bdcc0e621cc368 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx @@ -58,7 +58,8 @@ import { GeoFieldWorkspacePanel } from '../editor_frame_service/editor_frame/wor import { DraggingIdentifier } from '../drag_drop'; import { getStateTimeShiftWarningMessages } from './time_shift_utils'; -export { OperationType, IndexPatternColumn, deleteColumn } from './operations'; +export type { OperationType, IndexPatternColumn } from './operations'; +export { deleteColumn } from './operations'; export function columnToOperation(column: IndexPatternColumn, uniqueLabel?: string): Operation { const { dataType, label, isBucketed, scale } = column; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.test.tsx index 9315b61adcc543..5df02482a27456 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.test.tsx @@ -1952,6 +1952,64 @@ describe('IndexPattern Data Source suggestions', () => { suggestions.forEach((suggestion) => expect(suggestion.table.columns.length).toBe(1)); }); + it("should not propose an over time suggestion if there's a top values aggregation with an high size", () => { + const initialState = testInitialState(); + (initialState.layers.first.columns.col1 as { params: { size: number } }).params!.size = 6; + const suggestions = getDatasourceSuggestionsFromCurrentState({ + ...initialState, + indexPatterns: { 1: { ...initialState.indexPatterns['1'], timeFieldName: undefined } }, + }); + suggestions.forEach((suggestion) => expect(suggestion.table.columns.length).toBe(1)); + }); + + it('should not propose an over time suggestion if there are multiple bucket dimensions', () => { + const initialState = testInitialState(); + const state: IndexPatternPrivateState = { + ...initialState, + layers: { + first: { + indexPatternId: '1', + columnOrder: ['col1', 'col2', 'col3'], + columns: { + ...initialState.layers.first.columns, + col2: { + label: 'My Op', + customLabel: true, + dataType: 'number', + isBucketed: false, + operationType: 'average', + sourceField: 'bytes', + scale: 'ratio', + }, + col3: { + label: 'My Op', + customLabel: true, + dataType: 'string', + isBucketed: true, + + // Private + operationType: 'terms', + sourceField: 'dest', + params: { + size: 5, + orderBy: { type: 'alphabetical' }, + orderDirection: 'asc', + }, + }, + }, + }, + }, + }; + const suggestions = getDatasourceSuggestionsFromCurrentState({ + ...state, + indexPatterns: { 1: { ...state.indexPatterns['1'], timeFieldName: undefined } }, + }); + suggestions.forEach((suggestion) => { + const firstBucket = suggestion.table.columns.find(({ columnId }) => columnId === 'col1'); + expect(firstBucket?.operation).not.toBe('date'); + }); + }); + it('returns simplified versions of table with more than 2 columns', () => { const initialState = testInitialState(); const fields = [ diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts index d3c292b7e019be..8b940ec1f05af7 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts @@ -21,6 +21,7 @@ import { getExistingColumnGroups, isReferenced, getReferencedColumnIds, + hasTermsWithManyBuckets, } from './operations'; import { hasField } from './utils'; import type { @@ -424,7 +425,7 @@ export function getDatasourceSuggestionsFromCurrentState( ); if (!references.length && metrics.length && buckets.length === 0) { - if (timeField) { + if (timeField && buckets.length < 1 && !hasTermsWithManyBuckets(layer)) { // suggest current metric over time if there is a default time field suggestions.push(createSuggestionWithDefaultDateHistogram(state, layerId, timeField)); } @@ -436,7 +437,13 @@ export function getDatasourceSuggestionsFromCurrentState( // base range intervals are of number dataType. // Custom range/intervals have a different dataType so they still receive the Over Time suggestion - if (!timeDimension && timeField && !hasNumericDimension) { + if ( + !timeDimension && + timeField && + buckets.length < 2 && + !hasNumericDimension && + !hasTermsWithManyBuckets(layer) + ) { // suggest current configuration over time if there is a default time field // and no time dimension yet suggestions.push(createSuggestionWithDefaultDateHistogram(state, layerId, timeField)); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/index.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/index.ts index a7741bc60d6469..1ffbdea00b7758 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/index.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/index.ts @@ -5,17 +5,23 @@ * 2.0. */ -export { counterRateOperation, CounterRateIndexPatternColumn } from './counter_rate'; -export { cumulativeSumOperation, CumulativeSumIndexPatternColumn } from './cumulative_sum'; -export { derivativeOperation, DerivativeIndexPatternColumn } from './differences'; -export { movingAverageOperation, MovingAverageIndexPatternColumn } from './moving_average'; +export type { CounterRateIndexPatternColumn } from './counter_rate'; +export { counterRateOperation } from './counter_rate'; +export type { CumulativeSumIndexPatternColumn } from './cumulative_sum'; +export { cumulativeSumOperation } from './cumulative_sum'; +export type { DerivativeIndexPatternColumn } from './differences'; +export { derivativeOperation } from './differences'; +export type { MovingAverageIndexPatternColumn } from './moving_average'; +export { movingAverageOperation } from './moving_average'; +export type { + OverallSumIndexPatternColumn, + OverallMinIndexPatternColumn, + OverallMaxIndexPatternColumn, + OverallAverageIndexPatternColumn, +} from './overall_metric'; export { overallSumOperation, - OverallSumIndexPatternColumn, overallMinOperation, - OverallMinIndexPatternColumn, overallMaxOperation, - OverallMaxIndexPatternColumn, overallAverageOperation, - OverallAverageIndexPatternColumn, } from './overall_metric'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/index.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/index.ts index bafde0d37b3e9f..5ff0c4e2d4bd7d 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/index.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/index.ts @@ -5,6 +5,8 @@ * 2.0. */ -export { formulaOperation, FormulaIndexPatternColumn } from './formula'; +export type { FormulaIndexPatternColumn } from './formula'; +export { formulaOperation } from './formula'; export { regenerateLayerFromAst } from './parse'; -export { mathOperation, MathIndexPatternColumn } from './math'; +export type { MathIndexPatternColumn } from './math'; +export { mathOperation } from './math'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts index 0212c73f468790..392b2b135ca22d 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts @@ -93,21 +93,21 @@ export type IndexPatternColumn = export type FieldBasedIndexPatternColumn = Extract; -export { IncompleteColumn } from './column_types'; +export type { IncompleteColumn } from './column_types'; -export { TermsIndexPatternColumn } from './terms'; -export { FiltersIndexPatternColumn } from './filters'; -export { CardinalityIndexPatternColumn } from './cardinality'; -export { PercentileIndexPatternColumn } from './percentile'; -export { +export type { TermsIndexPatternColumn } from './terms'; +export type { FiltersIndexPatternColumn } from './filters'; +export type { CardinalityIndexPatternColumn } from './cardinality'; +export type { PercentileIndexPatternColumn } from './percentile'; +export type { MinIndexPatternColumn, AvgIndexPatternColumn, SumIndexPatternColumn, MaxIndexPatternColumn, MedianIndexPatternColumn, } from './metrics'; -export { DateHistogramIndexPatternColumn } from './date_histogram'; -export { +export type { DateHistogramIndexPatternColumn } from './date_histogram'; +export type { CumulativeSumIndexPatternColumn, CounterRateIndexPatternColumn, DerivativeIndexPatternColumn, @@ -117,11 +117,11 @@ export { OverallMaxIndexPatternColumn, OverallAverageIndexPatternColumn, } from './calculations'; -export { CountIndexPatternColumn } from './count'; -export { LastValueIndexPatternColumn } from './last_value'; -export { RangeIndexPatternColumn } from './ranges'; -export { FormulaIndexPatternColumn, MathIndexPatternColumn } from './formula'; -export { StaticValueIndexPatternColumn } from './static_value'; +export type { CountIndexPatternColumn } from './count'; +export type { LastValueIndexPatternColumn } from './last_value'; +export type { RangeIndexPatternColumn } from './ranges'; +export type { FormulaIndexPatternColumn, MathIndexPatternColumn } from './formula'; +export type { StaticValueIndexPatternColumn } from './static_value'; // List of all operation definitions registered to this data source. // If you want to implement a new operation, add the definition to this array and diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/index.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/index.ts index 7899ce9efcedf0..86add22b2b8ced 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/index.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/index.ts @@ -8,7 +8,7 @@ export * from './operations'; export * from './layer_helpers'; export * from './time_scale_utils'; -export { +export type { OperationType, IndexPatternColumn, FieldBasedIndexPatternColumn, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts index 77a2b334a9e20f..3dc0677f3b9b6b 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts @@ -15,6 +15,7 @@ import { deleteColumn, updateLayerIndexPattern, getErrorMessages, + hasTermsWithManyBuckets, } from './layer_helpers'; import { operationDefinitionMap, OperationType } from '../operations'; import { TermsIndexPatternColumn } from './definitions/terms'; @@ -3005,4 +3006,79 @@ describe('state_helpers', () => { ); }); }); + + describe('hasTermsWithManyBuckets', () => { + it('should return false for a bucketed non terms operation', () => { + const layer: IndexPatternLayer = { + columnOrder: ['col1'], + columns: { + col1: { + dataType: 'date', + isBucketed: true, + label: '', + operationType: 'date_histogram', + sourceField: 'fieldD', + params: { + interval: 'd', + }, + }, + }, + indexPatternId: 'original', + }; + + expect(hasTermsWithManyBuckets(layer)).toBeFalsy(); + }); + + it('should return false if all terms operation have a lower size', () => { + const layer: IndexPatternLayer = { + columnOrder: ['col1'], + columns: { + col1: { + label: 'My Op', + customLabel: true, + dataType: 'string', + isBucketed: true, + + // Private + operationType: 'terms', + sourceField: 'dest', + params: { + size: 5, + orderBy: { type: 'alphabetical' }, + orderDirection: 'asc', + }, + }, + }, + indexPatternId: 'original', + }; + + expect(hasTermsWithManyBuckets(layer)).toBeFalsy(); + }); + + it('should return true if the size is high', () => { + const layer: IndexPatternLayer = { + columnOrder: ['col1'], + columns: { + col1: { + label: 'My Op', + customLabel: true, + dataType: 'string', + isBucketed: true, + + // Private + operationType: 'terms', + sourceField: 'dest', + params: { + size: 15, + orderBy: { type: 'alphabetical' }, + orderDirection: 'asc', + }, + }, + }, + indexPatternId: 'original', + }; + + expect(hasTermsWithManyBuckets(layer)).toBeTruthy(); + }); + }); }); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts index 1ae17ca9ec2b2d..67546ca6009cf8 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts @@ -1369,6 +1369,17 @@ export function getReferencedColumnIds(layer: IndexPatternLayer, columnId: strin return referencedIds; } +export function hasTermsWithManyBuckets(layer: IndexPatternLayer): boolean { + return layer.columnOrder.some((columnId) => { + const column = layer.columns[columnId]; + if (column) { + return ( + column.isBucketed && column.params && 'size' in column.params && column.params.size > 5 + ); + } + }); +} + export function isOperationAllowedAsReference({ operationType, validation, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/types.ts b/x-pack/plugins/lens/public/indexpattern_datasource/types.ts index 588b2595202729..515693b4dd5c8c 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/types.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/types.ts @@ -11,7 +11,7 @@ import type { FieldSpec } from '../../../../../src/plugins/data/common'; import type { DragDropIdentifier } from '../drag_drop/providers'; import type { FieldFormatParams } from '../../../../../src/plugins/field_formats/common'; -export { +export type { FieldBasedIndexPatternColumn, IndexPatternColumn, OperationType, diff --git a/x-pack/plugins/lens/public/mocks/index.ts b/x-pack/plugins/lens/public/mocks/index.ts index 2dd32a1679f1b3..e9f03cde2642ed 100644 --- a/x-pack/plugins/lens/public/mocks/index.ts +++ b/x-pack/plugins/lens/public/mocks/index.ts @@ -16,12 +16,12 @@ export { datasourceMap, mockDatasourceMap, createMockDatasource } from './dataso export type { DatasourceMock } from './datasource_mock'; export { createExpressionRendererMock } from './expression_renderer_mock'; export { defaultDoc, exactMatchDoc, makeDefaultServices } from './services_mock'; +export type { MountStoreProps } from './store_mocks'; export { mockStoreDeps, mockDatasourceStates, defaultState, makeLensStore, - MountStoreProps, mountWithProvider, } from './store_mocks'; export { lensPluginMock } from './lens_plugin_mock'; diff --git a/x-pack/plugins/lens/public/shared_components/index.ts b/x-pack/plugins/lens/public/shared_components/index.ts index f268d6816910e0..9ffddaa1a135b7 100644 --- a/x-pack/plugins/lens/public/shared_components/index.ts +++ b/x-pack/plugins/lens/public/shared_components/index.ts @@ -6,7 +6,8 @@ */ export * from './empty_placeholder'; -export { ToolbarPopoverProps, ToolbarPopover } from './toolbar_popover'; +export type { ToolbarPopoverProps } from './toolbar_popover'; +export { ToolbarPopover } from './toolbar_popover'; export { LegendSettingsPopover } from './legend_settings_popover'; export { PalettePicker } from './palette_picker'; export { TooltipWrapper } from './tooltip_wrapper'; diff --git a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap b/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap index 6601167e1f83a6..e2566aa22ce9e2 100644 --- a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap +++ b/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap @@ -46,7 +46,7 @@ exports[`xy_expression XYChart component it renders area 1`] = ` + isHistogram && + (seriesType.includes('stacked') || !splitAccessor) && + (seriesType.includes('stacked') || + !seriesType.includes('bar') || + !chartHasMoreThanOneBarSeries) + ); - const gridLineStyle: RecursivePartial = shouldUseNewTimeAxis - ? { - visible: gridlinesVisibilitySettings?.x, - strokeWidth: 0.1, - stroke: darkMode ? 'white' : 'black', - } - : { - visible: gridlinesVisibilitySettings?.x, - strokeWidth: 2, - }; + const shouldUseNewTimeAxis = + isTimeViz && isHistogramModeEnabled && !useLegacyTimeAxis && !shouldRotate; + + const gridLineStyle = { + visible: gridlinesVisibilitySettings?.x, + strokeWidth: 1, + }; const xAxisStyle: RecursivePartial = shouldUseNewTimeAxis ? { + ...MULTILAYER_TIME_AXIS_STYLE, tickLabel: { + ...MULTILAYER_TIME_AXIS_STYLE.tickLabel, visible: Boolean(tickLabelsVisibilitySettings?.x), - rotation: 0, // rotation is disabled on new time axis - fontSize: 11, - padding: - referenceLinePaddings.bottom != null ? { inner: referenceLinePaddings.bottom } : 0, - alignment: { - vertical: Position.Bottom, - horizontal: Position.Left, - }, - offset: { - x: 1.5, - y: 0, - }, - }, - axisLine: { - stroke: darkMode ? 'lightgray' : 'darkgray', - strokeWidth: 1, }, tickLine: { - size: 12, - strokeWidth: 0.15, - stroke: darkMode ? 'white' : 'black', - padding: -10, + ...MULTILAYER_TIME_AXIS_STYLE.tickLine, visible: Boolean(tickLabelsVisibilitySettings?.x), }, axisTitle: { visible: axisTitlesVisibilitySettings.x, - padding: - !tickLabelsVisibilitySettings?.x && referenceLinePaddings.bottom != null - ? { inner: referenceLinePaddings.bottom } - : undefined, }, } : { @@ -715,6 +697,7 @@ export function XYChart({ tickFormat={(d) => axis.formatter?.convert(d) || ''} style={getYAxesStyle(axis.groupId as 'left' | 'right')} domain={getYAxisDomain(axis)} + ticks={5} /> ); })} diff --git a/x-pack/plugins/license_management/public/application/index.tsx b/x-pack/plugins/license_management/public/application/index.tsx index a289a40e72da8b..16b6ebb1afdf93 100644 --- a/x-pack/plugins/license_management/public/application/index.tsx +++ b/x-pack/plugins/license_management/public/application/index.tsx @@ -36,4 +36,4 @@ export const renderApp = (element: Element, dependencies: AppDependencies) => { }; }; -export { AppDependencies }; +export type { AppDependencies }; diff --git a/x-pack/plugins/license_management/public/index.ts b/x-pack/plugins/license_management/public/index.ts index d36a08a999f417..c63cab6f4ad090 100644 --- a/x-pack/plugins/license_management/public/index.ts +++ b/x-pack/plugins/license_management/public/index.ts @@ -9,5 +9,5 @@ import { PluginInitializerContext } from 'src/core/public'; import { LicenseManagementUIPlugin } from './plugin'; import './application/index.scss'; -export { LicenseManagementUIPluginSetup, LicenseManagementUIPluginStart } from './plugin'; +export type { LicenseManagementUIPluginSetup, LicenseManagementUIPluginStart } from './plugin'; export const plugin = (ctx: PluginInitializerContext) => new LicenseManagementUIPlugin(ctx); diff --git a/x-pack/plugins/lists/common/schemas/response/exception_export_details_schema.mock.ts b/x-pack/plugins/lists/common/schemas/response/exception_export_details_schema.mock.ts new file mode 100644 index 00000000000000..91b20a49213d64 --- /dev/null +++ b/x-pack/plugins/lists/common/schemas/response/exception_export_details_schema.mock.ts @@ -0,0 +1,28 @@ +/* + * Copyright 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 { ExportExceptionDetails } from '@kbn/securitysolution-io-ts-list-types'; + +export interface ExportExceptionDetailsMock { + listCount?: number; + missingListsCount?: number; + missingLists?: Array>; + itemCount?: number; + missingItemCount?: number; + missingItems?: Array>; +} + +export const getExceptionExportDetailsMock = ( + details?: ExportExceptionDetailsMock +): ExportExceptionDetails => ({ + exported_exception_list_count: details?.listCount ?? 0, + exported_exception_list_item_count: details?.itemCount ?? 0, + missing_exception_list_item_count: details?.missingItemCount ?? 0, + missing_exception_list_items: details?.missingItems ?? [], + missing_exception_lists: details?.missingLists ?? [], + missing_exception_lists_count: details?.missingListsCount ?? 0, +}); diff --git a/x-pack/plugins/lists/server/index.ts b/x-pack/plugins/lists/server/index.ts index 9f395cb0d94bc7..d8e13e86329c12 100644 --- a/x-pack/plugins/lists/server/index.ts +++ b/x-pack/plugins/lists/server/index.ts @@ -12,7 +12,7 @@ import { ListPlugin } from './plugin'; // exporting these since its required at top level in siem plugin export { ListClient } from './services/lists/list_client'; -export { +export type { CreateExceptionListItemOptions, UpdateExceptionListItemOptions, } from './services/exception_lists/exception_list_client_types'; diff --git a/x-pack/plugins/lists/server/services/exception_lists/exception_list_client_types.ts b/x-pack/plugins/lists/server/services/exception_lists/exception_list_client_types.ts index 14de474974c119..d6edf83428587c 100644 --- a/x-pack/plugins/lists/server/services/exception_lists/exception_list_client_types.ts +++ b/x-pack/plugins/lists/server/services/exception_lists/exception_list_client_types.ts @@ -15,6 +15,7 @@ import type { ExceptionListItemTypeOrUndefined, ExceptionListType, ExceptionListTypeOrUndefined, + ExportExceptionDetails, FilterOrUndefined, Id, IdOrUndefined, @@ -229,12 +230,5 @@ export interface ExportExceptionListAndItemsOptions { export interface ExportExceptionListAndItemsReturn { exportData: string; - exportDetails: { - exported_exception_list_count: number; - exported_exception_list_item_count: number; - missing_exception_list_item_count: number; - missing_exception_list_items: string[]; - missing_exception_lists: string[]; - missing_exception_lists_count: number; - }; + exportDetails: ExportExceptionDetails; } diff --git a/x-pack/plugins/lists/server/services/exception_lists/export_exception_list_and_items.ts b/x-pack/plugins/lists/server/services/exception_lists/export_exception_list_and_items.ts index 46b3df4e5ac449..b071c72a9b1225 100644 --- a/x-pack/plugins/lists/server/services/exception_lists/export_exception_list_and_items.ts +++ b/x-pack/plugins/lists/server/services/exception_lists/export_exception_list_and_items.ts @@ -6,6 +6,7 @@ */ import type { + ExportExceptionDetails, IdOrUndefined, ListIdOrUndefined, NamespaceType, @@ -25,14 +26,7 @@ interface ExportExceptionListAndItemsOptions { export interface ExportExceptionListAndItemsReturn { exportData: string; - exportDetails: { - exported_exception_list_count: number; - exported_exception_list_item_count: number; - missing_exception_list_item_count: number; - missing_exception_list_items: string[]; - missing_exception_lists: string[]; - missing_exception_lists_count: number; - }; + exportDetails: ExportExceptionDetails; } export const exportExceptionListAndItems = async ({ diff --git a/x-pack/plugins/maps/common/elasticsearch_util/index.ts b/x-pack/plugins/maps/common/elasticsearch_util/index.ts index 6febb237cdda71..b5b20d70a7c764 100644 --- a/x-pack/plugins/maps/common/elasticsearch_util/index.ts +++ b/x-pack/plugins/maps/common/elasticsearch_util/index.ts @@ -9,4 +9,5 @@ export * from './es_agg_utils'; export * from './elasticsearch_geo_utils'; export * from './spatial_filter_utils'; export * from './types'; -export { isTotalHitsGreaterThan, TotalHits } from './total_hits'; +export type { TotalHits } from './total_hits'; +export { isTotalHitsGreaterThan } from './total_hits'; diff --git a/x-pack/plugins/maps/common/index.ts b/x-pack/plugins/maps/common/index.ts index 8374a4d0dbaa3e..517ed0bceff10f 100644 --- a/x-pack/plugins/maps/common/index.ts +++ b/x-pack/plugins/maps/common/index.ts @@ -19,7 +19,7 @@ export { SYMBOLIZE_AS_TYPES, } from './constants'; -export { +export type { EMSFileSourceDescriptor, ESTermSourceDescriptor, LayerDescriptor, diff --git a/x-pack/plugins/maps/public/actions/index.ts b/x-pack/plugins/maps/public/actions/index.ts index 4c869698d5ac16..f4d6997333c6c1 100644 --- a/x-pack/plugins/maps/public/actions/index.ts +++ b/x-pack/plugins/maps/public/actions/index.ts @@ -10,9 +10,9 @@ export * from './ui_actions'; export * from './map_actions'; export * from './map_action_constants'; export * from './layer_actions'; +export type { DataRequestContext } from './data_request_actions'; export { cancelAllInFlightRequests, - DataRequestContext, fitToLayerExtent, fitToDataBounds, } from './data_request_actions'; diff --git a/x-pack/plugins/maps/public/api/index.ts b/x-pack/plugins/maps/public/api/index.ts index 9cf7577f448be3..0bbeca6f8160d2 100644 --- a/x-pack/plugins/maps/public/api/index.ts +++ b/x-pack/plugins/maps/public/api/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -export { MapsStartApi } from './start_api'; -export { MapsSetupApi } from './setup_api'; +export type { MapsStartApi } from './start_api'; +export type { MapsSetupApi } from './setup_api'; export { createLayerDescriptors } from './create_layer_descriptors'; export { suggestEMSTermJoinConfig } from './ems'; diff --git a/x-pack/plugins/maps/public/classes/fields/agg/index.ts b/x-pack/plugins/maps/public/classes/fields/agg/index.ts index f8de2db85db911..bd0b5184fe1575 100644 --- a/x-pack/plugins/maps/public/classes/fields/agg/index.ts +++ b/x-pack/plugins/maps/public/classes/fields/agg/index.ts @@ -6,4 +6,4 @@ */ export { esAggFieldsFactory } from './es_agg_factory'; -export { IESAggField } from './agg_field_types'; +export type { IESAggField } from './agg_field_types'; diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/index.ts b/x-pack/plugins/maps/public/classes/layers/vector_layer/index.ts index cb964f77613da1..2b14b78f929464 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/index.ts +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/index.ts @@ -6,10 +6,5 @@ */ export { addGeoJsonMbSource, getVectorSourceBounds, syncVectorSource } from './utils'; -export { - isVectorLayer, - IVectorLayer, - VectorLayer, - VectorLayerArguments, - NO_RESULTS_ICON_AND_TOOLTIPCONTENT, -} from './vector_layer'; +export type { IVectorLayer, VectorLayerArguments } from './vector_layer'; +export { isVectorLayer, VectorLayer, NO_RESULTS_ICON_AND_TOOLTIPCONTENT } from './vector_layer'; diff --git a/x-pack/plugins/maps/public/classes/sources/ems_file_source/index.ts b/x-pack/plugins/maps/public/classes/sources/ems_file_source/index.ts index 2d4d59c5c41598..6c9d7060e9a4b8 100644 --- a/x-pack/plugins/maps/public/classes/sources/ems_file_source/index.ts +++ b/x-pack/plugins/maps/public/classes/sources/ems_file_source/index.ts @@ -6,4 +6,5 @@ */ export { emsBoundariesLayerWizardConfig } from './ems_boundaries_layer_wizard'; -export { EMSFileSource, IEmsFileSource } from './ems_file_source'; +export type { IEmsFileSource } from './ems_file_source'; +export { EMSFileSource } from './ems_file_source'; diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/index.ts b/x-pack/plugins/maps/public/classes/sources/es_search_source/index.ts index 75217c0a29c082..54686f91c133d3 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/index.ts +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/index.ts @@ -5,7 +5,8 @@ * 2.0. */ -export { createLayerDescriptor, CreateLayerDescriptorParams } from './create_layer_descriptor'; +export type { CreateLayerDescriptorParams } from './create_layer_descriptor'; +export { createLayerDescriptor } from './create_layer_descriptor'; export { ESSearchSource } from './es_search_source'; export { createDefaultLayerDescriptor, diff --git a/x-pack/plugins/maps/public/classes/sources/term_join_source/index.ts b/x-pack/plugins/maps/public/classes/sources/term_join_source/index.ts index a40533d98be87e..78f7705104f733 100644 --- a/x-pack/plugins/maps/public/classes/sources/term_join_source/index.ts +++ b/x-pack/plugins/maps/public/classes/sources/term_join_source/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { ITermJoinSource } from './term_join_source'; +export type { ITermJoinSource } from './term_join_source'; diff --git a/x-pack/plugins/maps/public/classes/sources/tiled_single_layer_vector_source/index.ts b/x-pack/plugins/maps/public/classes/sources/tiled_single_layer_vector_source/index.ts index 30177751a8d555..c60cedba61c83d 100644 --- a/x-pack/plugins/maps/public/classes/sources/tiled_single_layer_vector_source/index.ts +++ b/x-pack/plugins/maps/public/classes/sources/tiled_single_layer_vector_source/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { ITiledSingleLayerVectorSource } from './tiled_single_layer_vector_source'; +export type { ITiledSingleLayerVectorSource } from './tiled_single_layer_vector_source'; diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/index.ts b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/index.ts index 7971017a3d52b6..570c1ba8fb896c 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/index.ts +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/index.ts @@ -31,4 +31,4 @@ function mapDispatchToProps(dispatch: ThunkDispatch { public readonly id = ML_APP_LOCATOR; diff --git a/x-pack/plugins/ml/server/lib/capabilities/index.ts b/x-pack/plugins/ml/server/lib/capabilities/index.ts index 623ebe56085ff5..7c27aee6bf4af5 100644 --- a/x-pack/plugins/ml/server/lib/capabilities/index.ts +++ b/x-pack/plugins/ml/server/lib/capabilities/index.ts @@ -5,9 +5,6 @@ * 2.0. */ -export { - capabilitiesProvider, - hasMlCapabilitiesProvider, - HasMlCapabilities, -} from './check_capabilities'; +export type { HasMlCapabilities } from './check_capabilities'; +export { capabilitiesProvider, hasMlCapabilitiesProvider } from './check_capabilities'; export { setupCapabilitiesSwitcher } from './capabilities_switcher'; diff --git a/x-pack/plugins/ml/server/lib/ml_client/index.ts b/x-pack/plugins/ml/server/lib/ml_client/index.ts index 509b83ef1edf71..b5329ba2cfbca5 100644 --- a/x-pack/plugins/ml/server/lib/ml_client/index.ts +++ b/x-pack/plugins/ml/server/lib/ml_client/index.ts @@ -7,4 +7,4 @@ export { getMlClient } from './ml_client'; export { MLJobNotFound } from './errors'; -export { MlClient } from './types'; +export type { MlClient } from './types'; diff --git a/x-pack/plugins/ml/server/models/calendar/index.ts b/x-pack/plugins/ml/server/models/calendar/index.ts index c5177dd675ca1c..ca05246dff0100 100644 --- a/x-pack/plugins/ml/server/models/calendar/index.ts +++ b/x-pack/plugins/ml/server/models/calendar/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { CalendarManager, Calendar, FormCalendar } from './calendar_manager'; +export type { Calendar, FormCalendar } from './calendar_manager'; +export { CalendarManager } from './calendar_manager'; diff --git a/x-pack/plugins/ml/server/models/data_frame_analytics/models_provider.ts b/x-pack/plugins/ml/server/models/data_frame_analytics/models_provider.ts index fb8480d621d557..2f40081f1458d6 100644 --- a/x-pack/plugins/ml/server/models/data_frame_analytics/models_provider.ts +++ b/x-pack/plugins/ml/server/models/data_frame_analytics/models_provider.ts @@ -49,26 +49,31 @@ export function modelsProvider( modelIds.map((id: string) => [id, null]) ); - const { body, statusCode } = await client.asCurrentUser.ingest.getPipeline(); - - if (statusCode !== 200) { - return modelIdsMap; - } - - for (const [pipelineName, pipelineDefinition] of Object.entries(body)) { - const { processors } = pipelineDefinition as { processors: Array> }; - - for (const processor of processors) { - const id = processor.inference?.model_id; - if (modelIdsMap.has(id)) { - const obj = modelIdsMap.get(id); - if (obj === null) { - modelIdsMap.set(id, { [pipelineName]: pipelineDefinition }); - } else { - obj![pipelineName] = pipelineDefinition; + try { + const { body } = await client.asCurrentUser.ingest.getPipeline(); + + for (const [pipelineName, pipelineDefinition] of Object.entries(body)) { + const { processors } = pipelineDefinition as { processors: Array> }; + + for (const processor of processors) { + const id = processor.inference?.model_id; + if (modelIdsMap.has(id)) { + const obj = modelIdsMap.get(id); + if (obj === null) { + modelIdsMap.set(id, { [pipelineName]: pipelineDefinition }); + } else { + obj![pipelineName] = pipelineDefinition; + } } } } + } catch (error) { + if (error.statusCode === 404) { + // ES returns 404 when there are no pipelines + // Instead, we should return the modelIdsMap and a 200 + return modelIdsMap; + } + throw error; } return modelIdsMap; diff --git a/x-pack/plugins/ml/server/models/data_frame_analytics/types.ts b/x-pack/plugins/ml/server/models/data_frame_analytics/types.ts index c9cca5756ada66..216cfe50cc5397 100644 --- a/x-pack/plugins/ml/server/models/data_frame_analytics/types.ts +++ b/x-pack/plugins/ml/server/models/data_frame_analytics/types.ts @@ -11,7 +11,7 @@ import { AnalyticsMapNodeElement, AnalyticsMapEdgeElement, } from '../../../common/types/data_frame_analytics'; -export { +export type { MapElements, AnalyticsMapReturnType, AnalyticsMapNodeElement, diff --git a/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts b/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts index 1cd9aae79777b8..9e02a93a3c0f1f 100644 --- a/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts +++ b/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts @@ -293,6 +293,8 @@ export class DataRecognizer { index, size, body: searchBody, + // Ignored indices that are frozen + ignore_throttled: true, }); // @ts-expect-error incorrect search response type diff --git a/x-pack/plugins/ml/server/models/data_recognizer/index.ts b/x-pack/plugins/ml/server/models/data_recognizer/index.ts index fbddf17a50ede0..55595c3a12bde1 100644 --- a/x-pack/plugins/ml/server/models/data_recognizer/index.ts +++ b/x-pack/plugins/ml/server/models/data_recognizer/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { DataRecognizer, RecognizeResult, dataRecognizerFactory } from './data_recognizer'; +export type { RecognizeResult } from './data_recognizer'; +export { DataRecognizer, dataRecognizerFactory } from './data_recognizer'; diff --git a/x-pack/plugins/ml/server/models/filter/index.ts b/x-pack/plugins/ml/server/models/filter/index.ts index d5663478b48123..678fe73007ea27 100644 --- a/x-pack/plugins/ml/server/models/filter/index.ts +++ b/x-pack/plugins/ml/server/models/filter/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { FilterManager, FormFilter, UpdateFilter } from './filter_manager'; +export type { FormFilter, UpdateFilter } from './filter_manager'; +export { FilterManager } from './filter_manager'; diff --git a/x-pack/plugins/ml/server/saved_objects/index.ts b/x-pack/plugins/ml/server/saved_objects/index.ts index cbd31c92611302..652f47122ae2f9 100644 --- a/x-pack/plugins/ml/server/saved_objects/index.ts +++ b/x-pack/plugins/ml/server/saved_objects/index.ts @@ -6,7 +6,8 @@ */ export { setupSavedObjects } from './saved_objects'; -export { JobObject, JobSavedObjectService, jobSavedObjectServiceFactory } from './service'; +export type { JobObject, JobSavedObjectService } from './service'; +export { jobSavedObjectServiceFactory } from './service'; export { checksFactory } from './checks'; export { syncSavedObjectsFactory } from './sync'; export { jobSavedObjectsInitializationFactory } from './initialization'; diff --git a/x-pack/plugins/ml/server/shared_services/index.ts b/x-pack/plugins/ml/server/shared_services/index.ts index 4126850918f6dc..3a38b0b76bac6c 100644 --- a/x-pack/plugins/ml/server/shared_services/index.ts +++ b/x-pack/plugins/ml/server/shared_services/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { SharedServices, createSharedServices } from './shared_services'; +export type { SharedServices } from './shared_services'; +export { createSharedServices } from './shared_services'; diff --git a/x-pack/plugins/ml/server/shared_services/license_checks/index.ts b/x-pack/plugins/ml/server/shared_services/license_checks/index.ts index 5939ff18a93767..9810084488cae2 100644 --- a/x-pack/plugins/ml/server/shared_services/license_checks/index.ts +++ b/x-pack/plugins/ml/server/shared_services/license_checks/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { LicenseCheck, licenseChecks } from './license_checks'; +export type { LicenseCheck } from './license_checks'; +export { licenseChecks } from './license_checks'; export { InsufficientBasicLicenseError, InsufficientFullLicenseError } from './errors'; diff --git a/x-pack/plugins/monitoring/public/types.ts b/x-pack/plugins/monitoring/public/types.ts index 4817ac235e2bdf..fa92cfacafdcc3 100644 --- a/x-pack/plugins/monitoring/public/types.ts +++ b/x-pack/plugins/monitoring/public/types.ts @@ -12,9 +12,9 @@ import { TriggersAndActionsUIPublicPluginStart } from '../../triggers_actions_ui import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/public'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths -export { MonitoringConfig } from '../server'; +export type { MonitoringConfig } from '../server'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths -export { MLJobs } from '../server/lib/elasticsearch/get_ml_jobs'; +export type { MLJobs } from '../server/lib/elasticsearch/get_ml_jobs'; export interface MonitoringStartPluginDependencies { navigation: NavigationStart; diff --git a/x-pack/plugins/monitoring/server/index.ts b/x-pack/plugins/monitoring/server/index.ts index 63cc61e5039170..44aaff7d51c4a4 100644 --- a/x-pack/plugins/monitoring/server/index.ts +++ b/x-pack/plugins/monitoring/server/index.ts @@ -11,9 +11,9 @@ import { MonitoringPlugin } from './plugin'; import { configSchema } from './config'; import { deprecations } from './deprecations'; -export { KibanaSettingsCollector } from './kibana_monitoring/collectors'; -export { MonitoringConfig } from './config'; -export { MonitoringPluginSetup, IBulkUploader } from './types'; +export type { KibanaSettingsCollector } from './kibana_monitoring/collectors'; +export type { MonitoringConfig } from './config'; +export type { MonitoringPluginSetup, IBulkUploader } from './types'; export const plugin = (initContext: PluginInitializerContext) => new MonitoringPlugin(initContext); export const config: PluginConfigDescriptor> = { diff --git a/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/index.ts b/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/index.ts index 06d47f00447286..9fa7ea8fdaf6ae 100644 --- a/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/index.ts +++ b/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/index.ts @@ -11,7 +11,8 @@ import { getSettingsCollector } from './get_settings_collector'; import { getMonitoringUsageCollector } from './get_usage_collector'; import { MonitoringConfig } from '../../config'; -export { KibanaSettingsCollector, getKibanaSettings } from './get_settings_collector'; +export type { KibanaSettingsCollector } from './get_settings_collector'; +export { getKibanaSettings } from './get_settings_collector'; export function registerCollectors( usageCollection: UsageCollectionSetup, diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/index.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/index.ts index 8f474c02848444..00f3370dfde516 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/index.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/index.ts @@ -7,6 +7,7 @@ export { getNodes } from './get_nodes'; export { getNodeSummary } from './get_node_summary'; -export { calculateNodeType, Node } from './calculate_node_type'; +export type { Node } from './calculate_node_type'; +export { calculateNodeType } from './calculate_node_type'; export { getNodeTypeClassLabel } from './get_node_type_class_label'; export { getDefaultNodeFromId } from './get_default_node_from_id'; diff --git a/x-pack/plugins/monitoring/server/lib/metrics/index.ts b/x-pack/plugins/monitoring/server/lib/metrics/index.ts index ba43a8c316d3b8..2fdaeb81ee6205 100644 --- a/x-pack/plugins/monitoring/server/lib/metrics/index.ts +++ b/x-pack/plugins/monitoring/server/lib/metrics/index.ts @@ -9,9 +9,11 @@ export { ElasticsearchMetric } from './elasticsearch/classes'; // @ts-ignore export { KibanaClusterMetric, KibanaMetric } from './kibana/classes'; -export { ApmMetric, ApmClusterMetric, ApmMetricFields } from './apm/classes'; +export type { ApmMetricFields } from './apm/classes'; +export { ApmMetric, ApmClusterMetric } from './apm/classes'; // @ts-ignore export { LogstashClusterMetric, LogstashMetric } from './logstash/classes'; -export { BeatsClusterMetric, BeatsMetric, BeatsMetricFields } from './beats/classes'; +export type { BeatsMetricFields } from './beats/classes'; +export { BeatsClusterMetric, BeatsMetric } from './beats/classes'; // @ts-ignore export { metrics } from './metrics'; diff --git a/x-pack/plugins/observability/public/index.ts b/x-pack/plugins/observability/public/index.ts index 2dd380c3b76830..3eebf8a84db190 100644 --- a/x-pack/plugins/observability/public/index.ts +++ b/x-pack/plugins/observability/public/index.ts @@ -51,12 +51,11 @@ export { export type { LazyObservabilityPageTemplateProps } from './components/shared'; +export type { UiTracker, TrackMetricOptions } from './hooks/use_track_metric'; export { useTrackPageview, useUiTracker, useTrackMetric, - UiTracker, - TrackMetricOptions, METRIC_TYPE, } from './hooks/use_track_metric'; @@ -83,8 +82,6 @@ export type { export { createObservabilityRuleTypeRegistryMock } from './rules/observability_rule_type_registry_mock'; export type { ExploratoryEmbeddableProps } from './components/shared/exploratory_view/embeddable/embeddable'; -export { - InspectorContextProvider, - AddInspectorRequest, -} from './context/inspector/inspector_context'; +export type { AddInspectorRequest } from './context/inspector/inspector_context'; +export { InspectorContextProvider } from './context/inspector/inspector_context'; export { useInspectorContext } from './context/inspector/use_inspector_context'; diff --git a/x-pack/plugins/observability/public/services/call_observability_api/types.ts b/x-pack/plugins/observability/public/services/call_observability_api/types.ts index 8722aecd908007..f517772821f426 100644 --- a/x-pack/plugins/observability/public/services/call_observability_api/types.ts +++ b/x-pack/plugins/observability/public/services/call_observability_api/types.ts @@ -31,4 +31,4 @@ export type ObservabilityClient = RouteRepositoryClient< ObservabilityClientOptions >; -export { ObservabilityAPIReturnType }; +export type { ObservabilityAPIReturnType }; diff --git a/x-pack/plugins/observability/server/index.ts b/x-pack/plugins/observability/server/index.ts index 22a469dbedbddc..d4d7127d8baee5 100644 --- a/x-pack/plugins/observability/server/index.ts +++ b/x-pack/plugins/observability/server/index.ts @@ -43,11 +43,5 @@ export type ObservabilityConfig = TypeOf; export const plugin = (initContext: PluginInitializerContext) => new ObservabilityPlugin(initContext); -export { - createOrUpdateIndex, - Mappings, - ObservabilityPluginSetup, - ScopedAnnotationsClient, - unwrapEsResponse, - WrappedElasticsearchClientError, -}; +export type { Mappings, ObservabilityPluginSetup, ScopedAnnotationsClient }; +export { createOrUpdateIndex, unwrapEsResponse, WrappedElasticsearchClientError }; diff --git a/x-pack/plugins/observability/server/routes/types.ts b/x-pack/plugins/observability/server/routes/types.ts index 5075b21fdf1faf..b316b1fffc7700 100644 --- a/x-pack/plugins/observability/server/routes/types.ts +++ b/x-pack/plugins/observability/server/routes/types.ts @@ -17,7 +17,7 @@ import { RuleDataPluginService } from '../../../rule_registry/server'; import { ObservabilityServerRouteRepository } from './get_global_observability_server_route_repository'; import { ObservabilityRequestHandlerContext } from '../types'; -export { ObservabilityServerRouteRepository }; +export type { ObservabilityServerRouteRepository }; export interface ObservabilityRouteHandlerResources { core: { diff --git a/x-pack/plugins/observability/typings/common.ts b/x-pack/plugins/observability/typings/common.ts index 2bc95447d9203c..368dd33f1f13fd 100644 --- a/x-pack/plugins/observability/typings/common.ts +++ b/x-pack/plugins/observability/typings/common.ts @@ -23,6 +23,6 @@ export type PromiseReturnType = Func extends (...args: any[]) => Promise new RemoteClustersUIPlugin(initializerContext); diff --git a/x-pack/plugins/remote_clusters/public/types.ts b/x-pack/plugins/remote_clusters/public/types.ts index 15a34c84bb30c5..bcd162599ab773 100644 --- a/x-pack/plugins/remote_clusters/public/types.ts +++ b/x-pack/plugins/remote_clusters/public/types.ts @@ -23,6 +23,6 @@ export interface ClientConfigType { }; } -export { RegisterManagementAppArgs }; +export type { RegisterManagementAppArgs }; -export { I18nStart }; +export type { I18nStart }; diff --git a/x-pack/plugins/remote_clusters/server/index.ts b/x-pack/plugins/remote_clusters/server/index.ts index 33be5d88a3e4b3..9447f9d9209e32 100644 --- a/x-pack/plugins/remote_clusters/server/index.ts +++ b/x-pack/plugins/remote_clusters/server/index.ts @@ -9,6 +9,6 @@ import { PluginInitializerContext } from 'kibana/server'; import { RemoteClustersServerPlugin } from './plugin'; export { config } from './config'; -export { RemoteClustersPluginSetup } from './plugin'; +export type { RemoteClustersPluginSetup } from './plugin'; export const plugin = (ctx: PluginInitializerContext) => new RemoteClustersServerPlugin(ctx); diff --git a/x-pack/plugins/reporting/common/types/base.ts b/x-pack/plugins/reporting/common/types/base.ts new file mode 100644 index 00000000000000..44960c57f61c14 --- /dev/null +++ b/x-pack/plugins/reporting/common/types/base.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 type { Ensure, SerializableRecord } from '@kbn/utility-types'; +import type { LayoutParams } from './layout'; + +export type JobId = string; + +export type BaseParams = Ensure< + { + layout?: LayoutParams; + objectType: string; + title: string; + browserTimezone: string; // to format dates in the user's time zone + version: string; // to handle any state migrations + }, + SerializableRecord +>; + +// base params decorated with encrypted headers that come into runJob functions +export interface BasePayload extends BaseParams { + headers: string; + spaceId?: string; + isDeprecated?: boolean; +} diff --git a/x-pack/plugins/reporting/server/export_types/csv/types.d.ts b/x-pack/plugins/reporting/common/types/export_types/csv.ts similarity index 86% rename from x-pack/plugins/reporting/server/export_types/csv/types.d.ts rename to x-pack/plugins/reporting/common/types/export_types/csv.ts index fff6f0bcf95387..8249c129052d75 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/types.d.ts +++ b/x-pack/plugins/reporting/common/types/export_types/csv.ts @@ -5,8 +5,7 @@ * 2.0. */ -import type { FieldSpec } from 'src/plugins/data/common'; -import { BaseParams, BasePayload } from '../../types'; +import { BaseParams, BasePayload } from '../base'; export type RawValue = string | object | null | undefined; @@ -57,16 +56,6 @@ export interface SearchRequestDeprecatedCSV { | any; } -type FormatsMapDeprecatedCSV = Map< - string, - { - id: string; - params: { - pattern: string; - }; - } ->; - export interface SavedSearchGeneratorResultDeprecatedCSV { maxSizeReached: boolean; csvContainsFormulas?: boolean; diff --git a/x-pack/plugins/reporting/server/export_types/csv_searchsource/types.d.ts b/x-pack/plugins/reporting/common/types/export_types/csv_searchsource.ts similarity index 81% rename from x-pack/plugins/reporting/server/export_types/csv_searchsource/types.d.ts rename to x-pack/plugins/reporting/common/types/export_types/csv_searchsource.ts index 170b03c2dfbff1..2ba88426e8786b 100644 --- a/x-pack/plugins/reporting/server/export_types/csv_searchsource/types.d.ts +++ b/x-pack/plugins/reporting/common/types/export_types/csv_searchsource.ts @@ -6,9 +6,7 @@ */ import type { SearchSourceFields } from 'src/plugins/data/common'; -import type { BaseParams, BasePayload } from '../../types'; - -export type RawValue = string | object | null | undefined; +import type { BaseParams, BasePayload } from '../base'; interface BaseParamsCSV { searchSource: SearchSourceFields; diff --git a/x-pack/plugins/reporting/server/export_types/csv_searchsource_immediate/types.d.ts b/x-pack/plugins/reporting/common/types/export_types/csv_searchsource_immediate.ts similarity index 100% rename from x-pack/plugins/reporting/server/export_types/csv_searchsource_immediate/types.d.ts rename to x-pack/plugins/reporting/common/types/export_types/csv_searchsource_immediate.ts diff --git a/x-pack/plugins/reporting/common/types/export_types/index.ts b/x-pack/plugins/reporting/common/types/export_types/index.ts new file mode 100644 index 00000000000000..0ad47e74140317 --- /dev/null +++ b/x-pack/plugins/reporting/common/types/export_types/index.ts @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export * from './csv'; +export * from './csv_searchsource'; +export * from './csv_searchsource_immediate'; +export * from './png'; +export * from './png_v2'; +export * from './printable_pdf'; +export * from './printable_pdf_v2'; diff --git a/x-pack/plugins/reporting/server/export_types/png/types.d.ts b/x-pack/plugins/reporting/common/types/export_types/png.ts similarity index 84% rename from x-pack/plugins/reporting/server/export_types/png/types.d.ts rename to x-pack/plugins/reporting/common/types/export_types/png.ts index d266b5c8491852..3b850b5bd8b33b 100644 --- a/x-pack/plugins/reporting/server/export_types/png/types.d.ts +++ b/x-pack/plugins/reporting/common/types/export_types/png.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { LayoutParams } from '../../lib/layouts'; -import { BaseParams, BasePayload } from '../../types'; +import type { LayoutParams } from '../layout'; +import type { BaseParams, BasePayload } from '../base'; interface BaseParamsPNG { layout: LayoutParams; diff --git a/x-pack/plugins/reporting/server/export_types/png_v2/types.d.ts b/x-pack/plugins/reporting/common/types/export_types/png_v2.ts similarity index 83% rename from x-pack/plugins/reporting/server/export_types/png_v2/types.d.ts rename to x-pack/plugins/reporting/common/types/export_types/png_v2.ts index 50c857b66934b2..c937d01ce0be1b 100644 --- a/x-pack/plugins/reporting/server/export_types/png_v2/types.d.ts +++ b/x-pack/plugins/reporting/common/types/export_types/png_v2.ts @@ -5,9 +5,9 @@ * 2.0. */ -import type { LocatorParams } from '../../../common/types'; -import type { LayoutParams } from '../../lib/layouts'; -import type { BaseParams, BasePayload } from '../../types'; +import type { LocatorParams } from '../url'; +import type { LayoutParams } from '../layout'; +import type { BaseParams, BasePayload } from '../base'; // Job params: structure of incoming user request data export interface JobParamsPNGV2 extends BaseParams { diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf/types.d.ts b/x-pack/plugins/reporting/common/types/export_types/printable_pdf.ts similarity index 74% rename from x-pack/plugins/reporting/server/export_types/printable_pdf/types.d.ts rename to x-pack/plugins/reporting/common/types/export_types/printable_pdf.ts index 8e4c45ad795067..a424706430f2c6 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf/types.d.ts +++ b/x-pack/plugins/reporting/common/types/export_types/printable_pdf.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { LayoutParams } from '../../lib/layouts'; -import { BaseParams, BasePayload } from '../../types'; +import type { LayoutParams } from '../layout'; +import type { BaseParams, BasePayload } from '../base'; interface BaseParamsPDF { layout: LayoutParams; @@ -17,6 +17,8 @@ interface BaseParamsPDF { // Job params: structure of incoming user request data, after being parsed from RISON export type JobParamsPDF = BaseParamsPDF & BaseParams; +export type JobAppParamsPDF = Omit; + // Job payload: structure of stored job data provided by create_job export interface TaskPayloadPDF extends BasePayload { layout: LayoutParams; @@ -24,8 +26,7 @@ export interface TaskPayloadPDF extends BasePayload { objects: Array<{ relativeUrl: string }>; } -type Legacy = Omit; -export interface JobParamsPDFLegacy extends Legacy { +export interface JobParamsPDFLegacy extends Omit { savedObjectId: string; queryString: string; } diff --git a/x-pack/plugins/reporting/common/types/export_types/printable_pdf_v2.ts b/x-pack/plugins/reporting/common/types/export_types/printable_pdf_v2.ts new file mode 100644 index 00000000000000..c9a7a2ce2331ab --- /dev/null +++ b/x-pack/plugins/reporting/common/types/export_types/printable_pdf_v2.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. + */ + +import type { LocatorParams } from '../url'; +import type { LayoutParams } from '../layout'; +import type { BaseParams, BasePayload } from '../base'; + +interface BaseParamsPDFV2 { + layout: LayoutParams; + + /** + * This value is used to re-create the same visual state as when the report was requested as well as navigate to the correct page. + */ + locatorParams: LocatorParams[]; +} + +// Job params: structure of incoming user request data, after being parsed from RISON +export type JobParamsPDFV2 = BaseParamsPDFV2 & BaseParams; + +export type JobAppParamsPDFV2 = Omit; + +// Job payload: structure of stored job data provided by create_job +export interface TaskPayloadPDFV2 extends BasePayload, BaseParamsPDFV2 { + layout: LayoutParams; + /** + * The value of forceNow is injected server-side every time a given report is generated. + */ + forceNow: string; +} diff --git a/x-pack/plugins/reporting/common/types.ts b/x-pack/plugins/reporting/common/types/index.ts similarity index 75% rename from x-pack/plugins/reporting/common/types.ts rename to x-pack/plugins/reporting/common/types/index.ts index fe018feab0f8bd..75e8cb0af9698e 100644 --- a/x-pack/plugins/reporting/common/types.ts +++ b/x-pack/plugins/reporting/common/types/index.ts @@ -5,7 +5,20 @@ * 2.0. */ -import type { Ensure, SerializableRecord } from '@kbn/utility-types'; +import type { Size, LayoutParams } from './layout'; +import type { JobId, BaseParams, BasePayload } from './base'; + +export type { JobId, BaseParams, BasePayload }; +export type { Size, LayoutParams }; +export type { + DownloadReportFn, + IlmPolicyMigrationStatus, + IlmPolicyStatusResponse, + LocatorParams, + ManagementLinkFn, + UrlOrUrlLocatorTuple, +} from './url'; +export * from './export_types'; export interface PageSizeParams { pageMarginTop: number; @@ -21,22 +34,6 @@ export interface PdfImageSize { height?: number; } -export type Size = Ensure< - { - width: number; - height: number; - }, - SerializableRecord ->; - -export type LayoutParams = Ensure< - { - id: string; - dimensions?: Size; - }, - SerializableRecord ->; - export interface ReportDocumentHead { _id: string; _index: string; @@ -56,24 +53,6 @@ export interface TaskRunResult { warnings?: string[]; } -export type BaseParams = Ensure< - { - layout?: LayoutParams; - objectType: string; - title: string; - browserTimezone: string; // to format dates in the user's time zone - version: string; // to handle any state migrations - }, - SerializableRecord ->; - -// base params decorated with encrypted headers that come into runJob functions -export interface BasePayload extends BaseParams { - headers: string; - spaceId?: string; - isDeprecated?: boolean; -} - export interface ReportSource { /* * Required fields: populated in RequestHandler.enqueueJob when the request comes in to @@ -119,8 +98,6 @@ export interface ReportDocument extends ReportDocumentHead { _source: ReportSource; } -export type JobId = string; - /* * JobStatus: * - Begins as 'pending' @@ -173,28 +150,3 @@ export interface JobSummarySet { completed: JobSummary[]; failed: JobSummary[]; } - -type DownloadLink = string; -export type DownloadReportFn = (jobId: JobId) => DownloadLink; - -type ManagementLink = string; -export type ManagementLinkFn = () => ManagementLink; - -export interface LocatorParams< - P extends SerializableRecord = SerializableRecord & { forceNow?: string } -> { - id: string; - version: string; - params: P; -} - -export type IlmPolicyMigrationStatus = 'policy-not-found' | 'indices-not-managed-by-policy' | 'ok'; - -export interface IlmPolicyStatusResponse { - status: IlmPolicyMigrationStatus; -} - -type Url = string; -type UrlLocatorTuple = [url: Url, locatorParams: LocatorParams]; - -export type UrlOrUrlLocatorTuple = Url | UrlLocatorTuple; diff --git a/x-pack/plugins/reporting/common/types/layout.ts b/x-pack/plugins/reporting/common/types/layout.ts new file mode 100644 index 00000000000000..b22d6b59d0873e --- /dev/null +++ b/x-pack/plugins/reporting/common/types/layout.ts @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { Ensure, SerializableRecord } from '@kbn/utility-types'; + +export type Size = Ensure< + { + width: number; + height: number; + }, + SerializableRecord +>; + +export type LayoutParams = Ensure< + { + id: string; + dimensions?: Size; + }, + SerializableRecord +>; diff --git a/x-pack/plugins/reporting/common/types/url.ts b/x-pack/plugins/reporting/common/types/url.ts new file mode 100644 index 00000000000000..dfb8ee9f908e3c --- /dev/null +++ b/x-pack/plugins/reporting/common/types/url.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { SerializableRecord } from '@kbn/utility-types'; +import type { JobId } from './base'; + +type DownloadLink = string; +export type DownloadReportFn = (jobId: JobId) => DownloadLink; + +type ManagementLink = string; +export type ManagementLinkFn = () => ManagementLink; + +export interface LocatorParams< + P extends SerializableRecord = SerializableRecord & { forceNow?: string } +> { + id: string; + version: string; + params: P; +} + +export type IlmPolicyMigrationStatus = 'policy-not-found' | 'indices-not-managed-by-policy' | 'ok'; + +export interface IlmPolicyStatusResponse { + status: IlmPolicyMigrationStatus; +} + +type Url = string; +type UrlLocatorTuple = [url: Url, locatorParams: LocatorParams]; + +export type UrlOrUrlLocatorTuple = Url | UrlLocatorTuple; diff --git a/x-pack/plugins/reporting/public/index.ts b/x-pack/plugins/reporting/public/index.ts index 2df236e6e3079e..a634f87140e731 100644 --- a/x-pack/plugins/reporting/public/index.ts +++ b/x-pack/plugins/reporting/public/index.ts @@ -18,6 +18,17 @@ export interface ReportingSetup { export type ReportingStart = ReportingSetup; export { constants } from '../common'; +export type { + JobParamsCSV, + JobParamsDownloadCSV, + JobParamsPNG, + JobParamsPNGV2, + JobAppParamsPDFV2, + JobParamsPDF, + JobParamsPDFV2, + JobAppParamsPDF, +} from '../common/types'; + export { ReportingAPIClient, ReportingPublicPlugin as Plugin }; export function plugin(initializerContext: PluginInitializerContext) { diff --git a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/index.ts b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/index.ts index 843a0b6747e4c1..94ee7f940b9175 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/index.ts +++ b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { ReportingPanelContent, Props, ReportingPanelProps } from './reporting_panel_content'; +export type { Props, ReportingPanelProps } from './reporting_panel_content'; +export { ReportingPanelContent } from './reporting_panel_content'; diff --git a/x-pack/plugins/reporting/public/shared_imports.ts b/x-pack/plugins/reporting/public/shared_imports.ts index e719d720a7895f..30e6cd12e3ed91 100644 --- a/x-pack/plugins/reporting/public/shared_imports.ts +++ b/x-pack/plugins/reporting/public/shared_imports.ts @@ -7,7 +7,8 @@ export type { SharePluginSetup, SharePluginStart, LocatorPublic } from 'src/plugins/share/public'; -export { useRequest, UseRequestResponse } from '../../../../src/plugins/es_ui_shared/public'; +export type { UseRequestResponse } from '../../../../src/plugins/es_ui_shared/public'; +export { useRequest } from '../../../../src/plugins/es_ui_shared/public'; export { KibanaContextProvider } from '../../../../src/plugins/kibana_react/public'; diff --git a/x-pack/plugins/reporting/server/config/__snapshots__/schema.test.ts.snap b/x-pack/plugins/reporting/server/config/__snapshots__/schema.test.ts.snap new file mode 100644 index 00000000000000..a384550f184622 --- /dev/null +++ b/x-pack/plugins/reporting/server/config/__snapshots__/schema.test.ts.snap @@ -0,0 +1,197 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Reporting Config Schema context {"dev":false,"dist":false} produces correct config 1`] = ` +Object { + "capture": Object { + "browser": Object { + "autoDownload": true, + "chromium": Object { + "proxy": Object { + "enabled": false, + }, + }, + "type": "chromium", + }, + "loadDelay": "PT3S", + "maxAttempts": 1, + "networkPolicy": Object { + "enabled": true, + "rules": Array [ + Object { + "allow": true, + "host": undefined, + "protocol": "http:", + }, + Object { + "allow": true, + "host": undefined, + "protocol": "https:", + }, + Object { + "allow": true, + "host": undefined, + "protocol": "ws:", + }, + Object { + "allow": true, + "host": undefined, + "protocol": "wss:", + }, + Object { + "allow": true, + "host": undefined, + "protocol": "data:", + }, + Object { + "allow": false, + "host": undefined, + "protocol": undefined, + }, + ], + }, + "timeouts": Object { + "openUrl": "PT1M", + "renderComplete": "PT30S", + "waitForElements": "PT30S", + }, + "zoom": 2, + }, + "csv": Object { + "checkForFormulas": true, + "enablePanelActionDownload": true, + "escapeFormulaValues": false, + "maxSizeBytes": ByteSizeValue { + "valueInBytes": 10485760, + }, + "scroll": Object { + "duration": "30s", + "size": 500, + }, + "useByteOrderMarkEncoding": false, + }, + "enabled": true, + "encryptionKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "kibanaServer": Object {}, + "poll": Object { + "jobCompletionNotifier": Object { + "interval": 10000, + "intervalErrorMultiplier": 5, + }, + "jobsRefresh": Object { + "interval": 5000, + "intervalErrorMultiplier": 5, + }, + }, + "queue": Object { + "indexInterval": "week", + "pollEnabled": true, + "pollInterval": "PT3S", + "pollIntervalErrorMultiplier": 10, + "timeout": "PT2M", + }, + "roles": Object { + "allow": Array [ + "reporting_user", + ], + "enabled": true, + }, +} +`; + +exports[`Reporting Config Schema context {"dev":false,"dist":true} produces correct config 1`] = ` +Object { + "capture": Object { + "browser": Object { + "autoDownload": false, + "chromium": Object { + "inspect": false, + "proxy": Object { + "enabled": false, + }, + }, + "type": "chromium", + }, + "loadDelay": "PT3S", + "maxAttempts": 3, + "networkPolicy": Object { + "enabled": true, + "rules": Array [ + Object { + "allow": true, + "host": undefined, + "protocol": "http:", + }, + Object { + "allow": true, + "host": undefined, + "protocol": "https:", + }, + Object { + "allow": true, + "host": undefined, + "protocol": "ws:", + }, + Object { + "allow": true, + "host": undefined, + "protocol": "wss:", + }, + Object { + "allow": true, + "host": undefined, + "protocol": "data:", + }, + Object { + "allow": false, + "host": undefined, + "protocol": undefined, + }, + ], + }, + "timeouts": Object { + "openUrl": "PT1M", + "renderComplete": "PT30S", + "waitForElements": "PT30S", + }, + "zoom": 2, + }, + "csv": Object { + "checkForFormulas": true, + "enablePanelActionDownload": true, + "escapeFormulaValues": false, + "maxSizeBytes": ByteSizeValue { + "valueInBytes": 10485760, + }, + "scroll": Object { + "duration": "30s", + "size": 500, + }, + "useByteOrderMarkEncoding": false, + }, + "enabled": true, + "kibanaServer": Object {}, + "poll": Object { + "jobCompletionNotifier": Object { + "interval": 10000, + "intervalErrorMultiplier": 5, + }, + "jobsRefresh": Object { + "interval": 5000, + "intervalErrorMultiplier": 5, + }, + }, + "queue": Object { + "indexInterval": "week", + "pollEnabled": true, + "pollInterval": "PT3S", + "pollIntervalErrorMultiplier": 10, + "timeout": "PT2M", + }, + "roles": Object { + "allow": Array [ + "reporting_user", + ], + "enabled": true, + }, +} +`; diff --git a/x-pack/plugins/reporting/server/config/create_config.test.ts b/x-pack/plugins/reporting/server/config/create_config.test.ts index 718638e1ba62bb..3c5ecdc1dab0b9 100644 --- a/x-pack/plugins/reporting/server/config/create_config.test.ts +++ b/x-pack/plugins/reporting/server/config/create_config.test.ts @@ -43,10 +43,10 @@ describe('Reporting server createConfig$', () => { const result = await createConfig$(mockCoreSetup, mockConfig$, mockLogger).toPromise(); expect(result.encryptionKey).toMatch(/\S{32,}/); // random 32 characters - expect(mockLogger.warn.mock.calls.length).toBe(1); - expect(mockLogger.warn.mock.calls[0]).toMatchObject([ - 'Generating a random key for xpack.reporting.encryptionKey. To prevent sessions from being invalidated on restart, please set xpack.reporting.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command.', - ]); + expect(mockLogger.warn).toHaveBeenCalledTimes(1); + expect(mockLogger.warn).toHaveBeenCalledWith( + 'Generating a random key for xpack.reporting.encryptionKey. To prevent sessions from being invalidated on restart, please set xpack.reporting.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command.' + ); }); it('uses the user-provided encryption key', async () => { @@ -58,7 +58,7 @@ describe('Reporting server createConfig$', () => { const mockConfig$ = createMockConfig(mockInitContext); const result = await createConfig$(mockCoreSetup, mockConfig$, mockLogger).toPromise(); expect(result.encryptionKey).toMatch('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii'); - expect(mockLogger.warn.mock.calls.length).toBe(0); + expect(mockLogger.warn).not.toHaveBeenCalled(); }); it('uses the user-provided encryption key, reporting kibanaServer settings to override server info', async () => { @@ -103,7 +103,7 @@ describe('Reporting server createConfig$', () => { }, } `); - expect(mockLogger.warn.mock.calls.length).toBe(0); + expect(mockLogger.warn).not.toHaveBeenCalled(); }); it('uses user-provided disableSandbox: false', async () => { @@ -117,7 +117,7 @@ describe('Reporting server createConfig$', () => { const result = await createConfig$(mockCoreSetup, mockConfig$, mockLogger).toPromise(); expect(result.capture.browser.chromium).toMatchObject({ disableSandbox: false }); - expect(mockLogger.warn.mock.calls.length).toBe(0); + expect(mockLogger.warn).not.toHaveBeenCalled(); }); it('uses user-provided disableSandbox: true', async () => { @@ -131,7 +131,7 @@ describe('Reporting server createConfig$', () => { const result = await createConfig$(mockCoreSetup, mockConfig$, mockLogger).toPromise(); expect(result.capture.browser.chromium).toMatchObject({ disableSandbox: true }); - expect(mockLogger.warn.mock.calls.length).toBe(0); + expect(mockLogger.warn).not.toHaveBeenCalled(); }); it('provides a default for disableSandbox', async () => { @@ -144,18 +144,12 @@ describe('Reporting server createConfig$', () => { const result = await createConfig$(mockCoreSetup, mockConfig$, mockLogger).toPromise(); expect(result.capture.browser.chromium).toMatchObject({ disableSandbox: expect.any(Boolean) }); - expect(mockLogger.warn.mock.calls.length).toBe(0); + expect(mockLogger.warn).not.toHaveBeenCalled(); }); - for (const hostname of [ - '0', - '0.0', - '0.0.0', - '0.0.0.0', - '0000:0000:0000:0000:0000:0000:0000:0000', - '::', - ]) { - it(`apply failover logic when hostname is given as ${hostname}`, async () => { + it.each(['0', '0.0', '0.0.0', '0.0.0.0', '0000:0000:0000:0000:0000:0000:0000:0000', '::'])( + `apply failover logic when hostname is given as "%s"`, + async (hostname) => { mockInitContext = coreMock.createPluginInitializerContext( createMockConfigSchema({ encryptionKey: 'aaaaaaaaaaaaabbbbbbbbbbbbaaaaaaaaa', @@ -167,7 +161,7 @@ describe('Reporting server createConfig$', () => { }, }) ); - mockCoreSetup.http.getServerInfo = jest.fn().mockImplementation( + mockCoreSetup.http.getServerInfo = jest.fn( (): HttpServerInfo => ({ name: 'cool server', hostname, @@ -177,12 +171,16 @@ describe('Reporting server createConfig$', () => { ); const mockConfig$ = createMockConfig(mockInitContext); - const result = await createConfig$(mockCoreSetup, mockConfig$, mockLogger).toPromise(); - expect(result.kibanaServer).toMatchObject({ - hostname: 'localhost', - port: 5601, - protocol: 'http', - }); - }); - } + await expect( + createConfig$(mockCoreSetup, mockConfig$, mockLogger).toPromise() + ).resolves.toHaveProperty( + 'kibanaServer', + expect.objectContaining({ + hostname: 'localhost', + port: 5601, + protocol: 'http', + }) + ); + } + ); }); diff --git a/x-pack/plugins/reporting/server/config/index.ts b/x-pack/plugins/reporting/server/config/index.ts index c20b5e16c7f04f..fa836fd47cde36 100644 --- a/x-pack/plugins/reporting/server/config/index.ts +++ b/x-pack/plugins/reporting/server/config/index.ts @@ -11,7 +11,8 @@ import { get } from 'lodash'; import { ConfigSchema, ReportingConfigType } from './schema'; export { buildConfig } from './config'; export { registerUiSettings } from './ui_settings'; -export { ConfigSchema, ReportingConfigType }; +export type { ReportingConfigType }; +export { ConfigSchema }; export const config: PluginConfigDescriptor = { exposeToBrowser: { poll: true, roles: true }, diff --git a/x-pack/plugins/reporting/server/config/schema.test.ts b/x-pack/plugins/reporting/server/config/schema.test.ts index 7f1da5b55ccb67..c49490be87a15b 100644 --- a/x-pack/plugins/reporting/server/config/schema.test.ts +++ b/x-pack/plugins/reporting/server/config/schema.test.ts @@ -9,203 +9,11 @@ import { ConfigSchema } from './schema'; describe('Reporting Config Schema', () => { it(`context {"dev":false,"dist":false} produces correct config`, () => { - expect(ConfigSchema.validate({}, { dev: false, dist: false })).toMatchInlineSnapshot(` - Object { - "capture": Object { - "browser": Object { - "autoDownload": true, - "chromium": Object { - "proxy": Object { - "enabled": false, - }, - }, - "type": "chromium", - }, - "loadDelay": "PT3S", - "maxAttempts": 1, - "networkPolicy": Object { - "enabled": true, - "rules": Array [ - Object { - "allow": true, - "host": undefined, - "protocol": "http:", - }, - Object { - "allow": true, - "host": undefined, - "protocol": "https:", - }, - Object { - "allow": true, - "host": undefined, - "protocol": "ws:", - }, - Object { - "allow": true, - "host": undefined, - "protocol": "wss:", - }, - Object { - "allow": true, - "host": undefined, - "protocol": "data:", - }, - Object { - "allow": false, - "host": undefined, - "protocol": undefined, - }, - ], - }, - "timeouts": Object { - "openUrl": "PT1M", - "renderComplete": "PT30S", - "waitForElements": "PT30S", - }, - "zoom": 2, - }, - "csv": Object { - "checkForFormulas": true, - "enablePanelActionDownload": true, - "escapeFormulaValues": false, - "maxSizeBytes": ByteSizeValue { - "valueInBytes": 10485760, - }, - "scroll": Object { - "duration": "30s", - "size": 500, - }, - "useByteOrderMarkEncoding": false, - }, - "enabled": true, - "encryptionKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "kibanaServer": Object {}, - "poll": Object { - "jobCompletionNotifier": Object { - "interval": 10000, - "intervalErrorMultiplier": 5, - }, - "jobsRefresh": Object { - "interval": 5000, - "intervalErrorMultiplier": 5, - }, - }, - "queue": Object { - "indexInterval": "week", - "pollEnabled": true, - "pollInterval": "PT3S", - "pollIntervalErrorMultiplier": 10, - "timeout": "PT2M", - }, - "roles": Object { - "allow": Array [ - "reporting_user", - ], - "enabled": true, - }, - } - `); + expect(ConfigSchema.validate({}, { dev: false, dist: false })).toMatchSnapshot(); }); it(`context {"dev":false,"dist":true} produces correct config`, () => { - expect(ConfigSchema.validate({}, { dev: false, dist: true })).toMatchInlineSnapshot(` - Object { - "capture": Object { - "browser": Object { - "autoDownload": false, - "chromium": Object { - "inspect": false, - "proxy": Object { - "enabled": false, - }, - }, - "type": "chromium", - }, - "loadDelay": "PT3S", - "maxAttempts": 3, - "networkPolicy": Object { - "enabled": true, - "rules": Array [ - Object { - "allow": true, - "host": undefined, - "protocol": "http:", - }, - Object { - "allow": true, - "host": undefined, - "protocol": "https:", - }, - Object { - "allow": true, - "host": undefined, - "protocol": "ws:", - }, - Object { - "allow": true, - "host": undefined, - "protocol": "wss:", - }, - Object { - "allow": true, - "host": undefined, - "protocol": "data:", - }, - Object { - "allow": false, - "host": undefined, - "protocol": undefined, - }, - ], - }, - "timeouts": Object { - "openUrl": "PT1M", - "renderComplete": "PT30S", - "waitForElements": "PT30S", - }, - "zoom": 2, - }, - "csv": Object { - "checkForFormulas": true, - "enablePanelActionDownload": true, - "escapeFormulaValues": false, - "maxSizeBytes": ByteSizeValue { - "valueInBytes": 10485760, - }, - "scroll": Object { - "duration": "30s", - "size": 500, - }, - "useByteOrderMarkEncoding": false, - }, - "enabled": true, - "kibanaServer": Object {}, - "poll": Object { - "jobCompletionNotifier": Object { - "interval": 10000, - "intervalErrorMultiplier": 5, - }, - "jobsRefresh": Object { - "interval": 5000, - "intervalErrorMultiplier": 5, - }, - }, - "queue": Object { - "indexInterval": "week", - "pollEnabled": true, - "pollInterval": "PT3S", - "pollIntervalErrorMultiplier": 10, - "timeout": "PT2M", - }, - "roles": Object { - "allow": Array [ - "reporting_user", - ], - "enabled": true, - }, - } - `); + expect(ConfigSchema.validate({}, { dev: false, dist: true })).toMatchSnapshot(); }); it('allows Duration values for certain keys', () => { @@ -288,18 +96,20 @@ describe('Reporting Config Schema', () => { `); }); - for (const address of ['0', '0.0', '0.0.0']) { - it(`fails to validate "kibanaServer.hostname" with an invalid hostname: "${address}"`, () => { + it.each(['0', '0.0', '0.0.0'])( + `fails to validate "kibanaServer.hostname" with an invalid hostname: "%s"`, + (address) => { expect(() => ConfigSchema.validate({ kibanaServer: { hostname: address }, }) ).toThrowError(`[kibanaServer.hostname]: value must be a valid hostname (see RFC 1123).`); - }); - } + } + ); - for (const address of ['0.0.0.0', '0000:0000:0000:0000:0000:0000:0000:0000', '::']) { - it(`fails to validate "kibanaServer.hostname" hostname as zero: "${address}"`, () => { + it.each(['0.0.0.0', '0000:0000:0000:0000:0000:0000:0000:0000', '::'])( + `fails to validate "kibanaServer.hostname" hostname as zero: "%s"`, + (address) => { expect(() => ConfigSchema.validate({ kibanaServer: { hostname: address }, @@ -307,6 +117,6 @@ describe('Reporting Config Schema', () => { ).toThrowError( `[kibanaServer.hostname]: cannot use '0.0.0.0' as Kibana host name, consider using the default (localhost) instead` ); - }); - } + } + ); }); diff --git a/x-pack/plugins/reporting/server/export_types/csv/types.ts b/x-pack/plugins/reporting/server/export_types/csv/types.ts new file mode 100644 index 00000000000000..5531f2d670128f --- /dev/null +++ b/x-pack/plugins/reporting/server/export_types/csv/types.ts @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { + RawValue, + JobParamsDeprecatedCSV, + TaskPayloadDeprecatedCSV, + SearchRequestDeprecatedCSV, + SavedSearchGeneratorResultDeprecatedCSV, +} from '../../../common/types'; diff --git a/x-pack/plugins/reporting/server/export_types/csv_searchsource/types.ts b/x-pack/plugins/reporting/server/export_types/csv_searchsource/types.ts new file mode 100644 index 00000000000000..57e154eb2b26fc --- /dev/null +++ b/x-pack/plugins/reporting/server/export_types/csv_searchsource/types.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { RawValue, JobParamsCSV, TaskPayloadCSV } from '../../../common/types'; diff --git a/x-pack/plugins/reporting/server/export_types/csv_searchsource_immediate/types.ts b/x-pack/plugins/reporting/server/export_types/csv_searchsource_immediate/types.ts new file mode 100644 index 00000000000000..1475c0cc2cf634 --- /dev/null +++ b/x-pack/plugins/reporting/server/export_types/csv_searchsource_immediate/types.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { + FakeRequest, + JobParamsDownloadCSV, + SavedObjectServiceError, +} from '../../../common/types'; diff --git a/x-pack/plugins/reporting/server/export_types/png/types.ts b/x-pack/plugins/reporting/server/export_types/png/types.ts new file mode 100644 index 00000000000000..ccfca04b024990 --- /dev/null +++ b/x-pack/plugins/reporting/server/export_types/png/types.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { JobParamsPNG, TaskPayloadPNG } from '../../../common/types'; diff --git a/x-pack/plugins/reporting/server/export_types/png_v2/types.ts b/x-pack/plugins/reporting/server/export_types/png_v2/types.ts new file mode 100644 index 00000000000000..3773bfae2b3ff7 --- /dev/null +++ b/x-pack/plugins/reporting/server/export_types/png_v2/types.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { JobParamsPNGV2, TaskPayloadPNGV2 } from '../../../common/types'; diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf/types.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf/types.ts new file mode 100644 index 00000000000000..763fb8942b4707 --- /dev/null +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf/types.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { JobParamsPDF, TaskPayloadPDF, JobParamsPDFLegacy } from '../../../common/types'; diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf_v2/types.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf_v2/types.ts index a629eea9f21f7e..ba8427feda9145 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf_v2/types.ts +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf_v2/types.ts @@ -5,27 +5,4 @@ * 2.0. */ -import { LocatorParams } from '../../../common/types'; -import { LayoutParams } from '../../lib/layouts'; -import { BaseParams, BasePayload } from '../../types'; - -interface BaseParamsPDFV2 { - layout: LayoutParams; - - /** - * This value is used to re-create the same visual state as when the report was requested as well as navigate to the correct page. - */ - locatorParams: LocatorParams[]; -} - -// Job params: structure of incoming user request data, after being parsed from RISON -export type JobParamsPDFV2 = BaseParamsPDFV2 & BaseParams; - -// Job payload: structure of stored job data provided by create_job -export interface TaskPayloadPDFV2 extends BasePayload, BaseParamsPDFV2 { - layout: LayoutParams; - /** - * The value of forceNow is injected server-side every time a given report is generated. - */ - forceNow: string; -} +export type { JobParamsPDFV2, TaskPayloadPDFV2 } from '../../../common/types'; diff --git a/x-pack/plugins/reporting/server/index.ts b/x-pack/plugins/reporting/server/index.ts index bc6529eb90782c..2c851a9dffc1bf 100644 --- a/x-pack/plugins/reporting/server/index.ts +++ b/x-pack/plugins/reporting/server/index.ts @@ -13,10 +13,20 @@ export const plugin = (initContext: PluginInitializerContext ({ openUrl: { diff --git a/x-pack/plugins/reporting/server/lib/store/index.ts b/x-pack/plugins/reporting/server/lib/store/index.ts index 9ba8d44f19e653..e5f1c65e47948e 100644 --- a/x-pack/plugins/reporting/server/lib/store/index.ts +++ b/x-pack/plugins/reporting/server/lib/store/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -export { ReportDocument } from '../../../common/types'; +export type { ReportDocument } from '../../../common/types'; export { Report } from './report'; export { SavedReport } from './saved_report'; export { ReportingStore } from './store'; diff --git a/x-pack/plugins/reporting/server/lib/store/report.ts b/x-pack/plugins/reporting/server/lib/store/report.ts index 2feb162fbf37ea..2f802334eb6ff5 100644 --- a/x-pack/plugins/reporting/server/lib/store/report.ts +++ b/x-pack/plugins/reporting/server/lib/store/report.ts @@ -17,8 +17,8 @@ import { } from '../../../common/types'; import type { ReportTaskParams } from '../tasks'; -export { ReportDocument }; -export { ReportApiJSON, ReportSource }; +export type { ReportDocument }; +export type { ReportApiJSON, ReportSource }; const puid = new Puid(); export const MIGRATION_VERSION = '7.14.0'; diff --git a/x-pack/plugins/reporting/server/lib/tasks/index.ts b/x-pack/plugins/reporting/server/lib/tasks/index.ts index f464383c0b5334..6be8299d1d26a3 100644 --- a/x-pack/plugins/reporting/server/lib/tasks/index.ts +++ b/x-pack/plugins/reporting/server/lib/tasks/index.ts @@ -14,7 +14,7 @@ export const REPORTING_MONITOR_TYPE = 'reports:monitor'; export { ExecuteReportTask } from './execute_report'; export { MonitorReportsTask } from './monitor_reports'; -export { TaskRunResult }; +export type { TaskRunResult }; export interface ReportTaskParams { id: string; diff --git a/x-pack/plugins/reporting/server/types.ts b/x-pack/plugins/reporting/server/types.ts index 84fa6fb5b10d6e..af9a973b0bb451 100644 --- a/x-pack/plugins/reporting/server/types.ts +++ b/x-pack/plugins/reporting/server/types.ts @@ -57,7 +57,7 @@ export type ReportingUser = { username: AuthenticatedUser['username'] } | false; export type CaptureConfig = ReportingConfigType['capture']; export type ScrollConfig = ReportingConfigType['csv']['scroll']; -export { BaseParams, BasePayload }; +export type { BaseParams, BasePayload }; // default fn type for CreateJobFnFactory export type CreateJobFn = ( diff --git a/x-pack/plugins/rule_registry/server/index.ts b/x-pack/plugins/rule_registry/server/index.ts index d6c5b61706415c..d52cd0ebf608c9 100644 --- a/x-pack/plugins/rule_registry/server/index.ts +++ b/x-pack/plugins/rule_registry/server/index.ts @@ -12,9 +12,9 @@ import { PluginInitializerContext } from 'src/core/server'; import { RuleRegistryPlugin } from './plugin'; export type { RuleRegistryPluginSetupContract, RuleRegistryPluginStartContract } from './plugin'; -export { IRuleDataService, RuleDataPluginService } from './rule_data_plugin_service'; +export type { IRuleDataService, RuleDataPluginService } from './rule_data_plugin_service'; export { RuleDataClient } from './rule_data_client'; -export { IRuleDataClient } from './rule_data_client/types'; +export type { IRuleDataClient } from './rule_data_client/types'; export type { RacRequestHandlerContext, RacApiRequestHandlerContext, @@ -24,14 +24,15 @@ export type { export * from './config'; export * from './rule_data_plugin_service'; export * from './rule_data_client'; +export * from './alert_data_client/audit_events'; export { createLifecycleRuleTypeFactory } from './utils/create_lifecycle_rule_type_factory'; -export { +export type { LifecycleRuleExecutor, LifecycleAlertService, LifecycleAlertServices, - createLifecycleExecutor, } from './utils/create_lifecycle_executor'; +export { createLifecycleExecutor } from './utils/create_lifecycle_executor'; export { createPersistenceRuleTypeWrapper } from './utils/create_persistence_rule_type_wrapper'; export * from './utils/persistence_types'; export type { AlertsClient } from './alert_data_client/alerts_client'; diff --git a/x-pack/plugins/runtime_fields/public/components/index.ts b/x-pack/plugins/runtime_fields/public/components/index.ts index 8fbec39b4abfbd..47db4087dab6ef 100644 --- a/x-pack/plugins/runtime_fields/public/components/index.ts +++ b/x-pack/plugins/runtime_fields/public/components/index.ts @@ -5,11 +5,10 @@ * 2.0. */ -export { RuntimeFieldForm, FormState as RuntimeFieldFormState } from './runtime_field_form'; +export type { FormState as RuntimeFieldFormState } from './runtime_field_form'; +export { RuntimeFieldForm } from './runtime_field_form'; export { RuntimeFieldEditor } from './runtime_field_editor'; -export { - RuntimeFieldEditorFlyoutContent, - RuntimeFieldEditorFlyoutContentProps, -} from './runtime_field_editor_flyout_content'; +export type { RuntimeFieldEditorFlyoutContentProps } from './runtime_field_editor_flyout_content'; +export { RuntimeFieldEditorFlyoutContent } from './runtime_field_editor_flyout_content'; diff --git a/x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/index.ts b/x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/index.ts index 7ac0165fc9d411..e626cdb5b2312b 100644 --- a/x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/index.ts +++ b/x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/index.ts @@ -5,7 +5,5 @@ * 2.0. */ -export { - RuntimeFieldEditorFlyoutContent, - Props as RuntimeFieldEditorFlyoutContentProps, -} from './runtime_field_editor_flyout_content'; +export type { Props as RuntimeFieldEditorFlyoutContentProps } from './runtime_field_editor_flyout_content'; +export { RuntimeFieldEditorFlyoutContent } from './runtime_field_editor_flyout_content'; diff --git a/x-pack/plugins/runtime_fields/public/components/runtime_field_form/index.ts b/x-pack/plugins/runtime_fields/public/components/runtime_field_form/index.ts index bc8d6d8bdc1b34..a8f29539c4f2c3 100644 --- a/x-pack/plugins/runtime_fields/public/components/runtime_field_form/index.ts +++ b/x-pack/plugins/runtime_fields/public/components/runtime_field_form/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { RuntimeFieldForm, FormState } from './runtime_field_form'; +export type { FormState } from './runtime_field_form'; +export { RuntimeFieldForm } from './runtime_field_form'; diff --git a/x-pack/plugins/runtime_fields/public/index.ts b/x-pack/plugins/runtime_fields/public/index.ts index 1a3c6943c3a5cd..ece935d0d55719 100644 --- a/x-pack/plugins/runtime_fields/public/index.ts +++ b/x-pack/plugins/runtime_fields/public/index.ts @@ -7,14 +7,10 @@ import { RuntimeFieldsPlugin } from './plugin'; -export { - RuntimeFieldEditorFlyoutContent, - RuntimeFieldEditorFlyoutContentProps, - RuntimeFieldEditor, - RuntimeFieldFormState, -} from './components'; +export type { RuntimeFieldEditorFlyoutContentProps, RuntimeFieldFormState } from './components'; +export { RuntimeFieldEditorFlyoutContent, RuntimeFieldEditor } from './components'; export { RUNTIME_FIELD_OPTIONS } from './constants'; -export { RuntimeField, RuntimeType, PluginSetup as RuntimeFieldsSetup } from './types'; +export type { RuntimeField, RuntimeType, PluginSetup as RuntimeFieldsSetup } from './types'; export function plugin() { return new RuntimeFieldsPlugin(); diff --git a/x-pack/plugins/runtime_fields/public/shared_imports.ts b/x-pack/plugins/runtime_fields/public/shared_imports.ts index a6dd23440176a9..61b517a4e11171 100644 --- a/x-pack/plugins/runtime_fields/public/shared_imports.ts +++ b/x-pack/plugins/runtime_fields/public/shared_imports.ts @@ -5,15 +5,17 @@ * 2.0. */ +export type { + FormSchema, + FormHook, + ValidationFunc, + FieldConfig, +} from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; export { useForm, useFormData, Form, - FormSchema, UseField, - FormHook, - ValidationFunc, - FieldConfig, } from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; export { fieldValidators } from '../../../../src/plugins/es_ui_shared/static/forms/helpers'; diff --git a/x-pack/plugins/runtime_fields/public/test_utils.ts b/x-pack/plugins/runtime_fields/public/test_utils.ts index d3b02257c2ff2c..1c052cd666e568 100644 --- a/x-pack/plugins/runtime_fields/public/test_utils.ts +++ b/x-pack/plugins/runtime_fields/public/test_utils.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { registerTestBed, TestBed } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test/jest'; +export { registerTestBed } from '@kbn/test/jest'; diff --git a/x-pack/plugins/saved_objects_tagging/common/index.ts b/x-pack/plugins/saved_objects_tagging/common/index.ts index 500e656014e9a5..a513822adb5e05 100644 --- a/x-pack/plugins/saved_objects_tagging/common/index.ts +++ b/x-pack/plugins/saved_objects_tagging/common/index.ts @@ -5,11 +5,12 @@ * 2.0. */ -export { TagsCapabilities, getTagsCapabilities } from './capabilities'; +export type { TagsCapabilities } from './capabilities'; +export { getTagsCapabilities } from './capabilities'; export { tagFeatureId, tagSavedObjectTypeName, tagManagementSectionId } from './constants'; -export { TagWithRelations, TagAttributes, Tag, ITagsClient, TagSavedObject } from './types'; +export type { TagWithRelations, TagAttributes, Tag, ITagsClient, TagSavedObject } from './types'; +export type { TagValidation } from './validation'; export { - TagValidation, validateTagColor, validateTagName, validateTagDescription, diff --git a/x-pack/plugins/saved_objects_tagging/public/components/assign_flyout/index.ts b/x-pack/plugins/saved_objects_tagging/public/components/assign_flyout/index.ts index 2dc3449199cf63..d785d241edb6c3 100644 --- a/x-pack/plugins/saved_objects_tagging/public/components/assign_flyout/index.ts +++ b/x-pack/plugins/saved_objects_tagging/public/components/assign_flyout/index.ts @@ -5,9 +5,9 @@ * 2.0. */ -export { - getAssignFlyoutOpener, +export type { AssignFlyoutOpener, GetAssignFlyoutOpenerOptions, OpenAssignFlyoutOptions, } from './open_assign_flyout'; +export { getAssignFlyoutOpener } from './open_assign_flyout'; diff --git a/x-pack/plugins/saved_objects_tagging/public/components/base/index.ts b/x-pack/plugins/saved_objects_tagging/public/components/base/index.ts index 34500b978df00e..29c75be50a3926 100644 --- a/x-pack/plugins/saved_objects_tagging/public/components/base/index.ts +++ b/x-pack/plugins/saved_objects_tagging/public/components/base/index.ts @@ -5,7 +5,11 @@ * 2.0. */ -export { TagBadge, TagBadgeProps } from './tag_badge'; -export { TagList, TagListProps } from './tag_list'; -export { TagSelector, TagSelectorProps } from './tag_selector'; -export { TagSearchBarOption, TagSearchBarOptionProps } from './tag_searchbar_option'; +export type { TagBadgeProps } from './tag_badge'; +export { TagBadge } from './tag_badge'; +export type { TagListProps } from './tag_list'; +export { TagList } from './tag_list'; +export type { TagSelectorProps } from './tag_selector'; +export { TagSelector } from './tag_selector'; +export type { TagSearchBarOptionProps } from './tag_searchbar_option'; +export { TagSearchBarOption } from './tag_searchbar_option'; diff --git a/x-pack/plugins/saved_objects_tagging/public/components/edition_modal/index.ts b/x-pack/plugins/saved_objects_tagging/public/components/edition_modal/index.ts index 0436e8c57e59be..ac6994453443eb 100644 --- a/x-pack/plugins/saved_objects_tagging/public/components/edition_modal/index.ts +++ b/x-pack/plugins/saved_objects_tagging/public/components/edition_modal/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { getCreateModalOpener, getEditModalOpener, CreateModalOpener } from './open_modal'; +export type { CreateModalOpener } from './open_modal'; +export { getCreateModalOpener, getEditModalOpener } from './open_modal'; diff --git a/x-pack/plugins/saved_objects_tagging/public/components/index.ts b/x-pack/plugins/saved_objects_tagging/public/components/index.ts index c6142d8552bccd..5c7c491df9bd4e 100644 --- a/x-pack/plugins/saved_objects_tagging/public/components/index.ts +++ b/x-pack/plugins/saved_objects_tagging/public/components/index.ts @@ -5,13 +5,10 @@ * 2.0. */ -export { - TagSelector, +export type { TagSelectorProps, - TagList, TagListProps, - TagBadge, TagBadgeProps, - TagSearchBarOption, TagSearchBarOptionProps, } from './base'; +export { TagSelector, TagList, TagBadge, TagSearchBarOption } from './base'; diff --git a/x-pack/plugins/saved_objects_tagging/public/index.ts b/x-pack/plugins/saved_objects_tagging/public/index.ts index c110e629f0ca3a..1da147f4f168a2 100644 --- a/x-pack/plugins/saved_objects_tagging/public/index.ts +++ b/x-pack/plugins/saved_objects_tagging/public/index.ts @@ -8,8 +8,8 @@ import { PluginInitializerContext } from '../../../../src/core/public'; import { SavedObjectTaggingPlugin } from './plugin'; -export { SavedObjectTaggingPluginStart } from './types'; -export { Tag } from '../common'; +export type { SavedObjectTaggingPluginStart } from './types'; +export type { Tag } from '../common'; export const plugin = (initializerContext: PluginInitializerContext) => new SavedObjectTaggingPlugin(initializerContext); diff --git a/x-pack/plugins/saved_objects_tagging/public/management/actions/index.ts b/x-pack/plugins/saved_objects_tagging/public/management/actions/index.ts index a18ef5afd445f1..5503cec4af9dc3 100644 --- a/x-pack/plugins/saved_objects_tagging/public/management/actions/index.ts +++ b/x-pack/plugins/saved_objects_tagging/public/management/actions/index.ts @@ -14,7 +14,7 @@ import { getDeleteAction } from './delete'; import { getEditAction } from './edit'; import { getAssignAction } from './assign'; -export { TagAction } from './types'; +export type { TagAction } from './types'; interface GetActionsOptions { core: CoreStart; diff --git a/x-pack/plugins/saved_objects_tagging/public/services/assignments/index.ts b/x-pack/plugins/saved_objects_tagging/public/services/assignments/index.ts index 8b26da9cc5674e..763c70a93ab410 100644 --- a/x-pack/plugins/saved_objects_tagging/public/services/assignments/index.ts +++ b/x-pack/plugins/saved_objects_tagging/public/services/assignments/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { ITagAssignmentService, TagAssignmentService } from './assignment_service'; +export type { ITagAssignmentService } from './assignment_service'; +export { TagAssignmentService } from './assignment_service'; diff --git a/x-pack/plugins/saved_objects_tagging/public/services/index.ts b/x-pack/plugins/saved_objects_tagging/public/services/index.ts index 1909aaea5c4ee8..29d5ad7a7e0276 100644 --- a/x-pack/plugins/saved_objects_tagging/public/services/index.ts +++ b/x-pack/plugins/saved_objects_tagging/public/services/index.ts @@ -5,13 +5,12 @@ * 2.0. */ -export { +export type { ITagInternalClient, - TagsCache, ITagsCache, - TagsClient, ITagsChangeListener, - isServerValidationError, TagServerValidationError, } from './tags'; -export { TagAssignmentService, ITagAssignmentService } from './assignments'; +export { TagsCache, TagsClient, isServerValidationError } from './tags'; +export type { ITagAssignmentService } from './assignments'; +export { TagAssignmentService } from './assignments'; diff --git a/x-pack/plugins/saved_objects_tagging/public/services/tags/index.ts b/x-pack/plugins/saved_objects_tagging/public/services/tags/index.ts index 4b4e6d6c841231..b69f7124b0c8f7 100644 --- a/x-pack/plugins/saved_objects_tagging/public/services/tags/index.ts +++ b/x-pack/plugins/saved_objects_tagging/public/services/tags/index.ts @@ -5,6 +5,9 @@ * 2.0. */ -export { TagsClient, ITagInternalClient } from './tags_client'; -export { TagsCache, ITagsChangeListener, ITagsCache } from './tags_cache'; -export { isServerValidationError, TagServerValidationError } from './errors'; +export type { ITagInternalClient } from './tags_client'; +export { TagsClient } from './tags_client'; +export type { ITagsChangeListener, ITagsCache } from './tags_cache'; +export { TagsCache } from './tags_cache'; +export type { TagServerValidationError } from './errors'; +export { isServerValidationError } from './errors'; diff --git a/x-pack/plugins/saved_objects_tagging/public/services/tags/tags_cache.ts b/x-pack/plugins/saved_objects_tagging/public/services/tags/tags_cache.ts index 1d8fda1e5912d5..15d207aca47c05 100644 --- a/x-pack/plugins/saved_objects_tagging/public/services/tags/tags_cache.ts +++ b/x-pack/plugins/saved_objects_tagging/public/services/tags/tags_cache.ts @@ -11,7 +11,7 @@ import { takeUntil } from 'rxjs/operators'; import { ITagsCache } from '../../../../../../src/plugins/saved_objects_tagging_oss/public'; import { Tag, TagAttributes } from '../../../common/types'; -export { ITagsCache }; +export type { ITagsCache }; export interface ITagsChangeListener { onDelete: (id: string) => void; diff --git a/x-pack/plugins/saved_objects_tagging/server/services/assignments/index.ts b/x-pack/plugins/saved_objects_tagging/server/services/assignments/index.ts index c465f89369a1e1..7bf69b6c02304d 100644 --- a/x-pack/plugins/saved_objects_tagging/server/services/assignments/index.ts +++ b/x-pack/plugins/saved_objects_tagging/server/services/assignments/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { AssignmentService, IAssignmentService } from './assignment_service'; +export type { IAssignmentService } from './assignment_service'; +export { AssignmentService } from './assignment_service'; export { AssignmentError } from './errors'; diff --git a/x-pack/plugins/saved_objects_tagging/server/services/index.ts b/x-pack/plugins/saved_objects_tagging/server/services/index.ts index 695d90e496f603..36c5e32b816c69 100644 --- a/x-pack/plugins/saved_objects_tagging/server/services/index.ts +++ b/x-pack/plugins/saved_objects_tagging/server/services/index.ts @@ -6,4 +6,5 @@ */ export { TagsClient, savedObjectToTag, TagValidationError } from './tags'; -export { IAssignmentService, AssignmentService, AssignmentError } from './assignments'; +export type { IAssignmentService } from './assignments'; +export { AssignmentService, AssignmentError } from './assignments'; diff --git a/x-pack/plugins/searchprofiler/common/index.ts b/x-pack/plugins/searchprofiler/common/index.ts index 5b4f922231af30..154846bb3daa6c 100644 --- a/x-pack/plugins/searchprofiler/common/index.ts +++ b/x-pack/plugins/searchprofiler/common/index.ts @@ -7,4 +7,4 @@ export { PLUGIN } from './constants'; -export { LicenseStatus } from './types'; +export type { LicenseStatus } from './types'; diff --git a/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/index.ts b/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/index.ts index a48ee9be0c0d1a..3e1b4c208f1578 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/index.ts +++ b/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { HighlightDetailsFlyout, Props } from './highlight_details_flyout'; +export type { Props } from './highlight_details_flyout'; +export { HighlightDetailsFlyout } from './highlight_details_flyout'; diff --git a/x-pack/plugins/searchprofiler/public/application/components/index.ts b/x-pack/plugins/searchprofiler/public/application/components/index.ts index 86f7e2b6af5574..ea5ba226fc5f60 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/index.ts +++ b/x-pack/plugins/searchprofiler/public/application/components/index.ts @@ -7,7 +7,8 @@ export { SearchProfilerTabs } from './searchprofiler_tabs'; export { LicenseWarningNotice } from './license_warning_notice'; -export { ProfileTree, OnHighlightChangeArgs } from './profile_tree'; +export type { OnHighlightChangeArgs } from './profile_tree'; +export { ProfileTree } from './profile_tree'; export { HighlightDetailsFlyout } from './highlight_details_flyout'; export { ProfileLoadingPlaceholder } from './profile_loading_placeholder'; export { EmptyTreePlaceHolder } from './empty_tree_placeholder'; diff --git a/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/index.ts b/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/index.ts index 3d90bf26705251..5d8be480411769 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/index.ts +++ b/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { Editor, EditorInstance } from './editor'; +export type { EditorInstance } from './editor'; +export { Editor } from './editor'; diff --git a/x-pack/plugins/searchprofiler/public/application/components/profile_tree/index.ts b/x-pack/plugins/searchprofiler/public/application/components/profile_tree/index.ts index eb1eb29d7d09b1..8768c5b8b85f0c 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/profile_tree/index.ts +++ b/x-pack/plugins/searchprofiler/public/application/components/profile_tree/index.ts @@ -6,4 +6,4 @@ */ export { ProfileTree } from './profile_tree'; -export { OnHighlightChangeArgs } from './highlight_context'; +export type { OnHighlightChangeArgs } from './highlight_context'; diff --git a/x-pack/plugins/searchprofiler/public/application/store/index.ts b/x-pack/plugins/searchprofiler/public/application/store/index.ts index ce5a6fe832b8cc..ed350a47181d08 100644 --- a/x-pack/plugins/searchprofiler/public/application/store/index.ts +++ b/x-pack/plugins/searchprofiler/public/application/store/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { useStore, State } from './store'; -export { Action } from './reducer'; +export type { State } from './store'; +export { useStore } from './store'; +export type { Action } from './reducer'; diff --git a/x-pack/plugins/security/common/licensing/index.ts b/x-pack/plugins/security/common/licensing/index.ts index ec82007524fa4f..48329aeb999250 100644 --- a/x-pack/plugins/security/common/licensing/index.ts +++ b/x-pack/plugins/security/common/licensing/index.ts @@ -5,6 +5,7 @@ * 2.0. */ -export { SecurityLicenseService, SecurityLicense } from './license_service'; +export type { SecurityLicense } from './license_service'; +export { SecurityLicenseService } from './license_service'; -export { LoginLayout, SecurityLicenseFeatures } from './license_features'; +export type { LoginLayout, SecurityLicenseFeatures } from './license_features'; diff --git a/x-pack/plugins/security/common/model/index.ts b/x-pack/plugins/security/common/model/index.ts index 082e6bdc12cd07..bc1666af3200cc 100644 --- a/x-pack/plugins/security/common/model/index.ts +++ b/x-pack/plugins/security/common/model/index.ts @@ -5,17 +5,18 @@ * 2.0. */ -export { ApiKey, ApiKeyToInvalidate, ApiKeyRoleDescriptors } from './api_key'; -export { User, EditUser, getUserDisplayName } from './user'; -export { AuthenticatedUser, canUserChangePassword } from './authenticated_user'; -export { AuthenticationProvider, shouldProviderUseLoginForm } from './authentication_provider'; -export { BuiltinESPrivileges } from './builtin_es_privileges'; -export { RawKibanaPrivileges, RawKibanaFeaturePrivileges } from './raw_kibana_privileges'; -export { FeaturesPrivileges } from './features_privileges'; +export type { ApiKey, ApiKeyToInvalidate, ApiKeyRoleDescriptors } from './api_key'; +export type { User, EditUser } from './user'; +export { getUserDisplayName } from './user'; +export type { AuthenticatedUser } from './authenticated_user'; +export { canUserChangePassword } from './authenticated_user'; +export type { AuthenticationProvider } from './authentication_provider'; +export { shouldProviderUseLoginForm } from './authentication_provider'; +export type { BuiltinESPrivileges } from './builtin_es_privileges'; +export type { RawKibanaPrivileges, RawKibanaFeaturePrivileges } from './raw_kibana_privileges'; +export type { FeaturesPrivileges } from './features_privileges'; +export type { Role, RoleIndexPrivilege, RoleKibanaPrivilege } from './role'; export { - Role, - RoleIndexPrivilege, - RoleKibanaPrivilege, copyRole, isRoleDeprecated, isRoleReadOnly, @@ -26,14 +27,14 @@ export { prepareRoleClone, getExtendedRoleDeprecationNotice, } from './role'; -export { +export type { InlineRoleTemplate, StoredRoleTemplate, InvalidRoleTemplate, RoleTemplate, RoleMapping, } from './role_mapping'; -export { +export type { PrivilegeDeprecationsRolesByFeatureIdRequest, PrivilegeDeprecationsRolesByFeatureIdResponse, PrivilegeDeprecationsService, diff --git a/x-pack/plugins/security/public/authentication/index.ts b/x-pack/plugins/security/public/authentication/index.ts index 50d6b0c74376e7..dd7cb006d879e3 100644 --- a/x-pack/plugins/security/public/authentication/index.ts +++ b/x-pack/plugins/security/public/authentication/index.ts @@ -5,8 +5,8 @@ * 2.0. */ -export { - AuthenticationService, +export type { AuthenticationServiceSetup, AuthenticationServiceStart, } from './authentication_service'; +export { AuthenticationService } from './authentication_service'; diff --git a/x-pack/plugins/security/public/index.ts b/x-pack/plugins/security/public/index.ts index e8d5f739821ed6..55925e142ff24b 100644 --- a/x-pack/plugins/security/public/index.ts +++ b/x-pack/plugins/security/public/index.ts @@ -7,15 +7,20 @@ import type { PluginInitializer, PluginInitializerContext } from 'src/core/public'; -import type { PluginSetupDependencies, PluginStartDependencies } from './plugin'; -import { SecurityPlugin, SecurityPluginSetup, SecurityPluginStart } from './plugin'; +import type { + PluginSetupDependencies, + PluginStartDependencies, + SecurityPluginSetup, + SecurityPluginStart, +} from './plugin'; +import { SecurityPlugin } from './plugin'; -export { SecurityPluginSetup, SecurityPluginStart }; -export { AuthenticatedUser } from '../common/model'; -export { SecurityLicense, SecurityLicenseFeatures } from '../common/licensing'; -export { UserMenuLink, SecurityNavControlServiceStart } from '../public/nav_control'; +export type { SecurityPluginSetup, SecurityPluginStart }; +export type { AuthenticatedUser } from '../common/model'; +export type { SecurityLicense, SecurityLicenseFeatures } from '../common/licensing'; +export type { UserMenuLink, SecurityNavControlServiceStart } from '../public/nav_control'; -export { AuthenticationServiceStart, AuthenticationServiceSetup } from './authentication'; +export type { AuthenticationServiceStart, AuthenticationServiceSetup } from './authentication'; export const plugin: PluginInitializer< SecurityPluginSetup, diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/invalidate_provider/index.ts b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/invalidate_provider/index.ts index dc99861ce0a8db..3af1e9d37c17d0 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/invalidate_provider/index.ts +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/invalidate_provider/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { InvalidateProvider, InvalidateApiKeys } from './invalidate_provider'; +export type { InvalidateApiKeys } from './invalidate_provider'; +export { InvalidateProvider } from './invalidate_provider'; diff --git a/x-pack/plugins/security/public/management/role_mappings/model/index.ts b/x-pack/plugins/security/public/management/role_mappings/model/index.ts index 25e66bda350349..d80eb4d7d6943f 100644 --- a/x-pack/plugins/security/public/management/role_mappings/model/index.ts +++ b/x-pack/plugins/security/public/management/role_mappings/model/index.ts @@ -11,6 +11,7 @@ export { Rule } from './rule'; export { RuleGroup } from './rule_group'; export { ExceptAllRule } from './except_all_rule'; export { ExceptAnyRule } from './except_any_rule'; -export { FieldRule, FieldRuleValue } from './field_rule'; +export type { FieldRuleValue } from './field_rule'; +export { FieldRule } from './field_rule'; export { generateRulesFromRaw } from './rule_builder'; export { RuleBuilderError } from './rule_builder_error'; diff --git a/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx b/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx index f61b2ac2f80564..b8e98042b1cffe 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx @@ -28,7 +28,13 @@ const userMock = { roles: ['superuser'], }; -describe('EditUserPage', () => { +// FLAKY: https://github.com/elastic/kibana/issues/115473 +// FLAKY: https://github.com/elastic/kibana/issues/115474 +// FLAKY: https://github.com/elastic/kibana/issues/116889 +// FLAKY: https://github.com/elastic/kibana/issues/117081 +// FLAKY: https://github.com/elastic/kibana/issues/116891 +// FLAKY: https://github.com/elastic/kibana/issues/116890 +describe.skip('EditUserPage', () => { const coreStart = coreMock.createStart(); let history = createMemoryHistory({ initialEntries: ['/edit/jdoe'] }); const authc = securityMock.createSetup().authc; diff --git a/x-pack/plugins/security/public/nav_control/index.ts b/x-pack/plugins/security/public/nav_control/index.ts index 5ec306fa971706..95331b7504070c 100644 --- a/x-pack/plugins/security/public/nav_control/index.ts +++ b/x-pack/plugins/security/public/nav_control/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { SecurityNavControlService, SecurityNavControlServiceStart } from './nav_control_service'; +export type { SecurityNavControlServiceStart } from './nav_control_service'; +export { SecurityNavControlService } from './nav_control_service'; export type { UserMenuLink } from './nav_control_component'; diff --git a/x-pack/plugins/security/server/anonymous_access/index.ts b/x-pack/plugins/security/server/anonymous_access/index.ts index 2d86cb3a3e3b4f..6e41ab1bae7809 100644 --- a/x-pack/plugins/security/server/anonymous_access/index.ts +++ b/x-pack/plugins/security/server/anonymous_access/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { AnonymousAccessService, AnonymousAccessServiceStart } from './anonymous_access_service'; +export type { AnonymousAccessServiceStart } from './anonymous_access_service'; +export { AnonymousAccessService } from './anonymous_access_service'; diff --git a/x-pack/plugins/security/server/audit/index.ts b/x-pack/plugins/security/server/audit/index.ts index 5cae122c94cc34..b859e773552a3e 100644 --- a/x-pack/plugins/security/server/audit/index.ts +++ b/x-pack/plugins/security/server/audit/index.ts @@ -5,9 +5,10 @@ * 2.0. */ -export { AuditService, AuditServiceSetup, AuditLogger } from './audit_service'; +export type { AuditServiceSetup, AuditLogger } from './audit_service'; +export { AuditService } from './audit_service'; +export type { AuditEvent } from './audit_events'; export { - AuditEvent, userLoginEvent, accessAgreementAcknowledgedEvent, httpRequestEvent, diff --git a/x-pack/plugins/security/server/authentication/api_keys/index.ts b/x-pack/plugins/security/server/authentication/api_keys/index.ts index b14d09d5597009..44fe48f04debbf 100644 --- a/x-pack/plugins/security/server/authentication/api_keys/index.ts +++ b/x-pack/plugins/security/server/authentication/api_keys/index.ts @@ -5,11 +5,11 @@ * 2.0. */ -export { - APIKeys, +export type { CreateAPIKeyResult, InvalidateAPIKeyResult, CreateAPIKeyParams, InvalidateAPIKeysParams, GrantAPIKeyResult, } from './api_keys'; +export { APIKeys } from './api_keys'; diff --git a/x-pack/plugins/security/server/authentication/index.ts b/x-pack/plugins/security/server/authentication/index.ts index 1e46d2aaf560ed..f6f6f1da369527 100644 --- a/x-pack/plugins/security/server/authentication/index.ts +++ b/x-pack/plugins/security/server/authentication/index.ts @@ -6,11 +6,11 @@ */ export { canRedirectRequest } from './can_redirect_request'; -export { - AuthenticationService, +export type { AuthenticationServiceStart, InternalAuthenticationServiceStart, } from './authentication_service'; +export { AuthenticationService } from './authentication_service'; export { AuthenticationResult } from './authentication_result'; export { DeauthenticationResult } from './deauthentication_result'; export { diff --git a/x-pack/plugins/security/server/authentication/providers/index.ts b/x-pack/plugins/security/server/authentication/providers/index.ts index c589371331eafa..31f89889b38928 100644 --- a/x-pack/plugins/security/server/authentication/providers/index.ts +++ b/x-pack/plugins/security/server/authentication/providers/index.ts @@ -5,11 +5,8 @@ * 2.0. */ -export { - BaseAuthenticationProvider, - AuthenticationProviderOptions, - AuthenticationProviderSpecificOptions, -} from './base'; +export type { AuthenticationProviderOptions, AuthenticationProviderSpecificOptions } from './base'; +export { BaseAuthenticationProvider } from './base'; export { AnonymousAuthenticationProvider } from './anonymous'; export { BasicAuthenticationProvider } from './basic'; export { KerberosAuthenticationProvider } from './kerberos'; diff --git a/x-pack/plugins/security/server/authorization/authorization_service.tsx b/x-pack/plugins/security/server/authorization/authorization_service.tsx index 72f2c9843daece..004c82d2c3f3f9 100644 --- a/x-pack/plugins/security/server/authorization/authorization_service.tsx +++ b/x-pack/plugins/security/server/authorization/authorization_service.tsx @@ -50,7 +50,7 @@ import { validateFeaturePrivileges } from './validate_feature_privileges'; import { validateReservedPrivileges } from './validate_reserved_privileges'; export { Actions } from './actions'; -export { CheckSavedObjectsPrivileges } from './check_saved_objects_privileges'; +export type { CheckSavedObjectsPrivileges } from './check_saved_objects_privileges'; interface AuthorizationServiceSetupParams { packageVersion: string; diff --git a/x-pack/plugins/security/server/authorization/index.ts b/x-pack/plugins/security/server/authorization/index.ts index 221baa85a65f63..265ec2dce5a31e 100644 --- a/x-pack/plugins/security/server/authorization/index.ts +++ b/x-pack/plugins/security/server/authorization/index.ts @@ -6,11 +6,12 @@ */ export { Actions } from './actions'; -export { - AuthorizationService, +export type { AuthorizationServiceSetup, AuthorizationServiceSetupInternal, } from './authorization_service'; -export { CheckSavedObjectsPrivileges } from './check_saved_objects_privileges'; -export { CheckPrivilegesPayload } from './types'; -export { transformElasticsearchRoleToRole, ElasticsearchRole } from './roles'; +export { AuthorizationService } from './authorization_service'; +export type { CheckSavedObjectsPrivileges } from './check_saved_objects_privileges'; +export type { CheckPrivilegesPayload } from './types'; +export type { ElasticsearchRole } from './roles'; +export { transformElasticsearchRoleToRole } from './roles'; diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/index.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/index.ts index 81d13390523014..d46f30ef53ab4d 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/index.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/index.ts @@ -14,13 +14,13 @@ import { FeaturePrivilegeApiBuilder } from './api'; import { FeaturePrivilegeAppBuilder } from './app'; import { FeaturePrivilegeCasesBuilder } from './cases'; import { FeaturePrivilegeCatalogueBuilder } from './catalogue'; -import { FeaturePrivilegeBuilder } from './feature_privilege_builder'; +import type { FeaturePrivilegeBuilder } from './feature_privilege_builder'; import { FeaturePrivilegeManagementBuilder } from './management'; import { FeaturePrivilegeNavlinkBuilder } from './navlink'; import { FeaturePrivilegeSavedObjectBuilder } from './saved_object'; import { FeaturePrivilegeUIBuilder } from './ui'; -export { FeaturePrivilegeBuilder }; +export type { FeaturePrivilegeBuilder }; export const featurePrivilegeBuilderFactory = (actions: Actions): FeaturePrivilegeBuilder => { const builders = [ diff --git a/x-pack/plugins/security/server/authorization/privileges/index.ts b/x-pack/plugins/security/server/authorization/privileges/index.ts index 31c9cf2713c9d8..7e98730abd71ee 100644 --- a/x-pack/plugins/security/server/authorization/privileges/index.ts +++ b/x-pack/plugins/security/server/authorization/privileges/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { privilegesFactory, PrivilegesService } from './privileges'; +export type { PrivilegesService } from './privileges'; +export { privilegesFactory } from './privileges'; diff --git a/x-pack/plugins/security/server/authorization/roles/index.ts b/x-pack/plugins/security/server/authorization/roles/index.ts index a5047a1872c092..205c339b45fbc8 100644 --- a/x-pack/plugins/security/server/authorization/roles/index.ts +++ b/x-pack/plugins/security/server/authorization/roles/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { transformElasticsearchRoleToRole, ElasticsearchRole } from './elasticsearch_role'; +export type { ElasticsearchRole } from './elasticsearch_role'; +export { transformElasticsearchRoleToRole } from './elasticsearch_role'; diff --git a/x-pack/plugins/security/server/elasticsearch/index.ts b/x-pack/plugins/security/server/elasticsearch/index.ts index 1c3bdd3054dd74..46acb874f7fc28 100644 --- a/x-pack/plugins/security/server/elasticsearch/index.ts +++ b/x-pack/plugins/security/server/elasticsearch/index.ts @@ -8,8 +8,8 @@ import type { AuthenticatedUser } from '../../common/model'; export type AuthenticationInfo = Omit; -export { - ElasticsearchService, +export type { ElasticsearchServiceStart, OnlineStatusRetryScheduler, } from './elasticsearch_service'; +export { ElasticsearchService } from './elasticsearch_service'; diff --git a/x-pack/plugins/security/server/feature_usage/index.ts b/x-pack/plugins/security/server/feature_usage/index.ts index 81d4336ef7bbbf..b58dacfa97d3a8 100644 --- a/x-pack/plugins/security/server/feature_usage/index.ts +++ b/x-pack/plugins/security/server/feature_usage/index.ts @@ -5,7 +5,5 @@ * 2.0. */ -export { - SecurityFeatureUsageService, - SecurityFeatureUsageServiceStart, -} from './feature_usage_service'; +export type { SecurityFeatureUsageServiceStart } from './feature_usage_service'; +export { SecurityFeatureUsageService } from './feature_usage_service'; diff --git a/x-pack/plugins/security/server/index.ts b/x-pack/plugins/security/server/index.ts index d1600b52df0adb..10b1e8167c14aa 100644 --- a/x-pack/plugins/security/server/index.ts +++ b/x-pack/plugins/security/server/index.ts @@ -29,11 +29,11 @@ export type { } from './authentication'; export type { CheckPrivilegesPayload } from './authorization'; export type AuthorizationServiceSetup = SecurityPluginStart['authz']; -export { AuditLogger, AuditEvent } from './audit'; +export type { AuditLogger, AuditEvent } from './audit'; export type { SecurityPluginSetup, SecurityPluginStart }; export type { AuthenticatedUser } from '../common/model'; export { ROUTE_TAG_CAN_REDIRECT } from './routes/tags'; -export { AuditServiceSetup } from './audit'; +export type { AuditServiceSetup } from './audit'; export const config: PluginConfigDescriptor> = { schema: ConfigSchema, diff --git a/x-pack/plugins/security/server/routes/authorization/roles/model/index.ts b/x-pack/plugins/security/server/routes/authorization/roles/model/index.ts index e090cd26dc39fc..cb5bb8a91152c0 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/model/index.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/model/index.ts @@ -5,5 +5,6 @@ * 2.0. */ -export { ElasticsearchRole, transformElasticsearchRoleToRole } from '../../../../authorization'; +export type { ElasticsearchRole } from '../../../../authorization'; +export { transformElasticsearchRoleToRole } from '../../../../authorization'; export { getPutPayloadSchema, transformPutPayloadToElasticsearchRole } from './put_payload'; diff --git a/x-pack/plugins/security/server/session_management/index.ts b/x-pack/plugins/security/server/session_management/index.ts index a9ac23ad6354be..09787ed419854d 100644 --- a/x-pack/plugins/security/server/session_management/index.ts +++ b/x-pack/plugins/security/server/session_management/index.ts @@ -5,8 +5,7 @@ * 2.0. */ -export { Session, SessionValue } from './session'; -export { - SessionManagementServiceStart, - SessionManagementService, -} from './session_management_service'; +export type { SessionValue } from './session'; +export { Session } from './session'; +export type { SessionManagementServiceStart } from './session_management_service'; +export { SessionManagementService } from './session_management_service'; diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/export_rules_details_schema.mock.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/export_rules_details_schema.mock.ts new file mode 100644 index 00000000000000..a47d57c2991172 --- /dev/null +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/export_rules_details_schema.mock.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 { ExportRulesDetails } from './export_rules_details_schema'; +import { + ExportExceptionDetailsMock, + getExceptionExportDetailsMock, +} from '../../../../../lists/common/schemas/response/exception_export_details_schema.mock'; + +interface RuleDetailsMock { + totalCount?: number; + rulesCount?: number; + missingCount?: number; + missingRules?: Array>; +} + +export const getOutputDetailsSample = (ruleDetails?: RuleDetailsMock): ExportRulesDetails => ({ + exported_count: ruleDetails?.totalCount ?? 0, + exported_rules_count: ruleDetails?.rulesCount ?? 0, + missing_rules: ruleDetails?.missingRules ?? [], + missing_rules_count: ruleDetails?.missingCount ?? 0, +}); + +export const getOutputDetailsSampleWithExceptions = ( + ruleDetails?: RuleDetailsMock, + exceptionDetails?: ExportExceptionDetailsMock +): ExportRulesDetails => ({ + ...getOutputDetailsSample(ruleDetails), + ...getExceptionExportDetailsMock(exceptionDetails), +}); + +export const getSampleDetailsAsNdjson = (sample: ExportRulesDetails): string => { + return `${JSON.stringify(sample)}\n`; +}; diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/export_rules_details_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/export_rules_details_schema.test.ts new file mode 100644 index 00000000000000..af0295ee460466 --- /dev/null +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/export_rules_details_schema.test.ts @@ -0,0 +1,60 @@ +/* + * Copyright 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. + */ + +/* + * Copyright 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 { pipe } from 'fp-ts/lib/pipeable'; +import { left } from 'fp-ts/lib/Either'; +import { exactCheck, foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils'; + +import { + getOutputDetailsSample, + getOutputDetailsSampleWithExceptions, +} from './export_rules_details_schema.mock'; +import { + ExportRulesDetails, + exportRulesDetailsWithExceptionsSchema, +} from './export_rules_details_schema'; + +describe('exportRulesDetailsWithExceptionsSchema', () => { + test('it should validate export details response', () => { + const payload = getOutputDetailsSample(); + const decoded = exportRulesDetailsWithExceptionsSchema.decode(payload); + const checked = exactCheck(payload, decoded); + const message = pipe(checked, foldLeftRight); + + expect(getPaths(left(message.errors))).toEqual([]); + expect(message.schema).toEqual(payload); + }); + + test('it should validate export details with exceptions details response', () => { + const payload = getOutputDetailsSampleWithExceptions(); + const decoded = exportRulesDetailsWithExceptionsSchema.decode(payload); + const checked = exactCheck(payload, decoded); + const message = pipe(checked, foldLeftRight); + + expect(getPaths(left(message.errors))).toEqual([]); + expect(message.schema).toEqual(payload); + }); + + test('it should strip out extra keys', () => { + const payload: ExportRulesDetails & { + extraKey?: string; + } = getOutputDetailsSample(); + payload.extraKey = 'some extra key'; + const decoded = exportRulesDetailsWithExceptionsSchema.decode(payload); + const message = pipe(decoded, foldLeftRight); + + expect(getPaths(left(message.errors))).toEqual([]); + expect(message.schema).toEqual(getOutputDetailsSample()); + }); +}); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/export_rules_details_schema.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/export_rules_details_schema.ts new file mode 100644 index 00000000000000..00e34ca9d73262 --- /dev/null +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/export_rules_details_schema.ts @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import * as t from 'io-ts'; +import { exportExceptionDetails } from '@kbn/securitysolution-io-ts-list-types'; +import { NonEmptyString } from '@kbn/securitysolution-io-ts-types'; + +const createSchema = ( + requiredFields: Required, + optionalFields: Optional +) => { + return t.intersection([t.exact(t.type(requiredFields)), t.exact(t.partial(optionalFields))]); +}; + +export const exportRulesDetails = { + exported_count: t.number, + exported_rules_count: t.number, + missing_rules: t.array( + t.exact( + t.type({ + rule_id: NonEmptyString, + }) + ) + ), + missing_rules_count: t.number, +}; + +const exportRulesDetailsSchema = t.exact(t.type(exportRulesDetails)); +export type ExportRulesDetailsSchema = t.TypeOf; + +// With exceptions +export const exportRulesDetailsWithExceptionsSchema = createSchema( + exportRulesDetails, + exportExceptionDetails +); + +export type ExportRulesDetails = t.TypeOf; diff --git a/x-pack/plugins/security_solution/common/experimental_features.ts b/x-pack/plugins/security_solution/common/experimental_features.ts index b6a0724faebedf..4fd1b00ae3bee5 100644 --- a/x-pack/plugins/security_solution/common/experimental_features.ts +++ b/x-pack/plugins/security_solution/common/experimental_features.ts @@ -21,6 +21,7 @@ export const allowedExperimentalValues = Object.freeze({ uebaEnabled: false, disableIsolationUIPendingStatuses: false, riskyHostsEnabled: false, + pendingActionResponsesWithAck: true, }); type ExperimentalConfigKeys = Array; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/alerts.ts b/x-pack/plugins/security_solution/common/field_maps/alerts.ts similarity index 98% rename from x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/alerts.ts rename to x-pack/plugins/security_solution/common/field_maps/alerts.ts index 5a7ceb83baf8ce..08ce8f098f6fd8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/alerts.ts +++ b/x-pack/plugins/security_solution/common/field_maps/alerts.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FieldMap } from '../../../../../../rule_registry/common/field_map'; +import { FieldMap } from '../../../rule_registry/common/field_map'; export const alertsFieldMap: FieldMap = { 'kibana.alert.ancestors': { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/field_names.ts b/x-pack/plugins/security_solution/common/field_maps/field_names.ts similarity index 90% rename from x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/field_names.ts rename to x-pack/plugins/security_solution/common/field_maps/field_names.ts index 62c20217d23f0b..1cb40063202d0a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/field_names.ts +++ b/x-pack/plugins/security_solution/common/field_maps/field_names.ts @@ -13,6 +13,7 @@ export const ALERT_DEPTH = `${ALERT_NAMESPACE}.depth` as const; export const ALERT_GROUP_ID = `${ALERT_NAMESPACE}.group.id` as const; export const ALERT_GROUP_INDEX = `${ALERT_NAMESPACE}.group.index` as const; export const ALERT_ORIGINAL_TIME = `${ALERT_NAMESPACE}.original_time` as const; +export const ALERT_THRESHOLD_RESULT = `${ALERT_NAMESPACE}.threshold_result` as const; export const ALERT_ORIGINAL_EVENT = `${ALERT_NAMESPACE}.original_event` as const; export const ALERT_ORIGINAL_EVENT_ACTION = `${ALERT_ORIGINAL_EVENT}.action` as const; @@ -24,3 +25,4 @@ export const ALERT_ORIGINAL_EVENT_TYPE = `${ALERT_ORIGINAL_EVENT}.type` as const export const ALERT_RULE_THRESHOLD = `${ALERT_RULE_NAMESPACE}.threshold` as const; export const ALERT_RULE_THRESHOLD_FIELD = `${ALERT_RULE_THRESHOLD}.field` as const; +export const ALERT_RULE_TIMELINE_ID = `${ALERT_RULE_NAMESPACE}.timeline_id` as const; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/index.ts b/x-pack/plugins/security_solution/common/field_maps/index.ts similarity index 80% rename from x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/index.ts rename to x-pack/plugins/security_solution/common/field_maps/index.ts index 0f19e2b3d3a918..e293dac6638168 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/index.ts +++ b/x-pack/plugins/security_solution/common/field_maps/index.ts @@ -7,4 +7,5 @@ import { AlertsFieldMap, alertsFieldMap } from './alerts'; import { RulesFieldMap, rulesFieldMap } from './rules'; -export { AlertsFieldMap, RulesFieldMap, alertsFieldMap, rulesFieldMap }; +export type { AlertsFieldMap, RulesFieldMap }; +export { alertsFieldMap, rulesFieldMap }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/rules.ts b/x-pack/plugins/security_solution/common/field_maps/rules.ts similarity index 100% rename from x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/rules.ts rename to x-pack/plugins/security_solution/common/field_maps/rules.ts diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts index 49c2dd4b417171..e5b2c4eed3b003 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts @@ -54,6 +54,7 @@ describe('Alerts timeline', () => { loadDetectionsPage(ROLES.platform_engineer); }); + // Skipping due to alerts not refreshing for platform_engineer despite being returned from API? it.skip('should allow a user with crud privileges to attach alerts to cases', () => { cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click({ force: true }); cy.get(ATTACH_ALERT_TO_CASE_BUTTON).first().should('not.be.disabled'); diff --git a/x-pack/plugins/security_solution/cypress/objects/rule.ts b/x-pack/plugins/security_solution/cypress/objects/rule.ts index ae04e20dfe86eb..0a9eecf83c7fc9 100644 --- a/x-pack/plugins/security_solution/cypress/objects/rule.ts +++ b/x-pack/plugins/security_solution/cypress/objects/rule.ts @@ -419,7 +419,63 @@ export const getEditedRule = (): CustomRule => ({ }); export const expectedExportedRule = (ruleResponse: Cypress.Response): string => { - const jsonrule = ruleResponse.body; - - return `{"id":"${jsonrule.id}","updated_at":"${jsonrule.updated_at}","updated_by":"elastic","created_at":"${jsonrule.created_at}","created_by":"elastic","name":"${jsonrule.name}","tags":[],"interval":"100m","enabled":false,"description":"${jsonrule.description}","risk_score":${jsonrule.risk_score},"severity":"${jsonrule.severity}","output_index":".siem-signals-default","author":[],"false_positives":[],"from":"now-50000h","rule_id":"rule_testing","max_signals":100,"risk_score_mapping":[],"severity_mapping":[],"threat":[],"to":"now","references":[],"version":1,"exceptions_list":[],"immutable":false,"type":"query","language":"kuery","index":["exceptions-*"],"query":"${jsonrule.query}","throttle":"no_actions","actions":[]}\n{"exported_rules_count":1,"missing_rules":[],"missing_rules_count":0,"exported_exception_list_count":0,"exported_exception_list_item_count":0,"missing_exception_list_item_count":0,"missing_exception_list_items":[],"missing_exception_lists":[],"missing_exception_lists_count":0}\n`; + const { + id, + updated_at: updatedAt, + updated_by: updatedBy, + created_at: createdAt, + description, + name, + risk_score: riskScore, + severity, + query, + } = ruleResponse.body; + const rule = { + id, + updated_at: updatedAt, + updated_by: updatedBy, + created_at: createdAt, + created_by: 'elastic', + name, + tags: [], + interval: '100m', + enabled: false, + description, + risk_score: riskScore, + severity, + output_index: '.siem-signals-default', + author: [], + false_positives: [], + from: 'now-50000h', + rule_id: 'rule_testing', + max_signals: 100, + risk_score_mapping: [], + severity_mapping: [], + threat: [], + to: 'now', + references: [], + version: 1, + exceptions_list: [], + immutable: false, + type: 'query', + language: 'kuery', + index: ['exceptions-*'], + query, + throttle: 'no_actions', + actions: [], + }; + const details = { + exported_count: 1, + exported_rules_count: 1, + missing_rules: [], + missing_rules_count: 0, + exported_exception_list_count: 0, + exported_exception_list_item_count: 0, + missing_exception_list_item_count: 0, + missing_exception_list_items: [], + missing_exception_lists: [], + missing_exception_lists_count: 0, + }; + + return `${JSON.stringify(rule)}\n${JSON.stringify(details)}\n`; }; diff --git a/x-pack/plugins/security_solution/public/common/containers/source/index.tsx b/x-pack/plugins/security_solution/public/common/containers/source/index.tsx index a894dbdd1dda7c..846d3a4b426e6f 100644 --- a/x-pack/plugins/security_solution/public/common/containers/source/index.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/source/index.tsx @@ -28,7 +28,7 @@ import { sourcererActions, sourcererSelectors } from '../../store/sourcerer'; import { DocValueFields } from '../../../../common/search_strategy/common'; import { useAppToasts } from '../../hooks/use_app_toasts'; -export { BrowserField, BrowserFields, DocValueFields }; +export type { BrowserField, BrowserFields, DocValueFields }; export const getAllBrowserFields = (browserFields: BrowserFields): Array> => Object.values(browserFields).reduce>>( diff --git a/x-pack/plugins/security_solution/public/common/store/routing/index.ts b/x-pack/plugins/security_solution/public/common/store/routing/index.ts index 1b13b70063f55b..2ea4a93a817583 100644 --- a/x-pack/plugins/security_solution/public/common/store/routing/index.ts +++ b/x-pack/plugins/security_solution/public/common/store/routing/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { RoutingAction } from './action'; +export type { RoutingAction } from './action'; diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx index fb958c775e68c3..213f8c78e3b8d9 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx @@ -7,12 +7,21 @@ /* eslint-disable complexity */ -import dateMath from '@elastic/datemath'; -import { getOr, isEmpty } from 'lodash/fp'; +import { get, getOr, isEmpty } from 'lodash/fp'; import moment from 'moment'; -import { i18n } from '@kbn/i18n'; + +import dateMath from '@elastic/datemath'; import { FilterStateStore, Filter } from '@kbn/es-query'; +import { i18n } from '@kbn/i18n'; +import { ALERT_RULE_FROM, ALERT_RULE_TYPE, ALERT_RULE_NOTE } from '@kbn/rule-data-utils'; + +import { + ALERT_ORIGINAL_TIME, + ALERT_GROUP_ID, + ALERT_RULE_TIMELINE_ID, + ALERT_THRESHOLD_RESULT, +} from '../../../../common/field_maps/field_names'; import { KueryFilterQueryKind, TimelineId, @@ -40,6 +49,7 @@ import { formatTimelineResultToModel, } from '../../../timelines/components/open_timeline/helpers'; import { convertKueryToElasticSearchQuery } from '../../../common/lib/keury'; +import { getField } from '../../../helpers'; import { replaceTemplateFieldFromQuery, replaceTemplateFieldFromMatchFilters, @@ -68,10 +78,18 @@ export const getUpdateAlertsQuery = (eventIds: Readonly) => { export const getFilterAndRuleBounds = ( data: TimelineNonEcsData[][] ): [string[], number, number] => { - const stringFilter = data?.[0].filter((d) => d.field === 'signal.rule.filters')?.[0]?.value ?? []; + const stringFilter = + data?.[0].filter( + (d) => d.field === 'signal.rule.filters' || d.field === 'kibana.alert.rule.filters' + )?.[0]?.value ?? []; const eventTimes = data - .flatMap((alert) => alert.filter((d) => d.field === 'signal.original_time')?.[0]?.value ?? []) + .flatMap( + (alert) => + alert.filter( + (d) => d.field === 'signal.original_time' || d.field === 'kibana.alert.original_time' + )?.[0]?.value ?? [] + ) .map((d) => moment(d)); return [stringFilter, moment.min(eventTimes).valueOf(), moment.max(eventTimes).valueOf()]; @@ -134,10 +152,9 @@ export const determineToAndFrom = ({ ecs }: { ecs: Ecs[] | Ecs }) => { }; } const ecsData = ecs as Ecs; + const ruleFrom = getField(ecsData, ALERT_RULE_FROM); const elapsedTimeRule = moment.duration( - moment().diff( - dateMath.parse(ecsData?.signal?.rule?.from != null ? ecsData.signal?.rule?.from[0] : 'now-0s') - ) + moment().diff(dateMath.parse(ruleFrom != null ? ruleFrom[0] : 'now-0s')) ); const from = moment(ecsData?.timestamp ?? new Date()) .subtract(elapsedTimeRule) @@ -161,6 +178,7 @@ export const getThresholdAggregationData = ( ecsData: Ecs | Ecs[], nonEcsData: TimelineNonEcsData[] ): ThresholdAggregationData => { + // TODO: AAD fields const thresholdEcsData: Ecs[] = Array.isArray(ecsData) ? ecsData : [ecsData]; return thresholdEcsData.reduce( (outerAcc, thresholdData) => { @@ -177,9 +195,14 @@ export const getThresholdAggregationData = ( }; try { - thresholdResult = JSON.parse((thresholdData.signal?.threshold_result as string[])[0]); + try { + thresholdResult = JSON.parse((thresholdData.signal?.threshold_result as string[])[0]); + } catch (err) { + thresholdResult = JSON.parse((get(ALERT_THRESHOLD_RESULT, thresholdData) as string[])[0]); + } aggField = JSON.parse(threshold[0]).field; } catch (err) { + // Legacy support thresholdResult = { terms: [ { @@ -192,13 +215,15 @@ export const getThresholdAggregationData = ( }; } - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const originalTime = moment(thresholdData.signal?.original_time![0]); - const now = moment(); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const ruleFrom = dateMath.parse(thresholdData.signal?.rule?.from![0]!); - const ruleInterval = moment.duration(now.diff(ruleFrom)); + // Legacy support + const ruleFromStr = getField(thresholdData, ALERT_RULE_FROM)[0]; + const ruleFrom = dateMath.parse(ruleFromStr) ?? moment(); // The fallback here will essentially ensure 0 results + const originalTimeStr = getField(thresholdData, ALERT_ORIGINAL_TIME)[0]; + const originalTime = originalTimeStr != null ? moment(originalTimeStr) : ruleFrom; + const ruleInterval = moment.duration(moment().diff(ruleFrom)); const fromOriginalTime = originalTime.clone().subtract(ruleInterval); // This is the default... can overshoot + // End legacy support + const aggregationFields = Array.isArray(aggField) ? aggField : [aggField]; return { @@ -255,16 +280,19 @@ export const getThresholdAggregationData = ( ); }; -export const isEqlRuleWithGroupId = (ecsData: Ecs) => - ecsData.signal?.rule?.type?.length && - ecsData.signal?.rule?.type[0] === 'eql' && - ecsData.signal?.group?.id?.length; +export const isEqlRuleWithGroupId = (ecsData: Ecs) => { + const ruleType = getField(ecsData, ALERT_RULE_TYPE); + const groupId = getField(ecsData, ALERT_GROUP_ID); + return ruleType?.length && ruleType[0] === 'eql' && groupId?.length; +}; -export const isThresholdRule = (ecsData: Ecs) => - ecsData.signal?.rule?.type?.length && ecsData.signal?.rule?.type[0] === 'threshold'; +export const isThresholdRule = (ecsData: Ecs) => { + const ruleType = getField(ecsData, ALERT_RULE_TYPE); + return Array.isArray(ruleType) && ruleType.length && ruleType[0] === 'threshold'; +}; export const buildAlertsKqlFilter = ( - key: '_id' | 'signal.group.id', + key: '_id' | 'signal.group.id' | 'kibana.alert.group.id', alertIds: string[] ): Filter[] => { return [ @@ -283,7 +311,7 @@ export const buildAlertsKqlFilter = ( negate: false, disabled: false, type: 'phrases', - key, + key: key.replace('signal.', 'kibana.alert.'), value: alertIds.join(), params: alertIds, }, @@ -383,9 +411,11 @@ export const sendAlertToTimelineAction = async ({ */ const ecsData: Ecs = Array.isArray(ecs) && ecs.length > 0 ? ecs[0] : (ecs as Ecs); const alertIds = Array.isArray(ecs) ? ecs.map((d) => d._id) : []; - const noteContent = ecsData.signal?.rule?.note != null ? ecsData.signal?.rule?.note[0] : ''; + const ruleNote = getField(ecsData, ALERT_RULE_NOTE); + const noteContent = Array.isArray(ruleNote) && ruleNote.length > 0 ? ruleNote[0] : ''; + const ruleTimelineId = getField(ecsData, ALERT_RULE_TIMELINE_ID); const timelineId = - ecsData.signal?.rule?.timeline_id != null ? ecsData.signal?.rule?.timeline_id[0] : ''; + Array.isArray(ruleTimelineId) && ruleTimelineId.length > 0 ? ruleTimelineId[0] : ''; const { to, from } = determineToAndFrom({ ecs }); // For now we do not want to populate the template timeline if we have alertIds diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_add_to_case_actions.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_add_to_case_actions.tsx index e14c3e916a35e8..a342b01b038cae 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_add_to_case_actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_add_to_case_actions.tsx @@ -8,7 +8,7 @@ import { useMemo } from 'react'; import { useGetUserCasesPermissions, useKibana } from '../../../../common/lib/kibana'; import { TimelineId, TimelineNonEcsData } from '../../../../../common'; -import { APP_UI_ID } from '../../../../../common/constants'; +import { APP_ID } from '../../../../../common/constants'; import { useInsertTimeline } from '../../../../cases/components/use_insert_timeline'; import { Ecs } from '../../../../../common/ecs'; @@ -39,7 +39,7 @@ export const useAddToCaseActions = ({ event: { data: nonEcsData ?? [], ecs: ecsData, _id: ecsData?._id }, useInsertTimeline: insertTimelineHook, casePermissions, - appId: APP_UI_ID, + appId: APP_ID, onClose: afterCaseSelection, } : null, diff --git a/x-pack/plugins/security_solution/public/helpers.tsx b/x-pack/plugins/security_solution/public/helpers.tsx index 066e6a4cb4684e..f160d293dd475f 100644 --- a/x-pack/plugins/security_solution/public/helpers.tsx +++ b/x-pack/plugins/security_solution/public/helpers.tsx @@ -5,7 +5,8 @@ * 2.0. */ -import { isEmpty } from 'lodash/fp'; +import { ALERT_RULE_UUID } from '@kbn/rule-data-utils'; +import { get, isEmpty } from 'lodash/fp'; import React from 'react'; import { matchPath, RouteProps, Redirect } from 'react-router-dom'; @@ -22,6 +23,7 @@ import { OVERVIEW_PATH, CASES_PATH, } from '../common/constants'; +import { Ecs } from '../common/ecs'; import { FactoryQueryTypes, StrategyResponseType, @@ -208,3 +210,27 @@ export const RedirectRoute = React.memo<{ capabilities: Capabilities }>(({ capab return ; }); RedirectRoute.displayName = 'RedirectRoute'; + +const siemSignalsFieldMappings: Record = { + [ALERT_RULE_UUID]: 'signal.rule.id', +}; + +const alertFieldMappings: Record = { + 'signal.rule.id': ALERT_RULE_UUID, +}; + +/* + * Deprecation notice: This functionality should be removed when support for signal.* is no longer + * supported. + * + * Selectively returns the AAD field value (kibana.alert.*) or the legacy field value + * (signal.*), whichever is present. For backwards compatibility. + */ +export const getField = (ecsData: Ecs, field: string) => { + const aadField = (alertFieldMappings[field] ?? field).replace('signal', 'kibana.alert'); + const siemSignalsField = (siemSignalsFieldMappings[field] ?? field).replace( + 'kibana.alert', + 'signal' + ); + return get(aadField, ecsData) ?? get(siemSignalsField, ecsData); +}; diff --git a/x-pack/plugins/security_solution/public/index.ts b/x-pack/plugins/security_solution/public/index.ts index 3d2412b326b549..5f2f6014822aba 100644 --- a/x-pack/plugins/security_solution/public/index.ts +++ b/x-pack/plugins/security_solution/public/index.ts @@ -12,4 +12,5 @@ export type { TimelineModel } from './timelines/store/timeline/model'; export const plugin = (context: PluginInitializerContext): Plugin => new Plugin(context); -export { Plugin, PluginSetup }; +export type { PluginSetup }; +export { Plugin }; diff --git a/x-pack/plugins/security_solution/public/management/components/policies_selector/index.ts b/x-pack/plugins/security_solution/public/management/components/policies_selector/index.ts index 1b25a8af9d3fcc..7ebfcb8c9f4abf 100644 --- a/x-pack/plugins/security_solution/public/management/components/policies_selector/index.ts +++ b/x-pack/plugins/security_solution/public/management/components/policies_selector/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { PoliciesSelector, PolicySelectionItem, PoliciesSelectorProps } from './policies_selector'; +export type { PolicySelectionItem, PoliciesSelectorProps } from './policies_selector'; +export { PoliciesSelector } from './policies_selector'; diff --git a/x-pack/plugins/security_solution/public/management/components/search_exceptions/index.ts b/x-pack/plugins/security_solution/public/management/components/search_exceptions/index.ts index 6a870dbb06c66c..24775457766896 100644 --- a/x-pack/plugins/security_solution/public/management/components/search_exceptions/index.ts +++ b/x-pack/plugins/security_solution/public/management/components/search_exceptions/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { SearchExceptions, SearchExceptionsProps } from './search_exceptions'; +export type { SearchExceptionsProps } from './search_exceptions'; +export { SearchExceptions } from './search_exceptions'; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/index.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/index.tsx index 70f5bca339c82a..ac361ff8f16ade 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/index.tsx @@ -25,4 +25,4 @@ export const EndpointsContainer = memo(() => { EndpointsContainer.displayName = 'EndpointsContainer'; export { endpointListFleetApisHttpMock } from './mocks'; -export { EndpointListFleetApisHttpMockInterface } from './mocks'; +export type { EndpointListFleetApisHttpMockInterface } from './mocks'; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/components/log_entry.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/components/log_entry.tsx index 79af2ecb354fdb..87de2d42a9844f 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/components/log_entry.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/components/log_entry.tsx @@ -129,9 +129,9 @@ const useLogEntryUIProps = ( if (isIsolateAction) { if (isCompleted) { if (isSuccessful) { - return i18.ACTIVITY_LOG.LogEntry.response.unisolationCompletedAndSuccessful; + return i18.ACTIVITY_LOG.LogEntry.response.isolationCompletedAndSuccessful; } - return i18.ACTIVITY_LOG.LogEntry.response.unisolationCompletedAndUnsuccessful; + return i18.ACTIVITY_LOG.LogEntry.response.isolationCompletedAndUnsuccessful; } else if (isSuccessful) { return i18.ACTIVITY_LOG.LogEntry.response.isolationSuccessful; } else { diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx index 0983d6bcb755d9..2911264d7061a0 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx @@ -168,9 +168,8 @@ describe('When on the host isolation exceptions page', () => { it('should show the create flyout when the add button is pressed', async () => { render(); await dataReceived(); - act(() => { - userEvent.click(renderResult.getByTestId('hostIsolationExceptionsListAddButton')); - }); + userEvent.click(renderResult.getByTestId('hostIsolationExceptionsListAddButton')); + await dataReceived(); expect(renderResult.getByTestId('hostIsolationExceptionsCreateEditFlyout')).toBeTruthy(); }); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/index.ts b/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/index.ts index bc9e42ddf7f52e..c771cef28e73df 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/index.ts +++ b/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/index.ts @@ -20,4 +20,4 @@ export interface EndpointPolicyDetailsStatePluginState { export interface EndpointPolicyDetailsStatePluginReducer { policyDetails: ImmutableReducer; } -export { PolicyDetailsAction } from './action'; +export type { PolicyDetailsAction } from './action'; diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/index.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/index.ts index c017e7dec52488..44f378b15fa0fa 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/index.ts +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { LogicalConditionBuilder, LogicalConditionBuilderProps } from './logical_condition_builder'; +export type { LogicalConditionBuilderProps } from './logical_condition_builder'; +export { LogicalConditionBuilder } from './logical_condition_builder'; diff --git a/x-pack/plugins/security_solution/public/overview/components/link_panel/index.ts b/x-pack/plugins/security_solution/public/overview/components/link_panel/index.ts index 64c8d6a38efe77..9d404abcf2223c 100644 --- a/x-pack/plugins/security_solution/public/overview/components/link_panel/index.ts +++ b/x-pack/plugins/security_solution/public/overview/components/link_panel/index.ts @@ -8,4 +8,4 @@ export { InnerLinkPanel } from './inner_link_panel'; export { isLinkPanelListItem } from './helpers'; export { LinkPanel } from './link_panel'; -export { LinkPanelListItem } from './types'; +export type { LinkPanelListItem } from './types'; diff --git a/x-pack/plugins/security_solution/public/resolver/store/camera/index.ts b/x-pack/plugins/security_solution/public/resolver/store/camera/index.ts index f900ab92a58b58..e42906ec2029fa 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/camera/index.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/camera/index.ts @@ -20,4 +20,4 @@ * would not be in the camera's viewport would be ignored. */ export { cameraReducer } from './reducer'; -export { CameraAction } from './action'; +export type { CameraAction } from './action'; diff --git a/x-pack/plugins/security_solution/public/shared_imports.ts b/x-pack/plugins/security_solution/public/shared_imports.ts index dda4179cd853cf..8934ad9dab4cdc 100644 --- a/x-pack/plugins/security_solution/public/shared_imports.ts +++ b/x-pack/plugins/security_solution/public/shared_imports.ts @@ -5,28 +5,30 @@ * 2.0. */ +export type { + FieldHook, + FieldValidateResponse, + FormData, + FormHook, + FormSchema, + ValidationError, + ValidationFunc, +} from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; export { getUseField, getFieldValidityAndErrorMessage, - FieldHook, - FieldValidateResponse, FIELD_TYPES, Form, - FormData, FormDataProvider, - FormHook, - FormSchema, UseField, UseMultiFields, useForm, useFormContext, useFormData, - ValidationError, - ValidationFunc, VALIDATION_TYPES, } from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; export { Field, SelectField } from '../../../../src/plugins/es_ui_shared/static/forms/components'; export { fieldValidators } from '../../../../src/plugins/es_ui_shared/static/forms/helpers'; -export { ERROR_CODE } from '../../../../src/plugins/es_ui_shared/static/forms/helpers/field_validators/types'; +export type { ERROR_CODE } from '../../../../src/plugins/es_ui_shared/static/forms/helpers/field_validators/types'; export { ExceptionBuilder } from '../../lists/public'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/data_driven_columns/stateful_cell.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/data_driven_columns/stateful_cell.tsx index 403756a763808b..e7c03612828abf 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/data_driven_columns/stateful_cell.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/data_driven_columns/stateful_cell.tsx @@ -51,6 +51,7 @@ const StatefulCellComponent = ({ isExpandable: true, isExpanded: false, isDetails: false, + isTimeline: true, linkValues, rowIndex: ariaRowindex - 1, setCellProps, diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/cell_rendering/default_cell_renderer.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/cell_rendering/default_cell_renderer.tsx index 5b9fee621b4171..6aec7ae19734cf 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/cell_rendering/default_cell_renderer.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/cell_rendering/default_cell_renderer.tsx @@ -32,6 +32,7 @@ export const DefaultCellRenderer: React.FC = ({ header, isDetails, isDraggable, + isTimeline, linkValues, rowRenderers, setCellProps, @@ -49,7 +50,7 @@ export const DefaultCellRenderer: React.FC = ({ <> {getColumnRenderer(header.id, columnRenderers, data).renderColumn({ - asPlainText: !!getLink(header.id, header.type), // we want to render value with links as plain text but keep other formatters like badge. + asPlainText: !!getLink(header.id, header.type) && !isTimeline, // we want to render value with links as plain text but keep other formatters like badge. browserFields, columnName: header.id, ecsData, diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/cell_rendering/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/cell_rendering/index.tsx index 2848a850a52271..5d66e399ece6f5 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/cell_rendering/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/cell_rendering/index.tsx @@ -5,4 +5,4 @@ * 2.0. */ -export { CellValueElementProps } from '../../../../../common/types/timeline'; +export type { CellValueElementProps } from '../../../../../common/types/timeline'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts index ca7c3596d13bb8..c90d04e1e640a4 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts @@ -7,7 +7,7 @@ import { ColumnId } from './body/column_id'; import { DataProvider, QueryOperator } from './data_providers/data_provider'; -export { +export type { OnColumnSorted, OnColumnsSorted, OnColumnRemoved, diff --git a/x-pack/plugins/security_solution/public/timelines/containers/local_storage/index.tsx b/x-pack/plugins/security_solution/public/timelines/containers/local_storage/index.tsx index dd60656933ba83..c44d1351b0830f 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/local_storage/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/containers/local_storage/index.tsx @@ -123,4 +123,4 @@ export const useTimelinesStorage = (): TimelinesStorage => { return { getAllTimelines, getTimelineById, addTimeline }; }; -export { TimelinesStorage }; +export type { TimelinesStorage }; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/actions/status.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/actions/status.test.ts index a8592f02691aa9..e4dc9b049e2baa 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/actions/status.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/actions/status.test.ts @@ -87,7 +87,10 @@ describe('Endpoint Action Status', () => { logFactory: loggingSystemMock.create(), service: endpointAppContextService, config: () => Promise.resolve(createMockConfig()), - experimentalFeatures: parseExperimentalConfigValue(createMockConfig().enableExperimental), + experimentalFeatures: { + ...parseExperimentalConfigValue(createMockConfig().enableExperimental), + pendingActionResponsesWithAck: true, + }, }); getPendingStatus = async (reqParams?: any): Promise> => { @@ -451,4 +454,321 @@ describe('Endpoint Action Status', () => { }); }); }); + + describe('response (when pendingActionResponsesWithAck is FALSE)', () => { + let endpointAppContextService: EndpointAppContextService; + + // convenience for calling the route and handler for action status + let getPendingStatus: (reqParams?: any) => Promise>; + // convenience for injecting mock responses for actions index and responses + let havingActionsAndResponses: ( + actions: MockAction[], + responses: MockResponse[], + endpointResponses?: MockEndpointResponse[] + ) => void; + + beforeEach(() => { + const esClientMock = elasticsearchServiceMock.createScopedClusterClient(); + const routerMock = httpServiceMock.createRouter(); + endpointAppContextService = new EndpointAppContextService(); + endpointAppContextService.setup(createMockEndpointAppContextServiceSetupContract()); + endpointAppContextService.start(createMockEndpointAppContextServiceStartContract()); + + registerActionStatusRoutes(routerMock, { + logFactory: loggingSystemMock.create(), + service: endpointAppContextService, + config: () => Promise.resolve(createMockConfig()), + experimentalFeatures: { + ...parseExperimentalConfigValue(createMockConfig().enableExperimental), + pendingActionResponsesWithAck: false, + }, + }); + + getPendingStatus = async (reqParams?: any): Promise> => { + const req = httpServerMock.createKibanaRequest(reqParams); + const mockResponse = httpServerMock.createResponseFactory(); + const [, routeHandler]: [ + RouteConfig, + RequestHandler + ] = routerMock.get.mock.calls.find(([{ path }]) => path.startsWith(ACTION_STATUS_ROUTE))!; + await routeHandler( + createRouteHandlerContext(esClientMock, savedObjectsClientMock.create()), + req, + mockResponse + ); + + return mockResponse; + }; + + havingActionsAndResponses = ( + actions: MockAction[], + responses: MockResponse[], + endpointResponses?: MockEndpointResponse[] + ) => { + esClientMock.asCurrentUser.search = jest.fn().mockImplementation((req) => { + const size = req.size ? req.size : 10; + const items: any[] = + req.index === '.fleet-actions' + ? actions.splice(0, size) + : req.index === '.logs-endpoint.action.responses' && !!endpointResponses + ? endpointResponses + : responses.splice(0, size); + + if (items.length > 0) { + return Promise.resolve(mockSearchResult(items.map((x) => x.build()))); + } else { + return Promise.resolve(mockSearchResult()); + } + }); + }; + }); + + afterEach(() => { + endpointAppContextService.stop(); + }); + + it('should include total counts for large (more than a page) action counts', async () => { + const mockID = 'XYZABC-000'; + const actions = []; + for (let i = 0; i < 1400; i++) { + // putting more than a single page of results in + actions.push(aMockAction().withAgent(mockID)); + } + havingActionsAndResponses(actions, []); + + const response = await getPendingStatus({ + query: { + agent_ids: [mockID], + }, + }); + + expect(response.ok).toBeCalled(); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toHaveLength(1); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].agent_id).toEqual(mockID); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].pending_actions.isolate).toEqual( + 0 + ); + }); + it('should include a total count of a pending action', async () => { + const mockID = 'XYZABC-000'; + havingActionsAndResponses( + [ + aMockAction().withAgent(mockID).withAction('isolate'), + aMockAction().withAgent(mockID).withAction('isolate'), + ], + [] + ); + const response = await getPendingStatus({ + query: { + agent_ids: [mockID], + }, + }); + expect(response.ok).toBeCalled(); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toHaveLength(1); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].agent_id).toEqual(mockID); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].pending_actions.isolate).toEqual( + 0 + ); + }); + it('should show multiple pending actions, and their counts', async () => { + const mockID = 'XYZABC-000'; + havingActionsAndResponses( + [ + aMockAction().withAgent(mockID).withAction('isolate'), + aMockAction().withAgent(mockID).withAction('isolate'), + aMockAction().withAgent(mockID).withAction('isolate'), + aMockAction().withAgent(mockID).withAction('unisolate'), + aMockAction().withAgent(mockID).withAction('unisolate'), + ], + [] + ); + const response = await getPendingStatus({ + query: { + agent_ids: [mockID], + }, + }); + expect(response.ok).toBeCalled(); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toHaveLength(1); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].agent_id).toEqual(mockID); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].pending_actions.isolate).toEqual( + 0 + ); + expect( + (response.ok.mock.calls[0][0]?.body as any)?.data[0].pending_actions.unisolate + ).toEqual(0); + }); + it('should calculate correct pending counts from grouped/bulked actions', async () => { + const mockID = 'XYZABC-000'; + havingActionsAndResponses( + [ + aMockAction() + .withAgents([mockID, 'IRRELEVANT-OTHER-AGENT', 'ANOTHER-POSSIBLE-AGENT']) + .withAction('isolate'), + aMockAction().withAgents([mockID, 'YET-ANOTHER-AGENT-ID']).withAction('isolate'), + aMockAction().withAgents(['YET-ANOTHER-AGENT-ID']).withAction('isolate'), // one WITHOUT our agent-under-test + ], + [] + ); + const response = await getPendingStatus({ + query: { + agent_ids: [mockID], + }, + }); + expect(response.ok).toBeCalled(); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toHaveLength(1); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].agent_id).toEqual(mockID); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].pending_actions.isolate).toEqual( + 0 + ); + }); + + it('should exclude actions that have responses from the pending count', async () => { + const mockAgentID = 'XYZABC-000'; + const actionID = 'some-known-actionid'; + havingActionsAndResponses( + [ + aMockAction().withAgent(mockAgentID).withAction('isolate'), + aMockAction().withAgent(mockAgentID).withAction('isolate').withID(actionID), + ], + [aMockResponse(actionID, mockAgentID)] + ); + (endpointAppContextService.getEndpointMetadataService as jest.Mock) = jest + .fn() + .mockReturnValue({ + findHostMetadataForFleetAgents: jest.fn().mockResolvedValue([]), + }); + const response = await getPendingStatus({ + query: { + agent_ids: [mockAgentID], + }, + }); + expect(response.ok).toBeCalled(); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toHaveLength(1); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].agent_id).toEqual(mockAgentID); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].pending_actions.isolate).toEqual( + 0 + ); + }); + it('should have accurate counts for multiple agents, bulk actions, and responses', async () => { + const agentOne = 'XYZABC-000'; + const agentTwo = 'DEADBEEF'; + const agentThree = 'IDIDIDID'; + + const actionTwoID = 'ID-TWO'; + havingActionsAndResponses( + [ + aMockAction().withAgents([agentOne, agentTwo, agentThree]).withAction('isolate'), + aMockAction() + .withAgents([agentTwo, agentThree]) + .withAction('isolate') + .withID(actionTwoID), + aMockAction().withAgents([agentThree]).withAction('isolate'), + ], + [aMockResponse(actionTwoID, agentThree)] + ); + (endpointAppContextService.getEndpointMetadataService as jest.Mock) = jest + .fn() + .mockReturnValue({ + findHostMetadataForFleetAgents: jest.fn().mockResolvedValue([]), + }); + const response = await getPendingStatus({ + query: { + agent_ids: [agentOne, agentTwo, agentThree], + }, + }); + expect(response.ok).toBeCalled(); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toHaveLength(3); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toContainEqual({ + agent_id: agentOne, + pending_actions: { + isolate: 0, + }, + }); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toContainEqual({ + agent_id: agentTwo, + pending_actions: { + isolate: 0, + }, + }); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toContainEqual({ + agent_id: agentThree, + pending_actions: { + isolate: 0, + }, + }); + }); + + describe('with endpoint response index', () => { + it('should include a total count of a pending action response', async () => { + const mockAgentId = 'XYZABC-000'; + const actionIds = ['action_id_0', 'action_id_1']; + havingActionsAndResponses( + [ + aMockAction().withAgent(mockAgentId).withAction('isolate').withID(actionIds[0]), + aMockAction().withAgent(mockAgentId).withAction('isolate').withID(actionIds[1]), + ], + [ + aMockResponse(actionIds[0], mockAgentId, true), + aMockResponse(actionIds[1], mockAgentId, true), + ] + ); + (endpointAppContextService.getEndpointMetadataService as jest.Mock) = jest + .fn() + .mockReturnValue({ + findHostMetadataForFleetAgents: jest.fn().mockResolvedValue([]), + }); + const response = await getPendingStatus({ + query: { + agent_ids: [mockAgentId], + }, + }); + expect(response.ok).toBeCalled(); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toHaveLength(1); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].agent_id).toEqual(mockAgentId); + expect( + (response.ok.mock.calls[0][0]?.body as any)?.data[0].pending_actions.isolate + ).toEqual(0); + }); + + it('should show multiple pending action responses, and their counts', async () => { + const mockAgentID = 'XYZABC-000'; + const actionIds = ['ack_0', 'ack_1', 'ack_2', 'ack_3', 'ack_4']; + havingActionsAndResponses( + [ + aMockAction().withAgent(mockAgentID).withAction('isolate').withID(actionIds[0]), + aMockAction().withAgent(mockAgentID).withAction('isolate').withID(actionIds[1]), + aMockAction().withAgent(mockAgentID).withAction('isolate').withID(actionIds[2]), + aMockAction().withAgent(mockAgentID).withAction('unisolate').withID(actionIds[3]), + aMockAction().withAgent(mockAgentID).withAction('unisolate').withID(actionIds[4]), + ], + [ + aMockResponse(actionIds[0], mockAgentID, true), + aMockResponse(actionIds[1], mockAgentID, true), + aMockResponse(actionIds[2], mockAgentID, true), + aMockResponse(actionIds[3], mockAgentID, true), + aMockResponse(actionIds[4], mockAgentID, true), + ] + ); + (endpointAppContextService.getEndpointMetadataService as jest.Mock) = jest + .fn() + .mockReturnValue({ + findHostMetadataForFleetAgents: jest.fn().mockResolvedValue([]), + }); + const response = await getPendingStatus({ + query: { + agent_ids: [mockAgentID], + }, + }); + expect(response.ok).toBeCalled(); + expect((response.ok.mock.calls[0][0]?.body as any)?.data).toHaveLength(1); + expect((response.ok.mock.calls[0][0]?.body as any)?.data[0].agent_id).toEqual(mockAgentID); + expect( + (response.ok.mock.calls[0][0]?.body as any)?.data[0].pending_actions.isolate + ).toEqual(0); + expect( + (response.ok.mock.calls[0][0]?.body as any)?.data[0].pending_actions.unisolate + ).toEqual(0); + }); + }); + }); }); diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/actions/status.ts b/x-pack/plugins/security_solution/server/endpoint/routes/actions/status.ts index 4ba03bf220c21c..32c709aef2b879 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/actions/status.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/actions/status.ts @@ -50,7 +50,8 @@ export const actionStatusRequestHandler = function ( const response = await getPendingActionCounts( esClient, endpointContext.service.getEndpointMetadataService(), - agentIDs + agentIDs, + endpointContext.experimentalFeatures.pendingActionResponsesWithAck ); return res.ok({ diff --git a/x-pack/plugins/security_solution/server/endpoint/services/actions.ts b/x-pack/plugins/security_solution/server/endpoint/services/actions.ts index 5dcaca6c2c4cc5..4dbfd700496f5e 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/actions.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/actions.ts @@ -186,7 +186,8 @@ export const getPendingActionCounts = async ( esClient: ElasticsearchClient, metadataService: EndpointMetadataService, /** The Fleet Agent IDs to be checked */ - agentIDs: string[] + agentIDs: string[], + isPendingActionResponsesWithAckEnabled: boolean ): Promise => { // retrieve the unexpired actions for the given hosts const recentActions = await esClient @@ -254,11 +255,17 @@ export const getPendingActionCounts = async ( pending_actions: pendingActions .map((a) => a.data.command) .reduce((acc, cur) => { - if (cur in acc) { - acc[cur] += 1; + if (!isPendingActionResponsesWithAckEnabled) { + acc[cur] = 0; // set pending counts to 0 when FF is disabled } else { - acc[cur] = 1; + // else do the usual counting + if (cur in acc) { + acc[cur] += 1; + } else { + acc[cur] = 1; + } } + return acc; }, {} as EndpointPendingActions['pending_actions']), }); diff --git a/x-pack/plugins/security_solution/server/index.ts b/x-pack/plugins/security_solution/server/index.ts index 0adcd25f5e2466..16a4992e68698c 100644 --- a/x-pack/plugins/security_solution/server/index.ts +++ b/x-pack/plugins/security_solution/server/index.ts @@ -45,7 +45,8 @@ export const config: PluginConfigDescriptor = { ], }; -export { ConfigType, Plugin, PluginSetup, PluginStart }; +export type { ConfigType, PluginSetup, PluginStart }; +export { Plugin }; export { AppClient }; export type { SecuritySolutionApiRequestHandlerContext } from './types'; export { EndpointError } from './endpoint/errors'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/threshold.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/threshold.ts index 73029689deb196..e7ab48e807d54e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/threshold.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/threshold.ts @@ -27,12 +27,12 @@ import { TypeOfFieldMap } from '../../../../../../rule_registry/common/field_map import { SERVER_APP_ID } from '../../../../../common/constants'; import { ANCHOR_DATE } from '../../../../../common/detection_engine/schemas/response/rules_schema.mocks'; import { getListArrayMock } from '../../../../../common/detection_engine/schemas/types/lists.mock'; -import { RulesFieldMap } from '../field_maps'; +import { RulesFieldMap } from '../../../../../common/field_maps'; import { ALERT_ANCESTORS, ALERT_ORIGINAL_TIME, ALERT_ORIGINAL_EVENT, -} from '../field_maps/field_names'; +} from '../../../../../common/field_maps/field_names'; import { WrappedRACAlert } from '../types'; export const mockThresholdResults = { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.test.ts index 39ee8788d3ee03..d6bad86456493e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.test.ts @@ -31,14 +31,14 @@ import { ANCHOR_DATE, } from '../../../../../../common/detection_engine/schemas/response/rules_schema.mocks'; import { getListArrayMock } from '../../../../../../common/detection_engine/schemas/types/lists.mock'; +import { SERVER_APP_ID } from '../../../../../../common/constants'; +import { EVENT_DATASET } from '../../../../../../common/cti/constants'; import { ALERT_ANCESTORS, + ALERT_ORIGINAL_TIME, ALERT_DEPTH, ALERT_ORIGINAL_EVENT, - ALERT_ORIGINAL_TIME, -} from '../../field_maps/field_names'; -import { SERVER_APP_ID } from '../../../../../../common/constants'; -import { EVENT_DATASET } from '../../../../../../common/cti/constants'; +} from '../../../../../../common/field_maps/field_names'; type SignalDoc = SignalSourceHit & { _source: Required['_source'] & { [TIMESTAMP]: string }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.ts index bfd79d67bb74d2..bf07d2bb8515f0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.ts @@ -29,14 +29,14 @@ import { isWrappedSignalHit, } from '../../../signals/utils'; import { RACAlert } from '../../types'; +import { SERVER_APP_ID } from '../../../../../../common/constants'; +import { SearchTypes } from '../../../../telemetry/types'; import { ALERT_ANCESTORS, ALERT_DEPTH, - ALERT_ORIGINAL_EVENT, ALERT_ORIGINAL_TIME, -} from '../../field_maps/field_names'; -import { SERVER_APP_ID } from '../../../../../../common/constants'; -import { SearchTypes } from '../../../../telemetry/types'; + ALERT_ORIGINAL_EVENT, +} from '../../../../../../common/field_maps/field_names'; export const generateAlertId = (alert: RACAlert) => { return createHash('sha256') diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.test.ts index 3f6d419e6ddd0e..86b57b1ed16987 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.test.ts @@ -11,15 +11,15 @@ import { ALERT_RULE_CONSUMER } from '@kbn/rule-data-utils'; import { sampleDocNoSortId, sampleRuleGuid } from '../../../signals/__mocks__/es_results'; import { buildAlertGroupFromSequence } from './build_alert_group_from_sequence'; +import { SERVER_APP_ID } from '../../../../../../common/constants'; +import { getCompleteRuleMock, getQueryRuleParams } from '../../../schemas/rule_schemas.mock'; +import { QueryRuleParams } from '../../../schemas/rule_schemas'; import { ALERT_ANCESTORS, - ALERT_BUILDING_BLOCK_TYPE, ALERT_DEPTH, + ALERT_BUILDING_BLOCK_TYPE, ALERT_GROUP_ID, -} from '../../field_maps/field_names'; -import { SERVER_APP_ID } from '../../../../../../common/constants'; -import { getCompleteRuleMock, getQueryRuleParams } from '../../../schemas/rule_schemas.mock'; -import { QueryRuleParams } from '../../../schemas/rule_schemas'; +} from '../../../../../../common/field_maps/field_names'; const SPACE_ID = 'space'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.ts index 451f322f72799e..23958451800b06 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert_group_from_sequence.ts @@ -19,12 +19,12 @@ import { EqlSequence } from '../../../../../../common/detection_engine/types'; import { generateBuildingBlockIds } from './generate_building_block_ids'; import { objectArrayIntersection } from '../../../signals/build_bulk_body'; import { BuildReasonMessage } from '../../../signals/reason_formatters'; +import { CompleteRule, RuleParams } from '../../../schemas/rule_schemas'; import { ALERT_BUILDING_BLOCK_TYPE, ALERT_GROUP_ID, ALERT_GROUP_INDEX, -} from '../../field_maps/field_names'; -import { CompleteRule, RuleParams } from '../../../schemas/rule_schemas'; +} from '../../../../../../common/field_maps/field_names'; /** * Takes N raw documents from ES that form a sequence and builds them into N+1 signals ready to be indexed - diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/generate_building_block_ids.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/generate_building_block_ids.ts index 84e7f9e3ecef25..a603946b03d3b6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/generate_building_block_ids.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/generate_building_block_ids.ts @@ -7,8 +7,8 @@ import { ALERT_RULE_UUID } from '@kbn/rule-data-utils'; import { createHash } from 'crypto'; +import { ALERT_ANCESTORS } from '../../../../../../common/field_maps/field_names'; import { Ancestor } from '../../../signals/types'; -import { ALERT_ANCESTORS } from '../../field_maps/field_names'; import { RACAlert } from '../../types'; /** diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts index 89c01f65b4156e..d5b4d1f1eec773 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts @@ -33,9 +33,9 @@ import { WrapHits, WrapSequences, } from '../signals/types'; -import { AlertsFieldMap, RulesFieldMap } from './field_maps'; import { ExperimentalFeatures } from '../../../../common/experimental_features'; import { IEventLogService } from '../../../../../event_log/server'; +import { AlertsFieldMap, RulesFieldMap } from '../../../../common/field_maps'; export interface SecurityAlertTypeReturnValue { bulkCreateTimes: string[]; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.test.ts index f56d1d83eb873b..434da08791c06e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.test.ts @@ -10,6 +10,10 @@ import { createPromiseFromStreams } from '@kbn/utils'; import { createRulesStreamFromNdJson } from './create_rules_stream_from_ndjson'; import { BadRequestError } from '@kbn/securitysolution-es-utils'; import { ImportRulesSchemaDecoded } from '../../../../common/detection_engine/schemas/request/import_rules_schema'; +import { + getOutputDetailsSample, + getSampleDetailsAsNdjson, +} from '../../../../common/detection_engine/schemas/response/export_rules_details_schema.mock'; type PromiseFromStreams = ImportRulesSchemaDecoded | Error; @@ -202,12 +206,13 @@ describe('create_rules_stream_from_ndjson', () => { test('filters the export details entry from the stream', async () => { const sample1 = getOutputSample(); const sample2 = getOutputSample(); + const details = getOutputDetailsSample({ totalCount: 1, rulesCount: 1 }); sample2.rule_id = 'rule-2'; const ndJsonStream = new Readable({ read() { this.push(getSampleAsNdjson(sample1)); this.push(getSampleAsNdjson(sample2)); - this.push('{"exported_rules_count":1,"missing_rules":[],"missing_rules_count":0}\n'); + this.push(getSampleDetailsAsNdjson(details)); this.push(null); }, }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.ts index 799412a33ffbcf..00dc6fe428ac78 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.ts @@ -21,7 +21,6 @@ import { } from '../../../../common/detection_engine/schemas/request/import_rules_schema'; import { parseNdjsonStrings, - filterExportedRulesCounts, filterExceptions, createLimitStream, filterExportedCounts, @@ -62,7 +61,6 @@ export const createRulesStreamFromNdJson = (ruleLimit: number) => { createSplitStream('\n'), parseNdjsonStrings(), filterExportedCounts(), - filterExportedRulesCounts(), filterExceptions(), validateRules(), createLimitStream(ruleLimit), diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_all.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_all.test.ts index 99f5f76be1a7c6..304582378c2f18 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_all.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_all.test.ts @@ -15,6 +15,10 @@ import { rulesClientMock } from '../../../../../alerting/server/mocks'; import { getExportAll } from './get_export_all'; import { getListArrayMock } from '../../../../common/detection_engine/schemas/types/lists.mock'; import { getThreatMock } from '../../../../common/detection_engine/schemas/types/threat.mock'; +import { + getOutputDetailsSampleWithExceptions, + getSampleDetailsAsNdjson, +} from '../../../../common/detection_engine/schemas/response/export_rules_details_schema.mock'; import { getQueryRuleParams } from '../schemas/rule_schemas.mock'; import { getExceptionListClientMock } from '../../../../../lists/server/services/exception_lists/exception_list_client.mock'; @@ -103,6 +107,7 @@ describe.each([ expect(detailsJson).toEqual({ exported_exception_list_count: 1, exported_exception_list_item_count: 1, + exported_count: 3, exported_rules_count: 1, missing_exception_list_item_count: 0, missing_exception_list_items: [], @@ -121,6 +126,7 @@ describe.each([ total: 0, data: [], }; + const details = getOutputDetailsSampleWithExceptions(); rulesClient.find.mockResolvedValue(findResult); @@ -133,8 +139,7 @@ describe.each([ ); expect(exports).toEqual({ rulesNdjson: '', - exportDetails: - '{"exported_rules_count":0,"missing_rules":[],"missing_rules_count":0,"exported_exception_list_count":0,"exported_exception_list_item_count":0,"missing_exception_list_item_count":0,"missing_exception_list_items":[],"missing_exception_lists":[],"missing_exception_lists_count":0}\n', + exportDetails: getSampleDetailsAsNdjson(details), exceptionLists: '', }); }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.test.ts index 7aa55a8163e1a6..0e07ac4e56a9fc 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.test.ts @@ -15,6 +15,10 @@ import { import { rulesClientMock } from '../../../../../alerting/server/mocks'; import { getListArrayMock } from '../../../../common/detection_engine/schemas/types/lists.mock'; import { getThreatMock } from '../../../../common/detection_engine/schemas/types/threat.mock'; +import { + getSampleDetailsAsNdjson, + getOutputDetailsSampleWithExceptions, +} from '../../../../common/detection_engine/schemas/response/export_rules_details_schema.mock'; import { getQueryRuleParams } from '../schemas/rule_schemas.mock'; import { getExceptionListClientMock } from '../../../../../lists/server/services/exception_lists/exception_list_client.mock'; @@ -100,6 +104,7 @@ describe.each([ exportDetails: { exported_exception_list_count: 0, exported_exception_list_item_count: 0, + exported_count: 1, exported_rules_count: 1, missing_exception_list_item_count: 0, missing_exception_list_items: [], @@ -135,10 +140,13 @@ describe.each([ logger, isRuleRegistryEnabled ); + const details = getOutputDetailsSampleWithExceptions({ + missingRules: [{ rule_id: 'rule-1' }], + missingCount: 1, + }); expect(exports).toEqual({ rulesNdjson: '', - exportDetails: - '{"exported_rules_count":0,"missing_rules":[{"rule_id":"rule-1"}],"missing_rules_count":1,"exported_exception_list_count":0,"exported_exception_list_item_count":0,"missing_exception_list_item_count":0,"missing_exception_list_items":[],"missing_exception_lists":[],"missing_exception_lists_count":0}\n', + exportDetails: getSampleDetailsAsNdjson(details), exceptionLists: '', }); }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.ts index 81295c91976443..b8f1467cffe872 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_by_object_ids.ts @@ -72,7 +72,11 @@ export const getExportByObjectIds = async ( exceptionDetails ); - return { rulesNdjson, exportDetails, exceptionLists }; + return { + rulesNdjson, + exportDetails, + exceptionLists, + }; }; export const getRulesFromObjects = async ( diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_details_ndjson.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_details_ndjson.test.ts index 171233a8614665..e58d1b5088fcec 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_details_ndjson.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_details_ndjson.test.ts @@ -20,6 +20,7 @@ describe('getExportDetailsNdjson', () => { const details = getExportDetailsNdjson([rule]); const reParsed = JSON.parse(details); expect(reParsed).toEqual({ + exported_count: 1, exported_rules_count: 1, missing_rules: [], missing_rules_count: 0, @@ -31,6 +32,7 @@ describe('getExportDetailsNdjson', () => { const details = getExportDetailsNdjson([], [missingRule]); const reParsed = JSON.parse(details); expect(reParsed).toEqual({ + exported_count: 0, exported_rules_count: 0, missing_rules: [{ rule_id: 'rule-1' }], missing_rules_count: 1, @@ -49,6 +51,7 @@ describe('getExportDetailsNdjson', () => { const details = getExportDetailsNdjson([rule1, rule2], [missingRule1, missingRule2]); const reParsed = JSON.parse(details); expect(reParsed).toEqual({ + exported_count: 2, exported_rules_count: 2, missing_rules: [missingRule1, missingRule2], missing_rules_count: 2, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_details_ndjson.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_details_ndjson.ts index 429bf4f2926bfd..ad6b55272a52b5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_details_ndjson.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/get_export_details_ndjson.ts @@ -5,18 +5,27 @@ * 2.0. */ +import type { ExportExceptionDetails } from '@kbn/securitysolution-io-ts-list-types'; + +import { ExportRulesDetails } from '../../../../common/detection_engine/schemas/response/export_rules_details_schema'; import { RulesSchema } from '../../../../common/detection_engine/schemas/response/rules_schema'; export const getExportDetailsNdjson = ( rules: Array>, missingRules: Array<{ rule_id: string }> = [], - extraMeta: Record = {} + exceptionDetails?: ExportExceptionDetails ): string => { - const stringified = JSON.stringify({ + const stringified: ExportRulesDetails = { + exported_count: + exceptionDetails == null + ? rules.length + : rules.length + + exceptionDetails.exported_exception_list_count + + exceptionDetails.exported_exception_list_item_count, exported_rules_count: rules.length, missing_rules: missingRules, missing_rules_count: missingRules.length, - ...extraMeta, - }); - return `${stringified}\n`; + ...exceptionDetails, + }; + return `${JSON.stringify(stringified)}\n`; }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.test.ts index 8362942af15b94..dbf2fb7feac2ab 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ALERT_ORIGINAL_TIME } from '../../rule_types/field_maps/field_names'; +import { ALERT_ORIGINAL_TIME } from '../../../../../common/field_maps/field_names'; import { sampleThresholdAlert } from '../../rule_types/__mocks__/threshold'; import { buildThresholdSignalHistory } from './build_signal_history'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.ts index e5c21edbc9350b..b959f3de47a8af 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/build_signal_history.ts @@ -7,9 +7,9 @@ import { SearchHit } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { - ALERT_ORIGINAL_TIME, ALERT_RULE_THRESHOLD_FIELD, -} from '../../rule_types/field_maps/field_names'; + ALERT_ORIGINAL_TIME, +} from '../../../../../common/field_maps/field_names'; import { SimpleHit, ThresholdSignalHistory } from '../types'; import { getThresholdTermsHash, isWrappedRACAlert, isWrappedSignalHit } from '../utils'; diff --git a/x-pack/plugins/security_solution/server/lib/machine_learning/index.ts b/x-pack/plugins/security_solution/server/lib/machine_learning/index.ts index f8d767a371d9ac..b93e76c09282ea 100644 --- a/x-pack/plugins/security_solution/server/lib/machine_learning/index.ts +++ b/x-pack/plugins/security_solution/server/lib/machine_learning/index.ts @@ -11,7 +11,7 @@ import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-t import { buildExceptionFilter } from '@kbn/securitysolution-list-utils'; import { AnomalyRecordDoc as Anomaly } from '../../../../ml/server'; -export { Anomaly }; +export type { Anomaly }; export type AnomalyResults = estypes.SearchResponse; type MlAnomalySearch = ( searchParams: estypes.SearchRequest, diff --git a/x-pack/plugins/security_solution/server/lib/types.ts b/x-pack/plugins/security_solution/server/lib/types.ts index 2a1452e7b2fd3a..15f40fdbc30191 100644 --- a/x-pack/plugins/security_solution/server/lib/types.ts +++ b/x-pack/plugins/security_solution/server/lib/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -export { ConfigType as Configuration } from '../config'; +export type { ConfigType as Configuration } from '../config'; import { TotalValue, BaseHit, Explanation } from '../../common/detection_engine/types'; export interface ShardsResponse { diff --git a/x-pack/plugins/security_solution/server/plugin.ts b/x-pack/plugins/security_solution/server/plugin.ts index 307ccf4cfc9776..453bc339fc91c6 100644 --- a/x-pack/plugins/security_solution/server/plugin.ts +++ b/x-pack/plugins/security_solution/server/plugin.ts @@ -64,8 +64,6 @@ import { licenseService } from './lib/license'; import { PolicyWatcher } from './endpoint/lib/policy/license_watch'; import { migrateArtifactsToFleet } from './endpoint/lib/artifacts/migrate_artifacts_to_fleet'; import aadFieldConversion from './lib/detection_engine/routes/index/signal_aad_mapping.json'; -import { alertsFieldMap } from './lib/detection_engine/rule_types/field_maps/alerts'; -import { rulesFieldMap } from './lib/detection_engine/rule_types/field_maps/rules'; import { registerEventLogProvider } from './lib/detection_engine/rule_execution_log/event_log_adapter/register_event_log_provider'; import { getKibanaPrivilegesFeaturePrivileges, getCasesKibanaFeature } from './features'; import { EndpointMetadataService } from './endpoint/services/metadata'; @@ -88,8 +86,9 @@ import type { SecuritySolutionPluginStart, PluginInitializerContext, } from './plugin_contract'; +import { alertsFieldMap, rulesFieldMap } from '../common/field_maps'; -export { SetupPlugins, StartPlugins, PluginSetup, PluginStart } from './plugin_contract'; +export type { SetupPlugins, StartPlugins, PluginSetup, PluginStart } from './plugin_contract'; export class Plugin implements ISecuritySolutionPlugin { private readonly pluginContext: PluginInitializerContext; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/details/helpers.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/details/helpers.ts index fbc51aa0360ce3..918d3aadfd6e8e 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/details/helpers.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/details/helpers.ts @@ -209,7 +209,8 @@ export const getHostEndpoint = async ( ? getPendingActionCounts( esClient.asInternalUser, endpointContext.service.getEndpointMetadataService(), - [fleetAgentId] + [fleetAgentId], + endpointContext.experimentalFeatures.pendingActionResponsesWithAck ) .then((results) => { return results[0].pending_actions; diff --git a/x-pack/plugins/security_solution/server/utils/read_stream/create_stream_from_ndjson.ts b/x-pack/plugins/security_solution/server/utils/read_stream/create_stream_from_ndjson.ts index 914c684fe8813d..856d9b00dca7b7 100644 --- a/x-pack/plugins/security_solution/server/utils/read_stream/create_stream_from_ndjson.ts +++ b/x-pack/plugins/security_solution/server/utils/read_stream/create_stream_from_ndjson.ts @@ -34,12 +34,6 @@ export const filterExportedCounts = (): Transform => { ); }; -export const filterExportedRulesCounts = (): Transform => { - return createFilterStream( - (obj) => obj != null && !has('exported_rules_count', obj) - ); -}; - export const filterExceptions = (): Transform => { return createFilterStream( (obj) => obj != null && !has('list_id', obj) diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts index 231b88c39aeb8d..e28409871fb4d2 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts @@ -13,7 +13,8 @@ import { setup as policyAddSetup } from './policy_add.helpers'; import { setup as policyEditSetup } from './policy_edit.helpers'; import { setup as restoreSnapshotSetup } from './restore_snapshot.helpers'; -export { nextTick, getRandomString, findTestSubject, TestBed, delay } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test/jest'; +export { nextTick, getRandomString, findTestSubject, delay } from '@kbn/test/jest'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/snapshot_restore/public/application/components/index.ts b/x-pack/plugins/snapshot_restore/public/application/components/index.ts index 642f59d12c6f2d..77f53a3533a162 100644 --- a/x-pack/plugins/snapshot_restore/public/application/components/index.ts +++ b/x-pack/plugins/snapshot_restore/public/application/components/index.ts @@ -17,12 +17,8 @@ export { RestoreSnapshotForm } from './restore_snapshot_form'; export { PolicyExecuteProvider } from './policy_execute_provider'; export { PolicyDeleteProvider } from './policy_delete_provider'; export { CollapsibleIndicesList, CollapsibleDataStreamsList } from './collapsible_lists'; -export { - RetentionSettingsUpdateModalProvider, - UpdateRetentionSettings, -} from './retention_update_modal_provider'; -export { - RetentionExecuteModalProvider, - ExecuteRetention, -} from './retention_execute_modal_provider'; +export type { UpdateRetentionSettings } from './retention_update_modal_provider'; +export { RetentionSettingsUpdateModalProvider } from './retention_update_modal_provider'; +export type { ExecuteRetention } from './retention_execute_modal_provider'; +export { RetentionExecuteModalProvider } from './retention_execute_modal_provider'; export { PolicyForm } from './policy_form'; diff --git a/x-pack/plugins/snapshot_restore/public/application/index.tsx b/x-pack/plugins/snapshot_restore/public/application/index.tsx index c0b438e1761c68..69b4b2dab1b34c 100644 --- a/x-pack/plugins/snapshot_restore/public/application/index.tsx +++ b/x-pack/plugins/snapshot_restore/public/application/index.tsx @@ -37,4 +37,4 @@ export const renderApp = (elem: Element, dependencies: AppDependencies) => { }; }; -export { AppDependencies }; +export type { AppDependencies }; diff --git a/x-pack/plugins/snapshot_restore/public/application/lib/index.ts b/x-pack/plugins/snapshot_restore/public/application/lib/index.ts index 19a42bef4cea45..1462728e756b88 100644 --- a/x-pack/plugins/snapshot_restore/public/application/lib/index.ts +++ b/x-pack/plugins/snapshot_restore/public/application/lib/index.ts @@ -7,10 +7,8 @@ export { useDecodedParams } from './use_decoded_params'; +export type { SortField, SortDirection, SnapshotListParams } from './snapshot_list_params'; export { - SortField, - SortDirection, - SnapshotListParams, getListParams, getQueryFromListParams, DEFAULT_SNAPSHOT_LIST_PARAMS, diff --git a/x-pack/plugins/snapshot_restore/public/application/services/validation/index.ts b/x-pack/plugins/snapshot_restore/public/application/services/validation/index.ts index 90eca1f9fd1dd9..92d2e4117d0674 100644 --- a/x-pack/plugins/snapshot_restore/public/application/services/validation/index.ts +++ b/x-pack/plugins/snapshot_restore/public/application/services/validation/index.ts @@ -5,12 +5,11 @@ * 2.0. */ -export { - RepositoryValidation, - RepositorySettingsValidation, - validateRepository, -} from './validate_repository'; +export type { RepositoryValidation, RepositorySettingsValidation } from './validate_repository'; +export { validateRepository } from './validate_repository'; -export { RestoreValidation, validateRestore } from './validate_restore'; +export type { RestoreValidation } from './validate_restore'; +export { validateRestore } from './validate_restore'; -export { PolicyValidation, validatePolicy, ValidatePolicyHelperData } from './validate_policy'; +export type { PolicyValidation, ValidatePolicyHelperData } from './validate_policy'; +export { validatePolicy } from './validate_policy'; diff --git a/x-pack/plugins/snapshot_restore/public/shared_imports.ts b/x-pack/plugins/snapshot_restore/public/shared_imports.ts index a3cda90d26f2a1..cc86117d1f84ae 100644 --- a/x-pack/plugins/snapshot_restore/public/shared_imports.ts +++ b/x-pack/plugins/snapshot_restore/public/shared_imports.ts @@ -5,22 +5,24 @@ * 2.0. */ +export type { + Error, + Frequency, + SendRequestConfig, + SendRequestResponse, + UseRequestResponse, + UseRequestConfig, +} from '../../../../src/plugins/es_ui_shared/public'; export { AuthorizationProvider, CronEditor, - Error, - Frequency, NotAuthorizedSection, SectionError, PageError, PageLoading, sendRequest, - SendRequestConfig, - SendRequestResponse, - UseRequestResponse, useAuthorizationContext, useRequest, - UseRequestConfig, WithPrivileges, EuiCodeEditor, } from '../../../../src/plugins/es_ui_shared/public'; diff --git a/x-pack/plugins/snapshot_restore/server/test/helpers/index.ts b/x-pack/plugins/snapshot_restore/server/test/helpers/index.ts index 475d4d9a3e1702..682b520c12b00f 100644 --- a/x-pack/plugins/snapshot_restore/server/test/helpers/index.ts +++ b/x-pack/plugins/snapshot_restore/server/test/helpers/index.ts @@ -5,6 +5,7 @@ * 2.0. */ -export { RouterMock, RequestMock } from './router_mock'; +export type { RequestMock } from './router_mock'; +export { RouterMock } from './router_mock'; export { routeDependencies } from './route_dependencies'; diff --git a/x-pack/plugins/spaces/common/licensing/index.ts b/x-pack/plugins/spaces/common/licensing/index.ts index f7dd998a7561c8..5c23f035c84c5f 100644 --- a/x-pack/plugins/spaces/common/licensing/index.ts +++ b/x-pack/plugins/spaces/common/licensing/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { SpacesLicenseService, SpacesLicense } from './license_service'; +export type { SpacesLicense } from './license_service'; +export { SpacesLicenseService } from './license_service'; diff --git a/x-pack/plugins/spaces/public/index.ts b/x-pack/plugins/spaces/public/index.ts index fe04358e30483d..86f1afd234be3f 100644 --- a/x-pack/plugins/spaces/public/index.ts +++ b/x-pack/plugins/spaces/public/index.ts @@ -9,7 +9,7 @@ import { SpacesPlugin } from './plugin'; export { getSpaceColor, getSpaceImageUrl, getSpaceInitials } from './space_avatar'; -export { SpacesPluginSetup, SpacesPluginStart } from './plugin'; +export type { SpacesPluginSetup, SpacesPluginStart } from './plugin'; export type { Space, GetAllSpacesPurpose, GetSpaceResult } from '../common'; diff --git a/x-pack/plugins/spaces/server/index.ts b/x-pack/plugins/spaces/server/index.ts index ad27069759198b..6628d75a364945 100644 --- a/x-pack/plugins/spaces/server/index.ts +++ b/x-pack/plugins/spaces/server/index.ts @@ -19,9 +19,13 @@ export { addSpaceIdToPath } from '../common'; // end public contract exports -export { SpacesPluginSetup, SpacesPluginStart } from './plugin'; -export { SpacesServiceSetup, SpacesServiceStart } from './spaces_service'; -export { ISpacesClient, SpacesClientRepositoryFactory, SpacesClientWrapper } from './spaces_client'; +export type { SpacesPluginSetup, SpacesPluginStart } from './plugin'; +export type { SpacesServiceSetup, SpacesServiceStart } from './spaces_service'; +export type { + ISpacesClient, + SpacesClientRepositoryFactory, + SpacesClientWrapper, +} from './spaces_client'; export type { Space, diff --git a/x-pack/plugins/spaces/server/lib/copy_to_spaces/index.ts b/x-pack/plugins/spaces/server/lib/copy_to_spaces/index.ts index a4283d9837085e..a100056c57bcde 100644 --- a/x-pack/plugins/spaces/server/lib/copy_to_spaces/index.ts +++ b/x-pack/plugins/spaces/server/lib/copy_to_spaces/index.ts @@ -7,4 +7,4 @@ export { copySavedObjectsToSpacesFactory } from './copy_to_spaces'; export { resolveCopySavedObjectsToSpacesConflictsFactory } from './resolve_copy_conflicts'; -export { CopyResponse } from './types'; +export type { CopyResponse } from './types'; diff --git a/x-pack/plugins/spaces/server/spaces_client/index.ts b/x-pack/plugins/spaces/server/spaces_client/index.ts index 124d94ba07f2fe..b60d4fa2686f09 100644 --- a/x-pack/plugins/spaces/server/spaces_client/index.ts +++ b/x-pack/plugins/spaces/server/spaces_client/index.ts @@ -5,11 +5,12 @@ * 2.0. */ -export { SpacesClient, ISpacesClient } from './spaces_client'; -export { - SpacesClientService, +export type { ISpacesClient } from './spaces_client'; +export { SpacesClient } from './spaces_client'; +export type { SpacesClientServiceSetup, SpacesClientServiceStart, SpacesClientRepositoryFactory, SpacesClientWrapper, } from './spaces_client_service'; +export { SpacesClientService } from './spaces_client_service'; diff --git a/x-pack/plugins/spaces/server/spaces_service/index.ts b/x-pack/plugins/spaces/server/spaces_service/index.ts index adb311c2048e95..1fd77f742866de 100644 --- a/x-pack/plugins/spaces/server/spaces_service/index.ts +++ b/x-pack/plugins/spaces/server/spaces_service/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { SpacesService, SpacesServiceSetup, SpacesServiceStart } from './spaces_service'; +export type { SpacesServiceSetup, SpacesServiceStart } from './spaces_service'; +export { SpacesService } from './spaces_service'; diff --git a/x-pack/plugins/spaces/server/usage_stats/index.ts b/x-pack/plugins/spaces/server/usage_stats/index.ts index e8cba8fb198845..d3e736e174166d 100644 --- a/x-pack/plugins/spaces/server/usage_stats/index.ts +++ b/x-pack/plugins/spaces/server/usage_stats/index.ts @@ -6,5 +6,6 @@ */ export { SPACES_USAGE_STATS_TYPE } from './constants'; -export { UsageStatsService, UsageStatsServiceSetup } from './usage_stats_service'; -export { UsageStats } from './types'; +export type { UsageStatsServiceSetup } from './usage_stats_service'; +export { UsageStatsService } from './usage_stats_service'; +export type { UsageStats } from './types'; diff --git a/x-pack/plugins/stack_alerts/server/types.ts b/x-pack/plugins/stack_alerts/server/types.ts index b78aa4e6432d5e..a339e0b24921c0 100644 --- a/x-pack/plugins/stack_alerts/server/types.ts +++ b/x-pack/plugins/stack_alerts/server/types.ts @@ -8,7 +8,7 @@ import { PluginStartContract as TriggersActionsUiStartContract } from '../../triggers_actions_ui/server'; import { PluginSetupContract as AlertingSetup } from '../../alerting/server'; -export { +export type { PluginSetupContract as AlertingSetup, AlertType, RuleParamsAndRefs, diff --git a/x-pack/plugins/task_manager/server/index.ts b/x-pack/plugins/task_manager/server/index.ts index d078c7b78ad949..58fba0b6f68c7d 100644 --- a/x-pack/plugins/task_manager/server/index.ts +++ b/x-pack/plugins/task_manager/server/index.ts @@ -30,7 +30,7 @@ export { throwUnrecoverableError, isEphemeralTaskRejectedDueToCapacityError, } from './task_running'; -export { RunNowResult } from './task_scheduling'; +export type { RunNowResult } from './task_scheduling'; export { getOldestIdleActionTask } from './queries/oldest_idle_action_task'; export type { diff --git a/x-pack/plugins/task_manager/server/lib/fill_pool.ts b/x-pack/plugins/task_manager/server/lib/fill_pool.ts index c9050ebb75d69f..5d7d7a2a735c1f 100644 --- a/x-pack/plugins/task_manager/server/lib/fill_pool.ts +++ b/x-pack/plugins/task_manager/server/lib/fill_pool.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { performance } from 'perf_hooks'; import { Observable } from 'rxjs'; import { concatMap, last } from 'rxjs/operators'; import { ClaimOwnershipResult } from '../queries/task_claiming'; @@ -57,7 +56,6 @@ export async function fillPool( converter: (taskInstance: ConcreteTaskInstance) => TaskManagerRunner, run: (tasks: TaskManagerRunner[]) => Promise ): Promise { - performance.mark('fillPool.start'); return new Promise((resolve, reject) => { const stopTaskTimer = startTaskTimer(); const augmentTimingTo = ( @@ -76,12 +74,6 @@ export async function fillPool( res, async ({ docs, stats }) => { if (!docs.length) { - performance.mark('fillPool.bailNoTasks'); - performance.measure( - 'fillPool.activityDurationUntilNoTasks', - 'fillPool.start', - 'fillPool.bailNoTasks' - ); return asOk({ result: TaskPoolRunResult.NoTaskWereRan, stats }); } return asOk( @@ -106,20 +98,12 @@ export async function fillPool( ({ result, stats }) => { switch (result) { case TaskPoolRunResult.RanOutOfCapacity: - performance.mark('fillPool.bailExhaustedCapacity'); - performance.measure( - 'fillPool.activityDurationUntilExhaustedCapacity', - 'fillPool.start', - 'fillPool.bailExhaustedCapacity' - ); return augmentTimingTo(FillPoolResult.RanOutOfCapacity, stats); case TaskPoolRunResult.RunningAtCapacity: - performance.mark('fillPool.cycle'); return augmentTimingTo(FillPoolResult.RunningAtCapacity, stats); case TaskPoolRunResult.NoTaskWereRan: return augmentTimingTo(FillPoolResult.NoTasksClaimed, stats); default: - performance.mark('fillPool.cycle'); return augmentTimingTo(FillPoolResult.PoolFilled, stats); } }, diff --git a/x-pack/plugins/task_manager/server/monitoring/index.ts b/x-pack/plugins/task_manager/server/monitoring/index.ts index 99a4e31dbdb02e..a352ec55f2dbc6 100644 --- a/x-pack/plugins/task_manager/server/monitoring/index.ts +++ b/x-pack/plugins/task_manager/server/monitoring/index.ts @@ -18,10 +18,9 @@ import { TaskPollingLifecycle } from '../polling_lifecycle'; import { ManagedConfiguration } from '../lib/create_managed_configuration'; import { EphemeralTaskLifecycle } from '../ephemeral_task_lifecycle'; +export type { MonitoringStats, RawMonitoringStats } from './monitoring_stats_stream'; export { - MonitoringStats, HealthStatus, - RawMonitoringStats, summarizeMonitoringStats, createAggregators, createMonitoringStatsStream, diff --git a/x-pack/plugins/task_manager/server/monitoring/monitoring_stats_stream.ts b/x-pack/plugins/task_manager/server/monitoring/monitoring_stats_stream.ts index 08badf8fe1c9de..5175525b15cf19 100644 --- a/x-pack/plugins/task_manager/server/monitoring/monitoring_stats_stream.ts +++ b/x-pack/plugins/task_manager/server/monitoring/monitoring_stats_stream.ts @@ -37,7 +37,7 @@ import { ManagedConfiguration } from '../lib/create_managed_configuration'; import { EphemeralTaskLifecycle } from '../ephemeral_task_lifecycle'; import { CapacityEstimationStat, withCapacityEstimate } from './capacity_estimation'; -export { AggregatedStatProvider, AggregatedStat } from './runtime_statistics_aggregator'; +export type { AggregatedStatProvider, AggregatedStat } from './runtime_statistics_aggregator'; export interface MonitoringStats { last_update: string; diff --git a/x-pack/plugins/task_manager/server/polling/task_poller.ts b/x-pack/plugins/task_manager/server/polling/task_poller.ts index 37a283e4c45317..21a1579f85767c 100644 --- a/x-pack/plugins/task_manager/server/polling/task_poller.ts +++ b/x-pack/plugins/task_manager/server/polling/task_poller.ts @@ -9,8 +9,6 @@ * This module contains the logic for polling the task manager index for new work. */ -import { performance } from 'perf_hooks'; -import { after } from 'lodash'; import { Subject, merge, of, Observable, combineLatest, timer } from 'rxjs'; import { mapTo, filter, scan, concatMap, tap, catchError, switchMap } from 'rxjs/operators'; @@ -113,7 +111,6 @@ export function createTaskPoller({ // take as many argumented calls as we have capacity for and call `work` with // those arguments. If the queue is empty this will still trigger work to be done concatMap(async (set: Set) => { - closeSleepPerf(); return mapResult>>( await promiseResult( timeoutPromiseAfter( @@ -126,7 +123,6 @@ export function createTaskPoller({ (err: Error) => asPollingError(err, PollingErrorType.WorkError) ); }), - tap(openSleepPerf), // catch errors during polling for work catchError((err: Error) => of(asPollingError(err, PollingErrorType.WorkError))) ); @@ -177,13 +173,3 @@ export class PollingError extends Error { this.data = data; } } - -const openSleepPerf = () => { - performance.mark('TaskPoller.sleep'); -}; -// we only want to close after an open has been called, as we're counting the time *between* work cycles -// so we'll ignore the first call to `closeSleepPerf` but we will run every subsequent call -const closeSleepPerf = after(2, () => { - performance.mark('TaskPoller.poll'); - performance.measure('TaskPoller.sleepDuration', 'TaskPoller.sleep', 'TaskPoller.poll'); -}); diff --git a/x-pack/plugins/task_manager/server/task_pool.ts b/x-pack/plugins/task_manager/server/task_pool.ts index d394214e6c7780..87de0e691d4715 100644 --- a/x-pack/plugins/task_manager/server/task_pool.ts +++ b/x-pack/plugins/task_manager/server/task_pool.ts @@ -11,7 +11,6 @@ */ import { Observable, Subject } from 'rxjs'; import moment, { Duration } from 'moment'; -import { performance } from 'perf_hooks'; import { padStart } from 'lodash'; import { Logger } from '../../../../src/core/server'; import { TaskRunner } from './task_running'; @@ -111,7 +110,6 @@ export class TaskPool { public run = async (tasks: TaskRunner[]): Promise => { const [tasksToRun, leftOverTasks] = partitionListByCount(tasks, this.availableWorkers); if (tasksToRun.length) { - performance.mark('attemptToRun_start'); await Promise.all( tasksToRun .filter((taskRunner) => !this.tasksInPool.has(taskRunner.id)) @@ -130,9 +128,6 @@ export class TaskPool { .catch((err) => this.handleFailureOfMarkAsRunning(taskRunner, err)); }) ); - - performance.mark('attemptToRun_stop'); - performance.measure('taskPool.attemptToRun', 'attemptToRun_start', 'attemptToRun_stop'); } if (leftOverTasks.length) { diff --git a/x-pack/plugins/task_manager/server/task_running/task_runner.ts b/x-pack/plugins/task_manager/server/task_running/task_runner.ts index 919360952ebd41..2a5d48845ce483 100644 --- a/x-pack/plugins/task_manager/server/task_running/task_runner.ts +++ b/x-pack/plugins/task_manager/server/task_running/task_runner.ts @@ -13,7 +13,6 @@ import apm from 'elastic-apm-node'; import { withSpan } from '@kbn/apm-utils'; -import { performance } from 'perf_hooks'; import { identity, defaults, flow } from 'lodash'; import { Logger, @@ -313,7 +312,6 @@ export class TaskManagerRunner implements TaskRunner { }` ); } - performance.mark('markTaskAsRunning_start'); const apmTrans = apm.startTransaction('taskManager', 'taskManager markTaskAsRunning'); @@ -372,12 +370,10 @@ export class TaskManagerRunner implements TaskRunner { } if (apmTrans) apmTrans.end('success'); - performanceStopMarkingTaskAsRunning(); this.onTaskEvent(asTaskMarkRunningEvent(this.id, asOk(this.instance.task))); return true; } catch (error) { if (apmTrans) apmTrans.end('failure'); - performanceStopMarkingTaskAsRunning(); this.onTaskEvent(asTaskMarkRunningEvent(this.id, asErr(error))); if (!SavedObjectsErrorHelpers.isConflictError(error)) { if (!SavedObjectsErrorHelpers.isNotFoundError(error)) { @@ -617,15 +613,6 @@ function howManyMsUntilOwnershipClaimExpires(ownershipClaimedUntil: Date | null) return ownershipClaimedUntil ? ownershipClaimedUntil.getTime() - Date.now() : 0; } -function performanceStopMarkingTaskAsRunning() { - performance.mark('markTaskAsRunning_stop'); - performance.measure( - 'taskRunner.markTaskAsRunning', - 'markTaskAsRunning_start', - 'markTaskAsRunning_stop' - ); -} - // A type that extracts the Instance type out of TaskRunningStage // This helps us to better communicate to the developer what the expected "stage" // in a specific place in the code might be diff --git a/x-pack/plugins/timelines/common/types/timeline/cells/index.ts b/x-pack/plugins/timelines/common/types/timeline/cells/index.ts index ce22d87c0a59a2..e922fed97a4df0 100644 --- a/x-pack/plugins/timelines/common/types/timeline/cells/index.ts +++ b/x-pack/plugins/timelines/common/types/timeline/cells/index.ts @@ -23,6 +23,7 @@ export type CellValueElementProps = EuiDataGridCellValueElementProps & { globalFilters?: Filter[]; header: ColumnHeaderOptions; isDraggable: boolean; + isTimeline?: boolean; // Default cell renderer is used for both the alert table and timeline. This allows us to cheaply separate concerns linkValues: string[] | undefined; rowRenderers?: RowRenderer[]; // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/x-pack/plugins/timelines/kibana.json b/x-pack/plugins/timelines/kibana.json index 0239dcdd8f1660..11adf42b3a6b40 100644 --- a/x-pack/plugins/timelines/kibana.json +++ b/x-pack/plugins/timelines/kibana.json @@ -11,5 +11,5 @@ "server": true, "ui": true, "requiredPlugins": ["alerting", "cases", "data", "dataEnhanced", "kibanaReact", "kibanaUtils"], - "optionalPlugins": [] + "optionalPlugins": ["security"] } diff --git a/x-pack/plugins/timelines/public/components/clipboard/with_copy_to_clipboard.tsx b/x-pack/plugins/timelines/public/components/clipboard/with_copy_to_clipboard.tsx index a62f52c27cf702..714e2c5fcb8fe2 100644 --- a/x-pack/plugins/timelines/public/components/clipboard/with_copy_to_clipboard.tsx +++ b/x-pack/plugins/timelines/public/components/clipboard/with_copy_to_clipboard.tsx @@ -26,7 +26,7 @@ export const WithCopyToClipboard = React.memo<{ showTooltip?: boolean; text: string; titleSummary?: string; -}>(({ isHoverAction, keyboardShortcut = '', showTooltip = false, text, titleSummary }) => { +}>(({ isHoverAction, keyboardShortcut = '', showTooltip = true, text, titleSummary }) => { return showTooltip ? ( { const filterOutValueFn = useCallback(() => { const makeFilter = (currentVal: string | null | undefined) => - currentVal?.length === 0 + currentVal == null || currentVal?.length === 0 ? createFilter(field, null, false) : createFilter(field, currentVal, true); const filters = Array.isArray(value) diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/sort/index.ts b/x-pack/plugins/timelines/public/components/t_grid/body/sort/index.ts index e514e4f4e2618f..9e653e1b2bb8ea 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/sort/index.ts +++ b/x-pack/plugins/timelines/public/components/t_grid/body/sort/index.ts @@ -9,7 +9,7 @@ import { SortDirection } from '../../../../../common/types/timeline'; import type { SortColumnTimeline } from '../../../../../common/types/timeline'; // TODO: Cleanup this type to match SortColumnTimeline -export { SortDirection }; +export type { SortDirection }; /** Specifies which column the timeline is sorted on */ export type Sort = SortColumnTimeline; diff --git a/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts b/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts index d15b4e69807675..34622423781f91 100644 --- a/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts +++ b/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts @@ -126,7 +126,7 @@ export const useAddToCase = ({ } }, [event]); const isSecurityAlert = useMemo(() => { - return !isEmpty(event?.ecs.signal?.rule?.id); + return !isEmpty(event?.ecs.signal?.rule?.id ?? event?.ecs.kibana?.alert?.rule?.uuid); }, [event]); const isEventSupported = isSecurityAlert || isAlert; const userCanCrud = casePermissions?.crud ?? false; diff --git a/x-pack/plugins/timelines/public/index.ts b/x-pack/plugins/timelines/public/index.ts index 70f7185e9c486d..040137a9ea5451 100644 --- a/x-pack/plugins/timelines/public/index.ts +++ b/x-pack/plugins/timelines/public/index.ts @@ -26,14 +26,14 @@ export type { export { Direction } from '../common/search_strategy/common'; export { tGridReducer } from './store/t_grid/reducer'; export type { TGridModelForTimeline, TimelineState, TimelinesUIStart } from './types'; -export { TGridType, SortDirection } from './types'; +export type { TGridType, SortDirection } from './types'; +export type { OnColumnFocused } from '../common/utils/accessibility'; export { ARIA_COLINDEX_ATTRIBUTE, ARIA_ROWINDEX_ATTRIBUTE, DATA_COLINDEX_ATTRIBUTE, DATA_ROWINDEX_ATTRIBUTE, FIRST_ARIA_INDEX, - OnColumnFocused, arrayIndexToAriaIndex, elementOrChildrenHasFocus, isArrowDownOrArrowUp, diff --git a/x-pack/plugins/timelines/server/index.ts b/x-pack/plugins/timelines/server/index.ts index ef18226a0e60c7..e14ac343ed8152 100644 --- a/x-pack/plugins/timelines/server/index.ts +++ b/x-pack/plugins/timelines/server/index.ts @@ -12,4 +12,4 @@ export function plugin(initializerContext: PluginInitializerContext) { return new TimelinesPlugin(initializerContext); } -export { TimelinesPluginUI, TimelinesPluginStart } from './types'; +export type { TimelinesPluginUI, TimelinesPluginStart } from './types'; diff --git a/x-pack/plugins/timelines/server/plugin.ts b/x-pack/plugins/timelines/server/plugin.ts index 79d35e53fada11..4cda6c1ab31760 100644 --- a/x-pack/plugins/timelines/server/plugin.ts +++ b/x-pack/plugins/timelines/server/plugin.ts @@ -18,11 +18,13 @@ import { defineRoutes } from './routes'; import { timelineSearchStrategyProvider } from './search_strategy/timeline'; import { timelineEqlSearchStrategyProvider } from './search_strategy/timeline/eql'; import { indexFieldsProvider } from './search_strategy/index_fields'; +import { SecurityPluginSetup } from '../../security/server'; export class TimelinesPlugin implements Plugin { private readonly logger: Logger; + private security?: SecurityPluginSetup; constructor(initializerContext: PluginInitializerContext) { this.logger = initializerContext.logger.get(); @@ -30,6 +32,8 @@ export class TimelinesPlugin public setup(core: CoreSetup, plugins: SetupPlugins) { this.logger.debug('timelines: Setup'); + this.security = plugins.security; + const router = core.http.createRouter(); // Register server side APIs @@ -39,7 +43,8 @@ export class TimelinesPlugin core.getStartServices().then(([_, depsStart]) => { const TimelineSearchStrategy = timelineSearchStrategyProvider( depsStart.data, - depsStart.alerting + depsStart.alerting, + this.security ); const TimelineEqlSearchStrategy = timelineEqlSearchStrategyProvider(depsStart.data); const IndexFields = indexFieldsProvider(); diff --git a/x-pack/plugins/timelines/server/search_strategy/timeline/index.ts b/x-pack/plugins/timelines/server/search_strategy/timeline/index.ts index b2e073d3ecf599..21b920047d694f 100644 --- a/x-pack/plugins/timelines/server/search_strategy/timeline/index.ts +++ b/x-pack/plugins/timelines/server/search_strategy/timeline/index.ts @@ -32,16 +32,20 @@ import { ENHANCED_ES_SEARCH_STRATEGY, ISearchOptions, } from '../../../../../../src/plugins/data/common'; +import { AuditLogger, SecurityPluginSetup } from '../../../../security/server'; +import { AlertAuditAction, alertAuditEvent } from '../../../../rule_registry/server'; export const timelineSearchStrategyProvider = ( data: PluginStart, - alerting: AlertingPluginStartContract + alerting: AlertingPluginStartContract, + security?: SecurityPluginSetup ): ISearchStrategy, TimelineStrategyResponseType> => { const esAsInternal = data.search.searchAsInternalUser; const es = data.search.getSearchStrategy(ENHANCED_ES_SEARCH_STRATEGY); return { search: (request, options, deps) => { + const securityAuditLogger = security?.audit.asScoped(deps.request); const factoryQueryType = request.factoryQueryType; const entityType = request.entityType; @@ -59,6 +63,7 @@ export const timelineSearchStrategyProvider = ({ deps, queryFactory, alerting, + auditLogger, }: { es: ISearchStrategy; request: TimelineStrategyRequestType; @@ -111,9 +117,8 @@ const timelineAlertsSearchStrategy = ({ deps: SearchStrategyDependencies; alerting: AlertingPluginStartContract; queryFactory: TimelineFactory; + auditLogger: AuditLogger | undefined; }) => { - // Based on what solution alerts you want to see, figures out what corresponding - // index to query (ex: siem --> .alerts-security.alerts) const indices = request.defaultIndex ?? request.indexType; const requestWithAlertsIndices = { ...request, defaultIndex: indices, indexName: indices }; @@ -133,17 +138,46 @@ const timelineAlertsSearchStrategy = ({ return from(getAuthFilter()).pipe( mergeMap(({ filter }) => { - const dsl = queryFactory.buildDsl({ ...requestWithAlertsIndices, authFilter: filter }); + const dsl = queryFactory.buildDsl({ + ...requestWithAlertsIndices, + authFilter: filter, + }); return es.search({ ...requestWithAlertsIndices, params: dsl }, options, deps); }), map((response) => { + const rawResponse = shimHitsTotal(response.rawResponse, options); + // Do we have to loop over each hit? Yes. + // ecs auditLogger requires that we log each alert independently + if (auditLogger != null) { + rawResponse.hits?.hits?.forEach((hit) => { + auditLogger.log( + alertAuditEvent({ + action: AlertAuditAction.FIND, + id: hit._id, + outcome: 'success', + }) + ); + }); + } + return { ...response, - rawResponse: shimHitsTotal(response.rawResponse, options), + rawResponse, }; }), mergeMap((esSearchRes) => queryFactory.parse(requestWithAlertsIndices, esSearchRes)), catchError((err) => { + // check if auth error, if yes, write to ecs logger + if (auditLogger != null && err?.output?.statusCode === 403) { + auditLogger.log( + alertAuditEvent({ + action: AlertAuditAction.FIND, + outcome: 'failure', + error: err, + }) + ); + } + throw err; }) ); diff --git a/x-pack/plugins/timelines/server/types.ts b/x-pack/plugins/timelines/server/types.ts index 26748c37fa1e1a..f9a80908fbc719 100644 --- a/x-pack/plugins/timelines/server/types.ts +++ b/x-pack/plugins/timelines/server/types.ts @@ -8,6 +8,7 @@ // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { DataPluginSetup, DataPluginStart } from '../../../../src/plugins/data/server/plugin'; import { PluginStartContract as AlertingPluginStartContract } from '../../alerting/server'; +import { SecurityPluginSetup } from '../../security/server'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface TimelinesPluginUI {} @@ -16,6 +17,7 @@ export interface TimelinesPluginStart {} export interface SetupPlugins { data: DataPluginSetup; + security?: SecurityPluginSetup; } export interface StartPlugins { diff --git a/x-pack/plugins/transform/common/shared_imports.ts b/x-pack/plugins/transform/common/shared_imports.ts index 42e77938d9ceca..22201cf7c0757d 100644 --- a/x-pack/plugins/transform/common/shared_imports.ts +++ b/x-pack/plugins/transform/common/shared_imports.ts @@ -5,12 +5,12 @@ * 2.0. */ +export type { ChartData } from '../../ml/common'; export { composeValidators, isPopulatedObject, isRuntimeMappings, patternValidator, - ChartData, } from '../../ml/common'; export { RUNTIME_FIELD_TYPES } from '../../../../src/plugins/data/common'; diff --git a/x-pack/plugins/transform/public/app/common/index.ts b/x-pack/plugins/transform/public/app/common/index.ts index ccd90f87593588..7081b6db2fe405 100644 --- a/x-pack/plugins/transform/public/app/common/index.ts +++ b/x-pack/plugins/transform/public/app/common/index.ts @@ -11,35 +11,46 @@ export { getPivotPreviewDevConsoleStatement, INIT_MAX_COLUMNS, } from './data_grid'; +export type { EsDoc, EsDocSource } from './fields'; export { getDefaultSelectableFields, getFlattenedFields, getSelectableFields, toggleSelectedField, - EsDoc, - EsDocSource, } from './fields'; -export { DropDownLabel, DropDownOption, Label } from './dropdown'; +export type { DropDownLabel, DropDownOption, Label } from './dropdown'; export { isTransformIdValid, refreshTransformList$, useRefreshTransformList, REFRESH_TRANSFORM_LIST_STATE, } from './transform'; -export { TRANSFORM_LIST_COLUMN, TransformListAction, TransformListRow } from './transform_list'; +export type { TransformListAction, TransformListRow } from './transform_list'; +export { TRANSFORM_LIST_COLUMN } from './transform_list'; export { getTransformProgress, isCompletedBatchTransform } from './transform_stats'; -export { - getEsAggFromAggConfig, - isPivotAggsConfigWithUiSupport, - isPivotAggsConfigPercentiles, - PERCENTILES_AGG_DEFAULT_PERCENTS, +export type { PivotAggsConfig, PivotAggsConfigDict, PivotAggsConfigBase, PivotAggsConfigWithUiSupport, PivotAggsConfigWithUiSupportDict, +} from './pivot_aggs'; +export { + getEsAggFromAggConfig, + isPivotAggsConfigWithUiSupport, + isPivotAggsConfigPercentiles, + PERCENTILES_AGG_DEFAULT_PERCENTS, pivotAggsFieldSupport, } from './pivot_aggs'; +export type { + GroupByConfigWithInterval, + GroupByConfigWithUiSupport, + PivotGroupByConfig, + PivotGroupByConfigDict, + PivotGroupByConfigWithUiSupportDict, + PivotSupportedGroupByAggs, + PivotSupportedGroupByAggsWithInterval, +} from './pivot_group_by'; export { dateHistogramIntervalFormatRegex, getEsAggFromGroupByConfig, @@ -49,15 +60,9 @@ export { isGroupByHistogram, isGroupByTerms, pivotGroupByFieldSupport, - GroupByConfigWithInterval, - GroupByConfigWithUiSupport, - PivotGroupByConfig, - PivotGroupByConfigDict, - PivotGroupByConfigWithUiSupportDict, - PivotSupportedGroupByAggs, - PivotSupportedGroupByAggsWithInterval, PIVOT_SUPPORTED_GROUP_BY_AGGS, } from './pivot_group_by'; +export type { PivotQuery, SimpleQuery } from './request'; export { defaultQuery, getPreviewTransformRequestBody, @@ -68,6 +73,4 @@ export { isMatchAllQuery, isSimpleQuery, matchAllQuery, - PivotQuery, - SimpleQuery, } from './request'; diff --git a/x-pack/plugins/transform/public/app/hooks/use_search_items/index.ts b/x-pack/plugins/transform/public/app/hooks/use_search_items/index.ts index eacfa20f3f0735..14f2dde8a3fa7c 100644 --- a/x-pack/plugins/transform/public/app/hooks/use_search_items/index.ts +++ b/x-pack/plugins/transform/public/app/hooks/use_search_items/index.ts @@ -5,5 +5,5 @@ * 2.0. */ -export { SavedSearchQuery, SearchItems } from './common'; +export type { SavedSearchQuery, SearchItems } from './common'; export { useSearchItems } from './use_search_items'; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/index.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/index.ts index ac1f427d6bf97c..df038845bc260a 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/index.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/index.ts @@ -5,5 +5,7 @@ * 2.0. */ -export { AggListForm, AggListProps } from './list_form'; -export { AggListSummary, AggListSummaryProps } from './list_summary'; +export type { AggListProps } from './list_form'; +export { AggListForm } from './list_form'; +export type { AggListSummaryProps } from './list_summary'; +export { AggListSummary } from './list_summary'; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/index.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/index.ts index b7461f63f2adb0..c2bd23974c8923 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/index.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/index.ts @@ -6,4 +6,4 @@ */ export { filterAggsFieldSupport, FILTERS } from './constants'; -export { FilterAggType } from './types'; +export type { FilterAggType } from './types'; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/index.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/index.ts index 5014b8a4c80fc3..775401decef352 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/index.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/index.ts @@ -5,16 +5,12 @@ * 2.0. */ -export { - defaultSearch, - QUERY_LANGUAGE, - QUERY_LANGUAGE_KUERY, - QUERY_LANGUAGE_LUCENE, -} from './constants'; +export type { QUERY_LANGUAGE } from './constants'; +export { defaultSearch, QUERY_LANGUAGE_KUERY, QUERY_LANGUAGE_LUCENE } from './constants'; export { applyTransformConfigToDefineState } from './apply_transform_config_to_define_state'; export { getAggNameConflictToastMessages } from './get_agg_name_conflict_toast_messages'; export { getDefaultAggregationConfig } from './get_default_aggregation_config'; export { getDefaultGroupByConfig } from './get_default_group_by_config'; export { getDefaultStepDefineState } from './get_default_step_define_state'; export { getPivotDropdownOptions } from './get_pivot_dropdown_options'; -export { ErrorMessage, Field, StepDefineExposedState } from './types'; +export type { ErrorMessage, Field, StepDefineExposedState } from './types'; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/index.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/index.ts index 3c0ce70bd09956..5646e420a8ec74 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/index.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/index.ts @@ -5,13 +5,13 @@ * 2.0. */ +export type { StepDefineExposedState } from './common'; export { defaultSearch, applyTransformConfigToDefineState, getDefaultStepDefineState, - StepDefineExposedState, QUERY_LANGUAGE_KUERY, } from './common'; -export { StepDefineFormHook } from './hooks/use_step_define_form'; +export type { StepDefineFormHook } from './hooks/use_step_define_form'; export { StepDefineForm } from './step_define_form'; export { StepDefineSummary } from './step_define_summary'; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_details/index.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_details/index.ts index bbc4b42e1b236e..6045005dd4a0a2 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_details/index.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_details/index.ts @@ -5,10 +5,7 @@ * 2.0. */ -export { - applyTransformConfigToDetailsState, - getDefaultStepDetailsState, - StepDetailsExposedState, -} from './common'; +export type { StepDetailsExposedState } from './common'; +export { applyTransformConfigToDetailsState, getDefaultStepDetailsState } from './common'; export { StepDetailsForm } from './step_details_form'; export { StepDetailsSummary } from './step_details_summary'; diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/stats_bar/index.ts b/x-pack/plugins/transform/public/app/sections/transform_management/components/stats_bar/index.ts index 8d28d175943ca6..a656966fa8330e 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/stats_bar/index.ts +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/stats_bar/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { StatsBar, TransformStatsBarStats } from './stats_bar'; +export type { TransformStatsBarStats } from './stats_bar'; +export { StatsBar } from './stats_bar'; diff --git a/x-pack/plugins/transform/public/shared_imports.ts b/x-pack/plugins/transform/public/shared_imports.ts index b8f5d882058585..c8375af88a2131 100644 --- a/x-pack/plugins/transform/public/shared_imports.ts +++ b/x-pack/plugins/transform/public/shared_imports.ts @@ -6,20 +6,20 @@ */ export { XJsonMode } from '@kbn/ace'; -export { UseRequestConfig, useRequest } from '../../../../src/plugins/es_ui_shared/public'; +export type { UseRequestConfig } from '../../../../src/plugins/es_ui_shared/public'; +export { useRequest } from '../../../../src/plugins/es_ui_shared/public'; export { getSavedSearch, getSavedSearchUrlConflictMessage, } from '../../../../src/plugins/discover/public'; -export { - getMlSharedImports, +export type { GetMlSharedImportsReturnType, UseIndexDataReturnType, EsSorting, RenderCellValue, - ES_CLIENT_TOTAL_HITS_RELATION, } from '../../ml/public'; +export { getMlSharedImports, ES_CLIENT_TOTAL_HITS_RELATION } from '../../ml/public'; import { XJson } from '../../../../src/plugins/es_ui_shared/public'; const { expandLiteralStrings, collapseLiteralStrings } = XJson; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 47876265894ecf..ca2acee8d09c53 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -4391,7 +4391,6 @@ "share.contextMenu.permalinksLabel": "パーマリンク", "share.contextMenuTitle": "この {objectType} を共有", "share.urlGenerators.error.createUrlFnProvided": "このジェネレーターは非推奨とマークされています。createUrl fn を付けないでください。", - "share.urlGenerators.error.migrateCalledNotDeprecated": "非推奨以外のジェネレーターで migrate を呼び出すことはできません。", "share.urlGenerators.error.migrationFnGivenNotDeprecated": "移行機能を提供する場合、このジェネレーターに非推奨マークを付ける必要があります", "share.urlGenerators.error.noCreateUrlFnProvided": "このジェネレーターには非推奨のマークがありません。createUrl fn を付けてください。", "share.urlGenerators.error.noMigrationFnProvided": "アクセスリンクジェネレーターに非推奨マークが付いている場合、移行機能を提供する必要があります。", @@ -6234,7 +6233,6 @@ "xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentTitle": "サービス構成", "xpack.apm.fleet_integration.settings.apm.expvarEnabledDescription": "/debug/varsの下に公開されます", "xpack.apm.fleet_integration.settings.apm.expvarEnabledTitle": "APM Server Golang expvarサポートを有効にする", - "xpack.apm.fleet_integration.settings.apm.hostDescription": "この統合の使用方法を識別できるように、名前と説明を選択してください。", "xpack.apm.fleet_integration.settings.apm.hostLabel": "ホスト", "xpack.apm.fleet_integration.settings.apm.hostTitle": "サーバー構成", "xpack.apm.fleet_integration.settings.apm.idleTimeoutLabel": "基本接続が終了するまでのアイドル時間", @@ -6244,7 +6242,6 @@ "xpack.apm.fleet_integration.settings.apm.maxHeaderBytesLabel": "リクエストヘッダーの最大サイズ(バイト)", "xpack.apm.fleet_integration.settings.apm.maxHeaderBytesTitle": "上限", "xpack.apm.fleet_integration.settings.apm.readTimeoutLabel": "リクエスト全体を読み取る最大期間", - "xpack.apm.fleet_integration.settings.apm.responseHeadersDescription": "リクエストヘッダーサイズおよびタイミング構成の上限を設定します。", "xpack.apm.fleet_integration.settings.apm.responseHeadersHelpText": "セキュリティポリシー遵守目的で使用できます。", "xpack.apm.fleet_integration.settings.apm.responseHeadersLabel": "HTTP応答に追加されたカスタムHTTPヘッダー", "xpack.apm.fleet_integration.settings.apm.responseHeadersTitle": "カスタムヘッダー", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 0fd4fea956a116..a1cb499b6042ca 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -4434,7 +4434,6 @@ "share.contextMenu.permalinksLabel": "固定链接", "share.contextMenuTitle": "共享此 {objectType}", "share.urlGenerators.error.createUrlFnProvided": "此生成器标记为已过时。切勿提供 createUrl 函数。", - "share.urlGenerators.error.migrateCalledNotDeprecated": "无法在非过时的生成器上调用迁移。", "share.urlGenerators.error.migrationFnGivenNotDeprecated": "如果提供了迁移函数,则必须将此生成器标记为已过时", "share.urlGenerators.error.noCreateUrlFnProvided": "此生成器未标记为已过时。请提供 createUrl 函数。", "share.urlGenerators.error.noMigrationFnProvided": "如果访问链接生成器标记为已过时,则必须提供迁移函数。", @@ -6283,7 +6282,6 @@ "xpack.apm.fleet_integration.settings.apm.defaultServiceEnvironmentTitle": "服务配置", "xpack.apm.fleet_integration.settings.apm.expvarEnabledDescription": "在 /debug/vars 下公开", "xpack.apm.fleet_integration.settings.apm.expvarEnabledTitle": "启用 APM Server Golang expvar 支持", - "xpack.apm.fleet_integration.settings.apm.hostDescription": "选择有助于确定如何使用此集成的名称和描述。", "xpack.apm.fleet_integration.settings.apm.hostLabel": "主机", "xpack.apm.fleet_integration.settings.apm.hostTitle": "服务器配置", "xpack.apm.fleet_integration.settings.apm.idleTimeoutLabel": "基础连接关闭前的空闲时间", @@ -6293,7 +6291,6 @@ "xpack.apm.fleet_integration.settings.apm.maxHeaderBytesLabel": "请求标头的最大大小(字节)", "xpack.apm.fleet_integration.settings.apm.maxHeaderBytesTitle": "限制", "xpack.apm.fleet_integration.settings.apm.readTimeoutLabel": "读取整个请求的最大持续时间", - "xpack.apm.fleet_integration.settings.apm.responseHeadersDescription": "设置请求标头大小限制和计时配置。", "xpack.apm.fleet_integration.settings.apm.responseHeadersHelpText": "可能会用于安全策略合规。", "xpack.apm.fleet_integration.settings.apm.responseHeadersLabel": "添加到 HTTP 响应的定制 HTTP 标头", "xpack.apm.fleet_integration.settings.apm.responseHeadersTitle": "定制标头", diff --git a/x-pack/plugins/triggers_actions_ui/public/types.ts b/x-pack/plugins/triggers_actions_ui/public/types.ts index 8085f9245f4e9c..0b35317cad9b3e 100644 --- a/x-pack/plugins/triggers_actions_ui/public/types.ts +++ b/x-pack/plugins/triggers_actions_ui/public/types.ts @@ -43,7 +43,7 @@ import { type Alert = SanitizedAlert; type ResolvedRule = ResolvedSanitizedRule; -export { +export type { Alert, AlertAction, AlertAggregations, @@ -56,13 +56,12 @@ export { AlertTypeParams, ResolvedRule, }; +export type { ActionType, AsApiContract }; export { - ActionType, AlertHistoryEsIndexConnectorId, AlertHistoryDocumentTemplate, AlertHistoryDefaultIndexName, ALERT_HISTORY_PREFIX, - AsApiContract, }; export type ActionTypeIndex = Record; diff --git a/x-pack/plugins/triggers_actions_ui/server/data/index.ts b/x-pack/plugins/triggers_actions_ui/server/data/index.ts index 7bc14d0619d79e..1f6f39a57cbc8c 100644 --- a/x-pack/plugins/triggers_actions_ui/server/data/index.ts +++ b/x-pack/plugins/triggers_actions_ui/server/data/index.ts @@ -9,9 +9,8 @@ import { Logger, IRouter } from '../../../../../src/core/server'; import { timeSeriesQuery } from './lib/time_series_query'; import { registerRoutes } from './routes'; +export type { TimeSeriesQuery, CoreQueryParams } from './lib'; export { - TimeSeriesQuery, - CoreQueryParams, CoreQueryParamsSchemaProperties, validateCoreQueryBody, validateTimeWindowUnits, diff --git a/x-pack/plugins/triggers_actions_ui/server/data/lib/index.ts b/x-pack/plugins/triggers_actions_ui/server/data/lib/index.ts index aeaee619354490..c76eb1cafa8671 100644 --- a/x-pack/plugins/triggers_actions_ui/server/data/lib/index.ts +++ b/x-pack/plugins/triggers_actions_ui/server/data/lib/index.ts @@ -5,9 +5,9 @@ * 2.0. */ -export { TimeSeriesQuery } from './time_series_query'; +export type { TimeSeriesQuery } from './time_series_query'; +export type { CoreQueryParams } from './core_query_types'; export { - CoreQueryParams, CoreQueryParamsSchemaProperties, validateCoreQueryBody, validateTimeWindowUnits, diff --git a/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_query.ts b/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_query.ts index 0be981661f5655..ca4c7c8acc5dc0 100644 --- a/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_query.ts +++ b/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_query.ts @@ -12,7 +12,7 @@ import { DEFAULT_GROUPS } from '../index'; import { getDateRangeInfo } from './date_range_info'; import { TimeSeriesQuery, TimeSeriesResult, TimeSeriesResultRow } from './time_series_types'; -export { TimeSeriesQuery, TimeSeriesResult } from './time_series_types'; +export type { TimeSeriesQuery, TimeSeriesResult } from './time_series_types'; export interface TimeSeriesQueryParameters { logger: Logger; diff --git a/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_types.ts b/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_types.ts index f6a1950c0fd97c..125bdaa487fd2d 100644 --- a/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_types.ts +++ b/x-pack/plugins/triggers_actions_ui/server/data/lib/time_series_types.ts @@ -19,7 +19,7 @@ import { getDateStartAfterDateEndErrorMessage, } from './date_range_info'; -export { TimeSeriesResult, TimeSeriesResultRow, MetricResult } from '../../../common/data'; +export type { TimeSeriesResult, TimeSeriesResultRow, MetricResult } from '../../../common/data'; // The parameters here are very similar to the alert parameters. // Missing are `comparator` and `threshold`, which aren't needed to generate diff --git a/x-pack/plugins/triggers_actions_ui/server/data/routes/time_series_query.ts b/x-pack/plugins/triggers_actions_ui/server/data/routes/time_series_query.ts index da6638db2e4579..8b618b3ae3d49e 100644 --- a/x-pack/plugins/triggers_actions_ui/server/data/routes/time_series_query.ts +++ b/x-pack/plugins/triggers_actions_ui/server/data/routes/time_series_query.ts @@ -16,7 +16,7 @@ import { Logger } from '../../../../../../src/core/server'; import { TimeSeriesQueryParameters } from '../lib/time_series_query'; import { TimeSeriesQuery, TimeSeriesQuerySchema, TimeSeriesResult } from '../lib/time_series_types'; -export { TimeSeriesQuery, TimeSeriesResult } from '../lib/time_series_types'; +export type { TimeSeriesQuery, TimeSeriesResult } from '../lib/time_series_types'; export function createTimeSeriesQueryRoute( logger: Logger, diff --git a/x-pack/plugins/triggers_actions_ui/server/index.ts b/x-pack/plugins/triggers_actions_ui/server/index.ts index 89c17ea0d41890..2f33f3bd77cc0d 100644 --- a/x-pack/plugins/triggers_actions_ui/server/index.ts +++ b/x-pack/plugins/triggers_actions_ui/server/index.ts @@ -8,10 +8,9 @@ import { PluginConfigDescriptor, PluginInitializerContext } from 'kibana/server' import { configSchema, ConfigSchema } from '../config'; import { TriggersActionsPlugin } from './plugin'; -export { PluginStartContract } from './plugin'; +export type { PluginStartContract } from './plugin'; +export type { TimeSeriesQuery, CoreQueryParams } from './data'; export { - TimeSeriesQuery, - CoreQueryParams, CoreQueryParamsSchemaProperties, validateCoreQueryBody, validateTimeWindowUnits, diff --git a/x-pack/plugins/ui_actions_enhanced/public/components/presentable_picker/presentable_picker.tsx b/x-pack/plugins/ui_actions_enhanced/public/components/presentable_picker/presentable_picker.tsx index 72f9e5aa0bd4ab..9667a78df9a4e6 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/components/presentable_picker/presentable_picker.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/components/presentable_picker/presentable_picker.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { EuiFlexGroup } from '@elastic/eui'; import { PresentablePickerItem, Item } from './presentable_picker_item'; -export { Item } from './presentable_picker_item'; +export type { Item } from './presentable_picker_item'; export interface PresentablePickerProps { items: Item[]; diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/components/trigger_picker/index.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/components/trigger_picker/index.ts index cdb6fbe54698df..4a30a0494e8f78 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/components/trigger_picker/index.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/components/trigger_picker/index.ts @@ -5,5 +5,5 @@ * 2.0. */ -export { TriggerPickerItemDescription } from './trigger_picker_item'; +export type { TriggerPickerItemDescription } from './trigger_picker_item'; export * from './trigger_picker'; diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/components/types.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/components/types.ts index 4d6e5354604a1f..052211d523896b 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/components/types.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/components/types.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { ActionFactoryPlaceContext } from '../types'; +export type { ActionFactoryPlaceContext } from '../types'; diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/containers/index.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/containers/index.ts index 85ee5863674066..cb1e6099c9b53c 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/containers/index.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/containers/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { createPublicDrilldownManager, PublicDrilldownManagerComponent } from './drilldown_manager'; +export type { PublicDrilldownManagerComponent } from './drilldown_manager'; +export { createPublicDrilldownManager } from './drilldown_manager'; diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/state/drilldown_manager_state.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/state/drilldown_manager_state.ts index 5a34a002bf4c3c..e363d154dc141b 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/state/drilldown_manager_state.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/state/drilldown_manager_state.ts @@ -468,7 +468,6 @@ export class DrilldownManagerState { // Below are convenience React hooks for consuming observables in connected // React components. - /* eslint-disable react-hooks/rules-of-hooks */ public readonly useTitle = () => useObservable(this.title$, this.title$.getValue()); public readonly useFooter = () => useObservable(this.footer$, this.footer$.getValue()); public readonly useRoute = () => useObservable(this.route$, this.route$.getValue()); @@ -477,5 +476,4 @@ export class DrilldownManagerState { public readonly useActionFactory = () => useObservable(this.actionFactory$, this.actionFactory$.getValue()); public readonly useEvents = () => useObservable(this.events$, this.events$.getValue()); - /* eslint-enable react-hooks/rules-of-hooks */ } diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/state/drilldown_state.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/state/drilldown_state.ts index f80ad30d34bb87..d16a9a93930dd6 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/state/drilldown_state.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_manager/state/drilldown_state.ts @@ -233,10 +233,8 @@ export class DrilldownState { // Below are convenience React hooks for consuming observables in connected // React components. - /* eslint-disable react-hooks/rules-of-hooks */ public readonly useName = () => useObservable(this.name$, this.name$.getValue()); public readonly useTriggers = () => useObservable(this.triggers$, this.triggers$.getValue()); public readonly useConfig = () => useObservable(this.config$, this.config$.getValue()); public readonly useError = () => useSyncObservable(this.error$); - /* eslint-enable react-hooks/rules-of-hooks */ } diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/components/url_drilldown_collect_config/index.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/components/url_drilldown_collect_config/index.ts index 7922158c62e7fc..5aa1dddd64f8c8 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/components/url_drilldown_collect_config/index.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/components/url_drilldown_collect_config/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { UrlDrilldownCollectConfig, UrlDrilldownCollectConfigProps } from './lazy'; +export type { UrlDrilldownCollectConfigProps } from './lazy'; +export { UrlDrilldownCollectConfig } from './lazy'; diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/index.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/index.ts index cc0ce30eb4f432..db76a54cc8d5b8 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/index.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -export { UrlDrilldownConfig, UrlDrilldownGlobalScope, UrlDrilldownScope } from './types'; +export type { UrlDrilldownConfig, UrlDrilldownGlobalScope, UrlDrilldownScope } from './types'; export { UrlDrilldownCollectConfig } from './components'; export { validateUrlTemplate as urlDrilldownValidateUrlTemplate, diff --git a/x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/types.ts b/x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/types.ts index b400f9bd972314..2512753c07f4aa 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/types.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/types.ts @@ -7,7 +7,7 @@ import { SerializedAction, SerializedEvent, BaseActionConfig } from '../../common/types'; -export { SerializedAction, SerializedEvent, BaseActionConfig }; +export type { SerializedAction, SerializedEvent, BaseActionConfig }; /** * Action factory context passed into ActionFactories' CollectConfig, getDisplayName, getIconType diff --git a/x-pack/plugins/ui_actions_enhanced/public/index.ts b/x-pack/plugins/ui_actions_enhanced/public/index.ts index 3135cf44a7aa97..453a633e851af5 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/index.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/index.ts @@ -13,38 +13,42 @@ export function plugin(initializerContext: PluginInitializerContext) { } export { AdvancedUiActionsPublicPlugin as Plugin }; -export { +export type { SetupContract as AdvancedUiActionsSetup, StartContract as AdvancedUiActionsStart, } from './plugin'; -export { +export type { ActionFactoryDefinition as UiActionsEnhancedActionFactoryDefinition, - ActionFactory as UiActionsEnhancedActionFactory, SerializedAction as UiActionsEnhancedSerializedAction, SerializedEvent as UiActionsEnhancedSerializedEvent, - AbstractActionStorage as UiActionsEnhancedAbstractActionStorage, - DynamicActionManager as UiActionsEnhancedDynamicActionManager, DynamicActionManagerParams as UiActionsEnhancedDynamicActionManagerParams, DynamicActionManagerState as UiActionsEnhancedDynamicActionManagerState, - MemoryActionStorage as UiActionsEnhancedMemoryActionStorage, BaseActionFactoryContext as UiActionsEnhancedBaseActionFactoryContext, BaseActionConfig as UiActionsEnhancedBaseActionConfig, } from './dynamic_actions'; +export { + ActionFactory as UiActionsEnhancedActionFactory, + AbstractActionStorage as UiActionsEnhancedAbstractActionStorage, + DynamicActionManager as UiActionsEnhancedDynamicActionManager, + MemoryActionStorage as UiActionsEnhancedMemoryActionStorage, +} from './dynamic_actions'; -export { DynamicActionsState } from './services/ui_actions_service_enhancements'; +export type { DynamicActionsState } from './services/ui_actions_service_enhancements'; -export { +export type { DrilldownDefinition as UiActionsEnhancedDrilldownDefinition, DrilldownTemplate as UiActionsEnhancedDrilldownTemplate, } from './drilldowns'; +export type { + UrlDrilldownConfig, + UrlDrilldownGlobalScope, + UrlDrilldownScope, +} from './drilldowns/url_drilldown'; export { urlDrilldownCompileUrl, UrlDrilldownCollectConfig, - UrlDrilldownConfig, - UrlDrilldownGlobalScope, urlDrilldownGlobalScopeProvider, - UrlDrilldownScope, urlDrilldownValidateUrl, urlDrilldownValidateUrlTemplate, } from './drilldowns/url_drilldown'; diff --git a/x-pack/plugins/ui_actions_enhanced/public/services/ui_actions_service_enhancements.ts b/x-pack/plugins/ui_actions_enhanced/public/services/ui_actions_service_enhancements.ts index 8da9e62766cc3e..40155617b22e09 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/services/ui_actions_service_enhancements.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/services/ui_actions_service_enhancements.ts @@ -22,7 +22,7 @@ import { PersistableStateDefinition } from '../../../../../src/plugins/kibana_ut import { DynamicActionsState } from '../../common/types'; -export { DynamicActionsState }; +export type { DynamicActionsState }; export interface UiActionsServiceEnhancementsParams { readonly actionFactories?: ActionFactoryRegistry; diff --git a/x-pack/plugins/ui_actions_enhanced/server/index.ts b/x-pack/plugins/ui_actions_enhanced/server/index.ts index ef6cc4015c8e0b..a1d70d3ea4a835 100644 --- a/x-pack/plugins/ui_actions_enhanced/server/index.ts +++ b/x-pack/plugins/ui_actions_enhanced/server/index.ts @@ -12,17 +12,17 @@ export function plugin() { } export { AdvancedUiActionsServerPlugin as Plugin }; -export { +export type { SetupContract as AdvancedUiActionsSetup, StartContract as AdvancedUiActionsStart, } from './plugin'; -export { +export type { ActionFactoryDefinition as UiActionsEnhancedActionFactoryDefinition, ActionFactory as UiActionsEnhancedActionFactory, } from './types'; -export { +export type { DynamicActionsState, BaseActionConfig as UiActionsEnhancedBaseActionConfig, SerializedAction as UiActionsEnhancedSerializedAction, diff --git a/x-pack/plugins/ui_actions_enhanced/server/types.ts b/x-pack/plugins/ui_actions_enhanced/server/types.ts index 24d30d74661bdd..e0734e31486b5b 100644 --- a/x-pack/plugins/ui_actions_enhanced/server/types.ts +++ b/x-pack/plugins/ui_actions_enhanced/server/types.ts @@ -24,4 +24,4 @@ export interface ActionFactory

id: string; } -export { SerializedEvent, SerializedAction, DynamicActionsState }; +export type { SerializedEvent, SerializedAction, DynamicActionsState }; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts index b2a1c4e80ec7d8..2d3fff9d43e2ca 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts @@ -5,8 +5,11 @@ * 2.0. */ -export { setup as setupOverviewPage, OverviewTestBed } from './overview.helpers'; -export { setup as setupElasticsearchPage, ElasticsearchTestBed } from './elasticsearch.helpers'; -export { setup as setupKibanaPage, KibanaTestBed } from './kibana.helpers'; +export type { OverviewTestBed } from './overview.helpers'; +export { setup as setupOverviewPage } from './overview.helpers'; +export type { ElasticsearchTestBed } from './elasticsearch.helpers'; +export { setup as setupElasticsearchPage } from './elasticsearch.helpers'; +export type { KibanaTestBed } from './kibana.helpers'; +export { setup as setupKibanaPage } from './kibana.helpers'; export { setupEnvironment, kibanaVersion } from './setup_environment'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx index 6b9eee80acb574..dad239ddb81b30 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx @@ -5,4 +5,5 @@ * 2.0. */ -export { ReindexFlyout, ReindexFlyoutProps } from './container'; +export type { ReindexFlyoutProps } from './container'; +export { ReindexFlyout } from './container'; diff --git a/x-pack/plugins/upgrade_assistant/public/shared_imports.ts b/x-pack/plugins/upgrade_assistant/public/shared_imports.ts index 64b52065f63e6f..06816daac428b0 100644 --- a/x-pack/plugins/upgrade_assistant/public/shared_imports.ts +++ b/x-pack/plugins/upgrade_assistant/public/shared_imports.ts @@ -8,18 +8,20 @@ import { useKibana as _useKibana } from '../../../../src/plugins/kibana_react/public'; import { AppServicesContext } from './types'; -export { - sendRequest, +export type { SendRequestConfig, SendRequestResponse, - useRequest, UseRequestConfig, +} from '../../../../src/plugins/es_ui_shared/public/'; +export { + sendRequest, + useRequest, SectionLoading, GlobalFlyout, } from '../../../../src/plugins/es_ui_shared/public/'; export { KibanaContextProvider } from '../../../../src/plugins/kibana_react/public'; -export { DataPublicPluginStart } from '../../../../src/plugins/data/public'; +export type { DataPublicPluginStart } from '../../../../src/plugins/data/public'; export const useKibana = () => _useKibana(); diff --git a/x-pack/plugins/uptime/common/runtime_types/snapshot/index.ts b/x-pack/plugins/uptime/common/runtime_types/snapshot/index.ts index a09e5455015a19..15f190a0dacd23 100644 --- a/x-pack/plugins/uptime/common/runtime_types/snapshot/index.ts +++ b/x-pack/plugins/uptime/common/runtime_types/snapshot/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { Snapshot, SnapshotType } from './snapshot_count'; +export type { Snapshot } from './snapshot_count'; +export { SnapshotType } from './snapshot_count'; diff --git a/x-pack/plugins/uptime/public/components/common/charts/__snapshots__/donut_chart.test.tsx.snap b/x-pack/plugins/uptime/public/components/common/charts/__snapshots__/donut_chart.test.tsx.snap index c9299bf7bf3ea5..4ee227c6452531 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/__snapshots__/donut_chart.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/common/charts/__snapshots__/donut_chart.test.tsx.snap @@ -80,6 +80,24 @@ exports[`DonutChart component passes correct props without errors for valid prop "strokeWidth": 1, "visible": false, }, + "lumaSteps": Array [ + 224, + 184, + 128, + 96, + 64, + 32, + 16, + 8, + 4, + 2, + 1, + 0, + 0, + 0, + 0, + 0, + ], "vertical": Object { "dash": Array [ 0, diff --git a/x-pack/plugins/uptime/public/components/common/higher_order/index.ts b/x-pack/plugins/uptime/public/components/common/higher_order/index.ts index d1d95b7cb099f1..403f942a3d7c5a 100644 --- a/x-pack/plugins/uptime/public/components/common/higher_order/index.ts +++ b/x-pack/plugins/uptime/public/components/common/higher_order/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { ResponsiveWrapperProps, withResponsiveWrapper } from './responsive_wrapper'; +export type { ResponsiveWrapperProps } from './responsive_wrapper'; +export { withResponsiveWrapper } from './responsive_wrapper'; diff --git a/x-pack/plugins/uptime/public/components/common/uptime_date_picker.test.tsx b/x-pack/plugins/uptime/public/components/common/uptime_date_picker.test.tsx index cd122eb5d5fc52..1510fe28f17213 100644 --- a/x-pack/plugins/uptime/public/components/common/uptime_date_picker.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/uptime_date_picker.test.tsx @@ -12,8 +12,13 @@ import { createMemoryHistory } from 'history'; import { render } from '../../lib/helper/rtl_helpers'; import { fireEvent } from '@testing-library/dom'; -// FLAKY: https://github.com/elastic/kibana/issues/114396 -describe.skip('UptimeDatePicker component', () => { +describe('UptimeDatePicker component', () => { + jest.setTimeout(10_000); + + beforeEach(() => { + jest.clearAllMocks(); + }); + it('renders properly with mock data', async () => { const { findByText } = render(); expect(await findByText('Last 15 minutes')).toBeInTheDocument(); @@ -86,7 +91,7 @@ describe.skip('UptimeDatePicker component', () => { // it should update shared state - expect(startPlugins.data.query.timefilter.timefilter.setTime).toHaveBeenCalledTimes(3); + expect(startPlugins.data.query.timefilter.timefilter.setTime).toHaveBeenCalledTimes(2); expect(startPlugins.data.query.timefilter.timefilter.setTime).toHaveBeenCalledWith({ from: 'now-10m', diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/index.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/index.tsx index 0de1b50ecce8f7..b83cb630aaa791 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/index.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/index.tsx @@ -5,11 +5,12 @@ * 2.0. */ -export { WaterfallChart, RenderItem, WaterfallChartProps } from './components/waterfall_chart'; +export type { RenderItem, WaterfallChartProps } from './components/waterfall_chart'; +export { WaterfallChart } from './components/waterfall_chart'; export { WaterfallProvider, useWaterfallContext } from './context/waterfall_chart'; export { MiddleTruncatedText } from './components/middle_truncated_text'; export { useFlyout } from './components/use_flyout'; -export { +export type { WaterfallData, WaterfallDataEntry, WaterfallMetadata, diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/index.ts b/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/index.ts index 05223cc367c700..db1ca00c36ba45 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/index.ts +++ b/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/index.ts @@ -5,8 +5,6 @@ * 2.0. */ -export { - ToggleAlertFlyoutButton, - ToggleAlertFlyoutButtonProps, -} from './toggle_alert_flyout_button'; +export type { ToggleAlertFlyoutButtonProps } from './toggle_alert_flyout_button'; +export { ToggleAlertFlyoutButton } from './toggle_alert_flyout_button'; export { UptimeAlertsFlyoutWrapper } from './uptime_alerts_flyout_wrapper'; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/index.ts b/x-pack/plugins/uptime/public/components/overview/monitor_list/index.ts index 4d54668b6e24be..86e4c6907b7d1a 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/index.ts +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/index.ts @@ -6,7 +6,7 @@ */ export { MonitorListComponent } from './monitor_list'; -export { Criteria, Pagination } from './types'; +export type { Criteria, Pagination } from './types'; export { LocationLink } from './monitor_list_drawer'; export { MonitorListDrawer } from './monitor_list_drawer/list_drawer_container'; export { ActionsPopover } from './monitor_list_drawer/actions_popover/actions_popover_container'; diff --git a/x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.test.tsx b/x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.test.tsx index e4c57dab0ffcfd..217d8cdfc4c9ea 100644 --- a/x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.test.tsx @@ -17,7 +17,8 @@ import { UptimeUrlParams } from '../../../lib/helper/url_params'; const SAMPLE_ES_FILTERS = `{"bool":{"should":[{"match_phrase":{"monitor.id":"NodeServer"}}],"minimum_should_match":1}}`; -describe('useQueryBar', () => { +// FLAKY: https://github.com/elastic/kibana/issues/112677 +describe.skip('useQueryBar', () => { let DEFAULT_URL_PARAMS: UptimeUrlParams; let wrapper: any; let useUrlParamsSpy: jest.SpyInstance<[URL.GetUrlParams, URL.UpdateUrlParams]>; diff --git a/x-pack/plugins/uptime/public/contexts/index.ts b/x-pack/plugins/uptime/public/contexts/index.ts index 0a5d3441bfe2cd..8467691064bff3 100644 --- a/x-pack/plugins/uptime/public/contexts/index.ts +++ b/x-pack/plugins/uptime/public/contexts/index.ts @@ -6,11 +6,8 @@ */ export { UptimeRefreshContext, UptimeRefreshContextProvider } from './uptime_refresh_context'; -export { - UptimeSettingsContextValues, - UptimeSettingsContext, - UptimeSettingsContextProvider, -} from './uptime_settings_context'; +export type { UptimeSettingsContextValues } from './uptime_settings_context'; +export { UptimeSettingsContext, UptimeSettingsContextProvider } from './uptime_settings_context'; export { UptimeThemeContextProvider, UptimeThemeContext } from './uptime_theme_context'; export { UptimeStartupPluginsContext, diff --git a/x-pack/plugins/uptime/public/lib/helper/index.ts b/x-pack/plugins/uptime/public/lib/helper/index.ts index 2fce3cc0e54dc6..c06e1efc381377 100644 --- a/x-pack/plugins/uptime/public/lib/helper/index.ts +++ b/x-pack/plugins/uptime/public/lib/helper/index.ts @@ -9,5 +9,6 @@ export { convertMicrosecondsToMilliseconds } from './convert_measurements'; export * from './observability_integration'; export { getChartDateLabel } from './charts'; export { seriesHasDownValues } from './series_has_down_values'; -export { UptimeUrlParams, getSupportedUrlParams } from './url_params'; +export type { UptimeUrlParams } from './url_params'; +export { getSupportedUrlParams } from './url_params'; export { MountWithReduxProvider } from './helper_with_redux'; diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/index.ts b/x-pack/plugins/uptime/public/lib/helper/url_params/index.ts index 958a7b904da92f..8b1ff815c1c1f2 100644 --- a/x-pack/plugins/uptime/public/lib/helper/url_params/index.ts +++ b/x-pack/plugins/uptime/public/lib/helper/url_params/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { UptimeUrlParams, getSupportedUrlParams } from './get_supported_url_params'; +export type { UptimeUrlParams } from './get_supported_url_params'; +export { getSupportedUrlParams } from './get_supported_url_params'; diff --git a/x-pack/plugins/uptime/server/lib/domains/index.ts b/x-pack/plugins/uptime/server/lib/domains/index.ts index e0252e7d4a3ebc..ed459d39e246e0 100644 --- a/x-pack/plugins/uptime/server/lib/domains/index.ts +++ b/x-pack/plugins/uptime/server/lib/domains/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { licenseCheck, UMLicenseCheck } from './license'; +export type { UMLicenseCheck } from './license'; +export { licenseCheck } from './license'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts index 09a841ff147a49..37fe71d143988f 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts @@ -11,7 +11,8 @@ import { setup as watchCreateJsonSetup } from './watch_create_json.helpers'; import { setup as watchCreateThresholdSetup } from './watch_create_threshold.helpers'; import { setup as watchEditSetup } from './watch_edit.helpers'; -export { getRandomString, findTestSubject, TestBed } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test/jest'; +export { getRandomString, findTestSubject } from '@kbn/test/jest'; export { wrapBodyResponse, unwrapBodyResponse } from './body_response'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/watcher/public/application/components/index.ts b/x-pack/plugins/watcher/public/application/components/index.ts index f70c15bda18b26..f10dfe9b1e2812 100644 --- a/x-pack/plugins/watcher/public/application/components/index.ts +++ b/x-pack/plugins/watcher/public/application/components/index.ts @@ -11,4 +11,5 @@ export { DeleteWatchesModal } from './delete_watches_modal'; export { ErrableFormRow } from './form_errors'; export { WatchStatus } from './watch_status'; export { SectionLoading } from './section_loading'; -export { SectionError, Error } from './section_error'; +export type { Error } from './section_error'; +export { SectionError } from './section_error'; diff --git a/x-pack/plugins/watcher/public/application/shared_imports.ts b/x-pack/plugins/watcher/public/application/shared_imports.ts index 977204c627e5c8..a076fed8be58f4 100644 --- a/x-pack/plugins/watcher/public/application/shared_imports.ts +++ b/x-pack/plugins/watcher/public/application/shared_imports.ts @@ -5,10 +5,12 @@ * 2.0. */ -export { +export type { SendRequestConfig, SendRequestResponse, UseRequestConfig, +} from '../../../../../src/plugins/es_ui_shared/public'; +export { sendRequest, useRequest, XJson, diff --git a/x-pack/plugins/watcher/public/legacy/parse_es_interval/index.ts b/x-pack/plugins/watcher/public/legacy/parse_es_interval/index.ts index 0af13b3abbf5ec..b172a0b217c55c 100644 --- a/x-pack/plugins/watcher/public/legacy/parse_es_interval/index.ts +++ b/x-pack/plugins/watcher/public/legacy/parse_es_interval/index.ts @@ -5,7 +5,8 @@ * 2.0. */ -export { parseEsInterval, ParsedInterval } from './parse_es_interval'; +export type { ParsedInterval } from './parse_es_interval'; +export { parseEsInterval } from './parse_es_interval'; export { InvalidEsCalendarIntervalError } from './invalid_es_calendar_interval_error'; export { InvalidEsIntervalFormatError } from './invalid_es_interval_format_error'; export { isValidEsInterval } from './is_valid_es_interval'; diff --git a/x-pack/scripts/functional_tests.js b/x-pack/scripts/functional_tests.js index e31b12cd0115d7..77212274b6ade5 100644 --- a/x-pack/scripts/functional_tests.js +++ b/x-pack/scripts/functional_tests.js @@ -71,6 +71,10 @@ const onlyNotInCoverageTests = [ require.resolve('../test/saved_object_api_integration/security_and_spaces/config_trial.ts'), require.resolve('../test/saved_object_api_integration/security_and_spaces/config_basic.ts'), require.resolve('../test/saved_object_api_integration/spaces_only/config.ts'), + // TODO: Enable once RBAC timeline search strategy + // tests updated + // require.resolve('../test/timeline/security_and_spaces/config_basic.ts'), + require.resolve('../test/timeline/security_and_spaces/config_trial.ts'), require.resolve('../test/ui_capabilities/security_and_spaces/config.ts'), require.resolve('../test/ui_capabilities/spaces_only/config.ts'), require.resolve('../test/upgrade_assistant_integration/config.js'), diff --git a/x-pack/test/accessibility/apps/lens.ts b/x-pack/test/accessibility/apps/lens.ts index b8ddd774741b67..e97dc869af48bb 100644 --- a/x-pack/test/accessibility/apps/lens.ts +++ b/x-pack/test/accessibility/apps/lens.ts @@ -13,13 +13,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const esArchiver = getService('esArchiver'); const listingTable = getService('listingTable'); + const kibanaServer = getService('kibanaServer'); // Failing: See https://github.com/elastic/kibana/issues/115614 describe.skip('Lens', () => { const lensChartName = 'MyLensChart'; before(async () => { - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); + await esArchiver.load('x-pack/test/functional/es_archives/logstash_functional'); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); after(async () => { @@ -29,7 +32,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await listingTable.clickDeleteSelected(); await PageObjects.common.clickConfirmOnModal(); await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.unload('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); it('lens', async () => { diff --git a/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts b/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts index 48224ebcf73532..c9088c650c0339 100644 --- a/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts +++ b/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts @@ -95,7 +95,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('can open job selection flyout', async () => { await PageObjects.dashboard.clickCreateDashboardPrompt(); await ml.dashboardEmbeddables.assertDashboardIsEmpty(); - await ml.dashboardEmbeddables.openJobSelectionFlyout(); + await ml.dashboardEmbeddables.openAnomalyJobSelectionFlyout('ml_anomaly_charts'); await a11y.testAppSnapshot(); }); diff --git a/x-pack/test/alerting_api_integration/common/lib/index.ts b/x-pack/test/alerting_api_integration/common/lib/index.ts index eeb9c882696676..305c42b5c1d64d 100644 --- a/x-pack/test/alerting_api_integration/common/lib/index.ts +++ b/x-pack/test/alerting_api_integration/common/lib/index.ts @@ -14,7 +14,8 @@ export { getConsumerUnauthorizedErrorMessage, getProducerUnauthorizedErrorMessage, } from './alert_utils'; -export { TaskManagerUtils, TaskManagerDoc } from './task_manager_utils'; +export type { TaskManagerDoc } from './task_manager_utils'; +export { TaskManagerUtils } from './task_manager_utils'; export * from './test_assertions'; export { checkAAD } from './check_aad'; export { getEventLog } from './get_event_log'; diff --git a/x-pack/test/api_integration/apis/lens/telemetry.ts b/x-pack/test/api_integration/apis/lens/telemetry.ts index 1c0c67a5203d6a..f29df1c358d371 100644 --- a/x-pack/test/api_integration/apis/lens/telemetry.ts +++ b/x-pack/test/api_integration/apis/lens/telemetry.ts @@ -21,6 +21,7 @@ const COMMON_HEADERS = { export default ({ getService }: FtrProviderContext) => { const supertest = getService('supertest'); const es = getService('es'); + const kibanaServer = getService('kibanaServer'); async function assertExpectedSavedObjects(num: number) { // Make sure that new/deleted docs are available to search @@ -172,9 +173,10 @@ export default ({ getService }: FtrProviderContext) => { }); it('should collect telemetry on saved visualization types with a painless script', async () => { - const esArchiver = getService('esArchiver'); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); const kibanaClient = convertToKibanaClient(es); const results = await getVisualizationCounts(() => Promise.resolve(kibanaClient), '.kibana'); @@ -194,7 +196,9 @@ export default ({ getService }: FtrProviderContext) => { }); expect(results.saved_overall_total).to.eql(3); - await esArchiver.unload('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); }); }; diff --git a/x-pack/test/api_integration/apis/management/snapshot_restore/lib/index.ts b/x-pack/test/api_integration/apis/management/snapshot_restore/lib/index.ts index a9721c58565985..469ee43e4bef1d 100644 --- a/x-pack/test/api_integration/apis/management/snapshot_restore/lib/index.ts +++ b/x-pack/test/api_integration/apis/management/snapshot_restore/lib/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export { registerEsHelpers, SlmPolicy } from './elasticsearch'; +export type { SlmPolicy } from './elasticsearch'; +export { registerEsHelpers } from './elasticsearch'; diff --git a/x-pack/test/apm_api_integration/common/ftr_provider_context.ts b/x-pack/test/apm_api_integration/common/ftr_provider_context.ts index cac43046964317..b5f2a4a42d91ae 100644 --- a/x-pack/test/apm_api_integration/common/ftr_provider_context.ts +++ b/x-pack/test/apm_api_integration/common/ftr_provider_context.ts @@ -16,5 +16,5 @@ export type InheritedServices = InheritedFtrProviderContext extends GenericFtrPr ? TServices : {}; -export { InheritedFtrProviderContext }; +export type { InheritedFtrProviderContext }; export type FtrProviderContext = GenericFtrProviderContext; diff --git a/x-pack/test/apm_api_integration/tests/dependencies/top_dependencies.ts b/x-pack/test/apm_api_integration/tests/dependencies/top_dependencies.ts index 1b8219b4a39c67..6d32defed460df 100644 --- a/x-pack/test/apm_api_integration/tests/dependencies/top_dependencies.ts +++ b/x-pack/test/apm_api_integration/tests/dependencies/top_dependencies.ts @@ -53,7 +53,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { 'Top dependencies', { config: 'basic', archives: ['apm_mappings_only_8.0.0'] }, () => { - describe('when data is generated', () => { + describe.skip('when data is generated', () => { let topDependencies: TopDependencies; before(async () => { diff --git a/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts b/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts index 2da57c0a257793..d4733785c62b82 100644 --- a/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts +++ b/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts @@ -298,8 +298,8 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext) "avgErrorRate": 0, "avgMemoryUsage": 0.202572668763642, "transactionStats": Object { - "avgRequestsPerMinute": 7.13333333333333, - "avgTransactionDuration": 53147.5747663551, + "avgRequestsPerMinute": 5.2, + "avgTransactionDuration": 53906.6603773585, }, } `); diff --git a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap index 91b0b7f2da6e4c..8eb8ad2adb1649 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap +++ b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap @@ -2,7 +2,7 @@ exports[`APM API tests basic apm_8.0.0 Instance details when data is loaded fetch instance details return the correct data 1`] = ` Object { - "@timestamp": "2021-08-03T06:50:20.205Z", + "@timestamp": "2021-08-03T06:57:50.204Z", "agent": Object { "ephemeral_id": "2745d454-f57f-4473-a09b-fe6bef295860", "name": "java", diff --git a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap index 971c14262f0b0b..b8a57f26d85bc4 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap +++ b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap @@ -73,11 +73,11 @@ Object { "errorRate": Array [ Object { "x": 1627974300000, - "y": null, + "y": 0, }, Object { "x": 1627974360000, - "y": 0, + "y": null, }, Object { "x": 1627974420000, @@ -93,15 +93,15 @@ Object { }, Object { "x": 1627974600000, - "y": 0.5, + "y": 0.125, }, Object { "x": 1627974660000, - "y": 0.4, + "y": 0.6, }, Object { "x": 1627974720000, - "y": 0, + "y": 0.2, }, Object { "x": 1627974780000, @@ -109,11 +109,11 @@ Object { }, Object { "x": 1627974840000, - "y": 0.166666666666667, + "y": 0, }, Object { "x": 1627974900000, - "y": 0, + "y": 0.0666666666666667, }, Object { "x": 1627974960000, @@ -125,11 +125,11 @@ Object { }, Object { "x": 1627975080000, - "y": 0.142857142857143, + "y": 0, }, Object { "x": 1627975140000, - "y": 0.2, + "y": 0.181818181818182, }, Object { "x": 1627975200000, @@ -139,63 +139,63 @@ Object { "latency": Array [ Object { "x": 1627974300000, - "y": null, + "y": 34887.8888888889, }, Object { "x": 1627974360000, - "y": 5578, + "y": null, }, Object { "x": 1627974420000, - "y": 34851.1666666667, + "y": 4983, }, Object { "x": 1627974480000, - "y": 15896.4, + "y": 41285.4, }, Object { "x": 1627974540000, - "y": 15174.1666666667, + "y": 13820.3333333333, }, Object { "x": 1627974600000, - "y": 9185.16666666667, + "y": 13782, }, Object { "x": 1627974660000, - "y": 12363.2, + "y": 13392.6, }, Object { "x": 1627974720000, - "y": 6206.44444444444, + "y": 6991, }, Object { "x": 1627974780000, - "y": 6707, + "y": 6885.85714285714, }, Object { "x": 1627974840000, - "y": 12409.1666666667, + "y": 7935, }, Object { "x": 1627974900000, - "y": 9188.36363636364, + "y": 10828.3333333333, }, Object { "x": 1627974960000, - "y": 4279.6, + "y": 6079, }, Object { "x": 1627975020000, - "y": 6827.3, + "y": 5217, }, Object { "x": 1627975080000, - "y": 7445.78571428571, + "y": 8477.76923076923, }, Object { "x": 1627975140000, - "y": 563288.6, + "y": 5937.18181818182, }, Object { "x": 1627975200000, @@ -272,15 +272,15 @@ Object { "throughput": Array [ Object { "x": 1627974300000, - "y": 0, + "y": 9, }, Object { "x": 1627974360000, - "y": 2, + "y": 0, }, Object { "x": 1627974420000, - "y": 6, + "y": 4, }, Object { "x": 1627974480000, @@ -292,7 +292,7 @@ Object { }, Object { "x": 1627974600000, - "y": 6, + "y": 8, }, Object { "x": 1627974660000, @@ -300,35 +300,35 @@ Object { }, Object { "x": 1627974720000, - "y": 9, + "y": 5, }, Object { "x": 1627974780000, - "y": 3, + "y": 7, }, Object { "x": 1627974840000, - "y": 6, + "y": 2, }, Object { "x": 1627974900000, - "y": 11, + "y": 15, }, Object { "x": 1627974960000, - "y": 5, + "y": 3, }, Object { "x": 1627975020000, - "y": 10, + "y": 8, }, Object { "x": 1627975080000, - "y": 14, + "y": 13, }, Object { "x": 1627975140000, - "y": 10, + "y": 11, }, Object { "x": 1627975200000, @@ -412,15 +412,15 @@ Object { }, Object { "x": 1627974360000, - "y": 0.25, + "y": 0, }, Object { "x": 1627974420000, - "y": 0.111111111111111, + "y": 0.333333333333333, }, Object { "x": 1627974480000, - "y": 0.2, + "y": 0.181818181818182, }, Object { "x": 1627974540000, @@ -428,15 +428,15 @@ Object { }, Object { "x": 1627974600000, - "y": 0.142857142857143, + "y": 0, }, Object { "x": 1627974660000, - "y": 0.1, + "y": 0.166666666666667, }, Object { "x": 1627974720000, - "y": 0.125, + "y": 0.181818181818182, }, Object { "x": 1627974780000, @@ -444,15 +444,15 @@ Object { }, Object { "x": 1627974840000, - "y": 0.111111111111111, + "y": 0, }, Object { "x": 1627974900000, - "y": 0, + "y": 0.0833333333333333, }, Object { "x": 1627974960000, - "y": 0.333333333333333, + "y": 0.0769230769230769, }, Object { "x": 1627975020000, @@ -460,81 +460,81 @@ Object { }, Object { "x": 1627975080000, - "y": 0.0833333333333333, + "y": 0.1, }, Object { "x": 1627975140000, - "y": 0.1, + "y": 0.153846153846154, }, Object { "x": 1627975200000, - "y": 0, + "y": null, }, ], "latency": Array [ Object { "x": 1627974300000, - "y": 5372.5, + "y": 11839, }, Object { "x": 1627974360000, - "y": 1441598.25, + "y": 7407, }, Object { "x": 1627974420000, - "y": 9380.22222222222, + "y": 1925569.66666667, }, Object { "x": 1627974480000, - "y": 10949.4, + "y": 9017.18181818182, }, Object { "x": 1627974540000, - "y": 77148.6666666667, + "y": 63575, }, Object { "x": 1627974600000, - "y": 6461, + "y": 7577.66666666667, }, Object { "x": 1627974660000, - "y": 549308.4, + "y": 6844.33333333333, }, Object { "x": 1627974720000, - "y": 10797.75, + "y": 503471, }, Object { "x": 1627974780000, - "y": 9758.53846153846, + "y": 6247.8, }, Object { "x": 1627974840000, - "y": 1281052.66666667, + "y": 1137247, }, Object { "x": 1627974900000, - "y": 9511.0625, + "y": 27951.6666666667, }, Object { "x": 1627974960000, - "y": 11151203.3333333, + "y": 10248.8461538462, }, Object { "x": 1627975020000, - "y": 8647.2, + "y": 13529, }, Object { "x": 1627975080000, - "y": 9048.33333333333, + "y": 6691247.8, }, Object { "x": 1627975140000, - "y": 12671.6, + "y": 12098.6923076923, }, Object { "x": 1627975200000, - "y": 57275.4, + "y": null, }, ], "memoryUsage": Array [ @@ -607,67 +607,67 @@ Object { "throughput": Array [ Object { "x": 1627974300000, - "y": 2, + "y": 4, }, Object { "x": 1627974360000, - "y": 4, + "y": 2, }, Object { "x": 1627974420000, - "y": 9, + "y": 3, }, Object { "x": 1627974480000, - "y": 5, + "y": 11, }, Object { "x": 1627974540000, - "y": 3, + "y": 4, }, Object { "x": 1627974600000, - "y": 7, + "y": 6, }, Object { "x": 1627974660000, - "y": 10, + "y": 6, }, Object { "x": 1627974720000, - "y": 8, + "y": 11, }, Object { "x": 1627974780000, - "y": 13, + "y": 10, }, Object { "x": 1627974840000, - "y": 9, + "y": 10, }, Object { "x": 1627974900000, - "y": 16, + "y": 12, }, Object { "x": 1627974960000, - "y": 6, + "y": 13, }, Object { "x": 1627975020000, - "y": 10, + "y": 8, }, Object { "x": 1627975080000, - "y": 12, + "y": 10, }, Object { "x": 1627975140000, - "y": 10, + "y": 13, }, Object { "x": 1627975200000, - "y": 5, + "y": 0, }, ], }, @@ -812,15 +812,15 @@ Object { }, Object { "x": 1627973460000, - "y": 0.25, + "y": 0, }, Object { "x": 1627973520000, - "y": 0.111111111111111, + "y": 0.333333333333333, }, Object { "x": 1627973580000, - "y": 0.2, + "y": 0.181818181818182, }, Object { "x": 1627973640000, @@ -828,15 +828,15 @@ Object { }, Object { "x": 1627973700000, - "y": 0.142857142857143, + "y": 0, }, Object { "x": 1627973760000, - "y": 0.1, + "y": 0.166666666666667, }, Object { "x": 1627973820000, - "y": 0.125, + "y": 0.181818181818182, }, Object { "x": 1627973880000, @@ -844,15 +844,15 @@ Object { }, Object { "x": 1627973940000, - "y": 0.111111111111111, + "y": 0, }, Object { "x": 1627974000000, - "y": 0, + "y": 0.0833333333333333, }, Object { "x": 1627974060000, - "y": 0.333333333333333, + "y": 0.0769230769230769, }, Object { "x": 1627974120000, @@ -860,11 +860,11 @@ Object { }, Object { "x": 1627974180000, - "y": 0.0833333333333333, + "y": 0.1, }, Object { "x": 1627974240000, - "y": 0.1, + "y": 0.153846153846154, }, Object { "x": 1627974300000, @@ -872,7 +872,7 @@ Object { }, Object { "x": 1627974360000, - "y": 0, + "y": null, }, Object { "x": 1627974420000, @@ -888,15 +888,15 @@ Object { }, Object { "x": 1627974600000, - "y": 0.5, + "y": 0.125, }, Object { "x": 1627974660000, - "y": 0.4, + "y": 0.6, }, Object { "x": 1627974720000, - "y": 0, + "y": 0.2, }, Object { "x": 1627974780000, @@ -904,11 +904,11 @@ Object { }, Object { "x": 1627974840000, - "y": 0.166666666666667, + "y": 0, }, Object { "x": 1627974900000, - "y": 0, + "y": 0.0666666666666667, }, Object { "x": 1627974960000, @@ -920,11 +920,11 @@ Object { }, Object { "x": 1627975080000, - "y": 0.142857142857143, + "y": 0, }, Object { "x": 1627975140000, - "y": 0.2, + "y": 0.181818181818182, }, Object { "x": 1627975200000, @@ -934,123 +934,123 @@ Object { "latency": Array [ Object { "x": 1627973400000, - "y": 5372.5, + "y": 11839, }, Object { "x": 1627973460000, - "y": 1441598.25, + "y": 7407, }, Object { "x": 1627973520000, - "y": 9380.22222222222, + "y": 1925569.66666667, }, Object { "x": 1627973580000, - "y": 10949.4, + "y": 9017.18181818182, }, Object { "x": 1627973640000, - "y": 77148.6666666667, + "y": 63575, }, Object { "x": 1627973700000, - "y": 6461, + "y": 7577.66666666667, }, Object { "x": 1627973760000, - "y": 549308.4, + "y": 6844.33333333333, }, Object { "x": 1627973820000, - "y": 10797.75, + "y": 503471, }, Object { "x": 1627973880000, - "y": 9758.53846153846, + "y": 6247.8, }, Object { "x": 1627973940000, - "y": 1281052.66666667, + "y": 1137247, }, Object { "x": 1627974000000, - "y": 9511.0625, + "y": 27951.6666666667, }, Object { "x": 1627974060000, - "y": 11151203.3333333, + "y": 10248.8461538462, }, Object { "x": 1627974120000, - "y": 8647.2, + "y": 13529, }, Object { "x": 1627974180000, - "y": 9048.33333333333, + "y": 6691247.8, }, Object { "x": 1627974240000, - "y": 12671.6, + "y": 12098.6923076923, }, Object { "x": 1627974300000, - "y": 57275.4, + "y": 34887.8888888889, }, Object { "x": 1627974360000, - "y": 5578, + "y": null, }, Object { "x": 1627974420000, - "y": 34851.1666666667, + "y": 4983, }, Object { "x": 1627974480000, - "y": 15896.4, + "y": 41285.4, }, Object { "x": 1627974540000, - "y": 15174.1666666667, + "y": 13820.3333333333, }, Object { "x": 1627974600000, - "y": 9185.16666666667, + "y": 13782, }, Object { "x": 1627974660000, - "y": 12363.2, + "y": 13392.6, }, Object { "x": 1627974720000, - "y": 6206.44444444444, + "y": 6991, }, Object { "x": 1627974780000, - "y": 6707, + "y": 6885.85714285714, }, Object { "x": 1627974840000, - "y": 12409.1666666667, + "y": 7935, }, Object { "x": 1627974900000, - "y": 9188.36363636364, + "y": 10828.3333333333, }, Object { "x": 1627974960000, - "y": 4279.6, + "y": 6079, }, Object { "x": 1627975020000, - "y": 6827.3, + "y": 5217, }, Object { "x": 1627975080000, - "y": 7445.78571428571, + "y": 8477.76923076923, }, Object { "x": 1627975140000, - "y": 563288.6, + "y": 5937.18181818182, }, Object { "x": 1627975200000, @@ -1187,75 +1187,75 @@ Object { "throughput": Array [ Object { "x": 1627973400000, - "y": 2, + "y": 4, }, Object { "x": 1627973460000, - "y": 4, + "y": 2, }, Object { "x": 1627973520000, - "y": 9, + "y": 3, }, Object { "x": 1627973580000, - "y": 5, + "y": 11, }, Object { "x": 1627973640000, - "y": 3, + "y": 4, }, Object { "x": 1627973700000, - "y": 7, + "y": 6, }, Object { "x": 1627973760000, - "y": 10, + "y": 6, }, Object { "x": 1627973820000, - "y": 8, + "y": 11, }, Object { "x": 1627973880000, - "y": 13, + "y": 10, }, Object { "x": 1627973940000, - "y": 9, + "y": 10, }, Object { "x": 1627974000000, - "y": 16, + "y": 12, }, Object { "x": 1627974060000, - "y": 6, + "y": 13, }, Object { "x": 1627974120000, - "y": 10, + "y": 8, }, Object { "x": 1627974180000, - "y": 12, + "y": 10, }, Object { "x": 1627974240000, - "y": 10, + "y": 13, }, Object { "x": 1627974300000, - "y": 5, + "y": 9, }, Object { "x": 1627974360000, - "y": 2, + "y": 0, }, Object { "x": 1627974420000, - "y": 6, + "y": 4, }, Object { "x": 1627974480000, @@ -1267,7 +1267,7 @@ Object { }, Object { "x": 1627974600000, - "y": 6, + "y": 8, }, Object { "x": 1627974660000, @@ -1275,35 +1275,35 @@ Object { }, Object { "x": 1627974720000, - "y": 9, + "y": 5, }, Object { "x": 1627974780000, - "y": 3, + "y": 7, }, Object { "x": 1627974840000, - "y": 6, + "y": 2, }, Object { "x": 1627974900000, - "y": 11, + "y": 15, }, Object { "x": 1627974960000, - "y": 5, + "y": 3, }, Object { "x": 1627975020000, - "y": 10, + "y": 8, }, Object { "x": 1627975080000, - "y": 14, + "y": 13, }, Object { "x": 1627975140000, - "y": 10, + "y": 11, }, Object { "x": 1627975200000, diff --git a/x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts b/x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts index 7d4efa14b2d85e..909e58a5566a57 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts @@ -122,10 +122,10 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(values).toMatchInline(` Object { "cpuUsage": 0.002, - "errorRate": 0.092511013215859, - "latency": 430318.696035242, + "errorRate": 0.0848214285714286, + "latency": 411589.785714286, "memoryUsage": 0.786029688517253, - "throughput": 7.56666666666667, + "throughput": 7.46666666666667, } `); }); @@ -183,9 +183,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(values).toMatchInline(` Object { "cpuUsage": 0.001, - "errorRate": 0.00343642611683849, - "latency": 21520.4776632302, - "throughput": 9.7, + "errorRate": 0.00341296928327645, + "latency": 40989.5802047782, + "throughput": 9.76666666666667, } `); @@ -272,10 +272,10 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(values).toMatchInline(` Object { "cpuUsage": 0.00223333333333333, - "errorRate": 0.0852713178294574, - "latency": 706173.046511628, + "errorRate": 0.0894308943089431, + "latency": 739013.634146341, "memoryUsage": 0.783296203613281, - "throughput": 8.6, + "throughput": 8.2, } `); }); diff --git a/x-pack/test/apm_api_integration/tests/services/top_services.ts b/x-pack/test/apm_api_integration/tests/services/top_services.ts index d85331b8be45de..42d98f38e4e4a7 100644 --- a/x-pack/test/apm_api_integration/tests/services/top_services.ts +++ b/x-pack/test/apm_api_integration/tests/services/top_services.ts @@ -6,30 +6,39 @@ */ import expect from '@kbn/expect'; -import { sortBy, pick, isEmpty } from 'lodash'; +import { sortBy } from 'lodash'; +import { service, timerange } from '@elastic/apm-synthtrace'; import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi'; import { PromiseReturnType } from '../../../../plugins/observability/typings/common'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { registry } from '../../common/registry'; +import { ENVIRONMENT_ALL } from '../../../../plugins/apm/common/environment_filter_values'; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('legacySupertestAsApmReadUser'); + + const apmApiClient = getService('apmApiClient'); + const synthtrace = getService('synthtraceEsClient'); + const supertestAsApmReadUserWithoutMlAccess = getService( 'legacySupertestAsApmReadUserWithoutMlAccess' ); const archiveName = 'apm_8.0.0'; - const range = archives_metadata[archiveName]; + const archiveRange = archives_metadata[archiveName]; // url parameters - const start = encodeURIComponent(range.start); - const end = encodeURIComponent(range.end); + const archiveStart = encodeURIComponent(archiveRange.start); + const archiveEnd = encodeURIComponent(archiveRange.end); + + const start = '2021-10-01T00:00:00.000Z'; + const end = '2021-10-01T00:05:00.000Z'; registry.when( - 'APM Services Overview with a basic license when data is not loaded', - { config: 'basic', archives: [] }, + 'APM Services Overview with a basic license when data is not generated', + { config: 'basic', archives: ['apm_mappings_only_8.0.0'] }, () => { it('handles the empty state', async () => { const response = await supertest.get( @@ -44,187 +53,242 @@ export default function ApiTest({ getService }: FtrProviderContext) { ); registry.when( - 'APM Services Overview with a basic license when data is loaded', - { config: 'basic', archives: [archiveName] }, + 'APM Services Overview with a basic license when data is generated', + { config: 'basic', archives: ['apm_mappings_only_8.0.0'] }, () => { let response: { status: number; body: APIReturnType<'GET /internal/apm/services'>; }; - let sortedItems: typeof response.body.items; + const range = timerange(new Date(start).getTime(), new Date(end).getTime()); + const transactionInterval = range.interval('1s'); + const metricInterval = range.interval('30s'); + + const multipleEnvServiceProdInstance = service( + 'multiple-env-service', + 'production', + 'go' + ).instance('multiple-env-service-production'); + + const multipleEnvServiceDevInstance = service( + 'multiple-env-service', + 'development', + 'go' + ).instance('multiple-env-service-development'); + + const metricOnlyInstance = service('metric-only-service', 'production', 'java').instance( + 'metric-only-production' + ); + + const config = { + multiple: { + prod: { + rps: 4, + duration: 1000, + }, + dev: { + rps: 1, + duration: 500, + }, + }, + }; before(async () => { - response = await supertest.get( - `/internal/apm/services?start=${start}&end=${end}&environment=ENVIRONMENT_ALL&kuery=` - ); - sortedItems = sortBy(response.body.items, 'serviceName'); - }); - - it('the response is successful', () => { - expect(response.status).to.eql(200); - }); - - it('returns hasLegacyData: false', () => { - expect(response.body.hasLegacyData).to.be(false); + return synthtrace.index([ + ...transactionInterval + .rate(config.multiple.prod.rps) + .flatMap((timestamp) => [ + ...multipleEnvServiceProdInstance + .transaction('GET /api') + .timestamp(timestamp) + .duration(config.multiple.prod.duration) + .success() + .serialize(), + ]), + ...transactionInterval + .rate(config.multiple.dev.rps) + .flatMap((timestamp) => [ + ...multipleEnvServiceDevInstance + .transaction('GET /api') + .timestamp(timestamp) + .duration(config.multiple.dev.duration) + .failure() + .serialize(), + ]), + ...transactionInterval + .rate(config.multiple.prod.rps) + .flatMap((timestamp) => [ + ...multipleEnvServiceDevInstance + .transaction('non-request', 'rpc') + .timestamp(timestamp) + .duration(config.multiple.prod.duration) + .success() + .serialize(), + ]), + ...metricInterval.rate(1).flatMap((timestamp) => [ + ...metricOnlyInstance + .appMetrics({ + 'system.memory.actual.free': 1, + 'system.cpu.total.norm.pct': 1, + 'system.memory.total': 1, + 'system.process.cpu.total.norm.pct': 1, + }) + .timestamp(timestamp) + .serialize(), + ]), + ]); }); - it('returns the correct service names', () => { - expectSnapshot(sortedItems.map((item) => item.serviceName)).toMatchInline(` - Array [ - "auditbeat", - "opbeans-dotnet", - "opbeans-go", - "opbeans-java", - "opbeans-node", - "opbeans-python", - "opbeans-ruby", - "opbeans-rum", - ] - `); + after(() => { + return synthtrace.clean(); }); - it('returns the correct metrics averages', () => { - expectSnapshot( - sortedItems.map((item) => pick(item, 'transactionErrorRate', 'latency', 'throughput')) - ).toMatchInline(` - Array [ - Object {}, - Object { - "latency": 496794.054441261, - "throughput": 11.6333333333333, - "transactionErrorRate": 0.0315186246418338, - }, - Object { - "latency": 83395.638576779, - "throughput": 17.8, - "transactionErrorRate": 0.00936329588014981, - }, - Object { - "latency": 430318.696035242, - "throughput": 7.56666666666667, - "transactionErrorRate": 0.092511013215859, - }, - Object { - "latency": 53147.5747663551, - "throughput": 7.13333333333333, - "transactionErrorRate": 0, - }, - Object { - "latency": 419826.24375, - "throughput": 5.33333333333333, - "transactionErrorRate": 0.025, - }, - Object { - "latency": 21520.4776632302, - "throughput": 9.7, - "transactionErrorRate": 0.00343642611683849, - }, - Object { - "latency": 1040388.88888889, - "throughput": 2.4, - "transactionErrorRate": null, + describe('when no additional filters are applied', () => { + before(async () => { + response = await apmApiClient.readUser({ + endpoint: 'GET /internal/apm/services', + params: { + query: { + start, + end, + environment: ENVIRONMENT_ALL.value, + kuery: '', + }, }, - ] - `); - }); + }); + }); - it('returns environments', () => { - expectSnapshot(sortedItems.map((item) => item.environments ?? [])).toMatchInline(` - Array [ - Array [ - "production", - ], - Array [ - "production", - ], - Array [ - "testing", - ], - Array [ - "production", - ], - Array [ - "testing", - ], - Array [ - "production", - ], - Array [ - "production", - ], - Array [ - "testing", - ], - ] - `); - }); + it('returns a successful response', () => { + expect(response.status).to.be(200); + }); - it(`RUM services don't report any transaction error rates`, () => { - // RUM transactions don't have event.outcome set, - // so they should not have an error rate + it('returns the correct statistics', () => { + const multipleEnvService = response.body.items.find( + (item) => item.serviceName === 'multiple-env-service' + ); - const rumServices = sortedItems.filter((item) => item.agentName === 'rum-js'); + const totalRps = config.multiple.prod.rps + config.multiple.dev.rps; + + expect(multipleEnvService).to.eql({ + serviceName: 'multiple-env-service', + transactionType: 'request', + environments: ['production', 'development'], + agentName: 'go', + latency: + 1000 * + ((config.multiple.prod.duration * config.multiple.prod.rps + + config.multiple.dev.duration * config.multiple.dev.rps) / + totalRps), + throughput: totalRps * 60, + transactionErrorRate: + config.multiple.dev.rps / (config.multiple.prod.rps + config.multiple.dev.rps), + }); + }); - expect(rumServices.length).to.be.greaterThan(0); + it('returns services without transaction data', () => { + const serviceNames = response.body.items.map((item) => item.serviceName); - expect(rumServices.every((item) => isEmpty(item.transactionErrorRate))); + expect(serviceNames).to.contain('metric-only-service'); + }); }); - it('non-RUM services all report transaction error rates', () => { - const nonRumServices = sortedItems.filter( - (item) => item.agentName !== 'rum-js' && item.serviceName !== 'auditbeat' - ); + describe('when applying an environment filter', () => { + before(async () => { + response = await apmApiClient.readUser({ + endpoint: 'GET /internal/apm/services', + params: { + query: { + start, + end, + environment: 'production', + kuery: '', + }, + }, + }); + }); - expect( - nonRumServices.every((item) => { - return typeof item.transactionErrorRate === 'number'; - }) - ).to.be(true); + it('returns data only for that environment', () => { + const multipleEnvService = response.body.items.find( + (item) => item.serviceName === 'multiple-env-service' + ); + + const totalRps = config.multiple.prod.rps; + + expect(multipleEnvService).to.eql({ + serviceName: 'multiple-env-service', + transactionType: 'request', + environments: ['production'], + agentName: 'go', + latency: 1000 * ((config.multiple.prod.duration * config.multiple.prod.rps) / totalRps), + throughput: totalRps * 60, + transactionErrorRate: 0, + }); + }); }); - } - ); - registry.when( - 'APM Services Overview with a basic license when data is loaded excluding transaction events', - { config: 'basic', archives: [archiveName] }, - () => { - it('includes services that only report metric data', async () => { - interface Response { - status: number; - body: APIReturnType<'GET /internal/apm/services'>; - } - - const [unfilteredResponse, filteredResponse] = await Promise.all([ - supertest.get( - `/internal/apm/services?start=${start}&end=${end}&environment=ENVIRONMENT_ALL&kuery=` - ) as Promise, - supertest.get( - `/internal/apm/services?start=${start}&end=${end}&environment=ENVIRONMENT_ALL&kuery=${encodeURIComponent( - 'not (processor.event:transaction)' - )}` - ) as Promise, - ]); + describe('when applying a kuery filter', () => { + before(async () => { + response = await apmApiClient.readUser({ + endpoint: 'GET /internal/apm/services', + params: { + query: { + start, + end, + environment: ENVIRONMENT_ALL.value, + kuery: 'service.node.name:"multiple-env-service-development"', + }, + }, + }); + }); - expect(unfilteredResponse.body.items.length).to.be.greaterThan(0); + it('returns data for that kuery filter only', () => { + const multipleEnvService = response.body.items.find( + (item) => item.serviceName === 'multiple-env-service' + ); - const unfilteredServiceNames = unfilteredResponse.body.items - .map((item) => item.serviceName) - .sort(); + const totalRps = config.multiple.dev.rps; - const filteredServiceNames = filteredResponse.body.items - .map((item) => item.serviceName) - .sort(); + expect(multipleEnvService).to.eql({ + serviceName: 'multiple-env-service', + transactionType: 'request', + environments: ['development'], + agentName: 'go', + latency: 1000 * ((config.multiple.dev.duration * config.multiple.dev.rps) / totalRps), + throughput: totalRps * 60, + transactionErrorRate: 1, + }); + }); + }); - expect(unfilteredServiceNames).to.eql(filteredServiceNames); + describe('when excluding default transaction types', () => { + before(async () => { + response = await apmApiClient.readUser({ + endpoint: 'GET /internal/apm/services', + params: { + query: { + start, + end, + environment: ENVIRONMENT_ALL.value, + kuery: 'not (transaction.type:request)', + }, + }, + }); + }); - expect(filteredResponse.body.items.every((item) => !!item.agentName)).to.be(true); + it('returns data for the top transaction type that is not a default', () => { + const multipleEnvService = response.body.items.find( + (item) => item.serviceName === 'multiple-env-service' + ); + + expect(multipleEnvService?.transactionType).to.eql('rpc'); + }); }); } ); registry.when( - 'APM Services overview with a trial license when data is loaded', + 'APM Services Overview with a trial license when data is loaded', { config: 'trial', archives: [archiveName] }, () => { describe('with the default APM read user', () => { @@ -236,7 +300,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { before(async () => { response = await supertest.get( - `/internal/apm/services?start=${start}&end=${end}&environment=ENVIRONMENT_ALL&kuery=` + `/internal/apm/services?start=${archiveStart}&end=${archiveEnd}&environment=ENVIRONMENT_ALL&kuery=` ); }); @@ -282,7 +346,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { let response: PromiseReturnType; before(async () => { response = await supertestAsApmReadUserWithoutMlAccess.get( - `/internal/apm/services?start=${start}&end=${end}&environment=ENVIRONMENT_ALL&kuery=` + `/internal/apm/services?start=${archiveStart}&end=${archiveEnd}&environment=ENVIRONMENT_ALL&kuery=` ); }); @@ -307,7 +371,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { let response: PromiseReturnType; before(async () => { response = await supertest.get( - `/internal/apm/services?environment=ENVIRONMENT_ALL&start=${start}&end=${end}&kuery=${encodeURIComponent( + `/internal/apm/services?environment=ENVIRONMENT_ALL&start=${archiveStart}&end=${archiveEnd}&kuery=${encodeURIComponent( 'service.name:opbeans-java' )}` ); diff --git a/x-pack/test/apm_api_integration/tests/traces/__snapshots__/top_traces.snap b/x-pack/test/apm_api_integration/tests/traces/__snapshots__/top_traces.snap index 64e1754c9570f6..604348355f38c8 100644 --- a/x-pack/test/apm_api_integration/tests/traces/__snapshots__/top_traces.snap +++ b/x-pack/test/apm_api_integration/tests/traces/__snapshots__/top_traces.snap @@ -3,7 +3,7 @@ exports[`APM API tests basic apm_8.0.0 Top traces when data is loaded returns the correct buckets 1`] = ` Array [ Object { - "averageResponseTime": 1638, + "averageResponseTime": 1639, "impact": 0, "key": Object { "service.name": "opbeans-java", @@ -15,8 +15,8 @@ Array [ "transactionsPerMinute": 0.0333333333333333, }, Object { - "averageResponseTime": 3278, - "impact": 0.00153950779720334, + "averageResponseTime": 3279, + "impact": 0.00144735571024101, "key": Object { "service.name": "opbeans-node", "transaction.name": "POST /api/orders", @@ -27,8 +27,8 @@ Array [ "transactionsPerMinute": 0.0333333333333333, }, Object { - "averageResponseTime": 6169, - "impact": 0.00425335965190752, + "averageResponseTime": 6175, + "impact": 0.00400317408637392, "key": Object { "service.name": "opbeans-node", "transaction.name": "GET /api/products/:id", @@ -39,8 +39,8 @@ Array [ "transactionsPerMinute": 0.0333333333333333, }, Object { - "averageResponseTime": 3486, - "impact": 0.00500715523797721, + "averageResponseTime": 3495, + "impact": 0.00472243927164613, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "POST Orders/Post", @@ -51,8 +51,8 @@ Array [ "transactionsPerMinute": 0.0666666666666667, }, Object { - "averageResponseTime": 7022, - "impact": 0.00505409145130658, + "averageResponseTime": 7039, + "impact": 0.00476568343615943, "key": Object { "service.name": "opbeans-python", "transaction.name": "GET opbeans.views.product", @@ -63,8 +63,8 @@ Array [ "transactionsPerMinute": 0.0333333333333333, }, Object { - "averageResponseTime": 6279, - "impact": 0.0102508689911344, + "averageResponseTime": 6303, + "impact": 0.00967875004525193, "key": Object { "service.name": "opbeans-ruby", "transaction.name": "Api::OrdersController#create", @@ -75,8 +75,8 @@ Array [ "transactionsPerMinute": 0.0666666666666667, }, Object { - "averageResponseTime": 7959, - "impact": 0.0134049825268681, + "averageResponseTime": 7209.66666666667, + "impact": 0.0176418540534865, "key": Object { "service.name": "opbeans-java", "transaction.name": "APIRestController#products", @@ -84,35 +84,11 @@ Array [ "serviceName": "opbeans-java", "transactionName": "APIRestController#products", "transactionType": "request", - "transactionsPerMinute": 0.0666666666666667, - }, - Object { - "averageResponseTime": 7411.33333333333, - "impact": 0.0193339649946342, - "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.order", - }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.order", - "transactionType": "request", "transactionsPerMinute": 0.1, }, Object { - "averageResponseTime": 11729, - "impact": 0.0204829634969371, - "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::OrdersController#show", - }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::OrdersController#show", - "transactionType": "request", - "transactionsPerMinute": 0.0666666666666667, - }, - Object { - "averageResponseTime": 4499.16666666667, - "impact": 0.0238032312278568, + "averageResponseTime": 4511, + "impact": 0.0224401912465233, "key": Object { "service.name": "opbeans-java", "transaction.name": "APIRestController#orders", @@ -123,8 +99,20 @@ Array [ "transactionsPerMinute": 0.2, }, Object { - "averageResponseTime": 10126.3333333333, - "impact": 0.0269798741459886, + "averageResponseTime": 7607, + "impact": 0.0254072704525173, + "key": Object { + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.order", + }, + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.order", + "transactionType": "request", + "transactionsPerMinute": 0.133333333333333, + }, + Object { + "averageResponseTime": 10143, + "impact": 0.025408152986487, "key": Object { "service.name": "opbeans-node", "transaction.name": "GET /api/types", @@ -135,32 +123,32 @@ Array [ "transactionsPerMinute": 0.1, }, Object { - "averageResponseTime": 6089.83333333333, - "impact": 0.032762415628167, + "averageResponseTime": 6105.66666666667, + "impact": 0.0308842762682221, "key": Object { - "service.name": "opbeans-java", - "transaction.name": "APIRestController#customerWhoBought", + "service.name": "opbeans-ruby", + "transaction.name": "Api::TypesController#index", }, - "serviceName": "opbeans-java", - "transactionName": "APIRestController#customerWhoBought", + "serviceName": "opbeans-ruby", + "transactionName": "Api::TypesController#index", "transactionType": "request", "transactionsPerMinute": 0.2, }, Object { - "averageResponseTime": 6094.83333333333, - "impact": 0.0327905773561646, + "averageResponseTime": 6116.33333333333, + "impact": 0.0309407584422802, "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::TypesController#index", + "service.name": "opbeans-java", + "transaction.name": "APIRestController#customerWhoBought", }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::TypesController#index", + "serviceName": "opbeans-java", + "transactionName": "APIRestController#customerWhoBought", "transactionType": "request", "transactionsPerMinute": 0.2, }, Object { - "averageResponseTime": 12527.3333333333, - "impact": 0.0337415050382176, + "averageResponseTime": 12543, + "impact": 0.0317623975680329, "key": Object { "service.name": "opbeans-java", "transaction.name": "APIRestController#customers", @@ -171,8 +159,8 @@ Array [ "transactionsPerMinute": 0.1, }, Object { - "averageResponseTime": 5534.85714285714, - "impact": 0.0348323026359922, + "averageResponseTime": 5551, + "impact": 0.0328461492827744, "key": Object { "service.name": "opbeans-node", "transaction.name": "GET /api/orders/:id", @@ -183,8 +171,8 @@ Array [ "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 13149.3333333333, - "impact": 0.0354931645196697, + "averageResponseTime": 13183, + "impact": 0.0334568627897785, "key": Object { "service.name": "opbeans-java", "transaction.name": "APIRestController#stats", @@ -195,8 +183,8 @@ Array [ "transactionsPerMinute": 0.1, }, Object { - "averageResponseTime": 8025.8, - "impact": 0.0361324357452157, + "averageResponseTime": 8050.2, + "impact": 0.0340764016364792, "key": Object { "service.name": "opbeans-go", "transaction.name": "POST /api/orders", @@ -207,8 +195,20 @@ Array [ "transactionsPerMinute": 0.166666666666667, }, Object { - "averageResponseTime": 8432.8, - "impact": 0.0380427396277211, + "averageResponseTime": 10079, + "impact": 0.0341337663445071, + "key": Object { + "service.name": "opbeans-ruby", + "transaction.name": "Api::OrdersController#show", + }, + "serviceName": "opbeans-ruby", + "transactionName": "Api::OrdersController#show", + "transactionType": "request", + "transactionsPerMinute": 0.133333333333333, + }, + Object { + "averageResponseTime": 8463, + "impact": 0.0358979517498557, "key": Object { "service.name": "opbeans-node", "transaction.name": "GET /api/products/:id/customers", @@ -219,32 +219,32 @@ Array [ "transactionsPerMinute": 0.166666666666667, }, Object { - "averageResponseTime": 7408, - "impact": 0.0401867858526067, + "averageResponseTime": 10799, + "impact": 0.0366754641771254, "key": Object { "service.name": "opbeans-ruby", - "transaction.name": "Api::TypesController#show", + "transaction.name": "Api::ProductsController#show", }, "serviceName": "opbeans-ruby", - "transactionName": "Api::TypesController#show", + "transactionName": "Api::ProductsController#show", "transactionType": "request", - "transactionsPerMinute": 0.2, + "transactionsPerMinute": 0.133333333333333, }, Object { - "averageResponseTime": 6869.42857142857, - "impact": 0.0436018647344517, + "averageResponseTime": 7428.33333333333, + "impact": 0.0378880658514371, "key": Object { - "service.name": "opbeans-java", - "transaction.name": "APIRestController#order", + "service.name": "opbeans-ruby", + "transaction.name": "Api::TypesController#show", }, - "serviceName": "opbeans-java", - "transactionName": "APIRestController#order", + "serviceName": "opbeans-ruby", + "transactionName": "Api::TypesController#show", "transactionType": "request", - "transactionsPerMinute": 0.233333333333333, + "transactionsPerMinute": 0.2, }, Object { - "averageResponseTime": 3050, - "impact": 0.0442721138607951, + "averageResponseTime": 3105.13333333333, + "impact": 0.039659311528543, "key": Object { "service.name": "opbeans-java", "transaction.name": "ResourceHttpRequestHandler", @@ -252,23 +252,23 @@ Array [ "serviceName": "opbeans-java", "transactionName": "ResourceHttpRequestHandler", "transactionType": "request", - "transactionsPerMinute": 0.533333333333333, + "transactionsPerMinute": 0.5, }, Object { - "averageResponseTime": 10786.2, - "impact": 0.0490887080726551, + "averageResponseTime": 6883.57142857143, + "impact": 0.0410784261517549, "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::ProductsController#show", + "service.name": "opbeans-java", + "transaction.name": "APIRestController#order", }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::ProductsController#show", + "serviceName": "opbeans-java", + "transactionName": "APIRestController#order", "transactionType": "request", - "transactionsPerMinute": 0.166666666666667, + "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 3497.6875, - "impact": 0.0509961957823607, + "averageResponseTime": 3505, + "impact": 0.0480460318422139, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "GET Products/Get", @@ -279,8 +279,8 @@ Array [ "transactionsPerMinute": 0.533333333333333, }, Object { - "averageResponseTime": 5604.9, - "impact": 0.0510769260692872, + "averageResponseTime": 5621.4, + "impact": 0.0481642913941483, "key": Object { "service.name": "opbeans-java", "transaction.name": "APIRestController#topProducts", @@ -291,44 +291,44 @@ Array [ "transactionsPerMinute": 0.333333333333333, }, Object { - "averageResponseTime": 8500.57142857143, - "impact": 0.0543202184103467, + "averageResponseTime": 8428.71428571429, + "impact": 0.0506239135675883, "key": Object { "service.name": "opbeans-node", - "transaction.name": "GET /api/customers/:id", + "transaction.name": "GET /api/orders", }, "serviceName": "opbeans-node", - "transactionName": "GET /api/customers/:id", + "transactionName": "GET /api/orders", "transactionType": "request", "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 6658.88888888889, - "impact": 0.0547201149479129, + "averageResponseTime": 8520.14285714286, + "impact": 0.0511887353081702, "key": Object { "service.name": "opbeans-node", - "transaction.name": "GET /api/products/top", + "transaction.name": "GET /api/customers/:id", }, "serviceName": "opbeans-node", - "transactionName": "GET /api/products/top", + "transactionName": "GET /api/customers/:id", "transactionType": "request", - "transactionsPerMinute": 0.3, + "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 8141.125, - "impact": 0.0596005424099008, + "averageResponseTime": 6683.44444444444, + "impact": 0.0516388276326964, "key": Object { "service.name": "opbeans-node", - "transaction.name": "GET /api/orders", + "transaction.name": "GET /api/products/top", }, "serviceName": "opbeans-node", - "transactionName": "GET /api/orders", + "transactionName": "GET /api/products/top", "transactionType": "request", - "transactionsPerMinute": 0.266666666666667, + "transactionsPerMinute": 0.3, }, Object { - "averageResponseTime": 3473.52631578947, - "impact": 0.0604153550732987, + "averageResponseTime": 3482.78947368421, + "impact": 0.0569534471979838, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "GET Types/Get", @@ -339,20 +339,20 @@ Array [ "transactionsPerMinute": 0.633333333333333, }, Object { - "averageResponseTime": 7875, - "impact": 0.064994452045712, + "averageResponseTime": 16703, + "impact": 0.057517386404596, "key": Object { - "service.name": "opbeans-node", - "transaction.name": "GET /api/types/:id", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.product_type", }, - "serviceName": "opbeans-node", - "transactionName": "GET /api/types/:id", + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.product_type", "transactionType": "request", - "transactionsPerMinute": 0.3, + "transactionsPerMinute": 0.133333333333333, }, Object { - "averageResponseTime": 4889, - "impact": 0.0673037137415171, + "averageResponseTime": 4943, + "impact": 0.0596266425920813, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "GET Products/Get {id}", @@ -360,23 +360,23 @@ Array [ "serviceName": "opbeans-dotnet", "transactionName": "GET Products/Get {id}", "transactionType": "request", - "transactionsPerMinute": 0.5, + "transactionsPerMinute": 0.466666666666667, }, Object { - "averageResponseTime": 14902.4, - "impact": 0.0684085922032904, + "averageResponseTime": 7892.33333333333, + "impact": 0.0612407972225879, "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.product_type", + "service.name": "opbeans-node", + "transaction.name": "GET /api/types/:id", }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.product_type", + "serviceName": "opbeans-node", + "transactionName": "GET /api/types/:id", "transactionType": "request", - "transactionsPerMinute": 0.166666666666667, + "transactionsPerMinute": 0.3, }, Object { - "averageResponseTime": 6329.35714285714, - "impact": 0.0816436656379062, + "averageResponseTime": 6346.42857142857, + "impact": 0.0769666700279444, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "GET Orders/Get {id}", @@ -387,8 +387,8 @@ Array [ "transactionsPerMinute": 0.466666666666667, }, Object { - "averageResponseTime": 6627.42857142857, - "impact": 0.0855609620023755, + "averageResponseTime": 7052.84615384615, + "impact": 0.0794704188998674, "key": Object { "service.name": "opbeans-go", "transaction.name": "GET /api/products", @@ -396,11 +396,11 @@ Array [ "serviceName": "opbeans-go", "transactionName": "GET /api/products", "transactionType": "request", - "transactionsPerMinute": 0.466666666666667, + "transactionsPerMinute": 0.433333333333333, }, Object { - "averageResponseTime": 10459, - "impact": 0.0868254235894687, + "averageResponseTime": 10484.3333333333, + "impact": 0.0818285496667966, "key": Object { "service.name": "opbeans-java", "transaction.name": "APIRestController#product", @@ -411,8 +411,8 @@ Array [ "transactionsPerMinute": 0.3, }, Object { - "averageResponseTime": 23652.5, - "impact": 0.087275072513164, + "averageResponseTime": 23711, + "impact": 0.0822565786420813, "key": Object { "service.name": "opbeans-node", "transaction.name": "GET /api/stats", @@ -423,8 +423,8 @@ Array [ "transactionsPerMinute": 0.133333333333333, }, Object { - "averageResponseTime": 4480.95454545455, - "impact": 0.0910027465757826, + "averageResponseTime": 4491.36363636364, + "impact": 0.0857567083657495, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "GET Types/Get {id}", @@ -435,8 +435,8 @@ Array [ "transactionsPerMinute": 0.733333333333333, }, Object { - "averageResponseTime": 20677.4, - "impact": 0.0955142554010017, + "averageResponseTime": 20715.8, + "impact": 0.089965512867054, "key": Object { "service.name": "opbeans-python", "transaction.name": "GET opbeans.views.stats", @@ -447,8 +447,8 @@ Array [ "transactionsPerMinute": 0.166666666666667, }, Object { - "averageResponseTime": 9015.33333333333, - "impact": 0.100017315707821, + "averageResponseTime": 9036.33333333333, + "impact": 0.0942519803576885, "key": Object { "service.name": "opbeans-node", "transaction.name": "GET /api/products", @@ -459,20 +459,8 @@ Array [ "transactionsPerMinute": 0.4, }, Object { - "averageResponseTime": 12096.8888888889, - "impact": 0.100663158003234, - "key": Object { - "service.name": "opbeans-go", - "transaction.name": "GET /api/customers", - }, - "serviceName": "opbeans-go", - "transactionName": "GET /api/customers", - "transactionType": "request", - "transactionsPerMinute": 0.3, - }, - Object { - "averageResponseTime": 7361.46666666667, - "impact": 0.102118180616444, + "averageResponseTime": 7504.06666666667, + "impact": 0.0978924329825326, "key": Object { "service.name": "opbeans-java", "transaction.name": "APIRestController#customer", @@ -483,8 +471,8 @@ Array [ "transactionsPerMinute": 0.5, }, Object { - "averageResponseTime": 4141.07142857143, - "impact": 0.107307448362139, + "averageResponseTime": 4250.55555555556, + "impact": 0.0998375378516613, "key": Object { "service.name": "opbeans-go", "transaction.name": "GET /api/types/:id", @@ -492,11 +480,11 @@ Array [ "serviceName": "opbeans-go", "transactionName": "GET /api/types/:id", "transactionType": "request", - "transactionsPerMinute": 0.933333333333333, + "transactionsPerMinute": 0.9, }, Object { - "averageResponseTime": 21277, - "impact": 0.118301786972411, + "averageResponseTime": 21343, + "impact": 0.11156906191034, "key": Object { "service.name": "opbeans-node", "transaction.name": "GET /api/customers", @@ -507,8 +495,8 @@ Array [ "transactionsPerMinute": 0.2, }, Object { - "averageResponseTime": 16602.25, - "impact": 0.123141849290936, + "averageResponseTime": 16655, + "impact": 0.116142352941114, "key": Object { "service.name": "opbeans-ruby", "transaction.name": "Api::ProductsController#top", @@ -519,8 +507,20 @@ Array [ "transactionsPerMinute": 0.266666666666667, }, Object { - "averageResponseTime": 9924.07142857143, - "impact": 0.128885903078184, + "averageResponseTime": 5749, + "impact": 0.12032203382142, + "key": Object { + "service.name": "opbeans-go", + "transaction.name": "GET /api/types", + }, + "serviceName": "opbeans-go", + "transactionName": "GET /api/types", + "transactionType": "request", + "transactionsPerMinute": 0.8, + }, + Object { + "averageResponseTime": 9951, + "impact": 0.121502864272824, "key": Object { "service.name": "opbeans-ruby", "transaction.name": "Api::StatsController#index", @@ -531,20 +531,20 @@ Array [ "transactionsPerMinute": 0.466666666666667, }, Object { - "averageResponseTime": 5444.5, - "impact": 0.131345360656643, + "averageResponseTime": 14040.6, + "impact": 0.122466591367692, "key": Object { "service.name": "opbeans-go", - "transaction.name": "GET /api/types", + "transaction.name": "GET /api/customers", }, "serviceName": "opbeans-go", - "transactionName": "GET /api/types", + "transactionName": "GET /api/customers", "transactionType": "request", - "transactionsPerMinute": 0.866666666666667, + "transactionsPerMinute": 0.333333333333333, }, Object { - "averageResponseTime": 20932.4285714286, - "impact": 0.136010820261582, + "averageResponseTime": 20963.5714285714, + "impact": 0.128060974201361, "key": Object { "service.name": "opbeans-ruby", "transaction.name": "Api::OrdersController#index", @@ -555,20 +555,8 @@ Array [ "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 12301.3333333333, - "impact": 0.137033090987896, - "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::ProductsController#index", - }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::ProductsController#index", - "transactionType": "request", - "transactionsPerMinute": 0.4, - }, - Object { - "averageResponseTime": 22818.7142857143, - "impact": 0.148405735477602, + "averageResponseTime": 22874.4285714286, + "impact": 0.139865748579522, "key": Object { "service.name": "opbeans-python", "transaction.name": "GET opbeans.views.customer", @@ -579,8 +567,8 @@ Array [ "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 32098.4, - "impact": 0.149120104644475, + "averageResponseTime": 32203.8, + "impact": 0.140658264084276, "key": Object { "service.name": "opbeans-python", "transaction.name": "GET opbeans.views.customers", @@ -591,8 +579,8 @@ Array [ "transactionsPerMinute": 0.166666666666667, }, Object { - "averageResponseTime": 4585.91428571429, - "impact": 0.149134185508474, + "averageResponseTime": 4482.11111111111, + "impact": 0.140955678032051, "key": Object { "service.name": "opbeans-go", "transaction.name": "GET /api/customers/:id", @@ -600,23 +588,23 @@ Array [ "serviceName": "opbeans-go", "transactionName": "GET /api/customers/:id", "transactionType": "request", - "transactionsPerMinute": 1.16666666666667, + "transactionsPerMinute": 1.2, }, Object { - "averageResponseTime": 20449.3333333333, - "impact": 0.171228938571142, + "averageResponseTime": 12582.3846153846, + "impact": 0.142910490774846, "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.orders", + "service.name": "opbeans-ruby", + "transaction.name": "Api::ProductsController#index", }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.orders", + "serviceName": "opbeans-ruby", + "transactionName": "Api::ProductsController#index", "transactionType": "request", - "transactionsPerMinute": 0.3, + "transactionsPerMinute": 0.433333333333333, }, Object { - "averageResponseTime": 9981.1052631579, - "impact": 0.176482978291232, + "averageResponseTime": 10009.9473684211, + "impact": 0.166401779979233, "key": Object { "service.name": "opbeans-ruby", "transaction.name": "Api::CustomersController#show", @@ -627,8 +615,8 @@ Array [ "transactionsPerMinute": 0.633333333333333, }, Object { - "averageResponseTime": 27758.7142857143, - "impact": 0.180866820616195, + "averageResponseTime": 27825.2857142857, + "impact": 0.170450845832029, "key": Object { "service.name": "opbeans-python", "transaction.name": "GET opbeans.views.product_types", @@ -639,20 +627,20 @@ Array [ "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 8332.06896551724, - "impact": 0.225286314186844, + "averageResponseTime": 20562.2, + "impact": 0.180021926732983, "key": Object { - "service.name": "opbeans-go", - "transaction.name": "GET /api/orders/:id", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.orders", }, - "serviceName": "opbeans-go", - "transactionName": "GET /api/orders/:id", + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.orders", "transactionType": "request", - "transactionsPerMinute": 0.966666666666667, + "transactionsPerMinute": 0.333333333333333, }, Object { - "averageResponseTime": 6976.62857142857, - "impact": 0.227681938515175, + "averageResponseTime": 7106.76470588235, + "impact": 0.21180020991247, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "GET Customers/Get {id}", @@ -660,11 +648,23 @@ Array [ "serviceName": "opbeans-dotnet", "transactionName": "GET Customers/Get {id}", "transactionType": "request", - "transactionsPerMinute": 1.16666666666667, + "transactionsPerMinute": 1.13333333333333, + }, + Object { + "averageResponseTime": 8612.51724137931, + "impact": 0.218977858687708, + "key": Object { + "service.name": "opbeans-go", + "transaction.name": "GET /api/orders/:id", + }, + "serviceName": "opbeans-go", + "transactionName": "GET /api/orders/:id", + "transactionType": "request", + "transactionsPerMinute": 0.966666666666667, }, Object { - "averageResponseTime": 11321.7777777778, - "impact": 0.2854191132559, + "averageResponseTime": 11295, + "impact": 0.277663720068132, "key": Object { "service.name": "opbeans-ruby", "transaction.name": "Api::CustomersController#index", @@ -672,11 +672,11 @@ Array [ "serviceName": "opbeans-ruby", "transactionName": "Api::CustomersController#index", "transactionType": "request", - "transactionsPerMinute": 0.9, + "transactionsPerMinute": 0.933333333333333, }, Object { - "averageResponseTime": 64824.2, - "impact": 0.302722617661906, + "averageResponseTime": 65035.8, + "impact": 0.285535040543522, "key": Object { "service.name": "opbeans-python", "transaction.name": "GET opbeans.views.product_customers", @@ -687,8 +687,8 @@ Array [ "transactionsPerMinute": 0.166666666666667, }, Object { - "averageResponseTime": 32155.5625, - "impact": 0.481425678843616, + "averageResponseTime": 30999.4705882353, + "impact": 0.463640986028375, "key": Object { "service.name": "opbeans-go", "transaction.name": "GET /api/stats", @@ -696,23 +696,11 @@ Array [ "serviceName": "opbeans-go", "transactionName": "GET /api/stats", "transactionType": "request", - "transactionsPerMinute": 0.533333333333333, + "transactionsPerMinute": 0.566666666666667, }, Object { - "averageResponseTime": 32890.5714285714, - "impact": 0.646841098031782, - "key": Object { - "service.name": "opbeans-dotnet", - "transaction.name": "GET Customers/Get", - }, - "serviceName": "opbeans-dotnet", - "transactionName": "GET Customers/Get", - "transactionType": "request", - "transactionsPerMinute": 0.7, - }, - Object { - "averageResponseTime": 20133.0571428571, - "impact": 0.65994099517201, + "averageResponseTime": 20197.4, + "impact": 0.622424732781511, "key": Object { "service.name": "opbeans-go", "transaction.name": "GET /api/products/:id/customers", @@ -723,8 +711,8 @@ Array [ "transactionsPerMinute": 1.16666666666667, }, Object { - "averageResponseTime": 64534, - "impact": 0.725417951490748, + "averageResponseTime": 64681.6666666667, + "impact": 0.68355874339377, "key": Object { "service.name": "opbeans-python", "transaction.name": "GET opbeans.views.top_products", @@ -735,8 +723,20 @@ Array [ "transactionsPerMinute": 0.4, }, Object { - "averageResponseTime": 19259.8775510204, - "impact": 0.884368376654926, + "averageResponseTime": 41416.1428571429, + "impact": 0.766127739061111, + "key": Object { + "service.name": "opbeans-dotnet", + "transaction.name": "GET Customers/Get", + }, + "serviceName": "opbeans-dotnet", + "transactionName": "GET Customers/Get", + "transactionType": "request", + "transactionsPerMinute": 0.7, + }, + Object { + "averageResponseTime": 19429, + "impact": 0.821597646656097, "key": Object { "service.name": "opbeans-go", "transaction.name": "GET /api/products/:id", @@ -744,11 +744,11 @@ Array [ "serviceName": "opbeans-go", "transactionName": "GET /api/products/:id", "transactionType": "request", - "transactionsPerMinute": 1.63333333333333, + "transactionsPerMinute": 1.6, }, Object { - "averageResponseTime": 62237.5652173913, - "impact": 1.3422123631976, + "averageResponseTime": 62390.652173913, + "impact": 1.26497653527507, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "GET Products/Customerwhobought {id}", @@ -759,8 +759,8 @@ Array [ "transactionsPerMinute": 0.766666666666667, }, Object { - "averageResponseTime": 33203.5666666667, - "impact": 1.86860199568649, + "averageResponseTime": 33266.2, + "impact": 1.76006661931225, "key": Object { "service.name": "opbeans-python", "transaction.name": "opbeans.tasks.sync_orders", @@ -771,8 +771,8 @@ Array [ "transactionsPerMinute": 2, }, Object { - "averageResponseTime": 37042.1607142857, - "impact": 1.94571537801384, + "averageResponseTime": 38491.4444444444, + "impact": 1.83293391905112, "key": Object { "service.name": "opbeans-node", "transaction.name": "GET /api", @@ -780,11 +780,11 @@ Array [ "serviceName": "opbeans-node", "transactionName": "GET /api", "transactionType": "request", - "transactionsPerMinute": 1.86666666666667, + "transactionsPerMinute": 1.8, }, Object { - "averageResponseTime": 116654.571428571, - "impact": 2.29809838682675, + "averageResponseTime": 118488.6, + "impact": 2.08995781717084, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "GET Stats/Get", @@ -792,35 +792,47 @@ Array [ "serviceName": "opbeans-dotnet", "transactionName": "GET Stats/Get", "transactionType": "request", - "transactionsPerMinute": 0.7, + "transactionsPerMinute": 0.666666666666667, }, Object { - "averageResponseTime": 28741.0333333333, - "impact": 2.4266538589631, + "averageResponseTime": 250440.142857143, + "impact": 4.64001412901584, "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Rack", + "service.name": "opbeans-dotnet", + "transaction.name": "GET Products/Top", }, - "serviceName": "opbeans-ruby", - "transactionName": "Rack", + "serviceName": "opbeans-dotnet", + "transactionName": "GET Products/Top", "transactionType": "request", - "transactionsPerMinute": 3, + "transactionsPerMinute": 0.7, }, Object { - "averageResponseTime": 249714.952380952, - "impact": 4.9211455657754, + "averageResponseTime": 312096.523809524, + "impact": 5.782704992387, "key": Object { - "service.name": "opbeans-dotnet", - "transaction.name": "GET Products/Top", + "service.name": "opbeans-java", + "transaction.name": "DispatcherServlet#doGet", }, - "serviceName": "opbeans-dotnet", - "transactionName": "GET Products/Top", + "serviceName": "opbeans-java", + "transactionName": "DispatcherServlet#doGet", "transactionType": "request", "transactionsPerMinute": 0.7, }, Object { - "averageResponseTime": 653461.538461538, - "impact": 7.97292501431132, + "averageResponseTime": 91519.7032967033, + "impact": 7.34855500859826, + "key": Object { + "service.name": "opbeans-ruby", + "transaction.name": "Rack", + }, + "serviceName": "opbeans-ruby", + "transactionName": "Rack", + "transactionType": "request", + "transactionsPerMinute": 3.03333333333333, + }, + Object { + "averageResponseTime": 648269.769230769, + "impact": 7.43611473386403, "key": Object { "service.name": "opbeans-rum", "transaction.name": "/customers", @@ -831,20 +843,8 @@ Array [ "transactionsPerMinute": 0.433333333333333, }, Object { - "averageResponseTime": 575328.095238095, - "impact": 11.340025698891, - "key": Object { - "service.name": "opbeans-java", - "transaction.name": "DispatcherServlet#doGet", - }, - "serviceName": "opbeans-java", - "transactionName": "DispatcherServlet#doGet", - "transactionType": "request", - "transactionsPerMinute": 0.7, - }, - Object { - "averageResponseTime": 1534606.6, - "impact": 14.4041869205032, + "averageResponseTime": 1398919.72727273, + "impact": 13.5790895084132, "key": Object { "service.name": "opbeans-python", "transaction.name": "GET opbeans.views.products", @@ -852,11 +852,11 @@ Array [ "serviceName": "opbeans-python", "transactionName": "GET opbeans.views.products", "transactionType": "request", - "transactionsPerMinute": 0.333333333333333, + "transactionsPerMinute": 0.366666666666667, }, Object { - "averageResponseTime": 1197500, - "impact": 15.7361746989891, + "averageResponseTime": 1199907.57142857, + "impact": 14.8239822181408, "key": Object { "service.name": "opbeans-rum", "transaction.name": "/orders", @@ -867,8 +867,8 @@ Array [ "transactionsPerMinute": 0.466666666666667, }, Object { - "averageResponseTime": 953684.210526316, - "impact": 17.0081460802151, + "averageResponseTime": 955876.052631579, + "impact": 16.026822184214, "key": Object { "service.name": "opbeans-rum", "transaction.name": "/products", @@ -879,8 +879,8 @@ Array [ "transactionsPerMinute": 0.633333333333333, }, Object { - "averageResponseTime": 962252.473684211, - "impact": 17.1609675746427, + "averageResponseTime": 965009.526315789, + "impact": 16.1799735991728, "key": Object { "service.name": "opbeans-go", "transaction.name": "GET /api/orders", @@ -891,8 +891,8 @@ Array [ "transactionsPerMinute": 0.633333333333333, }, Object { - "averageResponseTime": 1212615.38461538, - "impact": 29.594561046619, + "averageResponseTime": 1213675.30769231, + "impact": 27.8474053933734, "key": Object { "service.name": "opbeans-rum", "transaction.name": "/dashboard", @@ -903,8 +903,8 @@ Array [ "transactionsPerMinute": 0.866666666666667, }, Object { - "averageResponseTime": 896783.309523809, - "impact": 35.3554170595149, + "averageResponseTime": 924019.363636364, + "impact": 35.8796065162284, "key": Object { "service.name": "opbeans-node", "transaction.name": "Update shipping status", @@ -912,11 +912,23 @@ Array [ "serviceName": "opbeans-node", "transactionName": "Update shipping status", "transactionType": "Worker", - "transactionsPerMinute": 1.4, + "transactionsPerMinute": 1.46666666666667, + }, + Object { + "averageResponseTime": 1060469.15384615, + "impact": 36.498655556576, + "key": Object { + "service.name": "opbeans-node", + "transaction.name": "Process payment", + }, + "serviceName": "opbeans-node", + "transactionName": "Process payment", + "transactionType": "Worker", + "transactionsPerMinute": 1.3, }, Object { - "averageResponseTime": 119062.672222222, - "impact": 40.2345894471584, + "averageResponseTime": 118686.822222222, + "impact": 37.7068083771466, "key": Object { "service.name": "opbeans-python", "transaction.name": "opbeans.tasks.update_stats", @@ -927,20 +939,8 @@ Array [ "transactionsPerMinute": 12, }, Object { - "averageResponseTime": 1078328.675, - "impact": 40.488594152833, - "key": Object { - "service.name": "opbeans-node", - "transaction.name": "Process payment", - }, - "serviceName": "opbeans-node", - "transactionName": "Process payment", - "transactionType": "Worker", - "transactionsPerMinute": 1.33333333333333, - }, - Object { - "averageResponseTime": 1057995.65957447, - "impact": 46.6772737502262, + "averageResponseTime": 1039228.27659574, + "impact": 43.1048035741496, "key": Object { "service.name": "opbeans-node", "transaction.name": "Process completed order", @@ -951,8 +951,8 @@ Array [ "transactionsPerMinute": 1.56666666666667, }, Object { - "averageResponseTime": 1947354.08333333, - "impact": 65.8074895815218, + "averageResponseTime": 1949922.55555556, + "impact": 61.9499776921889, "key": Object { "service.name": "opbeans-python", "transaction.name": "opbeans.tasks.sync_customers", @@ -963,7 +963,7 @@ Array [ "transactionsPerMinute": 1.2, }, Object { - "averageResponseTime": 5918288.44444444, + "averageResponseTime": 5963775, "impact": 100, "key": Object { "service.name": "opbeans-dotnet", @@ -972,7 +972,7 @@ Array [ "serviceName": "opbeans-dotnet", "transactionName": "GET Orders/Get", "transactionType": "request", - "transactionsPerMinute": 0.6, + "transactionsPerMinute": 0.633333333333333, }, ] `; diff --git a/x-pack/test/apm_api_integration/tests/traces/top_traces.ts b/x-pack/test/apm_api_integration/tests/traces/top_traces.ts index e67c2cb66df698..4968732f822033 100644 --- a/x-pack/test/apm_api_integration/tests/traces/top_traces.ts +++ b/x-pack/test/apm_api_integration/tests/traces/top_traces.ts @@ -63,7 +63,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(firstItem).toMatchInline(` Object { - "averageResponseTime": 1638, + "averageResponseTime": 1639, "impact": 0, "key": Object { "service.name": "opbeans-java", @@ -78,7 +78,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(lastItem).toMatchInline(` Object { - "averageResponseTime": 5918288.44444444, + "averageResponseTime": 5963775, "impact": 100, "key": Object { "service.name": "opbeans-dotnet", @@ -87,7 +87,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { "serviceName": "opbeans-dotnet", "transactionName": "GET Orders/Get", "transactionType": "request", - "transactionsPerMinute": 0.6, + "transactionsPerMinute": 0.633333333333333, } `); diff --git a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.snap b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.snap index 878e5775c4ef52..c4dfaf346d0155 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.snap +++ b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.snap @@ -6,241 +6,121 @@ Array [ "x": 1627973400000, "y": 0, }, - Object { - "x": 1627973430000, - "y": 0, - }, Object { "x": 1627973460000, "y": 0, }, - Object { - "x": 1627973490000, - "y": 0.333333333333333, - }, Object { "x": 1627973520000, - "y": 0, - }, - Object { - "x": 1627973550000, - "y": 0.125, + "y": 0.333333333333333, }, Object { "x": 1627973580000, - "y": 0.25, - }, - Object { - "x": 1627973610000, - "y": 0, + "y": 0.181818181818182, }, Object { "x": 1627973640000, "y": 0, }, - Object { - "x": 1627973670000, - "y": 0, - }, Object { "x": 1627973700000, "y": 0, }, - Object { - "x": 1627973730000, - "y": 0.333333333333333, - }, Object { "x": 1627973760000, "y": 0.166666666666667, }, - Object { - "x": 1627973790000, - "y": 0, - }, Object { "x": 1627973820000, - "y": 0.2, - }, - Object { - "x": 1627973850000, - "y": 0, + "y": 0.181818181818182, }, Object { "x": 1627973880000, "y": 0, }, - Object { - "x": 1627973910000, - "y": 0, - }, Object { "x": 1627973940000, "y": 0, }, - Object { - "x": 1627973970000, - "y": 0.166666666666667, - }, Object { "x": 1627974000000, - "y": 0, - }, - Object { - "x": 1627974030000, - "y": 0, + "y": 0.0833333333333333, }, Object { "x": 1627974060000, - "y": 0.25, - }, - Object { - "x": 1627974090000, - "y": 0.5, + "y": 0.0769230769230769, }, Object { "x": 1627974120000, "y": 0, }, - Object { - "x": 1627974150000, - "y": 0, - }, Object { "x": 1627974180000, - "y": 0, - }, - Object { - "x": 1627974210000, - "y": 0.2, + "y": 0.1, }, Object { "x": 1627974240000, - "y": 0.142857142857143, - }, - Object { - "x": 1627974270000, - "y": 0, + "y": 0.153846153846154, }, Object { "x": 1627974300000, "y": 0, }, - Object { - "x": 1627974330000, - "y": null, - }, Object { "x": 1627974360000, "y": null, }, - Object { - "x": 1627974390000, - "y": 0, - }, Object { "x": 1627974420000, "y": 0, }, - Object { - "x": 1627974450000, - "y": 0, - }, Object { "x": 1627974480000, "y": 0, }, - Object { - "x": 1627974510000, - "y": 0, - }, Object { "x": 1627974540000, "y": 0, }, - Object { - "x": 1627974570000, - "y": 0, - }, Object { "x": 1627974600000, - "y": 0.4, - }, - Object { - "x": 1627974630000, - "y": 1, + "y": 0.125, }, Object { "x": 1627974660000, - "y": 0.333333333333333, - }, - Object { - "x": 1627974690000, - "y": 0.5, + "y": 0.6, }, Object { "x": 1627974720000, - "y": 0, - }, - Object { - "x": 1627974750000, - "y": 0, + "y": 0.2, }, Object { "x": 1627974780000, "y": 0, }, - Object { - "x": 1627974810000, - "y": 0, - }, Object { "x": 1627974840000, - "y": 0.333333333333333, - }, - Object { - "x": 1627974870000, "y": 0, }, Object { "x": 1627974900000, - "y": 0, - }, - Object { - "x": 1627974930000, - "y": 0, + "y": 0.0666666666666667, }, Object { "x": 1627974960000, "y": 0, }, - Object { - "x": 1627974990000, - "y": 0, - }, Object { "x": 1627975020000, "y": 0, }, - Object { - "x": 1627975050000, - "y": 0, - }, Object { "x": 1627975080000, "y": 0, }, - Object { - "x": 1627975110000, - "y": 0.4, - }, Object { "x": 1627975140000, - "y": 0, - }, - Object { - "x": 1627975170000, - "y": 0.333333333333333, + "y": 0.181818181818182, }, Object { "x": 1627975200000, @@ -252,736 +132,136 @@ Array [ exports[`APM API tests basic apm_8.0.0 Error rate when data is loaded returns the transaction error rate with comparison data has the correct error rate 1`] = ` Array [ Object { - "x": 1627974310000, - "y": null, - }, - Object { - "x": 1627974320000, - "y": null, - }, - Object { - "x": 1627974330000, - "y": null, - }, - Object { - "x": 1627974340000, - "y": null, - }, - Object { - "x": 1627974350000, - "y": null, + "x": 1627974300000, + "y": 0, }, Object { "x": 1627974360000, "y": null, }, - Object { - "x": 1627974370000, - "y": null, - }, - Object { - "x": 1627974380000, - "y": null, - }, - Object { - "x": 1627974390000, - "y": null, - }, - Object { - "x": 1627974400000, - "y": null, - }, - Object { - "x": 1627974410000, - "y": 0, - }, Object { "x": 1627974420000, "y": 0, }, - Object { - "x": 1627974430000, - "y": null, - }, - Object { - "x": 1627974440000, - "y": 0, - }, - Object { - "x": 1627974450000, - "y": 0, - }, - Object { - "x": 1627974460000, - "y": 0, - }, - Object { - "x": 1627974470000, - "y": null, - }, Object { "x": 1627974480000, "y": 0, }, Object { - "x": 1627974490000, - "y": null, - }, - Object { - "x": 1627974500000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627974510000, - "y": null, + "x": 1627974600000, + "y": 0.125, }, Object { - "x": 1627974520000, - "y": 0, + "x": 1627974660000, + "y": 0.6, }, Object { - "x": 1627974530000, - "y": null, + "x": 1627974720000, + "y": 0.2, }, Object { - "x": 1627974540000, + "x": 1627974780000, "y": 0, }, Object { - "x": 1627974550000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627974560000, - "y": null, + "x": 1627974900000, + "y": 0.0666666666666667, }, Object { - "x": 1627974570000, + "x": 1627974960000, "y": 0, }, Object { - "x": 1627974580000, - "y": null, - }, - Object { - "x": 1627974590000, - "y": null, - }, - Object { - "x": 1627974600000, - "y": null, - }, - Object { - "x": 1627974610000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627974620000, - "y": 1, - }, - Object { - "x": 1627974630000, - "y": null, - }, - Object { - "x": 1627974640000, - "y": null, - }, - Object { - "x": 1627974650000, - "y": 1, - }, - Object { - "x": 1627974660000, + "x": 1627975080000, "y": 0, }, Object { - "x": 1627974670000, - "y": 0.5, - }, - Object { - "x": 1627974680000, - "y": null, - }, - Object { - "x": 1627974690000, - "y": 1, - }, - Object { - "x": 1627974700000, - "y": null, - }, - Object { - "x": 1627974710000, - "y": 0, + "x": 1627975140000, + "y": 0.181818181818182, }, Object { - "x": 1627974720000, + "x": 1627975200000, "y": null, }, +] +`; + +exports[`APM API tests basic apm_8.0.0 Error rate when data is loaded returns the transaction error rate with comparison data has the correct error rate 2`] = ` +Array [ Object { - "x": 1627974730000, + "x": 1627974300000, "y": 0, }, Object { - "x": 1627974740000, + "x": 1627974360000, "y": 0, }, Object { - "x": 1627974750000, - "y": 0, + "x": 1627974420000, + "y": 0.333333333333333, }, Object { - "x": 1627974760000, - "y": null, + "x": 1627974480000, + "y": 0.181818181818182, }, Object { - "x": 1627974770000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627974780000, + "x": 1627974600000, "y": 0, }, Object { - "x": 1627974790000, - "y": 0, + "x": 1627974660000, + "y": 0.166666666666667, }, Object { - "x": 1627974800000, - "y": null, + "x": 1627974720000, + "y": 0.181818181818182, }, Object { - "x": 1627974810000, + "x": 1627974780000, "y": 0, }, - Object { - "x": 1627974820000, - "y": null, - }, - Object { - "x": 1627974830000, - "y": null, - }, Object { "x": 1627974840000, - "y": null, - }, - Object { - "x": 1627974850000, - "y": 0.5, - }, - Object { - "x": 1627974860000, - "y": 0, - }, - Object { - "x": 1627974870000, - "y": 0, - }, - Object { - "x": 1627974880000, - "y": null, - }, - Object { - "x": 1627974890000, "y": 0, }, Object { "x": 1627974900000, - "y": 0, - }, - Object { - "x": 1627974910000, - "y": 0, + "y": 0.0833333333333333, }, Object { - "x": 1627974920000, - "y": null, + "x": 1627974960000, + "y": 0.0769230769230769, }, Object { - "x": 1627974930000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627974940000, - "y": null, - }, - Object { - "x": 1627974950000, - "y": null, - }, - Object { - "x": 1627974960000, - "y": null, + "x": 1627975080000, + "y": 0.1, }, Object { - "x": 1627974970000, - "y": 0, - }, - Object { - "x": 1627974980000, - "y": null, - }, - Object { - "x": 1627974990000, - "y": 0, - }, - Object { - "x": 1627975000000, - "y": null, - }, - Object { - "x": 1627975010000, - "y": 0, - }, - Object { - "x": 1627975020000, - "y": 0, - }, - Object { - "x": 1627975030000, - "y": 0, - }, - Object { - "x": 1627975040000, - "y": null, - }, - Object { - "x": 1627975050000, - "y": 0, - }, - Object { - "x": 1627975060000, - "y": 0, - }, - Object { - "x": 1627975070000, - "y": 0, - }, - Object { - "x": 1627975080000, - "y": 0, - }, - Object { - "x": 1627975090000, - "y": 0, - }, - Object { - "x": 1627975100000, - "y": 0, - }, - Object { - "x": 1627975110000, - "y": 0.333333333333333, - }, - Object { - "x": 1627975120000, - "y": 0, - }, - Object { - "x": 1627975130000, - "y": 1, - }, - Object { - "x": 1627975140000, - "y": 0, - }, - Object { - "x": 1627975150000, - "y": 0, - }, - Object { - "x": 1627975160000, - "y": null, - }, - Object { - "x": 1627975170000, - "y": 0, - }, - Object { - "x": 1627975180000, - "y": 0.25, - }, - Object { - "x": 1627975190000, - "y": 1, - }, - Object { - "x": 1627975200000, - "y": null, - }, - Object { - "x": 1627975210000, - "y": null, - }, -] -`; - -exports[`APM API tests basic apm_8.0.0 Error rate when data is loaded returns the transaction error rate with comparison data has the correct error rate 2`] = ` -Array [ - Object { - "x": 1627974310000, - "y": null, - }, - Object { - "x": 1627974320000, - "y": 0, - }, - Object { - "x": 1627974330000, - "y": null, - }, - Object { - "x": 1627974340000, - "y": null, - }, - Object { - "x": 1627974350000, - "y": 0, - }, - Object { - "x": 1627974360000, - "y": 0, - }, - Object { - "x": 1627974370000, - "y": null, - }, - Object { - "x": 1627974380000, - "y": null, - }, - Object { - "x": 1627974390000, - "y": 0.5, - }, - Object { - "x": 1627974400000, - "y": null, - }, - Object { - "x": 1627974410000, - "y": 0, - }, - Object { - "x": 1627974420000, - "y": null, - }, - Object { - "x": 1627974430000, - "y": 0, - }, - Object { - "x": 1627974440000, - "y": null, - }, - Object { - "x": 1627974450000, - "y": 0.142857142857143, - }, - Object { - "x": 1627974460000, - "y": 0, - }, - Object { - "x": 1627974470000, - "y": null, - }, - Object { - "x": 1627974480000, - "y": 0.5, - }, - Object { - "x": 1627974490000, - "y": 0, - }, - Object { - "x": 1627974500000, - "y": null, - }, - Object { - "x": 1627974510000, - "y": null, - }, - Object { - "x": 1627974520000, - "y": null, - }, - Object { - "x": 1627974530000, - "y": 0, - }, - Object { - "x": 1627974540000, - "y": null, - }, - Object { - "x": 1627974550000, - "y": 0, - }, - Object { - "x": 1627974560000, - "y": null, - }, - Object { - "x": 1627974570000, - "y": 0, - }, - Object { - "x": 1627974580000, - "y": null, - }, - Object { - "x": 1627974590000, - "y": 0, - }, - Object { - "x": 1627974600000, - "y": 0, - }, - Object { - "x": 1627974610000, - "y": 0, - }, - Object { - "x": 1627974620000, - "y": null, - }, - Object { - "x": 1627974630000, - "y": null, - }, - Object { - "x": 1627974640000, - "y": 0, - }, - Object { - "x": 1627974650000, - "y": 0.5, - }, - Object { - "x": 1627974660000, - "y": 0, - }, - Object { - "x": 1627974670000, - "y": 0.5, - }, - Object { - "x": 1627974680000, - "y": 0, - }, - Object { - "x": 1627974690000, - "y": 0, - }, - Object { - "x": 1627974700000, - "y": 0, - }, - Object { - "x": 1627974710000, - "y": 0, - }, - Object { - "x": 1627974720000, - "y": 0.25, - }, - Object { - "x": 1627974730000, - "y": null, - }, - Object { - "x": 1627974740000, - "y": 0, - }, - Object { - "x": 1627974750000, - "y": 0, - }, - Object { - "x": 1627974760000, - "y": 0, - }, - Object { - "x": 1627974770000, - "y": 0, - }, - Object { - "x": 1627974780000, - "y": 0, - }, - Object { - "x": 1627974790000, - "y": 0, - }, - Object { - "x": 1627974800000, - "y": 0, - }, - Object { - "x": 1627974810000, - "y": 0, - }, - Object { - "x": 1627974820000, - "y": 0, - }, - Object { - "x": 1627974830000, - "y": null, - }, - Object { - "x": 1627974840000, - "y": 0, - }, - Object { - "x": 1627974850000, - "y": 0, - }, - Object { - "x": 1627974860000, - "y": null, - }, - Object { - "x": 1627974870000, - "y": 0.5, - }, - Object { - "x": 1627974880000, - "y": null, - }, - Object { - "x": 1627974890000, - "y": 0, - }, - Object { - "x": 1627974900000, - "y": 0, - }, - Object { - "x": 1627974910000, - "y": 0, - }, - Object { - "x": 1627974920000, - "y": 0, - }, - Object { - "x": 1627974930000, - "y": 0, - }, - Object { - "x": 1627974940000, - "y": 0, - }, - Object { - "x": 1627974950000, - "y": 0, - }, - Object { - "x": 1627974960000, - "y": 0.333333333333333, - }, - Object { - "x": 1627974970000, - "y": 0, - }, - Object { - "x": 1627974980000, - "y": null, - }, - Object { - "x": 1627974990000, - "y": 0, - }, - Object { - "x": 1627975000000, - "y": 1, - }, - Object { - "x": 1627975010000, - "y": null, - }, - Object { - "x": 1627975020000, - "y": 0, - }, - Object { - "x": 1627975030000, - "y": 0, - }, - Object { - "x": 1627975040000, - "y": 0, - }, - Object { - "x": 1627975050000, - "y": 0, - }, - Object { - "x": 1627975060000, - "y": 0, - }, - Object { - "x": 1627975070000, - "y": null, - }, - Object { - "x": 1627975080000, - "y": 0, - }, - Object { - "x": 1627975090000, - "y": 0, - }, - Object { - "x": 1627975100000, - "y": 0, - }, - Object { - "x": 1627975110000, - "y": 0, - }, - Object { - "x": 1627975120000, - "y": 0, - }, - Object { - "x": 1627975130000, - "y": 0.333333333333333, - }, - Object { - "x": 1627975140000, - "y": 0.333333333333333, - }, - Object { - "x": 1627975150000, - "y": 0, - }, - Object { - "x": 1627975160000, - "y": null, - }, - Object { - "x": 1627975170000, - "y": null, - }, - Object { - "x": 1627975180000, - "y": 0, - }, - Object { - "x": 1627975190000, - "y": 0, + "x": 1627975140000, + "y": 0.153846153846154, }, Object { "x": 1627975200000, - "y": 0, - }, - Object { - "x": 1627975210000, "y": null, }, ] diff --git a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.snap b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.snap index 25b995acb87f14..ff9e52b57aeaa0 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.snap +++ b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.snap @@ -3,196 +3,64 @@ exports[`APM API tests basic apm_8.0.0 Latency with a basic license when data is loaded time comparison returns some data 1`] = ` Array [ Object { - "x": 1627974350000, - "y": 32153, + "x": 1627974300000, + "y": 22799, }, Object { - "x": 1627974390000, - "y": 15341.3333333333, - }, - Object { - "x": 1627974410000, - "y": 15170.5, + "x": 1627974360000, + "y": 3227391, }, Object { "x": 1627974420000, - "y": 17329, - }, - Object { - "x": 1627974460000, - "y": 50039, + "y": 15565.2222222222, }, Object { "x": 1627974480000, - "y": 55816.6, - }, - Object { - "x": 1627974490000, - "y": 17533, - }, - Object { - "x": 1627974510000, - "y": 14888, + "y": 54307.5714285714, }, Object { "x": 1627974540000, - "y": 12191.5, - }, - Object { - "x": 1627974550000, - "y": 20445.5, - }, - Object { - "x": 1627974590000, - "y": 9859, + "y": 16655, }, Object { "x": 1627974600000, - "y": 11796, - }, - Object { - "x": 1627974610000, - "y": 8774.4, - }, - Object { - "x": 1627974620000, - "y": 42225.6666666667, - }, - Object { - "x": 1627974630000, - "y": 16168, - }, - Object { - "x": 1627974640000, - "y": 7851.33333333333, + "y": 9453, }, Object { "x": 1627974660000, - "y": 45852, - }, - Object { - "x": 1627974700000, - "y": 21823, - }, - Object { - "x": 1627974710000, - "y": 4156, - }, - Object { - "x": 1627974730000, - "y": 14191.5, - }, - Object { - "x": 1627974740000, - "y": 3997, - }, - Object { - "x": 1627974750000, - "y": 21823.75, - }, - Object { - "x": 1627974760000, - "y": 58178.5, + "y": 31119, }, Object { - "x": 1627974770000, - "y": 24291.5, + "x": 1627974720000, + "y": 15282.2, }, Object { "x": 1627974780000, - "y": 7527.75, + "y": 18709, }, Object { "x": 1627974840000, - "y": 12028, - }, - Object { - "x": 1627974860000, - "y": 6773.8, + "y": 12095, }, Object { - "x": 1627974870000, - "y": 37030, - }, - Object { - "x": 1627974890000, - "y": 29564, - }, - Object { - "x": 1627974910000, - "y": 15606, - }, - Object { - "x": 1627974930000, - "y": 11747, - }, - Object { - "x": 1627974940000, - "y": 9425, - }, - Object { - "x": 1627974950000, - "y": 20220, - }, - Object { - "x": 1627975000000, - "y": 12995.5, - }, - Object { - "x": 1627975030000, - "y": 13606, - }, - Object { - "x": 1627975050000, - "y": 22030, + "x": 1627974900000, + "y": 16291, }, Object { - "x": 1627975060000, - "y": 10819, + "x": 1627974960000, + "y": 13444.3333333333, }, Object { - "x": 1627975070000, - "y": 26343, + "x": 1627975020000, + "y": 13241.6666666667, }, Object { "x": 1627975080000, - "y": 33080.5, + "y": 25535, }, Object { - "x": 1627975090000, - "y": 11899, - }, - Object { - "x": 1627975100000, - "y": 5253, - }, - Object { - "x": 1627975110000, - "y": 16502, - }, - Object { - "x": 1627975120000, - "y": 6945.5, - }, - Object { - "x": 1627975130000, - "y": 7244, - }, - Object { - "x": 1627975150000, - "y": 22631.5, - }, - Object { - "x": 1627975180000, - "y": 23489, - }, - Object { - "x": 1627975190000, - "y": 10133.3333333333, - }, - Object { - "x": 1627975210000, - "y": 52108, + "x": 1627975140000, + "y": 11024.6, }, ] `; @@ -200,200 +68,64 @@ Array [ exports[`APM API tests basic apm_8.0.0 Latency with a basic license when data is loaded time comparison returns some data 2`] = ` Array [ Object { - "x": 1627974310000, - "y": 107053.5, - }, - Object { - "x": 1627974370000, - "y": 9857, - }, - Object { - "x": 1627974380000, - "y": 266341, - }, - Object { - "x": 1627974390000, - "y": 11715.75, - }, - Object { - "x": 1627974410000, - "y": 7805.25, - }, - Object { - "x": 1627974430000, - "y": 15880, + "x": 1627974300000, + "y": 34866.2, }, Object { - "x": 1627974460000, - "y": 21836, + "x": 1627974360000, + "y": 104799, }, Object { - "x": 1627974470000, - "y": 23962, + "x": 1627974420000, + "y": 36247, }, Object { "x": 1627974480000, - "y": 21352.5, - }, - Object { - "x": 1627974490000, - "y": 21639, - }, - Object { - "x": 1627974530000, - "y": 13970, - }, - Object { - "x": 1627974550000, - "y": 58140, - }, - Object { - "x": 1627974570000, - "y": 9853.75, + "y": 22207, }, Object { - "x": 1627974580000, - "y": 6490, - }, - Object { - "x": 1627974590000, - "y": 18894, - }, - Object { - "x": 1627974610000, - "y": 14125, + "x": 1627974540000, + "y": 80191, }, Object { - "x": 1627974640000, - "y": 86268.25, + "x": 1627974600000, + "y": 11520.4545454545, }, Object { "x": 1627974660000, - "y": 14218, - }, - Object { - "x": 1627974670000, - "y": 19127, - }, - Object { - "x": 1627974680000, - "y": 31538, + "y": 47031.8888888889, }, Object { "x": 1627974720000, - "y": 29535, - }, - Object { - "x": 1627974740000, - "y": 11229, - }, - Object { - "x": 1627974750000, - "y": 23940, + "y": 30249.6666666667, }, Object { - "x": 1627974760000, - "y": 9262, - }, - Object { - "x": 1627974790000, - "y": 15650, + "x": 1627974780000, + "y": 14868.3333333333, }, Object { "x": 1627974840000, - "y": 17656.3333333333, - }, - Object { - "x": 1627974880000, - "y": 8371.5, - }, - Object { - "x": 1627974890000, - "y": 11386.5, + "y": 17199, }, Object { "x": 1627974900000, - "y": 28923.75, - }, - Object { - "x": 1627974910000, - "y": 22670, - }, - Object { - "x": 1627974920000, - "y": 13607.6666666667, - }, - Object { - "x": 1627974930000, - "y": 19640, - }, - Object { - "x": 1627974940000, - "y": 20511, + "y": 19837.2222222222, }, Object { "x": 1627974960000, - "y": 34862, - }, - Object { - "x": 1627974990000, - "y": 27929.2, + "y": 19397.6666666667, }, Object { "x": 1627975020000, - "y": 25569, - }, - Object { - "x": 1627975030000, - "y": 6817.33333333333, - }, - Object { - "x": 1627975040000, - "y": 10467.6666666667, - }, - Object { - "x": 1627975060000, - "y": 6754.33333333333, - }, - Object { - "x": 1627975070000, - "y": 22049, + "y": 22473.6666666667, }, Object { "x": 1627975080000, - "y": 15029, - }, - Object { - "x": 1627975090000, - "y": 14744, - }, - Object { - "x": 1627975110000, - "y": 32192.3333333333, - }, - Object { - "x": 1627975130000, - "y": 8321, - }, - Object { - "x": 1627975160000, - "y": 11648, - }, - Object { - "x": 1627975170000, - "y": 13157, - }, - Object { - "x": 1627975190000, - "y": 12855, - }, - Object { - "x": 1627975200000, - "y": 1322026.8, + "y": 11362.2, }, Object { - "x": 1627975210000, - "y": 4650.33333333333, + "x": 1627975140000, + "y": 26319, }, ] `; diff --git a/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts b/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts index 0507bc8f28b475..aeb7cc61a582a2 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts @@ -112,12 +112,12 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); it('has the correct number of buckets', () => { - expectSnapshot(errorRateResponse.currentPeriod.timeseries.length).toMatchInline(`61`); + expectSnapshot(errorRateResponse.currentPeriod.timeseries.length).toMatchInline(`31`); }); it('has the correct calculation for average', () => { expectSnapshot(errorRateResponse.currentPeriod.average).toMatchInline( - `0.092511013215859` + `0.0848214285714286` ); }); @@ -168,32 +168,32 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('has the correct start date', () => { expectSnapshot( new Date(first(errorRateResponse.currentPeriod.timeseries)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-08-03T07:05:10.000Z"`); + ).toMatchInline(`"2021-08-03T07:05:00.000Z"`); expectSnapshot( new Date(first(errorRateResponse.previousPeriod.timeseries)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-08-03T07:05:10.000Z"`); + ).toMatchInline(`"2021-08-03T07:05:00.000Z"`); }); it('has the correct end date', () => { expectSnapshot( new Date(last(errorRateResponse.currentPeriod.timeseries)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-08-03T07:20:10.000Z"`); + ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); expectSnapshot( new Date(last(errorRateResponse.previousPeriod.timeseries)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-08-03T07:20:10.000Z"`); + ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); }); it('has the correct number of buckets', () => { - expectSnapshot(errorRateResponse.currentPeriod.timeseries.length).toMatchInline(`91`); - expectSnapshot(errorRateResponse.previousPeriod.timeseries.length).toMatchInline(`91`); + expectSnapshot(errorRateResponse.currentPeriod.timeseries.length).toMatchInline(`16`); + expectSnapshot(errorRateResponse.previousPeriod.timeseries.length).toMatchInline(`16`); }); it('has the correct calculation for average', () => { expectSnapshot(errorRateResponse.currentPeriod.average).toMatchInline( - `0.102040816326531` + `0.0792079207920792` ); expectSnapshot(errorRateResponse.previousPeriod.average).toMatchInline( - `0.0852713178294574` + `0.0894308943089431` ); }); diff --git a/x-pack/test/apm_api_integration/tests/transactions/latency.ts b/x-pack/test/apm_api_integration/tests/transactions/latency.ts index d021e59ecff6ca..beaff7647868a5 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/latency.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/latency.ts @@ -113,7 +113,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(response.status).to.be(200); const latencyChartReturn = response.body as LatencyChartReturnType; expect(latencyChartReturn.currentPeriod.overallAvgDuration).not.to.be(null); - expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(61); + expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(31); }); }); @@ -138,7 +138,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(response.status).to.be(200); const latencyChartReturn = response.body as LatencyChartReturnType; expect(latencyChartReturn.currentPeriod.overallAvgDuration).not.to.be(null); - expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(61); + expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(31); }); }); @@ -165,10 +165,10 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(latencyChartReturn.currentPeriod.overallAvgDuration).not.to.be(null); expectSnapshot(latencyChartReturn.currentPeriod.overallAvgDuration).toMatchInline( - `53147.5747663551` + `53906.6603773585` ); - expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(61); + expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(31); }); }); diff --git a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts index f95d153b1c96ee..7664d28271e14b 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts @@ -98,18 +98,18 @@ export default function ApiTest({ getService }: FtrProviderContext) { ); expectSnapshot(impacts).toMatchInline(` Array [ - 98.5616469236242, - 0.088146942911198, - 0.208815627929649, - 0.189536811278812, - 0.110293217369968, - 0.191163512620049, - 0.0899742946381385, - 0.341831477754056, - 0.0411384477014597, - 0.0652338973356331, - 0.109023796562458, - 0.00319505027438735, + 98.4867713293593, + 0.0910992862692518, + 0.217172932411727, + 0.197499651612207, + 0.117088451625813, + 0.203168003440319, + 0.0956764857936742, + 0.353287132108131, + 0.043688393280619, + 0.0754467823979389, + 0.115710953190738, + 0.00339059851027124, ] `); @@ -120,9 +120,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(pick(firstItem, 'name', 'latency', 'throughput', 'errorRate', 'impact')) .toMatchInline(` Object { - "errorRate": 0.1, - "impact": 98.5616469236242, - "latency": 1925546.54, + "errorRate": 0.08, + "impact": 98.4867713293593, + "latency": 1816019.48, "name": "DispatcherServlet#doGet", "throughput": 1.66666666666667, } @@ -150,7 +150,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { response.body as TransactionsGroupsPrimaryStatistics; const firstItem = transctionsGroupsPrimaryStatistics.transactionGroups[0]; - expectSnapshot(firstItem.latency).toMatchInline(`66836803`); + expectSnapshot(firstItem.latency).toMatchInline(`66846719`); }); } ); diff --git a/x-pack/test/detection_engine_api_integration/basic/tests/export_rules.ts b/x-pack/test/detection_engine_api_integration/basic/tests/export_rules.ts index 03b1beffa79931..12a4007496e277 100644 --- a/x-pack/test/detection_engine_api_integration/basic/tests/export_rules.ts +++ b/x-pack/test/detection_engine_api_integration/basic/tests/export_rules.ts @@ -78,6 +78,7 @@ export default ({ getService }: FtrProviderContext): void => { expect(bodySplitAndParsed).to.eql({ exported_exception_list_count: 0, exported_exception_list_item_count: 0, + exported_count: 1, exported_rules_count: 1, missing_exception_list_item_count: 0, missing_exception_list_items: [], diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_ml.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_ml.ts index 6cfc21306d0a6b..9e0aff09c84c8e 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_ml.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_ml.ts @@ -37,7 +37,7 @@ import { ALERT_ANCESTORS, ALERT_DEPTH, ALERT_ORIGINAL_TIME, -} from '../../../../plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/field_names'; +} from '../../../../plugins/security_solution/common/field_maps/field_names'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_threat_matching.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_threat_matching.ts index dcfdfb7bbd9bcf..250f6cf1d0b83d 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_threat_matching.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_threat_matching.ts @@ -41,6 +41,7 @@ import { import { getCreateThreatMatchRulesSchemaMock } from '../../../../plugins/security_solution/common/detection_engine/schemas/request/rule_schemas.mock'; import { getThreatMatchingSchemaPartialMock } from '../../../../plugins/security_solution/common/detection_engine/schemas/response/rules_schema.mocks'; import { ENRICHMENT_TYPES } from '../../../../plugins/security_solution/common/cti/constants'; +import { Ancestor } from '../../../../plugins/security_solution/server/lib/detection_engine/signals/types'; import { ALERT_ANCESTORS, ALERT_DEPTH, @@ -48,8 +49,7 @@ import { ALERT_ORIGINAL_EVENT_CATEGORY, ALERT_ORIGINAL_EVENT_MODULE, ALERT_ORIGINAL_TIME, -} from '../../../../plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/field_names'; -import { Ancestor } from '../../../../plugins/security_solution/server/lib/detection_engine/signals/types'; +} from '../../../../plugins/security_solution/common/field_maps/field_names'; const format = (value: unknown): string => JSON.stringify(value, null, 2); diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/export_rules.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/export_rules.ts index 0f4c42fd7ab390..bc44ed5ae2dd2b 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/export_rules.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/export_rules.ts @@ -79,6 +79,7 @@ export default ({ getService }: FtrProviderContext): void => { expect(bodySplitAndParsed).to.eql({ exported_exception_list_count: 0, exported_exception_list_item_count: 0, + exported_count: 1, exported_rules_count: 1, missing_exception_list_item_count: 0, missing_exception_list_items: [], diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/generating_signals.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/generating_signals.ts index 2977037a9523fd..876a1a9d6dca1f 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/generating_signals.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/generating_signals.ts @@ -46,15 +46,15 @@ import { waitForRuleSuccessOrStatus, waitForSignalsToBePresent, } from '../../utils'; +import { Ancestor } from '../../../../plugins/security_solution/server/lib/detection_engine/signals/types'; import { ALERT_ANCESTORS, ALERT_DEPTH, - ALERT_GROUP_ID, + ALERT_ORIGINAL_TIME, ALERT_ORIGINAL_EVENT, ALERT_ORIGINAL_EVENT_CATEGORY, - ALERT_ORIGINAL_TIME, -} from '../../../../plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/field_names'; -import { Ancestor } from '../../../../plugins/security_solution/server/lib/detection_engine/signals/types'; + ALERT_GROUP_ID, +} from '../../../../plugins/security_solution/common/field_maps/field_names'; /** * Specific _id to use for some of the tests. If the archiver changes and you see errors diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/perform_bulk_action.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/perform_bulk_action.ts index 83166619b152dc..b40705f4e0242c 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/perform_bulk_action.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/perform_bulk_action.ts @@ -59,6 +59,7 @@ export default ({ getService }: FtrProviderContext): void => { expect(exportDetails).to.eql({ exported_exception_list_count: 0, exported_exception_list_item_count: 0, + exported_count: 1, exported_rules_count: 1, missing_exception_list_item_count: 0, missing_exception_list_items: [], diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/timestamps.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/timestamps.ts index f4b91cae364488..01543fc59e47fd 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/timestamps.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/timestamps.ts @@ -11,7 +11,7 @@ import { EqlCreateSchema, QueryCreateSchema, } from '../../../../plugins/security_solution/common/detection_engine/schemas/request'; -import { ALERT_ORIGINAL_TIME } from '../../../../plugins/security_solution/server/lib/detection_engine/rule_types/field_maps/field_names'; +import { ALERT_ORIGINAL_TIME } from '../../../../plugins/security_solution/common/field_maps/field_names'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import { diff --git a/x-pack/test/examples/embedded_lens/index.ts b/x-pack/test/examples/embedded_lens/index.ts index 3bd4ea31cc89bb..98ea7f80754a2d 100644 --- a/x-pack/test/examples/embedded_lens/index.ts +++ b/x-pack/test/examples/embedded_lens/index.ts @@ -15,14 +15,19 @@ export default function ({ getService, loadTestFile }: PluginFunctionalProviderC describe('embedded Lens examples', function () { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.load('x-pack/test/functional/es_archives/lens/basic'); // need at least one index pattern + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); // need at least one index pattern await kibanaServer.uiSettings.update({ defaultIndex: 'logstash-*', }); }); after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/lens/basic'); + await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); describe('', function () { diff --git a/x-pack/test/examples/search_examples/index.ts b/x-pack/test/examples/search_examples/index.ts index 41c4945ca45696..ac9e385d3d391d 100644 --- a/x-pack/test/examples/search_examples/index.ts +++ b/x-pack/test/examples/search_examples/index.ts @@ -10,17 +10,23 @@ import { PluginFunctionalProviderContext } from 'test/plugin_functional/services // eslint-disable-next-line import/no-default-export export default function ({ getService, loadTestFile }: PluginFunctionalProviderContext) { const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); describe('search examples', function () { this.tags('ciGroup13'); before(async () => { await esArchiver.emptyKibanaIndex(); await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); // need at least one index pattern + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); // need at least one index pattern }); after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/lens/basic'); + await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); loadTestFile(require.resolve('./search_session_example')); diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/create.ts b/x-pack/test/fleet_api_integration/apis/package_policy/create.ts index 6a0d46a6053866..6817289d389f35 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/create.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/create.ts @@ -68,7 +68,7 @@ export default function (providerContext: FtrProviderContext) { .post(`/api/fleet/package_policies`) .set('kbn-xsrf', 'xxxx') .send({ - name: 'filetest-1', + name: 'filetest', description: '', namespace: 'default', policy_id: hostedPolicy.id, @@ -85,7 +85,7 @@ export default function (providerContext: FtrProviderContext) { expect(responseWithoutForce.statusCode).to.be(400); expect(responseWithoutForce.message).to.contain( - 'Cannot add integrations to hosted agent policy' + 'Cannot update integrations of hosted agent policy' ); // try same request with `force: true` @@ -122,7 +122,7 @@ export default function (providerContext: FtrProviderContext) { .post(`/api/fleet/package_policies`) .set('kbn-xsrf', 'xxxx') .send({ - name: 'filetest-1', + name: 'filetest-2', description: '', namespace: 'default', policy_id: agentPolicyId, @@ -276,5 +276,53 @@ export default function (providerContext: FtrProviderContext) { }) .expect(400); }); + + it('should return a 400 if there is a package policy with the same name on a different policy', async function () { + const { body: agentPolicyResponse } = await supertest + .post(`/api/fleet/agent_policies`) + .set('kbn-xsrf', 'xxxx') + .send({ + name: 'Test policy 2', + namespace: 'default', + }); + const otherAgentPolicyId = agentPolicyResponse.item.id; + + await supertest + .post(`/api/fleet/package_policies`) + .set('kbn-xsrf', 'xxxx') + .send({ + name: 'same-name-test-2', + description: '', + namespace: 'default', + policy_id: otherAgentPolicyId, + enabled: true, + output_id: '', + inputs: [], + package: { + name: 'filetest', + title: 'For File Tests', + version: '0.1.0', + }, + }) + .expect(200); + await supertest + .post(`/api/fleet/package_policies`) + .set('kbn-xsrf', 'xxxx') + .send({ + name: 'same-name-test-2', + description: '', + namespace: 'default', + policy_id: agentPolicyId, + enabled: true, + output_id: '', + inputs: [], + package: { + name: 'filetest', + title: 'For File Tests', + version: '0.1.0', + }, + }) + .expect(400); + }); }); } diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/update.ts b/x-pack/test/fleet_api_integration/apis/package_policy/update.ts index 315ca276c393ff..7d62ea3bf7ec34 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/update.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/update.ts @@ -158,7 +158,7 @@ export default function (providerContext: FtrProviderContext) { }); }); - it('should return a 500 if there is another package policy with the same name', async function () { + it('should return a 400 if there is another package policy with the same name', async function () { await supertest .put(`/api/fleet/package_policies/${packagePolicyId2}`) .set('kbn-xsrf', 'xxxx') @@ -176,7 +176,37 @@ export default function (providerContext: FtrProviderContext) { version: '0.1.0', }, }) - .expect(500); + .expect(400); + }); + + it('should return a 400 if there is another package policy with the same name on a different policy', async function () { + const { body: agentPolicyResponse } = await supertest + .post(`/api/fleet/agent_policies`) + .set('kbn-xsrf', 'xxxx') + .send({ + name: 'Test policy 2', + namespace: 'default', + }); + const otherAgentPolicyId = agentPolicyResponse.item.id; + + await supertest + .put(`/api/fleet/package_policies/${packagePolicyId2}`) + .set('kbn-xsrf', 'xxxx') + .send({ + name: 'filetest-1', + description: '', + namespace: 'updated_namespace', + policy_id: otherAgentPolicyId, + enabled: true, + output_id: '', + inputs: [], + package: { + name: 'filetest', + title: 'For File Tests', + version: '0.1.0', + }, + }) + .expect(400); }); it('should work with frozen input vars', async function () { diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts index 7efa86c3acf282..20c79d9142f096 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts @@ -9,7 +9,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getPageObjects, getService }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const security = getService('security'); const PageObjects = getPageObjects(['common', 'settings', 'security', 'spaceSelector']); @@ -18,14 +17,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const globalNav = getService('globalNav'); describe('security feature controls', () => { - before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana'); - }); - - after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana'); - }); - describe('global advanced_settings all privileges', () => { before(async () => { await security.role.create('global_advanced_settings_all_role', { diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts index 41a03b36d3c43b..0d1c525f569044 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts @@ -25,7 +25,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { before(async () => { // we need to load the following in every situation as deleting // a space deletes all of the associated saved objects - await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana'); await spacesService.create({ id: 'custom_space', @@ -36,7 +35,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { after(async () => { await spacesService.delete('custom_space'); - await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana'); }); it('shows Management navlink', async () => { diff --git a/x-pack/test/functional/apps/api_keys/feature_controls/api_keys_security.ts b/x-pack/test/functional/apps/api_keys/feature_controls/api_keys_security.ts index 9e25ca1d79f9bf..9b418e5fd2b94a 100644 --- a/x-pack/test/functional/apps/api_keys/feature_controls/api_keys_security.ts +++ b/x-pack/test/functional/apps/api_keys/feature_controls/api_keys_security.ts @@ -9,7 +9,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getPageObjects, getService }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); const security = getService('security'); const PageObjects = getPageObjects(['common', 'settings', 'security']); const appsMenu = getService('appsMenu'); @@ -17,14 +16,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('security', () => { before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana'); await PageObjects.common.navigateToApp('home'); }); - after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana'); - }); - describe('global all privileges (aka kibana_admin)', () => { before(async () => { await security.testUser.setRoles(['kibana_admin'], true); diff --git a/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts b/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts index 6f6d29db1ef0ca..05e13bb04d91b5 100644 --- a/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts +++ b/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts @@ -9,7 +9,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getPageObjects, getService }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); const security = getService('security'); const PageObjects = getPageObjects(['common', 'error', 'security']); const testSubjects = getService('testSubjects'); @@ -18,7 +17,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('security', () => { before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana'); // ensure we're logged out so we can login as the appropriate users await PageObjects.security.forceLogout(); }); diff --git a/x-pack/test/functional/apps/dashboard/dashboard_lens_by_value.ts b/x-pack/test/functional/apps/dashboard/dashboard_lens_by_value.ts index b1d7c1194e7bc5..26efa4248850bf 100644 --- a/x-pack/test/functional/apps/dashboard/dashboard_lens_by_value.ts +++ b/x-pack/test/functional/apps/dashboard/dashboard_lens_by_value.ts @@ -15,16 +15,26 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const testSubjects = getService('testSubjects'); const dashboardPanelActions = getService('dashboardPanelActions'); + const kibanaServer = getService('kibanaServer'); describe('dashboard lens by value', function () { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.clickNewDashboard(); }); + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); + }); + it('can add a lens panel by value', async () => { await PageObjects.lens.createAndAddLensFromDashboard({}); const newPanelCount = await PageObjects.dashboard.getPanelCount(); diff --git a/x-pack/test/functional/apps/dashboard/dashboard_maps_by_value.ts b/x-pack/test/functional/apps/dashboard/dashboard_maps_by_value.ts index 043acf90bb8932..f8a90767b54ac9 100644 --- a/x-pack/test/functional/apps/dashboard/dashboard_maps_by_value.ts +++ b/x-pack/test/functional/apps/dashboard/dashboard_maps_by_value.ts @@ -23,6 +23,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); const dashboardAddPanel = getService('dashboardAddPanel'); + const kibanaServer = getService('kibanaServer'); const LAYER_NAME = 'World Countries'; let mapCounter = 0; @@ -77,7 +78,19 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('dashboard maps by value', function () { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); + }); + + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); + await kibanaServer.savedObjects.clean({ + types: ['search', 'index-pattern', 'visualization', 'dashboard', 'tag', 'map'], + }); }); describe('adding a map by value', () => { diff --git a/x-pack/test/functional/apps/dashboard/dashboard_tagging.ts b/x-pack/test/functional/apps/dashboard/dashboard_tagging.ts index 707b3877a70b51..7a358e24a2b412 100644 --- a/x-pack/test/functional/apps/dashboard/dashboard_tagging.ts +++ b/x-pack/test/functional/apps/dashboard/dashboard_tagging.ts @@ -11,6 +11,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const listingTable = getService('listingTable'); const testSubjects = getService('testSubjects'); + const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); const find = getService('find'); const PageObjects = getPageObjects([ @@ -67,12 +68,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.clickNewDashboard(); }); + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); + await kibanaServer.savedObjects.clean({ + types: ['search', 'index-pattern', 'visualization', 'dashboard', 'tag'], + }); + }); + it('adds a new tag to a new Dashboard', async () => { await createTagFromDashboard(); PageObjects.dashboard.saveDashboard(dashboardTitle, {}, false); diff --git a/x-pack/test/functional/apps/dashboard/drilldowns/dashboard_to_dashboard_drilldown.ts b/x-pack/test/functional/apps/dashboard/drilldowns/dashboard_to_dashboard_drilldown.ts index 3e83d385936019..f42be7b4229f96 100644 --- a/x-pack/test/functional/apps/dashboard/drilldowns/dashboard_to_dashboard_drilldown.ts +++ b/x-pack/test/functional/apps/dashboard/drilldowns/dashboard_to_dashboard_drilldown.ts @@ -156,7 +156,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - describe('Copy to space', () => { + // FLAKY: https://github.com/elastic/kibana/issues/83824 + describe.skip('Copy to space', () => { const destinationSpaceId = 'custom_space'; before(async () => { await spaces.create({ diff --git a/x-pack/test/functional/apps/dashboard/sync_colors.ts b/x-pack/test/functional/apps/dashboard/sync_colors.ts index 2fcc1cf5614fbf..a3628635dfa2ff 100644 --- a/x-pack/test/functional/apps/dashboard/sync_colors.ts +++ b/x-pack/test/functional/apps/dashboard/sync_colors.ts @@ -22,6 +22,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const dashboardAddPanel = getService('dashboardAddPanel'); const filterBar = getService('filterBar'); const elasticChart = getService('elasticChart'); + const kibanaServer = getService('kibanaServer'); function getColorMapping(debugState: DebugState | null) { if (!debugState) return {}; @@ -37,12 +38,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe.skip('sync colors', function () { before(async function () { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); after(async function () { await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.unload('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); it('should sync colors on dashboard by default', async function () { diff --git a/x-pack/test/functional/apps/discover/visualize_field.ts b/x-pack/test/functional/apps/discover/visualize_field.ts index 650d67f05129c3..584558c90c2b28 100644 --- a/x-pack/test/functional/apps/discover/visualize_field.ts +++ b/x-pack/test/functional/apps/discover/visualize_field.ts @@ -14,6 +14,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const queryBar = getService('queryBar'); const testSubjects = getService('testSubjects'); const retry = getService('retry'); + const kibanaServer = getService('kibanaServer'); const PageObjects = getPageObjects([ 'common', 'error', @@ -31,13 +32,18 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('discover field visualize button', () => { beforeEach(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); await PageObjects.common.navigateToApp('discover'); await setDiscoverTimeRange(); }); after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/lens/basic'); + await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); it('shows "visualize" field button', async () => { diff --git a/x-pack/test/functional/apps/lens/index.ts b/x-pack/test/functional/apps/lens/index.ts index 86ceb4812ad3b0..f9e4835f044afc 100644 --- a/x-pack/test/functional/apps/lens/index.ts +++ b/x-pack/test/functional/apps/lens/index.ts @@ -7,18 +7,24 @@ import { FtrProviderContext } from '../../ftr_provider_context'; -export default function ({ getService, loadTestFile }: FtrProviderContext) { +export default function ({ getService, loadTestFile, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const log = getService('log'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); + const PageObjects = getPageObjects(['timePicker']); describe('lens app', () => { before(async () => { log.debug('Starting lens before method'); await browser.setWindowSize(1280, 800); await esArchiver.load('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.load('x-pack/test/functional/es_archives/lens/basic'); + // changing the timepicker default here saves us from having to set it in Discover (~8s) + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); + await kibanaServer.uiSettings.update({ defaultIndex: 'logstash-*', 'dateFormat:tz': 'UTC' }); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); await kibanaServer.importExport.load( 'x-pack/test/functional/fixtures/kbn_archiver/lens/default' ); @@ -26,7 +32,10 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { after(async () => { await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.unload('x-pack/test/functional/es_archives/lens/basic'); + await PageObjects.timePicker.resetDefaultAbsoluteRangeViaUiSettings(); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); await kibanaServer.importExport.unload( 'x-pack/test/functional/fixtures/kbn_archiver/lens/default' ); @@ -50,14 +59,13 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./time_shift')); loadTestFile(require.resolve('./drag_and_drop')); loadTestFile(require.resolve('./geo_field')); - loadTestFile(require.resolve('./lens_reporting')); - loadTestFile(require.resolve('./lens_tagging')); loadTestFile(require.resolve('./formula')); loadTestFile(require.resolve('./heatmap')); loadTestFile(require.resolve('./reference_lines')); loadTestFile(require.resolve('./inspector')); loadTestFile(require.resolve('./error_handling')); - + loadTestFile(require.resolve('./lens_tagging')); + loadTestFile(require.resolve('./lens_reporting')); // has to be last one in the suite because it overrides saved objects loadTestFile(require.resolve('./rollup')); }); diff --git a/x-pack/test/functional/apps/lens/lens_reporting.ts b/x-pack/test/functional/apps/lens/lens_reporting.ts index bd0c003ff3f45c..2d0ff14ef95f25 100644 --- a/x-pack/test/functional/apps/lens/lens_reporting.ts +++ b/x-pack/test/functional/apps/lens/lens_reporting.ts @@ -9,7 +9,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['common', 'dashboard', 'reporting']); + const PageObjects = getPageObjects(['common', 'dashboard', 'reporting', 'timePicker']); const es = getService('es'); const esArchiver = getService('esArchiver'); const listingTable = getService('listingTable'); @@ -18,6 +18,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('lens reporting', () => { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/reporting'); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await security.testUser.setRoles( [ 'test_logstash_reader', @@ -30,6 +31,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { after(async () => { await esArchiver.unload('x-pack/test/functional/es_archives/lens/reporting'); + await PageObjects.timePicker.resetDefaultAbsoluteRangeViaUiSettings(); await es.deleteByQuery({ index: '.reporting-*', refresh: true, diff --git a/x-pack/test/functional/apps/lens/lens_tagging.ts b/x-pack/test/functional/apps/lens/lens_tagging.ts index cbe04b26830d63..3852fdb0456acf 100644 --- a/x-pack/test/functional/apps/lens/lens_tagging.ts +++ b/x-pack/test/functional/apps/lens/lens_tagging.ts @@ -11,8 +11,8 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const listingTable = getService('listingTable'); const testSubjects = getService('testSubjects'); - const esArchiver = getService('esArchiver'); const retry = getService('retry'); + const esArchiver = getService('esArchiver'); const find = getService('find'); const dashboardAddPanel = getService('dashboardAddPanel'); const dashboardPanelActions = getService('dashboardPanelActions'); @@ -23,6 +23,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'dashboard', 'visualize', 'lens', + 'timePicker', ]); const lensTag = 'extreme-lens-tag'; @@ -31,12 +32,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('lens tagging', () => { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.clickNewDashboard(); }); + after(async () => { + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); + }); + it('adds a new tag to a Lens visualization', async () => { // create lens await dashboardAddPanel.clickCreateNewLink(); diff --git a/x-pack/test/functional/apps/lens/rollup.ts b/x-pack/test/functional/apps/lens/rollup.ts index 267c83cda1386d..488e7f848f2ed5 100644 --- a/x-pack/test/functional/apps/lens/rollup.ts +++ b/x-pack/test/functional/apps/lens/rollup.ts @@ -9,7 +9,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['visualize', 'lens', 'header']); + const PageObjects = getPageObjects(['visualize', 'lens', 'header', 'timePicker']); const find = getService('find'); const listingTable = getService('listingTable'); const esArchiver = getService('esArchiver'); @@ -19,11 +19,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/rollup/data'); await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/rollup/config'); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); }); after(async () => { await esArchiver.unload('x-pack/test/functional/es_archives/lens/rollup/data'); await esArchiver.unload('x-pack/test/functional/es_archives/lens/rollup/config'); + await PageObjects.timePicker.resetDefaultAbsoluteRangeViaUiSettings(); }); it('should allow creation of lens xy chart', async () => { diff --git a/x-pack/test/functional/apps/lens/table.ts b/x-pack/test/functional/apps/lens/table.ts index 892534eec7033b..94bc5e8b266ea5 100644 --- a/x-pack/test/functional/apps/lens/table.ts +++ b/x-pack/test/functional/apps/lens/table.ts @@ -60,12 +60,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(await PageObjects.lens.getDatatableHeaderText(1)).to.equal('@timestamp per 3 hours'); expect(await PageObjects.lens.getDatatableHeaderText(2)).to.equal('Average of bytes'); - await PageObjects.lens.toggleColumnVisibility('lnsDatatable_rows > lns-dimensionTrigger'); + await PageObjects.lens.toggleColumnVisibility('lnsDatatable_rows > lns-dimensionTrigger', 1); expect(await PageObjects.lens.getDatatableHeaderText(0)).to.equal('@timestamp per 3 hours'); expect(await PageObjects.lens.getDatatableHeaderText(1)).to.equal('Average of bytes'); - await PageObjects.lens.toggleColumnVisibility('lnsDatatable_rows > lns-dimensionTrigger'); + await PageObjects.lens.toggleColumnVisibility('lnsDatatable_rows > lns-dimensionTrigger', 4); expect(await PageObjects.lens.getDatatableHeaderText(0)).to.equal('Top values of ip'); expect(await PageObjects.lens.getDatatableHeaderText(1)).to.equal('@timestamp per 3 hours'); diff --git a/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts b/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts index 1c47893dbafd08..66a32a888b77a3 100644 --- a/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts +++ b/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts @@ -6,42 +6,16 @@ */ import { FtrProviderContext } from '../../../ftr_provider_context'; -import { Job, Datafeed } from '../../../../../plugins/ml/common/types/anomaly_detection_jobs'; - -// @ts-expect-error not full interface -const JOB_CONFIG: Job = { - job_id: `fq_multi_1_ae`, - description: - 'mean/min/max(responsetime) partition=airline on farequote dataset with 1h bucket span', - groups: ['farequote', 'automated', 'multi-metric'], - analysis_config: { - bucket_span: '1h', - influencers: ['airline'], - detectors: [ - { function: 'mean', field_name: 'responsetime', partition_field_name: 'airline' }, - { function: 'min', field_name: 'responsetime', partition_field_name: 'airline' }, - { function: 'max', field_name: 'responsetime', partition_field_name: 'airline' }, - ], - }, - data_description: { time_field: '@timestamp' }, - analysis_limits: { model_memory_limit: '20mb' }, - model_plot_config: { enabled: true }, -}; - -// @ts-expect-error not full interface -const DATAFEED_CONFIG: Datafeed = { - datafeed_id: 'datafeed-fq_multi_1_ae', - indices: ['ft_farequote'], - job_id: 'fq_multi_1_ae', - query: { bool: { must: [{ match_all: {} }] } }, -}; +import { JOB_CONFIG, DATAFEED_CONFIG, ML_EMBEDDABLE_TYPES } from './constants'; const testDataList = [ { + type: 'testData', suiteSuffix: 'with multi metric job', panelTitle: `ML anomaly charts for ${JOB_CONFIG.job_id}`, jobConfig: JOB_CONFIG, datafeedConfig: DATAFEED_CONFIG, + dashboardTitle: `ML anomaly charts for fq_multi_1_ae ${Date.now()}`, expected: { influencers: [ { @@ -59,7 +33,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const ml = getService('ml'); const PageObjects = getPageObjects(['common', 'timePicker', 'dashboard']); - describe('anomaly charts', function () { + describe('anomaly charts in dashboard', function () { this.tags(['mlqa']); before(async () => { @@ -69,6 +43,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await ml.securityUI.loginAsMlPowerUser(); }); + after(async () => { + await ml.api.cleanMlIndices(); + }); + for (const testData of testDataList) { describe(testData.suiteSuffix, function () { before(async () => { @@ -79,14 +57,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.common.navigateToApp('dashboard'); }); - after(async () => { - await ml.api.cleanMlIndices(); - }); - it('can open job selection flyout', async () => { - await PageObjects.dashboard.clickCreateDashboardPrompt(); + await PageObjects.dashboard.clickNewDashboard(); await ml.dashboardEmbeddables.assertDashboardIsEmpty(); - await ml.dashboardEmbeddables.openJobSelectionFlyout(); + await ml.dashboardEmbeddables.openAnomalyJobSelectionFlyout( + ML_EMBEDDABLE_TYPES.ANOMALY_CHARTS + ); }); it('can select jobs', async () => { @@ -109,6 +85,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.timePicker.pauseAutoRefresh(); await ml.dashboardEmbeddables.assertAnomalyChartsSeverityThresholdControlExists(); await ml.dashboardEmbeddables.assertAnomalyChartsExists(); + await PageObjects.dashboard.saveDashboard(testData.dashboardTitle); }); }); } diff --git a/x-pack/test/functional/apps/ml/embeddables/anomaly_embeddables_migration.ts b/x-pack/test/functional/apps/ml/embeddables/anomaly_embeddables_migration.ts new file mode 100644 index 00000000000000..a7fcfa1b83475e --- /dev/null +++ b/x-pack/test/functional/apps/ml/embeddables/anomaly_embeddables_migration.ts @@ -0,0 +1,118 @@ +/* + * Copyright 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 { FtrProviderContext } from '../../../ftr_provider_context'; +import { JOB_CONFIG, DATAFEED_CONFIG, ML_EMBEDDABLE_TYPES } from './constants'; + +const testDataList = [ + { + type: ML_EMBEDDABLE_TYPES.ANOMALY_SWIMLANE, + panelTitle: 'ML anomaly swim lane', + dashboardSavedObject: { + type: 'dashboard', + attributes: { + title: `7.15.2 ML anomaly swimlane dashboard ${Date.now()}`, + description: '', + panelsJSON: `[{"version":"7.15.2","type":"ml_anomaly_swimlane","gridData":{"x":0,"y":0,"w":24,"h":15,"i":"c177ed0a-dea0-40f8-8980-cfb0c6bc13a8"},"panelIndex":"c177ed0a-dea0-40f8-8980-cfb0c6bc13a8","embeddableConfig":{"jobIds":["fq_multi_1_ae"],"swimlaneType":"viewBy","viewBy":"airline","enhancements":{}},"title":"ML anomaly swim lane"}]`, + optionsJSON: '{"useMargins":true,"syncColors":false,"hidePanelTitles":false}', + timeRestore: true, + timeTo: '2016-02-11T00:00:00.000Z', + timeFrom: '2016-02-07T00:00:00.000Z', + refreshInterval: { + pause: true, + value: 0, + }, + kibanaSavedObjectMeta: { + searchSourceJSON: '{"query":{"query":"","language":"kuery"},"filter":[]}', + }, + }, + coreMigrationVersion: '7.15.2', + }, + }, + { + type: ML_EMBEDDABLE_TYPES.ANOMALY_CHARTS, + panelTitle: 'ML anomaly charts', + dashboardSavedObject: { + type: 'dashboard', + attributes: { + title: `7.15.2 ML anomaly charts dashboard ${Date.now()}`, + description: '', + panelsJSON: + '[{"version":"7.15.2","type":"ml_anomaly_charts","gridData":{"x":0,"y":0,"w":38,"h":21,"i":"1155890b-c19c-4d98-8153-50e6434612f1"},"panelIndex":"1155890b-c19c-4d98-8153-50e6434612f1","embeddableConfig":{"jobIds":["fq_multi_1_ae"],"maxSeriesToPlot":6,"severityThreshold":0,"enhancements":{}},"title":"ML anomaly charts"}]', + optionsJSON: '{"useMargins":true,"syncColors":false,"hidePanelTitles":false}', + timeRestore: true, + timeTo: '2016-02-11T00:00:00.000Z', + timeFrom: '2016-02-07T00:00:00.000Z', + refreshInterval: { + pause: true, + value: 0, + }, + kibanaSavedObjectMeta: { + searchSourceJSON: '{"query":{"query":"","language":"kuery"},"filter":[]}', + }, + }, + coreMigrationVersion: '7.15.2', + }, + }, +]; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const ml = getService('ml'); + const PageObjects = getPageObjects(['common', 'timePicker', 'dashboard']); + + describe('anomaly embeddables migration in Dashboard', function () { + this.tags(['mlqa']); + + before(async () => { + await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); + await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); + await ml.testResources.setKibanaTimeZoneToUTC(); + await ml.securityUI.loginAsMlPowerUser(); + + await ml.api.createAndRunAnomalyDetectionLookbackJob(JOB_CONFIG, DATAFEED_CONFIG); + // Using bulk API because create API might return 400 for conflict errors + await ml.testResources.createBulkSavedObjects( + testDataList.map((d) => d.dashboardSavedObject) + ); + + await PageObjects.common.navigateToApp('dashboard'); + }); + + after(async () => { + await ml.api.cleanMlIndices(); + }); + + for (const testData of testDataList) { + const { dashboardSavedObject, panelTitle, type } = testData; + describe(`for ${panelTitle}`, function () { + before(async () => { + await PageObjects.common.navigateToApp('dashboard'); + }); + + after(async () => { + await ml.testResources.deleteDashboardByTitle(dashboardSavedObject.attributes.title); + }); + + it(`loads saved dashboard from version ${dashboardSavedObject.coreMigrationVersion}`, async () => { + await PageObjects.dashboard.loadSavedDashboard(dashboardSavedObject.attributes.title); + + await ml.dashboardEmbeddables.assertDashboardPanelExists(panelTitle); + + if (type === ML_EMBEDDABLE_TYPES.ANOMALY_CHARTS) { + await ml.dashboardEmbeddables.assertAnomalyChartsSeverityThresholdControlExists(); + await ml.dashboardEmbeddables.assertAnomalyChartsExists(); + } + + if (type === ML_EMBEDDABLE_TYPES.ANOMALY_SWIMLANE) { + await ml.dashboardEmbeddables.assertAnomalySwimlaneExists(); + } + }); + }); + } + }); +} diff --git a/x-pack/test/functional/apps/ml/embeddables/constants.ts b/x-pack/test/functional/apps/ml/embeddables/constants.ts new file mode 100644 index 00000000000000..f315b7ee44dc86 --- /dev/null +++ b/x-pack/test/functional/apps/ml/embeddables/constants.ts @@ -0,0 +1,41 @@ +/* + * Copyright 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 { Datafeed, Job } from '../../../../../plugins/ml/common/types/anomaly_detection_jobs'; + +// @ts-expect-error not full interface +export const JOB_CONFIG: Job = { + job_id: `fq_multi_1_ae`, + description: + 'mean/min/max(responsetime) partition=airline on farequote dataset with 1h bucket span', + groups: ['farequote', 'automated', 'multi-metric'], + analysis_config: { + bucket_span: '1h', + influencers: ['airline'], + detectors: [ + { function: 'mean', field_name: 'responsetime', partition_field_name: 'airline' }, + { function: 'min', field_name: 'responsetime', partition_field_name: 'airline' }, + { function: 'max', field_name: 'responsetime', partition_field_name: 'airline' }, + ], + }, + data_description: { time_field: '@timestamp' }, + analysis_limits: { model_memory_limit: '20mb' }, + model_plot_config: { enabled: true }, +}; + +// @ts-expect-error not full interface +export const DATAFEED_CONFIG: Datafeed = { + datafeed_id: 'datafeed-fq_multi_1_ae', + indices: ['ft_farequote'], + job_id: 'fq_multi_1_ae', + query: { bool: { must: [{ match_all: {} }] } }, +}; + +export const ML_EMBEDDABLE_TYPES = { + ANOMALY_SWIMLANE: 'ml_anomaly_swimlane', + ANOMALY_CHARTS: 'ml_anomaly_charts', +} as const; diff --git a/x-pack/test/functional/apps/ml/embeddables/index.ts b/x-pack/test/functional/apps/ml/embeddables/index.ts index dc059a1862c801..31074a59866a60 100644 --- a/x-pack/test/functional/apps/ml/embeddables/index.ts +++ b/x-pack/test/functional/apps/ml/embeddables/index.ts @@ -11,5 +11,6 @@ export default function ({ loadTestFile }: FtrProviderContext) { describe('embeddables', function () { this.tags(['skipFirefox']); loadTestFile(require.resolve('./anomaly_charts_dashboard_embeddables')); + loadTestFile(require.resolve('./anomaly_embeddables_migration')); }); } diff --git a/x-pack/test/functional/apps/spaces/copy_saved_objects.ts b/x-pack/test/functional/apps/spaces/copy_saved_objects.ts index 2d2fdf61a94b68..807e0fff16ff17 100644 --- a/x-pack/test/functional/apps/spaces/copy_saved_objects.ts +++ b/x-pack/test/functional/apps/spaces/copy_saved_objects.ts @@ -17,7 +17,8 @@ export default function spaceSelectorFunctonalTests({ const testSubjects = getService('testSubjects'); const PageObjects = getPageObjects(['security', 'settings', 'copySavedObjectsToSpace']); - describe('Copy Saved Objects to Space', function () { + // FLAKY: https://github.com/elastic/kibana/issues/44575 + describe.skip('Copy Saved Objects to Space', function () { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/spaces/copy_saved_objects'); diff --git a/x-pack/test/functional/apps/spaces/spaces_selection.ts b/x-pack/test/functional/apps/spaces/spaces_selection.ts index 0b9d1f420c6637..bab90a6d567fe7 100644 --- a/x-pack/test/functional/apps/spaces/spaces_selection.ts +++ b/x-pack/test/functional/apps/spaces/spaces_selection.ts @@ -22,8 +22,7 @@ export default function spaceSelectorFunctionalTests({ 'spaceSelector', ]); - // FLAKY: https://github.com/elastic/kibana/issues/99581 - describe.skip('Spaces', function () { + describe('Spaces', function () { this.tags('includeFirefox'); describe('Space Selector', () => { before(async () => { diff --git a/x-pack/test/functional/es_archives/lens/basic/data.json b/x-pack/test/functional/es_archives/lens/basic/data.json deleted file mode 100644 index a985de882929d4..00000000000000 --- a/x-pack/test/functional/es_archives/lens/basic/data.json +++ /dev/null @@ -1,577 +0,0 @@ -{ - "type": "doc", - "value": { - "id": "space:default", - "index": ".kibana_1", - "source": { - "migrationVersion": { - "space": "6.6.0" - }, - "references": [], - "space": { - "_reserved": true, - "description": "This is the default space!", - "disabledFeatures": [], - "name": "Default" - }, - "type": "space" - }, - "type": "_doc" - } -} - -{ - "type": "doc", - "value": { - "id": "index-pattern:logstash-*", - "index": ".kibana_1", - "source": { - "index-pattern": { - "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]", - "timeFieldName": "@timestamp", - "title": "logstash-*" - }, - "migrationVersion": { - "index-pattern": "6.5.0" - }, - "references": [], - "type": "index-pattern", - "updated_at": "2018-12-21T00:43:07.096Z" - }, - "type": "_doc" - } -} - -{ - "type": "doc", - "value": { - "id": "index-pattern:log*", - "index": ".kibana_1", - "source": { - "index-pattern": { - "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]", - "timeFieldName": "@timestamp", - "title": "log*" - }, - "migrationVersion": { - "index-pattern": "6.5.0" - }, - "references": [], - "type": "index-pattern", - "updated_at": "2018-12-21T00:43:07.096Z" - }, - "type": "_doc" - } -} - - -{ - "type": "doc", - "value": { - "id": "custom_space:index-pattern:logstash-*", - "index": ".kibana_1", - "source": { - "index-pattern": { - "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]", - "timeFieldName": "@timestamp", - "title": "logstash-*" - }, - "migrationVersion": { - "index-pattern": "6.5.0" - }, - "namespace": "custom_space", - "references": [], - "type": "index-pattern", - "updated_at": "2018-12-21T00:43:07.096Z" - }, - "type": "_doc" - } -} - -{ - "type": "doc", - "value": { - "id": "visualization:i-exist", - "index": ".kibana_1", - "source": { - "migrationVersion": { - "visualization": "7.3.1" - }, - "references": [ - { - "id": "logstash-*", - "name": "kibanaSavedObjectMeta.searchSourceJSON.index", - "type": "index-pattern" - } - ], - "type": "visualization", - "updated_at": "2019-01-22T19:32:31.206Z", - "visualization": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" - }, - "title": "A Pie", - "uiStateJSON": "{}", - "version": 1, - "visState": "{\"title\":\"A Pie\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":true,\"labels\":{\"show\":false,\"values\":true,\"last_level\":true,\"truncate\":100},\"dimensions\":{\"metric\":{\"accessor\":0,\"format\":{\"id\":\"number\"},\"params\":{},\"aggType\":\"count\"}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"geo.src\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"}}]}" - } - }, - "type": "_doc" - } -} - -{ - "type": "doc", - "value": { - "id": "custom_space:visualization:i-exist", - "index": ".kibana_1", - "source": { - "migrationVersion": { - "visualization": "7.3.1" - }, - "namespace": "custom_space", - "references": [ - { - "id": "logstash-*", - "name": "kibanaSavedObjectMeta.searchSourceJSON.index", - "type": "index-pattern" - } - ], - "type": "visualization", - "updated_at": "2019-01-22T19:32:31.206Z", - "visualization": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" - }, - "title": "A Pie", - "uiStateJSON": "{}", - "version": 1, - "visState": "{\"title\":\"A Pie\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":true,\"labels\":{\"show\":false,\"values\":true,\"last_level\":true,\"truncate\":100},\"dimensions\":{\"metric\":{\"accessor\":0,\"format\":{\"id\":\"number\"},\"params\":{},\"aggType\":\"count\"}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"geo.src\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"}}]}" - } - }, - "type": "_doc" - } -} - -{ - "type": "doc", - "value": { - "id": "query:okjpgs", - "index": ".kibana_1", - "source": { - "query": { - "description": "Ok responses for jpg files", - "filters": [ - { - "$state": { - "store": "appState" - }, - "meta": { - "alias": null, - "disabled": false, - "index": "b15b1d40-a8bb-11e9-98cf-2bb06ef63e0b", - "key": "extension.raw", - "negate": false, - "params": { - "query": "jpg" - }, - "type": "phrase", - "value": "jpg" - }, - "query": { - "match": { - "extension.raw": { - "query": "jpg", - "type": "phrase" - } - } - } - } - ], - "query": { - "language": "kuery", - "query": "response:200" - }, - "title": "OKJpgs" - }, - "references": [], - "type": "query", - "updated_at": "2019-07-17T17:54:26.378Z" - }, - "type": "_doc" - } -} - -{ - "type": "doc", - "value": { - "id": "config:8.0.0", - "index": ".kibana_1", - "source": { - "config": { - "accessibility:disableAnimations": true, - "buildNum": 9007199254740991, - "dateFormat:tz": "UTC", - "defaultIndex": "logstash-*" - }, - "references": [], - "type": "config", - "updated_at": "2019-09-04T18:47:24.761Z" - }, - "type": "_doc" - } -} - -{ - "type": "doc", - "value": { - "id": "lens:76fc4200-cf44-11e9-b933-fd84270f3ac1", - "index": ".kibana_1", - "source": { - "lens": { - "expression": "kibana\n| kibana_context query=\"{\\\"language\\\":\\\"kuery\\\",\\\"query\\\":\\\"\\\"}\" filters=\"[]\"\n| lens_merge_tables layerIds=\"c61a8afb-a185-4fae-a064-fb3846f6c451\" \n tables={esaggs index=\"logstash-*\" metricsAtAllLevels=false partialRows=false includeFormatHints=true aggConfigs={lens_auto_date aggConfigs=\"[{\\\"id\\\":\\\"2cd09808-3915-49f4-b3b0-82767eba23f7\\\",\\\"enabled\\\":true,\\\"type\\\":\\\"max\\\",\\\"schema\\\":\\\"metric\\\",\\\"params\\\":{\\\"field\\\":\\\"bytes\\\"}}]\"} | lens_rename_columns idMap=\"{\\\"col-0-2cd09808-3915-49f4-b3b0-82767eba23f7\\\":{\\\"dataType\\\":\\\"number\\\",\\\"isBucketed\\\":false,\\\"label\\\":\\\"Maximum of bytes\\\",\\\"operationType\\\":\\\"max\\\",\\\"scale\\\":\\\"ratio\\\",\\\"sourceField\\\":\\\"bytes\\\",\\\"id\\\":\\\"2cd09808-3915-49f4-b3b0-82767eba23f7\\\"}}\"}\n| lens_metric_chart title=\"Maximum of bytes\" accessor=\"2cd09808-3915-49f4-b3b0-82767eba23f7\" mode=\"full\"", - "state": { - "datasourceMetaData": { - "filterableIndexPatterns": [ - { - "id": "logstash-*", - "title": "logstash-*" - } - ] - }, - "datasourceStates": { - "indexpattern": { - "currentIndexPatternId": "logstash-*", - "layers": { - "c61a8afb-a185-4fae-a064-fb3846f6c451": { - "columnOrder": [ - "2cd09808-3915-49f4-b3b0-82767eba23f7" - ], - "columns": { - "2cd09808-3915-49f4-b3b0-82767eba23f7": { - "dataType": "number", - "isBucketed": false, - "label": "Maximum of bytes", - "operationType": "max", - "scale": "ratio", - "sourceField": "bytes" - } - }, - "indexPatternId": "logstash-*" - } - } - } - }, - "filters": [], - "query": { - "language": "kuery", - "query": "" - }, - "visualization": { - "accessor": "2cd09808-3915-49f4-b3b0-82767eba23f7", - "isHorizontal": false, - "layerId": "c61a8afb-a185-4fae-a064-fb3846f6c451", - "layers": [ - { - "accessors": [ - "d3e62a7a-c259-4fff-a2fc-eebf20b7008a", - "26ef70a9-c837-444c-886e-6bd905ee7335" - ], - "layerId": "c61a8afb-a185-4fae-a064-fb3846f6c451", - "seriesType": "area", - "splitAccessor": "54cd64ed-2a44-4591-af84-b2624504569a", - "xAccessor": "d6e40cea-6299-43b4-9c9d-b4ee305a2ce8" - } - ], - "legend": { - "isVisible": true, - "position": "right" - }, - "preferredSeriesType": "area" - } - }, - "title": "Artistpreviouslyknownaslens", - "visualizationType": "lnsMetric" - }, - "references": [], - "type": "lens", - "updated_at": "2019-10-16T00:28:08.979Z" - }, - "type": "_doc" - } -} - -{ - "type": "doc", - "value": { - "id": "lens:9536bed0-d57e-11ea-b169-e3a222a76b9c", - "index": ".kibana_1", - "source": { - "lens": { - "expression": "kibana\n| kibana_context query=\"{\\\"language\\\":\\\"kuery\\\",\\\"query\\\":\\\"\\\"}\" filters=\"[]\"\n| lens_merge_tables layerIds=\"4ba1a1be-6e67-434b-b3a0-f30db8ea5395\" \n tables={esaggs index=\"logstash-*\" metricsAtAllLevels=true partialRows=true includeFormatHints=true aggConfigs=\"[{\\\"id\\\":\\\"bafe3009-1776-4227-a0fe-b0d6ccbb4961\\\",\\\"enabled\\\":true,\\\"type\\\":\\\"terms\\\",\\\"schema\\\":\\\"segment\\\",\\\"params\\\":{\\\"field\\\":\\\"geo.dest\\\",\\\"orderBy\\\":\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\",\\\"order\\\":\\\"desc\\\",\\\"size\\\":7,\\\"otherBucket\\\":false,\\\"otherBucketLabel\\\":\\\"Other\\\",\\\"missingBucket\\\":false,\\\"missingBucketLabel\\\":\\\"Missing\\\"}},{\\\"id\\\":\\\"c1ebe4c9-f283-486c-ae95-6b3e99e83bd8\\\",\\\"enabled\\\":true,\\\"type\\\":\\\"terms\\\",\\\"schema\\\":\\\"segment\\\",\\\"params\\\":{\\\"field\\\":\\\"geo.src\\\",\\\"orderBy\\\":\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\",\\\"order\\\":\\\"desc\\\",\\\"size\\\":3,\\\"otherBucket\\\":false,\\\"otherBucketLabel\\\":\\\"Other\\\",\\\"missingBucket\\\":false,\\\"missingBucketLabel\\\":\\\"Missing\\\"}},{\\\"id\\\":\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\",\\\"enabled\\\":true,\\\"type\\\":\\\"avg\\\",\\\"schema\\\":\\\"metric\\\",\\\"params\\\":{\\\"field\\\":\\\"bytes\\\",\\\"missing\\\":0}}]\" | lens_rename_columns idMap=\"{\\\"col-0-bafe3009-1776-4227-a0fe-b0d6ccbb4961\\\":{\\\"dataType\\\":\\\"string\\\",\\\"isBucketed\\\":true,\\\"label\\\":\\\"Top values of geo.dest\\\",\\\"operationType\\\":\\\"terms\\\",\\\"params\\\":{\\\"orderBy\\\":{\\\"columnId\\\":\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\",\\\"type\\\":\\\"column\\\"},\\\"orderDirection\\\":\\\"desc\\\",\\\"size\\\":7},\\\"scale\\\":\\\"ordinal\\\",\\\"sourceField\\\":\\\"geo.dest\\\",\\\"id\\\":\\\"bafe3009-1776-4227-a0fe-b0d6ccbb4961\\\"},\\\"col-2-c1ebe4c9-f283-486c-ae95-6b3e99e83bd8\\\":{\\\"label\\\":\\\"Top values of geo.src\\\",\\\"dataType\\\":\\\"string\\\",\\\"operationType\\\":\\\"terms\\\",\\\"scale\\\":\\\"ordinal\\\",\\\"sourceField\\\":\\\"geo.src\\\",\\\"isBucketed\\\":true,\\\"params\\\":{\\\"size\\\":3,\\\"orderBy\\\":{\\\"type\\\":\\\"column\\\",\\\"columnId\\\":\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\"},\\\"orderDirection\\\":\\\"desc\\\"},\\\"id\\\":\\\"c1ebe4c9-f283-486c-ae95-6b3e99e83bd8\\\"},\\\"col-3-3dc0bd55-2087-4e60-aea2-f9910714f7db\\\":{\\\"dataType\\\":\\\"number\\\",\\\"isBucketed\\\":false,\\\"label\\\":\\\"Average of bytes\\\",\\\"operationType\\\":\\\"avg\\\",\\\"scale\\\":\\\"ratio\\\",\\\"sourceField\\\":\\\"bytes\\\",\\\"id\\\":\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\"}}\"}\n| lens_pie shape=\"pie\" hideLabels=false groups=\"bafe3009-1776-4227-a0fe-b0d6ccbb4961\"\n groups=\"c1ebe4c9-f283-486c-ae95-6b3e99e83bd8\" metric=\"3dc0bd55-2087-4e60-aea2-f9910714f7db\" numberDisplay=\"percent\" categoryDisplay=\"default\" legendDisplay=\"default\" legendPosition=\"right\" percentDecimals=3 nestedLegend=false", - "state": { - "datasourceMetaData": { - "filterableIndexPatterns": [ - { - "id": "logstash-*", - "title": "logstash-*" - } - ] - }, - "datasourceStates": { - "indexpattern": { - "currentIndexPatternId": "logstash-*", - "layers": { - "4ba1a1be-6e67-434b-b3a0-f30db8ea5395": { - "columnOrder": [ - "bafe3009-1776-4227-a0fe-b0d6ccbb4961", - "c1ebe4c9-f283-486c-ae95-6b3e99e83bd8", - "3dc0bd55-2087-4e60-aea2-f9910714f7db" - ], - "columns": { - "3dc0bd55-2087-4e60-aea2-f9910714f7db": { - "dataType": "number", - "isBucketed": false, - "label": "Average of bytes", - "operationType": "avg", - "scale": "ratio", - "sourceField": "bytes" - }, - "5bd1c078-e1dd-465b-8d25-7a6404befa88": { - "dataType": "date", - "isBucketed": true, - "label": "@timestamp", - "operationType": "date_histogram", - "params": { - "interval": "auto" - }, - "scale": "interval", - "sourceField": "@timestamp" - }, - "65340cf3-8402-4494-96f2-293701c59571": { - "dataType": "number", - "isBucketed": true, - "label": "Top values of bytes", - "operationType": "terms", - "params": { - "orderBy": { - "columnId": "3dc0bd55-2087-4e60-aea2-f9910714f7db", - "type": "column" - }, - "orderDirection": "desc", - "size": 3 - }, - "scale": "ordinal", - "sourceField": "bytes" - }, - "87554e1d-3dbf-4c1c-a358-4c9d40424cfa": { - "dataType": "string", - "isBucketed": true, - "label": "Top values of type", - "operationType": "terms", - "params": { - "orderBy": { - "columnId": "3dc0bd55-2087-4e60-aea2-f9910714f7db", - "type": "column" - }, - "orderDirection": "desc", - "size": 3 - }, - "scale": "ordinal", - "sourceField": "type" - }, - "bafe3009-1776-4227-a0fe-b0d6ccbb4961": { - "dataType": "string", - "isBucketed": true, - "label": "Top values of geo.dest", - "operationType": "terms", - "params": { - "orderBy": { - "columnId": "3dc0bd55-2087-4e60-aea2-f9910714f7db", - "type": "column" - }, - "orderDirection": "desc", - "size": 7 - }, - "scale": "ordinal", - "sourceField": "geo.dest" - }, - "c1ebe4c9-f283-486c-ae95-6b3e99e83bd8": { - "dataType": "string", - "isBucketed": true, - "label": "Top values of geo.src", - "operationType": "terms", - "params": { - "orderBy": { - "columnId": "3dc0bd55-2087-4e60-aea2-f9910714f7db", - "type": "column" - }, - "orderDirection": "desc", - "size": 3 - }, - "scale": "ordinal", - "sourceField": "geo.src" - } - }, - "indexPatternId": "logstash-*" - } - } - } - }, - "filters": [], - "query": { - "language": "kuery", - "query": "" - }, - "visualization": { - "layers": [ - { - "categoryDisplay": "default", - "groups": [ - "bafe3009-1776-4227-a0fe-b0d6ccbb4961", - "c1ebe4c9-f283-486c-ae95-6b3e99e83bd8" - ], - "layerId": "4ba1a1be-6e67-434b-b3a0-f30db8ea5395", - "legendDisplay": "default", - "metric": "3dc0bd55-2087-4e60-aea2-f9910714f7db", - "nestedLegend": false, - "numberDisplay": "percent" - } - ], - "shape": "pie" - } - }, - "title": "lnsPieVis", - "visualizationType": "lnsPie" - }, - "references": [], - "type": "lens", - "updated_at": "2020-08-03T11:43:43.421Z" - }, - "type": "_doc" - } -} - -{ - "type": "doc", - "value": { - "id": "lens:76fc4200-cf44-11e9-b933-fd84270f3ac2", - "index": ".kibana_1", - "source": { - "lens": { - "expression": "kibana\n| kibana_context query=\"{\\\"query\\\":\\\"\\\",\\\"language\\\":\\\"kuery\\\"}\" filters=\"[]\"\n| lens_merge_tables layerIds=\"4ba1a1be-6e67-434b-b3a0-f30db8ea5395\" \n tables={esaggs index=\"logstash-*\" metricsAtAllLevels=false partialRows=false includeFormatHints=true aggConfigs={lens_auto_date aggConfigs=\"[{\\\"id\\\":\\\"7a5d833b-ca6f-4e48-a924-d2a28d365dc3\\\",\\\"enabled\\\":true,\\\"type\\\":\\\"terms\\\",\\\"schema\\\":\\\"segment\\\",\\\"params\\\":{\\\"field\\\":\\\"ip\\\",\\\"orderBy\\\":\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\",\\\"order\\\":\\\"desc\\\",\\\"size\\\":3,\\\"otherBucket\\\":false,\\\"otherBucketLabel\\\":\\\"Other\\\",\\\"missingBucket\\\":false,\\\"missingBucketLabel\\\":\\\"Missing\\\"}},{\\\"id\\\":\\\"3cf18f28-3495-4d45-a55f-d97f88022099\\\",\\\"enabled\\\":true,\\\"type\\\":\\\"date_histogram\\\",\\\"schema\\\":\\\"segment\\\",\\\"params\\\":{\\\"field\\\":\\\"@timestamp\\\",\\\"useNormalizedEsInterval\\\":true,\\\"interval\\\":\\\"auto\\\",\\\"drop_partials\\\":false,\\\"min_doc_count\\\":0,\\\"extended_bounds\\\":{}}},{\\\"id\\\":\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\",\\\"enabled\\\":true,\\\"type\\\":\\\"avg\\\",\\\"schema\\\":\\\"metric\\\",\\\"params\\\":{\\\"field\\\":\\\"bytes\\\",\\\"missing\\\":0}}]\"} | lens_rename_columns idMap=\"{\\\"col-0-7a5d833b-ca6f-4e48-a924-d2a28d365dc3\\\":{\\\"label\\\":\\\"Top values of ip\\\",\\\"dataType\\\":\\\"ip\\\",\\\"operationType\\\":\\\"terms\\\",\\\"scale\\\":\\\"ordinal\\\",\\\"suggestedPriority\\\":0,\\\"sourceField\\\":\\\"ip\\\",\\\"isBucketed\\\":true,\\\"params\\\":{\\\"size\\\":3,\\\"orderBy\\\":{\\\"type\\\":\\\"column\\\",\\\"columnId\\\":\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\"},\\\"orderDirection\\\":\\\"desc\\\"},\\\"id\\\":\\\"7a5d833b-ca6f-4e48-a924-d2a28d365dc3\\\"},\\\"col-1-3cf18f28-3495-4d45-a55f-d97f88022099\\\":{\\\"label\\\":\\\"@timestamp\\\",\\\"dataType\\\":\\\"date\\\",\\\"operationType\\\":\\\"date_histogram\\\",\\\"suggestedPriority\\\":1,\\\"sourceField\\\":\\\"@timestamp\\\",\\\"isBucketed\\\":true,\\\"scale\\\":\\\"interval\\\",\\\"params\\\":{\\\"interval\\\":\\\"auto\\\"},\\\"id\\\":\\\"3cf18f28-3495-4d45-a55f-d97f88022099\\\"},\\\"col-2-3dc0bd55-2087-4e60-aea2-f9910714f7db\\\":{\\\"label\\\":\\\"Average of bytes\\\",\\\"dataType\\\":\\\"number\\\",\\\"operationType\\\":\\\"avg\\\",\\\"sourceField\\\":\\\"bytes\\\",\\\"isBucketed\\\":false,\\\"scale\\\":\\\"ratio\\\",\\\"id\\\":\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\"}}\"}\n| lens_xy_chart xTitle=\"@timestamp\" yTitle=\"Average of bytes\" legend={lens_xy_legendConfig isVisible=true position=\"right\"} \n layers={lens_xy_layer layerId=\"4ba1a1be-6e67-434b-b3a0-f30db8ea5395\" hide=false xAccessor=\"3cf18f28-3495-4d45-a55f-d97f88022099\" yScaleType=\"linear\" xScaleType=\"time\" isHistogram=true splitAccessor=\"7a5d833b-ca6f-4e48-a924-d2a28d365dc3\" seriesType=\"bar_stacked\" accessors=\"3dc0bd55-2087-4e60-aea2-f9910714f7db\" columnToLabel=\"{\\\"3dc0bd55-2087-4e60-aea2-f9910714f7db\\\":\\\"Average of bytes\\\",\\\"7a5d833b-ca6f-4e48-a924-d2a28d365dc3\\\":\\\"Top values of ip\\\"}\"}", - "state": { - "datasourceMetaData": { - "filterableIndexPatterns": [ - { - "id": "logstash-*", - "title": "logstash-*" - } - ] - }, - "datasourceStates": { - "indexpattern": { - "currentIndexPatternId": "logstash-*", - "layers": { - "4ba1a1be-6e67-434b-b3a0-f30db8ea5395": { - "columnOrder": [ - "7a5d833b-ca6f-4e48-a924-d2a28d365dc3", - "3cf18f28-3495-4d45-a55f-d97f88022099", - "3dc0bd55-2087-4e60-aea2-f9910714f7db" - ], - "columns": { - "3cf18f28-3495-4d45-a55f-d97f88022099": { - "dataType": "date", - "isBucketed": true, - "label": "@timestamp", - "operationType": "date_histogram", - "params": { - "interval": "auto" - }, - "scale": "interval", - "sourceField": "@timestamp", - "suggestedPriority": 1 - }, - "3dc0bd55-2087-4e60-aea2-f9910714f7db": { - "dataType": "number", - "isBucketed": false, - "label": "Average of bytes", - "operationType": "avg", - "scale": "ratio", - "sourceField": "bytes" - }, - "7a5d833b-ca6f-4e48-a924-d2a28d365dc3": { - "dataType": "ip", - "isBucketed": true, - "label": "Top values of ip", - "operationType": "terms", - "params": { - "orderBy": { - "columnId": "3dc0bd55-2087-4e60-aea2-f9910714f7db", - "type": "column" - }, - "orderDirection": "desc", - "size": 3 - }, - "scale": "ordinal", - "sourceField": "ip", - "suggestedPriority": 0 - } - }, - "indexPatternId": "logstash-*" - } - } - } - }, - "filters": [], - "query": { - "language": "kuery", - "query": "" - }, - "visualization": { - "layers": [ - { - "accessors": [ - "3dc0bd55-2087-4e60-aea2-f9910714f7db" - ], - "layerId": "4ba1a1be-6e67-434b-b3a0-f30db8ea5395", - "seriesType": "bar_stacked", - "splitAccessor": "7a5d833b-ca6f-4e48-a924-d2a28d365dc3", - "xAccessor": "3cf18f28-3495-4d45-a55f-d97f88022099" - } - ], - "legend": { - "isVisible": true, - "position": "right" - }, - "preferredSeriesType": "bar_stacked" - } - }, - "title": "lnsXYvis", - "visualizationType": "lnsXY" - }, - "references": [], - "type": "lens", - "updated_at": "2019-10-16T00:28:08.979Z" - }, - "type": "_doc" - } -} - -{ - "type": "doc", - "value": { - "id": "ui-metric:DashboardPanelVersionInUrl:8.0.0", - "index": ".kibana_1", - "source": { - "type": "ui-metric", - "ui-metric": { - "count": 1 - }, - "updated_at": "2019-10-16T00:28:24.399Z" - }, - "type": "_doc" - } -} diff --git a/x-pack/test/functional/es_archives/lens/basic/mappings.json b/x-pack/test/functional/es_archives/lens/basic/mappings.json deleted file mode 100644 index 5ff0a0e4661c36..00000000000000 --- a/x-pack/test/functional/es_archives/lens/basic/mappings.json +++ /dev/null @@ -1,1252 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": { - } - }, - "index": ".kibana_1", - "mappings": { - "_meta": { - "migrationMappingPropertyHashes": { - "apm-telemetry": "07ee1939fa4302c62ddc052ec03fed90", - "canvas-element": "7390014e1091044523666d97247392fc", - "canvas-workpad": "b0a1706d356228dbdcb4a17e6b9eb231", - "config": "87aca8fdb053154f11383fce3dbf3edf", - "dashboard": "d00f614b29a80360e1190193fd333bab", - "file-upload-telemetry": "0ed4d3e1983d1217a30982630897092e", - "graph-workspace": "cd7ba1330e6682e9cc00b78850874be1", - "index-pattern": "66eccb05066c5a89924f48a9e9736499", - "infrastructure-ui-source": "ddc0ecb18383f6b26101a2fadb2dab0c", - "inventory-view": "84b320fd67209906333ffce261128462", - "kql-telemetry": "d12a98a6f19a2d273696597547e064ee", - "lens": "21c3ea0763beb1ecb0162529706b88c5", - "maps-telemetry": "a4229f8b16a6820c6d724b7e0c1f729d", - "metrics-explorer-view": "53c5365793677328df0ccb6138bf3cdd", - "migrationVersion": "4a1746014a75ade3a714e1db5763276f", - "ml-telemetry": "257fd1d4b4fdbb9cb4b8a3b27da201e9", - "namespace": "2f4316de49999235636386fe51dc06c1", - "query": "11aaeb7f5f7fa5bb43f25e18ce26e7d9", - "references": "7997cf5a56cc02bdc9c93361bde732b0", - "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", - "search": "181661168bbadd1eff5902361e2a0d5c", - "server": "ec97f1c5da1a19609a60874e5af1100c", - "siem-ui-timeline": "1f6f0860ad7bc0dba3e42467ca40470d", - "siem-ui-timeline-note": "8874706eedc49059d4cf0f5094559084", - "siem-ui-timeline-pinned-event": "20638091112f0e14f0e443d512301c29", - "space": "c5ca8acafa0beaa4d08d014a97b6bc6b", - "telemetry": "e1c8bc94e443aefd9458932cc0697a4d", - "type": "2f4316de49999235636386fe51dc06c1", - "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", - "updated_at": "00da57df13e94e9d98437d13ace4bfe0", - "upgrade-assistant-reindex-operation": "a53a20fe086b72c9a86da3cc12dad8a6", - "upgrade-assistant-telemetry": "56702cec857e0a9dacfb696655b4ff7b", - "url": "c7f66a0df8b1b52f17c28c4adb111105", - "visualization": "52d7a13ad68a150c4525b292d23e12cc" - } - }, - "dynamic": "strict", - "properties": { - "action": { - "properties": { - "actionTypeId": { - "type": "keyword" - }, - "config": { - "enabled": false, - "type": "object" - }, - "description": { - "type": "text" - }, - "secrets": { - "type": "binary" - } - } - }, - "action_task_params": { - "properties": { - "actionId": { - "type": "keyword" - }, - "apiKey": { - "type": "binary" - }, - "params": { - "enabled": false, - "type": "object" - } - } - }, - "alert": { - "properties": { - "actions": { - "properties": { - "actionRef": { - "type": "keyword" - }, - "group": { - "type": "keyword" - }, - "params": { - "enabled": false, - "type": "object" - } - }, - "type": "nested" - }, - "alertTypeId": { - "type": "keyword" - }, - "params": { - "enabled": false, - "type": "object" - }, - "apiKey": { - "type": "binary" - }, - "apiKeyOwner": { - "type": "keyword" - }, - "createdBy": { - "type": "keyword" - }, - "enabled": { - "type": "boolean" - }, - "interval": { - "type": "keyword" - }, - "scheduledTaskId": { - "type": "keyword" - }, - "updatedBy": { - "type": "keyword" - } - } - }, - "apm-telemetry": { - "properties": { - "has_any_services": { - "type": "boolean" - }, - "services_per_agent": { - "properties": { - "dotnet": { - "null_value": 0, - "type": "long" - }, - "go": { - "null_value": 0, - "type": "long" - }, - "java": { - "null_value": 0, - "type": "long" - }, - "js-base": { - "null_value": 0, - "type": "long" - }, - "nodejs": { - "null_value": 0, - "type": "long" - }, - "python": { - "null_value": 0, - "type": "long" - }, - "ruby": { - "null_value": 0, - "type": "long" - }, - "rum-js": { - "null_value": 0, - "type": "long" - } - } - } - } - }, - "canvas-element": { - "dynamic": "false", - "properties": { - "@created": { - "type": "date" - }, - "@timestamp": { - "type": "date" - }, - "content": { - "type": "text" - }, - "help": { - "type": "text" - }, - "image": { - "type": "text" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "canvas-workpad": { - "dynamic": "false", - "properties": { - "@created": { - "type": "date" - }, - "@timestamp": { - "type": "date" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "config": { - "dynamic": "true", - "properties": { - "accessibility:disableAnimations": { - "type": "boolean" - }, - "buildNum": { - "type": "keyword" - }, - "dateFormat:tz": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "defaultIndex": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "file-upload-telemetry": { - "properties": { - "filesUploadedTotalCount": { - "type": "long" - } - } - }, - "gis-map": { - "properties": { - "bounds": { - "dynamic": false, - "properties": {} - }, - "description": { - "type": "text" - }, - "layerListJSON": { - "type": "text" - }, - "mapStateJSON": { - "type": "text" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "graph-workspace": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "numLinks": { - "type": "integer" - }, - "numVertices": { - "type": "integer" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "wsState": { - "type": "text" - } - } - }, - "index-pattern": { - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "type": { - "type": "keyword" - }, - "typeMeta": { - "type": "keyword" - } - } - }, - "infrastructure-ui-source": { - "properties": { - "description": { - "type": "text" - }, - "fields": { - "properties": { - "container": { - "type": "keyword" - }, - "host": { - "type": "keyword" - }, - "pod": { - "type": "keyword" - }, - "tiebreaker": { - "type": "keyword" - }, - "timestamp": { - "type": "keyword" - } - } - }, - "logAlias": { - "type": "keyword" - }, - "logColumns": { - "properties": { - "fieldColumn": { - "properties": { - "field": { - "type": "keyword" - }, - "id": { - "type": "keyword" - } - } - }, - "messageColumn": { - "properties": { - "id": { - "type": "keyword" - } - } - }, - "timestampColumn": { - "properties": { - "id": { - "type": "keyword" - } - } - } - }, - "type": "nested" - }, - "metricAlias": { - "type": "keyword" - }, - "name": { - "type": "text" - } - } - }, - "inventory-view": { - "properties": { - "autoBounds": { - "type": "boolean" - }, - "autoReload": { - "type": "boolean" - }, - "boundsOverride": { - "properties": { - "max": { - "type": "integer" - }, - "min": { - "type": "integer" - } - } - }, - "customOptions": { - "properties": { - "field": { - "type": "keyword" - }, - "text": { - "type": "keyword" - } - }, - "type": "nested" - }, - "filterQuery": { - "properties": { - "expression": { - "type": "keyword" - }, - "kind": { - "type": "keyword" - } - } - }, - "groupBy": { - "properties": { - "field": { - "type": "keyword" - }, - "label": { - "type": "keyword" - } - }, - "type": "nested" - }, - "metric": { - "properties": { - "type": { - "type": "keyword" - } - } - }, - "name": { - "type": "keyword" - }, - "nodeType": { - "type": "keyword" - }, - "time": { - "type": "integer" - }, - "view": { - "type": "keyword" - } - } - }, - "kql-telemetry": { - "properties": { - "optInCount": { - "type": "long" - }, - "optOutCount": { - "type": "long" - } - } - }, - "lens": { - "properties": { - "expression": { - "index": false, - "type": "keyword" - }, - "state": { - "type": "flattened" - }, - "title": { - "type": "text" - }, - "visualizationType": { - "type": "keyword" - } - } - }, - "map": { - "properties": { - "bounds": { - "dynamic": false, - "properties": {} - }, - "description": { - "type": "text" - }, - "layerListJSON": { - "type": "text" - }, - "mapStateJSON": { - "type": "text" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "maps-telemetry": { - "properties": { - "attributesPerMap": { - "properties": { - "dataSourcesCount": { - "properties": { - "avg": { - "type": "long" - }, - "max": { - "type": "long" - }, - "min": { - "type": "long" - } - } - }, - "emsVectorLayersCount": { - "dynamic": "true", - "type": "object" - }, - "layerTypesCount": { - "dynamic": "true", - "type": "object" - }, - "layersCount": { - "properties": { - "avg": { - "type": "long" - }, - "max": { - "type": "long" - }, - "min": { - "type": "long" - } - } - } - } - }, - "mapsTotalCount": { - "type": "long" - }, - "timeCaptured": { - "type": "date" - } - } - }, - "metrics-explorer-view": { - "properties": { - "chartOptions": { - "properties": { - "stack": { - "type": "boolean" - }, - "type": { - "type": "keyword" - }, - "yAxisMode": { - "type": "keyword" - } - } - }, - "currentTimerange": { - "properties": { - "from": { - "type": "keyword" - }, - "interval": { - "type": "keyword" - }, - "to": { - "type": "keyword" - } - } - }, - "name": { - "type": "keyword" - }, - "options": { - "properties": { - "aggregation": { - "type": "keyword" - }, - "filterQuery": { - "type": "keyword" - }, - "groupBy": { - "type": "keyword" - }, - "limit": { - "type": "integer" - }, - "metrics": { - "properties": { - "aggregation": { - "type": "keyword" - }, - "color": { - "type": "keyword" - }, - "field": { - "type": "keyword" - }, - "label": { - "type": "keyword" - } - }, - "type": "nested" - } - } - } - } - }, - "migrationVersion": { - "dynamic": "true", - "properties": { - "index-pattern": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "space": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "visualization": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "ml-telemetry": { - "properties": { - "file_data_visualizer": { - "properties": { - "index_creation_count": { - "type": "long" - } - } - } - } - }, - "namespace": { - "type": "keyword" - }, - "query": { - "properties": { - "description": { - "type": "text" - }, - "filters": { - "enabled": false, - "type": "object" - }, - "query": { - "properties": { - "language": { - "type": "keyword" - }, - "query": { - "index": false, - "type": "keyword" - } - } - }, - "timefilter": { - "enabled": false, - "type": "object" - }, - "title": { - "type": "text" - } - } - }, - "references": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "sample-data-telemetry": { - "properties": { - "installCount": { - "type": "long" - }, - "unInstallCount": { - "type": "long" - } - } - }, - "search": { - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "siem-ui-timeline": { - "properties": { - "columns": { - "properties": { - "aggregatable": { - "type": "boolean" - }, - "category": { - "type": "keyword" - }, - "columnHeaderType": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "example": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "indexes": { - "type": "keyword" - }, - "name": { - "type": "text" - }, - "placeholder": { - "type": "text" - }, - "searchable": { - "type": "boolean" - }, - "type": { - "type": "keyword" - } - } - }, - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "dataProviders": { - "properties": { - "and": { - "properties": { - "enabled": { - "type": "boolean" - }, - "excluded": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "kqlQuery": { - "type": "text" - }, - "name": { - "type": "text" - }, - "queryMatch": { - "properties": { - "displayField": { - "type": "text" - }, - "displayValue": { - "type": "text" - }, - "field": { - "type": "text" - }, - "operator": { - "type": "text" - }, - "value": { - "type": "text" - } - } - } - } - }, - "enabled": { - "type": "boolean" - }, - "excluded": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "kqlQuery": { - "type": "text" - }, - "name": { - "type": "text" - }, - "queryMatch": { - "properties": { - "displayField": { - "type": "text" - }, - "displayValue": { - "type": "text" - }, - "field": { - "type": "text" - }, - "operator": { - "type": "text" - }, - "value": { - "type": "text" - } - } - } - } - }, - "dateRange": { - "properties": { - "end": { - "type": "date" - }, - "start": { - "type": "date" - } - } - }, - "description": { - "type": "text" - }, - "favorite": { - "properties": { - "favoriteDate": { - "type": "date" - }, - "fullName": { - "type": "text" - }, - "keySearch": { - "type": "text" - }, - "userName": { - "type": "text" - } - } - }, - "kqlMode": { - "type": "keyword" - }, - "kqlQuery": { - "properties": { - "filterQuery": { - "properties": { - "kuery": { - "properties": { - "expression": { - "type": "text" - }, - "kind": { - "type": "keyword" - } - } - }, - "serializedQuery": { - "type": "text" - } - } - } - } - }, - "sort": { - "properties": { - "columnId": { - "type": "keyword" - }, - "sortDirection": { - "type": "keyword" - } - } - }, - "title": { - "type": "text" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "siem-ui-timeline-note": { - "properties": { - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "eventId": { - "type": "keyword" - }, - "note": { - "type": "text" - }, - "timelineId": { - "type": "keyword" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "siem-ui-timeline-pinned-event": { - "properties": { - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "eventId": { - "type": "keyword" - }, - "timelineId": { - "type": "keyword" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "space": { - "properties": { - "_reserved": { - "type": "boolean" - }, - "color": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "disabledFeatures": { - "type": "keyword" - }, - "imageUrl": { - "index": false, - "type": "text" - }, - "initials": { - "type": "keyword" - }, - "name": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "spaceId": { - "type": "keyword" - }, - "telemetry": { - "properties": { - "enabled": { - "type": "boolean" - } - } - }, - "type": { - "type": "keyword" - }, - "ui-metric": { - "properties": { - "count": { - "type": "integer" - } - } - }, - "updated_at": { - "type": "date" - }, - "upgrade-assistant-reindex-operation": { - "dynamic": "true", - "properties": { - "indexName": { - "type": "keyword" - }, - "status": { - "type": "integer" - } - } - }, - "upgrade-assistant-telemetry": { - "properties": { - "features": { - "properties": { - "deprecation_logging": { - "properties": { - "enabled": { - "null_value": true, - "type": "boolean" - } - } - } - } - }, - "ui_open": { - "properties": { - "cluster": { - "null_value": 0, - "type": "long" - }, - "indices": { - "null_value": 0, - "type": "long" - }, - "overview": { - "null_value": 0, - "type": "long" - } - } - }, - "ui_reindex": { - "properties": { - "close": { - "null_value": 0, - "type": "long" - }, - "open": { - "null_value": 0, - "type": "long" - }, - "start": { - "null_value": 0, - "type": "long" - }, - "stop": { - "null_value": 0, - "type": "long" - } - } - } - } - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchRefName": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - } - } - }, - "settings": { - "index": { - "auto_expand_replicas": "0-1", - "number_of_replicas": "0", - "number_of_shards": "1" - } - } - } -} diff --git a/x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json b/x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json new file mode 100644 index 00000000000000..8f77950407841f --- /dev/null +++ b/x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json @@ -0,0 +1,433 @@ +{ + "attributes": { + "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]", + "timeFieldName": "@timestamp", + "title": "logstash-*" + }, + "coreMigrationVersion": "8.0.0", + "id": "logstash-*", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "updated_at": "2018-12-21T00:43:07.096Z", + "version": "WzEzLDJd" +} + +{ + "attributes": { + "state": { + "datasourceStates": { + "indexpattern": { + "layers": { + "c61a8afb-a185-4fae-a064-fb3846f6c451": { + "columnOrder": [ + "2cd09808-3915-49f4-b3b0-82767eba23f7" + ], + "columns": { + "2cd09808-3915-49f4-b3b0-82767eba23f7": { + "dataType": "number", + "isBucketed": false, + "label": "Maximum of bytes", + "operationType": "max", + "scale": "ratio", + "sourceField": "bytes" + } + } + } + } + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "accessor": "2cd09808-3915-49f4-b3b0-82767eba23f7", + "isHorizontal": false, + "layerId": "c61a8afb-a185-4fae-a064-fb3846f6c451", + "layers": [ + { + "accessors": [ + "d3e62a7a-c259-4fff-a2fc-eebf20b7008a", + "26ef70a9-c837-444c-886e-6bd905ee7335" + ], + "layerId": "c61a8afb-a185-4fae-a064-fb3846f6c451", + "seriesType": "area", + "splitAccessor": "54cd64ed-2a44-4591-af84-b2624504569a", + "xAccessor": "d6e40cea-6299-43b4-9c9d-b4ee305a2ce8" + } + ], + "legend": { + "isVisible": true, + "position": "right" + }, + "preferredSeriesType": "area" + } + }, + "title": "Artistpreviouslyknownaslens", + "visualizationType": "lnsMetric" + }, + "coreMigrationVersion": "8.0.0", + "id": "76fc4200-cf44-11e9-b933-fd84270f3ac1", + "migrationVersion": { + "lens": "7.14.0" + }, + "references": [ + { + "id": "logstash-*", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern" + }, + { + "id": "logstash-*", + "name": "indexpattern-datasource-layer-c61a8afb-a185-4fae-a064-fb3846f6c451", + "type": "index-pattern" + } + ], + "type": "lens", + "updated_at": "2019-10-16T00:28:08.979Z", + "version": "WzIwLDJd" +} + +{ + "attributes": { + "state": { + "datasourceStates": { + "indexpattern": { + "layers": { + "4ba1a1be-6e67-434b-b3a0-f30db8ea5395": { + "columnOrder": [ + "7a5d833b-ca6f-4e48-a924-d2a28d365dc3", + "3cf18f28-3495-4d45-a55f-d97f88022099", + "3dc0bd55-2087-4e60-aea2-f9910714f7db" + ], + "columns": { + "3cf18f28-3495-4d45-a55f-d97f88022099": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + }, + "3dc0bd55-2087-4e60-aea2-f9910714f7db": { + "dataType": "number", + "isBucketed": false, + "label": "Average of bytes", + "operationType": "average", + "scale": "ratio", + "sourceField": "bytes" + }, + "7a5d833b-ca6f-4e48-a924-d2a28d365dc3": { + "dataType": "ip", + "isBucketed": true, + "label": "Top values of ip", + "operationType": "terms", + "params": { + "orderBy": { + "columnId": "3dc0bd55-2087-4e60-aea2-f9910714f7db", + "type": "column" + }, + "orderDirection": "desc", + "size": 3 + }, + "scale": "ordinal", + "sourceField": "ip" + } + } + } + } + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "layers": [ + { + "accessors": [ + "3dc0bd55-2087-4e60-aea2-f9910714f7db" + ], + "layerId": "4ba1a1be-6e67-434b-b3a0-f30db8ea5395", + "seriesType": "bar_stacked", + "splitAccessor": "7a5d833b-ca6f-4e48-a924-d2a28d365dc3", + "xAccessor": "3cf18f28-3495-4d45-a55f-d97f88022099" + } + ], + "legend": { + "isVisible": true, + "position": "right" + }, + "preferredSeriesType": "bar_stacked" + } + }, + "title": "lnsXYvis", + "visualizationType": "lnsXY" + }, + "coreMigrationVersion": "8.0.0", + "id": "76fc4200-cf44-11e9-b933-fd84270f3ac2", + "migrationVersion": { + "lens": "7.14.0" + }, + "references": [ + { + "id": "logstash-*", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern" + }, + { + "id": "logstash-*", + "name": "indexpattern-datasource-layer-4ba1a1be-6e67-434b-b3a0-f30db8ea5395", + "type": "index-pattern" + } + ], + "type": "lens", + "updated_at": "2019-10-16T00:28:08.979Z", + "version": "WzIyLDJd" +} + +{ + "attributes": { + "state": { + "datasourceStates": { + "indexpattern": { + "layers": { + "4ba1a1be-6e67-434b-b3a0-f30db8ea5395": { + "columnOrder": [ + "bafe3009-1776-4227-a0fe-b0d6ccbb4961", + "c1ebe4c9-f283-486c-ae95-6b3e99e83bd8", + "3dc0bd55-2087-4e60-aea2-f9910714f7db" + ], + "columns": { + "3dc0bd55-2087-4e60-aea2-f9910714f7db": { + "dataType": "number", + "isBucketed": false, + "label": "Average of bytes", + "operationType": "average", + "scale": "ratio", + "sourceField": "bytes" + }, + "5bd1c078-e1dd-465b-8d25-7a6404befa88": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + }, + "65340cf3-8402-4494-96f2-293701c59571": { + "dataType": "number", + "isBucketed": true, + "label": "Top values of bytes", + "operationType": "terms", + "params": { + "orderBy": { + "columnId": "3dc0bd55-2087-4e60-aea2-f9910714f7db", + "type": "column" + }, + "orderDirection": "desc", + "size": 3 + }, + "scale": "ordinal", + "sourceField": "bytes" + }, + "87554e1d-3dbf-4c1c-a358-4c9d40424cfa": { + "dataType": "string", + "isBucketed": true, + "label": "Top values of type", + "operationType": "terms", + "params": { + "orderBy": { + "columnId": "3dc0bd55-2087-4e60-aea2-f9910714f7db", + "type": "column" + }, + "orderDirection": "desc", + "size": 3 + }, + "scale": "ordinal", + "sourceField": "type" + }, + "bafe3009-1776-4227-a0fe-b0d6ccbb4961": { + "dataType": "string", + "isBucketed": true, + "label": "Top values of geo.dest", + "operationType": "terms", + "params": { + "orderBy": { + "columnId": "3dc0bd55-2087-4e60-aea2-f9910714f7db", + "type": "column" + }, + "orderDirection": "desc", + "size": 7 + }, + "scale": "ordinal", + "sourceField": "geo.dest" + }, + "c1ebe4c9-f283-486c-ae95-6b3e99e83bd8": { + "dataType": "string", + "isBucketed": true, + "label": "Top values of geo.src", + "operationType": "terms", + "params": { + "orderBy": { + "columnId": "3dc0bd55-2087-4e60-aea2-f9910714f7db", + "type": "column" + }, + "orderDirection": "desc", + "size": 3 + }, + "scale": "ordinal", + "sourceField": "geo.src" + } + } + } + } + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "layers": [ + { + "categoryDisplay": "default", + "groups": [ + "bafe3009-1776-4227-a0fe-b0d6ccbb4961", + "c1ebe4c9-f283-486c-ae95-6b3e99e83bd8" + ], + "layerId": "4ba1a1be-6e67-434b-b3a0-f30db8ea5395", + "legendDisplay": "default", + "metric": "3dc0bd55-2087-4e60-aea2-f9910714f7db", + "nestedLegend": false, + "numberDisplay": "percent" + } + ], + "shape": "pie" + } + }, + "title": "lnsPieVis", + "visualizationType": "lnsPie" + }, + "coreMigrationVersion": "8.0.0", + "id": "9536bed0-d57e-11ea-b169-e3a222a76b9c", + "migrationVersion": { + "lens": "7.14.0" + }, + "references": [ + { + "id": "logstash-*", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern" + }, + { + "id": "logstash-*", + "name": "indexpattern-datasource-layer-4ba1a1be-6e67-434b-b3a0-f30db8ea5395", + "type": "index-pattern" + } + ], + "type": "lens", + "updated_at": "2020-08-03T11:43:43.421Z", + "version": "WzIxLDJd" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" + }, + "title": "A Pie", + "uiStateJSON": "{}", + "version": 1, + "visState": "{\"title\":\"A Pie\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":true,\"labels\":{\"show\":false,\"values\":true,\"last_level\":true,\"truncate\":100},\"dimensions\":{\"metric\":{\"accessor\":0,\"format\":{\"id\":\"number\"},\"params\":{},\"aggType\":\"count\"}},\"palette\":{\"type\":\"palette\",\"name\":\"kibana_palette\"},\"distinctColors\":true},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"geo.src\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"}}]}" + }, + "coreMigrationVersion": "8.0.0", + "id": "i-exist", + "migrationVersion": { + "visualization": "7.14.0" + }, + "references": [ + { + "id": "logstash-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization", + "updated_at": "2019-01-22T19:32:31.206Z", + "version": "WzE2LDJd" +} + +{ + "attributes": { + "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]", + "timeFieldName": "@timestamp", + "title": "log*" + }, + "coreMigrationVersion": "8.0.0", + "id": "log*", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "updated_at": "2018-12-21T00:43:07.096Z", + "version": "WzE0LDJd" +} + +{ + "attributes": { + "description": "Ok responses for jpg files", + "filters": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "index": "b15b1d40-a8bb-11e9-98cf-2bb06ef63e0b", + "key": "extension.raw", + "negate": false, + "params": { + "query": "jpg" + }, + "type": "phrase", + "value": "jpg" + }, + "query": { + "match": { + "extension.raw": { + "query": "jpg", + "type": "phrase" + } + } + } + } + ], + "query": { + "language": "kuery", + "query": "response:200" + }, + "title": "OKJpgs" + }, + "coreMigrationVersion": "8.0.0", + "id": "okjpgs", + "references": [], + "type": "query", + "updated_at": "2019-07-17T17:54:26.378Z", + "version": "WzE4LDJd" +} \ No newline at end of file diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts index 790ac3ede496f8..266aa4955b6e82 100644 --- a/x-pack/test/functional/page_objects/lens_page.ts +++ b/x-pack/test/functional/page_objects/lens_page.ts @@ -797,6 +797,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont }, async getDatatableHeader(index = 0) { + log.debug(`All headers ${await testSubjects.getVisibleText('dataGridHeader')}`); return find.byCssSelector( `[data-test-subj="lnsDataTable"] [data-test-subj="dataGridHeader"] [role=columnheader]:nth-child(${ index + 1 @@ -897,12 +898,18 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont ); }, - async toggleColumnVisibility(dimension: string) { + async toggleColumnVisibility(dimension: string, no = 1) { await this.openDimensionEditor(dimension); const id = 'lns-table-column-hidden'; + await PageObjects.common.sleep(500); const isChecked = await testSubjects.isEuiSwitchChecked(id); + log.debug(`switch status before the toggle = ${isChecked}`); await testSubjects.setEuiSwitch(id, isChecked ? 'uncheck' : 'check'); + await PageObjects.common.sleep(500); + const isChecked2 = await testSubjects.isEuiSwitchChecked(id); + log.debug(`switch status after the toggle = ${isChecked2}`); await this.closeDimensionEditor(); + await PageObjects.common.sleep(500); await PageObjects.header.waitUntilLoadingHasFinished(); }, diff --git a/x-pack/test/functional/services/ml/dashboard_embeddables.ts b/x-pack/test/functional/services/ml/dashboard_embeddables.ts index 0dc5cc8fae2d5e..5c55a16698cb68 100644 --- a/x-pack/test/functional/services/ml/dashboard_embeddables.ts +++ b/x-pack/test/functional/services/ml/dashboard_embeddables.ts @@ -93,13 +93,21 @@ export function MachineLearningDashboardEmbeddablesProvider( }); }, - async openJobSelectionFlyout() { + async assertAnomalySwimlaneExists() { + await retry.tryForTime(60 * 1000, async () => { + await testSubjects.existOrFail(`mlAnomalySwimlaneEmbeddableWrapper`); + }); + }, + + async openAnomalyJobSelectionFlyout( + mlEmbeddableType: 'ml_anomaly_swimlane' | 'ml_anomaly_charts' + ) { await retry.tryForTime(60 * 1000, async () => { await dashboardAddPanel.clickEditorMenuButton(); await testSubjects.existOrFail('dashboardEditorContextMenu', { timeout: 2000 }); await dashboardAddPanel.clickEmbeddableFactoryGroupButton('ml'); - await dashboardAddPanel.clickAddNewEmbeddableLink('ml_anomaly_charts'); + await dashboardAddPanel.clickAddNewEmbeddableLink(mlEmbeddableType); await mlDashboardJobSelectionTable.assertJobSelectionTableExists(); }); diff --git a/x-pack/test/functional/services/ml/test_resources.ts b/x-pack/test/functional/services/ml/test_resources.ts index 65a892d124edb4..071db63125a55b 100644 --- a/x-pack/test/functional/services/ml/test_resources.ts +++ b/x-pack/test/functional/services/ml/test_resources.ts @@ -128,6 +128,20 @@ export function MachineLearningTestResourcesProvider({ getService }: FtrProvider return createResponse.id; }, + async createBulkSavedObjects(body: object[]): Promise { + log.debug(`Creating bulk saved objects'`); + + const createResponse = await supertest + .post(`/api/saved_objects/_bulk_create`) + .set(COMMON_REQUEST_HEADERS) + .send(body) + .expect(200) + .then((res: any) => res.body); + + log.debug(` > Created bulk saved objects'`); + return createResponse; + }, + async createIndexPatternIfNeeded(title: string, timeFieldName?: string): Promise { const indexPatternId = await this.getIndexPatternId(title); if (indexPatternId !== undefined) { diff --git a/x-pack/test/functional_enterprise_search/services/app_search_service.ts b/x-pack/test/functional_enterprise_search/services/app_search_service.ts index edb3957692f27a..6cd3cac9f336b4 100644 --- a/x-pack/test/functional_enterprise_search/services/app_search_service.ts +++ b/x-pack/test/functional_enterprise_search/services/app_search_service.ts @@ -22,7 +22,7 @@ export interface IUser { user: string; password: string; } -export { IEngine }; +export type { IEngine }; export class AppSearchService { getEnterpriseSearchUser(): IUser { diff --git a/x-pack/test/observability_api_integration/common/ftr_provider_context.ts b/x-pack/test/observability_api_integration/common/ftr_provider_context.ts index 8f59a8d3852815..2ea45b854eb280 100644 --- a/x-pack/test/observability_api_integration/common/ftr_provider_context.ts +++ b/x-pack/test/observability_api_integration/common/ftr_provider_context.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { FtrProviderContext } from '../../api_integration/ftr_provider_context'; +export type { FtrProviderContext } from '../../api_integration/ftr_provider_context'; diff --git a/x-pack/test/plugin_functional/plugins/global_search_test/public/index.ts b/x-pack/test/plugin_functional/plugins/global_search_test/public/index.ts index 43adc3f1036e20..9450384458d09e 100644 --- a/x-pack/test/plugin_functional/plugins/global_search_test/public/index.ts +++ b/x-pack/test/plugin_functional/plugins/global_search_test/public/index.ts @@ -21,7 +21,7 @@ export const plugin: PluginInitializer< GlobalSearchTestPluginStartDeps > = () => new GlobalSearchTestPlugin(); -export { +export type { GlobalSearchTestPluginSetup, GlobalSearchTestPluginStart, GlobalSearchTestPluginSetupDeps, diff --git a/x-pack/test/saved_object_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json b/x-pack/test/saved_object_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json index 84c31dc2b7db60..e7d2c630fc130d 100644 --- a/x-pack/test/saved_object_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json +++ b/x-pack/test/saved_object_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json @@ -57,11 +57,12 @@ "index": ".kibana", "source": { "index-pattern": { - "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"@message\"}}},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"@tags\"}}},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"agent\"}}},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"extension\"}}},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"headings\"}}},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"host\"}}},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"index\"}}},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"links\"}}},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"machine.os\"}}},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.article:section\"}}},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.article:tag\"}}},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:description\"}}},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:image\"}}},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:image:height\"}}},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:image:width\"}}},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:site_name\"}}},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:title\"}}},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:type\"}}},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:url\"}}},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:card\"}}},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:description\"}}},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:image\"}}},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:site\"}}},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:title\"}}},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.url\"}}},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"request\"}}},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"response\"}}},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"spaces\"}}},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"url\"}}},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"xss\"}}}]", "timeFieldName": "@timestamp", "title": "logstash-*" }, + "namespaces": ["default"], "type": "index-pattern", + "migrationVersion": { "index-pattern": "8.0.0" }, "updated_at": "2017-09-21T18:49:16.270Z" }, "type": "doc" @@ -145,16 +146,16 @@ { "type": "doc", "value": { - "id": "space_1:index-pattern:space1-index-pattern-id", + "id": "index-pattern:space1-index-pattern-id", "index": ".kibana", "source": { "index-pattern": { - "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"@message\"}}},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"@tags\"}}},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"agent\"}}},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"extension\"}}},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"headings\"}}},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"host\"}}},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"index\"}}},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"links\"}}},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"machine.os\"}}},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.article:section\"}}},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.article:tag\"}}},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:description\"}}},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:image\"}}},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:image:height\"}}},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:image:width\"}}},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:site_name\"}}},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:title\"}}},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:type\"}}},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:url\"}}},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:card\"}}},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:description\"}}},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:image\"}}},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:site\"}}},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:title\"}}},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.url\"}}},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"request\"}}},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"response\"}}},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"spaces\"}}},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"url\"}}},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"xss\"}}}]", "timeFieldName": "@timestamp", "title": "logstash-*" }, - "namespace": "space_1", + "namespaces": ["space_1"], "type": "index-pattern", + "migrationVersion": { "index-pattern": "8.0.0" }, "updated_at": "2017-09-21T18:49:16.270Z" }, "type": "doc" @@ -240,16 +241,16 @@ { "type": "doc", "value": { - "id": "space_2:index-pattern:space2-index-pattern-id", + "id": "index-pattern:space2-index-pattern-id", "index": ".kibana", "source": { "index-pattern": { - "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"@message\"}}},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"@tags\"}}},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"agent\"}}},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"extension\"}}},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"headings\"}}},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"host\"}}},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"index\"}}},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"links\"}}},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"machine.os\"}}},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.article:section\"}}},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.article:tag\"}}},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:description\"}}},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:image\"}}},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:image:height\"}}},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:image:width\"}}},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:site_name\"}}},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:title\"}}},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:type\"}}},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.og:url\"}}},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:card\"}}},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:description\"}}},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:image\"}}},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:site\"}}},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.twitter:title\"}}},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"relatedContent.url\"}}},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"request\"}}},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"response\"}}},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"spaces\"}}},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"url\"}}},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\": \"xss\"}}}]", "timeFieldName": "@timestamp", "title": "logstash-*" }, - "namespace": "space_2", + "namespaces": ["space_2"], "type": "index-pattern", + "migrationVersion": { "index-pattern": "8.0.0" }, "updated_at": "2017-09-21T18:49:16.270Z" }, "type": "doc" @@ -554,6 +555,22 @@ } } +{ + "type": "doc", + "value": { + "index": ".kibana", + "id": "resolvetype:all_spaces", + "source": { + "type": "resolvetype", + "updated_at": "2017-09-21T18:51:23.794Z", + "resolvetype": { + "title": "This is used to test that 1. the 'disabled' alias does not resolve to this target (because the alias is disabled), and 2. when this object that exists in all spaces is deleted, the alias that targets it is deleted too (even though the alias is disabled)" + }, + "namespaces": ["*"] + } + } +} + { "type": "doc", "value": { @@ -566,7 +583,7 @@ "sourceId": "disabled", "targetNamespace": "space_1", "targetType": "resolvetype", - "targetId": "alias-match-newid", + "targetId": "disabled-newid", "disabled": true } } @@ -585,7 +602,7 @@ "sourceId": "alias-match", "targetNamespace": "space_x", "targetType": "resolvetype", - "targetId": "doesnt-matter" + "targetId": "alias-match-newid" } } } @@ -603,7 +620,7 @@ "sourceId": "alias-match", "targetNamespace": "space_y", "targetType": "resolvetype", - "targetId": "doesnt-matter", + "targetId": "alias-match-newid", "disabled": true } } diff --git a/x-pack/test/saved_object_api_integration/common/suites/delete.ts b/x-pack/test/saved_object_api_integration/common/suites/delete.ts index 844da51d16e80b..4dbd7901a05c4c 100644 --- a/x-pack/test/saved_object_api_integration/common/suites/delete.ts +++ b/x-pack/test/saved_object_api_integration/common/suites/delete.ts @@ -6,7 +6,9 @@ */ import { SuperTest } from 'supertest'; +import type { Client } from '@elastic/elasticsearch'; import expect from '@kbn/expect'; +import type { SearchTotalHits } from '@elastic/elasticsearch/lib/api/types'; import { SAVED_OBJECT_TEST_CASES as CASES } from '../lib/saved_object_test_cases'; import { SPACES } from '../lib/spaces'; import { expectResponses, getUrlPrefix, getTestTitle } from '../lib/saved_object_test_utils'; @@ -21,9 +23,13 @@ export interface DeleteTestCase extends TestCase { failure?: 400 | 403 | 404; } +const ALIAS_DELETE_INCLUSIVE = Object.freeze({ type: 'resolvetype', id: 'alias-match-newid' }); // exists in three specific spaces; deleting this should also delete the alias that targets it in space 1 +const ALIAS_DELETE_EXCLUSIVE = Object.freeze({ type: 'resolvetype', id: 'all_spaces' }); // exists in all spaces; deleting this should also delete the alias that targets it in space 1 const DOES_NOT_EXIST = Object.freeze({ type: 'dashboard', id: 'does-not-exist' }); export const TEST_CASES: Record = Object.freeze({ ...CASES, + ALIAS_DELETE_INCLUSIVE, + ALIAS_DELETE_EXCLUSIVE, DOES_NOT_EXIST, }); @@ -32,7 +38,7 @@ export const TEST_CASES: Record = Object.freeze({ */ const createRequest = ({ type, id, force }: DeleteTestCase) => ({ type, id, force }); -export function deleteTestSuiteFactory(esArchiver: any, supertest: SuperTest) { +export function deleteTestSuiteFactory(es: Client, esArchiver: any, supertest: SuperTest) { const expectSavedObjectForbidden = expectResponses.forbiddenTypes('delete'); const expectResponseBody = (testCase: DeleteTestCase): ExpectResponseBody => @@ -47,6 +53,25 @@ export function deleteTestSuiteFactory(esArchiver: any, supertest: SuperTest testCase.type === type && testCase.id === id + ); + expect((searchResponse.hits.total as SearchTotalHits).value).to.eql( + // Five aliases exist but only one should be deleted in each case (for the "inclusive" case, this asserts that the aliases + // targeting that object in space x and space y were *not* deleted) + expectAliasWasDeleted ? 4 : 5 + ); } } }; diff --git a/x-pack/test/saved_object_api_integration/security_and_spaces/apis/delete.ts b/x-pack/test/saved_object_api_integration/security_and_spaces/apis/delete.ts index 6a6fc8a15decfd..8970070645f4df 100644 --- a/x-pack/test/saved_object_api_integration/security_and_spaces/apis/delete.ts +++ b/x-pack/test/saved_object_api_integration/security_and_spaces/apis/delete.ts @@ -51,6 +51,8 @@ const createTestCases = (spaceId: string) => { }, { ...CASES.MULTI_NAMESPACE_ISOLATED_ONLY_SPACE_1, ...fail404(spaceId !== SPACE_1_ID) }, CASES.NAMESPACE_AGNOSTIC, + { ...CASES.ALIAS_DELETE_INCLUSIVE, force: true }, + { ...CASES.ALIAS_DELETE_EXCLUSIVE, force: true }, { ...CASES.DOES_NOT_EXIST, ...fail404() }, ]; const hiddenType = [{ ...CASES.HIDDEN, ...fail404() }]; @@ -61,8 +63,9 @@ const createTestCases = (spaceId: string) => { export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertestWithoutAuth'); const esArchiver = getService('esArchiver'); + const es = getService('es'); - const { addTests, createTestDefinitions } = deleteTestSuiteFactory(esArchiver, supertest); + const { addTests, createTestDefinitions } = deleteTestSuiteFactory(es, esArchiver, supertest); const createTests = (spaceId: string) => { const { normalTypes, hiddenType, allTypes } = createTestCases(spaceId); return { diff --git a/x-pack/test/saved_object_api_integration/spaces_only/apis/delete.ts b/x-pack/test/saved_object_api_integration/spaces_only/apis/delete.ts index 1a168bac948bef..28674e8fd45aa5 100644 --- a/x-pack/test/saved_object_api_integration/spaces_only/apis/delete.ts +++ b/x-pack/test/saved_object_api_integration/spaces_only/apis/delete.ts @@ -45,6 +45,8 @@ const createTestCases = (spaceId: string) => [ }, { ...CASES.MULTI_NAMESPACE_ISOLATED_ONLY_SPACE_1, ...fail404(spaceId !== SPACE_1_ID) }, CASES.NAMESPACE_AGNOSTIC, + { ...CASES.ALIAS_DELETE_INCLUSIVE, force: true }, + { ...CASES.ALIAS_DELETE_EXCLUSIVE, force: true }, { ...CASES.HIDDEN, ...fail404() }, { ...CASES.DOES_NOT_EXIST, ...fail404() }, ]; @@ -52,8 +54,9 @@ const createTestCases = (spaceId: string) => [ export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const esArchiver = getService('esArchiver'); + const es = getService('es'); - const { addTests, createTestDefinitions } = deleteTestSuiteFactory(esArchiver, supertest); + const { addTests, createTestDefinitions } = deleteTestSuiteFactory(es, esArchiver, supertest); const createTests = (spaceId: string) => { const testCases = createTestCases(spaceId); return createTestDefinitions(testCases, false, { spaceId }); diff --git a/x-pack/test/saved_object_tagging/common/lib/index.ts b/x-pack/test/saved_object_tagging/common/lib/index.ts index ae662def2459c5..9d23dc2541f8c6 100644 --- a/x-pack/test/saved_object_tagging/common/lib/index.ts +++ b/x-pack/test/saved_object_tagging/common/lib/index.ts @@ -5,6 +5,6 @@ * 2.0. */ -export { Role, User, ExpectedResponse } from './types'; +export type { Role, User, ExpectedResponse } from './types'; export { ROLES, USERS } from './authentication'; export { createUsersAndRoles } from './create_users_and_roles'; diff --git a/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/lens.ts b/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/lens.ts index b6dfc29bb1c6bc..1027a44cd8b91a 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/lens.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/lens.ts @@ -9,24 +9,28 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); const dashboardPanelActions = getService('dashboardPanelActions'); const dashboardAddPanel = getService('dashboardAddPanel'); const find = getService('find'); const testSubjects = getService('testSubjects'); + const kibanaServer = getService('kibanaServer'); const PageObjects = getPageObjects(['header', 'common', 'dashboard', 'timePicker', 'lens']); // Dashboard shares a search session with lens when navigating to and from by value lens to hit search cache // https://github.com/elastic/kibana/issues/99310 describe('Search session sharing with lens', () => { before(async () => { - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); }); after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); // NOTE: This test doesn't check if the cache was actually hit, but just checks if the same search session id is used diff --git a/x-pack/test/search_sessions_integration/tests/apps/lens/search_sessions.ts b/x-pack/test/search_sessions_integration/tests/apps/lens/search_sessions.ts index d95e117d1b0330..9690f9be99fc60 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/lens/search_sessions.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/lens/search_sessions.ts @@ -13,14 +13,19 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const searchSession = getService('searchSessions'); const PageObjects = getPageObjects(['visualize', 'lens', 'common', 'timePicker', 'header']); const listingTable = getService('listingTable'); + const kibanaServer = getService('kibanaServer'); describe('lens search sessions', () => { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/lens/basic'); + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' + ); }); it("doesn't shows search sessions indicator UI", async () => { diff --git a/x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json b/x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json index c9b09456a9a492..c5dc147b45123c 100644 --- a/x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json +++ b/x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces/data.json @@ -582,6 +582,94 @@ } } +{ + "type": "doc", + "value": { + "id": "sharedtype:alias_delete_inclusive", + "index": ".kibana", + "source": { + "sharedtype": { + "title": "This is used to test that when an object is unshared from a space, inbound aliases for just those spaces are removed" + }, + "type": "sharedtype", + "namespaces": ["default", "space_1", "space_2"], + "updated_at": "2017-09-21T18:59:16.270Z" + }, + "type": "doc" + } +} + +{ + "type": "doc", + "value": { + "id": "legacy-url-alias:space_1:sharedtype:doesnt-matter", + "index": ".kibana", + "source": { + "type": "legacy-url-alias", + "updated_at": "2017-09-21T18:51:23.794Z", + "legacy-url-alias": { + "sourceId": "doesnt-matter", + "targetNamespace": "space_1", + "targetType": "sharedtype", + "targetId": "alias_delete_inclusive" + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "legacy-url-alias:space_2:sharedtype:doesnt-matter", + "index": ".kibana", + "source": { + "type": "legacy-url-alias", + "updated_at": "2017-09-21T18:51:23.794Z", + "legacy-url-alias": { + "sourceId": "doesnt-matter", + "targetNamespace": "space_2", + "targetType": "sharedtype", + "targetId": "alias_delete_inclusive" + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "sharedtype:alias_delete_exclusive", + "index": ".kibana", + "source": { + "sharedtype": { + "title": "This is used to test that when an object is unshared from all space, inbound aliases for all spaces are removed" + }, + "type": "sharedtype", + "namespaces": ["*"], + "updated_at": "2017-09-21T18:59:16.270Z" + }, + "type": "doc" + } +} + +{ + "type": "doc", + "value": { + "id": "legacy-url-alias:other_space:sharedtype:doesnt-matter", + "index": ".kibana", + "source": { + "type": "legacy-url-alias", + "updated_at": "2017-09-21T18:51:23.794Z", + "legacy-url-alias": { + "sourceId": "doesnt-matter", + "targetNamespace": "other_space", + "targetType": "sharedtype", + "targetId": "alias_delete_exclusive" + } + } + } +} + { "type": "doc", "value": { diff --git a/x-pack/test/spaces_api_integration/common/lib/saved_object_test_cases.ts b/x-pack/test/spaces_api_integration/common/lib/saved_object_test_cases.ts index ddbcf8f5f31c17..8d9af1170f288f 100644 --- a/x-pack/test/spaces_api_integration/common/lib/saved_object_test_cases.ts +++ b/x-pack/test/spaces_api_integration/common/lib/saved_object_test_cases.ts @@ -38,6 +38,14 @@ export const MULTI_NAMESPACE_SAVED_OBJECT_TEST_CASES = Object.freeze({ id: 'all_spaces', existingNamespaces: ['*'], // all current and future spaces }), + ALIAS_DELETE_INCLUSIVE: Object.freeze({ + id: 'alias_delete_inclusive', + existingNamespaces: ['default', 'space_1', 'space_2'], // each individual space + }), + ALIAS_DELETE_EXCLUSIVE: Object.freeze({ + id: 'alias_delete_exclusive', + existingNamespaces: ['*'], // all current and future spaces + }), DOES_NOT_EXIST: Object.freeze({ id: 'does_not_exist', existingNamespaces: [] as string[], diff --git a/x-pack/test/spaces_api_integration/common/suites/delete.ts b/x-pack/test/spaces_api_integration/common/suites/delete.ts index e0f222af707c54..ae8b73535c2c65 100644 --- a/x-pack/test/spaces_api_integration/common/suites/delete.ts +++ b/x-pack/test/spaces_api_integration/common/suites/delete.ts @@ -53,8 +53,8 @@ export function deleteTestSuiteFactory(es: Client, esArchiver: any, supertest: S // @ts-expect-error @elastic/elasticsearch doesn't defined `count.buckets`. const buckets = response.aggregations?.count.buckets; - // The test fixture contains three legacy URL aliases: - // (1) one for "space_1", (2) one for "space_2", and (3) one for "other_space", which is a non-existent space. + // The test fixture contains six legacy URL aliases: + // (1) two for "space_1", (2) two for "space_2", and (3) two for "other_space", which is a non-existent space. // Each test deletes "space_2", so the agg buckets should reflect that aliases (1) and (3) still exist afterwards. // Space 2 deleted, all others should exist @@ -75,26 +75,26 @@ export function deleteTestSuiteFactory(es: Client, esArchiver: any, supertest: S }, }, { - doc_count: 6, + doc_count: 7, key: 'space_1', countByType: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [ { key: 'visualization', doc_count: 3 }, + { key: 'legacy-url-alias', doc_count: 2 }, // aliases (1) { key: 'dashboard', doc_count: 1 }, { key: 'index-pattern', doc_count: 1 }, - { key: 'legacy-url-alias', doc_count: 1 }, // alias (1) ], }, }, { - doc_count: 1, + doc_count: 2, key: 'other_space', countByType: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, - buckets: [{ key: 'legacy-url-alias', doc_count: 1 }], // alias (3) + buckets: [{ key: 'legacy-url-alias', doc_count: 2 }], // aliases (3) }, }, ]; @@ -110,8 +110,8 @@ export function deleteTestSuiteFactory(es: Client, esArchiver: any, supertest: S body: { query: { terms: { type: ['sharedtype'] } } }, }); const docs = multiNamespaceResponse.hits.hits; - // Just 12 results, since spaces_2_only, conflict_1_space_2 and conflict_2_space_2 got deleted. - expect(docs).length(12); + // Just 14 results, since spaces_2_only, conflict_1_space_2 and conflict_2_space_2 got deleted. + expect(docs).length(14); docs.forEach((doc) => () => { const containsSpace2 = doc?._source?.namespaces.includes('space_2'); expect(containsSpace2).to.eql(false); diff --git a/x-pack/test/spaces_api_integration/common/suites/update_objects_spaces.ts b/x-pack/test/spaces_api_integration/common/suites/update_objects_spaces.ts index ecd0d15b522e17..3b795ae719db8d 100644 --- a/x-pack/test/spaces_api_integration/common/suites/update_objects_spaces.ts +++ b/x-pack/test/spaces_api_integration/common/suites/update_objects_spaces.ts @@ -6,6 +6,8 @@ */ import expect from '@kbn/expect'; +import type { Client } from '@elastic/elasticsearch'; +import type { SearchTotalHits } from '@elastic/elasticsearch/lib/api/types'; import { without, uniq } from 'lodash'; import { SuperTest } from 'supertest'; import { @@ -35,6 +37,7 @@ export interface UpdateObjectsSpacesTestCase { objects: Array<{ id: string; existingNamespaces: string[]; + expectAliasDifference?: number; failure?: 400 | 404; }>; spacesToAdd: string[]; @@ -54,7 +57,11 @@ const getTestTitle = ({ objects, spacesToAdd, spacesToRemove }: UpdateObjectsSpa return `{objects: [${objStr}], spacesToAdd: [${addStr}], spacesToRemove: [${remStr}]}`; }; -export function updateObjectsSpacesTestSuiteFactory(esArchiver: any, supertest: SuperTest) { +export function updateObjectsSpacesTestSuiteFactory( + es: Client, + esArchiver: any, + supertest: SuperTest +) { const expectForbidden = expectResponses.forbiddenTypes('share_to_space'); const expectResponseBody = ( @@ -68,7 +75,10 @@ export function updateObjectsSpacesTestSuiteFactory(esArchiver: any, supertest: } else { const { objects, spacesToAdd, spacesToRemove } = testCase; const apiResponse = response.body as SavedObjectsUpdateObjectsSpacesResponse; - objects.forEach(({ id, existingNamespaces, failure }, i) => { + + let hasRefreshed = false; + for (let i = 0; i < objects.length; i++) { + const { id, existingNamespaces, expectAliasDifference, failure } = objects[i]; const object = apiResponse.objects[i]; if (failure === 404) { const error = SavedObjectsErrorHelpers.createGenericNotFoundError(TYPE, id); @@ -84,8 +94,28 @@ export function updateObjectsSpacesTestSuiteFactory(esArchiver: any, supertest: expect(result.type).to.eql(TYPE); expect(result.id).to.eql(id); expect(result.spaces.sort()).to.eql(expectedSpaces.sort()); + + if (expectAliasDifference !== undefined) { + // if we deleted an object that had an alias pointing to it, the alias should have been deleted as well + if (!hasRefreshed) { + await es.indices.refresh({ index: '.kibana' }); // alias deletion uses refresh: false, so we need to manually refresh the index before searching + hasRefreshed = true; + } + const searchResponse = await es.search({ + index: '.kibana', + body: { + size: 0, + query: { terms: { type: ['legacy-url-alias'] } }, + track_total_hits: true, + }, + }); + expect((searchResponse.hits.total as SearchTotalHits).value).to.eql( + // Six aliases exist in the test fixtures + 6 + expectAliasDifference + ); + } } - }); + } } }; const createTestDefinitions = ( diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/update_objects_spaces.ts b/x-pack/test/spaces_api_integration/security_and_spaces/apis/update_objects_spaces.ts index 36f50aa165e72d..c6a97337e6ad93 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/update_objects_spaces.ts +++ b/x-pack/test/spaces_api_integration/security_and_spaces/apis/update_objects_spaces.ts @@ -28,6 +28,8 @@ const { fail404 } = testCaseFailures; const createTestCases = (spaceId: string): UpdateObjectsSpacesTestCase[] => { const eachSpace = [DEFAULT_SPACE_ID, SPACE_1_ID, SPACE_2_ID]; + // Note: we intentionally exclude ALIAS_DELETION test cases because they are already covered in spaces_only test suite, and there is no + // authZ-specific logic that affects alias deletion, all of that happens at the Saved Objects Repository level. return [ // Test case to check adding and removing all spaces ("*") to a saved object { @@ -125,8 +127,10 @@ const calculateSingleSpaceAuthZ = (testCases: UpdateObjectsSpacesTestCase[], spa export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertestWithoutAuth'); const esArchiver = getService('esArchiver'); + const es = getService('es'); const { addTests, createTestDefinitions } = updateObjectsSpacesTestSuiteFactory( + es, esArchiver, supertest ); diff --git a/x-pack/test/spaces_api_integration/spaces_only/apis/update_objects_spaces.ts b/x-pack/test/spaces_api_integration/spaces_only/apis/update_objects_spaces.ts index 865d5eca22cbd8..fc95f513f55195 100644 --- a/x-pack/test/spaces_api_integration/spaces_only/apis/update_objects_spaces.ts +++ b/x-pack/test/spaces_api_integration/spaces_only/apis/update_objects_spaces.ts @@ -11,6 +11,7 @@ import { getTestScenarios, } from '../../../saved_object_api_integration/common/lib/saved_object_test_utils'; import { MULTI_NAMESPACE_SAVED_OBJECT_TEST_CASES as CASES } from '../../common/lib/saved_object_test_cases'; +import type { UpdateObjectsSpacesTestCase } from '../../common/suites/update_objects_spaces'; import { updateObjectsSpacesTestSuiteFactory } from '../../common/suites/update_objects_spaces'; import { FtrProviderContext } from '../../common/ftr_provider_context'; @@ -51,7 +52,55 @@ const createSinglePartTestCases = (spaceId: string) => { const createMultiPartTestCases = () => { const nonExistentSpace = 'does_not_exist'; // space that doesn't exist const eachSpace = [DEFAULT_SPACE_ID, SPACE_1_ID, SPACE_2_ID]; - const group1 = [ + const group1: UpdateObjectsSpacesTestCase[] = [ + // These test cases ensure that aliases are deleted when objects are unshared. + // For simplicity these are done separately, before the others. + { + objects: [ + { + id: CASES.ALIAS_DELETE_INCLUSIVE.id, + existingNamespaces: eachSpace, + expectAliasDifference: -1, // one alias should have been deleted from space_2 + }, + ], + spacesToAdd: [], + spacesToRemove: [SPACE_2_ID], + }, + { + objects: [ + { + id: CASES.ALIAS_DELETE_INCLUSIVE.id, + existingNamespaces: [DEFAULT_SPACE_ID, SPACE_1_ID], + expectAliasDifference: -2, // one alias should have been deleted from space_1 + }, + ], + spacesToAdd: [], + spacesToRemove: [SPACE_1_ID], + }, + { + objects: [ + { + id: CASES.ALIAS_DELETE_INCLUSIVE.id, + existingNamespaces: [DEFAULT_SPACE_ID], + expectAliasDifference: -2, // no aliases can exist in the default space, so no aliases were deleted + }, + ], + spacesToAdd: [], + spacesToRemove: [DEFAULT_SPACE_ID], + }, + { + objects: [ + { + id: CASES.ALIAS_DELETE_EXCLUSIVE.id, + existingNamespaces: [SPACE_1_ID], + expectAliasDifference: -3, // one alias should have been deleted from other_space + }, + ], + spacesToAdd: [SPACE_1_ID], + spacesToRemove: ['*'], + }, + ]; + const group2 = [ // first, add this object to each space and remove it from nonExistentSpace // this will succeed even though the object already exists in the default space and it doesn't exist in nonExistentSpace { objects: [CASES.DEFAULT_ONLY], spacesToAdd: eachSpace, spacesToRemove: [nonExistentSpace] }, @@ -87,7 +136,7 @@ const createMultiPartTestCases = () => { spacesToRemove: [SPACE_1_ID], }, ]; - const group2 = [ + const group3 = [ // first, add this object to space_2 and remove it from space_1 { objects: [CASES.DEFAULT_AND_SPACE_1], @@ -111,15 +160,17 @@ const createMultiPartTestCases = () => { spacesToRemove: [], }, ]; - return [...group1, ...group2]; + return [...group1, ...group2, ...group3]; }; // eslint-disable-next-line import/no-default-export export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const esArchiver = getService('esArchiver'); + const es = getService('es'); const { addTests, createTestDefinitions } = updateObjectsSpacesTestSuiteFactory( + es, esArchiver, supertest ); diff --git a/x-pack/test/stack_functional_integration/apps/apm/apm_smoke_test.js b/x-pack/test/stack_functional_integration/apps/apm/apm_smoke_test.js index c7809e6abbf4ab..6a653cc95921aa 100644 --- a/x-pack/test/stack_functional_integration/apps/apm/apm_smoke_test.js +++ b/x-pack/test/stack_functional_integration/apps/apm/apm_smoke_test.js @@ -9,20 +9,32 @@ export default function ({ getService, getPageObjects }) { describe('APM smoke test', function ampsmokeTest() { const browser = getService('browser'); const testSubjects = getService('testSubjects'); - const PageObjects = getPageObjects(['common', 'timePicker']); + const PageObjects = getPageObjects(['common', 'timePicker', 'header']); const find = getService('find'); const log = getService('log'); + const retry = getService('retry'); before(async () => { await browser.setWindowSize(1400, 1400); await PageObjects.common.navigateToApp('apm'); + await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year'); + await PageObjects.header.waitUntilLoadingHasFinished(); }); it('can navigate to APM app', async () => { await testSubjects.existOrFail('apmMainContainer', { timeout: 10000, }); + // wait for this last change on the page; + // This table contains 1 rows out of 1 rows; Page 1 of 1. + // but "" always exists so we have to wait until there's text + await retry.waitForWithTimeout('The APM table has a caption', 5000, async () => { + return (await (await find.byCssSelector('caption')).getAttribute('innerHTML')).includes( + 'This table contains ' + ); + }); + await find.clickByDisplayedLinkText('apm-a-rum-test-e2e-general-usecase'); log.debug('### apm smoke test passed'); await find.clickByLinkText('general-usecase-initial-p-load'); diff --git a/x-pack/test/timeline/common/config.ts b/x-pack/test/timeline/common/config.ts index 211f380b133a55..75f0eb24a6cd9a 100644 --- a/x-pack/test/timeline/common/config.ts +++ b/x-pack/test/timeline/common/config.ts @@ -7,6 +7,7 @@ import { CA_CERT_PATH } from '@kbn/dev-utils'; import { FtrConfigProviderContext } from '@kbn/test'; +import { resolve } from 'path'; import { services } from './services'; import { getAllExternalServiceSimulatorPaths } from '../../alerting_api_integration/common/fixtures/plugins/actions_simulators/server/plugin'; @@ -40,6 +41,7 @@ const enabledActionTypes = [ export function createTestConfig(name: string, options: CreateTestConfigOptions) { const { license = 'trial', disabledPlugins = [], ssl = false, testFiles = [] } = options; + const auditLogPath = resolve(__dirname, './audit.log'); return async ({ readConfigFile }: FtrConfigProviderContext) => { const xPackApiIntegrationTestsConfig = await readConfigFile( @@ -85,6 +87,10 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions) // TO DO: Remove feature flags once we're good to go '--xpack.securitySolution.enableExperimental=["ruleRegistryEnabled"]', '--xpack.ruleRegistry.write.enabled=true', + '--xpack.security.audit.enabled=true', + '--xpack.security.audit.appender.type=file', + `--xpack.security.audit.appender.fileName=${auditLogPath}`, + '--xpack.security.audit.appender.layout.type=json', `--server.xsrf.allowlist=${JSON.stringify(getAllExternalServiceSimulatorPaths())}`, ...(ssl ? [ diff --git a/x-pack/test/timeline/security_and_spaces/tests/trial/events.ts b/x-pack/test/timeline/security_and_spaces/tests/trial/events.ts index 91ad87737805f7..2ccfa7526df061 100644 --- a/x-pack/test/timeline/security_and_spaces/tests/trial/events.ts +++ b/x-pack/test/timeline/security_and_spaces/tests/trial/events.ts @@ -5,9 +5,11 @@ * 2.0. */ +import Path from 'path'; +import Fs from 'fs'; import { JsonObject } from '@kbn/utility-types'; import expect from '@kbn/expect'; -import { ALERT_UUID, ALERT_RULE_CONSUMER } from '@kbn/rule-data-utils'; +import { ALERT_RULE_CONSUMER } from '@kbn/rule-data-utils'; import { User } from '../../../../rule_registry/common/lib/authentication/types'; import { TimelineEdges, TimelineNonEcsData } from '../../../../../plugins/timelines/common/'; @@ -18,6 +20,7 @@ import { obsMinReadAlertsReadSpacesAll, obsMinRead, obsMinReadSpacesAll, + superUser, } from '../../../../rule_registry/common/lib/authentication/users'; import { Direction, @@ -25,6 +28,28 @@ import { } from '../../../../../plugins/security_solution/common/search_strategy'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; +class FileWrapper { + constructor(private readonly path: string) {} + async reset() { + // "touch" each file to ensure it exists and is empty before each test + await Fs.promises.writeFile(this.path, ''); + } + async read() { + const content = await Fs.promises.readFile(this.path, { encoding: 'utf8' }); + return content.trim().split('\n'); + } + async readJSON() { + const content = await this.read(); + return content.map((l) => JSON.parse(l)); + } + // writing in a file is an async operation. we use this method to make sure logs have been written. + async isNotEmpty() { + const content = await this.read(); + const line = content[0]; + return line.length > 0; + } +} + interface TestCase { /** The space where the alert exists */ space?: string; @@ -44,6 +69,7 @@ const TO = '3000-01-01T00:00:00.000Z'; const FROM = '2000-01-01T00:00:00.000Z'; const TEST_URL = '/internal/search/timelineSearchStrategy/'; const SPACE_1 = 'space1'; +const SPACE_2 = 'space2'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext) => { @@ -56,18 +82,9 @@ export default ({ getService }: FtrProviderContext) => { { field: '@timestamp', }, - { - field: ALERT_RULE_CONSUMER, - }, - { - field: ALERT_UUID, - }, - { - field: 'event.kind', - }, ], factoryQueryType: TimelineEventsQueries.all, - fieldRequested: ['@timestamp', 'message', ALERT_RULE_CONSUMER, ALERT_UUID, 'event.kind'], + fieldRequested: ['@timestamp'], fields: [], filterQuery: { bool: { @@ -98,6 +115,10 @@ export default ({ getService }: FtrProviderContext) => { }); describe('Timeline - Events', () => { + const logFilePath = Path.resolve(__dirname, '../../../common/audit.log'); + const logFile = new FileWrapper(logFilePath); + const retry = getService('retry'); + before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/rule_registry/alerts'); }); @@ -162,14 +183,15 @@ export default ({ getService }: FtrProviderContext) => { }); } - describe('alerts authentication', () => { + // TODO - tests need to be updated with new table logic + describe.skip('alerts authentication', () => { addTests({ space: SPACE_1, featureIds: ['apm'], expectedNumberAlerts: 2, body: { ...getPostBody(), - defaultIndex: ['.alerts-*'], + defaultIndex: ['.alerts*'], entityType: 'alerts', alertConsumers: ['apm'], }, @@ -177,5 +199,80 @@ export default ({ getService }: FtrProviderContext) => { unauthorizedUsers: [obsMinRead, obsMinReadSpacesAll], }); }); + + describe('logging', () => { + beforeEach(async () => { + await logFile.reset(); + }); + + afterEach(async () => { + await logFile.reset(); + }); + + it('logs success events when reading alerts', async () => { + await supertestWithoutAuth + .post(`${getSpaceUrlPrefix(SPACE_1)}${TEST_URL}`) + .auth(superUser.username, superUser.password) + .set('kbn-xsrf', 'true') + .set('Content-Type', 'application/json') + .send({ + ...getPostBody(), + defaultIndex: ['.alerts-*'], + entityType: 'alerts', + alertConsumers: ['apm'], + }) + .expect(200); + await retry.waitFor('logs event in the dest file', async () => await logFile.isNotEmpty()); + + const content = await logFile.readJSON(); + + const httpEvent = content.find((c) => c.event.action === 'http_request'); + expect(httpEvent).to.be.ok(); + expect(httpEvent.trace.id).to.be.ok(); + expect(httpEvent.user.name).to.be(superUser.username); + expect(httpEvent.kibana.space_id).to.be('space1'); + expect(httpEvent.http.request.method).to.be('post'); + expect(httpEvent.url.path).to.be('/s/space1/internal/search/timelineSearchStrategy/'); + + const findEvents = content.filter((c) => c.event.action === 'alert_find'); + expect(findEvents[0].trace.id).to.be.ok(); + expect(findEvents[0].event.outcome).to.be('success'); + expect(findEvents[0].user.name).to.be(superUser.username); + expect(findEvents[0].kibana.space_id).to.be('space1'); + }); + + it('logs failure events when unauthorized to read alerts', async () => { + await supertestWithoutAuth + .post(`${getSpaceUrlPrefix(SPACE_2)}${TEST_URL}`) + .auth(obsMinRead.username, obsMinRead.password) + .set('kbn-xsrf', 'true') + .set('Content-Type', 'application/json') + .send({ + ...getPostBody(), + defaultIndex: ['.alerts-*'], + entityType: 'alerts', + alertConsumers: ['apm'], + }) + .expect(500); + await retry.waitFor('logs event in the dest file', async () => await logFile.isNotEmpty()); + + const content = await logFile.readJSON(); + + const httpEvent = content.find((c) => c.event.action === 'http_request'); + expect(httpEvent).to.be.ok(); + expect(httpEvent.trace.id).to.be.ok(); + expect(httpEvent.user.name).to.be(obsMinRead.username); + expect(httpEvent.kibana.space_id).to.be(SPACE_2); + expect(httpEvent.http.request.method).to.be('post'); + expect(httpEvent.url.path).to.be('/s/space2/internal/search/timelineSearchStrategy/'); + + const findEvents = content.filter((c) => c.event.action === 'alert_find'); + expect(findEvents.length).to.equal(1); + expect(findEvents[0].trace.id).to.be.ok(); + expect(findEvents[0].event.outcome).to.be('failure'); + expect(findEvents[0].user.name).to.be(obsMinRead.username); + expect(findEvents[0].kibana.space_id).to.be(SPACE_2); + }); + }); }); }; diff --git a/yarn.lock b/yarn.lock index 1e99d54dcf4239..4eecb11e4b0b83 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2337,10 +2337,10 @@ dependencies: object-hash "^1.3.0" -"@elastic/charts@38.1.0": - version "38.1.0" - resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-38.1.0.tgz#52146564c0e399da2267c10ec4536c33e50969e4" - integrity sha512-u2hQ8+daCvqapKQiFqN8QHWTz3OXby5Xf/ta1Dv59KTDTFIinCZD/M8PyD3MapbKx4b67hL7UxbErqr4rZ8jeA== +"@elastic/charts@38.1.3": + version "38.1.3" + resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-38.1.3.tgz#0bf27021c54176e87d38269613205f3d6219da96" + integrity sha512-p6bJQWmfJ5SLkcgAoAMB3eTah/2a3/r3uo3ZskEN/xdPiqU8P+GANF8+6F4dWNfejbrpSUyCUldl7S4nWFGg3Q== dependencies: "@popperjs/core" "^2.4.0" chroma-js "^2.1.0" @@ -6429,15 +6429,10 @@ "@types/parse5" "*" "@types/tough-cookie" "*" -"@types/json-schema@*", "@types/json-schema@^7.0.4": - version "7.0.5" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd" - integrity sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ== - -"@types/json-schema@^7.0.6", "@types/json-schema@^7.0.7": - version "7.0.7" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad" - integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA== +"@types/json-schema@*", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.7", "@types/json-schema@^7.0.9": + version "7.0.9" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" + integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== "@types/json-stable-stringify@^1.0.32": version "1.0.32" @@ -7350,20 +7345,33 @@ resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d" integrity sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg== -"@typescript-eslint/eslint-plugin@^4.31.2": - version "4.31.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.31.2.tgz#9f41efaee32cdab7ace94b15bd19b756dd099b0a" - integrity sha512-w63SCQ4bIwWN/+3FxzpnWrDjQRXVEGiTt9tJTRptRXeFvdZc/wLiz3FQUwNQ2CVoRGI6KUWMNUj/pk63noUfcA== +"@typescript-eslint/eslint-plugin@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.2.0.tgz#2bdb247cc2e2afce7efbce09afb9a6f0a8a08434" + integrity sha512-qQwg7sqYkBF4CIQSyRQyqsYvP+g/J0To9ZPVNJpfxfekl5RmdvQnFFTVVwpRtaUDFNvjfe/34TgY/dpc3MgNTw== dependencies: - "@typescript-eslint/experimental-utils" "4.31.2" - "@typescript-eslint/scope-manager" "4.31.2" - debug "^4.3.1" + "@typescript-eslint/experimental-utils" "5.2.0" + "@typescript-eslint/scope-manager" "5.2.0" + debug "^4.3.2" functional-red-black-tree "^1.0.1" - regexpp "^3.1.0" + ignore "^5.1.8" + regexpp "^3.2.0" semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/experimental-utils@4.31.2", "@typescript-eslint/experimental-utils@^4.0.1": +"@typescript-eslint/experimental-utils@5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.2.0.tgz#e3b2cb9cd0aff9b50f68d9a414c299fd26b067e6" + integrity sha512-fWyT3Agf7n7HuZZRpvUYdFYbPk3iDCq6fgu3ulia4c7yxmPnwVBovdSOX7RL+k8u6hLbrXcdAehlWUVpGh6IEw== + dependencies: + "@types/json-schema" "^7.0.9" + "@typescript-eslint/scope-manager" "5.2.0" + "@typescript-eslint/types" "5.2.0" + "@typescript-eslint/typescript-estree" "5.2.0" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + +"@typescript-eslint/experimental-utils@^4.0.1": version "4.31.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.31.2.tgz#98727a9c1e977dd5d20c8705e69cd3c2a86553fa" integrity sha512-3tm2T4nyA970yQ6R3JZV9l0yilE2FedYg8dcXrTar34zC9r6JB7WyBQbpIVongKPlhEMjhQ01qkwrzWy38Bk1Q== @@ -7375,15 +7383,15 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/parser@^4.31.2": - version "4.31.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.31.2.tgz#54aa75986e3302d91eff2bbbaa6ecfa8084e9c34" - integrity sha512-EcdO0E7M/sv23S/rLvenHkb58l3XhuSZzKf6DBvLgHqOYdL6YFMYVtreGFWirxaU2mS1GYDby3Lyxco7X5+Vjw== +"@typescript-eslint/parser@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.2.0.tgz#dc081aa89de16b5676b10215519af3aa7b58fb72" + integrity sha512-Uyy4TjJBlh3NuA8/4yIQptyJb95Qz5PX//6p8n7zG0QnN4o3NF9Je3JHbVU7fxf5ncSXTmnvMtd/LDQWDk0YqA== dependencies: - "@typescript-eslint/scope-manager" "4.31.2" - "@typescript-eslint/types" "4.31.2" - "@typescript-eslint/typescript-estree" "4.31.2" - debug "^4.3.1" + "@typescript-eslint/scope-manager" "5.2.0" + "@typescript-eslint/types" "5.2.0" + "@typescript-eslint/typescript-estree" "5.2.0" + debug "^4.3.2" "@typescript-eslint/scope-manager@4.31.2": version "4.31.2" @@ -7393,12 +7401,25 @@ "@typescript-eslint/types" "4.31.2" "@typescript-eslint/visitor-keys" "4.31.2" +"@typescript-eslint/scope-manager@5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.2.0.tgz#7ce8e4ab2baaa0ad5282913ea8e13ce03ec6a12a" + integrity sha512-RW+wowZqPzQw8MUFltfKYZfKXqA2qgyi6oi/31J1zfXJRpOn6tCaZtd9b5u9ubnDG2n/EMvQLeZrsLNPpaUiFQ== + dependencies: + "@typescript-eslint/types" "5.2.0" + "@typescript-eslint/visitor-keys" "5.2.0" + "@typescript-eslint/types@4.31.2": version "4.31.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.31.2.tgz#2aea7177d6d744521a168ed4668eddbd912dfadf" integrity sha512-kWiTTBCTKEdBGrZKwFvOlGNcAsKGJSBc8xLvSjSppFO88AqGxGNYtF36EuEYG6XZ9vT0xX8RNiHbQUKglbSi1w== -"@typescript-eslint/typescript-estree@4.31.2", "@typescript-eslint/typescript-estree@^4.31.2": +"@typescript-eslint/types@5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.2.0.tgz#7ad32d15abddb0ee968a330f0ea182ea544ef7cf" + integrity sha512-cTk6x08qqosps6sPyP2j7NxyFPlCNsJwSDasqPNjEQ8JMD5xxj2NHxcLin5AJQ8pAVwpQ8BMI3bTxR0zxmK9qQ== + +"@typescript-eslint/typescript-estree@4.31.2": version "4.31.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.31.2.tgz#abfd50594d8056b37e7428df3b2d185ef2d0060c" integrity sha512-ieBq8U9at6PvaC7/Z6oe8D3czeW5d//Fo1xkF/s9394VR0bg/UaMYPdARiWyKX+lLEjY3w/FNZJxitMsiWv+wA== @@ -7411,6 +7432,19 @@ semver "^7.3.5" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.2.0", "@typescript-eslint/typescript-estree@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.2.0.tgz#c22e0ff6f8a4a3f78504a80ebd686fe2870a68ae" + integrity sha512-RsdXq2XmVgKbm9nLsE3mjNUM7BTr/K4DYR9WfFVMUuozHWtH5gMpiNZmtrMG8GR385EOSQ3kC9HiEMJWimxd/g== + dependencies: + "@typescript-eslint/types" "5.2.0" + "@typescript-eslint/visitor-keys" "5.2.0" + debug "^4.3.2" + globby "^11.0.4" + is-glob "^4.0.3" + semver "^7.3.5" + tsutils "^3.21.0" + "@typescript-eslint/visitor-keys@4.31.2": version "4.31.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.31.2.tgz#7d5b4a4705db7fe59ecffb273c1d082760f635cc" @@ -7419,6 +7453,14 @@ "@typescript-eslint/types" "4.31.2" eslint-visitor-keys "^2.0.0" +"@typescript-eslint/visitor-keys@5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.2.0.tgz#03522d35df98474f08e0357171a7d1b259a88f55" + integrity sha512-Nk7HizaXWWCUBfLA/rPNKMzXzWS8Wg9qHMuGtT+v2/YpPij4nVXrVJc24N/r5WrrmqK31jCrZxeHqIgqRzs0Xg== + dependencies: + "@typescript-eslint/types" "5.2.0" + eslint-visitor-keys "^3.0.0" + "@ungap/promise-all-settled@1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" @@ -13962,16 +14004,16 @@ eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== -eslint-visitor-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" - integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== - -eslint-visitor-keys@^2.1.0: +eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== +eslint-visitor-keys@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186" + integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q== + eslint@^7.32.0: version "7.32.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" @@ -15659,10 +15701,10 @@ globby@^10.0.1: merge2 "^1.2.3" slash "^3.0.0" -globby@^11.0.1, globby@^11.0.3: - version "11.0.3" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.3.tgz#9b1f0cb523e171dd1ad8c7b2a9fb4b644b9593cb" - integrity sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg== +globby@^11.0.1, globby@^11.0.3, globby@^11.0.4: + version "11.0.4" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5" + integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg== dependencies: array-union "^2.1.0" dir-glob "^3.0.1" @@ -17289,10 +17331,10 @@ is-glob@^3.0.0, is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" - integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" @@ -24806,10 +24848,10 @@ regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.3.0, regexp.prototype.f call-bind "^1.0.2" define-properties "^1.1.3" -regexpp@^3.0.0, regexpp@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" - integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== +regexpp@^3.0.0, regexpp@^3.1.0, regexpp@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== regexpu-core@^4.7.1: version "4.7.1"