From 92a8636f0ff63ab072527574e96e6616327b2ea4 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Thu, 2 Dec 2021 16:27:41 -0800 Subject: [PATCH 01/62] Upgrade Typescript to 4.3.5 (#104470) Co-authored-by: Mikhail Shustov Co-authored-by: Dario Gieselaar Co-authored-by: CJ Cenizal Co-authored-by: Justin Kambic Co-authored-by: Stratoula Kalafateli Co-authored-by: Jean-Louis Leysens Co-authored-by: Kyle Pollich Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Co-authored-by: Kevin Qualters Co-authored-by: Candace Park Co-authored-by: Brian Seeders Co-authored-by: spalger --- ...core-public.scopedhistory._constructor_.md | 4 +- ...-plugin-core-public.scopedhistory.block.md | 2 +- ...e-public.scopedhistory.createsubhistory.md | 2 +- ...kibana-plugin-core-public.scopedhistory.md | 4 +- ...lugin-core-server.kibanaresponsefactory.md | 32 +- package.json | 10 +- packages/kbn-alerts/BUILD.bazel | 2 - packages/kbn-alerts/tsconfig.json | 2 +- .../buid_api_declaration.test.ts | 3 +- .../build_basic_api_declaration.ts | 2 +- .../build_api_declarations/js_doc_utils.ts | 4 +- .../src/api_docs/mdx/write_plugin_mdx_docs.ts | 2 +- .../src/api_docs/tests/api_doc_suite.test.ts | 2 +- .../api_docs/tests/snapshots/plugin_a.json | 6 +- .../src/api_docs/tests/snapshots/plugin_a.mdx | 2 +- .../api_docs/tests/snapshots/plugin_a_foo.mdx | 2 +- .../src/api_docs/tests/snapshots/plugin_b.mdx | 2 +- packages/kbn-field-types/BUILD.bazel | 1 - packages/kbn-optimizer/BUILD.bazel | 2 - packages/kbn-pm/dist/index.js | 8490 +++++++---------- packages/kbn-react-field/BUILD.bazel | 1 - packages/kbn-react-field/tsconfig.json | 1 - .../BUILD.bazel | 2 - .../tsconfig.json | 2 +- packages/kbn-storybook/src/webpack.config.ts | 6 +- packages/kbn-test/src/jest/run.ts | 5 +- .../kbn-typed-react-router-config/BUILD.bazel | 1 + .../src/create_router.test.tsx | 2 + .../src/create_router.ts | 14 +- .../src/types/index.ts | 20 +- packages/kbn-ui-shared-deps-npm/BUILD.bazel | 2 - packages/kbn-ui-shared-deps-npm/tsconfig.json | 1 - packages/kbn-ui-shared-deps-src/tsconfig.json | 1 - src/core/public/application/scoped_history.ts | 11 +- src/core/public/chrome/chrome_service.tsx | 2 +- src/core/public/core_app/core_app.ts | 4 +- .../public/doc_links/doc_links_service.ts | 2 +- .../fatal_errors/fatal_errors_service.tsx | 2 +- .../integrations/integrations_service.ts | 2 +- .../notifications/notifications_service.ts | 4 +- src/core/public/public.api.md | 7 +- .../public/rendering/rendering_service.tsx | 2 +- src/core/public/theme/theme_service.ts | 2 +- .../public/ui_settings/ui_settings_service.ts | 2 +- .../server/context/container/context.mock.ts | 1 - src/core/server/context/context_service.ts | 2 +- src/core/server/http/http_service.mock.ts | 13 +- src/core/server/http/http_service.ts | 4 +- src/core/server/http/router/headers.ts | 16 +- src/core/server/i18n/i18n_service.ts | 4 +- src/core/server/logging/logging_service.ts | 2 +- src/core/server/metrics/metrics_service.ts | 2 +- src/core/server/server.api.md | 33 +- src/core/server/status/status_service.ts | 2 +- src/core/types/elasticsearch/search.ts | 36 +- src/dev/build/build_distributables.ts | 8 +- src/dev/precommit_hook/casing_check_config.js | 1 + src/dev/typescript/run_type_check_cli.ts | 2 +- .../models/sense_editor/sense_editor.ts | 4 +- .../embeddable/grid/dashboard_grid.tsx | 6 +- .../search_interceptor/search_interceptor.ts | 9 +- .../data/public/ui/search_bar/search_bar.tsx | 2 +- .../data/server/search/collectors/usage.ts | 8 +- .../editors/number/number.tsx | 2 +- .../components/scripting_help/test_script.tsx | 2 +- .../components/field_editor/field_editor.tsx | 2 +- .../main/services/discover_search_session.ts | 4 +- src/plugins/discover/public/build_services.ts | 6 +- .../discover/public/kibana_services.ts | 4 +- .../attribute_service/attribute_service.tsx | 12 +- .../embeddable_state_transfer.ts | 4 +- .../common/execution/execution_contract.ts | 6 +- .../expression_types/expression_type.ts | 4 +- .../common/field_formats_registry.ts | 6 +- .../components/vis/input_control_vis.tsx | 6 +- .../public/components/add_data/add_data.tsx | 13 +- .../components/manage_data/manage_data.tsx | 13 +- .../control_group_container_factory.ts | 1 - .../utils/use/use_editor_updates.test.ts | 5 +- test/tsconfig.json | 2 +- tsconfig.base.json | 4 +- typings/resize-observer-polyfill/index.d.ts | 10 + .../drilldown.tsx | 8 +- x-pack/plugins/apm/kibana.json | 4 +- .../plugins/apm/public/application/uxApp.tsx | 1 + .../app/service_inventory/index.tsx | 4 +- .../service_map/Popover/backend_contents.tsx | 1 + .../components/shared/managed_table/index.tsx | 1 + .../shared/time_comparison/index.tsx | 1 + .../apm/public/hooks/use_apm_router.ts | 4 +- .../create_apm_event_client/index.test.ts | 6 +- .../create_apm_event_client/index.ts | 226 +- .../apm/server/lib/helpers/setup_request.ts | 7 +- .../get_transaction_group_stats.ts | 6 +- x-pack/plugins/apm/server/plugin.ts | 6 +- ...ister_transaction_error_rate_alert_type.ts | 38 +- .../apm/server/routes/data_view/route.ts | 13 +- .../get_error_group_main_statistics.ts | 1 + .../service_map/get_service_anomalies.ts | 1 + ...ervice_instances_transaction_statistics.ts | 1 + .../settings/apm_indices/get_apm_indices.ts | 2 +- .../server/routes/traces/get_trace_items.ts | 6 +- x-pack/plugins/apm/server/routes/typings.ts | 11 +- x-pack/plugins/apm/server/types.ts | 160 +- .../abstract_dashboard_drilldown.tsx | 13 +- .../utils/saved_search_utils.test.ts | 2 +- .../accordion_list.test.tsx | 4 +- .../components/crawl_requests_table.test.tsx | 2 + .../components/crawl_requests_table.tsx | 7 +- .../credentials_list.test.tsx | 4 +- .../ignored_queries_panel.test.tsx | 1 + .../error_pages/components/no_data_layout.tsx | 2 +- .../field_manager/field_manager.test.tsx | 2 +- .../graph/public/state_management/fields.ts | 4 +- .../public/state_management/persistence.ts | 16 +- .../graph/public/state_management/store.ts | 2 +- .../public/state_management/workspace.ts | 12 +- .../plugins/graph/public/types/app_state.ts | 2 +- .../components/mappings_editor/reducer.ts | 2 - .../expression_editor/criterion.tsx | 6 +- .../log_text_stream/loading_item_view.tsx | 2 +- .../pipelines_create/pipelines_create.tsx | 10 +- .../maps/public/actions/layer_actions.ts | 8 +- .../tooltip_selector/tooltip_selector.tsx | 2 + .../feature_geometry_filter_form.tsx | 4 +- .../ml/server/lib/alerts/alerting_service.ts | 3 +- .../data_recognizer/data_recognizer.test.ts | 2 +- .../public/routes/live_queries/new/index.tsx | 6 +- .../reporting_api_client.ts | 8 +- .../rule_data_client/rule_data_client.mock.ts | 1 + .../utils/create_lifecycle_executor.test.ts | 1 + .../utils/create_lifecycle_rule_type.test.ts | 1 + .../management/users/edit_user/user_form.tsx | 2 +- .../common/endpoint/schema/trusted_apps.ts | 6 +- .../security_solution/cypress/tsconfig.json | 1 - .../public/common/mock/utils.ts | 2 +- .../detection_engine/rules/helpers.test.tsx | 3 +- .../public/management/index.ts | 2 +- .../view/side_effect_simulator_factory.ts | 9 +- .../timelines/components/timeline/styles.tsx | 4 +- .../signals/query_signals_route.test.ts | 1 + .../detection_engine/signals/utils.test.ts | 2 +- .../security_solution/index.ts | 16 +- .../public/components/t_grid/styles.tsx | 4 +- .../lib/reindexing/credential_store.test.ts | 18 +- .../monitor_list/use_monitor_histogram.ts | 1 + .../uptime/public/state/alerts/alerts.ts | 8 +- .../uptime/public/state/effects/alerts.ts | 32 +- .../public/state/effects/fetch_effect.ts | 4 +- .../uptime/public/state/effects/journey.ts | 8 +- .../uptime/public/state/effects/ml_anomaly.ts | 30 +- .../public/state/effects/network_events.ts | 47 +- x-pack/plugins/uptime/public/state/index.ts | 3 +- .../uptime/public/state/selectors/index.ts | 2 +- .../server/lib/requests/get_monitor_status.ts | 1 + .../lib/requests/get_ping_histogram.test.ts | 38 + .../server/lib/requests/get_ping_histogram.ts | 2 +- .../services/observability/users.ts | 1 - yarn.lock | 81 +- 159 files changed, 4022 insertions(+), 5878 deletions(-) create mode 100644 typings/resize-observer-polyfill/index.d.ts diff --git a/docs/development/core/public/kibana-plugin-core-public.scopedhistory._constructor_.md b/docs/development/core/public/kibana-plugin-core-public.scopedhistory._constructor_.md index 32b0950aa1065..67264a26ac5db 100644 --- a/docs/development/core/public/kibana-plugin-core-public.scopedhistory._constructor_.md +++ b/docs/development/core/public/kibana-plugin-core-public.scopedhistory._constructor_.md @@ -9,13 +9,13 @@ Constructs a new instance of the `ScopedHistory` class Signature: ```typescript -constructor(parentHistory: History, basePath: string); +constructor(parentHistory: History, basePath: string); ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| parentHistory | History | | +| parentHistory | History<HistoryLocationState> | | | basePath | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.scopedhistory.block.md b/docs/development/core/public/kibana-plugin-core-public.scopedhistory.block.md index eb632465e4699..acbb06c6aa6ec 100644 --- a/docs/development/core/public/kibana-plugin-core-public.scopedhistory.block.md +++ b/docs/development/core/public/kibana-plugin-core-public.scopedhistory.block.md @@ -9,5 +9,5 @@ Add a block prompt requesting user confirmation when navigating away from the cu Signature: ```typescript -block: (prompt?: string | boolean | History.TransitionPromptHook | undefined) => UnregisterCallback; +block: (prompt?: string | boolean | TransitionPromptHook | undefined) => UnregisterCallback; ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.scopedhistory.createsubhistory.md b/docs/development/core/public/kibana-plugin-core-public.scopedhistory.createsubhistory.md index a976eeed912b2..7c5dfccb5b008 100644 --- a/docs/development/core/public/kibana-plugin-core-public.scopedhistory.createsubhistory.md +++ b/docs/development/core/public/kibana-plugin-core-public.scopedhistory.createsubhistory.md @@ -9,5 +9,5 @@ Creates a `ScopedHistory` for a subpath of this `ScopedHistory`. Useful Signature: ```typescript -createSubHistory: (basePath: string) => ScopedHistory; +createSubHistory: (basePath: string) => ScopedHistory; ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md b/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md index 0d04fc3d6a860..a3c369b143b4a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md +++ b/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md @@ -28,9 +28,9 @@ export declare class ScopedHistory implements Hi | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [action](./kibana-plugin-core-public.scopedhistory.action.md) | | Action | The last action dispatched on the history stack. | -| [block](./kibana-plugin-core-public.scopedhistory.block.md) | | (prompt?: string \| boolean \| History.TransitionPromptHook<HistoryLocationState> \| undefined) => UnregisterCallback | Add a block prompt requesting user confirmation when navigating away from the current page. | +| [block](./kibana-plugin-core-public.scopedhistory.block.md) | | (prompt?: string \| boolean \| TransitionPromptHook<HistoryLocationState> \| undefined) => UnregisterCallback | Add a block prompt requesting user confirmation when navigating away from the current page. | | [createHref](./kibana-plugin-core-public.scopedhistory.createhref.md) | | (location: LocationDescriptorObject<HistoryLocationState>, { prependBasePath }?: { prependBasePath?: boolean \| undefined; }) => Href | Creates an href (string) to the location. If prependBasePath is true (default), it will prepend the location's path with the scoped history basePath. | -| [createSubHistory](./kibana-plugin-core-public.scopedhistory.createsubhistory.md) | | <SubHistoryLocationState = unknown>(basePath: string) => ScopedHistory<SubHistoryLocationState> | Creates a ScopedHistory for a subpath of this ScopedHistory. Useful for applications that may have sub-apps that do not need access to the containing application's history. | +| [createSubHistory](./kibana-plugin-core-public.scopedhistory.createsubhistory.md) | | (basePath: string) => ScopedHistory<HistoryLocationState> | Creates a ScopedHistory for a subpath of this ScopedHistory. Useful for applications that may have sub-apps that do not need access to the containing application's history. | | [go](./kibana-plugin-core-public.scopedhistory.go.md) | | (n: number) => void | Send the user forward or backwards in the history stack. | | [goBack](./kibana-plugin-core-public.scopedhistory.goback.md) | | () => void | Send the user one location back in the history stack. Equivalent to calling [ScopedHistory.go(-1)](./kibana-plugin-core-public.scopedhistory.go.md). If no more entries are available backwards, this is a no-op. | | [goForward](./kibana-plugin-core-public.scopedhistory.goforward.md) | | () => void | Send the user one location forward in the history stack. Equivalent to calling [ScopedHistory.go(1)](./kibana-plugin-core-public.scopedhistory.go.md). If no more entries are available forwards, this is a no-op. | diff --git a/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md b/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md index b2e2b4bc6003f..91cb6c370d759 100644 --- a/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md +++ b/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md @@ -12,14 +12,32 @@ Set of helpers used to create `KibanaResponse` to form HTTP response on an incom kibanaResponseFactory: { custom: | Error | Buffer | Stream | { message: string | Error; - attributes?: Record | undefined; + attributes?: ResponseErrorAttributes | undefined; } | undefined>(options: CustomHttpResponseOptions) => KibanaResponse; - badRequest: (options?: ErrorHttpResponseOptions) => KibanaResponse; - unauthorized: (options?: ErrorHttpResponseOptions) => KibanaResponse; - forbidden: (options?: ErrorHttpResponseOptions) => KibanaResponse; - notFound: (options?: ErrorHttpResponseOptions) => KibanaResponse; - conflict: (options?: ErrorHttpResponseOptions) => KibanaResponse; - customError: (options: CustomHttpResponseOptions) => KibanaResponse; + badRequest: (options?: ErrorHttpResponseOptions) => KibanaResponse; + unauthorized: (options?: ErrorHttpResponseOptions) => KibanaResponse; + forbidden: (options?: ErrorHttpResponseOptions) => KibanaResponse; + notFound: (options?: ErrorHttpResponseOptions) => KibanaResponse; + conflict: (options?: ErrorHttpResponseOptions) => KibanaResponse; + customError: (options: CustomHttpResponseOptions) => KibanaResponse; redirected: (options: RedirectResponseOptions) => KibanaResponse | Buffer | Stream>; ok: (options?: HttpResponseOptions) => KibanaResponse | Buffer | Stream>; accepted: (options?: HttpResponseOptions) => KibanaResponse | Buffer | Stream>; diff --git a/package.json b/package.json index 75da2784a391b..06e338ab87ca7 100644 --- a/package.json +++ b/package.json @@ -88,9 +88,9 @@ "**/react-syntax-highlighter": "^15.3.1", "**/react-syntax-highlighter/**/highlight.js": "^10.4.1", "**/trim": "1.0.1", - "**/typescript": "4.1.3", + "**/typescript": "4.3.5", "**/underscore": "^1.13.1", - "globby/fast-glob": "3.2.5" + "globby/fast-glob": "3.2.7" }, "dependencies": { "@babel/runtime": "^7.16.3", @@ -538,7 +538,7 @@ "@types/hapi__inert": "^5.2.3", "@types/has-ansi": "^3.0.0", "@types/he": "^1.1.1", - "@types/history": "^4.7.3", + "@types/history": "^4.7.9", "@types/hjson": "^2.4.2", "@types/http-proxy": "^1.17.4", "@types/http-proxy-agent": "^2.0.2", @@ -823,9 +823,9 @@ "terser-webpack-plugin": "^4.2.3", "tough-cookie": "^4.0.0", "ts-loader": "^7.0.5", - "ts-morph": "^9.1.0", + "ts-morph": "^11.0.0", "tsd": "^0.13.1", - "typescript": "4.1.3", + "typescript": "4.3.5", "unlazy-loader": "^0.1.3", "url-loader": "^2.2.0", "val-loader": "^1.1.1", diff --git a/packages/kbn-alerts/BUILD.bazel b/packages/kbn-alerts/BUILD.bazel index 15dbc163cd288..a6e5f167735c0 100644 --- a/packages/kbn-alerts/BUILD.bazel +++ b/packages/kbn-alerts/BUILD.bazel @@ -34,13 +34,11 @@ RUNTIME_DEPS = [ "@npm//@elastic/eui", "@npm//enzyme", "@npm//react", - "@npm//resize-observer-polyfill", ] TYPES_DEPS = [ "//packages/kbn-i18n:npm_module_types", "@npm//@elastic/eui", - "@npm//resize-observer-polyfill", "@npm//tslib", "@npm//@types/enzyme", "@npm//@types/jest", diff --git a/packages/kbn-alerts/tsconfig.json b/packages/kbn-alerts/tsconfig.json index fa18a40744354..ac523fb77a9e1 100644 --- a/packages/kbn-alerts/tsconfig.json +++ b/packages/kbn-alerts/tsconfig.json @@ -8,7 +8,7 @@ "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-alerts/src", - "types": ["jest", "node", "resize-observer-polyfill"] + "types": ["jest", "node"] }, "include": ["src/**/*"], } diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts index 6697dfe53ee36..75c0bf4985b84 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts @@ -114,7 +114,8 @@ it('Function inside interface has a label', () => { expect(fn?.type).toBe(TypeKind.FunctionKind); }); -it('Test ReactElement signature', () => { +// FAILING: https://github.com/elastic/kibana/issues/120125 +it.skip('Test ReactElement signature', () => { const node = nodes.find((n) => getNodeName(n) === 'AReactElementFn'); expect(node).toBeDefined(); const def = buildApiDeclarationTopNode(node!, { diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_basic_api_declaration.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_basic_api_declaration.ts index d9538467a0984..cb0928fa3763d 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_basic_api_declaration.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_basic_api_declaration.ts @@ -48,7 +48,7 @@ export function buildBasicApiDeclaration(node: Node, opts: BuildApiDecOpts): Api signature: getSignature(node, opts.plugins, opts.log), path: getSourceForNode(node), deprecated, - removeBy: removeByTag ? removeByTag.getComment() : undefined, + removeBy: removeByTag ? removeByTag.getCommentText() : undefined, }; return { ...apiDec, diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/js_doc_utils.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/js_doc_utils.ts index 55639f16d7a97..7b6ac5a6ec5f6 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/js_doc_utils.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/js_doc_utils.ts @@ -43,14 +43,14 @@ export function getJSDocs(node: Node): JSDoc[] | undefined { export function getJSDocReturnTagComment(node: Node | JSDoc[]): TextWithLinks { const tags = getJSDocTags(node); const returnTag = tags.find((tag) => Node.isJSDocReturnTag(tag)); - if (returnTag) return getTextWithLinks(returnTag.getComment()); + if (returnTag) return getTextWithLinks(returnTag.getCommentText()); return []; } export function getJSDocParamComment(node: Node | JSDoc[], name: string): TextWithLinks { const tags = getJSDocTags(node); const paramTag = tags.find((tag) => Node.isJSDocParameterTag(tag) && tag.getName() === name); - if (paramTag) return getTextWithLinks(paramTag.getComment()); + if (paramTag) return getTextWithLinks(paramTag.getCommentText()); return []; } diff --git a/packages/kbn-docs-utils/src/api_docs/mdx/write_plugin_mdx_docs.ts b/packages/kbn-docs-utils/src/api_docs/mdx/write_plugin_mdx_docs.ts index aae77a7508954..fabe55d93c8ef 100644 --- a/packages/kbn-docs-utils/src/api_docs/mdx/write_plugin_mdx_docs.ts +++ b/packages/kbn-docs-utils/src/api_docs/mdx/write_plugin_mdx_docs.ts @@ -98,7 +98,7 @@ ${ **Code health stats** -| Public API count | Any count | Items lacking comments | Missing exports | +| Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| | ${pluginStats.apiCount} | ${pluginStats.isAnyType.length} | ${ pluginStats.missingComments.length diff --git a/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts b/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts index 7708eca0ec67a..cf536ce5158c1 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts +++ b/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts @@ -330,7 +330,7 @@ describe('Types', () => { "section": "def-public.MyProps", "text": "MyProps", }, - ">", + ", string | React.JSXElementConstructor>", ] `); }); diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json index 0eb9438ce594f..a3b3cdcbe28d0 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json @@ -76,7 +76,7 @@ "label": "component", "description": [], "signature": [ - "React.ComponentClass<{}, any> | React.FunctionComponent<{}> | undefined" + "React.ComponentType<{}> | undefined" ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts", "deprecated": false @@ -1241,7 +1241,7 @@ "section": "def-public.MyProps", "text": "MyProps" }, - ">" + ", string | React.JSXElementConstructor>" ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts", "deprecated": false, @@ -2356,7 +2356,7 @@ "deprecated": false, "children": [], "returnComment": [ - "The currently selected {@link SearchLanguage}" + "The currently selected {@link SearchLanguage }" ] } ], diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.mdx b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.mdx index 44223783ada57..f6a7893fe5998 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.mdx +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.mdx @@ -16,7 +16,7 @@ Contact Kibana Core for questions regarding this plugin. **Code health stats** -| Public API count | Any count | Items lacking comments | Missing exports | +| Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| | 131 | 1 | 71 | 2 | diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.mdx b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.mdx index b27d6d2de2f8f..13754ad452b01 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.mdx +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.mdx @@ -16,7 +16,7 @@ Contact Kibana Core for questions regarding this plugin. **Code health stats** -| Public API count | Any count | Items lacking comments | Missing exports | +| Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| | 131 | 1 | 71 | 2 | diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_b.mdx b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_b.mdx index df0dec0054497..afc42a59ee96d 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_b.mdx +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_b.mdx @@ -16,7 +16,7 @@ Contact Kibana Core for questions regarding this plugin. **Code health stats** -| Public API count | Any count | Items lacking comments | Missing exports | +| Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| | 2 | 0 | 2 | 0 | diff --git a/packages/kbn-field-types/BUILD.bazel b/packages/kbn-field-types/BUILD.bazel index 1fb97a5914ee4..0492829dd5320 100644 --- a/packages/kbn-field-types/BUILD.bazel +++ b/packages/kbn-field-types/BUILD.bazel @@ -38,7 +38,6 @@ TYPES_DEPS = [ "@npm//@types/node", "@npm//@types/node-forge", "@npm//@types/testing-library__jest-dom", - "@npm//resize-observer-polyfill", "@npm//@emotion/react", "@npm//jest-styled-components", ] diff --git a/packages/kbn-optimizer/BUILD.bazel b/packages/kbn-optimizer/BUILD.bazel index 485e5f1044aa3..647fcdfcbaad3 100644 --- a/packages/kbn-optimizer/BUILD.bazel +++ b/packages/kbn-optimizer/BUILD.bazel @@ -51,7 +51,6 @@ RUNTIME_DEPS = [ "@npm//node-sass", "@npm//normalize-path", "@npm//pirates", - "@npm//resize-observer-polyfill", "@npm//rxjs", "@npm//source-map-support", "@npm//watchpack", @@ -77,7 +76,6 @@ TYPES_DEPS = [ "@npm//jest-diff", "@npm//lmdb-store", "@npm//pirates", - "@npm//resize-observer-polyfill", "@npm//rxjs", "@npm//zlib", "@npm//@types/compression-webpack-plugin", diff --git a/packages/kbn-pm/dist/index.js b/packages/kbn-pm/dist/index.js index ab8b9766f28d0..c1d0f69e4ea07 100644 --- a/packages/kbn-pm/dist/index.js +++ b/packages/kbn-pm/dist/index.js @@ -94,21 +94,21 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _cli__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "run", function() { return _cli__WEBPACK_IMPORTED_MODULE_0__["run"]; }); -/* harmony import */ var _production__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(569); +/* harmony import */ var _production__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(563); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildBazelProductionProjects", function() { return _production__WEBPACK_IMPORTED_MODULE_1__["buildBazelProductionProjects"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildNonBazelProductionProjects", function() { return _production__WEBPACK_IMPORTED_MODULE_1__["buildNonBazelProductionProjects"]; }); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(346); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(340); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getProjects", function() { return _utils_projects__WEBPACK_IMPORTED_MODULE_2__["getProjects"]; }); -/* harmony import */ var _utils_project__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(348); +/* harmony import */ var _utils_project__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(342); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Project", function() { return _utils_project__WEBPACK_IMPORTED_MODULE_3__["Project"]; }); -/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(349); +/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(343); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "transformDependencies", function() { return _utils_package_json__WEBPACK_IMPORTED_MODULE_4__["transformDependencies"]; }); -/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(568); +/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(562); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getProjectPaths", function() { return _config__WEBPACK_IMPORTED_MODULE_5__["getProjectPaths"]; }); /* @@ -141,7 +141,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _kbn_dev_utils_tooling_log__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5); /* harmony import */ var _kbn_dev_utils_tooling_log__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_kbn_dev_utils_tooling_log__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(129); -/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(563); +/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(557); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(220); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one @@ -8811,12 +8811,12 @@ exports.ToolingLogCollectingWriter = ToolingLogCollectingWriter; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "commands", function() { return commands; }); /* harmony import */ var _bootstrap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(130); -/* harmony import */ var _build__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(533); -/* harmony import */ var _clean__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(534); -/* harmony import */ var _reset__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(558); -/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(559); -/* harmony import */ var _watch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(561); -/* harmony import */ var _patch_native_modules__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(562); +/* harmony import */ var _build__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(527); +/* harmony import */ var _clean__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(528); +/* harmony import */ var _reset__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(552); +/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(553); +/* harmony import */ var _watch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(555); +/* harmony import */ var _patch_native_modules__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(556); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License @@ -8855,11 +8855,11 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(220); /* harmony import */ var _utils_child_process__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(221); /* harmony import */ var _utils_link_project_executables__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(230); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(346); -/* harmony import */ var _utils_yarn_lock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(414); -/* harmony import */ var _utils_sort_package_json__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(417); -/* harmony import */ var _utils_validate_dependencies__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(425); -/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(427); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(340); +/* harmony import */ var _utils_yarn_lock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(408); +/* harmony import */ var _utils_sort_package_json__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(411); +/* harmony import */ var _utils_validate_dependencies__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(419); +/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(421); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } @@ -16552,7 +16552,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(132); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var ncp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(345); +/* harmony import */ var ncp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(339); /* harmony import */ var ncp__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(ncp__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_4__); @@ -17966,12 +17966,12 @@ const {promisify} = __webpack_require__(113); const path = __webpack_require__(4); const globby = __webpack_require__(241); const isGlob = __webpack_require__(266); -const slash = __webpack_require__(336); +const slash = __webpack_require__(330); const gracefulFs = __webpack_require__(233); -const isPathCwd = __webpack_require__(338); -const isPathInside = __webpack_require__(339); -const rimraf = __webpack_require__(340); -const pMap = __webpack_require__(341); +const isPathCwd = __webpack_require__(332); +const isPathInside = __webpack_require__(333); +const rimraf = __webpack_require__(334); +const pMap = __webpack_require__(335); const rimrafP = promisify(rimraf); @@ -18095,9 +18095,9 @@ const arrayUnion = __webpack_require__(242); const merge2 = __webpack_require__(243); const glob = __webpack_require__(244); const fastGlob = __webpack_require__(257); -const dirGlob = __webpack_require__(332); -const gitignore = __webpack_require__(334); -const {FilterStream, UniqueStream} = __webpack_require__(337); +const dirGlob = __webpack_require__(326); +const gitignore = __webpack_require__(328); +const {FilterStream, UniqueStream} = __webpack_require__(331); const DEFAULT_FILTER = () => false; @@ -21708,73 +21708,73 @@ function slice (args) { /***/ (function(module, exports, __webpack_require__) { "use strict"; - -const taskManager = __webpack_require__(258); -const async_1 = __webpack_require__(293); -const stream_1 = __webpack_require__(328); -const sync_1 = __webpack_require__(329); -const settings_1 = __webpack_require__(331); -const utils = __webpack_require__(259); -async function FastGlob(source, options) { - assertPatternsInput(source); - const works = getWorks(source, async_1.default, options); - const result = await Promise.all(works); - return utils.array.flatten(result); -} -// https://github.com/typescript-eslint/typescript-eslint/issues/60 -// eslint-disable-next-line no-redeclare -(function (FastGlob) { - function sync(source, options) { - assertPatternsInput(source); - const works = getWorks(source, sync_1.default, options); - return utils.array.flatten(works); - } - FastGlob.sync = sync; - function stream(source, options) { - assertPatternsInput(source); - const works = getWorks(source, stream_1.default, options); - /** - * The stream returned by the provider cannot work with an asynchronous iterator. - * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. - * This affects performance (+25%). I don't see best solution right now. - */ - return utils.stream.merge(works); - } - FastGlob.stream = stream; - function generateTasks(source, options) { - assertPatternsInput(source); - const patterns = [].concat(source); - const settings = new settings_1.default(options); - return taskManager.generate(patterns, settings); - } - FastGlob.generateTasks = generateTasks; - function isDynamicPattern(source, options) { - assertPatternsInput(source); - const settings = new settings_1.default(options); - return utils.pattern.isDynamicPattern(source, settings); - } - FastGlob.isDynamicPattern = isDynamicPattern; - function escapePath(source) { - assertPatternsInput(source); - return utils.path.escape(source); - } - FastGlob.escapePath = escapePath; -})(FastGlob || (FastGlob = {})); -function getWorks(source, _Provider, options) { - const patterns = [].concat(source); - const settings = new settings_1.default(options); - const tasks = taskManager.generate(patterns, settings); - const provider = new _Provider(settings); - return tasks.map(provider.read, provider); -} -function assertPatternsInput(input) { - const source = [].concat(input); - const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item)); - if (!isValidSource) { - throw new TypeError('Patterns must be a string (non empty) or an array of strings'); - } -} -module.exports = FastGlob; + +const taskManager = __webpack_require__(258); +const async_1 = __webpack_require__(287); +const stream_1 = __webpack_require__(322); +const sync_1 = __webpack_require__(323); +const settings_1 = __webpack_require__(325); +const utils = __webpack_require__(259); +async function FastGlob(source, options) { + assertPatternsInput(source); + const works = getWorks(source, async_1.default, options); + const result = await Promise.all(works); + return utils.array.flatten(result); +} +// https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare +(function (FastGlob) { + function sync(source, options) { + assertPatternsInput(source); + const works = getWorks(source, sync_1.default, options); + return utils.array.flatten(works); + } + FastGlob.sync = sync; + function stream(source, options) { + assertPatternsInput(source); + const works = getWorks(source, stream_1.default, options); + /** + * The stream returned by the provider cannot work with an asynchronous iterator. + * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. + * This affects performance (+25%). I don't see best solution right now. + */ + return utils.stream.merge(works); + } + FastGlob.stream = stream; + function generateTasks(source, options) { + assertPatternsInput(source); + const patterns = [].concat(source); + const settings = new settings_1.default(options); + return taskManager.generate(patterns, settings); + } + FastGlob.generateTasks = generateTasks; + function isDynamicPattern(source, options) { + assertPatternsInput(source); + const settings = new settings_1.default(options); + return utils.pattern.isDynamicPattern(source, settings); + } + FastGlob.isDynamicPattern = isDynamicPattern; + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escape(source); + } + FastGlob.escapePath = escapePath; +})(FastGlob || (FastGlob = {})); +function getWorks(source, _Provider, options) { + const patterns = [].concat(source); + const settings = new settings_1.default(options); + const tasks = taskManager.generate(patterns, settings); + const provider = new _Provider(settings); + return tasks.map(provider.read, provider); +} +function assertPatternsInput(input) { + const source = [].concat(input); + const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item)); + if (!isValidSource) { + throw new TypeError('Patterns must be a string (non empty) or an array of strings'); + } +} +module.exports = FastGlob; /***/ }), @@ -21782,71 +21782,86 @@ module.exports = FastGlob; /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; -const utils = __webpack_require__(259); -function generate(patterns, settings) { - const positivePatterns = getPositivePatterns(patterns); - const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); - const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); - const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); - const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); - const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); - return staticTasks.concat(dynamicTasks); -} -exports.generate = generate; -function convertPatternsToTasks(positive, negative, dynamic) { - const positivePatternsGroup = groupPatternsByBaseDirectory(positive); - // When we have a global group – there is no reason to divide the patterns into independent tasks. - // In this case, the global task covers the rest. - if ('.' in positivePatternsGroup) { - const task = convertPatternGroupToTask('.', positive, negative, dynamic); - return [task]; - } - return convertPatternGroupsToTasks(positivePatternsGroup, negative, dynamic); -} -exports.convertPatternsToTasks = convertPatternsToTasks; -function getPositivePatterns(patterns) { - return utils.pattern.getPositivePatterns(patterns); -} -exports.getPositivePatterns = getPositivePatterns; -function getNegativePatternsAsPositive(patterns, ignore) { - const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); - const positive = negative.map(utils.pattern.convertToPositivePattern); - return positive; -} -exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; -function groupPatternsByBaseDirectory(patterns) { - const group = {}; - return patterns.reduce((collection, pattern) => { - const base = utils.pattern.getBaseDirectory(pattern); - if (base in collection) { - collection[base].push(pattern); - } - else { - collection[base] = [pattern]; - } - return collection; - }, group); -} -exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; -function convertPatternGroupsToTasks(positive, negative, dynamic) { - return Object.keys(positive).map((base) => { - return convertPatternGroupToTask(base, positive[base], negative, dynamic); - }); -} -exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; -function convertPatternGroupToTask(base, positive, negative, dynamic) { - return { - dynamic, - positive, - negative, - base, - patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) - }; -} -exports.convertPatternGroupToTask = convertPatternGroupToTask; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; +const utils = __webpack_require__(259); +function generate(patterns, settings) { + const positivePatterns = getPositivePatterns(patterns); + const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); + const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); + const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); + const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); + const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); + return staticTasks.concat(dynamicTasks); +} +exports.generate = generate; +/** + * Returns tasks grouped by basic pattern directories. + * + * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately. + * This is necessary because directory traversal starts at the base directory and goes deeper. + */ +function convertPatternsToTasks(positive, negative, dynamic) { + const tasks = []; + const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive); + const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive); + const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory); + const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory); + tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic)); + /* + * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory + * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest. + */ + if ('.' in insideCurrentDirectoryGroup) { + tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic)); + } + else { + tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic)); + } + return tasks; +} +exports.convertPatternsToTasks = convertPatternsToTasks; +function getPositivePatterns(patterns) { + return utils.pattern.getPositivePatterns(patterns); +} +exports.getPositivePatterns = getPositivePatterns; +function getNegativePatternsAsPositive(patterns, ignore) { + const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); + const positive = negative.map(utils.pattern.convertToPositivePattern); + return positive; +} +exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; +function groupPatternsByBaseDirectory(patterns) { + const group = {}; + return patterns.reduce((collection, pattern) => { + const base = utils.pattern.getBaseDirectory(pattern); + if (base in collection) { + collection[base].push(pattern); + } + else { + collection[base] = [pattern]; + } + return collection; + }, group); +} +exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; +function convertPatternGroupsToTasks(positive, negative, dynamic) { + return Object.keys(positive).map((base) => { + return convertPatternGroupToTask(base, positive[base], negative, dynamic); + }); +} +exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; +function convertPatternGroupToTask(base, positive, negative, dynamic) { + return { + dynamic, + positive, + negative, + base, + patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) + }; +} +exports.convertPatternGroupToTask = convertPatternGroupToTask; /***/ }), @@ -21854,23 +21869,23 @@ exports.convertPatternGroupToTask = convertPatternGroupToTask; /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; -const array = __webpack_require__(260); -exports.array = array; -const errno = __webpack_require__(261); -exports.errno = errno; -const fs = __webpack_require__(262); -exports.fs = fs; -const path = __webpack_require__(263); -exports.path = path; -const pattern = __webpack_require__(264); -exports.pattern = pattern; -const stream = __webpack_require__(291); -exports.stream = stream; -const string = __webpack_require__(292); -exports.string = string; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; +const array = __webpack_require__(260); +exports.array = array; +const errno = __webpack_require__(261); +exports.errno = errno; +const fs = __webpack_require__(262); +exports.fs = fs; +const path = __webpack_require__(263); +exports.path = path; +const pattern = __webpack_require__(264); +exports.pattern = pattern; +const stream = __webpack_require__(285); +exports.stream = stream; +const string = __webpack_require__(286); +exports.string = string; /***/ }), @@ -21878,28 +21893,28 @@ exports.string = string; /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.splitWhen = exports.flatten = void 0; -function flatten(items) { - return items.reduce((collection, item) => [].concat(collection, item), []); -} -exports.flatten = flatten; -function splitWhen(items, predicate) { - const result = [[]]; - let groupIndex = 0; - for (const item of items) { - if (predicate(item)) { - groupIndex++; - result[groupIndex] = []; - } - else { - result[groupIndex].push(item); - } - } - return result; -} -exports.splitWhen = splitWhen; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.splitWhen = exports.flatten = void 0; +function flatten(items) { + return items.reduce((collection, item) => [].concat(collection, item), []); +} +exports.flatten = flatten; +function splitWhen(items, predicate) { + const result = [[]]; + let groupIndex = 0; + for (const item of items) { + if (predicate(item)) { + groupIndex++; + result[groupIndex] = []; + } + else { + result[groupIndex].push(item); + } + } + return result; +} +exports.splitWhen = splitWhen; /***/ }), @@ -21907,13 +21922,13 @@ exports.splitWhen = splitWhen; /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isEnoentCodeError = void 0; -function isEnoentCodeError(error) { - return error.code === 'ENOENT'; -} -exports.isEnoentCodeError = isEnoentCodeError; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isEnoentCodeError = void 0; +function isEnoentCodeError(error) { + return error.code === 'ENOENT'; +} +exports.isEnoentCodeError = isEnoentCodeError; /***/ }), @@ -21921,25 +21936,25 @@ exports.isEnoentCodeError = isEnoentCodeError; /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createDirentFromStats = void 0; -class DirentFromStats { - constructor(name, stats) { - this.name = name; - this.isBlockDevice = stats.isBlockDevice.bind(stats); - this.isCharacterDevice = stats.isCharacterDevice.bind(stats); - this.isDirectory = stats.isDirectory.bind(stats); - this.isFIFO = stats.isFIFO.bind(stats); - this.isFile = stats.isFile.bind(stats); - this.isSocket = stats.isSocket.bind(stats); - this.isSymbolicLink = stats.isSymbolicLink.bind(stats); - } -} -function createDirentFromStats(name, stats) { - return new DirentFromStats(name, stats); -} -exports.createDirentFromStats = createDirentFromStats; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDirentFromStats = void 0; +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; /***/ }), @@ -21947,39 +21962,39 @@ exports.createDirentFromStats = createDirentFromStats; /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.removeLeadingDotSegment = exports.escape = exports.makeAbsolute = exports.unixify = void 0; -const path = __webpack_require__(4); -const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ -const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g; -/** - * Designed to work only with simple paths: `dir\\file`. - */ -function unixify(filepath) { - return filepath.replace(/\\/g, '/'); -} -exports.unixify = unixify; -function makeAbsolute(cwd, filepath) { - return path.resolve(cwd, filepath); -} -exports.makeAbsolute = makeAbsolute; -function escape(pattern) { - return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); -} -exports.escape = escape; -function removeLeadingDotSegment(entry) { - // We do not use `startsWith` because this is 10x slower than current implementation for some cases. - // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with - if (entry.charAt(0) === '.') { - const secondCharactery = entry.charAt(1); - if (secondCharactery === '/' || secondCharactery === '\\') { - return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); - } - } - return entry; -} -exports.removeLeadingDotSegment = removeLeadingDotSegment; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.removeLeadingDotSegment = exports.escape = exports.makeAbsolute = exports.unixify = void 0; +const path = __webpack_require__(4); +const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ +const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g; +/** + * Designed to work only with simple paths: `dir\\file`. + */ +function unixify(filepath) { + return filepath.replace(/\\/g, '/'); +} +exports.unixify = unixify; +function makeAbsolute(cwd, filepath) { + return path.resolve(cwd, filepath); +} +exports.makeAbsolute = makeAbsolute; +function escape(pattern) { + return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); +} +exports.escape = escape; +function removeLeadingDotSegment(entry) { + // We do not use `startsWith` because this is 10x slower than current implementation for some cases. + // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with + if (entry.charAt(0) === '.') { + const secondCharactery = entry.charAt(1); + if (secondCharactery === '/' || secondCharactery === '\\') { + return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); + } + } + return entry; +} +exports.removeLeadingDotSegment = removeLeadingDotSegment; /***/ }), @@ -21987,138 +22002,163 @@ exports.removeLeadingDotSegment = removeLeadingDotSegment; /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; -const path = __webpack_require__(4); -const globParent = __webpack_require__(265); -const micromatch = __webpack_require__(268); -const picomatch = __webpack_require__(285); -const GLOBSTAR = '**'; -const ESCAPE_SYMBOL = '\\'; -const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; -const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/; -const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/; -const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/; -const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/; -function isStaticPattern(pattern, options = {}) { - return !isDynamicPattern(pattern, options); -} -exports.isStaticPattern = isStaticPattern; -function isDynamicPattern(pattern, options = {}) { - /** - * A special case with an empty string is necessary for matching patterns that start with a forward slash. - * An empty string cannot be a dynamic pattern. - * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'. - */ - if (pattern === '') { - return false; - } - /** - * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check - * filepath directly (without read directory). - */ - if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { - return true; - } - if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { - return true; - } - if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { - return true; - } - if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) { - return true; - } - return false; -} -exports.isDynamicPattern = isDynamicPattern; -function convertToPositivePattern(pattern) { - return isNegativePattern(pattern) ? pattern.slice(1) : pattern; -} -exports.convertToPositivePattern = convertToPositivePattern; -function convertToNegativePattern(pattern) { - return '!' + pattern; -} -exports.convertToNegativePattern = convertToNegativePattern; -function isNegativePattern(pattern) { - return pattern.startsWith('!') && pattern[1] !== '('; -} -exports.isNegativePattern = isNegativePattern; -function isPositivePattern(pattern) { - return !isNegativePattern(pattern); -} -exports.isPositivePattern = isPositivePattern; -function getNegativePatterns(patterns) { - return patterns.filter(isNegativePattern); -} -exports.getNegativePatterns = getNegativePatterns; -function getPositivePatterns(patterns) { - return patterns.filter(isPositivePattern); -} -exports.getPositivePatterns = getPositivePatterns; -function getBaseDirectory(pattern) { - return globParent(pattern, { flipBackslashes: false }); -} -exports.getBaseDirectory = getBaseDirectory; -function hasGlobStar(pattern) { - return pattern.includes(GLOBSTAR); -} -exports.hasGlobStar = hasGlobStar; -function endsWithSlashGlobStar(pattern) { - return pattern.endsWith('/' + GLOBSTAR); -} -exports.endsWithSlashGlobStar = endsWithSlashGlobStar; -function isAffectDepthOfReadingPattern(pattern) { - const basename = path.basename(pattern); - return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); -} -exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; -function expandPatternsWithBraceExpansion(patterns) { - return patterns.reduce((collection, pattern) => { - return collection.concat(expandBraceExpansion(pattern)); - }, []); -} -exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; -function expandBraceExpansion(pattern) { - return micromatch.braces(pattern, { - expand: true, - nodupes: true - }); -} -exports.expandBraceExpansion = expandBraceExpansion; -function getPatternParts(pattern, options) { - let { parts } = picomatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); - /** - * The scan method returns an empty array in some cases. - * See micromatch/picomatch#58 for more details. - */ - if (parts.length === 0) { - parts = [pattern]; - } - /** - * The scan method does not return an empty part for the pattern with a forward slash. - * This is another part of micromatch/picomatch#58. - */ - if (parts[0].startsWith('/')) { - parts[0] = parts[0].slice(1); - parts.unshift(''); - } - return parts; -} -exports.getPatternParts = getPatternParts; -function makeRe(pattern, options) { - return micromatch.makeRe(pattern, options); -} -exports.makeRe = makeRe; -function convertPatternsToRe(patterns, options) { - return patterns.map((pattern) => makeRe(pattern, options)); -} -exports.convertPatternsToRe = convertPatternsToRe; -function matchAny(entry, patternsRe) { - return patternsRe.some((patternRe) => patternRe.test(entry)); -} -exports.matchAny = matchAny; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; +const path = __webpack_require__(4); +const globParent = __webpack_require__(265); +const micromatch = __webpack_require__(268); +const GLOBSTAR = '**'; +const ESCAPE_SYMBOL = '\\'; +const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; +const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/; +const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/; +const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/; +const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/; +function isStaticPattern(pattern, options = {}) { + return !isDynamicPattern(pattern, options); +} +exports.isStaticPattern = isStaticPattern; +function isDynamicPattern(pattern, options = {}) { + /** + * A special case with an empty string is necessary for matching patterns that start with a forward slash. + * An empty string cannot be a dynamic pattern. + * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'. + */ + if (pattern === '') { + return false; + } + /** + * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check + * filepath directly (without read directory). + */ + if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { + return true; + } + if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) { + return true; + } + return false; +} +exports.isDynamicPattern = isDynamicPattern; +function convertToPositivePattern(pattern) { + return isNegativePattern(pattern) ? pattern.slice(1) : pattern; +} +exports.convertToPositivePattern = convertToPositivePattern; +function convertToNegativePattern(pattern) { + return '!' + pattern; +} +exports.convertToNegativePattern = convertToNegativePattern; +function isNegativePattern(pattern) { + return pattern.startsWith('!') && pattern[1] !== '('; +} +exports.isNegativePattern = isNegativePattern; +function isPositivePattern(pattern) { + return !isNegativePattern(pattern); +} +exports.isPositivePattern = isPositivePattern; +function getNegativePatterns(patterns) { + return patterns.filter(isNegativePattern); +} +exports.getNegativePatterns = getNegativePatterns; +function getPositivePatterns(patterns) { + return patterns.filter(isPositivePattern); +} +exports.getPositivePatterns = getPositivePatterns; +/** + * Returns patterns that can be applied inside the current directory. + * + * @example + * // ['./*', '*', 'a/*'] + * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*']) + */ +function getPatternsInsideCurrentDirectory(patterns) { + return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern)); +} +exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory; +/** + * Returns patterns to be expanded relative to (outside) the current directory. + * + * @example + * // ['../*', './../*'] + * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*']) + */ +function getPatternsOutsideCurrentDirectory(patterns) { + return patterns.filter(isPatternRelatedToParentDirectory); +} +exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory; +function isPatternRelatedToParentDirectory(pattern) { + return pattern.startsWith('..') || pattern.startsWith('./..'); +} +exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory; +function getBaseDirectory(pattern) { + return globParent(pattern, { flipBackslashes: false }); +} +exports.getBaseDirectory = getBaseDirectory; +function hasGlobStar(pattern) { + return pattern.includes(GLOBSTAR); +} +exports.hasGlobStar = hasGlobStar; +function endsWithSlashGlobStar(pattern) { + return pattern.endsWith('/' + GLOBSTAR); +} +exports.endsWithSlashGlobStar = endsWithSlashGlobStar; +function isAffectDepthOfReadingPattern(pattern) { + const basename = path.basename(pattern); + return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); +} +exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; +function expandPatternsWithBraceExpansion(patterns) { + return patterns.reduce((collection, pattern) => { + return collection.concat(expandBraceExpansion(pattern)); + }, []); +} +exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; +function expandBraceExpansion(pattern) { + return micromatch.braces(pattern, { + expand: true, + nodupes: true + }); +} +exports.expandBraceExpansion = expandBraceExpansion; +function getPatternParts(pattern, options) { + let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); + /** + * The scan method returns an empty array in some cases. + * See micromatch/picomatch#58 for more details. + */ + if (parts.length === 0) { + parts = [pattern]; + } + /** + * The scan method does not return an empty part for the pattern with a forward slash. + * This is another part of micromatch/picomatch#58. + */ + if (parts[0].startsWith('/')) { + parts[0] = parts[0].slice(1); + parts.unshift(''); + } + return parts; +} +exports.getPatternParts = getPatternParts; +function makeRe(pattern, options) { + return micromatch.makeRe(pattern, options); +} +exports.makeRe = makeRe; +function convertPatternsToRe(patterns, options) { + return patterns.map((pattern) => makeRe(pattern, options)); +} +exports.convertPatternsToRe = convertPatternsToRe; +function matchAny(entry, patternsRe) { + return patternsRe.some((patternRe) => patternRe.test(entry)); +} +exports.matchAny = matchAny; /***/ }), @@ -26436,2237 +26476,149 @@ module.exports = parse; "use strict"; - -module.exports = __webpack_require__(286); - - -/***/ }), -/* 286 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const path = __webpack_require__(4); -const scan = __webpack_require__(287); -const parse = __webpack_require__(290); -const utils = __webpack_require__(288); -const constants = __webpack_require__(289); -const isObject = val => val && typeof val === 'object' && !Array.isArray(val); - -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ - -const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject(glob) && glob.tokens && glob.input; - - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } - - const opts = options || {}; - const posix = utils.isWindows(options); - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); - - const state = regex.state; - delete regex.state; - - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); - } - - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; - - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } - - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } - - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } - - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; - - if (returnState) { - matcher.state = state; - } - - return matcher; -}; - -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ - -picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } - - if (input === '') { - return { isMatch: false, output: '' }; - } - - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; - - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } - - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } - - return { isMatch: Boolean(match), match, output }; -}; - -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ - -picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(path.basename(input)); -}; - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ - -picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse(pattern, { ...options, fastpaths: false }); -}; - -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ - -picomatch.scan = (input, options) => scan(input, options); - -/** - * Create a regular expression from a parsed glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `state` The object returned from the `.parse` method. - * @param {Object} `options` - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return parsed.output; - } - - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; - - let source = `${prepend}(?:${parsed.output})${append}`; - if (parsed && parsed.negated === true) { - source = `^(?!${source}).*$`; - } - - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = parsed; - } - - return regex; -}; - -picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } - - const opts = options || {}; - let parsed = { negated: false, fastpaths: true }; - let prefix = ''; - let output; - - if (input.startsWith('./')) { - input = input.slice(2); - prefix = parsed.prefix = './'; - } - - if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - output = parse.fastpaths(input, options); - } - - if (output === undefined) { - parsed = parse(input, options); - parsed.prefix = prefix + (parsed.prefix || ''); - } else { - parsed.output = output; - } - - return picomatch.compileRe(parsed, options, returnOutput, returnState); -}; - -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ - -picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; - -/** - * Picomatch constants. - * @return {Object} - */ - -picomatch.constants = constants; - -/** - * Expose "picomatch" - */ - -module.exports = picomatch; - - -/***/ }), -/* 287 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const utils = __webpack_require__(288); -const { - CHAR_ASTERISK, /* * */ - CHAR_AT, /* @ */ - CHAR_BACKWARD_SLASH, /* \ */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_EXCLAMATION_MARK, /* ! */ - CHAR_FORWARD_SLASH, /* / */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_PLUS, /* + */ - CHAR_QUESTION_MARK, /* ? */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_RIGHT_SQUARE_BRACKET /* ] */ -} = __webpack_require__(289); - -const isPathSeparator = code => { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -}; - -const depth = token => { - if (token.isPrefix !== true) { - token.depth = token.isGlobstar ? Infinity : 1; - } -}; - -/** - * Quickly scans a glob pattern and returns an object with a handful of - * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), - * `glob` (the actual pattern), and `negated` (true if the path starts with `!`). - * - * ```js - * const pm = require('picomatch'); - * console.log(pm.scan('foo/bar/*.js')); - * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {Object} Returns an object with tokens and regex source string. - * @api public - */ - -const scan = (input, options) => { - const opts = options || {}; - - const length = input.length - 1; - const scanToEnd = opts.parts === true || opts.scanToEnd === true; - const slashes = []; - const tokens = []; - const parts = []; - - let str = input; - let index = -1; - let start = 0; - let lastIndex = 0; - let isBrace = false; - let isBracket = false; - let isGlob = false; - let isExtglob = false; - let isGlobstar = false; - let braceEscaped = false; - let backslashes = false; - let negated = false; - let finished = false; - let braces = 0; - let prev; - let code; - let token = { value: '', depth: 0, isGlob: false }; - - const eos = () => index >= length; - const peek = () => str.charCodeAt(index + 1); - const advance = () => { - prev = code; - return str.charCodeAt(++index); - }; - - while (index < length) { - code = advance(); - let next; - - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - - if (code === CHAR_LEFT_CURLY_BRACE) { - braceEscaped = true; - } - continue; - } - - if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { - braces++; - - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (code === CHAR_LEFT_CURLY_BRACE) { - braces++; - continue; - } - - if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (braceEscaped !== true && code === CHAR_COMMA) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_RIGHT_CURLY_BRACE) { - braces--; - - if (braces === 0) { - braceEscaped = false; - isBrace = token.isBrace = true; - finished = true; - break; - } - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_FORWARD_SLASH) { - slashes.push(index); - tokens.push(token); - token = { value: '', depth: 0, isGlob: false }; - - if (finished === true) continue; - if (prev === CHAR_DOT && index === (start + 1)) { - start += 2; - continue; - } - - lastIndex = index + 1; - continue; - } - - if (opts.noext !== true) { - const isExtglobChar = code === CHAR_PLUS - || code === CHAR_AT - || code === CHAR_ASTERISK - || code === CHAR_QUESTION_MARK - || code === CHAR_EXCLAMATION_MARK; - - if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - isExtglob = token.isExtglob = true; - finished = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - isGlob = token.isGlob = true; - finished = true; - break; - } - } - continue; - } - break; - } - } - - if (code === CHAR_ASTERISK) { - if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_QUESTION_MARK) { - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_LEFT_SQUARE_BRACKET) { - while (eos() !== true && (next = advance())) { - if (next === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - isBracket = token.isBracket = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - } - } - - if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { - negated = token.negated = true; - start++; - continue; - } - - if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_LEFT_PARENTHESES) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - finished = true; - break; - } - } - continue; - } - break; - } - - if (isGlob === true) { - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - } - - if (opts.noext === true) { - isExtglob = false; - isGlob = false; - } - - let base = str; - let prefix = ''; - let glob = ''; - - if (start > 0) { - prefix = str.slice(0, start); - str = str.slice(start); - lastIndex -= start; - } - - if (base && isGlob === true && lastIndex > 0) { - base = str.slice(0, lastIndex); - glob = str.slice(lastIndex); - } else if (isGlob === true) { - base = ''; - glob = str; - } else { - base = str; - } - - if (base && base !== '' && base !== '/' && base !== str) { - if (isPathSeparator(base.charCodeAt(base.length - 1))) { - base = base.slice(0, -1); - } - } - - if (opts.unescape === true) { - if (glob) glob = utils.removeBackslashes(glob); - - if (base && backslashes === true) { - base = utils.removeBackslashes(base); - } - } - - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated - }; - - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); - } - state.tokens = tokens; - } - - if (opts.parts === true || opts.tokens === true) { - let prevIndex; - - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; - } - if (idx !== 0 || value !== '') { - parts.push(value); - } - prevIndex = i; - } - - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); - - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; - } - } - - state.slashes = slashes; - state.parts = parts; - } - - return state; -}; - -module.exports = scan; - - -/***/ }), -/* 288 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const path = __webpack_require__(4); -const win32 = process.platform === 'win32'; -const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL -} = __webpack_require__(289); - -exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); -exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); -exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); -exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - -exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\' ? '' : match; - }); -}; - -exports.supportsLookbehinds = () => { - const segs = process.version.slice(1).split('.').map(Number); - if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { - return true; - } - return false; -}; - -exports.isWindows = options => { - if (options && typeof options.windows === 'boolean') { - return options.windows; - } - return win32 === true || path.sep === '\\'; -}; - -exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); - return `${input.slice(0, idx)}\\${input.slice(idx)}`; -}; - -exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; - } - return output; -}; - -exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; - - let output = `${prepend}(?:${input})${append}`; - if (state.negated === true) { - output = `(?:^(?!${output}).*$)`; - } - return output; -}; - - -/***/ }), -/* 289 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const path = __webpack_require__(4); -const WIN_SLASH = '\\\\/'; -const WIN_NO_SLASH = `[^${WIN_SLASH}]`; - -/** - * Posix glob regex - */ - -const DOT_LITERAL = '\\.'; -const PLUS_LITERAL = '\\+'; -const QMARK_LITERAL = '\\?'; -const SLASH_LITERAL = '\\/'; -const ONE_CHAR = '(?=.)'; -const QMARK = '[^/]'; -const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; -const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; -const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; -const NO_DOT = `(?!${DOT_LITERAL})`; -const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; -const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; -const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; -const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; -const STAR = `${QMARK}*?`; - -const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR, - START_ANCHOR -}; - -/** - * Windows glob regex - */ - -const WINDOWS_CHARS = { - ...POSIX_CHARS, - - SLASH_LITERAL: `[${WIN_SLASH}]`, - QMARK: WIN_NO_SLASH, - STAR: `${WIN_NO_SLASH}*?`, - DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, - NO_DOT: `(?!${DOT_LITERAL})`, - NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, - NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - QMARK_NO_DOT: `[^.${WIN_SLASH}]`, - START_ANCHOR: `(?:^|[${WIN_SLASH}])`, - END_ANCHOR: `(?:[${WIN_SLASH}]|$)` -}; - -/** - * POSIX Bracket Regex - */ - -const POSIX_REGEX_SOURCE = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\x00-\\x7F', - blank: ' \\t', - cntrl: '\\x00-\\x1F\\x7F', - digit: '0-9', - graph: '\\x21-\\x7E', - lower: 'a-z', - print: '\\x20-\\x7E ', - punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', - space: ' \\t\\r\\n\\v\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' -}; - -module.exports = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE, - - // regular expressions - REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, - - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ - - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ - - CHAR_ASTERISK: 42, /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \ */ - CHAR_CARRIAGE_RETURN: 13, /* \r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* ` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \n */ - CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - - SEP: path.sep, - - /** - * Create EXTGLOB_CHARS - */ - - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, - - /** - * Create GLOB_CHARS - */ - - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } -}; - - -/***/ }), -/* 290 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const constants = __webpack_require__(289); -const utils = __webpack_require__(288); - -/** - * Constants - */ - -const { - MAX_LENGTH, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS -} = constants; - -/** - * Helpers - */ - -const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } - - args.sort(); - const value = `[${args.join('-')}]`; - - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils.escapeRegex(v)).join('..'); - } - - return value; -}; - -/** - * Create the message for a syntax error - */ - -const syntaxError = (type, char) => { - return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; -}; - -/** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ - -const parse = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - input = REPLACEMENTS[input] || input; - - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - - let len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; - - const capture = opts.capture ? '' : '?:'; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants.globChars(win32); - const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); - - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; - - const globstar = (opts) => { - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; - } - - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; - - input = utils.removePrefix(input, state); - len = input.length; - - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; - - /** - * Tokenizing helpers - */ - - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index]; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; - - const negate = () => { - let count = 1; - - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } - - if (count % 2 === 0) { - return false; - } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } - - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; - - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); - - if (token.type === 'negate') { - let extglobStar = star; - - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } - - if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { - output = token.close = `)$))${extglobStar}`; - } - - if (token.prev.type === 'bos' && eos()) { - state.negatedExtglob = true; - } - } - - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; - - /** - * Fast paths - */ - - if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { - let backslashes = false; - - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\') { - backslashes = true; - return m; - } - - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); - } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); - } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } - - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : `\\${m}`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\/g, ''); - } else { - output = output.replace(/\\+/g, m => { - return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); - }); - } - } - - if (output === input && opts.contains === true) { - state.output = input; - return state; - } - - state.output = utils.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\u0000') { - continue; - } - - /** - * Escaped characters - */ - - if (value === '\\') { - const next = peek(); - - if (next === '/' && opts.bash !== true) { - continue; - } - - if (next === '.' || next === ';') { - continue; - } - - if (!next) { - value += '\\'; - push({ type: 'text', value }); - continue; - } - - // collapse slashes to reduce potential for exploits - const match = /^\\+/.exec(remaining()); - let slashes = 0; - - if (match && match[0].length > 2) { - slashes = match[0].length; - state.index += slashes; - if (slashes % 2 !== 0) { - value += '\\'; - } - } - - if (opts.unescape === true) { - value = advance() || ''; - } else { - value += advance() || ''; - } - - if (state.brackets === 0) { - push({ type: 'text', value }); - continue; - } - } - - /** - * If we're inside a regex character class, continue - * until we reach the closing bracket. - */ - - if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { - if (opts.posix !== false && value === ':') { - const inner = prev.value.slice(1); - if (inner.includes('[')) { - prev.posix = true; - - if (inner.includes(':')) { - const idx = prev.value.lastIndexOf('['); - const pre = prev.value.slice(0, idx); - const rest = prev.value.slice(idx + 2); - const posix = POSIX_REGEX_SOURCE[rest]; - if (posix) { - prev.value = pre + posix; - state.backtrack = true; - advance(); - - if (!bos.output && tokens.indexOf(prev) === 1) { - bos.output = ONE_CHAR; - } - continue; - } - } - } - } - - if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { - value = `\\${value}`; - } - - if (value === ']' && (prev.value === '[' || prev.value === '[^')) { - value = `\\${value}`; - } - - if (opts.posix === true && value === '!' && prev.value === '[') { - value = '^'; - } - - prev.value += value; - append({ value }); - continue; - } - - /** - * If we're inside a quoted string, continue - * until we reach the closing double quote. - */ - - if (state.quotes === 1 && value !== '"') { - value = utils.escapeRegex(value); - prev.value += value; - append({ value }); - continue; - } - - /** - * Double quotes - */ - - if (value === '"') { - state.quotes = state.quotes === 1 ? 0 : 1; - if (opts.keepQuotes === true) { - push({ type: 'text', value }); - } - continue; - } - - /** - * Parentheses - */ - - if (value === '(') { - increment('parens'); - push({ type: 'paren', value }); - continue; - } - - if (value === ')') { - if (state.parens === 0 && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '(')); - } - - const extglob = extglobs[extglobs.length - 1]; - if (extglob && state.parens === extglob.parens + 1) { - extglobClose(extglobs.pop()); - continue; - } - - push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); - decrement('parens'); - continue; - } - - /** - * Square brackets - */ - - if (value === '[') { - if (opts.nobracket === true || !remaining().includes(']')) { - if (opts.nobracket !== true && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('closing', ']')); - } - - value = `\\${value}`; - } else { - increment('brackets'); - } - - push({ type: 'bracket', value }); - continue; - } - - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '[')); - } - - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - decrement('brackets'); - - const prevValue = prev.value.slice(1); - if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { - value = `/${value}`; - } - - prev.value += value; - append({ value }); - - // when literal brackets are explicitly disabled - // assume we should match with a regex character class - if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { - continue; - } - - const escaped = utils.escapeRegex(prev.value); - state.output = state.output.slice(0, -prev.value.length); - - // when literal brackets are explicitly enabled - // assume we should escape the brackets to match literal characters - if (opts.literalBrackets === true) { - state.output += escaped; - prev.value = escaped; - continue; - } - - // when the user specifies nothing, try to match both - prev.value = `(${capture}${escaped}|${prev.value})`; - state.output += prev.value; - continue; - } - - /** - * Braces - */ - - if (value === '{' && opts.nobrace !== true) { - increment('braces'); - - const open = { - type: 'brace', - value, - output: '(', - outputIndex: state.output.length, - tokensIndex: state.tokens.length - }; - - braces.push(open); - push(open); - continue; - } - - if (value === '}') { - const brace = braces[braces.length - 1]; - - if (opts.nobrace === true || !brace) { - push({ type: 'text', value, output: value }); - continue; - } - - let output = ')'; - - if (brace.dots === true) { - const arr = tokens.slice(); - const range = []; - - for (let i = arr.length - 1; i >= 0; i--) { - tokens.pop(); - if (arr[i].type === 'brace') { - break; - } - if (arr[i].type !== 'dots') { - range.unshift(arr[i].value); - } - } - - output = expandRange(range, opts); - state.backtrack = true; - } - - if (brace.comma !== true && brace.dots !== true) { - const out = state.output.slice(0, brace.outputIndex); - const toks = state.tokens.slice(brace.tokensIndex); - brace.value = brace.output = '\\{'; - value = output = '\\}'; - state.output = out; - for (const t of toks) { - state.output += (t.output || t.value); - } - } - - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } - - /** - * Pipes - */ - - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } - - /** - * Commas - */ - - if (value === ',') { - let output = value; - - const brace = braces[braces.length - 1]; - if (brace && stack[stack.length - 1] === 'braces') { - brace.comma = true; - output = '|'; - } - - push({ type: 'comma', value, output }); - continue; - } - - /** - * Slashes - */ - - if (value === '/') { - // if the beginning of the glob is "./", advance the start - // to the current index, and don't add the "./" characters - // to the state. This greatly simplifies lookbehinds when - // checking for BOS characters like "!" and "." (not "./") - if (prev.type === 'dot' && state.index === state.start + 1) { - state.start = state.index + 1; - state.consumed = ''; - state.output = ''; - tokens.pop(); - prev = bos; // reset "prev" to the first token - continue; - } - - push({ type: 'slash', value, output: SLASH_LITERAL }); - continue; - } - - /** - * Dots - */ - - if (value === '.') { - if (state.braces > 0 && prev.type === 'dot') { - if (prev.value === '.') prev.output = DOT_LITERAL; - const brace = braces[braces.length - 1]; - prev.type = 'dots'; - prev.output += value; - prev.value += value; - brace.dots = true; - continue; - } - - if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { - push({ type: 'text', value, output: DOT_LITERAL }); - continue; - } - - push({ type: 'dot', value, output: DOT_LITERAL }); - continue; - } - - /** - * Question marks - */ - - if (value === '?') { - const isGroup = prev && prev.value === '('; - if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('qmark', value); - continue; - } - - if (prev && prev.type === 'paren') { - const next = peek(); - let output = value; - - if (next === '<' && !utils.supportsLookbehinds()) { - throw new Error('Node.js v10 or higher is required for regex lookbehinds'); - } - - if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { - output = `\\${value}`; - } - - push({ type: 'text', value, output }); - continue; - } - - if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { - push({ type: 'qmark', value, output: QMARK_NO_DOT }); - continue; - } - - push({ type: 'qmark', value, output: QMARK }); - continue; - } - - /** - * Exclamation - */ - - if (value === '!') { - if (opts.noextglob !== true && peek() === '(') { - if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { - extglobOpen('negate', value); - continue; - } - } - - if (opts.nonegate !== true && state.index === 0) { - negate(); - continue; - } - } - - /** - * Plus - */ - - if (value === '+') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('plus', value); - continue; - } - - if ((prev && prev.value === '(') || opts.regex === false) { - push({ type: 'plus', value, output: PLUS_LITERAL }); - continue; - } - - if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { - push({ type: 'plus', value }); - continue; - } - - push({ type: 'plus', value: PLUS_LITERAL }); - continue; - } - - /** - * Plain text - */ - - if (value === '@') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - push({ type: 'at', extglob: true, value, output: '' }); - continue; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Plain text - */ - - if (value !== '*') { - if (value === '$' || value === '^') { - value = `\\${value}`; - } - - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } - - let rest = remaining(); - if (opts.noextglob !== true && /^\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } - - if (prev.type === 'star') { - if (opts.noglobstar === true) { - consume(value); - continue; - } - - const prior = prev.prev; - const before = prior.prev; - const isStart = prior.type === 'slash' || prior.type === 'bos'; - const afterStar = before && (before.type === 'star' || before.type === 'globstar'); - - if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { - push({ type: 'star', value, output: '' }); - continue; - } - - const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); - const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); - if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { - push({ type: 'star', value, output: '' }); - continue; - } - - // strip consecutive `/**/` - while (rest.slice(0, 3) === '/**') { - const after = input[state.index + 4]; - if (after && after !== '/') { - break; - } - rest = rest.slice(3); - consume('/**', 3); - } - - if (prior.type === 'bos' && eos()) { - prev.type = 'globstar'; - prev.value += value; - prev.output = globstar(opts); - state.output = prev.output; - state.globstar = true; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); - prev.value += value; - state.globstar = true; - state.output += prior.output + prev.output; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { - const end = rest[1] !== void 0 ? '|$' : ''; - - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; - prev.value += value; - - state.output += prior.output + prev.output; - state.globstar = true; - - consume(value + advance()); - - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - if (prior.type === 'bos' && rest[0] === '/') { - prev.type = 'globstar'; - prev.value += value; - prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; - state.output = prev.output; - state.globstar = true; - consume(value + advance()); - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - // remove single star from output - state.output = state.output.slice(0, -prev.output.length); - - // reset previous token to globstar - prev.type = 'globstar'; - prev.output = globstar(opts); - prev.value += value; - - // reset output with globstar - state.output += prev.output; - state.globstar = true; - consume(value); - continue; - } - - const token = { type: 'star', value, output: star }; - - if (opts.bash === true) { - token.output = '.*?'; - if (prev.type === 'bos' || prev.type === 'slash') { - token.output = nodot + token.output; - } - push(token); - continue; - } - - if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { - token.output = value; - push(token); - continue; - } - - if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { - if (prev.type === 'dot') { - state.output += NO_DOT_SLASH; - prev.output += NO_DOT_SLASH; - - } else if (opts.dot === true) { - state.output += NO_DOTS_SLASH; - prev.output += NO_DOTS_SLASH; - - } else { - state.output += nodot; - prev.output += nodot; - } - - if (peek() !== '*') { - state.output += ONE_CHAR; - prev.output += ONE_CHAR; - } - } - - push(token); - } - - while (state.brackets > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); - state.output = utils.escapeLast(state.output, '['); - decrement('brackets'); - } - - while (state.parens > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); - state.output = utils.escapeLast(state.output, '('); - decrement('parens'); - } - - while (state.braces > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); - state.output = utils.escapeLast(state.output, '{'); - decrement('braces'); - } - - if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { - push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); - } - - // rebuild the output if we had to backtrack at any point - if (state.backtrack === true) { - state.output = ''; - - for (const token of state.tokens) { - state.output += token.output != null ? token.output : token.value; - - if (token.suffix) { - state.output += token.suffix; - } - } - } - - return state; -}; - -/** - * Fast paths for creating regular expressions for common glob patterns. - * This can significantly speed up processing and has very little downside - * impact when none of the fast paths match. - */ - -parse.fastpaths = (input, options) => { - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - const len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - input = REPLACEMENTS[input] || input; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const { - DOT_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOTS_SLASH, - STAR, - START_ANCHOR - } = constants.globChars(win32); - - const nodot = opts.dot ? NO_DOTS : NO_DOT; - const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; - const capture = opts.capture ? '' : '?:'; - const state = { negated: false, prefix: '' }; - let star = opts.bash === true ? '.*?' : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - const globstar = (opts) => { - if (opts.noglobstar === true) return star; - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const create = str => { - switch (str) { - case '*': - return `${nodot}${ONE_CHAR}${star}`; - - case '.*': - return `${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*.*': - return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*/*': - return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; - - case '**': - return nodot + globstar(opts); - - case '**/*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; - - case '**/*.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '**/.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; - - default: { - const match = /^(.*?)\.(\w+)$/.exec(str); - if (!match) return; - - const source = create(match[1]); - if (!source) return; - - return source + DOT_LITERAL + match[2]; - } - } - }; - - const output = utils.removePrefix(input, state); - let source = create(output); - - if (source && opts.strictSlashes !== true) { - source += `${SLASH_LITERAL}?`; - } - - return source; -}; - -module.exports = parse; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.merge = void 0; +const merge2 = __webpack_require__(243); +function merge(streams) { + const mergedStream = merge2(streams); + streams.forEach((stream) => { + stream.once('error', (error) => mergedStream.emit('error', error)); + }); + mergedStream.once('close', () => propagateCloseEventToSources(streams)); + mergedStream.once('end', () => propagateCloseEventToSources(streams)); + return mergedStream; +} +exports.merge = merge; +function propagateCloseEventToSources(streams) { + streams.forEach((stream) => stream.emit('close')); +} /***/ }), -/* 291 */ +/* 286 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.merge = void 0; -const merge2 = __webpack_require__(243); -function merge(streams) { - const mergedStream = merge2(streams); - streams.forEach((stream) => { - stream.once('error', (error) => mergedStream.emit('error', error)); - }); - mergedStream.once('close', () => propagateCloseEventToSources(streams)); - mergedStream.once('end', () => propagateCloseEventToSources(streams)); - return mergedStream; -} -exports.merge = merge; -function propagateCloseEventToSources(streams) { - streams.forEach((stream) => stream.emit('close')); -} - - -/***/ }), -/* 292 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isEmpty = exports.isString = void 0; -function isString(input) { - return typeof input === 'string'; -} -exports.isString = isString; -function isEmpty(input) { - return input === ''; -} -exports.isEmpty = isEmpty; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isEmpty = exports.isString = void 0; +function isString(input) { + return typeof input === 'string'; +} +exports.isString = isString; +function isEmpty(input) { + return input === ''; +} +exports.isEmpty = isEmpty; /***/ }), -/* 293 */ +/* 287 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(294); -const provider_1 = __webpack_require__(321); -class ProviderAsync extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new stream_1.default(this._settings); - } - read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const entries = []; - return new Promise((resolve, reject) => { - const stream = this.api(root, task, options); - stream.once('error', reject); - stream.on('data', (entry) => entries.push(options.transform(entry))); - stream.once('end', () => resolve(entries)); - }); - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } -} -exports.default = ProviderAsync; + +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = __webpack_require__(288); +const provider_1 = __webpack_require__(315); +class ProviderAsync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new stream_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = []; + return new Promise((resolve, reject) => { + const stream = this.api(root, task, options); + stream.once('error', reject); + stream.on('data', (entry) => entries.push(options.transform(entry))); + stream.once('end', () => resolve(entries)); + }); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports.default = ProviderAsync; /***/ }), -/* 294 */ +/* 288 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(173); -const fsStat = __webpack_require__(295); -const fsWalk = __webpack_require__(300); -const reader_1 = __webpack_require__(320); -class ReaderStream extends reader_1.default { - constructor() { - super(...arguments); - this._walkStream = fsWalk.walkStream; - this._stat = fsStat.stat; - } - dynamic(root, options) { - return this._walkStream(root, options); - } - static(patterns, options) { - const filepaths = patterns.map(this._getFullEntryPath, this); - const stream = new stream_1.PassThrough({ objectMode: true }); - stream._write = (index, _enc, done) => { - return this._getEntry(filepaths[index], patterns[index], options) - .then((entry) => { - if (entry !== null && options.entryFilter(entry)) { - stream.push(entry); - } - if (index === filepaths.length - 1) { - stream.end(); - } - done(); - }) - .catch(done); - }; - for (let i = 0; i < filepaths.length; i++) { - stream.write(i); - } - return stream; - } - _getEntry(filepath, pattern, options) { - return this._getStat(filepath) - .then((stats) => this._makeEntry(stats, pattern)) - .catch((error) => { - if (options.errorFilter(error)) { - return null; - } - throw error; - }); - } - _getStat(filepath) { - return new Promise((resolve, reject) => { - this._stat(filepath, this._fsStatSettings, (error, stats) => { - return error === null ? resolve(stats) : reject(error); - }); - }); - } -} -exports.default = ReaderStream; + +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = __webpack_require__(173); +const fsStat = __webpack_require__(289); +const fsWalk = __webpack_require__(294); +const reader_1 = __webpack_require__(314); +class ReaderStream extends reader_1.default { + constructor() { + super(...arguments); + this._walkStream = fsWalk.walkStream; + this._stat = fsStat.stat; + } + dynamic(root, options) { + return this._walkStream(root, options); + } + static(patterns, options) { + const filepaths = patterns.map(this._getFullEntryPath, this); + const stream = new stream_1.PassThrough({ objectMode: true }); + stream._write = (index, _enc, done) => { + return this._getEntry(filepaths[index], patterns[index], options) + .then((entry) => { + if (entry !== null && options.entryFilter(entry)) { + stream.push(entry); + } + if (index === filepaths.length - 1) { + stream.end(); + } + done(); + }) + .catch(done); + }; + for (let i = 0; i < filepaths.length; i++) { + stream.write(i); + } + return stream; + } + _getEntry(filepath, pattern, options) { + return this._getStat(filepath) + .then((stats) => this._makeEntry(stats, pattern)) + .catch((error) => { + if (options.errorFilter(error)) { + return null; + } + throw error; + }); + } + _getStat(filepath) { + return new Promise((resolve, reject) => { + this._stat(filepath, this._fsStatSettings, (error, stats) => { + return error === null ? resolve(stats) : reject(error); + }); + }); + } +} +exports.default = ReaderStream; /***/ }), -/* 295 */ +/* 289 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async = __webpack_require__(296); -const sync = __webpack_require__(297); -const settings_1 = __webpack_require__(298); +const async = __webpack_require__(290); +const sync = __webpack_require__(291); +const settings_1 = __webpack_require__(292); exports.Settings = settings_1.default; function stat(path, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { @@ -28689,7 +26641,7 @@ function getSettings(settingsOrOptions = {}) { /***/ }), -/* 296 */ +/* 290 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -28727,7 +26679,7 @@ function callSuccessCallback(callback, result) { /***/ }), -/* 297 */ +/* 291 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -28756,13 +26708,13 @@ exports.read = read; /***/ }), -/* 298 */ +/* 292 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(299); +const fs = __webpack_require__(293); class Settings { constructor(_options = {}) { this._options = _options; @@ -28779,7 +26731,7 @@ exports.default = Settings; /***/ }), -/* 299 */ +/* 293 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -28802,16 +26754,16 @@ exports.createFileSystemAdapter = createFileSystemAdapter; /***/ }), -/* 300 */ +/* 294 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async_1 = __webpack_require__(301); -const stream_1 = __webpack_require__(316); -const sync_1 = __webpack_require__(317); -const settings_1 = __webpack_require__(319); +const async_1 = __webpack_require__(295); +const stream_1 = __webpack_require__(310); +const sync_1 = __webpack_require__(311); +const settings_1 = __webpack_require__(313); exports.Settings = settings_1.default; function walk(directory, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { @@ -28841,13 +26793,13 @@ function getSettings(settingsOrOptions = {}) { /***/ }), -/* 301 */ +/* 295 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async_1 = __webpack_require__(302); +const async_1 = __webpack_require__(296); class AsyncProvider { constructor(_root, _settings) { this._root = _root; @@ -28878,17 +26830,17 @@ function callSuccessCallback(callback, entries) { /***/ }), -/* 302 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const events_1 = __webpack_require__(164); -const fsScandir = __webpack_require__(303); -const fastq = __webpack_require__(312); -const common = __webpack_require__(314); -const reader_1 = __webpack_require__(315); +const fsScandir = __webpack_require__(297); +const fastq = __webpack_require__(306); +const common = __webpack_require__(308); +const reader_1 = __webpack_require__(309); class AsyncReader extends reader_1.default { constructor(_root, _settings) { super(_root, _settings); @@ -28978,15 +26930,15 @@ exports.default = AsyncReader; /***/ }), -/* 303 */ +/* 297 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async = __webpack_require__(304); -const sync = __webpack_require__(309); -const settings_1 = __webpack_require__(310); +const async = __webpack_require__(298); +const sync = __webpack_require__(303); +const settings_1 = __webpack_require__(304); exports.Settings = settings_1.default; function scandir(path, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { @@ -29009,16 +26961,16 @@ function getSettings(settingsOrOptions = {}) { /***/ }), -/* 304 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(295); -const rpl = __webpack_require__(305); -const constants_1 = __webpack_require__(306); -const utils = __webpack_require__(307); +const fsStat = __webpack_require__(289); +const rpl = __webpack_require__(299); +const constants_1 = __webpack_require__(300); +const utils = __webpack_require__(301); function read(directory, settings, callback) { if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { return readdirWithFileTypes(directory, settings, callback); @@ -29106,7 +27058,7 @@ function callSuccessCallback(callback, result) { /***/ }), -/* 305 */ +/* 299 */ /***/ (function(module, exports) { module.exports = runParallel @@ -29160,7 +27112,7 @@ function runParallel (tasks, cb) { /***/ }), -/* 306 */ +/* 300 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -29180,18 +27132,18 @@ exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_B /***/ }), -/* 307 */ +/* 301 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(308); +const fs = __webpack_require__(302); exports.fs = fs; /***/ }), -/* 308 */ +/* 302 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -29216,15 +27168,15 @@ exports.createDirentFromStats = createDirentFromStats; /***/ }), -/* 309 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(295); -const constants_1 = __webpack_require__(306); -const utils = __webpack_require__(307); +const fsStat = __webpack_require__(289); +const constants_1 = __webpack_require__(300); +const utils = __webpack_require__(301); function read(directory, settings) { if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { return readdirWithFileTypes(directory, settings); @@ -29275,15 +27227,15 @@ exports.readdir = readdir; /***/ }), -/* 310 */ +/* 304 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(4); -const fsStat = __webpack_require__(295); -const fs = __webpack_require__(311); +const fsStat = __webpack_require__(289); +const fs = __webpack_require__(305); class Settings { constructor(_options = {}) { this._options = _options; @@ -29306,7 +27258,7 @@ exports.default = Settings; /***/ }), -/* 311 */ +/* 305 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -29331,13 +27283,13 @@ exports.createFileSystemAdapter = createFileSystemAdapter; /***/ }), -/* 312 */ +/* 306 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var reusify = __webpack_require__(313) +var reusify = __webpack_require__(307) function fastqueue (context, worker, concurrency) { if (typeof context === 'function') { @@ -29511,7 +27463,7 @@ module.exports = fastqueue /***/ }), -/* 313 */ +/* 307 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -29551,7 +27503,7 @@ module.exports = reusify /***/ }), -/* 314 */ +/* 308 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -29582,13 +27534,13 @@ exports.joinPathSegments = joinPathSegments; /***/ }), -/* 315 */ +/* 309 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const common = __webpack_require__(314); +const common = __webpack_require__(308); class Reader { constructor(_root, _settings) { this._root = _root; @@ -29600,14 +27552,14 @@ exports.default = Reader; /***/ }), -/* 316 */ +/* 310 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const stream_1 = __webpack_require__(173); -const async_1 = __webpack_require__(302); +const async_1 = __webpack_require__(296); class StreamProvider { constructor(_root, _settings) { this._root = _root; @@ -29637,13 +27589,13 @@ exports.default = StreamProvider; /***/ }), -/* 317 */ +/* 311 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const sync_1 = __webpack_require__(318); +const sync_1 = __webpack_require__(312); class SyncProvider { constructor(_root, _settings) { this._root = _root; @@ -29658,15 +27610,15 @@ exports.default = SyncProvider; /***/ }), -/* 318 */ +/* 312 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsScandir = __webpack_require__(303); -const common = __webpack_require__(314); -const reader_1 = __webpack_require__(315); +const fsScandir = __webpack_require__(297); +const common = __webpack_require__(308); +const reader_1 = __webpack_require__(309); class SyncReader extends reader_1.default { constructor() { super(...arguments); @@ -29724,14 +27676,14 @@ exports.default = SyncReader; /***/ }), -/* 319 */ +/* 313 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(4); -const fsScandir = __webpack_require__(303); +const fsScandir = __webpack_require__(297); class Settings { constructor(_options = {}) { this._options = _options; @@ -29757,579 +27709,579 @@ exports.default = Settings; /***/ }), -/* 320 */ +/* 314 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(4); -const fsStat = __webpack_require__(295); -const utils = __webpack_require__(259); -class Reader { - constructor(_settings) { - this._settings = _settings; - this._fsStatSettings = new fsStat.Settings({ - followSymbolicLink: this._settings.followSymbolicLinks, - fs: this._settings.fs, - throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks - }); - } - _getFullEntryPath(filepath) { - return path.resolve(this._settings.cwd, filepath); - } - _makeEntry(stats, pattern) { - const entry = { - name: pattern, - path: pattern, - dirent: utils.fs.createDirentFromStats(pattern, stats) - }; - if (this._settings.stats) { - entry.stats = stats; - } - return entry; - } - _isFatalError(error) { - return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; - } -} -exports.default = Reader; + +Object.defineProperty(exports, "__esModule", { value: true }); +const path = __webpack_require__(4); +const fsStat = __webpack_require__(289); +const utils = __webpack_require__(259); +class Reader { + constructor(_settings) { + this._settings = _settings; + this._fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this._settings.followSymbolicLinks, + fs: this._settings.fs, + throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks + }); + } + _getFullEntryPath(filepath) { + return path.resolve(this._settings.cwd, filepath); + } + _makeEntry(stats, pattern) { + const entry = { + name: pattern, + path: pattern, + dirent: utils.fs.createDirentFromStats(pattern, stats) + }; + if (this._settings.stats) { + entry.stats = stats; + } + return entry; + } + _isFatalError(error) { + return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; + } +} +exports.default = Reader; /***/ }), -/* 321 */ +/* 315 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(4); -const deep_1 = __webpack_require__(322); -const entry_1 = __webpack_require__(325); -const error_1 = __webpack_require__(326); -const entry_2 = __webpack_require__(327); -class Provider { - constructor(_settings) { - this._settings = _settings; - this.errorFilter = new error_1.default(this._settings); - this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions()); - this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions()); - this.entryTransformer = new entry_2.default(this._settings); - } - _getRootDirectory(task) { - return path.resolve(this._settings.cwd, task.base); - } - _getReaderOptions(task) { - const basePath = task.base === '.' ? '' : task.base; - return { - basePath, - pathSegmentSeparator: '/', - concurrency: this._settings.concurrency, - deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), - entryFilter: this.entryFilter.getFilter(task.positive, task.negative), - errorFilter: this.errorFilter.getFilter(), - followSymbolicLinks: this._settings.followSymbolicLinks, - fs: this._settings.fs, - stats: this._settings.stats, - throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, - transform: this.entryTransformer.getTransformer() - }; - } - _getMicromatchOptions() { - return { - dot: this._settings.dot, - matchBase: this._settings.baseNameMatch, - nobrace: !this._settings.braceExpansion, - nocase: !this._settings.caseSensitiveMatch, - noext: !this._settings.extglob, - noglobstar: !this._settings.globstar, - posix: true, - strictSlashes: false - }; - } -} -exports.default = Provider; + +Object.defineProperty(exports, "__esModule", { value: true }); +const path = __webpack_require__(4); +const deep_1 = __webpack_require__(316); +const entry_1 = __webpack_require__(319); +const error_1 = __webpack_require__(320); +const entry_2 = __webpack_require__(321); +class Provider { + constructor(_settings) { + this._settings = _settings; + this.errorFilter = new error_1.default(this._settings); + this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions()); + this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions()); + this.entryTransformer = new entry_2.default(this._settings); + } + _getRootDirectory(task) { + return path.resolve(this._settings.cwd, task.base); + } + _getReaderOptions(task) { + const basePath = task.base === '.' ? '' : task.base; + return { + basePath, + pathSegmentSeparator: '/', + concurrency: this._settings.concurrency, + deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), + entryFilter: this.entryFilter.getFilter(task.positive, task.negative), + errorFilter: this.errorFilter.getFilter(), + followSymbolicLinks: this._settings.followSymbolicLinks, + fs: this._settings.fs, + stats: this._settings.stats, + throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, + transform: this.entryTransformer.getTransformer() + }; + } + _getMicromatchOptions() { + return { + dot: this._settings.dot, + matchBase: this._settings.baseNameMatch, + nobrace: !this._settings.braceExpansion, + nocase: !this._settings.caseSensitiveMatch, + noext: !this._settings.extglob, + noglobstar: !this._settings.globstar, + posix: true, + strictSlashes: false + }; + } +} +exports.default = Provider; /***/ }), -/* 322 */ +/* 316 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(259); -const partial_1 = __webpack_require__(323); -class DeepFilter { - constructor(_settings, _micromatchOptions) { - this._settings = _settings; - this._micromatchOptions = _micromatchOptions; - } - getFilter(basePath, positive, negative) { - const matcher = this._getMatcher(positive); - const negativeRe = this._getNegativePatternsRe(negative); - return (entry) => this._filter(basePath, entry, matcher, negativeRe); - } - _getMatcher(patterns) { - return new partial_1.default(patterns, this._settings, this._micromatchOptions); - } - _getNegativePatternsRe(patterns) { - const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern); - return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); - } - _filter(basePath, entry, matcher, negativeRe) { - if (this._isSkippedByDeep(basePath, entry.path)) { - return false; - } - if (this._isSkippedSymbolicLink(entry)) { - return false; - } - const filepath = utils.path.removeLeadingDotSegment(entry.path); - if (this._isSkippedByPositivePatterns(filepath, matcher)) { - return false; - } - return this._isSkippedByNegativePatterns(filepath, negativeRe); - } - _isSkippedByDeep(basePath, entryPath) { - /** - * Avoid unnecessary depth calculations when it doesn't matter. - */ - if (this._settings.deep === Infinity) { - return false; - } - return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; - } - _getEntryLevel(basePath, entryPath) { - const entryPathDepth = entryPath.split('/').length; - if (basePath === '') { - return entryPathDepth; - } - const basePathDepth = basePath.split('/').length; - return entryPathDepth - basePathDepth; - } - _isSkippedSymbolicLink(entry) { - return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); - } - _isSkippedByPositivePatterns(entryPath, matcher) { - return !this._settings.baseNameMatch && !matcher.match(entryPath); - } - _isSkippedByNegativePatterns(entryPath, patternsRe) { - return !utils.pattern.matchAny(entryPath, patternsRe); - } -} -exports.default = DeepFilter; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(259); +const partial_1 = __webpack_require__(317); +class DeepFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + } + getFilter(basePath, positive, negative) { + const matcher = this._getMatcher(positive); + const negativeRe = this._getNegativePatternsRe(negative); + return (entry) => this._filter(basePath, entry, matcher, negativeRe); + } + _getMatcher(patterns) { + return new partial_1.default(patterns, this._settings, this._micromatchOptions); + } + _getNegativePatternsRe(patterns) { + const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern); + return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); + } + _filter(basePath, entry, matcher, negativeRe) { + if (this._isSkippedByDeep(basePath, entry.path)) { + return false; + } + if (this._isSkippedSymbolicLink(entry)) { + return false; + } + const filepath = utils.path.removeLeadingDotSegment(entry.path); + if (this._isSkippedByPositivePatterns(filepath, matcher)) { + return false; + } + return this._isSkippedByNegativePatterns(filepath, negativeRe); + } + _isSkippedByDeep(basePath, entryPath) { + /** + * Avoid unnecessary depth calculations when it doesn't matter. + */ + if (this._settings.deep === Infinity) { + return false; + } + return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; + } + _getEntryLevel(basePath, entryPath) { + const entryPathDepth = entryPath.split('/').length; + if (basePath === '') { + return entryPathDepth; + } + const basePathDepth = basePath.split('/').length; + return entryPathDepth - basePathDepth; + } + _isSkippedSymbolicLink(entry) { + return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); + } + _isSkippedByPositivePatterns(entryPath, matcher) { + return !this._settings.baseNameMatch && !matcher.match(entryPath); + } + _isSkippedByNegativePatterns(entryPath, patternsRe) { + return !utils.pattern.matchAny(entryPath, patternsRe); + } +} +exports.default = DeepFilter; /***/ }), -/* 323 */ +/* 317 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const matcher_1 = __webpack_require__(324); -class PartialMatcher extends matcher_1.default { - match(filepath) { - const parts = filepath.split('/'); - const levels = parts.length; - const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels); - for (const pattern of patterns) { - const section = pattern.sections[0]; - /** - * In this case, the pattern has a globstar and we must read all directories unconditionally, - * but only if the level has reached the end of the first group. - * - * fixtures/{a,b}/** - * ^ true/false ^ always true - */ - if (!pattern.complete && levels > section.length) { - return true; - } - const match = parts.every((part, index) => { - const segment = pattern.segments[index]; - if (segment.dynamic && segment.patternRe.test(part)) { - return true; - } - if (!segment.dynamic && segment.pattern === part) { - return true; - } - return false; - }); - if (match) { - return true; - } - } - return false; - } -} -exports.default = PartialMatcher; + +Object.defineProperty(exports, "__esModule", { value: true }); +const matcher_1 = __webpack_require__(318); +class PartialMatcher extends matcher_1.default { + match(filepath) { + const parts = filepath.split('/'); + const levels = parts.length; + const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels); + for (const pattern of patterns) { + const section = pattern.sections[0]; + /** + * In this case, the pattern has a globstar and we must read all directories unconditionally, + * but only if the level has reached the end of the first group. + * + * fixtures/{a,b}/** + * ^ true/false ^ always true + */ + if (!pattern.complete && levels > section.length) { + return true; + } + const match = parts.every((part, index) => { + const segment = pattern.segments[index]; + if (segment.dynamic && segment.patternRe.test(part)) { + return true; + } + if (!segment.dynamic && segment.pattern === part) { + return true; + } + return false; + }); + if (match) { + return true; + } + } + return false; + } +} +exports.default = PartialMatcher; /***/ }), -/* 324 */ +/* 318 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(259); -class Matcher { - constructor(_patterns, _settings, _micromatchOptions) { - this._patterns = _patterns; - this._settings = _settings; - this._micromatchOptions = _micromatchOptions; - this._storage = []; - this._fillStorage(); - } - _fillStorage() { - /** - * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level). - * So, before expand patterns with brace expansion into separated patterns. - */ - const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns); - for (const pattern of patterns) { - const segments = this._getPatternSegments(pattern); - const sections = this._splitSegmentsIntoSections(segments); - this._storage.push({ - complete: sections.length <= 1, - pattern, - segments, - sections - }); - } - } - _getPatternSegments(pattern) { - const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions); - return parts.map((part) => { - const dynamic = utils.pattern.isDynamicPattern(part, this._settings); - if (!dynamic) { - return { - dynamic: false, - pattern: part - }; - } - return { - dynamic: true, - pattern: part, - patternRe: utils.pattern.makeRe(part, this._micromatchOptions) - }; - }); - } - _splitSegmentsIntoSections(segments) { - return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern)); - } -} -exports.default = Matcher; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(259); +class Matcher { + constructor(_patterns, _settings, _micromatchOptions) { + this._patterns = _patterns; + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this._storage = []; + this._fillStorage(); + } + _fillStorage() { + /** + * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level). + * So, before expand patterns with brace expansion into separated patterns. + */ + const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns); + for (const pattern of patterns) { + const segments = this._getPatternSegments(pattern); + const sections = this._splitSegmentsIntoSections(segments); + this._storage.push({ + complete: sections.length <= 1, + pattern, + segments, + sections + }); + } + } + _getPatternSegments(pattern) { + const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions); + return parts.map((part) => { + const dynamic = utils.pattern.isDynamicPattern(part, this._settings); + if (!dynamic) { + return { + dynamic: false, + pattern: part + }; + } + return { + dynamic: true, + pattern: part, + patternRe: utils.pattern.makeRe(part, this._micromatchOptions) + }; + }); + } + _splitSegmentsIntoSections(segments) { + return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern)); + } +} +exports.default = Matcher; /***/ }), -/* 325 */ +/* 319 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(259); -class EntryFilter { - constructor(_settings, _micromatchOptions) { - this._settings = _settings; - this._micromatchOptions = _micromatchOptions; - this.index = new Map(); - } - getFilter(positive, negative) { - const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions); - const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions); - return (entry) => this._filter(entry, positiveRe, negativeRe); - } - _filter(entry, positiveRe, negativeRe) { - if (this._settings.unique && this._isDuplicateEntry(entry)) { - return false; - } - if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { - return false; - } - if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) { - return false; - } - const filepath = this._settings.baseNameMatch ? entry.name : entry.path; - const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe); - if (this._settings.unique && isMatched) { - this._createIndexRecord(entry); - } - return isMatched; - } - _isDuplicateEntry(entry) { - return this.index.has(entry.path); - } - _createIndexRecord(entry) { - this.index.set(entry.path, undefined); - } - _onlyFileFilter(entry) { - return this._settings.onlyFiles && !entry.dirent.isFile(); - } - _onlyDirectoryFilter(entry) { - return this._settings.onlyDirectories && !entry.dirent.isDirectory(); - } - _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) { - if (!this._settings.absolute) { - return false; - } - const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath); - return utils.pattern.matchAny(fullpath, patternsRe); - } - _isMatchToPatterns(entryPath, patternsRe) { - const filepath = utils.path.removeLeadingDotSegment(entryPath); - return utils.pattern.matchAny(filepath, patternsRe); - } -} -exports.default = EntryFilter; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(259); +class EntryFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this.index = new Map(); + } + getFilter(positive, negative) { + const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions); + const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions); + return (entry) => this._filter(entry, positiveRe, negativeRe); + } + _filter(entry, positiveRe, negativeRe) { + if (this._settings.unique && this._isDuplicateEntry(entry)) { + return false; + } + if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { + return false; + } + if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) { + return false; + } + const filepath = this._settings.baseNameMatch ? entry.name : entry.path; + const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe); + if (this._settings.unique && isMatched) { + this._createIndexRecord(entry); + } + return isMatched; + } + _isDuplicateEntry(entry) { + return this.index.has(entry.path); + } + _createIndexRecord(entry) { + this.index.set(entry.path, undefined); + } + _onlyFileFilter(entry) { + return this._settings.onlyFiles && !entry.dirent.isFile(); + } + _onlyDirectoryFilter(entry) { + return this._settings.onlyDirectories && !entry.dirent.isDirectory(); + } + _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) { + if (!this._settings.absolute) { + return false; + } + const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath); + return utils.pattern.matchAny(fullpath, patternsRe); + } + _isMatchToPatterns(entryPath, patternsRe) { + const filepath = utils.path.removeLeadingDotSegment(entryPath); + return utils.pattern.matchAny(filepath, patternsRe); + } +} +exports.default = EntryFilter; /***/ }), -/* 326 */ +/* 320 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(259); -class ErrorFilter { - constructor(_settings) { - this._settings = _settings; - } - getFilter() { - return (error) => this._isNonFatalError(error); - } - _isNonFatalError(error) { - return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; - } -} -exports.default = ErrorFilter; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(259); +class ErrorFilter { + constructor(_settings) { + this._settings = _settings; + } + getFilter() { + return (error) => this._isNonFatalError(error); + } + _isNonFatalError(error) { + return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; + } +} +exports.default = ErrorFilter; /***/ }), -/* 327 */ +/* 321 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(259); -class EntryTransformer { - constructor(_settings) { - this._settings = _settings; - } - getTransformer() { - return (entry) => this._transform(entry); - } - _transform(entry) { - let filepath = entry.path; - if (this._settings.absolute) { - filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); - filepath = utils.path.unixify(filepath); - } - if (this._settings.markDirectories && entry.dirent.isDirectory()) { - filepath += '/'; - } - if (!this._settings.objectMode) { - return filepath; - } - return Object.assign(Object.assign({}, entry), { path: filepath }); - } -} -exports.default = EntryTransformer; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(259); +class EntryTransformer { + constructor(_settings) { + this._settings = _settings; + } + getTransformer() { + return (entry) => this._transform(entry); + } + _transform(entry) { + let filepath = entry.path; + if (this._settings.absolute) { + filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); + filepath = utils.path.unixify(filepath); + } + if (this._settings.markDirectories && entry.dirent.isDirectory()) { + filepath += '/'; + } + if (!this._settings.objectMode) { + return filepath; + } + return Object.assign(Object.assign({}, entry), { path: filepath }); + } +} +exports.default = EntryTransformer; /***/ }), -/* 328 */ +/* 322 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(173); -const stream_2 = __webpack_require__(294); -const provider_1 = __webpack_require__(321); -class ProviderStream extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new stream_2.default(this._settings); - } - read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const source = this.api(root, task, options); - const destination = new stream_1.Readable({ objectMode: true, read: () => { } }); - source - .once('error', (error) => destination.emit('error', error)) - .on('data', (entry) => destination.emit('data', options.transform(entry))) - .once('end', () => destination.emit('end')); - destination - .once('close', () => source.destroy()); - return destination; - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } -} -exports.default = ProviderStream; + +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = __webpack_require__(173); +const stream_2 = __webpack_require__(288); +const provider_1 = __webpack_require__(315); +class ProviderStream extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new stream_2.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const source = this.api(root, task, options); + const destination = new stream_1.Readable({ objectMode: true, read: () => { } }); + source + .once('error', (error) => destination.emit('error', error)) + .on('data', (entry) => destination.emit('data', options.transform(entry))) + .once('end', () => destination.emit('end')); + destination + .once('close', () => source.destroy()); + return destination; + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports.default = ProviderStream; /***/ }), -/* 329 */ +/* 323 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const sync_1 = __webpack_require__(330); -const provider_1 = __webpack_require__(321); -class ProviderSync extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new sync_1.default(this._settings); - } - read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const entries = this.api(root, task, options); - return entries.map(options.transform); - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } -} -exports.default = ProviderSync; + +Object.defineProperty(exports, "__esModule", { value: true }); +const sync_1 = __webpack_require__(324); +const provider_1 = __webpack_require__(315); +class ProviderSync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new sync_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = this.api(root, task, options); + return entries.map(options.transform); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports.default = ProviderSync; /***/ }), -/* 330 */ +/* 324 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(295); -const fsWalk = __webpack_require__(300); -const reader_1 = __webpack_require__(320); -class ReaderSync extends reader_1.default { - constructor() { - super(...arguments); - this._walkSync = fsWalk.walkSync; - this._statSync = fsStat.statSync; - } - dynamic(root, options) { - return this._walkSync(root, options); - } - static(patterns, options) { - const entries = []; - for (const pattern of patterns) { - const filepath = this._getFullEntryPath(pattern); - const entry = this._getEntry(filepath, pattern, options); - if (entry === null || !options.entryFilter(entry)) { - continue; - } - entries.push(entry); - } - return entries; - } - _getEntry(filepath, pattern, options) { - try { - const stats = this._getStat(filepath); - return this._makeEntry(stats, pattern); - } - catch (error) { - if (options.errorFilter(error)) { - return null; - } - throw error; - } - } - _getStat(filepath) { - return this._statSync(filepath, this._fsStatSettings); - } -} -exports.default = ReaderSync; + +Object.defineProperty(exports, "__esModule", { value: true }); +const fsStat = __webpack_require__(289); +const fsWalk = __webpack_require__(294); +const reader_1 = __webpack_require__(314); +class ReaderSync extends reader_1.default { + constructor() { + super(...arguments); + this._walkSync = fsWalk.walkSync; + this._statSync = fsStat.statSync; + } + dynamic(root, options) { + return this._walkSync(root, options); + } + static(patterns, options) { + const entries = []; + for (const pattern of patterns) { + const filepath = this._getFullEntryPath(pattern); + const entry = this._getEntry(filepath, pattern, options); + if (entry === null || !options.entryFilter(entry)) { + continue; + } + entries.push(entry); + } + return entries; + } + _getEntry(filepath, pattern, options) { + try { + const stats = this._getStat(filepath); + return this._makeEntry(stats, pattern); + } + catch (error) { + if (options.errorFilter(error)) { + return null; + } + throw error; + } + } + _getStat(filepath) { + return this._statSync(filepath, this._fsStatSettings); + } +} +exports.default = ReaderSync; /***/ }), -/* 331 */ +/* 325 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; -const fs = __webpack_require__(132); -const os = __webpack_require__(122); -/** - * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero. - * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107 - */ -const CPU_COUNT = Math.max(os.cpus().length, 1); -exports.DEFAULT_FILE_SYSTEM_ADAPTER = { - lstat: fs.lstat, - lstatSync: fs.lstatSync, - stat: fs.stat, - statSync: fs.statSync, - readdir: fs.readdir, - readdirSync: fs.readdirSync -}; -class Settings { - constructor(_options = {}) { - this._options = _options; - this.absolute = this._getValue(this._options.absolute, false); - this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); - this.braceExpansion = this._getValue(this._options.braceExpansion, true); - this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); - this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); - this.cwd = this._getValue(this._options.cwd, process.cwd()); - this.deep = this._getValue(this._options.deep, Infinity); - this.dot = this._getValue(this._options.dot, false); - this.extglob = this._getValue(this._options.extglob, true); - this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); - this.fs = this._getFileSystemMethods(this._options.fs); - this.globstar = this._getValue(this._options.globstar, true); - this.ignore = this._getValue(this._options.ignore, []); - this.markDirectories = this._getValue(this._options.markDirectories, false); - this.objectMode = this._getValue(this._options.objectMode, false); - this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); - this.onlyFiles = this._getValue(this._options.onlyFiles, true); - this.stats = this._getValue(this._options.stats, false); - this.suppressErrors = this._getValue(this._options.suppressErrors, false); - this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); - this.unique = this._getValue(this._options.unique, true); - if (this.onlyDirectories) { - this.onlyFiles = false; - } - if (this.stats) { - this.objectMode = true; - } - } - _getValue(option, value) { - return option === undefined ? value : option; - } - _getFileSystemMethods(methods = {}) { - return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); - } -} -exports.default = Settings; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; +const fs = __webpack_require__(132); +const os = __webpack_require__(122); +/** + * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero. + * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107 + */ +const CPU_COUNT = Math.max(os.cpus().length, 1); +exports.DEFAULT_FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + lstatSync: fs.lstatSync, + stat: fs.stat, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; +class Settings { + constructor(_options = {}) { + this._options = _options; + this.absolute = this._getValue(this._options.absolute, false); + this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); + this.braceExpansion = this._getValue(this._options.braceExpansion, true); + this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); + this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); + this.cwd = this._getValue(this._options.cwd, process.cwd()); + this.deep = this._getValue(this._options.deep, Infinity); + this.dot = this._getValue(this._options.dot, false); + this.extglob = this._getValue(this._options.extglob, true); + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); + this.fs = this._getFileSystemMethods(this._options.fs); + this.globstar = this._getValue(this._options.globstar, true); + this.ignore = this._getValue(this._options.ignore, []); + this.markDirectories = this._getValue(this._options.markDirectories, false); + this.objectMode = this._getValue(this._options.objectMode, false); + this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); + this.onlyFiles = this._getValue(this._options.onlyFiles, true); + this.stats = this._getValue(this._options.stats, false); + this.suppressErrors = this._getValue(this._options.suppressErrors, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); + this.unique = this._getValue(this._options.unique, true); + if (this.onlyDirectories) { + this.onlyFiles = false; + } + if (this.stats) { + this.objectMode = true; + } + } + _getValue(option, value) { + return option === undefined ? value : option; + } + _getFileSystemMethods(methods = {}) { + return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); + } +} +exports.default = Settings; /***/ }), -/* 332 */ +/* 326 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const pathType = __webpack_require__(333); +const pathType = __webpack_require__(327); const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]; @@ -30405,7 +28357,7 @@ module.exports.sync = (input, options) => { /***/ }), -/* 333 */ +/* 327 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -30455,7 +28407,7 @@ exports.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink'); /***/ }), -/* 334 */ +/* 328 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -30464,8 +28416,8 @@ const {promisify} = __webpack_require__(113); const fs = __webpack_require__(132); const path = __webpack_require__(4); const fastGlob = __webpack_require__(257); -const gitIgnore = __webpack_require__(335); -const slash = __webpack_require__(336); +const gitIgnore = __webpack_require__(329); +const slash = __webpack_require__(330); const DEFAULT_IGNORE = [ '**/node_modules/**', @@ -30579,7 +28531,7 @@ module.exports.sync = options => { /***/ }), -/* 335 */ +/* 329 */ /***/ (function(module, exports) { // A simple implementation of make-array @@ -31182,7 +29134,7 @@ if ( /***/ }), -/* 336 */ +/* 330 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31200,7 +29152,7 @@ module.exports = path => { /***/ }), -/* 337 */ +/* 331 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31253,7 +29205,7 @@ module.exports = { /***/ }), -/* 338 */ +/* 332 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31275,7 +29227,7 @@ module.exports = path_ => { /***/ }), -/* 339 */ +/* 333 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31303,7 +29255,7 @@ module.exports = (childPath, parentPath) => { /***/ }), -/* 340 */ +/* 334 */ /***/ (function(module, exports, __webpack_require__) { const assert = __webpack_require__(162) @@ -31669,12 +29621,12 @@ rimraf.sync = rimrafSync /***/ }), -/* 341 */ +/* 335 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const AggregateError = __webpack_require__(342); +const AggregateError = __webpack_require__(336); module.exports = async ( iterable, @@ -31757,13 +29709,13 @@ module.exports = async ( /***/ }), -/* 342 */ +/* 336 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const indentString = __webpack_require__(343); -const cleanStack = __webpack_require__(344); +const indentString = __webpack_require__(337); +const cleanStack = __webpack_require__(338); const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, ''); @@ -31811,7 +29763,7 @@ module.exports = AggregateError; /***/ }), -/* 343 */ +/* 337 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31853,7 +29805,7 @@ module.exports = (string, count = 1, options) => { /***/ }), -/* 344 */ +/* 338 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -31900,7 +29852,7 @@ module.exports = (stack, options) => { /***/ }), -/* 345 */ +/* 339 */ /***/ (function(module, exports, __webpack_require__) { var fs = __webpack_require__(132), @@ -32167,7 +30119,7 @@ function ncp (source, dest, options, callback) { /***/ }), -/* 346 */ +/* 340 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -32184,8 +30136,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(113); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(347); -/* harmony import */ var _project__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(348); +/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(341); +/* harmony import */ var _project__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(342); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License @@ -32360,7 +30312,7 @@ function includeTransitiveProjects(subsetOfProjects, allProjects, { } /***/ }), -/* 347 */ +/* 341 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -32382,7 +30334,7 @@ class CliError extends Error { } /***/ }), -/* 348 */ +/* 342 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -32394,10 +30346,10 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(113); /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(347); +/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(341); /* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(220); -/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(349); -/* harmony import */ var _scripts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(413); +/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(343); +/* harmony import */ var _scripts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(407); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } @@ -32590,7 +30542,7 @@ function normalizePath(path) { } /***/ }), -/* 349 */ +/* 343 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -32601,9 +30553,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isLinkDependency", function() { return isLinkDependency; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBazelPackageDependency", function() { return isBazelPackageDependency; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformDependencies", function() { return transformDependencies; }); -/* harmony import */ var read_pkg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(350); +/* harmony import */ var read_pkg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(344); /* harmony import */ var read_pkg__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(read_pkg__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var write_pkg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(402); +/* harmony import */ var write_pkg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(396); /* harmony import */ var write_pkg__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(write_pkg__WEBPACK_IMPORTED_MODULE_1__); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } @@ -32671,7 +30623,7 @@ function transformDependencies(dependencies = {}) { } /***/ }), -/* 350 */ +/* 344 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -32679,7 +30631,7 @@ function transformDependencies(dependencies = {}) { const {promisify} = __webpack_require__(113); const fs = __webpack_require__(132); const path = __webpack_require__(4); -const parseJson = __webpack_require__(351); +const parseJson = __webpack_require__(345); const readFileAsync = promisify(fs.readFile); @@ -32694,7 +30646,7 @@ module.exports = async options => { const json = parseJson(await readFileAsync(filePath, 'utf8')); if (options.normalize) { - __webpack_require__(372)(json); + __webpack_require__(366)(json); } return json; @@ -32711,7 +30663,7 @@ module.exports.sync = options => { const json = parseJson(fs.readFileSync(filePath, 'utf8')); if (options.normalize) { - __webpack_require__(372)(json); + __webpack_require__(366)(json); } return json; @@ -32719,15 +30671,15 @@ module.exports.sync = options => { /***/ }), -/* 351 */ +/* 345 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const errorEx = __webpack_require__(352); -const fallback = __webpack_require__(354); -const {default: LinesAndColumns} = __webpack_require__(355); -const {codeFrameColumns} = __webpack_require__(356); +const errorEx = __webpack_require__(346); +const fallback = __webpack_require__(348); +const {default: LinesAndColumns} = __webpack_require__(349); +const {codeFrameColumns} = __webpack_require__(350); const JSONError = errorEx('JSONError', { fileName: errorEx.append('in %s'), @@ -32776,14 +30728,14 @@ module.exports = (string, reviver, filename) => { /***/ }), -/* 352 */ +/* 346 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var util = __webpack_require__(113); -var isArrayish = __webpack_require__(353); +var isArrayish = __webpack_require__(347); var errorEx = function errorEx(name, properties) { if (!name || name.constructor !== String) { @@ -32916,7 +30868,7 @@ module.exports = errorEx; /***/ }), -/* 353 */ +/* 347 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -32933,7 +30885,7 @@ module.exports = function isArrayish(obj) { /***/ }), -/* 354 */ +/* 348 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -32978,7 +30930,7 @@ function parseJson (txt, reviver, context) { /***/ }), -/* 355 */ +/* 349 */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; @@ -33042,7 +30994,7 @@ var LinesAndColumns = (function () { /***/ }), -/* 356 */ +/* 350 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33054,7 +31006,7 @@ Object.defineProperty(exports, "__esModule", { exports.codeFrameColumns = codeFrameColumns; exports.default = _default; -var _highlight = __webpack_require__(357); +var _highlight = __webpack_require__(351); let deprecationWarningShown = false; @@ -33211,7 +31163,7 @@ function _default(rawLines, lineNumber, colNumber, opts = {}) { } /***/ }), -/* 357 */ +/* 351 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33224,11 +31176,11 @@ exports.default = highlight; exports.getChalk = getChalk; exports.shouldHighlight = shouldHighlight; -var _jsTokens = __webpack_require__(358); +var _jsTokens = __webpack_require__(352); -var _helperValidatorIdentifier = __webpack_require__(359); +var _helperValidatorIdentifier = __webpack_require__(353); -var _chalk = __webpack_require__(362); +var _chalk = __webpack_require__(356); const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]); @@ -33333,7 +31285,7 @@ function highlight(code, options = {}) { } /***/ }), -/* 358 */ +/* 352 */ /***/ (function(module, exports) { // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell @@ -33362,7 +31314,7 @@ exports.matchToToken = function(match) { /***/ }), -/* 359 */ +/* 353 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33420,12 +31372,12 @@ Object.defineProperty(exports, "isKeyword", { } }); -var _identifier = __webpack_require__(360); +var _identifier = __webpack_require__(354); -var _keyword = __webpack_require__(361); +var _keyword = __webpack_require__(355); /***/ }), -/* 360 */ +/* 354 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33515,7 +31467,7 @@ function isIdentifierName(name) { } /***/ }), -/* 361 */ +/* 355 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33559,16 +31511,16 @@ function isKeyword(word) { } /***/ }), -/* 362 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const escapeStringRegexp = __webpack_require__(363); -const ansiStyles = __webpack_require__(364); -const stdoutColor = __webpack_require__(369).stdout; +const escapeStringRegexp = __webpack_require__(357); +const ansiStyles = __webpack_require__(358); +const stdoutColor = __webpack_require__(363).stdout; -const template = __webpack_require__(371); +const template = __webpack_require__(365); const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); @@ -33794,7 +31746,7 @@ module.exports.default = module.exports; // For TypeScript /***/ }), -/* 363 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33812,12 +31764,12 @@ module.exports = function (str) { /***/ }), -/* 364 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) { -const colorConvert = __webpack_require__(365); +const colorConvert = __webpack_require__(359); const wrapAnsi16 = (fn, offset) => function () { const code = fn.apply(colorConvert, arguments); @@ -33985,11 +31937,11 @@ Object.defineProperty(module, 'exports', { /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(116)(module))) /***/ }), -/* 365 */ +/* 359 */ /***/ (function(module, exports, __webpack_require__) { -var conversions = __webpack_require__(366); -var route = __webpack_require__(368); +var conversions = __webpack_require__(360); +var route = __webpack_require__(362); var convert = {}; @@ -34069,11 +32021,11 @@ module.exports = convert; /***/ }), -/* 366 */ +/* 360 */ /***/ (function(module, exports, __webpack_require__) { /* MIT license */ -var cssKeywords = __webpack_require__(367); +var cssKeywords = __webpack_require__(361); // NOTE: conversions should only return primitive values (i.e. arrays, or // values that give correct `typeof` results). @@ -34943,7 +32895,7 @@ convert.rgb.gray = function (rgb) { /***/ }), -/* 367 */ +/* 361 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35102,10 +33054,10 @@ module.exports = { /***/ }), -/* 368 */ +/* 362 */ /***/ (function(module, exports, __webpack_require__) { -var conversions = __webpack_require__(366); +var conversions = __webpack_require__(360); /* this function routes a model to all other models. @@ -35205,13 +33157,13 @@ module.exports = function (fromModel) { /***/ }), -/* 369 */ +/* 363 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const os = __webpack_require__(122); -const hasFlag = __webpack_require__(370); +const hasFlag = __webpack_require__(364); const env = process.env; @@ -35343,7 +33295,7 @@ module.exports = { /***/ }), -/* 370 */ +/* 364 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35358,7 +33310,7 @@ module.exports = (flag, argv) => { /***/ }), -/* 371 */ +/* 365 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35493,15 +33445,15 @@ module.exports = (chalk, tmp) => { /***/ }), -/* 372 */ +/* 366 */ /***/ (function(module, exports, __webpack_require__) { module.exports = normalize -var fixer = __webpack_require__(373) +var fixer = __webpack_require__(367) normalize.fixer = fixer -var makeWarning = __webpack_require__(400) +var makeWarning = __webpack_require__(394) var fieldsToFix = ['name','version','description','repository','modules','scripts' ,'files','bin','man','bugs','keywords','readme','homepage','license'] @@ -35538,17 +33490,17 @@ function ucFirst (string) { /***/ }), -/* 373 */ +/* 367 */ /***/ (function(module, exports, __webpack_require__) { -var semver = __webpack_require__(374) -var validateLicense = __webpack_require__(375); -var hostedGitInfo = __webpack_require__(380) -var isBuiltinModule = __webpack_require__(383).isCore +var semver = __webpack_require__(368) +var validateLicense = __webpack_require__(369); +var hostedGitInfo = __webpack_require__(374) +var isBuiltinModule = __webpack_require__(377).isCore var depTypes = ["dependencies","devDependencies","optionalDependencies"] -var extractDescription = __webpack_require__(398) +var extractDescription = __webpack_require__(392) var url = __webpack_require__(203) -var typos = __webpack_require__(399) +var typos = __webpack_require__(393) var fixer = module.exports = { // default warning function @@ -35962,7 +33914,7 @@ function bugsTypos(bugs, warn) { /***/ }), -/* 374 */ +/* 368 */ /***/ (function(module, exports) { exports = module.exports = SemVer @@ -37451,11 +35403,11 @@ function coerce (version) { /***/ }), -/* 375 */ +/* 369 */ /***/ (function(module, exports, __webpack_require__) { -var parse = __webpack_require__(376); -var correct = __webpack_require__(378); +var parse = __webpack_require__(370); +var correct = __webpack_require__(372); var genericWarning = ( 'license should be ' + @@ -37541,10 +35493,10 @@ module.exports = function(argument) { /***/ }), -/* 376 */ +/* 370 */ /***/ (function(module, exports, __webpack_require__) { -var parser = __webpack_require__(377).parser +var parser = __webpack_require__(371).parser module.exports = function (argument) { return parser.parse(argument) @@ -37552,7 +35504,7 @@ module.exports = function (argument) { /***/ }), -/* 377 */ +/* 371 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {/* parser generated by jison 0.4.17 */ @@ -38916,10 +36868,10 @@ if ( true && __webpack_require__.c[__webpack_require__.s] === module) { /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(116)(module))) /***/ }), -/* 378 */ +/* 372 */ /***/ (function(module, exports, __webpack_require__) { -var licenseIDs = __webpack_require__(379); +var licenseIDs = __webpack_require__(373); function valid(string) { return licenseIDs.indexOf(string) > -1; @@ -39159,20 +37111,20 @@ module.exports = function(identifier) { /***/ }), -/* 379 */ +/* 373 */ /***/ (function(module) { module.exports = JSON.parse("[\"Glide\",\"Abstyles\",\"AFL-1.1\",\"AFL-1.2\",\"AFL-2.0\",\"AFL-2.1\",\"AFL-3.0\",\"AMPAS\",\"APL-1.0\",\"Adobe-Glyph\",\"APAFML\",\"Adobe-2006\",\"AGPL-1.0\",\"Afmparse\",\"Aladdin\",\"ADSL\",\"AMDPLPA\",\"ANTLR-PD\",\"Apache-1.0\",\"Apache-1.1\",\"Apache-2.0\",\"AML\",\"APSL-1.0\",\"APSL-1.1\",\"APSL-1.2\",\"APSL-2.0\",\"Artistic-1.0\",\"Artistic-1.0-Perl\",\"Artistic-1.0-cl8\",\"Artistic-2.0\",\"AAL\",\"Bahyph\",\"Barr\",\"Beerware\",\"BitTorrent-1.0\",\"BitTorrent-1.1\",\"BSL-1.0\",\"Borceux\",\"BSD-2-Clause\",\"BSD-2-Clause-FreeBSD\",\"BSD-2-Clause-NetBSD\",\"BSD-3-Clause\",\"BSD-3-Clause-Clear\",\"BSD-4-Clause\",\"BSD-Protection\",\"BSD-Source-Code\",\"BSD-3-Clause-Attribution\",\"0BSD\",\"BSD-4-Clause-UC\",\"bzip2-1.0.5\",\"bzip2-1.0.6\",\"Caldera\",\"CECILL-1.0\",\"CECILL-1.1\",\"CECILL-2.0\",\"CECILL-2.1\",\"CECILL-B\",\"CECILL-C\",\"ClArtistic\",\"MIT-CMU\",\"CNRI-Jython\",\"CNRI-Python\",\"CNRI-Python-GPL-Compatible\",\"CPOL-1.02\",\"CDDL-1.0\",\"CDDL-1.1\",\"CPAL-1.0\",\"CPL-1.0\",\"CATOSL-1.1\",\"Condor-1.1\",\"CC-BY-1.0\",\"CC-BY-2.0\",\"CC-BY-2.5\",\"CC-BY-3.0\",\"CC-BY-4.0\",\"CC-BY-ND-1.0\",\"CC-BY-ND-2.0\",\"CC-BY-ND-2.5\",\"CC-BY-ND-3.0\",\"CC-BY-ND-4.0\",\"CC-BY-NC-1.0\",\"CC-BY-NC-2.0\",\"CC-BY-NC-2.5\",\"CC-BY-NC-3.0\",\"CC-BY-NC-4.0\",\"CC-BY-NC-ND-1.0\",\"CC-BY-NC-ND-2.0\",\"CC-BY-NC-ND-2.5\",\"CC-BY-NC-ND-3.0\",\"CC-BY-NC-ND-4.0\",\"CC-BY-NC-SA-1.0\",\"CC-BY-NC-SA-2.0\",\"CC-BY-NC-SA-2.5\",\"CC-BY-NC-SA-3.0\",\"CC-BY-NC-SA-4.0\",\"CC-BY-SA-1.0\",\"CC-BY-SA-2.0\",\"CC-BY-SA-2.5\",\"CC-BY-SA-3.0\",\"CC-BY-SA-4.0\",\"CC0-1.0\",\"Crossword\",\"CrystalStacker\",\"CUA-OPL-1.0\",\"Cube\",\"curl\",\"D-FSL-1.0\",\"diffmark\",\"WTFPL\",\"DOC\",\"Dotseqn\",\"DSDP\",\"dvipdfm\",\"EPL-1.0\",\"ECL-1.0\",\"ECL-2.0\",\"eGenix\",\"EFL-1.0\",\"EFL-2.0\",\"MIT-advertising\",\"MIT-enna\",\"Entessa\",\"ErlPL-1.1\",\"EUDatagrid\",\"EUPL-1.0\",\"EUPL-1.1\",\"Eurosym\",\"Fair\",\"MIT-feh\",\"Frameworx-1.0\",\"FreeImage\",\"FTL\",\"FSFAP\",\"FSFUL\",\"FSFULLR\",\"Giftware\",\"GL2PS\",\"Glulxe\",\"AGPL-3.0\",\"GFDL-1.1\",\"GFDL-1.2\",\"GFDL-1.3\",\"GPL-1.0\",\"GPL-2.0\",\"GPL-3.0\",\"LGPL-2.1\",\"LGPL-3.0\",\"LGPL-2.0\",\"gnuplot\",\"gSOAP-1.3b\",\"HaskellReport\",\"HPND\",\"IBM-pibs\",\"IPL-1.0\",\"ICU\",\"ImageMagick\",\"iMatix\",\"Imlib2\",\"IJG\",\"Info-ZIP\",\"Intel-ACPI\",\"Intel\",\"Interbase-1.0\",\"IPA\",\"ISC\",\"JasPer-2.0\",\"JSON\",\"LPPL-1.0\",\"LPPL-1.1\",\"LPPL-1.2\",\"LPPL-1.3a\",\"LPPL-1.3c\",\"Latex2e\",\"BSD-3-Clause-LBNL\",\"Leptonica\",\"LGPLLR\",\"Libpng\",\"libtiff\",\"LAL-1.2\",\"LAL-1.3\",\"LiLiQ-P-1.1\",\"LiLiQ-Rplus-1.1\",\"LiLiQ-R-1.1\",\"LPL-1.02\",\"LPL-1.0\",\"MakeIndex\",\"MTLL\",\"MS-PL\",\"MS-RL\",\"MirOS\",\"MITNFA\",\"MIT\",\"Motosoto\",\"MPL-1.0\",\"MPL-1.1\",\"MPL-2.0\",\"MPL-2.0-no-copyleft-exception\",\"mpich2\",\"Multics\",\"Mup\",\"NASA-1.3\",\"Naumen\",\"NBPL-1.0\",\"NetCDF\",\"NGPL\",\"NOSL\",\"NPL-1.0\",\"NPL-1.1\",\"Newsletr\",\"NLPL\",\"Nokia\",\"NPOSL-3.0\",\"NLOD-1.0\",\"Noweb\",\"NRL\",\"NTP\",\"Nunit\",\"OCLC-2.0\",\"ODbL-1.0\",\"PDDL-1.0\",\"OCCT-PL\",\"OGTSL\",\"OLDAP-2.2.2\",\"OLDAP-1.1\",\"OLDAP-1.2\",\"OLDAP-1.3\",\"OLDAP-1.4\",\"OLDAP-2.0\",\"OLDAP-2.0.1\",\"OLDAP-2.1\",\"OLDAP-2.2\",\"OLDAP-2.2.1\",\"OLDAP-2.3\",\"OLDAP-2.4\",\"OLDAP-2.5\",\"OLDAP-2.6\",\"OLDAP-2.7\",\"OLDAP-2.8\",\"OML\",\"OPL-1.0\",\"OSL-1.0\",\"OSL-1.1\",\"OSL-2.0\",\"OSL-2.1\",\"OSL-3.0\",\"OpenSSL\",\"OSET-PL-2.1\",\"PHP-3.0\",\"PHP-3.01\",\"Plexus\",\"PostgreSQL\",\"psfrag\",\"psutils\",\"Python-2.0\",\"QPL-1.0\",\"Qhull\",\"Rdisc\",\"RPSL-1.0\",\"RPL-1.1\",\"RPL-1.5\",\"RHeCos-1.1\",\"RSCPL\",\"RSA-MD\",\"Ruby\",\"SAX-PD\",\"Saxpath\",\"SCEA\",\"SWL\",\"SMPPL\",\"Sendmail\",\"SGI-B-1.0\",\"SGI-B-1.1\",\"SGI-B-2.0\",\"OFL-1.0\",\"OFL-1.1\",\"SimPL-2.0\",\"Sleepycat\",\"SNIA\",\"Spencer-86\",\"Spencer-94\",\"Spencer-99\",\"SMLNJ\",\"SugarCRM-1.1.3\",\"SISSL\",\"SISSL-1.2\",\"SPL-1.0\",\"Watcom-1.0\",\"TCL\",\"Unlicense\",\"TMate\",\"TORQUE-1.1\",\"TOSL\",\"Unicode-TOU\",\"UPL-1.0\",\"NCSA\",\"Vim\",\"VOSTROM\",\"VSL-1.0\",\"W3C-19980720\",\"W3C\",\"Wsuipa\",\"Xnet\",\"X11\",\"Xerox\",\"XFree86-1.1\",\"xinetd\",\"xpp\",\"XSkat\",\"YPL-1.0\",\"YPL-1.1\",\"Zed\",\"Zend-2.0\",\"Zimbra-1.3\",\"Zimbra-1.4\",\"Zlib\",\"zlib-acknowledgement\",\"ZPL-1.1\",\"ZPL-2.0\",\"ZPL-2.1\",\"BSD-3-Clause-No-Nuclear-License\",\"BSD-3-Clause-No-Nuclear-Warranty\",\"BSD-3-Clause-No-Nuclear-License-2014\",\"eCos-2.0\",\"GPL-2.0-with-autoconf-exception\",\"GPL-2.0-with-bison-exception\",\"GPL-2.0-with-classpath-exception\",\"GPL-2.0-with-font-exception\",\"GPL-2.0-with-GCC-exception\",\"GPL-3.0-with-autoconf-exception\",\"GPL-3.0-with-GCC-exception\",\"StandardML-NJ\",\"WXwindows\"]"); /***/ }), -/* 380 */ +/* 374 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var url = __webpack_require__(203) -var gitHosts = __webpack_require__(381) -var GitHost = module.exports = __webpack_require__(382) +var gitHosts = __webpack_require__(375) +var GitHost = module.exports = __webpack_require__(376) var protocolToRepresentationMap = { 'git+ssh:': 'sshurl', @@ -39320,7 +37272,7 @@ function parseGitUrl (giturl) { /***/ }), -/* 381 */ +/* 375 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -39406,12 +37358,12 @@ function formatHashFragment (fragment) { /***/ }), -/* 382 */ +/* 376 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var gitHosts = __webpack_require__(381) +var gitHosts = __webpack_require__(375) /* eslint-disable node/no-deprecated-api */ // copy-pasta util._extend from node's source, to avoid pulling @@ -39569,27 +37521,27 @@ GitHost.prototype.toString = function (opts) { /***/ }), -/* 383 */ +/* 377 */ /***/ (function(module, exports, __webpack_require__) { -var async = __webpack_require__(384); -async.core = __webpack_require__(394); -async.isCore = __webpack_require__(396); -async.sync = __webpack_require__(397); +var async = __webpack_require__(378); +async.core = __webpack_require__(388); +async.isCore = __webpack_require__(390); +async.sync = __webpack_require__(391); module.exports = async; /***/ }), -/* 384 */ +/* 378 */ /***/ (function(module, exports, __webpack_require__) { var fs = __webpack_require__(132); var path = __webpack_require__(4); -var caller = __webpack_require__(385); -var nodeModulesPaths = __webpack_require__(386); -var normalizeOptions = __webpack_require__(388); -var isCore = __webpack_require__(389); +var caller = __webpack_require__(379); +var nodeModulesPaths = __webpack_require__(380); +var normalizeOptions = __webpack_require__(382); +var isCore = __webpack_require__(383); var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; @@ -39907,7 +37859,7 @@ module.exports = function resolve(x, options, callback) { /***/ }), -/* 385 */ +/* 379 */ /***/ (function(module, exports) { module.exports = function () { @@ -39921,11 +37873,11 @@ module.exports = function () { /***/ }), -/* 386 */ +/* 380 */ /***/ (function(module, exports, __webpack_require__) { var path = __webpack_require__(4); -var parse = path.parse || __webpack_require__(387); +var parse = path.parse || __webpack_require__(381); var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { var prefix = '/'; @@ -39969,7 +37921,7 @@ module.exports = function nodeModulesPaths(start, opts, request) { /***/ }), -/* 387 */ +/* 381 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -40051,7 +38003,7 @@ module.exports.win32 = win32.parse; /***/ }), -/* 388 */ +/* 382 */ /***/ (function(module, exports) { module.exports = function (x, opts) { @@ -40067,13 +38019,13 @@ module.exports = function (x, opts) { /***/ }), -/* 389 */ +/* 383 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var has = __webpack_require__(390); +var has = __webpack_require__(384); function specifierIncluded(current, specifier) { var nodeParts = current.split('.'); @@ -40135,7 +38087,7 @@ function versionIncluded(nodeVersion, specifierValue) { return matchesRange(current, specifierValue); } -var data = __webpack_require__(393); +var data = __webpack_require__(387); module.exports = function isCore(x, nodeVersion) { return has(data, x) && versionIncluded(nodeVersion, data[x]); @@ -40143,31 +38095,31 @@ module.exports = function isCore(x, nodeVersion) { /***/ }), -/* 390 */ +/* 384 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var bind = __webpack_require__(391); +var bind = __webpack_require__(385); module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); /***/ }), -/* 391 */ +/* 385 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var implementation = __webpack_require__(392); +var implementation = __webpack_require__(386); module.exports = Function.prototype.bind || implementation; /***/ }), -/* 392 */ +/* 386 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -40226,13 +38178,13 @@ module.exports = function bind(that) { /***/ }), -/* 393 */ +/* 387 */ /***/ (function(module) { module.exports = JSON.parse("{\"assert\":true,\"node:assert\":[\">= 14.18 && < 15\",\">= 16\"],\"assert/strict\":\">= 15\",\"node:assert/strict\":\">= 16\",\"async_hooks\":\">= 8\",\"node:async_hooks\":[\">= 14.18 && < 15\",\">= 16\"],\"buffer_ieee754\":\"< 0.9.7\",\"buffer\":true,\"node:buffer\":[\">= 14.18 && < 15\",\">= 16\"],\"child_process\":true,\"node:child_process\":[\">= 14.18 && < 15\",\">= 16\"],\"cluster\":true,\"node:cluster\":[\">= 14.18 && < 15\",\">= 16\"],\"console\":true,\"node:console\":[\">= 14.18 && < 15\",\">= 16\"],\"constants\":true,\"node:constants\":[\">= 14.18 && < 15\",\">= 16\"],\"crypto\":true,\"node:crypto\":[\">= 14.18 && < 15\",\">= 16\"],\"_debug_agent\":\">= 1 && < 8\",\"_debugger\":\"< 8\",\"dgram\":true,\"node:dgram\":[\">= 14.18 && < 15\",\">= 16\"],\"diagnostics_channel\":[\">= 14.17 && < 15\",\">= 15.1\"],\"node:diagnostics_channel\":[\">= 14.18 && < 15\",\">= 16\"],\"dns\":true,\"node:dns\":[\">= 14.18 && < 15\",\">= 16\"],\"dns/promises\":\">= 15\",\"node:dns/promises\":\">= 16\",\"domain\":\">= 0.7.12\",\"node:domain\":[\">= 14.18 && < 15\",\">= 16\"],\"events\":true,\"node:events\":[\">= 14.18 && < 15\",\">= 16\"],\"freelist\":\"< 6\",\"fs\":true,\"node:fs\":[\">= 14.18 && < 15\",\">= 16\"],\"fs/promises\":[\">= 10 && < 10.1\",\">= 14\"],\"node:fs/promises\":[\">= 14.18 && < 15\",\">= 16\"],\"_http_agent\":\">= 0.11.1\",\"node:_http_agent\":[\">= 14.18 && < 15\",\">= 16\"],\"_http_client\":\">= 0.11.1\",\"node:_http_client\":[\">= 14.18 && < 15\",\">= 16\"],\"_http_common\":\">= 0.11.1\",\"node:_http_common\":[\">= 14.18 && < 15\",\">= 16\"],\"_http_incoming\":\">= 0.11.1\",\"node:_http_incoming\":[\">= 14.18 && < 15\",\">= 16\"],\"_http_outgoing\":\">= 0.11.1\",\"node:_http_outgoing\":[\">= 14.18 && < 15\",\">= 16\"],\"_http_server\":\">= 0.11.1\",\"node:_http_server\":[\">= 14.18 && < 15\",\">= 16\"],\"http\":true,\"node:http\":[\">= 14.18 && < 15\",\">= 16\"],\"http2\":\">= 8.8\",\"node:http2\":[\">= 14.18 && < 15\",\">= 16\"],\"https\":true,\"node:https\":[\">= 14.18 && < 15\",\">= 16\"],\"inspector\":\">= 8\",\"node:inspector\":[\">= 14.18 && < 15\",\">= 16\"],\"_linklist\":\"< 8\",\"module\":true,\"node:module\":[\">= 14.18 && < 15\",\">= 16\"],\"net\":true,\"node:net\":[\">= 14.18 && < 15\",\">= 16\"],\"node-inspect/lib/_inspect\":\">= 7.6 && < 12\",\"node-inspect/lib/internal/inspect_client\":\">= 7.6 && < 12\",\"node-inspect/lib/internal/inspect_repl\":\">= 7.6 && < 12\",\"os\":true,\"node:os\":[\">= 14.18 && < 15\",\">= 16\"],\"path\":true,\"node:path\":[\">= 14.18 && < 15\",\">= 16\"],\"path/posix\":\">= 15.3\",\"node:path/posix\":\">= 16\",\"path/win32\":\">= 15.3\",\"node:path/win32\":\">= 16\",\"perf_hooks\":\">= 8.5\",\"node:perf_hooks\":[\">= 14.18 && < 15\",\">= 16\"],\"process\":\">= 1\",\"node:process\":[\">= 14.18 && < 15\",\">= 16\"],\"punycode\":true,\"node:punycode\":[\">= 14.18 && < 15\",\">= 16\"],\"querystring\":true,\"node:querystring\":[\">= 14.18 && < 15\",\">= 16\"],\"readline\":true,\"node:readline\":[\">= 14.18 && < 15\",\">= 16\"],\"repl\":true,\"node:repl\":[\">= 14.18 && < 15\",\">= 16\"],\"smalloc\":\">= 0.11.5 && < 3\",\"_stream_duplex\":\">= 0.9.4\",\"node:_stream_duplex\":[\">= 14.18 && < 15\",\">= 16\"],\"_stream_transform\":\">= 0.9.4\",\"node:_stream_transform\":[\">= 14.18 && < 15\",\">= 16\"],\"_stream_wrap\":\">= 1.4.1\",\"node:_stream_wrap\":[\">= 14.18 && < 15\",\">= 16\"],\"_stream_passthrough\":\">= 0.9.4\",\"node:_stream_passthrough\":[\">= 14.18 && < 15\",\">= 16\"],\"_stream_readable\":\">= 0.9.4\",\"node:_stream_readable\":[\">= 14.18 && < 15\",\">= 16\"],\"_stream_writable\":\">= 0.9.4\",\"node:_stream_writable\":[\">= 14.18 && < 15\",\">= 16\"],\"stream\":true,\"node:stream\":[\">= 14.18 && < 15\",\">= 16\"],\"stream/consumers\":\">= 16.7\",\"node:stream/consumers\":\">= 16.7\",\"stream/promises\":\">= 15\",\"node:stream/promises\":\">= 16\",\"stream/web\":\">= 16.5\",\"node:stream/web\":\">= 16.5\",\"string_decoder\":true,\"node:string_decoder\":[\">= 14.18 && < 15\",\">= 16\"],\"sys\":[\">= 0.6 && < 0.7\",\">= 0.8\"],\"node:sys\":[\">= 14.18 && < 15\",\">= 16\"],\"timers\":true,\"node:timers\":[\">= 14.18 && < 15\",\">= 16\"],\"timers/promises\":\">= 15\",\"node:timers/promises\":\">= 16\",\"_tls_common\":\">= 0.11.13\",\"node:_tls_common\":[\">= 14.18 && < 15\",\">= 16\"],\"_tls_legacy\":\">= 0.11.3 && < 10\",\"_tls_wrap\":\">= 0.11.3\",\"node:_tls_wrap\":[\">= 14.18 && < 15\",\">= 16\"],\"tls\":true,\"node:tls\":[\">= 14.18 && < 15\",\">= 16\"],\"trace_events\":\">= 10\",\"node:trace_events\":[\">= 14.18 && < 15\",\">= 16\"],\"tty\":true,\"node:tty\":[\">= 14.18 && < 15\",\">= 16\"],\"url\":true,\"node:url\":[\">= 14.18 && < 15\",\">= 16\"],\"util\":true,\"node:util\":[\">= 14.18 && < 15\",\">= 16\"],\"util/types\":\">= 15.3\",\"node:util/types\":\">= 16\",\"v8/tools/arguments\":\">= 10 && < 12\",\"v8/tools/codemap\":[\">= 4.4 && < 5\",\">= 5.2 && < 12\"],\"v8/tools/consarray\":[\">= 4.4 && < 5\",\">= 5.2 && < 12\"],\"v8/tools/csvparser\":[\">= 4.4 && < 5\",\">= 5.2 && < 12\"],\"v8/tools/logreader\":[\">= 4.4 && < 5\",\">= 5.2 && < 12\"],\"v8/tools/profile_view\":[\">= 4.4 && < 5\",\">= 5.2 && < 12\"],\"v8/tools/splaytree\":[\">= 4.4 && < 5\",\">= 5.2 && < 12\"],\"v8\":\">= 1\",\"node:v8\":[\">= 14.18 && < 15\",\">= 16\"],\"vm\":true,\"node:vm\":[\">= 14.18 && < 15\",\">= 16\"],\"wasi\":\">= 13.4 && < 13.5\",\"worker_threads\":\">= 11.7\",\"node:worker_threads\":[\">= 14.18 && < 15\",\">= 16\"],\"zlib\":true,\"node:zlib\":[\">= 14.18 && < 15\",\">= 16\"]}"); /***/ }), -/* 394 */ +/* 388 */ /***/ (function(module, exports, __webpack_require__) { var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; @@ -40279,7 +38231,7 @@ function versionIncluded(specifierValue) { return matchesRange(specifierValue); } -var data = __webpack_require__(395); +var data = __webpack_require__(389); var core = {}; for (var mod in data) { // eslint-disable-line no-restricted-syntax @@ -40291,16 +38243,16 @@ module.exports = core; /***/ }), -/* 395 */ +/* 389 */ /***/ (function(module) { module.exports = JSON.parse("{\"assert\":true,\"assert/strict\":\">= 15\",\"async_hooks\":\">= 8\",\"buffer_ieee754\":\"< 0.9.7\",\"buffer\":true,\"child_process\":true,\"cluster\":true,\"console\":true,\"constants\":true,\"crypto\":true,\"_debug_agent\":\">= 1 && < 8\",\"_debugger\":\"< 8\",\"dgram\":true,\"diagnostics_channel\":\">= 15.1\",\"dns\":true,\"dns/promises\":\">= 15\",\"domain\":\">= 0.7.12\",\"events\":true,\"freelist\":\"< 6\",\"fs\":true,\"fs/promises\":[\">= 10 && < 10.1\",\">= 14\"],\"_http_agent\":\">= 0.11.1\",\"_http_client\":\">= 0.11.1\",\"_http_common\":\">= 0.11.1\",\"_http_incoming\":\">= 0.11.1\",\"_http_outgoing\":\">= 0.11.1\",\"_http_server\":\">= 0.11.1\",\"http\":true,\"http2\":\">= 8.8\",\"https\":true,\"inspector\":\">= 8.0.0\",\"_linklist\":\"< 8\",\"module\":true,\"net\":true,\"node-inspect/lib/_inspect\":\">= 7.6.0 && < 12\",\"node-inspect/lib/internal/inspect_client\":\">= 7.6.0 && < 12\",\"node-inspect/lib/internal/inspect_repl\":\">= 7.6.0 && < 12\",\"os\":true,\"path\":true,\"path/posix\":\">= 15.3\",\"path/win32\":\">= 15.3\",\"perf_hooks\":\">= 8.5\",\"process\":\">= 1\",\"punycode\":true,\"querystring\":true,\"readline\":true,\"repl\":true,\"smalloc\":\">= 0.11.5 && < 3\",\"_stream_duplex\":\">= 0.9.4\",\"_stream_transform\":\">= 0.9.4\",\"_stream_wrap\":\">= 1.4.1\",\"_stream_passthrough\":\">= 0.9.4\",\"_stream_readable\":\">= 0.9.4\",\"_stream_writable\":\">= 0.9.4\",\"stream\":true,\"stream/promises\":\">= 15\",\"string_decoder\":true,\"sys\":[\">= 0.6 && < 0.7\",\">= 0.8\"],\"timers\":true,\"timers/promises\":\">= 15\",\"_tls_common\":\">= 0.11.13\",\"_tls_legacy\":\">= 0.11.3 && < 10\",\"_tls_wrap\":\">= 0.11.3\",\"tls\":true,\"trace_events\":\">= 10\",\"tty\":true,\"url\":true,\"util\":true,\"util/types\":\">= 15.3\",\"v8/tools/arguments\":\">= 10 && < 12\",\"v8/tools/codemap\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/consarray\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/csvparser\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/logreader\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/profile_view\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8/tools/splaytree\":[\">= 4.4.0 && < 5\",\">= 5.2.0 && < 12\"],\"v8\":\">= 1\",\"vm\":true,\"wasi\":\">= 13.4 && < 13.5\",\"worker_threads\":\">= 11.7\",\"zlib\":true}"); /***/ }), -/* 396 */ +/* 390 */ /***/ (function(module, exports, __webpack_require__) { -var isCoreModule = __webpack_require__(389); +var isCoreModule = __webpack_require__(383); module.exports = function isCore(x) { return isCoreModule(x); @@ -40308,15 +38260,15 @@ module.exports = function isCore(x) { /***/ }), -/* 397 */ +/* 391 */ /***/ (function(module, exports, __webpack_require__) { -var isCore = __webpack_require__(389); +var isCore = __webpack_require__(383); var fs = __webpack_require__(132); var path = __webpack_require__(4); -var caller = __webpack_require__(385); -var nodeModulesPaths = __webpack_require__(386); -var normalizeOptions = __webpack_require__(388); +var caller = __webpack_require__(379); +var nodeModulesPaths = __webpack_require__(380); +var normalizeOptions = __webpack_require__(382); var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; @@ -40513,7 +38465,7 @@ module.exports = function resolveSync(x, options) { /***/ }), -/* 398 */ +/* 392 */ /***/ (function(module, exports) { module.exports = extractDescription @@ -40533,17 +38485,17 @@ function extractDescription (d) { /***/ }), -/* 399 */ +/* 393 */ /***/ (function(module) { module.exports = JSON.parse("{\"topLevel\":{\"dependancies\":\"dependencies\",\"dependecies\":\"dependencies\",\"depdenencies\":\"dependencies\",\"devEependencies\":\"devDependencies\",\"depends\":\"dependencies\",\"dev-dependencies\":\"devDependencies\",\"devDependences\":\"devDependencies\",\"devDepenencies\":\"devDependencies\",\"devdependencies\":\"devDependencies\",\"repostitory\":\"repository\",\"repo\":\"repository\",\"prefereGlobal\":\"preferGlobal\",\"hompage\":\"homepage\",\"hampage\":\"homepage\",\"autohr\":\"author\",\"autor\":\"author\",\"contributers\":\"contributors\",\"publicationConfig\":\"publishConfig\",\"script\":\"scripts\"},\"bugs\":{\"web\":\"url\",\"name\":\"url\"},\"script\":{\"server\":\"start\",\"tests\":\"test\"}}"); /***/ }), -/* 400 */ +/* 394 */ /***/ (function(module, exports, __webpack_require__) { var util = __webpack_require__(113) -var messages = __webpack_require__(401) +var messages = __webpack_require__(395) module.exports = function() { var args = Array.prototype.slice.call(arguments, 0) @@ -40568,20 +38520,20 @@ function makeTypoWarning (providedName, probableName, field) { /***/ }), -/* 401 */ +/* 395 */ /***/ (function(module) { module.exports = JSON.parse("{\"repositories\":\"'repositories' (plural) Not supported. Please pick one as the 'repository' field\",\"missingRepository\":\"No repository field.\",\"brokenGitUrl\":\"Probably broken git url: %s\",\"nonObjectScripts\":\"scripts must be an object\",\"nonStringScript\":\"script values must be string commands\",\"nonArrayFiles\":\"Invalid 'files' member\",\"invalidFilename\":\"Invalid filename in 'files' list: %s\",\"nonArrayBundleDependencies\":\"Invalid 'bundleDependencies' list. Must be array of package names\",\"nonStringBundleDependency\":\"Invalid bundleDependencies member: %s\",\"nonDependencyBundleDependency\":\"Non-dependency in bundleDependencies: %s\",\"nonObjectDependencies\":\"%s field must be an object\",\"nonStringDependency\":\"Invalid dependency: %s %s\",\"deprecatedArrayDependencies\":\"specifying %s as array is deprecated\",\"deprecatedModules\":\"modules field is deprecated\",\"nonArrayKeywords\":\"keywords should be an array of strings\",\"nonStringKeyword\":\"keywords should be an array of strings\",\"conflictingName\":\"%s is also the name of a node core module.\",\"nonStringDescription\":\"'description' field should be a string\",\"missingDescription\":\"No description\",\"missingReadme\":\"No README data\",\"missingLicense\":\"No license field.\",\"nonEmailUrlBugsString\":\"Bug string field must be url, email, or {email,url}\",\"nonUrlBugsUrlField\":\"bugs.url field must be a string url. Deleted.\",\"nonEmailBugsEmailField\":\"bugs.email field must be a string email. Deleted.\",\"emptyNormalizedBugs\":\"Normalized value of bugs field is an empty object. Deleted.\",\"nonUrlHomepage\":\"homepage field must be a string url. Deleted.\",\"invalidLicense\":\"license should be a valid SPDX license expression\",\"typo\":\"%s should probably be %s.\"}"); /***/ }), -/* 402 */ +/* 396 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const writeJsonFile = __webpack_require__(403); -const sortKeys = __webpack_require__(407); +const writeJsonFile = __webpack_require__(397); +const sortKeys = __webpack_require__(401); const dependencyKeys = new Set([ 'dependencies', @@ -40646,18 +38598,18 @@ module.exports.sync = (filePath, data, options) => { /***/ }), -/* 403 */ +/* 397 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); const fs = __webpack_require__(233); -const writeFileAtomic = __webpack_require__(404); -const sortKeys = __webpack_require__(407); -const makeDir = __webpack_require__(409); -const pify = __webpack_require__(410); -const detectIndent = __webpack_require__(412); +const writeFileAtomic = __webpack_require__(398); +const sortKeys = __webpack_require__(401); +const makeDir = __webpack_require__(403); +const pify = __webpack_require__(404); +const detectIndent = __webpack_require__(406); const init = (fn, filePath, data, options) => { if (!filePath) { @@ -40729,7 +38681,7 @@ module.exports.sync = (filePath, data, options) => { /***/ }), -/* 404 */ +/* 398 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -40740,7 +38692,7 @@ module.exports._getTmpname = getTmpname // for testing module.exports._cleanupOnExit = cleanupOnExit var fs = __webpack_require__(233) -var MurmurHash3 = __webpack_require__(405) +var MurmurHash3 = __webpack_require__(399) var onExit = __webpack_require__(161) var path = __webpack_require__(4) var activeFiles = {} @@ -40749,7 +38701,7 @@ var activeFiles = {} /* istanbul ignore next */ var threadId = (function getId () { try { - var workerThreads = __webpack_require__(406) + var workerThreads = __webpack_require__(400) /// if we are in main thread, this is set to `0` return workerThreads.threadId @@ -40974,7 +38926,7 @@ function writeFileSync (filename, data, options) { /***/ }), -/* 405 */ +/* 399 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41116,18 +39068,18 @@ function writeFileSync (filename, data, options) { /***/ }), -/* 406 */ +/* 400 */ /***/ (function(module, exports) { module.exports = require(undefined); /***/ }), -/* 407 */ +/* 401 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const isPlainObj = __webpack_require__(408); +const isPlainObj = __webpack_require__(402); module.exports = (obj, opts) => { if (!isPlainObj(obj)) { @@ -41184,7 +39136,7 @@ module.exports = (obj, opts) => { /***/ }), -/* 408 */ +/* 402 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -41198,15 +39150,15 @@ module.exports = function (x) { /***/ }), -/* 409 */ +/* 403 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const fs = __webpack_require__(132); const path = __webpack_require__(4); -const pify = __webpack_require__(410); -const semver = __webpack_require__(411); +const pify = __webpack_require__(404); +const semver = __webpack_require__(405); const defaults = { mode: 0o777 & (~process.umask()), @@ -41344,7 +39296,7 @@ module.exports.sync = (input, options) => { /***/ }), -/* 410 */ +/* 404 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -41419,7 +39371,7 @@ module.exports = (input, options) => { /***/ }), -/* 411 */ +/* 405 */ /***/ (function(module, exports) { exports = module.exports = SemVer @@ -42908,7 +40860,7 @@ function coerce (version) { /***/ }), -/* 412 */ +/* 406 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -43037,7 +40989,7 @@ module.exports = str => { /***/ }), -/* 413 */ +/* 407 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -43097,14 +41049,14 @@ function runScriptInPackageStreaming({ } /***/ }), -/* 414 */ +/* 408 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readYarnLock", function() { return readYarnLock; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resolveDepsForProject", function() { return resolveDepsForProject; }); -/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(415); +/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(409); /* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(231); /* @@ -43206,7 +41158,7 @@ function resolveDepsForProject({ } /***/ }), -/* 415 */ +/* 409 */ /***/ (function(module, exports, __webpack_require__) { module.exports = @@ -47089,7 +45041,7 @@ function onceStrict (fn) { /* 63 */ /***/ (function(module, exports) { -module.exports = __webpack_require__(416); +module.exports = __webpack_require__(410); /***/ }), /* 64 */, @@ -53484,21 +51436,21 @@ module.exports = process && support(supportLevel); /******/ ]); /***/ }), -/* 416 */ +/* 410 */ /***/ (function(module, exports) { module.exports = require("buffer"); /***/ }), -/* 417 */ +/* 411 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sortPackageJson", function() { return sortPackageJson; }); -/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(418); +/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(412); /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var sort_package_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(419); +/* harmony import */ var sort_package_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(413); /* harmony import */ var sort_package_json__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(sort_package_json__WEBPACK_IMPORTED_MODULE_1__); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one @@ -53519,20 +51471,20 @@ async function sortPackageJson(kbn) { } /***/ }), -/* 418 */ +/* 412 */ /***/ (function(module, exports) { module.exports = require("fs/promises"); /***/ }), -/* 419 */ +/* 413 */ /***/ (function(module, exports, __webpack_require__) { -const sortObjectKeys = __webpack_require__(420) -const detectIndent = __webpack_require__(421) -const detectNewline = __webpack_require__(422).graceful -const gitHooks = __webpack_require__(423) -const isPlainObject = __webpack_require__(424) +const sortObjectKeys = __webpack_require__(414) +const detectIndent = __webpack_require__(415) +const detectNewline = __webpack_require__(416).graceful +const gitHooks = __webpack_require__(417) +const isPlainObject = __webpack_require__(418) const hasOwnProperty = (object, property) => Object.prototype.hasOwnProperty.call(object, property) @@ -53891,7 +51843,7 @@ module.exports.default = sortPackageJson /***/ }), -/* 420 */ +/* 414 */ /***/ (function(module, exports) { module.exports = function sortObjectByKeyNameList(object, sortWith) { @@ -53915,7 +51867,7 @@ module.exports = function sortObjectByKeyNameList(object, sortWith) { /***/ }), -/* 421 */ +/* 415 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -54082,7 +52034,7 @@ module.exports = string => { /***/ }), -/* 422 */ +/* 416 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -54110,13 +52062,13 @@ module.exports.graceful = string => (typeof string === 'string' && detectNewline /***/ }), -/* 423 */ +/* 417 */ /***/ (function(module) { module.exports = JSON.parse("[\"applypatch-msg\",\"pre-applypatch\",\"post-applypatch\",\"pre-commit\",\"pre-merge-commit\",\"prepare-commit-msg\",\"commit-msg\",\"post-commit\",\"pre-rebase\",\"post-checkout\",\"post-merge\",\"pre-push\",\"pre-receive\",\"update\",\"post-receive\",\"post-update\",\"push-to-checkout\",\"pre-auto-gc\",\"post-rewrite\",\"sendemail-validate\",\"fsmonitor-watchman\",\"p4-pre-submit\",\"post-index-change\"]"); /***/ }), -/* 424 */ +/* 418 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -54133,13 +52085,13 @@ module.exports = value => { /***/ }), -/* 425 */ +/* 419 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validateDependencies", function() { return validateDependencies; }); -/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(415); +/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(409); /* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var dedent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); /* harmony import */ var dedent__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dedent__WEBPACK_IMPORTED_MODULE_1__); @@ -54149,8 +52101,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(231); /* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(220); -/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(349); -/* harmony import */ var _projects_tree__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(426); +/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(343); +/* harmony import */ var _projects_tree__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(420); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License @@ -54331,7 +52283,7 @@ function getDevOnlyProductionDepsTree(kbn, projectName) { } /***/ }), -/* 426 */ +/* 420 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54473,27 +52425,27 @@ function addProjectToTree(tree, pathParts, project) { } /***/ }), -/* 427 */ +/* 421 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony import */ var _yarn_integrity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(428); +/* harmony import */ var _yarn_integrity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(422); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "yarnIntegrityFileExists", function() { return _yarn_integrity__WEBPACK_IMPORTED_MODULE_0__["yarnIntegrityFileExists"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ensureYarnIntegrityFileExists", function() { return _yarn_integrity__WEBPACK_IMPORTED_MODULE_0__["ensureYarnIntegrityFileExists"]; }); -/* harmony import */ var _get_cache_folders__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(429); +/* harmony import */ var _get_cache_folders__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(423); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getBazelDiskCacheFolder", function() { return _get_cache_folders__WEBPACK_IMPORTED_MODULE_1__["getBazelDiskCacheFolder"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getBazelRepositoryCacheFolder", function() { return _get_cache_folders__WEBPACK_IMPORTED_MODULE_1__["getBazelRepositoryCacheFolder"]; }); -/* harmony import */ var _install_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(430); +/* harmony import */ var _install_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(424); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBazelBinAvailable", function() { return _install_tools__WEBPACK_IMPORTED_MODULE_2__["isBazelBinAvailable"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "installBazelTools", function() { return _install_tools__WEBPACK_IMPORTED_MODULE_2__["installBazelTools"]; }); -/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(431); +/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(425); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "runBazel", function() { return _run__WEBPACK_IMPORTED_MODULE_3__["runBazel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "runIBazel", function() { return _run__WEBPACK_IMPORTED_MODULE_3__["runIBazel"]; }); @@ -54511,7 +52463,7 @@ __webpack_require__.r(__webpack_exports__); /***/ }), -/* 428 */ +/* 422 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54558,7 +52510,7 @@ async function ensureYarnIntegrityFileExists(nodeModulesPath) { } /***/ }), -/* 429 */ +/* 423 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54595,7 +52547,7 @@ async function getBazelRepositoryCacheFolder() { } /***/ }), -/* 430 */ +/* 424 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54714,7 +52666,7 @@ async function installBazelTools(repoRootPath) { } /***/ }), -/* 431 */ +/* 425 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -54724,12 +52676,12 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(114); /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9); -/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(432); -/* harmony import */ var _kbn_dev_utils_stdio__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(530); +/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(426); +/* harmony import */ var _kbn_dev_utils_stdio__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(524); /* harmony import */ var _kbn_dev_utils_stdio__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_kbn_dev_utils_stdio__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _child_process__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(221); /* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(220); -/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(347); +/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(341); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } @@ -54791,141 +52743,141 @@ async function runIBazel(bazelArgs, offline = false, runOpts = {}) { } /***/ }), -/* 432 */ +/* 426 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony import */ var _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(433); +/* harmony import */ var _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(427); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "audit", function() { return _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__["audit"]; }); -/* harmony import */ var _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(434); +/* harmony import */ var _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(428); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "auditTime", function() { return _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__["auditTime"]; }); -/* harmony import */ var _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(435); +/* harmony import */ var _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(429); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buffer", function() { return _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__["buffer"]; }); -/* harmony import */ var _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(436); +/* harmony import */ var _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(430); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferCount", function() { return _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__["bufferCount"]; }); -/* harmony import */ var _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(437); +/* harmony import */ var _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(431); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferTime", function() { return _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__["bufferTime"]; }); -/* harmony import */ var _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(438); +/* harmony import */ var _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(432); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferToggle", function() { return _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__["bufferToggle"]; }); -/* harmony import */ var _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(439); +/* harmony import */ var _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(433); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferWhen", function() { return _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__["bufferWhen"]; }); -/* harmony import */ var _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(440); +/* harmony import */ var _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(434); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "catchError", function() { return _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__["catchError"]; }); -/* harmony import */ var _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(441); +/* harmony import */ var _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(435); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineAll", function() { return _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__["combineAll"]; }); -/* harmony import */ var _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(442); +/* harmony import */ var _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(436); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function() { return _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__["combineLatest"]; }); -/* harmony import */ var _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(443); +/* harmony import */ var _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(437); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__["concat"]; }); /* harmony import */ var _internal_operators_concatAll__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(81); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatAll", function() { return _internal_operators_concatAll__WEBPACK_IMPORTED_MODULE_11__["concatAll"]; }); -/* harmony import */ var _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(444); +/* harmony import */ var _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(438); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatMap", function() { return _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__["concatMap"]; }); -/* harmony import */ var _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(445); +/* harmony import */ var _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(439); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatMapTo", function() { return _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__["concatMapTo"]; }); -/* harmony import */ var _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(446); +/* harmony import */ var _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(440); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "count", function() { return _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__["count"]; }); -/* harmony import */ var _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(447); +/* harmony import */ var _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(441); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__["debounce"]; }); -/* harmony import */ var _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(448); +/* harmony import */ var _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(442); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounceTime", function() { return _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__["debounceTime"]; }); -/* harmony import */ var _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(449); +/* harmony import */ var _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(443); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultIfEmpty", function() { return _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__["defaultIfEmpty"]; }); -/* harmony import */ var _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(450); +/* harmony import */ var _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(444); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__["delay"]; }); -/* harmony import */ var _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(452); +/* harmony import */ var _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(446); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delayWhen", function() { return _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__["delayWhen"]; }); -/* harmony import */ var _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(453); +/* harmony import */ var _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(447); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "dematerialize", function() { return _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__["dematerialize"]; }); -/* harmony import */ var _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(454); +/* harmony import */ var _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(448); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinct", function() { return _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__["distinct"]; }); -/* harmony import */ var _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(455); +/* harmony import */ var _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(449); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinctUntilChanged", function() { return _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__["distinctUntilChanged"]; }); -/* harmony import */ var _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(456); +/* harmony import */ var _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(450); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinctUntilKeyChanged", function() { return _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__["distinctUntilKeyChanged"]; }); -/* harmony import */ var _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(457); +/* harmony import */ var _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(451); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "elementAt", function() { return _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__["elementAt"]; }); -/* harmony import */ var _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(460); +/* harmony import */ var _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(454); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endWith", function() { return _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__["endWith"]; }); -/* harmony import */ var _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(461); +/* harmony import */ var _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(455); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "every", function() { return _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__["every"]; }); -/* harmony import */ var _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(462); +/* harmony import */ var _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(456); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "exhaust", function() { return _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__["exhaust"]; }); -/* harmony import */ var _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(463); +/* harmony import */ var _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(457); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "exhaustMap", function() { return _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__["exhaustMap"]; }); -/* harmony import */ var _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(464); +/* harmony import */ var _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(458); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "expand", function() { return _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__["expand"]; }); /* harmony import */ var _internal_operators_filter__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(106); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return _internal_operators_filter__WEBPACK_IMPORTED_MODULE_30__["filter"]; }); -/* harmony import */ var _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(465); +/* harmony import */ var _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(459); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "finalize", function() { return _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__["finalize"]; }); -/* harmony import */ var _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(466); +/* harmony import */ var _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(460); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "find", function() { return _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__["find"]; }); -/* harmony import */ var _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(467); +/* harmony import */ var _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(461); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__["findIndex"]; }); -/* harmony import */ var _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(468); +/* harmony import */ var _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(462); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "first", function() { return _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__["first"]; }); /* harmony import */ var _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(32); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_35__["groupBy"]; }); -/* harmony import */ var _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(469); +/* harmony import */ var _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(463); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ignoreElements", function() { return _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__["ignoreElements"]; }); -/* harmony import */ var _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(470); +/* harmony import */ var _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(464); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__["isEmpty"]; }); -/* harmony import */ var _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(471); +/* harmony import */ var _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(465); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "last", function() { return _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__["last"]; }); /* harmony import */ var _internal_operators_map__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(67); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "map", function() { return _internal_operators_map__WEBPACK_IMPORTED_MODULE_39__["map"]; }); -/* harmony import */ var _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(473); +/* harmony import */ var _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(467); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mapTo", function() { return _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__["mapTo"]; }); -/* harmony import */ var _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(474); +/* harmony import */ var _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(468); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "materialize", function() { return _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__["materialize"]; }); -/* harmony import */ var _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(475); +/* harmony import */ var _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(469); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "max", function() { return _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__["max"]; }); -/* harmony import */ var _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(478); +/* harmony import */ var _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(472); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__["merge"]; }); /* harmony import */ var _internal_operators_mergeAll__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(82); @@ -54936,175 +52888,175 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flatMap", function() { return _internal_operators_mergeMap__WEBPACK_IMPORTED_MODULE_45__["flatMap"]; }); -/* harmony import */ var _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(479); +/* harmony import */ var _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(473); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeMapTo", function() { return _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__["mergeMapTo"]; }); -/* harmony import */ var _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(480); +/* harmony import */ var _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(474); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeScan", function() { return _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__["mergeScan"]; }); -/* harmony import */ var _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(481); +/* harmony import */ var _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(475); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "min", function() { return _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__["min"]; }); -/* harmony import */ var _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(482); +/* harmony import */ var _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(476); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "multicast", function() { return _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__["multicast"]; }); /* harmony import */ var _internal_operators_observeOn__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(42); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "observeOn", function() { return _internal_operators_observeOn__WEBPACK_IMPORTED_MODULE_50__["observeOn"]; }); -/* harmony import */ var _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(483); +/* harmony import */ var _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(477); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function() { return _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__["onErrorResumeNext"]; }); -/* harmony import */ var _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(484); +/* harmony import */ var _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(478); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pairwise", function() { return _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__["pairwise"]; }); -/* harmony import */ var _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(485); +/* harmony import */ var _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(479); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__["partition"]; }); -/* harmony import */ var _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(486); +/* harmony import */ var _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(480); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__["pluck"]; }); -/* harmony import */ var _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(487); +/* harmony import */ var _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(481); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publish", function() { return _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__["publish"]; }); -/* harmony import */ var _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(488); +/* harmony import */ var _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(482); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishBehavior", function() { return _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__["publishBehavior"]; }); -/* harmony import */ var _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(489); +/* harmony import */ var _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(483); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishLast", function() { return _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__["publishLast"]; }); -/* harmony import */ var _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(490); +/* harmony import */ var _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(484); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishReplay", function() { return _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__["publishReplay"]; }); -/* harmony import */ var _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(491); +/* harmony import */ var _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(485); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "race", function() { return _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__["race"]; }); -/* harmony import */ var _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(476); +/* harmony import */ var _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(470); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__["reduce"]; }); -/* harmony import */ var _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(492); +/* harmony import */ var _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(486); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeat", function() { return _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__["repeat"]; }); -/* harmony import */ var _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(493); +/* harmony import */ var _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(487); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeatWhen", function() { return _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__["repeatWhen"]; }); -/* harmony import */ var _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(494); +/* harmony import */ var _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(488); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retry", function() { return _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__["retry"]; }); -/* harmony import */ var _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(495); +/* harmony import */ var _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(489); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retryWhen", function() { return _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__["retryWhen"]; }); /* harmony import */ var _internal_operators_refCount__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(31); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "refCount", function() { return _internal_operators_refCount__WEBPACK_IMPORTED_MODULE_65__["refCount"]; }); -/* harmony import */ var _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(496); +/* harmony import */ var _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(490); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__["sample"]; }); -/* harmony import */ var _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(497); +/* harmony import */ var _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(491); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sampleTime", function() { return _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__["sampleTime"]; }); -/* harmony import */ var _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(477); +/* harmony import */ var _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(471); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "scan", function() { return _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__["scan"]; }); -/* harmony import */ var _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(498); +/* harmony import */ var _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(492); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sequenceEqual", function() { return _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__["sequenceEqual"]; }); -/* harmony import */ var _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(499); +/* harmony import */ var _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(493); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "share", function() { return _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__["share"]; }); -/* harmony import */ var _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(500); +/* harmony import */ var _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(494); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "shareReplay", function() { return _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__["shareReplay"]; }); -/* harmony import */ var _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(501); +/* harmony import */ var _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(495); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "single", function() { return _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__["single"]; }); -/* harmony import */ var _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(502); +/* harmony import */ var _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(496); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skip", function() { return _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__["skip"]; }); -/* harmony import */ var _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(503); +/* harmony import */ var _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(497); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipLast", function() { return _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__["skipLast"]; }); -/* harmony import */ var _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(504); +/* harmony import */ var _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(498); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipUntil", function() { return _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__["skipUntil"]; }); -/* harmony import */ var _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(505); +/* harmony import */ var _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(499); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipWhile", function() { return _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__["skipWhile"]; }); -/* harmony import */ var _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(506); +/* harmony import */ var _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(500); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startWith", function() { return _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__["startWith"]; }); -/* harmony import */ var _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(507); +/* harmony import */ var _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(501); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subscribeOn", function() { return _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__["subscribeOn"]; }); -/* harmony import */ var _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(509); +/* harmony import */ var _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(503); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchAll", function() { return _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__["switchAll"]; }); -/* harmony import */ var _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(510); +/* harmony import */ var _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(504); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchMap", function() { return _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__["switchMap"]; }); -/* harmony import */ var _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(511); +/* harmony import */ var _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(505); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchMapTo", function() { return _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__["switchMapTo"]; }); -/* harmony import */ var _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(459); +/* harmony import */ var _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(453); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "take", function() { return _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__["take"]; }); -/* harmony import */ var _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(472); +/* harmony import */ var _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(466); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeLast", function() { return _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__["takeLast"]; }); -/* harmony import */ var _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(512); +/* harmony import */ var _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(506); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeUntil", function() { return _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__["takeUntil"]; }); -/* harmony import */ var _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(513); +/* harmony import */ var _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(507); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeWhile", function() { return _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__["takeWhile"]; }); -/* harmony import */ var _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(514); +/* harmony import */ var _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(508); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__["tap"]; }); -/* harmony import */ var _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(515); +/* harmony import */ var _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(509); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__["throttle"]; }); -/* harmony import */ var _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(516); +/* harmony import */ var _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(510); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttleTime", function() { return _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__["throttleTime"]; }); -/* harmony import */ var _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(458); +/* harmony import */ var _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(452); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throwIfEmpty", function() { return _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__["throwIfEmpty"]; }); -/* harmony import */ var _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(517); +/* harmony import */ var _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(511); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeInterval", function() { return _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__["timeInterval"]; }); -/* harmony import */ var _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(518); +/* harmony import */ var _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(512); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeout", function() { return _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__["timeout"]; }); -/* harmony import */ var _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(519); +/* harmony import */ var _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(513); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeoutWith", function() { return _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__["timeoutWith"]; }); -/* harmony import */ var _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(520); +/* harmony import */ var _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(514); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timestamp", function() { return _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__["timestamp"]; }); -/* harmony import */ var _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(521); +/* harmony import */ var _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(515); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__["toArray"]; }); -/* harmony import */ var _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(522); +/* harmony import */ var _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(516); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "window", function() { return _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__["window"]; }); -/* harmony import */ var _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(523); +/* harmony import */ var _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(517); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowCount", function() { return _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__["windowCount"]; }); -/* harmony import */ var _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(524); +/* harmony import */ var _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(518); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowTime", function() { return _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__["windowTime"]; }); -/* harmony import */ var _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(525); +/* harmony import */ var _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(519); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowToggle", function() { return _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__["windowToggle"]; }); -/* harmony import */ var _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(526); +/* harmony import */ var _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(520); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowWhen", function() { return _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__["windowWhen"]; }); -/* harmony import */ var _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(527); +/* harmony import */ var _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(521); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withLatestFrom", function() { return _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__["withLatestFrom"]; }); -/* harmony import */ var _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(528); +/* harmony import */ var _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(522); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__["zip"]; }); -/* harmony import */ var _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(529); +/* harmony import */ var _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(523); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zipAll", function() { return _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__["zipAll"]; }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ @@ -55215,7 +53167,7 @@ __webpack_require__.r(__webpack_exports__); /***/ }), -/* 433 */ +/* 427 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55294,14 +53246,14 @@ var AuditSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 434 */ +/* 428 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "auditTime", function() { return auditTime; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(56); -/* harmony import */ var _audit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(433); +/* harmony import */ var _audit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(427); /* harmony import */ var _observable_timer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(109); /** PURE_IMPORTS_START _scheduler_async,_audit,_observable_timer PURE_IMPORTS_END */ @@ -55317,7 +53269,7 @@ function auditTime(duration, scheduler) { /***/ }), -/* 435 */ +/* 429 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55364,7 +53316,7 @@ var BufferSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 436 */ +/* 430 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55465,7 +53417,7 @@ var BufferSkipCountSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 437 */ +/* 431 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55626,7 +53578,7 @@ function dispatchBufferClose(arg) { /***/ }), -/* 438 */ +/* 432 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55745,7 +53697,7 @@ var BufferToggleSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 439 */ +/* 433 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55838,7 +53790,7 @@ var BufferWhenSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 440 */ +/* 434 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55898,7 +53850,7 @@ var CatchSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 441 */ +/* 435 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55914,7 +53866,7 @@ function combineAll(project) { /***/ }), -/* 442 */ +/* 436 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55946,7 +53898,7 @@ function combineLatest() { /***/ }), -/* 443 */ +/* 437 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55966,7 +53918,7 @@ function concat() { /***/ }), -/* 444 */ +/* 438 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -55982,13 +53934,13 @@ function concatMap(project, resultSelector) { /***/ }), -/* 445 */ +/* 439 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatMapTo", function() { return concatMapTo; }); -/* harmony import */ var _concatMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(444); +/* harmony import */ var _concatMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(438); /** PURE_IMPORTS_START _concatMap PURE_IMPORTS_END */ function concatMapTo(innerObservable, resultSelector) { @@ -55998,7 +53950,7 @@ function concatMapTo(innerObservable, resultSelector) { /***/ }), -/* 446 */ +/* 440 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56063,7 +54015,7 @@ var CountSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 447 */ +/* 441 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56148,7 +54100,7 @@ var DebounceSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 448 */ +/* 442 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56224,7 +54176,7 @@ function dispatchNext(subscriber) { /***/ }), -/* 449 */ +/* 443 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56274,7 +54226,7 @@ var DefaultIfEmptySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 450 */ +/* 444 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56282,7 +54234,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return delay; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(56); -/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(451); +/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(445); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12); /* harmony import */ var _Notification__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(43); /** PURE_IMPORTS_START tslib,_scheduler_async,_util_isDate,_Subscriber,_Notification PURE_IMPORTS_END */ @@ -56381,7 +54333,7 @@ var DelayMessage = /*@__PURE__*/ (function () { /***/ }), -/* 451 */ +/* 445 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56395,7 +54347,7 @@ function isDate(value) { /***/ }), -/* 452 */ +/* 446 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56541,7 +54493,7 @@ var SubscriptionDelaySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 453 */ +/* 447 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56579,7 +54531,7 @@ var DeMaterializeSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 454 */ +/* 448 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56655,7 +54607,7 @@ var DistinctSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 455 */ +/* 449 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56726,13 +54678,13 @@ var DistinctUntilChangedSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 456 */ +/* 450 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distinctUntilKeyChanged", function() { return distinctUntilKeyChanged; }); -/* harmony import */ var _distinctUntilChanged__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(455); +/* harmony import */ var _distinctUntilChanged__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(449); /** PURE_IMPORTS_START _distinctUntilChanged PURE_IMPORTS_END */ function distinctUntilKeyChanged(key, compare) { @@ -56742,7 +54694,7 @@ function distinctUntilKeyChanged(key, compare) { /***/ }), -/* 457 */ +/* 451 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56750,9 +54702,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "elementAt", function() { return elementAt; }); /* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(63); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(106); -/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(458); -/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(449); -/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(459); +/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(452); +/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(443); +/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(453); /** PURE_IMPORTS_START _util_ArgumentOutOfRangeError,_filter,_throwIfEmpty,_defaultIfEmpty,_take PURE_IMPORTS_END */ @@ -56774,7 +54726,7 @@ function elementAt(index, defaultValue) { /***/ }), -/* 458 */ +/* 452 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56840,7 +54792,7 @@ function defaultErrorFactory() { /***/ }), -/* 459 */ +/* 453 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56902,7 +54854,7 @@ var TakeSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 460 */ +/* 454 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56924,7 +54876,7 @@ function endWith() { /***/ }), -/* 461 */ +/* 455 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -56986,7 +54938,7 @@ var EverySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 462 */ +/* 456 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57040,7 +54992,7 @@ var SwitchFirstSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 463 */ +/* 457 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57134,7 +55086,7 @@ var ExhaustMapSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 464 */ +/* 458 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57246,7 +55198,7 @@ var ExpandSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 465 */ +/* 459 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57284,7 +55236,7 @@ var FinallySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 466 */ +/* 460 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57356,13 +55308,13 @@ var FindValueSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 467 */ +/* 461 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return findIndex; }); -/* harmony import */ var _operators_find__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(466); +/* harmony import */ var _operators_find__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(460); /** PURE_IMPORTS_START _operators_find PURE_IMPORTS_END */ function findIndex(predicate, thisArg) { @@ -57372,7 +55324,7 @@ function findIndex(predicate, thisArg) { /***/ }), -/* 468 */ +/* 462 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57380,9 +55332,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return first; }); /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(106); -/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(459); -/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(449); -/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(458); +/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(453); +/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(443); +/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(452); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(26); /** PURE_IMPORTS_START _util_EmptyError,_filter,_take,_defaultIfEmpty,_throwIfEmpty,_util_identity PURE_IMPORTS_END */ @@ -57399,7 +55351,7 @@ function first(predicate, defaultValue) { /***/ }), -/* 469 */ +/* 463 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57436,7 +55388,7 @@ var IgnoreElementsSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 470 */ +/* 464 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57480,7 +55432,7 @@ var IsEmptySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 471 */ +/* 465 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57488,9 +55440,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return last; }); /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(106); -/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(472); -/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(458); -/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(449); +/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(466); +/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(452); +/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(443); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(26); /** PURE_IMPORTS_START _util_EmptyError,_filter,_takeLast,_throwIfEmpty,_defaultIfEmpty,_util_identity PURE_IMPORTS_END */ @@ -57507,7 +55459,7 @@ function last(predicate, defaultValue) { /***/ }), -/* 472 */ +/* 466 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57584,7 +55536,7 @@ var TakeLastSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 473 */ +/* 467 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57623,7 +55575,7 @@ var MapToSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 474 */ +/* 468 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57673,13 +55625,13 @@ var MaterializeSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 475 */ +/* 469 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return max; }); -/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(476); +/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(470); /** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */ function max(comparer) { @@ -57692,15 +55644,15 @@ function max(comparer) { /***/ }), -/* 476 */ +/* 470 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return reduce; }); -/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(477); -/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(472); -/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(449); +/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(471); +/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(466); +/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(443); /* harmony import */ var _util_pipe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(25); /** PURE_IMPORTS_START _scan,_takeLast,_defaultIfEmpty,_util_pipe PURE_IMPORTS_END */ @@ -57721,7 +55673,7 @@ function reduce(accumulator, seed) { /***/ }), -/* 477 */ +/* 471 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57803,7 +55755,7 @@ var ScanSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 478 */ +/* 472 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57823,7 +55775,7 @@ function merge() { /***/ }), -/* 479 */ +/* 473 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57848,7 +55800,7 @@ function mergeMapTo(innerObservable, resultSelector, concurrent) { /***/ }), -/* 480 */ +/* 474 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -57957,13 +55909,13 @@ var MergeScanSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 481 */ +/* 475 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return min; }); -/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(476); +/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(470); /** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */ function min(comparer) { @@ -57976,7 +55928,7 @@ function min(comparer) { /***/ }), -/* 482 */ +/* 476 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58025,7 +55977,7 @@ var MulticastOperator = /*@__PURE__*/ (function () { /***/ }), -/* 483 */ +/* 477 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58115,7 +56067,7 @@ var OnErrorResumeNextSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 484 */ +/* 478 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58163,7 +56115,7 @@ var PairwiseSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 485 */ +/* 479 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58186,7 +56138,7 @@ function partition(predicate, thisArg) { /***/ }), -/* 486 */ +/* 480 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58226,14 +56178,14 @@ function plucker(props, length) { /***/ }), -/* 487 */ +/* 481 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publish", function() { return publish; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28); -/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(482); +/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(476); /** PURE_IMPORTS_START _Subject,_multicast PURE_IMPORTS_END */ @@ -58246,14 +56198,14 @@ function publish(selector) { /***/ }), -/* 488 */ +/* 482 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishBehavior", function() { return publishBehavior; }); /* harmony import */ var _BehaviorSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33); -/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(482); +/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(476); /** PURE_IMPORTS_START _BehaviorSubject,_multicast PURE_IMPORTS_END */ @@ -58264,14 +56216,14 @@ function publishBehavior(value) { /***/ }), -/* 489 */ +/* 483 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishLast", function() { return publishLast; }); /* harmony import */ var _AsyncSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51); -/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(482); +/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(476); /** PURE_IMPORTS_START _AsyncSubject,_multicast PURE_IMPORTS_END */ @@ -58282,14 +56234,14 @@ function publishLast() { /***/ }), -/* 490 */ +/* 484 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishReplay", function() { return publishReplay; }); /* harmony import */ var _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34); -/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(482); +/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(476); /** PURE_IMPORTS_START _ReplaySubject,_multicast PURE_IMPORTS_END */ @@ -58305,7 +56257,7 @@ function publishReplay(bufferSize, windowTime, selectorOrScheduler, scheduler) { /***/ }), -/* 491 */ +/* 485 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58332,7 +56284,7 @@ function race() { /***/ }), -/* 492 */ +/* 486 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58397,7 +56349,7 @@ var RepeatSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 493 */ +/* 487 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58491,7 +56443,7 @@ var RepeatWhenSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 494 */ +/* 488 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58544,7 +56496,7 @@ var RetrySubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 495 */ +/* 489 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58630,7 +56582,7 @@ var RetryWhenSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 496 */ +/* 490 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58685,7 +56637,7 @@ var SampleSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 497 */ +/* 491 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58745,7 +56697,7 @@ function dispatchNotification(state) { /***/ }), -/* 498 */ +/* 492 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58868,13 +56820,13 @@ var SequenceEqualCompareToSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 499 */ +/* 493 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "share", function() { return share; }); -/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(482); +/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(476); /* harmony import */ var _refCount__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28); /** PURE_IMPORTS_START _multicast,_refCount,_Subject PURE_IMPORTS_END */ @@ -58891,7 +56843,7 @@ function share() { /***/ }), -/* 500 */ +/* 494 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -58960,7 +56912,7 @@ function shareReplayOperator(_a) { /***/ }), -/* 501 */ +/* 495 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59040,7 +56992,7 @@ var SingleSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 502 */ +/* 496 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59082,7 +57034,7 @@ var SkipSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 503 */ +/* 497 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59144,7 +57096,7 @@ var SkipLastSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 504 */ +/* 498 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59201,7 +57153,7 @@ var SkipUntilSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 505 */ +/* 499 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59257,7 +57209,7 @@ var SkipWhileSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 506 */ +/* 500 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59286,13 +57238,13 @@ function startWith() { /***/ }), -/* 507 */ +/* 501 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeOn", function() { return subscribeOn; }); -/* harmony import */ var _observable_SubscribeOnObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(508); +/* harmony import */ var _observable_SubscribeOnObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(502); /** PURE_IMPORTS_START _observable_SubscribeOnObservable PURE_IMPORTS_END */ function subscribeOn(scheduler, delay) { @@ -59317,7 +57269,7 @@ var SubscribeOnOperator = /*@__PURE__*/ (function () { /***/ }), -/* 508 */ +/* 502 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59381,13 +57333,13 @@ var SubscribeOnObservable = /*@__PURE__*/ (function (_super) { /***/ }), -/* 509 */ +/* 503 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchAll", function() { return switchAll; }); -/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(510); +/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(504); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26); /** PURE_IMPORTS_START _switchMap,_util_identity PURE_IMPORTS_END */ @@ -59399,7 +57351,7 @@ function switchAll() { /***/ }), -/* 510 */ +/* 504 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59487,13 +57439,13 @@ var SwitchMapSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 511 */ +/* 505 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchMapTo", function() { return switchMapTo; }); -/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(510); +/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(504); /** PURE_IMPORTS_START _switchMap PURE_IMPORTS_END */ function switchMapTo(innerObservable, resultSelector) { @@ -59503,7 +57455,7 @@ function switchMapTo(innerObservable, resultSelector) { /***/ }), -/* 512 */ +/* 506 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59551,7 +57503,7 @@ var TakeUntilSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 513 */ +/* 507 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59619,7 +57571,7 @@ var TakeWhileSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 514 */ +/* 508 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59707,7 +57659,7 @@ var TapSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 515 */ +/* 509 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59809,7 +57761,7 @@ var ThrottleSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 516 */ +/* 510 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59818,7 +57770,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56); -/* harmony import */ var _throttle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(515); +/* harmony import */ var _throttle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(509); /** PURE_IMPORTS_START tslib,_Subscriber,_scheduler_async,_throttle PURE_IMPORTS_END */ @@ -59907,7 +57859,7 @@ function dispatchNext(arg) { /***/ }), -/* 517 */ +/* 511 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59915,7 +57867,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeInterval", function() { return timeInterval; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeInterval", function() { return TimeInterval; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(56); -/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(477); +/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(471); /* harmony import */ var _observable_defer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(92); /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67); /** PURE_IMPORTS_START _scheduler_async,_scan,_observable_defer,_map PURE_IMPORTS_END */ @@ -59951,7 +57903,7 @@ var TimeInterval = /*@__PURE__*/ (function () { /***/ }), -/* 518 */ +/* 512 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59959,7 +57911,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeout", function() { return timeout; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(56); /* harmony import */ var _util_TimeoutError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65); -/* harmony import */ var _timeoutWith__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(519); +/* harmony import */ var _timeoutWith__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(513); /* harmony import */ var _observable_throwError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(50); /** PURE_IMPORTS_START _scheduler_async,_util_TimeoutError,_timeoutWith,_observable_throwError PURE_IMPORTS_END */ @@ -59976,7 +57928,7 @@ function timeout(due, scheduler) { /***/ }), -/* 519 */ +/* 513 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59984,7 +57936,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeoutWith", function() { return timeoutWith; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(56); -/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(451); +/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(445); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(91); /** PURE_IMPORTS_START tslib,_scheduler_async,_util_isDate,_innerSubscribe PURE_IMPORTS_END */ @@ -60055,7 +58007,7 @@ var TimeoutWithSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 520 */ +/* 514 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -60085,13 +58037,13 @@ var Timestamp = /*@__PURE__*/ (function () { /***/ }), -/* 521 */ +/* 515 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return toArray; }); -/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(476); +/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(470); /** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */ function toArrayReducer(arr, item, index) { @@ -60108,7 +58060,7 @@ function toArray() { /***/ }), -/* 522 */ +/* 516 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -60186,7 +58138,7 @@ var WindowSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 523 */ +/* 517 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -60276,7 +58228,7 @@ var WindowCountSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 524 */ +/* 518 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -60446,7 +58398,7 @@ function dispatchWindowClose(state) { /***/ }), -/* 525 */ +/* 519 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -60589,7 +58541,7 @@ var WindowToggleSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 526 */ +/* 520 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -60686,7 +58638,7 @@ var WindowSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 527 */ +/* 521 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -60781,7 +58733,7 @@ var WithLatestFromSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 528 */ +/* 522 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -60803,7 +58755,7 @@ function zip() { /***/ }), -/* 529 */ +/* 523 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -60819,7 +58771,7 @@ function zipAll(project) { /***/ }), -/* 530 */ +/* 524 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -60829,7 +58781,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _observe_lines = __webpack_require__(531); +var _observe_lines = __webpack_require__(525); Object.keys(_observe_lines).forEach(function (key) { if (key === "default" || key === "__esModule") return; @@ -60842,7 +58794,7 @@ Object.keys(_observe_lines).forEach(function (key) { }); }); -var _observe_readable = __webpack_require__(532); +var _observe_readable = __webpack_require__(526); Object.keys(_observe_readable).forEach(function (key) { if (key === "default" || key === "__esModule") return; @@ -60856,7 +58808,7 @@ Object.keys(_observe_readable).forEach(function (key) { }); /***/ }), -/* 531 */ +/* 525 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -60869,9 +58821,9 @@ exports.observeLines = observeLines; var Rx = _interopRequireWildcard(__webpack_require__(9)); -var _operators = __webpack_require__(432); +var _operators = __webpack_require__(426); -var _observe_readable = __webpack_require__(532); +var _observe_readable = __webpack_require__(526); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -60934,7 +58886,7 @@ function observeLines(readable) { } /***/ }), -/* 532 */ +/* 526 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -60947,7 +58899,7 @@ exports.observeReadable = observeReadable; var Rx = _interopRequireWildcard(__webpack_require__(9)); -var _operators = __webpack_require__(432); +var _operators = __webpack_require__(426); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -60971,13 +58923,13 @@ function observeReadable(readable) { } /***/ }), -/* 533 */ +/* 527 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BuildCommand", function() { return BuildCommand; }); -/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(427); +/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(421); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License @@ -61005,7 +58957,7 @@ const BuildCommand = { }; /***/ }), -/* 534 */ +/* 528 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -61015,11 +58967,11 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var dedent__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dedent__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(240); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(535); +/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(529); /* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(ora__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(427); +/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(421); /* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(231); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(220); /* @@ -61122,20 +59074,20 @@ const CleanCommand = { }; /***/ }), -/* 535 */ +/* 529 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const readline = __webpack_require__(536); -const chalk = __webpack_require__(537); -const cliCursor = __webpack_require__(540); -const cliSpinners = __webpack_require__(542); -const logSymbols = __webpack_require__(544); -const stripAnsi = __webpack_require__(550); -const wcwidth = __webpack_require__(552); -const isInteractive = __webpack_require__(556); -const MuteStream = __webpack_require__(557); +const readline = __webpack_require__(530); +const chalk = __webpack_require__(531); +const cliCursor = __webpack_require__(534); +const cliSpinners = __webpack_require__(536); +const logSymbols = __webpack_require__(538); +const stripAnsi = __webpack_require__(544); +const wcwidth = __webpack_require__(546); +const isInteractive = __webpack_require__(550); +const MuteStream = __webpack_require__(551); const TEXT = Symbol('text'); const PREFIX_TEXT = Symbol('prefixText'); @@ -61488,13 +59440,13 @@ module.exports.promise = (action, options) => { /***/ }), -/* 536 */ +/* 530 */ /***/ (function(module, exports) { module.exports = require("readline"); /***/ }), -/* 537 */ +/* 531 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61504,7 +59456,7 @@ const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(121); const { stringReplaceAll, stringEncaseCRLFWithFirstIndex -} = __webpack_require__(538); +} = __webpack_require__(532); // `supportsColor.level` → `ansiStyles.color[name]` mapping const levelMapping = [ @@ -61705,7 +59657,7 @@ const chalkTag = (chalk, ...strings) => { } if (template === undefined) { - template = __webpack_require__(539); + template = __webpack_require__(533); } return template(chalk, parts.join('')); @@ -61734,7 +59686,7 @@ module.exports = chalk; /***/ }), -/* 538 */ +/* 532 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61780,7 +59732,7 @@ module.exports = { /***/ }), -/* 539 */ +/* 533 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61921,12 +59873,12 @@ module.exports = (chalk, temporary) => { /***/ }), -/* 540 */ +/* 534 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const restoreCursor = __webpack_require__(541); +const restoreCursor = __webpack_require__(535); let isHidden = false; @@ -61963,7 +59915,7 @@ exports.toggle = (force, writableStream) => { /***/ }), -/* 541 */ +/* 535 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61979,13 +59931,13 @@ module.exports = onetime(() => { /***/ }), -/* 542 */ +/* 536 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const spinners = Object.assign({}, __webpack_require__(543)); +const spinners = Object.assign({}, __webpack_require__(537)); const spinnersList = Object.keys(spinners); @@ -62003,18 +59955,18 @@ module.exports.default = spinners; /***/ }), -/* 543 */ +/* 537 */ /***/ (function(module) { module.exports = JSON.parse("{\"dots\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠹\",\"⠸\",\"⠼\",\"⠴\",\"⠦\",\"⠧\",\"⠇\",\"⠏\"]},\"dots2\":{\"interval\":80,\"frames\":[\"⣾\",\"⣽\",\"⣻\",\"⢿\",\"⡿\",\"⣟\",\"⣯\",\"⣷\"]},\"dots3\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠚\",\"⠞\",\"⠖\",\"⠦\",\"⠴\",\"⠲\",\"⠳\",\"⠓\"]},\"dots4\":{\"interval\":80,\"frames\":[\"⠄\",\"⠆\",\"⠇\",\"⠋\",\"⠙\",\"⠸\",\"⠰\",\"⠠\",\"⠰\",\"⠸\",\"⠙\",\"⠋\",\"⠇\",\"⠆\"]},\"dots5\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\"]},\"dots6\":{\"interval\":80,\"frames\":[\"⠁\",\"⠉\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠤\",\"⠄\",\"⠄\",\"⠤\",\"⠴\",\"⠲\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠚\",\"⠙\",\"⠉\",\"⠁\"]},\"dots7\":{\"interval\":80,\"frames\":[\"⠈\",\"⠉\",\"⠋\",\"⠓\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠖\",\"⠦\",\"⠤\",\"⠠\",\"⠠\",\"⠤\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\",\"⠉\",\"⠈\"]},\"dots8\":{\"interval\":80,\"frames\":[\"⠁\",\"⠁\",\"⠉\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠤\",\"⠄\",\"⠄\",\"⠤\",\"⠠\",\"⠠\",\"⠤\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\",\"⠉\",\"⠈\",\"⠈\"]},\"dots9\":{\"interval\":80,\"frames\":[\"⢹\",\"⢺\",\"⢼\",\"⣸\",\"⣇\",\"⡧\",\"⡗\",\"⡏\"]},\"dots10\":{\"interval\":80,\"frames\":[\"⢄\",\"⢂\",\"⢁\",\"⡁\",\"⡈\",\"⡐\",\"⡠\"]},\"dots11\":{\"interval\":100,\"frames\":[\"⠁\",\"⠂\",\"⠄\",\"⡀\",\"⢀\",\"⠠\",\"⠐\",\"⠈\"]},\"dots12\":{\"interval\":80,\"frames\":[\"⢀⠀\",\"⡀⠀\",\"⠄⠀\",\"⢂⠀\",\"⡂⠀\",\"⠅⠀\",\"⢃⠀\",\"⡃⠀\",\"⠍⠀\",\"⢋⠀\",\"⡋⠀\",\"⠍⠁\",\"⢋⠁\",\"⡋⠁\",\"⠍⠉\",\"⠋⠉\",\"⠋⠉\",\"⠉⠙\",\"⠉⠙\",\"⠉⠩\",\"⠈⢙\",\"⠈⡙\",\"⢈⠩\",\"⡀⢙\",\"⠄⡙\",\"⢂⠩\",\"⡂⢘\",\"⠅⡘\",\"⢃⠨\",\"⡃⢐\",\"⠍⡐\",\"⢋⠠\",\"⡋⢀\",\"⠍⡁\",\"⢋⠁\",\"⡋⠁\",\"⠍⠉\",\"⠋⠉\",\"⠋⠉\",\"⠉⠙\",\"⠉⠙\",\"⠉⠩\",\"⠈⢙\",\"⠈⡙\",\"⠈⠩\",\"⠀⢙\",\"⠀⡙\",\"⠀⠩\",\"⠀⢘\",\"⠀⡘\",\"⠀⠨\",\"⠀⢐\",\"⠀⡐\",\"⠀⠠\",\"⠀⢀\",\"⠀⡀\"]},\"dots8Bit\":{\"interval\":80,\"frames\":[\"⠀\",\"⠁\",\"⠂\",\"⠃\",\"⠄\",\"⠅\",\"⠆\",\"⠇\",\"⡀\",\"⡁\",\"⡂\",\"⡃\",\"⡄\",\"⡅\",\"⡆\",\"⡇\",\"⠈\",\"⠉\",\"⠊\",\"⠋\",\"⠌\",\"⠍\",\"⠎\",\"⠏\",\"⡈\",\"⡉\",\"⡊\",\"⡋\",\"⡌\",\"⡍\",\"⡎\",\"⡏\",\"⠐\",\"⠑\",\"⠒\",\"⠓\",\"⠔\",\"⠕\",\"⠖\",\"⠗\",\"⡐\",\"⡑\",\"⡒\",\"⡓\",\"⡔\",\"⡕\",\"⡖\",\"⡗\",\"⠘\",\"⠙\",\"⠚\",\"⠛\",\"⠜\",\"⠝\",\"⠞\",\"⠟\",\"⡘\",\"⡙\",\"⡚\",\"⡛\",\"⡜\",\"⡝\",\"⡞\",\"⡟\",\"⠠\",\"⠡\",\"⠢\",\"⠣\",\"⠤\",\"⠥\",\"⠦\",\"⠧\",\"⡠\",\"⡡\",\"⡢\",\"⡣\",\"⡤\",\"⡥\",\"⡦\",\"⡧\",\"⠨\",\"⠩\",\"⠪\",\"⠫\",\"⠬\",\"⠭\",\"⠮\",\"⠯\",\"⡨\",\"⡩\",\"⡪\",\"⡫\",\"⡬\",\"⡭\",\"⡮\",\"⡯\",\"⠰\",\"⠱\",\"⠲\",\"⠳\",\"⠴\",\"⠵\",\"⠶\",\"⠷\",\"⡰\",\"⡱\",\"⡲\",\"⡳\",\"⡴\",\"⡵\",\"⡶\",\"⡷\",\"⠸\",\"⠹\",\"⠺\",\"⠻\",\"⠼\",\"⠽\",\"⠾\",\"⠿\",\"⡸\",\"⡹\",\"⡺\",\"⡻\",\"⡼\",\"⡽\",\"⡾\",\"⡿\",\"⢀\",\"⢁\",\"⢂\",\"⢃\",\"⢄\",\"⢅\",\"⢆\",\"⢇\",\"⣀\",\"⣁\",\"⣂\",\"⣃\",\"⣄\",\"⣅\",\"⣆\",\"⣇\",\"⢈\",\"⢉\",\"⢊\",\"⢋\",\"⢌\",\"⢍\",\"⢎\",\"⢏\",\"⣈\",\"⣉\",\"⣊\",\"⣋\",\"⣌\",\"⣍\",\"⣎\",\"⣏\",\"⢐\",\"⢑\",\"⢒\",\"⢓\",\"⢔\",\"⢕\",\"⢖\",\"⢗\",\"⣐\",\"⣑\",\"⣒\",\"⣓\",\"⣔\",\"⣕\",\"⣖\",\"⣗\",\"⢘\",\"⢙\",\"⢚\",\"⢛\",\"⢜\",\"⢝\",\"⢞\",\"⢟\",\"⣘\",\"⣙\",\"⣚\",\"⣛\",\"⣜\",\"⣝\",\"⣞\",\"⣟\",\"⢠\",\"⢡\",\"⢢\",\"⢣\",\"⢤\",\"⢥\",\"⢦\",\"⢧\",\"⣠\",\"⣡\",\"⣢\",\"⣣\",\"⣤\",\"⣥\",\"⣦\",\"⣧\",\"⢨\",\"⢩\",\"⢪\",\"⢫\",\"⢬\",\"⢭\",\"⢮\",\"⢯\",\"⣨\",\"⣩\",\"⣪\",\"⣫\",\"⣬\",\"⣭\",\"⣮\",\"⣯\",\"⢰\",\"⢱\",\"⢲\",\"⢳\",\"⢴\",\"⢵\",\"⢶\",\"⢷\",\"⣰\",\"⣱\",\"⣲\",\"⣳\",\"⣴\",\"⣵\",\"⣶\",\"⣷\",\"⢸\",\"⢹\",\"⢺\",\"⢻\",\"⢼\",\"⢽\",\"⢾\",\"⢿\",\"⣸\",\"⣹\",\"⣺\",\"⣻\",\"⣼\",\"⣽\",\"⣾\",\"⣿\"]},\"line\":{\"interval\":130,\"frames\":[\"-\",\"\\\\\",\"|\",\"/\"]},\"line2\":{\"interval\":100,\"frames\":[\"⠂\",\"-\",\"–\",\"—\",\"–\",\"-\"]},\"pipe\":{\"interval\":100,\"frames\":[\"┤\",\"┘\",\"┴\",\"└\",\"├\",\"┌\",\"┬\",\"┐\"]},\"simpleDots\":{\"interval\":400,\"frames\":[\". \",\".. \",\"...\",\" \"]},\"simpleDotsScrolling\":{\"interval\":200,\"frames\":[\". \",\".. \",\"...\",\" ..\",\" .\",\" \"]},\"star\":{\"interval\":70,\"frames\":[\"✶\",\"✸\",\"✹\",\"✺\",\"✹\",\"✷\"]},\"star2\":{\"interval\":80,\"frames\":[\"+\",\"x\",\"*\"]},\"flip\":{\"interval\":70,\"frames\":[\"_\",\"_\",\"_\",\"-\",\"`\",\"`\",\"'\",\"´\",\"-\",\"_\",\"_\",\"_\"]},\"hamburger\":{\"interval\":100,\"frames\":[\"☱\",\"☲\",\"☴\"]},\"growVertical\":{\"interval\":120,\"frames\":[\"▁\",\"▃\",\"▄\",\"▅\",\"▆\",\"▇\",\"▆\",\"▅\",\"▄\",\"▃\"]},\"growHorizontal\":{\"interval\":120,\"frames\":[\"▏\",\"▎\",\"▍\",\"▌\",\"▋\",\"▊\",\"▉\",\"▊\",\"▋\",\"▌\",\"▍\",\"▎\"]},\"balloon\":{\"interval\":140,\"frames\":[\" \",\".\",\"o\",\"O\",\"@\",\"*\",\" \"]},\"balloon2\":{\"interval\":120,\"frames\":[\".\",\"o\",\"O\",\"°\",\"O\",\"o\",\".\"]},\"noise\":{\"interval\":100,\"frames\":[\"▓\",\"▒\",\"░\"]},\"bounce\":{\"interval\":120,\"frames\":[\"⠁\",\"⠂\",\"⠄\",\"⠂\"]},\"boxBounce\":{\"interval\":120,\"frames\":[\"▖\",\"▘\",\"▝\",\"▗\"]},\"boxBounce2\":{\"interval\":100,\"frames\":[\"▌\",\"▀\",\"▐\",\"▄\"]},\"triangle\":{\"interval\":50,\"frames\":[\"◢\",\"◣\",\"◤\",\"◥\"]},\"arc\":{\"interval\":100,\"frames\":[\"◜\",\"◠\",\"◝\",\"◞\",\"◡\",\"◟\"]},\"circle\":{\"interval\":120,\"frames\":[\"◡\",\"⊙\",\"◠\"]},\"squareCorners\":{\"interval\":180,\"frames\":[\"◰\",\"◳\",\"◲\",\"◱\"]},\"circleQuarters\":{\"interval\":120,\"frames\":[\"◴\",\"◷\",\"◶\",\"◵\"]},\"circleHalves\":{\"interval\":50,\"frames\":[\"◐\",\"◓\",\"◑\",\"◒\"]},\"squish\":{\"interval\":100,\"frames\":[\"╫\",\"╪\"]},\"toggle\":{\"interval\":250,\"frames\":[\"⊶\",\"⊷\"]},\"toggle2\":{\"interval\":80,\"frames\":[\"▫\",\"▪\"]},\"toggle3\":{\"interval\":120,\"frames\":[\"□\",\"■\"]},\"toggle4\":{\"interval\":100,\"frames\":[\"■\",\"□\",\"▪\",\"▫\"]},\"toggle5\":{\"interval\":100,\"frames\":[\"▮\",\"▯\"]},\"toggle6\":{\"interval\":300,\"frames\":[\"ဝ\",\"၀\"]},\"toggle7\":{\"interval\":80,\"frames\":[\"⦾\",\"⦿\"]},\"toggle8\":{\"interval\":100,\"frames\":[\"◍\",\"◌\"]},\"toggle9\":{\"interval\":100,\"frames\":[\"◉\",\"◎\"]},\"toggle10\":{\"interval\":100,\"frames\":[\"㊂\",\"㊀\",\"㊁\"]},\"toggle11\":{\"interval\":50,\"frames\":[\"⧇\",\"⧆\"]},\"toggle12\":{\"interval\":120,\"frames\":[\"☗\",\"☖\"]},\"toggle13\":{\"interval\":80,\"frames\":[\"=\",\"*\",\"-\"]},\"arrow\":{\"interval\":100,\"frames\":[\"←\",\"↖\",\"↑\",\"↗\",\"→\",\"↘\",\"↓\",\"↙\"]},\"arrow2\":{\"interval\":80,\"frames\":[\"⬆️ \",\"↗️ \",\"➡️ \",\"↘️ \",\"⬇️ \",\"↙️ \",\"⬅️ \",\"↖️ \"]},\"arrow3\":{\"interval\":120,\"frames\":[\"▹▹▹▹▹\",\"▸▹▹▹▹\",\"▹▸▹▹▹\",\"▹▹▸▹▹\",\"▹▹▹▸▹\",\"▹▹▹▹▸\"]},\"bouncingBar\":{\"interval\":80,\"frames\":[\"[ ]\",\"[= ]\",\"[== ]\",\"[=== ]\",\"[ ===]\",\"[ ==]\",\"[ =]\",\"[ ]\",\"[ =]\",\"[ ==]\",\"[ ===]\",\"[====]\",\"[=== ]\",\"[== ]\",\"[= ]\"]},\"bouncingBall\":{\"interval\":80,\"frames\":[\"( ● )\",\"( ● )\",\"( ● )\",\"( ● )\",\"( ●)\",\"( ● )\",\"( ● )\",\"( ● )\",\"( ● )\",\"(● )\"]},\"smiley\":{\"interval\":200,\"frames\":[\"😄 \",\"😝 \"]},\"monkey\":{\"interval\":300,\"frames\":[\"🙈 \",\"🙈 \",\"🙉 \",\"🙊 \"]},\"hearts\":{\"interval\":100,\"frames\":[\"💛 \",\"💙 \",\"💜 \",\"💚 \",\"❤️ \"]},\"clock\":{\"interval\":100,\"frames\":[\"🕛 \",\"🕐 \",\"🕑 \",\"🕒 \",\"🕓 \",\"🕔 \",\"🕕 \",\"🕖 \",\"🕗 \",\"🕘 \",\"🕙 \",\"🕚 \"]},\"earth\":{\"interval\":180,\"frames\":[\"🌍 \",\"🌎 \",\"🌏 \"]},\"material\":{\"interval\":17,\"frames\":[\"█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"███████▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"████████▁▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"██████████▁▁▁▁▁▁▁▁▁▁\",\"███████████▁▁▁▁▁▁▁▁▁\",\"█████████████▁▁▁▁▁▁▁\",\"██████████████▁▁▁▁▁▁\",\"██████████████▁▁▁▁▁▁\",\"▁██████████████▁▁▁▁▁\",\"▁██████████████▁▁▁▁▁\",\"▁██████████████▁▁▁▁▁\",\"▁▁██████████████▁▁▁▁\",\"▁▁▁██████████████▁▁▁\",\"▁▁▁▁█████████████▁▁▁\",\"▁▁▁▁██████████████▁▁\",\"▁▁▁▁██████████████▁▁\",\"▁▁▁▁▁██████████████▁\",\"▁▁▁▁▁██████████████▁\",\"▁▁▁▁▁██████████████▁\",\"▁▁▁▁▁▁██████████████\",\"▁▁▁▁▁▁██████████████\",\"▁▁▁▁▁▁▁█████████████\",\"▁▁▁▁▁▁▁█████████████\",\"▁▁▁▁▁▁▁▁████████████\",\"▁▁▁▁▁▁▁▁████████████\",\"▁▁▁▁▁▁▁▁▁███████████\",\"▁▁▁▁▁▁▁▁▁███████████\",\"▁▁▁▁▁▁▁▁▁▁██████████\",\"▁▁▁▁▁▁▁▁▁▁██████████\",\"▁▁▁▁▁▁▁▁▁▁▁▁████████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁███████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████\",\"█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████\",\"██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███\",\"██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███\",\"███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███\",\"████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██\",\"█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"██████▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"████████▁▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"███████████▁▁▁▁▁▁▁▁▁\",\"████████████▁▁▁▁▁▁▁▁\",\"████████████▁▁▁▁▁▁▁▁\",\"██████████████▁▁▁▁▁▁\",\"██████████████▁▁▁▁▁▁\",\"▁██████████████▁▁▁▁▁\",\"▁██████████████▁▁▁▁▁\",\"▁▁▁█████████████▁▁▁▁\",\"▁▁▁▁▁████████████▁▁▁\",\"▁▁▁▁▁████████████▁▁▁\",\"▁▁▁▁▁▁███████████▁▁▁\",\"▁▁▁▁▁▁▁▁█████████▁▁▁\",\"▁▁▁▁▁▁▁▁█████████▁▁▁\",\"▁▁▁▁▁▁▁▁▁█████████▁▁\",\"▁▁▁▁▁▁▁▁▁█████████▁▁\",\"▁▁▁▁▁▁▁▁▁▁█████████▁\",\"▁▁▁▁▁▁▁▁▁▁▁████████▁\",\"▁▁▁▁▁▁▁▁▁▁▁████████▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁███████▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁███████▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁███████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁███████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\"]},\"moon\":{\"interval\":80,\"frames\":[\"🌑 \",\"🌒 \",\"🌓 \",\"🌔 \",\"🌕 \",\"🌖 \",\"🌗 \",\"🌘 \"]},\"runner\":{\"interval\":140,\"frames\":[\"🚶 \",\"🏃 \"]},\"pong\":{\"interval\":80,\"frames\":[\"▐⠂ ▌\",\"▐⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂▌\",\"▐ ⠠▌\",\"▐ ⡀▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐⠠ ▌\"]},\"shark\":{\"interval\":120,\"frames\":[\"▐|\\\\____________▌\",\"▐_|\\\\___________▌\",\"▐__|\\\\__________▌\",\"▐___|\\\\_________▌\",\"▐____|\\\\________▌\",\"▐_____|\\\\_______▌\",\"▐______|\\\\______▌\",\"▐_______|\\\\_____▌\",\"▐________|\\\\____▌\",\"▐_________|\\\\___▌\",\"▐__________|\\\\__▌\",\"▐___________|\\\\_▌\",\"▐____________|\\\\▌\",\"▐____________/|▌\",\"▐___________/|_▌\",\"▐__________/|__▌\",\"▐_________/|___▌\",\"▐________/|____▌\",\"▐_______/|_____▌\",\"▐______/|______▌\",\"▐_____/|_______▌\",\"▐____/|________▌\",\"▐___/|_________▌\",\"▐__/|__________▌\",\"▐_/|___________▌\",\"▐/|____________▌\"]},\"dqpb\":{\"interval\":100,\"frames\":[\"d\",\"q\",\"p\",\"b\"]},\"weather\":{\"interval\":100,\"frames\":[\"☀️ \",\"☀️ \",\"☀️ \",\"🌤 \",\"⛅️ \",\"🌥 \",\"☁️ \",\"🌧 \",\"🌨 \",\"🌧 \",\"🌨 \",\"🌧 \",\"🌨 \",\"⛈ \",\"🌨 \",\"🌧 \",\"🌨 \",\"☁️ \",\"🌥 \",\"⛅️ \",\"🌤 \",\"☀️ \",\"☀️ \"]},\"christmas\":{\"interval\":400,\"frames\":[\"🌲\",\"🎄\"]},\"grenade\":{\"interval\":80,\"frames\":[\"، \",\"′ \",\" ´ \",\" ‾ \",\" ⸌\",\" ⸊\",\" |\",\" ⁎\",\" ⁕\",\" ෴ \",\" ⁓\",\" \",\" \",\" \"]},\"point\":{\"interval\":125,\"frames\":[\"∙∙∙\",\"●∙∙\",\"∙●∙\",\"∙∙●\",\"∙∙∙\"]},\"layer\":{\"interval\":150,\"frames\":[\"-\",\"=\",\"≡\"]},\"betaWave\":{\"interval\":80,\"frames\":[\"ρββββββ\",\"βρβββββ\",\"ββρββββ\",\"βββρβββ\",\"ββββρββ\",\"βββββρβ\",\"ββββββρ\"]},\"aesthetic\":{\"interval\":80,\"frames\":[\"▰▱▱▱▱▱▱\",\"▰▰▱▱▱▱▱\",\"▰▰▰▱▱▱▱\",\"▰▰▰▰▱▱▱\",\"▰▰▰▰▰▱▱\",\"▰▰▰▰▰▰▱\",\"▰▰▰▰▰▰▰\",\"▰▱▱▱▱▱▱\"]}}"); /***/ }), -/* 544 */ +/* 538 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const chalk = __webpack_require__(545); +const chalk = __webpack_require__(539); const isSupported = process.platform !== 'win32' || process.env.CI || process.env.TERM === 'xterm-256color'; @@ -62036,16 +59988,16 @@ module.exports = isSupported ? main : fallbacks; /***/ }), -/* 545 */ +/* 539 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const escapeStringRegexp = __webpack_require__(363); -const ansiStyles = __webpack_require__(546); -const stdoutColor = __webpack_require__(547).stdout; +const escapeStringRegexp = __webpack_require__(357); +const ansiStyles = __webpack_require__(540); +const stdoutColor = __webpack_require__(541).stdout; -const template = __webpack_require__(549); +const template = __webpack_require__(543); const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); @@ -62271,12 +60223,12 @@ module.exports.default = module.exports; // For TypeScript /***/ }), -/* 546 */ +/* 540 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) { -const colorConvert = __webpack_require__(365); +const colorConvert = __webpack_require__(359); const wrapAnsi16 = (fn, offset) => function () { const code = fn.apply(colorConvert, arguments); @@ -62444,13 +60396,13 @@ Object.defineProperty(module, 'exports', { /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(116)(module))) /***/ }), -/* 547 */ +/* 541 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const os = __webpack_require__(122); -const hasFlag = __webpack_require__(548); +const hasFlag = __webpack_require__(542); const env = process.env; @@ -62582,7 +60534,7 @@ module.exports = { /***/ }), -/* 548 */ +/* 542 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62597,7 +60549,7 @@ module.exports = (flag, argv) => { /***/ }), -/* 549 */ +/* 543 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62732,18 +60684,18 @@ module.exports = (chalk, tmp) => { /***/ }), -/* 550 */ +/* 544 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const ansiRegex = __webpack_require__(551); +const ansiRegex = __webpack_require__(545); module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; /***/ }), -/* 551 */ +/* 545 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62760,14 +60712,14 @@ module.exports = ({onlyFirst = false} = {}) => { /***/ }), -/* 552 */ +/* 546 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var defaults = __webpack_require__(553) -var combining = __webpack_require__(555) +var defaults = __webpack_require__(547) +var combining = __webpack_require__(549) var DEFAULTS = { nul: 0, @@ -62866,10 +60818,10 @@ function bisearch(ucs) { /***/ }), -/* 553 */ +/* 547 */ /***/ (function(module, exports, __webpack_require__) { -var clone = __webpack_require__(554); +var clone = __webpack_require__(548); module.exports = function(options, defaults) { options = options || {}; @@ -62884,7 +60836,7 @@ module.exports = function(options, defaults) { }; /***/ }), -/* 554 */ +/* 548 */ /***/ (function(module, exports, __webpack_require__) { var clone = (function() { @@ -63056,7 +61008,7 @@ if ( true && module.exports) { /***/ }), -/* 555 */ +/* 549 */ /***/ (function(module, exports) { module.exports = [ @@ -63112,7 +61064,7 @@ module.exports = [ /***/ }), -/* 556 */ +/* 550 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -63128,7 +61080,7 @@ module.exports = ({stream = process.stdout} = {}) => { /***/ }), -/* 557 */ +/* 551 */ /***/ (function(module, exports, __webpack_require__) { var Stream = __webpack_require__(173) @@ -63279,7 +61231,7 @@ MuteStream.prototype.close = proxy('close') /***/ }), -/* 558 */ +/* 552 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -63289,11 +61241,11 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var dedent__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dedent__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(240); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(535); +/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(529); /* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(ora__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(427); +/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(421); /* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(231); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(220); /* @@ -63402,7 +61354,7 @@ const ResetCommand = { }; /***/ }), -/* 559 */ +/* 553 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -63410,10 +61362,10 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RunCommand", function() { return RunCommand; }); /* harmony import */ var dedent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var dedent__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dedent__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(347); +/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(341); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(220); -/* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(560); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(346); +/* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(554); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(340); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License @@ -63471,7 +61423,7 @@ const RunCommand = { }; /***/ }), -/* 560 */ +/* 554 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -63526,13 +61478,13 @@ async function parallelize(items, fn, concurrency = 4) { } /***/ }), -/* 561 */ +/* 555 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WatchCommand", function() { return WatchCommand; }); -/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(427); +/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(421); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License @@ -63563,7 +61515,7 @@ const WatchCommand = { }; /***/ }), -/* 562 */ +/* 556 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -63643,7 +61595,7 @@ const PatchNativeModulesCommand = { }; /***/ }), -/* 563 */ +/* 557 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -63651,11 +61603,11 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runCommand", function() { return runCommand; }); /* harmony import */ var _kbn_dev_utils_ci_stats_reporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(131); /* harmony import */ var _kbn_dev_utils_ci_stats_reporter__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_kbn_dev_utils_ci_stats_reporter__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(347); +/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(341); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(220); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(346); -/* harmony import */ var _utils_projects_tree__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(426); -/* harmony import */ var _utils_kibana__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(564); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(340); +/* harmony import */ var _utils_projects_tree__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(420); +/* harmony import */ var _utils_kibana__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(558); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } @@ -63774,7 +61726,7 @@ function toArray(value) { } /***/ }), -/* 564 */ +/* 558 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -63784,13 +61736,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(132); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(565); +/* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(559); /* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(multimatch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var is_path_inside__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(339); +/* harmony import */ var is_path_inside__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(333); /* harmony import */ var is_path_inside__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(is_path_inside__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _yarn_lock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(414); -/* harmony import */ var _projects__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(346); -/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(568); +/* harmony import */ var _yarn_lock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(408); +/* harmony import */ var _projects__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(340); +/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(562); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } @@ -63954,15 +61906,15 @@ class Kibana { } /***/ }), -/* 565 */ +/* 559 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const minimatch = __webpack_require__(247); const arrayUnion = __webpack_require__(242); -const arrayDiffer = __webpack_require__(566); -const arrify = __webpack_require__(567); +const arrayDiffer = __webpack_require__(560); +const arrify = __webpack_require__(561); module.exports = (list, patterns, options = {}) => { list = arrify(list); @@ -63986,7 +61938,7 @@ module.exports = (list, patterns, options = {}) => { /***/ }), -/* 566 */ +/* 560 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64001,7 +61953,7 @@ module.exports = arrayDiffer; /***/ }), -/* 567 */ +/* 561 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64031,7 +61983,7 @@ module.exports = arrify; /***/ }), -/* 568 */ +/* 562 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -64091,15 +62043,15 @@ function getProjectPaths({ } /***/ }), -/* 569 */ +/* 563 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony import */ var _build_bazel_production_projects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(570); +/* harmony import */ var _build_bazel_production_projects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(564); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildBazelProductionProjects", function() { return _build_bazel_production_projects__WEBPACK_IMPORTED_MODULE_0__["buildBazelProductionProjects"]; }); -/* harmony import */ var _build_non_bazel_production_projects__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(817); +/* harmony import */ var _build_non_bazel_production_projects__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(811); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildNonBazelProductionProjects", function() { return _build_non_bazel_production_projects__WEBPACK_IMPORTED_MODULE_1__["buildNonBazelProductionProjects"]; }); /* @@ -64113,24 +62065,24 @@ __webpack_require__.r(__webpack_exports__); /***/ }), -/* 570 */ +/* 564 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildBazelProductionProjects", function() { return buildBazelProductionProjects; }); -/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(571); +/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(565); /* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cpy__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var globby__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(783); +/* harmony import */ var globby__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(777); /* harmony import */ var globby__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(globby__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _build_non_bazel_production_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(817); -/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(427); +/* harmony import */ var _build_non_bazel_production_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(811); +/* harmony import */ var _utils_bazel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(421); /* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(231); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(220); -/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(349); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(346); +/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(343); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(340); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License @@ -64220,7 +62172,7 @@ async function applyCorrectPermissions(project, kibanaRoot, buildRoot) { } /***/ }), -/* 571 */ +/* 565 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64228,14 +62180,14 @@ async function applyCorrectPermissions(project, kibanaRoot, buildRoot) { const EventEmitter = __webpack_require__(164); const path = __webpack_require__(4); const os = __webpack_require__(122); -const pMap = __webpack_require__(572); -const arrify = __webpack_require__(567); -const globby = __webpack_require__(575); -const hasGlob = __webpack_require__(767); -const cpFile = __webpack_require__(769); -const junk = __webpack_require__(779); -const pFilter = __webpack_require__(780); -const CpyError = __webpack_require__(782); +const pMap = __webpack_require__(566); +const arrify = __webpack_require__(561); +const globby = __webpack_require__(569); +const hasGlob = __webpack_require__(761); +const cpFile = __webpack_require__(763); +const junk = __webpack_require__(773); +const pFilter = __webpack_require__(774); +const CpyError = __webpack_require__(776); const defaultOptions = { ignoreJunk: true @@ -64386,12 +62338,12 @@ module.exports = (source, destination, { /***/ }), -/* 572 */ +/* 566 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const AggregateError = __webpack_require__(573); +const AggregateError = __webpack_require__(567); module.exports = async ( iterable, @@ -64474,13 +62426,13 @@ module.exports = async ( /***/ }), -/* 573 */ +/* 567 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const indentString = __webpack_require__(574); -const cleanStack = __webpack_require__(344); +const indentString = __webpack_require__(568); +const cleanStack = __webpack_require__(338); const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, ''); @@ -64528,7 +62480,7 @@ module.exports = AggregateError; /***/ }), -/* 574 */ +/* 568 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64570,17 +62522,17 @@ module.exports = (string, count = 1, options) => { /***/ }), -/* 575 */ +/* 569 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const fs = __webpack_require__(132); -const arrayUnion = __webpack_require__(576); +const arrayUnion = __webpack_require__(570); const glob = __webpack_require__(244); -const fastGlob = __webpack_require__(578); -const dirGlob = __webpack_require__(761); -const gitignore = __webpack_require__(764); +const fastGlob = __webpack_require__(572); +const dirGlob = __webpack_require__(755); +const gitignore = __webpack_require__(758); const DEFAULT_FILTER = () => false; @@ -64725,12 +62677,12 @@ module.exports.gitignore = gitignore; /***/ }), -/* 576 */ +/* 570 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var arrayUniq = __webpack_require__(577); +var arrayUniq = __webpack_require__(571); module.exports = function () { return arrayUniq([].concat.apply([], arguments)); @@ -64738,7 +62690,7 @@ module.exports = function () { /***/ }), -/* 577 */ +/* 571 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64807,10 +62759,10 @@ if ('Set' in global) { /***/ }), -/* 578 */ +/* 572 */ /***/ (function(module, exports, __webpack_require__) { -const pkg = __webpack_require__(579); +const pkg = __webpack_require__(573); module.exports = pkg.async; module.exports.default = pkg.async; @@ -64823,19 +62775,19 @@ module.exports.generateTasks = pkg.generateTasks; /***/ }), -/* 579 */ +/* 573 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var optionsManager = __webpack_require__(580); -var taskManager = __webpack_require__(581); -var reader_async_1 = __webpack_require__(732); -var reader_stream_1 = __webpack_require__(756); -var reader_sync_1 = __webpack_require__(757); -var arrayUtils = __webpack_require__(759); -var streamUtils = __webpack_require__(760); +var optionsManager = __webpack_require__(574); +var taskManager = __webpack_require__(575); +var reader_async_1 = __webpack_require__(726); +var reader_stream_1 = __webpack_require__(750); +var reader_sync_1 = __webpack_require__(751); +var arrayUtils = __webpack_require__(753); +var streamUtils = __webpack_require__(754); /** * Synchronous API. */ @@ -64901,7 +62853,7 @@ function isString(source) { /***/ }), -/* 580 */ +/* 574 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64939,13 +62891,13 @@ exports.prepare = prepare; /***/ }), -/* 581 */ +/* 575 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var patternUtils = __webpack_require__(582); +var patternUtils = __webpack_require__(576); /** * Generate tasks based on parent directory of each pattern. */ @@ -65036,16 +62988,16 @@ exports.convertPatternGroupToTask = convertPatternGroupToTask; /***/ }), -/* 582 */ +/* 576 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var path = __webpack_require__(4); -var globParent = __webpack_require__(583); +var globParent = __webpack_require__(577); var isGlob = __webpack_require__(266); -var micromatch = __webpack_require__(586); +var micromatch = __webpack_require__(580); var GLOBSTAR = '**'; /** * Return true for static pattern. @@ -65191,15 +63143,15 @@ exports.matchAny = matchAny; /***/ }), -/* 583 */ +/* 577 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var path = __webpack_require__(4); -var isglob = __webpack_require__(584); -var pathDirname = __webpack_require__(585); +var isglob = __webpack_require__(578); +var pathDirname = __webpack_require__(579); var isWin32 = __webpack_require__(122).platform() === 'win32'; module.exports = function globParent(str) { @@ -65222,7 +63174,7 @@ module.exports = function globParent(str) { /***/ }), -/* 584 */ +/* 578 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -65253,7 +63205,7 @@ module.exports = function isGlob(str) { /***/ }), -/* 585 */ +/* 579 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -65403,7 +63355,7 @@ module.exports.win32 = win32; /***/ }), -/* 586 */ +/* 580 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -65414,18 +63366,18 @@ module.exports.win32 = win32; */ var util = __webpack_require__(113); -var braces = __webpack_require__(587); -var toRegex = __webpack_require__(588); -var extend = __webpack_require__(700); +var braces = __webpack_require__(581); +var toRegex = __webpack_require__(582); +var extend = __webpack_require__(694); /** * Local dependencies */ -var compilers = __webpack_require__(702); -var parsers = __webpack_require__(728); -var cache = __webpack_require__(729); -var utils = __webpack_require__(730); +var compilers = __webpack_require__(696); +var parsers = __webpack_require__(722); +var cache = __webpack_require__(723); +var utils = __webpack_require__(724); var MAX_LENGTH = 1024 * 64; /** @@ -66287,7 +64239,7 @@ module.exports = micromatch; /***/ }), -/* 587 */ +/* 581 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -66297,18 +64249,18 @@ module.exports = micromatch; * Module dependencies */ -var toRegex = __webpack_require__(588); -var unique = __webpack_require__(608); -var extend = __webpack_require__(609); +var toRegex = __webpack_require__(582); +var unique = __webpack_require__(602); +var extend = __webpack_require__(603); /** * Local dependencies */ -var compilers = __webpack_require__(611); -var parsers = __webpack_require__(626); -var Braces = __webpack_require__(631); -var utils = __webpack_require__(612); +var compilers = __webpack_require__(605); +var parsers = __webpack_require__(620); +var Braces = __webpack_require__(625); +var utils = __webpack_require__(606); var MAX_LENGTH = 1024 * 64; var cache = {}; @@ -66612,16 +64564,16 @@ module.exports = braces; /***/ }), -/* 588 */ +/* 582 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var safe = __webpack_require__(589); -var define = __webpack_require__(595); -var extend = __webpack_require__(601); -var not = __webpack_require__(605); +var safe = __webpack_require__(583); +var define = __webpack_require__(589); +var extend = __webpack_require__(595); +var not = __webpack_require__(599); var MAX_LENGTH = 1024 * 64; /** @@ -66774,10 +64726,10 @@ module.exports.makeRe = makeRe; /***/ }), -/* 589 */ +/* 583 */ /***/ (function(module, exports, __webpack_require__) { -var parse = __webpack_require__(590); +var parse = __webpack_require__(584); var types = parse.types; module.exports = function (re, opts) { @@ -66823,13 +64775,13 @@ function isRegExp (x) { /***/ }), -/* 590 */ +/* 584 */ /***/ (function(module, exports, __webpack_require__) { -var util = __webpack_require__(591); -var types = __webpack_require__(592); -var sets = __webpack_require__(593); -var positions = __webpack_require__(594); +var util = __webpack_require__(585); +var types = __webpack_require__(586); +var sets = __webpack_require__(587); +var positions = __webpack_require__(588); module.exports = function(regexpStr) { @@ -67111,11 +65063,11 @@ module.exports.types = types; /***/ }), -/* 591 */ +/* 585 */ /***/ (function(module, exports, __webpack_require__) { -var types = __webpack_require__(592); -var sets = __webpack_require__(593); +var types = __webpack_require__(586); +var sets = __webpack_require__(587); // All of these are private and only used by randexp. @@ -67228,7 +65180,7 @@ exports.error = function(regexp, msg) { /***/ }), -/* 592 */ +/* 586 */ /***/ (function(module, exports) { module.exports = { @@ -67244,10 +65196,10 @@ module.exports = { /***/ }), -/* 593 */ +/* 587 */ /***/ (function(module, exports, __webpack_require__) { -var types = __webpack_require__(592); +var types = __webpack_require__(586); var INTS = function() { return [{ type: types.RANGE , from: 48, to: 57 }]; @@ -67332,10 +65284,10 @@ exports.anyChar = function() { /***/ }), -/* 594 */ +/* 588 */ /***/ (function(module, exports, __webpack_require__) { -var types = __webpack_require__(592); +var types = __webpack_require__(586); exports.wordBoundary = function() { return { type: types.POSITION, value: 'b' }; @@ -67355,7 +65307,7 @@ exports.end = function() { /***/ }), -/* 595 */ +/* 589 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67368,8 +65320,8 @@ exports.end = function() { -var isobject = __webpack_require__(596); -var isDescriptor = __webpack_require__(597); +var isobject = __webpack_require__(590); +var isDescriptor = __webpack_require__(591); var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty) ? Reflect.defineProperty : Object.defineProperty; @@ -67400,7 +65352,7 @@ module.exports = function defineProperty(obj, key, val) { /***/ }), -/* 596 */ +/* 590 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67419,7 +65371,7 @@ module.exports = function isObject(val) { /***/ }), -/* 597 */ +/* 591 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67432,9 +65384,9 @@ module.exports = function isObject(val) { -var typeOf = __webpack_require__(598); -var isAccessor = __webpack_require__(599); -var isData = __webpack_require__(600); +var typeOf = __webpack_require__(592); +var isAccessor = __webpack_require__(593); +var isData = __webpack_require__(594); module.exports = function isDescriptor(obj, key) { if (typeOf(obj) !== 'object') { @@ -67448,7 +65400,7 @@ module.exports = function isDescriptor(obj, key) { /***/ }), -/* 598 */ +/* 592 */ /***/ (function(module, exports) { var toString = Object.prototype.toString; @@ -67583,7 +65535,7 @@ function isBuffer(val) { /***/ }), -/* 599 */ +/* 593 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67596,7 +65548,7 @@ function isBuffer(val) { -var typeOf = __webpack_require__(598); +var typeOf = __webpack_require__(592); // accessor descriptor properties var accessor = { @@ -67659,7 +65611,7 @@ module.exports = isAccessorDescriptor; /***/ }), -/* 600 */ +/* 594 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67672,7 +65624,7 @@ module.exports = isAccessorDescriptor; -var typeOf = __webpack_require__(598); +var typeOf = __webpack_require__(592); module.exports = function isDataDescriptor(obj, prop) { // data descriptor properties @@ -67715,14 +65667,14 @@ module.exports = function isDataDescriptor(obj, prop) { /***/ }), -/* 601 */ +/* 595 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isExtendable = __webpack_require__(602); -var assignSymbols = __webpack_require__(604); +var isExtendable = __webpack_require__(596); +var assignSymbols = __webpack_require__(598); module.exports = Object.assign || function(obj/*, objects*/) { if (obj === null || typeof obj === 'undefined') { @@ -67782,7 +65734,7 @@ function isEnum(obj, key) { /***/ }), -/* 602 */ +/* 596 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67795,7 +65747,7 @@ function isEnum(obj, key) { -var isPlainObject = __webpack_require__(603); +var isPlainObject = __webpack_require__(597); module.exports = function isExtendable(val) { return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); @@ -67803,7 +65755,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 603 */ +/* 597 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67816,7 +65768,7 @@ module.exports = function isExtendable(val) { -var isObject = __webpack_require__(596); +var isObject = __webpack_require__(590); function isObjectObject(o) { return isObject(o) === true @@ -67847,7 +65799,7 @@ module.exports = function isPlainObject(o) { /***/ }), -/* 604 */ +/* 598 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67894,14 +65846,14 @@ module.exports = function(receiver, objects) { /***/ }), -/* 605 */ +/* 599 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var extend = __webpack_require__(606); -var safe = __webpack_require__(589); +var extend = __webpack_require__(600); +var safe = __webpack_require__(583); /** * The main export is a function that takes a `pattern` string and an `options` object. @@ -67973,14 +65925,14 @@ module.exports = toRegex; /***/ }), -/* 606 */ +/* 600 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isExtendable = __webpack_require__(607); -var assignSymbols = __webpack_require__(604); +var isExtendable = __webpack_require__(601); +var assignSymbols = __webpack_require__(598); module.exports = Object.assign || function(obj/*, objects*/) { if (obj === null || typeof obj === 'undefined') { @@ -68040,7 +65992,7 @@ function isEnum(obj, key) { /***/ }), -/* 607 */ +/* 601 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68053,7 +66005,7 @@ function isEnum(obj, key) { -var isPlainObject = __webpack_require__(603); +var isPlainObject = __webpack_require__(597); module.exports = function isExtendable(val) { return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); @@ -68061,7 +66013,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 608 */ +/* 602 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68111,13 +66063,13 @@ module.exports.immutable = function uniqueImmutable(arr) { /***/ }), -/* 609 */ +/* 603 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(610); +var isObject = __webpack_require__(604); module.exports = function extend(o/*, objects*/) { if (!isObject(o)) { o = {}; } @@ -68151,7 +66103,7 @@ function hasOwn(obj, key) { /***/ }), -/* 610 */ +/* 604 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68171,13 +66123,13 @@ module.exports = function isExtendable(val) { /***/ }), -/* 611 */ +/* 605 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var utils = __webpack_require__(612); +var utils = __webpack_require__(606); module.exports = function(braces, options) { braces.compiler @@ -68460,25 +66412,25 @@ function hasQueue(node) { /***/ }), -/* 612 */ +/* 606 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var splitString = __webpack_require__(613); +var splitString = __webpack_require__(607); var utils = module.exports; /** * Module dependencies */ -utils.extend = __webpack_require__(609); -utils.flatten = __webpack_require__(616); -utils.isObject = __webpack_require__(596); -utils.fillRange = __webpack_require__(617); -utils.repeat = __webpack_require__(625); -utils.unique = __webpack_require__(608); +utils.extend = __webpack_require__(603); +utils.flatten = __webpack_require__(610); +utils.isObject = __webpack_require__(590); +utils.fillRange = __webpack_require__(611); +utils.repeat = __webpack_require__(619); +utils.unique = __webpack_require__(602); utils.define = function(obj, key, val) { Object.defineProperty(obj, key, { @@ -68810,7 +66762,7 @@ utils.escapeRegex = function(str) { /***/ }), -/* 613 */ +/* 607 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68823,7 +66775,7 @@ utils.escapeRegex = function(str) { -var extend = __webpack_require__(614); +var extend = __webpack_require__(608); module.exports = function(str, options, fn) { if (typeof str !== 'string') { @@ -68988,14 +66940,14 @@ function keepEscaping(opts, str, idx) { /***/ }), -/* 614 */ +/* 608 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isExtendable = __webpack_require__(615); -var assignSymbols = __webpack_require__(604); +var isExtendable = __webpack_require__(609); +var assignSymbols = __webpack_require__(598); module.exports = Object.assign || function(obj/*, objects*/) { if (obj === null || typeof obj === 'undefined') { @@ -69055,7 +67007,7 @@ function isEnum(obj, key) { /***/ }), -/* 615 */ +/* 609 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69068,7 +67020,7 @@ function isEnum(obj, key) { -var isPlainObject = __webpack_require__(603); +var isPlainObject = __webpack_require__(597); module.exports = function isExtendable(val) { return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); @@ -69076,7 +67028,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 616 */ +/* 610 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69105,7 +67057,7 @@ function flat(arr, res) { /***/ }), -/* 617 */ +/* 611 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69119,10 +67071,10 @@ function flat(arr, res) { var util = __webpack_require__(113); -var isNumber = __webpack_require__(618); -var extend = __webpack_require__(621); -var repeat = __webpack_require__(623); -var toRegex = __webpack_require__(624); +var isNumber = __webpack_require__(612); +var extend = __webpack_require__(615); +var repeat = __webpack_require__(617); +var toRegex = __webpack_require__(618); /** * Return a range of numbers or letters. @@ -69320,7 +67272,7 @@ module.exports = fillRange; /***/ }), -/* 618 */ +/* 612 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69333,7 +67285,7 @@ module.exports = fillRange; -var typeOf = __webpack_require__(619); +var typeOf = __webpack_require__(613); module.exports = function isNumber(num) { var type = typeOf(num); @@ -69349,10 +67301,10 @@ module.exports = function isNumber(num) { /***/ }), -/* 619 */ +/* 613 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(620); +var isBuffer = __webpack_require__(614); var toString = Object.prototype.toString; /** @@ -69471,7 +67423,7 @@ module.exports = function kindOf(val) { /***/ }), -/* 620 */ +/* 614 */ /***/ (function(module, exports) { /*! @@ -69498,13 +67450,13 @@ function isSlowBuffer (obj) { /***/ }), -/* 621 */ +/* 615 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(622); +var isObject = __webpack_require__(616); module.exports = function extend(o/*, objects*/) { if (!isObject(o)) { o = {}; } @@ -69538,7 +67490,7 @@ function hasOwn(obj, key) { /***/ }), -/* 622 */ +/* 616 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69558,7 +67510,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 623 */ +/* 617 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69635,7 +67587,7 @@ function repeat(str, num) { /***/ }), -/* 624 */ +/* 618 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69648,8 +67600,8 @@ function repeat(str, num) { -var repeat = __webpack_require__(623); -var isNumber = __webpack_require__(618); +var repeat = __webpack_require__(617); +var isNumber = __webpack_require__(612); var cache = {}; function toRegexRange(min, max, options) { @@ -69936,7 +67888,7 @@ module.exports = toRegexRange; /***/ }), -/* 625 */ +/* 619 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69961,14 +67913,14 @@ module.exports = function repeat(ele, num) { /***/ }), -/* 626 */ +/* 620 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Node = __webpack_require__(627); -var utils = __webpack_require__(612); +var Node = __webpack_require__(621); +var utils = __webpack_require__(606); /** * Braces parsers @@ -70328,15 +68280,15 @@ function concatNodes(pos, node, parent, options) { /***/ }), -/* 627 */ +/* 621 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(596); -var define = __webpack_require__(628); -var utils = __webpack_require__(629); +var isObject = __webpack_require__(590); +var define = __webpack_require__(622); +var utils = __webpack_require__(623); var ownNames; /** @@ -70827,7 +68779,7 @@ exports = module.exports = Node; /***/ }), -/* 628 */ +/* 622 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -70840,7 +68792,7 @@ exports = module.exports = Node; -var isDescriptor = __webpack_require__(597); +var isDescriptor = __webpack_require__(591); module.exports = function defineProperty(obj, prop, val) { if (typeof obj !== 'object' && typeof obj !== 'function') { @@ -70865,13 +68817,13 @@ module.exports = function defineProperty(obj, prop, val) { /***/ }), -/* 629 */ +/* 623 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var typeOf = __webpack_require__(630); +var typeOf = __webpack_require__(624); var utils = module.exports; /** @@ -71891,10 +69843,10 @@ function assert(val, message) { /***/ }), -/* 630 */ +/* 624 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(620); +var isBuffer = __webpack_require__(614); var toString = Object.prototype.toString; /** @@ -72013,17 +69965,17 @@ module.exports = function kindOf(val) { /***/ }), -/* 631 */ +/* 625 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var extend = __webpack_require__(609); -var Snapdragon = __webpack_require__(632); -var compilers = __webpack_require__(611); -var parsers = __webpack_require__(626); -var utils = __webpack_require__(612); +var extend = __webpack_require__(603); +var Snapdragon = __webpack_require__(626); +var compilers = __webpack_require__(605); +var parsers = __webpack_require__(620); +var utils = __webpack_require__(606); /** * Customize Snapdragon parser and renderer @@ -72124,17 +70076,17 @@ module.exports = Braces; /***/ }), -/* 632 */ +/* 626 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Base = __webpack_require__(633); -var define = __webpack_require__(663); -var Compiler = __webpack_require__(674); -var Parser = __webpack_require__(697); -var utils = __webpack_require__(677); +var Base = __webpack_require__(627); +var define = __webpack_require__(657); +var Compiler = __webpack_require__(668); +var Parser = __webpack_require__(691); +var utils = __webpack_require__(671); var regexCache = {}; var cache = {}; @@ -72305,20 +70257,20 @@ module.exports.Parser = Parser; /***/ }), -/* 633 */ +/* 627 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var util = __webpack_require__(113); -var define = __webpack_require__(634); -var CacheBase = __webpack_require__(635); -var Emitter = __webpack_require__(636); -var isObject = __webpack_require__(596); -var merge = __webpack_require__(657); -var pascal = __webpack_require__(660); -var cu = __webpack_require__(661); +var define = __webpack_require__(628); +var CacheBase = __webpack_require__(629); +var Emitter = __webpack_require__(630); +var isObject = __webpack_require__(590); +var merge = __webpack_require__(651); +var pascal = __webpack_require__(654); +var cu = __webpack_require__(655); /** * Optionally define a custom `cache` namespace to use. @@ -72747,7 +70699,7 @@ module.exports.namespace = namespace; /***/ }), -/* 634 */ +/* 628 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72760,7 +70712,7 @@ module.exports.namespace = namespace; -var isDescriptor = __webpack_require__(597); +var isDescriptor = __webpack_require__(591); module.exports = function defineProperty(obj, prop, val) { if (typeof obj !== 'object' && typeof obj !== 'function') { @@ -72785,21 +70737,21 @@ module.exports = function defineProperty(obj, prop, val) { /***/ }), -/* 635 */ +/* 629 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(596); -var Emitter = __webpack_require__(636); -var visit = __webpack_require__(637); -var toPath = __webpack_require__(640); -var union = __webpack_require__(642); -var del = __webpack_require__(648); -var get = __webpack_require__(645); -var has = __webpack_require__(653); -var set = __webpack_require__(656); +var isObject = __webpack_require__(590); +var Emitter = __webpack_require__(630); +var visit = __webpack_require__(631); +var toPath = __webpack_require__(634); +var union = __webpack_require__(636); +var del = __webpack_require__(642); +var get = __webpack_require__(639); +var has = __webpack_require__(647); +var set = __webpack_require__(650); /** * Create a `Cache` constructor that when instantiated will @@ -73053,7 +71005,7 @@ module.exports.namespace = namespace; /***/ }), -/* 636 */ +/* 630 */ /***/ (function(module, exports, __webpack_require__) { @@ -73222,7 +71174,7 @@ Emitter.prototype.hasListeners = function(event){ /***/ }), -/* 637 */ +/* 631 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73235,8 +71187,8 @@ Emitter.prototype.hasListeners = function(event){ -var visit = __webpack_require__(638); -var mapVisit = __webpack_require__(639); +var visit = __webpack_require__(632); +var mapVisit = __webpack_require__(633); module.exports = function(collection, method, val) { var result; @@ -73259,7 +71211,7 @@ module.exports = function(collection, method, val) { /***/ }), -/* 638 */ +/* 632 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73272,7 +71224,7 @@ module.exports = function(collection, method, val) { -var isObject = __webpack_require__(596); +var isObject = __webpack_require__(590); module.exports = function visit(thisArg, method, target, val) { if (!isObject(thisArg) && typeof thisArg !== 'function') { @@ -73299,14 +71251,14 @@ module.exports = function visit(thisArg, method, target, val) { /***/ }), -/* 639 */ +/* 633 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var util = __webpack_require__(113); -var visit = __webpack_require__(638); +var visit = __webpack_require__(632); /** * Map `visit` over an array of objects. @@ -73343,7 +71295,7 @@ function isObject(val) { /***/ }), -/* 640 */ +/* 634 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73356,7 +71308,7 @@ function isObject(val) { -var typeOf = __webpack_require__(641); +var typeOf = __webpack_require__(635); module.exports = function toPath(args) { if (typeOf(args) !== 'arguments') { @@ -73383,10 +71335,10 @@ function filter(arr) { /***/ }), -/* 641 */ +/* 635 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(620); +var isBuffer = __webpack_require__(614); var toString = Object.prototype.toString; /** @@ -73505,16 +71457,16 @@ module.exports = function kindOf(val) { /***/ }), -/* 642 */ +/* 636 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(643); -var union = __webpack_require__(644); -var get = __webpack_require__(645); -var set = __webpack_require__(646); +var isObject = __webpack_require__(637); +var union = __webpack_require__(638); +var get = __webpack_require__(639); +var set = __webpack_require__(640); module.exports = function unionValue(obj, prop, value) { if (!isObject(obj)) { @@ -73542,7 +71494,7 @@ function arrayify(val) { /***/ }), -/* 643 */ +/* 637 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73562,7 +71514,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 644 */ +/* 638 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73598,7 +71550,7 @@ module.exports = function union(init) { /***/ }), -/* 645 */ +/* 639 */ /***/ (function(module, exports) { /*! @@ -73654,7 +71606,7 @@ function toString(val) { /***/ }), -/* 646 */ +/* 640 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73667,10 +71619,10 @@ function toString(val) { -var split = __webpack_require__(613); -var extend = __webpack_require__(647); -var isPlainObject = __webpack_require__(603); -var isObject = __webpack_require__(643); +var split = __webpack_require__(607); +var extend = __webpack_require__(641); +var isPlainObject = __webpack_require__(597); +var isObject = __webpack_require__(637); module.exports = function(obj, prop, val) { if (!isObject(obj)) { @@ -73716,13 +71668,13 @@ function isValidKey(key) { /***/ }), -/* 647 */ +/* 641 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isObject = __webpack_require__(643); +var isObject = __webpack_require__(637); module.exports = function extend(o/*, objects*/) { if (!isObject(o)) { o = {}; } @@ -73756,7 +71708,7 @@ function hasOwn(obj, key) { /***/ }), -/* 648 */ +/* 642 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73769,8 +71721,8 @@ function hasOwn(obj, key) { -var isObject = __webpack_require__(596); -var has = __webpack_require__(649); +var isObject = __webpack_require__(590); +var has = __webpack_require__(643); module.exports = function unset(obj, prop) { if (!isObject(obj)) { @@ -73795,7 +71747,7 @@ module.exports = function unset(obj, prop) { /***/ }), -/* 649 */ +/* 643 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73808,9 +71760,9 @@ module.exports = function unset(obj, prop) { -var isObject = __webpack_require__(650); -var hasValues = __webpack_require__(652); -var get = __webpack_require__(645); +var isObject = __webpack_require__(644); +var hasValues = __webpack_require__(646); +var get = __webpack_require__(639); module.exports = function(obj, prop, noZero) { if (isObject(obj)) { @@ -73821,7 +71773,7 @@ module.exports = function(obj, prop, noZero) { /***/ }), -/* 650 */ +/* 644 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73834,7 +71786,7 @@ module.exports = function(obj, prop, noZero) { -var isArray = __webpack_require__(651); +var isArray = __webpack_require__(645); module.exports = function isObject(val) { return val != null && typeof val === 'object' && isArray(val) === false; @@ -73842,7 +71794,7 @@ module.exports = function isObject(val) { /***/ }), -/* 651 */ +/* 645 */ /***/ (function(module, exports) { var toString = {}.toString; @@ -73853,7 +71805,7 @@ module.exports = Array.isArray || function (arr) { /***/ }), -/* 652 */ +/* 646 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73896,7 +71848,7 @@ module.exports = function hasValue(o, noZero) { /***/ }), -/* 653 */ +/* 647 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73909,9 +71861,9 @@ module.exports = function hasValue(o, noZero) { -var isObject = __webpack_require__(596); -var hasValues = __webpack_require__(654); -var get = __webpack_require__(645); +var isObject = __webpack_require__(590); +var hasValues = __webpack_require__(648); +var get = __webpack_require__(639); module.exports = function(val, prop) { return hasValues(isObject(val) && prop ? get(val, prop) : val); @@ -73919,7 +71871,7 @@ module.exports = function(val, prop) { /***/ }), -/* 654 */ +/* 648 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73932,8 +71884,8 @@ module.exports = function(val, prop) { -var typeOf = __webpack_require__(655); -var isNumber = __webpack_require__(618); +var typeOf = __webpack_require__(649); +var isNumber = __webpack_require__(612); module.exports = function hasValue(val) { // is-number checks for NaN and other edge cases @@ -73986,10 +71938,10 @@ module.exports = function hasValue(val) { /***/ }), -/* 655 */ +/* 649 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(620); +var isBuffer = __webpack_require__(614); var toString = Object.prototype.toString; /** @@ -74111,7 +72063,7 @@ module.exports = function kindOf(val) { /***/ }), -/* 656 */ +/* 650 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74124,10 +72076,10 @@ module.exports = function kindOf(val) { -var split = __webpack_require__(613); -var extend = __webpack_require__(647); -var isPlainObject = __webpack_require__(603); -var isObject = __webpack_require__(643); +var split = __webpack_require__(607); +var extend = __webpack_require__(641); +var isPlainObject = __webpack_require__(597); +var isObject = __webpack_require__(637); module.exports = function(obj, prop, val) { if (!isObject(obj)) { @@ -74173,14 +72125,14 @@ function isValidKey(key) { /***/ }), -/* 657 */ +/* 651 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isExtendable = __webpack_require__(658); -var forIn = __webpack_require__(659); +var isExtendable = __webpack_require__(652); +var forIn = __webpack_require__(653); function mixinDeep(target, objects) { var len = arguments.length, i = 0; @@ -74244,7 +72196,7 @@ module.exports = mixinDeep; /***/ }), -/* 658 */ +/* 652 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74257,7 +72209,7 @@ module.exports = mixinDeep; -var isPlainObject = __webpack_require__(603); +var isPlainObject = __webpack_require__(597); module.exports = function isExtendable(val) { return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); @@ -74265,7 +72217,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 659 */ +/* 653 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74288,7 +72240,7 @@ module.exports = function forIn(obj, fn, thisArg) { /***/ }), -/* 660 */ +/* 654 */ /***/ (function(module, exports) { /*! @@ -74315,14 +72267,14 @@ module.exports = pascalcase; /***/ }), -/* 661 */ +/* 655 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var util = __webpack_require__(113); -var utils = __webpack_require__(662); +var utils = __webpack_require__(656); /** * Expose class utils @@ -74687,7 +72639,7 @@ cu.bubble = function(Parent, events) { /***/ }), -/* 662 */ +/* 656 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74701,10 +72653,10 @@ var utils = {}; * Lazily required module dependencies */ -utils.union = __webpack_require__(644); -utils.define = __webpack_require__(663); -utils.isObj = __webpack_require__(596); -utils.staticExtend = __webpack_require__(670); +utils.union = __webpack_require__(638); +utils.define = __webpack_require__(657); +utils.isObj = __webpack_require__(590); +utils.staticExtend = __webpack_require__(664); /** @@ -74715,7 +72667,7 @@ module.exports = utils; /***/ }), -/* 663 */ +/* 657 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74728,7 +72680,7 @@ module.exports = utils; -var isDescriptor = __webpack_require__(664); +var isDescriptor = __webpack_require__(658); module.exports = function defineProperty(obj, prop, val) { if (typeof obj !== 'object' && typeof obj !== 'function') { @@ -74753,7 +72705,7 @@ module.exports = function defineProperty(obj, prop, val) { /***/ }), -/* 664 */ +/* 658 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74766,9 +72718,9 @@ module.exports = function defineProperty(obj, prop, val) { -var typeOf = __webpack_require__(665); -var isAccessor = __webpack_require__(666); -var isData = __webpack_require__(668); +var typeOf = __webpack_require__(659); +var isAccessor = __webpack_require__(660); +var isData = __webpack_require__(662); module.exports = function isDescriptor(obj, key) { if (typeOf(obj) !== 'object') { @@ -74782,7 +72734,7 @@ module.exports = function isDescriptor(obj, key) { /***/ }), -/* 665 */ +/* 659 */ /***/ (function(module, exports) { var toString = Object.prototype.toString; @@ -74935,7 +72887,7 @@ function isBuffer(val) { /***/ }), -/* 666 */ +/* 660 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74948,7 +72900,7 @@ function isBuffer(val) { -var typeOf = __webpack_require__(667); +var typeOf = __webpack_require__(661); // accessor descriptor properties var accessor = { @@ -75011,10 +72963,10 @@ module.exports = isAccessorDescriptor; /***/ }), -/* 667 */ +/* 661 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(620); +var isBuffer = __webpack_require__(614); var toString = Object.prototype.toString; /** @@ -75133,7 +73085,7 @@ module.exports = function kindOf(val) { /***/ }), -/* 668 */ +/* 662 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75146,7 +73098,7 @@ module.exports = function kindOf(val) { -var typeOf = __webpack_require__(669); +var typeOf = __webpack_require__(663); // data descriptor properties var data = { @@ -75195,10 +73147,10 @@ module.exports = isDataDescriptor; /***/ }), -/* 669 */ +/* 663 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(620); +var isBuffer = __webpack_require__(614); var toString = Object.prototype.toString; /** @@ -75317,7 +73269,7 @@ module.exports = function kindOf(val) { /***/ }), -/* 670 */ +/* 664 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75330,8 +73282,8 @@ module.exports = function kindOf(val) { -var copy = __webpack_require__(671); -var define = __webpack_require__(663); +var copy = __webpack_require__(665); +var define = __webpack_require__(657); var util = __webpack_require__(113); /** @@ -75414,15 +73366,15 @@ module.exports = extend; /***/ }), -/* 671 */ +/* 665 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var typeOf = __webpack_require__(672); -var copyDescriptor = __webpack_require__(673); -var define = __webpack_require__(663); +var typeOf = __webpack_require__(666); +var copyDescriptor = __webpack_require__(667); +var define = __webpack_require__(657); /** * Copy static properties, prototype properties, and descriptors from one object to another. @@ -75595,10 +73547,10 @@ module.exports.has = has; /***/ }), -/* 672 */ +/* 666 */ /***/ (function(module, exports, __webpack_require__) { -var isBuffer = __webpack_require__(620); +var isBuffer = __webpack_require__(614); var toString = Object.prototype.toString; /** @@ -75717,7 +73669,7 @@ module.exports = function kindOf(val) { /***/ }), -/* 673 */ +/* 667 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75805,16 +73757,16 @@ function isObject(val) { /***/ }), -/* 674 */ +/* 668 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var use = __webpack_require__(675); -var define = __webpack_require__(663); +var use = __webpack_require__(669); +var define = __webpack_require__(657); var debug = __webpack_require__(205)('snapdragon:compiler'); -var utils = __webpack_require__(677); +var utils = __webpack_require__(671); /** * Create a new `Compiler` with the given `options`. @@ -75968,7 +73920,7 @@ Compiler.prototype = { // source map support if (opts.sourcemap) { - var sourcemaps = __webpack_require__(696); + var sourcemaps = __webpack_require__(690); sourcemaps(this); this.mapVisit(this.ast.nodes); this.applySourceMaps(); @@ -75989,7 +73941,7 @@ module.exports = Compiler; /***/ }), -/* 675 */ +/* 669 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76002,7 +73954,7 @@ module.exports = Compiler; -var utils = __webpack_require__(676); +var utils = __webpack_require__(670); module.exports = function base(app, opts) { if (!utils.isObject(app) && typeof app !== 'function') { @@ -76117,7 +74069,7 @@ module.exports = function base(app, opts) { /***/ }), -/* 676 */ +/* 670 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76131,8 +74083,8 @@ var utils = {}; * Lazily required module dependencies */ -utils.define = __webpack_require__(663); -utils.isObject = __webpack_require__(596); +utils.define = __webpack_require__(657); +utils.isObject = __webpack_require__(590); utils.isString = function(val) { @@ -76147,7 +74099,7 @@ module.exports = utils; /***/ }), -/* 677 */ +/* 671 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76157,9 +74109,9 @@ module.exports = utils; * Module dependencies */ -exports.extend = __webpack_require__(647); -exports.SourceMap = __webpack_require__(678); -exports.sourceMapResolve = __webpack_require__(689); +exports.extend = __webpack_require__(641); +exports.SourceMap = __webpack_require__(672); +exports.sourceMapResolve = __webpack_require__(683); /** * Convert backslash in the given string to forward slashes @@ -76202,7 +74154,7 @@ exports.last = function(arr, n) { /***/ }), -/* 678 */ +/* 672 */ /***/ (function(module, exports, __webpack_require__) { /* @@ -76210,13 +74162,13 @@ exports.last = function(arr, n) { * Licensed under the New BSD license. See LICENSE.txt or: * http://opensource.org/licenses/BSD-3-Clause */ -exports.SourceMapGenerator = __webpack_require__(679).SourceMapGenerator; -exports.SourceMapConsumer = __webpack_require__(685).SourceMapConsumer; -exports.SourceNode = __webpack_require__(688).SourceNode; +exports.SourceMapGenerator = __webpack_require__(673).SourceMapGenerator; +exports.SourceMapConsumer = __webpack_require__(679).SourceMapConsumer; +exports.SourceNode = __webpack_require__(682).SourceNode; /***/ }), -/* 679 */ +/* 673 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -76226,10 +74178,10 @@ exports.SourceNode = __webpack_require__(688).SourceNode; * http://opensource.org/licenses/BSD-3-Clause */ -var base64VLQ = __webpack_require__(680); -var util = __webpack_require__(682); -var ArraySet = __webpack_require__(683).ArraySet; -var MappingList = __webpack_require__(684).MappingList; +var base64VLQ = __webpack_require__(674); +var util = __webpack_require__(676); +var ArraySet = __webpack_require__(677).ArraySet; +var MappingList = __webpack_require__(678).MappingList; /** * An instance of the SourceMapGenerator represents a source map which is @@ -76638,7 +74590,7 @@ exports.SourceMapGenerator = SourceMapGenerator; /***/ }), -/* 680 */ +/* 674 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -76678,7 +74630,7 @@ exports.SourceMapGenerator = SourceMapGenerator; * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -var base64 = __webpack_require__(681); +var base64 = __webpack_require__(675); // A single base 64 digit can contain 6 bits of data. For the base 64 variable // length quantities we use in the source map spec, the first bit is the sign, @@ -76784,7 +74736,7 @@ exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { /***/ }), -/* 681 */ +/* 675 */ /***/ (function(module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -76857,7 +74809,7 @@ exports.decode = function (charCode) { /***/ }), -/* 682 */ +/* 676 */ /***/ (function(module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -77280,7 +75232,7 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate /***/ }), -/* 683 */ +/* 677 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -77290,7 +75242,7 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate * http://opensource.org/licenses/BSD-3-Clause */ -var util = __webpack_require__(682); +var util = __webpack_require__(676); var has = Object.prototype.hasOwnProperty; var hasNativeMap = typeof Map !== "undefined"; @@ -77407,7 +75359,7 @@ exports.ArraySet = ArraySet; /***/ }), -/* 684 */ +/* 678 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -77417,7 +75369,7 @@ exports.ArraySet = ArraySet; * http://opensource.org/licenses/BSD-3-Clause */ -var util = __webpack_require__(682); +var util = __webpack_require__(676); /** * Determine whether mappingB is after mappingA with respect to generated @@ -77492,7 +75444,7 @@ exports.MappingList = MappingList; /***/ }), -/* 685 */ +/* 679 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -77502,11 +75454,11 @@ exports.MappingList = MappingList; * http://opensource.org/licenses/BSD-3-Clause */ -var util = __webpack_require__(682); -var binarySearch = __webpack_require__(686); -var ArraySet = __webpack_require__(683).ArraySet; -var base64VLQ = __webpack_require__(680); -var quickSort = __webpack_require__(687).quickSort; +var util = __webpack_require__(676); +var binarySearch = __webpack_require__(680); +var ArraySet = __webpack_require__(677).ArraySet; +var base64VLQ = __webpack_require__(674); +var quickSort = __webpack_require__(681).quickSort; function SourceMapConsumer(aSourceMap) { var sourceMap = aSourceMap; @@ -78580,7 +76532,7 @@ exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; /***/ }), -/* 686 */ +/* 680 */ /***/ (function(module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -78697,7 +76649,7 @@ exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { /***/ }), -/* 687 */ +/* 681 */ /***/ (function(module, exports) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -78817,7 +76769,7 @@ exports.quickSort = function (ary, comparator) { /***/ }), -/* 688 */ +/* 682 */ /***/ (function(module, exports, __webpack_require__) { /* -*- Mode: js; js-indent-level: 2; -*- */ @@ -78827,8 +76779,8 @@ exports.quickSort = function (ary, comparator) { * http://opensource.org/licenses/BSD-3-Clause */ -var SourceMapGenerator = __webpack_require__(679).SourceMapGenerator; -var util = __webpack_require__(682); +var SourceMapGenerator = __webpack_require__(673).SourceMapGenerator; +var util = __webpack_require__(676); // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other // operating systems these days (capturing the result). @@ -79236,17 +77188,17 @@ exports.SourceNode = SourceNode; /***/ }), -/* 689 */ +/* 683 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2014, 2015, 2016, 2017 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) -var sourceMappingURL = __webpack_require__(690) -var resolveUrl = __webpack_require__(691) -var decodeUriComponent = __webpack_require__(692) -var urix = __webpack_require__(694) -var atob = __webpack_require__(695) +var sourceMappingURL = __webpack_require__(684) +var resolveUrl = __webpack_require__(685) +var decodeUriComponent = __webpack_require__(686) +var urix = __webpack_require__(688) +var atob = __webpack_require__(689) @@ -79544,7 +77496,7 @@ module.exports = { /***/ }), -/* 690 */ +/* 684 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright 2014 Simon Lydell @@ -79607,7 +77559,7 @@ void (function(root, factory) { /***/ }), -/* 691 */ +/* 685 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2014 Simon Lydell @@ -79625,13 +77577,13 @@ module.exports = resolveUrl /***/ }), -/* 692 */ +/* 686 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2017 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) -var decodeUriComponent = __webpack_require__(693) +var decodeUriComponent = __webpack_require__(687) function customDecodeUriComponent(string) { // `decodeUriComponent` turns `+` into ` `, but that's not wanted. @@ -79642,7 +77594,7 @@ module.exports = customDecodeUriComponent /***/ }), -/* 693 */ +/* 687 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79743,7 +77695,7 @@ module.exports = function (encodedURI) { /***/ }), -/* 694 */ +/* 688 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2014 Simon Lydell @@ -79766,7 +77718,7 @@ module.exports = urix /***/ }), -/* 695 */ +/* 689 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79780,7 +77732,7 @@ module.exports = atob.atob = atob; /***/ }), -/* 696 */ +/* 690 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79788,8 +77740,8 @@ module.exports = atob.atob = atob; var fs = __webpack_require__(132); var path = __webpack_require__(4); -var define = __webpack_require__(663); -var utils = __webpack_require__(677); +var define = __webpack_require__(657); +var utils = __webpack_require__(671); /** * Expose `mixin()`. @@ -79932,19 +77884,19 @@ exports.comment = function(node) { /***/ }), -/* 697 */ +/* 691 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var use = __webpack_require__(675); +var use = __webpack_require__(669); var util = __webpack_require__(113); -var Cache = __webpack_require__(698); -var define = __webpack_require__(663); +var Cache = __webpack_require__(692); +var define = __webpack_require__(657); var debug = __webpack_require__(205)('snapdragon:parser'); -var Position = __webpack_require__(699); -var utils = __webpack_require__(677); +var Position = __webpack_require__(693); +var utils = __webpack_require__(671); /** * Create a new `Parser` with the given `input` and `options`. @@ -80472,7 +78424,7 @@ module.exports = Parser; /***/ }), -/* 698 */ +/* 692 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80579,13 +78531,13 @@ MapCache.prototype.del = function mapDelete(key) { /***/ }), -/* 699 */ +/* 693 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var define = __webpack_require__(663); +var define = __webpack_require__(657); /** * Store position for a node @@ -80600,14 +78552,14 @@ module.exports = function Position(start, parser) { /***/ }), -/* 700 */ +/* 694 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isExtendable = __webpack_require__(701); -var assignSymbols = __webpack_require__(604); +var isExtendable = __webpack_require__(695); +var assignSymbols = __webpack_require__(598); module.exports = Object.assign || function(obj/*, objects*/) { if (obj === null || typeof obj === 'undefined') { @@ -80667,7 +78619,7 @@ function isEnum(obj, key) { /***/ }), -/* 701 */ +/* 695 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80680,7 +78632,7 @@ function isEnum(obj, key) { -var isPlainObject = __webpack_require__(603); +var isPlainObject = __webpack_require__(597); module.exports = function isExtendable(val) { return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); @@ -80688,14 +78640,14 @@ module.exports = function isExtendable(val) { /***/ }), -/* 702 */ +/* 696 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var nanomatch = __webpack_require__(703); -var extglob = __webpack_require__(717); +var nanomatch = __webpack_require__(697); +var extglob = __webpack_require__(711); module.exports = function(snapdragon) { var compilers = snapdragon.compiler.compilers; @@ -80772,7 +78724,7 @@ function escapeExtglobs(compiler) { /***/ }), -/* 703 */ +/* 697 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80783,17 +78735,17 @@ function escapeExtglobs(compiler) { */ var util = __webpack_require__(113); -var toRegex = __webpack_require__(588); -var extend = __webpack_require__(704); +var toRegex = __webpack_require__(582); +var extend = __webpack_require__(698); /** * Local dependencies */ -var compilers = __webpack_require__(706); -var parsers = __webpack_require__(707); -var cache = __webpack_require__(710); -var utils = __webpack_require__(712); +var compilers = __webpack_require__(700); +var parsers = __webpack_require__(701); +var cache = __webpack_require__(704); +var utils = __webpack_require__(706); var MAX_LENGTH = 1024 * 64; /** @@ -81617,14 +79569,14 @@ module.exports = nanomatch; /***/ }), -/* 704 */ +/* 698 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isExtendable = __webpack_require__(705); -var assignSymbols = __webpack_require__(604); +var isExtendable = __webpack_require__(699); +var assignSymbols = __webpack_require__(598); module.exports = Object.assign || function(obj/*, objects*/) { if (obj === null || typeof obj === 'undefined') { @@ -81684,7 +79636,7 @@ function isEnum(obj, key) { /***/ }), -/* 705 */ +/* 699 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -81697,7 +79649,7 @@ function isEnum(obj, key) { -var isPlainObject = __webpack_require__(603); +var isPlainObject = __webpack_require__(597); module.exports = function isExtendable(val) { return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); @@ -81705,7 +79657,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 706 */ +/* 700 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -82051,15 +80003,15 @@ module.exports = function(nanomatch, options) { /***/ }), -/* 707 */ +/* 701 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var regexNot = __webpack_require__(605); -var toRegex = __webpack_require__(588); -var isOdd = __webpack_require__(708); +var regexNot = __webpack_require__(599); +var toRegex = __webpack_require__(582); +var isOdd = __webpack_require__(702); /** * Characters to use in negation regex (we want to "not" match @@ -82445,7 +80397,7 @@ module.exports.not = NOT_REGEX; /***/ }), -/* 708 */ +/* 702 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -82458,7 +80410,7 @@ module.exports.not = NOT_REGEX; -var isNumber = __webpack_require__(709); +var isNumber = __webpack_require__(703); module.exports = function isOdd(i) { if (!isNumber(i)) { @@ -82472,7 +80424,7 @@ module.exports = function isOdd(i) { /***/ }), -/* 709 */ +/* 703 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -82500,14 +80452,14 @@ module.exports = function isNumber(num) { /***/ }), -/* 710 */ +/* 704 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = new (__webpack_require__(711))(); +module.exports = new (__webpack_require__(705))(); /***/ }), -/* 711 */ +/* 705 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -82520,7 +80472,7 @@ module.exports = new (__webpack_require__(711))(); -var MapCache = __webpack_require__(698); +var MapCache = __webpack_require__(692); /** * Create a new `FragmentCache` with an optional object to use for `caches`. @@ -82642,7 +80594,7 @@ exports = module.exports = FragmentCache; /***/ }), -/* 712 */ +/* 706 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -82655,14 +80607,14 @@ var path = __webpack_require__(4); * Module dependencies */ -var isWindows = __webpack_require__(713)(); -var Snapdragon = __webpack_require__(632); -utils.define = __webpack_require__(714); -utils.diff = __webpack_require__(715); -utils.extend = __webpack_require__(704); -utils.pick = __webpack_require__(716); -utils.typeOf = __webpack_require__(598); -utils.unique = __webpack_require__(608); +var isWindows = __webpack_require__(707)(); +var Snapdragon = __webpack_require__(626); +utils.define = __webpack_require__(708); +utils.diff = __webpack_require__(709); +utils.extend = __webpack_require__(698); +utils.pick = __webpack_require__(710); +utils.typeOf = __webpack_require__(592); +utils.unique = __webpack_require__(602); /** * Returns true if the given value is effectively an empty string @@ -83028,7 +80980,7 @@ utils.unixify = function(options) { /***/ }), -/* 713 */ +/* 707 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @@ -83056,7 +81008,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ /***/ }), -/* 714 */ +/* 708 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83069,8 +81021,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ -var isobject = __webpack_require__(596); -var isDescriptor = __webpack_require__(597); +var isobject = __webpack_require__(590); +var isDescriptor = __webpack_require__(591); var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty) ? Reflect.defineProperty : Object.defineProperty; @@ -83101,7 +81053,7 @@ module.exports = function defineProperty(obj, key, val) { /***/ }), -/* 715 */ +/* 709 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83155,7 +81107,7 @@ function diffArray(one, two) { /***/ }), -/* 716 */ +/* 710 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83168,7 +81120,7 @@ function diffArray(one, two) { -var isObject = __webpack_require__(596); +var isObject = __webpack_require__(590); module.exports = function pick(obj, keys) { if (!isObject(obj) && typeof obj !== 'function') { @@ -83197,7 +81149,7 @@ module.exports = function pick(obj, keys) { /***/ }), -/* 717 */ +/* 711 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83207,18 +81159,18 @@ module.exports = function pick(obj, keys) { * Module dependencies */ -var extend = __webpack_require__(647); -var unique = __webpack_require__(608); -var toRegex = __webpack_require__(588); +var extend = __webpack_require__(641); +var unique = __webpack_require__(602); +var toRegex = __webpack_require__(582); /** * Local dependencies */ -var compilers = __webpack_require__(718); -var parsers = __webpack_require__(724); -var Extglob = __webpack_require__(727); -var utils = __webpack_require__(726); +var compilers = __webpack_require__(712); +var parsers = __webpack_require__(718); +var Extglob = __webpack_require__(721); +var utils = __webpack_require__(720); var MAX_LENGTH = 1024 * 64; /** @@ -83535,13 +81487,13 @@ module.exports = extglob; /***/ }), -/* 718 */ +/* 712 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var brackets = __webpack_require__(719); +var brackets = __webpack_require__(713); /** * Extglob compilers @@ -83711,7 +81663,7 @@ module.exports = function(extglob) { /***/ }), -/* 719 */ +/* 713 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83721,17 +81673,17 @@ module.exports = function(extglob) { * Local dependencies */ -var compilers = __webpack_require__(720); -var parsers = __webpack_require__(722); +var compilers = __webpack_require__(714); +var parsers = __webpack_require__(716); /** * Module dependencies */ var debug = __webpack_require__(205)('expand-brackets'); -var extend = __webpack_require__(647); -var Snapdragon = __webpack_require__(632); -var toRegex = __webpack_require__(588); +var extend = __webpack_require__(641); +var Snapdragon = __webpack_require__(626); +var toRegex = __webpack_require__(582); /** * Parses the given POSIX character class `pattern` and returns a @@ -83929,13 +81881,13 @@ module.exports = brackets; /***/ }), -/* 720 */ +/* 714 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var posix = __webpack_require__(721); +var posix = __webpack_require__(715); module.exports = function(brackets) { brackets.compiler @@ -84023,7 +81975,7 @@ module.exports = function(brackets) { /***/ }), -/* 721 */ +/* 715 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -84052,14 +82004,14 @@ module.exports = { /***/ }), -/* 722 */ +/* 716 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var utils = __webpack_require__(723); -var define = __webpack_require__(663); +var utils = __webpack_require__(717); +var define = __webpack_require__(657); /** * Text regex @@ -84278,14 +82230,14 @@ module.exports.TEXT_REGEX = TEXT_REGEX; /***/ }), -/* 723 */ +/* 717 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var toRegex = __webpack_require__(588); -var regexNot = __webpack_require__(605); +var toRegex = __webpack_require__(582); +var regexNot = __webpack_require__(599); var cached; /** @@ -84319,15 +82271,15 @@ exports.createRegex = function(pattern, include) { /***/ }), -/* 724 */ +/* 718 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var brackets = __webpack_require__(719); -var define = __webpack_require__(725); -var utils = __webpack_require__(726); +var brackets = __webpack_require__(713); +var define = __webpack_require__(719); +var utils = __webpack_require__(720); /** * Characters to use in text regex (we want to "not" match @@ -84482,7 +82434,7 @@ module.exports = parsers; /***/ }), -/* 725 */ +/* 719 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -84495,7 +82447,7 @@ module.exports = parsers; -var isDescriptor = __webpack_require__(597); +var isDescriptor = __webpack_require__(591); module.exports = function defineProperty(obj, prop, val) { if (typeof obj !== 'object' && typeof obj !== 'function') { @@ -84520,14 +82472,14 @@ module.exports = function defineProperty(obj, prop, val) { /***/ }), -/* 726 */ +/* 720 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var regex = __webpack_require__(605); -var Cache = __webpack_require__(711); +var regex = __webpack_require__(599); +var Cache = __webpack_require__(705); /** * Utils @@ -84596,7 +82548,7 @@ utils.createRegex = function(str) { /***/ }), -/* 727 */ +/* 721 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -84606,16 +82558,16 @@ utils.createRegex = function(str) { * Module dependencies */ -var Snapdragon = __webpack_require__(632); -var define = __webpack_require__(725); -var extend = __webpack_require__(647); +var Snapdragon = __webpack_require__(626); +var define = __webpack_require__(719); +var extend = __webpack_require__(641); /** * Local dependencies */ -var compilers = __webpack_require__(718); -var parsers = __webpack_require__(724); +var compilers = __webpack_require__(712); +var parsers = __webpack_require__(718); /** * Customize Snapdragon parser and renderer @@ -84681,16 +82633,16 @@ module.exports = Extglob; /***/ }), -/* 728 */ +/* 722 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var extglob = __webpack_require__(717); -var nanomatch = __webpack_require__(703); -var regexNot = __webpack_require__(605); -var toRegex = __webpack_require__(588); +var extglob = __webpack_require__(711); +var nanomatch = __webpack_require__(697); +var regexNot = __webpack_require__(599); +var toRegex = __webpack_require__(582); var not; /** @@ -84771,14 +82723,14 @@ function textRegex(pattern) { /***/ }), -/* 729 */ +/* 723 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = new (__webpack_require__(711))(); +module.exports = new (__webpack_require__(705))(); /***/ }), -/* 730 */ +/* 724 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -84791,13 +82743,13 @@ var path = __webpack_require__(4); * Module dependencies */ -var Snapdragon = __webpack_require__(632); -utils.define = __webpack_require__(731); -utils.diff = __webpack_require__(715); -utils.extend = __webpack_require__(700); -utils.pick = __webpack_require__(716); -utils.typeOf = __webpack_require__(598); -utils.unique = __webpack_require__(608); +var Snapdragon = __webpack_require__(626); +utils.define = __webpack_require__(725); +utils.diff = __webpack_require__(709); +utils.extend = __webpack_require__(694); +utils.pick = __webpack_require__(710); +utils.typeOf = __webpack_require__(592); +utils.unique = __webpack_require__(602); /** * Returns true if the platform is windows, or `path.sep` is `\\`. @@ -85094,7 +83046,7 @@ utils.unixify = function(options) { /***/ }), -/* 731 */ +/* 725 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85107,8 +83059,8 @@ utils.unixify = function(options) { -var isobject = __webpack_require__(596); -var isDescriptor = __webpack_require__(597); +var isobject = __webpack_require__(590); +var isDescriptor = __webpack_require__(591); var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty) ? Reflect.defineProperty : Object.defineProperty; @@ -85139,7 +83091,7 @@ module.exports = function defineProperty(obj, key, val) { /***/ }), -/* 732 */ +/* 726 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85158,9 +83110,9 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var readdir = __webpack_require__(733); -var reader_1 = __webpack_require__(746); -var fs_stream_1 = __webpack_require__(750); +var readdir = __webpack_require__(727); +var reader_1 = __webpack_require__(740); +var fs_stream_1 = __webpack_require__(744); var ReaderAsync = /** @class */ (function (_super) { __extends(ReaderAsync, _super); function ReaderAsync() { @@ -85221,15 +83173,15 @@ exports.default = ReaderAsync; /***/ }), -/* 733 */ +/* 727 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const readdirSync = __webpack_require__(734); -const readdirAsync = __webpack_require__(742); -const readdirStream = __webpack_require__(745); +const readdirSync = __webpack_require__(728); +const readdirAsync = __webpack_require__(736); +const readdirStream = __webpack_require__(739); module.exports = exports = readdirAsyncPath; exports.readdir = exports.readdirAsync = exports.async = readdirAsyncPath; @@ -85313,7 +83265,7 @@ function readdirStreamStat (dir, options) { /***/ }), -/* 734 */ +/* 728 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85321,11 +83273,11 @@ function readdirStreamStat (dir, options) { module.exports = readdirSync; -const DirectoryReader = __webpack_require__(735); +const DirectoryReader = __webpack_require__(729); let syncFacade = { - fs: __webpack_require__(740), - forEach: __webpack_require__(741), + fs: __webpack_require__(734), + forEach: __webpack_require__(735), sync: true }; @@ -85354,7 +83306,7 @@ function readdirSync (dir, options, internalOptions) { /***/ }), -/* 735 */ +/* 729 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85363,9 +83315,9 @@ function readdirSync (dir, options, internalOptions) { const Readable = __webpack_require__(173).Readable; const EventEmitter = __webpack_require__(164).EventEmitter; const path = __webpack_require__(4); -const normalizeOptions = __webpack_require__(736); -const stat = __webpack_require__(738); -const call = __webpack_require__(739); +const normalizeOptions = __webpack_require__(730); +const stat = __webpack_require__(732); +const call = __webpack_require__(733); /** * Asynchronously reads the contents of a directory and streams the results @@ -85741,14 +83693,14 @@ module.exports = DirectoryReader; /***/ }), -/* 736 */ +/* 730 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const globToRegExp = __webpack_require__(737); +const globToRegExp = __webpack_require__(731); module.exports = normalizeOptions; @@ -85925,7 +83877,7 @@ function normalizeOptions (options, internalOptions) { /***/ }), -/* 737 */ +/* 731 */ /***/ (function(module, exports) { module.exports = function (glob, opts) { @@ -86062,13 +84014,13 @@ module.exports = function (glob, opts) { /***/ }), -/* 738 */ +/* 732 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const call = __webpack_require__(739); +const call = __webpack_require__(733); module.exports = stat; @@ -86143,7 +84095,7 @@ function symlinkStat (fs, path, lstats, callback) { /***/ }), -/* 739 */ +/* 733 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86204,14 +84156,14 @@ function callOnce (fn) { /***/ }), -/* 740 */ +/* 734 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const fs = __webpack_require__(132); -const call = __webpack_require__(739); +const call = __webpack_require__(733); /** * A facade around {@link fs.readdirSync} that allows it to be called @@ -86275,7 +84227,7 @@ exports.lstat = function (path, callback) { /***/ }), -/* 741 */ +/* 735 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86304,7 +84256,7 @@ function syncForEach (array, iterator, done) { /***/ }), -/* 742 */ +/* 736 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86312,12 +84264,12 @@ function syncForEach (array, iterator, done) { module.exports = readdirAsync; -const maybe = __webpack_require__(743); -const DirectoryReader = __webpack_require__(735); +const maybe = __webpack_require__(737); +const DirectoryReader = __webpack_require__(729); let asyncFacade = { fs: __webpack_require__(132), - forEach: __webpack_require__(744), + forEach: __webpack_require__(738), async: true }; @@ -86359,7 +84311,7 @@ function readdirAsync (dir, options, callback, internalOptions) { /***/ }), -/* 743 */ +/* 737 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86386,7 +84338,7 @@ module.exports = function maybe (cb, promise) { /***/ }), -/* 744 */ +/* 738 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86422,7 +84374,7 @@ function asyncForEach (array, iterator, done) { /***/ }), -/* 745 */ +/* 739 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86430,11 +84382,11 @@ function asyncForEach (array, iterator, done) { module.exports = readdirStream; -const DirectoryReader = __webpack_require__(735); +const DirectoryReader = __webpack_require__(729); let streamFacade = { fs: __webpack_require__(132), - forEach: __webpack_require__(744), + forEach: __webpack_require__(738), async: true }; @@ -86454,16 +84406,16 @@ function readdirStream (dir, options, internalOptions) { /***/ }), -/* 746 */ +/* 740 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var path = __webpack_require__(4); -var deep_1 = __webpack_require__(747); -var entry_1 = __webpack_require__(749); -var pathUtil = __webpack_require__(748); +var deep_1 = __webpack_require__(741); +var entry_1 = __webpack_require__(743); +var pathUtil = __webpack_require__(742); var Reader = /** @class */ (function () { function Reader(options) { this.options = options; @@ -86529,14 +84481,14 @@ exports.default = Reader; /***/ }), -/* 747 */ +/* 741 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var pathUtils = __webpack_require__(748); -var patternUtils = __webpack_require__(582); +var pathUtils = __webpack_require__(742); +var patternUtils = __webpack_require__(576); var DeepFilter = /** @class */ (function () { function DeepFilter(options, micromatchOptions) { this.options = options; @@ -86619,7 +84571,7 @@ exports.default = DeepFilter; /***/ }), -/* 748 */ +/* 742 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86650,14 +84602,14 @@ exports.makeAbsolute = makeAbsolute; /***/ }), -/* 749 */ +/* 743 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var pathUtils = __webpack_require__(748); -var patternUtils = __webpack_require__(582); +var pathUtils = __webpack_require__(742); +var patternUtils = __webpack_require__(576); var EntryFilter = /** @class */ (function () { function EntryFilter(options, micromatchOptions) { this.options = options; @@ -86742,7 +84694,7 @@ exports.default = EntryFilter; /***/ }), -/* 750 */ +/* 744 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86762,8 +84714,8 @@ var __extends = (this && this.__extends) || (function () { })(); Object.defineProperty(exports, "__esModule", { value: true }); var stream = __webpack_require__(173); -var fsStat = __webpack_require__(751); -var fs_1 = __webpack_require__(755); +var fsStat = __webpack_require__(745); +var fs_1 = __webpack_require__(749); var FileSystemStream = /** @class */ (function (_super) { __extends(FileSystemStream, _super); function FileSystemStream() { @@ -86813,14 +84765,14 @@ exports.default = FileSystemStream; /***/ }), -/* 751 */ +/* 745 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const optionsManager = __webpack_require__(752); -const statProvider = __webpack_require__(754); +const optionsManager = __webpack_require__(746); +const statProvider = __webpack_require__(748); /** * Asynchronous API. */ @@ -86851,13 +84803,13 @@ exports.statSync = statSync; /***/ }), -/* 752 */ +/* 746 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsAdapter = __webpack_require__(753); +const fsAdapter = __webpack_require__(747); function prepare(opts) { const options = Object.assign({ fs: fsAdapter.getFileSystemAdapter(opts ? opts.fs : undefined), @@ -86870,7 +84822,7 @@ exports.prepare = prepare; /***/ }), -/* 753 */ +/* 747 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86893,7 +84845,7 @@ exports.getFileSystemAdapter = getFileSystemAdapter; /***/ }), -/* 754 */ +/* 748 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86945,7 +84897,7 @@ exports.isFollowedSymlink = isFollowedSymlink; /***/ }), -/* 755 */ +/* 749 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86976,7 +84928,7 @@ exports.default = FileSystem; /***/ }), -/* 756 */ +/* 750 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86996,9 +84948,9 @@ var __extends = (this && this.__extends) || (function () { })(); Object.defineProperty(exports, "__esModule", { value: true }); var stream = __webpack_require__(173); -var readdir = __webpack_require__(733); -var reader_1 = __webpack_require__(746); -var fs_stream_1 = __webpack_require__(750); +var readdir = __webpack_require__(727); +var reader_1 = __webpack_require__(740); +var fs_stream_1 = __webpack_require__(744); var TransformStream = /** @class */ (function (_super) { __extends(TransformStream, _super); function TransformStream(reader) { @@ -87066,7 +85018,7 @@ exports.default = ReaderStream; /***/ }), -/* 757 */ +/* 751 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -87085,9 +85037,9 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var readdir = __webpack_require__(733); -var reader_1 = __webpack_require__(746); -var fs_sync_1 = __webpack_require__(758); +var readdir = __webpack_require__(727); +var reader_1 = __webpack_require__(740); +var fs_sync_1 = __webpack_require__(752); var ReaderSync = /** @class */ (function (_super) { __extends(ReaderSync, _super); function ReaderSync() { @@ -87147,7 +85099,7 @@ exports.default = ReaderSync; /***/ }), -/* 758 */ +/* 752 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -87166,8 +85118,8 @@ var __extends = (this && this.__extends) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var fsStat = __webpack_require__(751); -var fs_1 = __webpack_require__(755); +var fsStat = __webpack_require__(745); +var fs_1 = __webpack_require__(749); var FileSystemSync = /** @class */ (function (_super) { __extends(FileSystemSync, _super); function FileSystemSync() { @@ -87213,7 +85165,7 @@ exports.default = FileSystemSync; /***/ }), -/* 759 */ +/* 753 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -87229,7 +85181,7 @@ exports.flatten = flatten; /***/ }), -/* 760 */ +/* 754 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -87250,13 +85202,13 @@ exports.merge = merge; /***/ }), -/* 761 */ +/* 755 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const pathType = __webpack_require__(762); +const pathType = __webpack_require__(756); const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]; @@ -87322,13 +85274,13 @@ module.exports.sync = (input, opts) => { /***/ }), -/* 762 */ +/* 756 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const fs = __webpack_require__(132); -const pify = __webpack_require__(763); +const pify = __webpack_require__(757); function type(fn, fn2, fp) { if (typeof fp !== 'string') { @@ -87371,7 +85323,7 @@ exports.symlinkSync = typeSync.bind(null, 'lstatSync', 'isSymbolicLink'); /***/ }), -/* 763 */ +/* 757 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -87462,17 +85414,17 @@ module.exports = (obj, opts) => { /***/ }), -/* 764 */ +/* 758 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const fs = __webpack_require__(132); const path = __webpack_require__(4); -const fastGlob = __webpack_require__(578); -const gitIgnore = __webpack_require__(765); -const pify = __webpack_require__(410); -const slash = __webpack_require__(766); +const fastGlob = __webpack_require__(572); +const gitIgnore = __webpack_require__(759); +const pify = __webpack_require__(404); +const slash = __webpack_require__(760); const DEFAULT_IGNORE = [ '**/node_modules/**', @@ -87570,7 +85522,7 @@ module.exports.sync = options => { /***/ }), -/* 765 */ +/* 759 */ /***/ (function(module, exports) { // A simple implementation of make-array @@ -88039,7 +85991,7 @@ module.exports = options => new IgnoreBase(options) /***/ }), -/* 766 */ +/* 760 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -88057,7 +86009,7 @@ module.exports = input => { /***/ }), -/* 767 */ +/* 761 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -88070,7 +86022,7 @@ module.exports = input => { -var isGlob = __webpack_require__(768); +var isGlob = __webpack_require__(762); module.exports = function hasGlob(val) { if (val == null) return false; @@ -88090,7 +86042,7 @@ module.exports = function hasGlob(val) { /***/ }), -/* 768 */ +/* 762 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -88121,17 +86073,17 @@ module.exports = function isGlob(str) { /***/ }), -/* 769 */ +/* 763 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); const {constants: fsConstants} = __webpack_require__(132); -const pEvent = __webpack_require__(770); -const CpFileError = __webpack_require__(773); -const fs = __webpack_require__(775); -const ProgressEmitter = __webpack_require__(778); +const pEvent = __webpack_require__(764); +const CpFileError = __webpack_require__(767); +const fs = __webpack_require__(769); +const ProgressEmitter = __webpack_require__(772); const cpFileAsync = async (source, destination, options, progressEmitter) => { let readError; @@ -88245,12 +86197,12 @@ module.exports.sync = (source, destination, options) => { /***/ }), -/* 770 */ +/* 764 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const pTimeout = __webpack_require__(771); +const pTimeout = __webpack_require__(765); const symbolAsyncIterator = Symbol.asyncIterator || '@@asyncIterator'; @@ -88541,12 +86493,12 @@ module.exports.iterator = (emitter, event, options) => { /***/ }), -/* 771 */ +/* 765 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const pFinally = __webpack_require__(772); +const pFinally = __webpack_require__(766); class TimeoutError extends Error { constructor(message) { @@ -88592,7 +86544,7 @@ module.exports.TimeoutError = TimeoutError; /***/ }), -/* 772 */ +/* 766 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -88614,12 +86566,12 @@ module.exports = (promise, onFinally) => { /***/ }), -/* 773 */ +/* 767 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const NestedError = __webpack_require__(774); +const NestedError = __webpack_require__(768); class CpFileError extends NestedError { constructor(message, nested) { @@ -88633,7 +86585,7 @@ module.exports = CpFileError; /***/ }), -/* 774 */ +/* 768 */ /***/ (function(module, exports, __webpack_require__) { var inherits = __webpack_require__(113).inherits; @@ -88689,16 +86641,16 @@ module.exports = NestedError; /***/ }), -/* 775 */ +/* 769 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const {promisify} = __webpack_require__(113); const fs = __webpack_require__(233); -const makeDir = __webpack_require__(776); -const pEvent = __webpack_require__(770); -const CpFileError = __webpack_require__(773); +const makeDir = __webpack_require__(770); +const pEvent = __webpack_require__(764); +const CpFileError = __webpack_require__(767); const stat = promisify(fs.stat); const lstat = promisify(fs.lstat); @@ -88795,7 +86747,7 @@ exports.copyFileSync = (source, destination, flags) => { /***/ }), -/* 776 */ +/* 770 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -88803,7 +86755,7 @@ exports.copyFileSync = (source, destination, flags) => { const fs = __webpack_require__(132); const path = __webpack_require__(4); const {promisify} = __webpack_require__(113); -const semver = __webpack_require__(777); +const semver = __webpack_require__(771); const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0'); @@ -88958,7 +86910,7 @@ module.exports.sync = (input, options) => { /***/ }), -/* 777 */ +/* 771 */ /***/ (function(module, exports) { exports = module.exports = SemVer @@ -90560,7 +88512,7 @@ function coerce (version, options) { /***/ }), -/* 778 */ +/* 772 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -90601,7 +88553,7 @@ module.exports = ProgressEmitter; /***/ }), -/* 779 */ +/* 773 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -90647,12 +88599,12 @@ exports.default = module.exports; /***/ }), -/* 780 */ +/* 774 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const pMap = __webpack_require__(781); +const pMap = __webpack_require__(775); const pFilter = async (iterable, filterer, options) => { const values = await pMap( @@ -90669,7 +88621,7 @@ module.exports.default = pFilter; /***/ }), -/* 781 */ +/* 775 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -90748,12 +88700,12 @@ module.exports.default = pMap; /***/ }), -/* 782 */ +/* 776 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const NestedError = __webpack_require__(774); +const NestedError = __webpack_require__(768); class CpyError extends NestedError { constructor(message, nested) { @@ -90767,7 +88719,7 @@ module.exports = CpyError; /***/ }), -/* 783 */ +/* 777 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -90775,10 +88727,10 @@ module.exports = CpyError; const fs = __webpack_require__(132); const arrayUnion = __webpack_require__(242); const merge2 = __webpack_require__(243); -const fastGlob = __webpack_require__(784); -const dirGlob = __webpack_require__(332); -const gitignore = __webpack_require__(815); -const {FilterStream, UniqueStream} = __webpack_require__(816); +const fastGlob = __webpack_require__(778); +const dirGlob = __webpack_require__(326); +const gitignore = __webpack_require__(809); +const {FilterStream, UniqueStream} = __webpack_require__(810); const DEFAULT_FILTER = () => false; @@ -90955,425 +88907,465 @@ module.exports.gitignore = gitignore; /***/ }), -/* 784 */ +/* 778 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -const taskManager = __webpack_require__(785); -const async_1 = __webpack_require__(801); -const stream_1 = __webpack_require__(811); -const sync_1 = __webpack_require__(812); -const settings_1 = __webpack_require__(814); -const utils = __webpack_require__(786); -async function FastGlob(source, options) { - assertPatternsInput(source); - const works = getWorks(source, async_1.default, options); - const result = await Promise.all(works); - return utils.array.flatten(result); -} -// https://github.com/typescript-eslint/typescript-eslint/issues/60 -// eslint-disable-next-line no-redeclare -(function (FastGlob) { - function sync(source, options) { - assertPatternsInput(source); - const works = getWorks(source, sync_1.default, options); - return utils.array.flatten(works); - } - FastGlob.sync = sync; - function stream(source, options) { - assertPatternsInput(source); - const works = getWorks(source, stream_1.default, options); - /** - * The stream returned by the provider cannot work with an asynchronous iterator. - * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. - * This affects performance (+25%). I don't see best solution right now. - */ - return utils.stream.merge(works); - } - FastGlob.stream = stream; - function generateTasks(source, options) { - assertPatternsInput(source); - const patterns = [].concat(source); - const settings = new settings_1.default(options); - return taskManager.generate(patterns, settings); - } - FastGlob.generateTasks = generateTasks; - function isDynamicPattern(source, options) { - assertPatternsInput(source); - const settings = new settings_1.default(options); - return utils.pattern.isDynamicPattern(source, settings); - } - FastGlob.isDynamicPattern = isDynamicPattern; - function escapePath(source) { - assertPatternsInput(source); - return utils.path.escape(source); - } - FastGlob.escapePath = escapePath; -})(FastGlob || (FastGlob = {})); -function getWorks(source, _Provider, options) { - const patterns = [].concat(source); - const settings = new settings_1.default(options); - const tasks = taskManager.generate(patterns, settings); - const provider = new _Provider(settings); - return tasks.map(provider.read, provider); -} -function assertPatternsInput(input) { - const source = [].concat(input); - const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item)); - if (!isValidSource) { - throw new TypeError('Patterns must be a string (non empty) or an array of strings'); - } -} -module.exports = FastGlob; + +const taskManager = __webpack_require__(779); +const async_1 = __webpack_require__(795); +const stream_1 = __webpack_require__(805); +const sync_1 = __webpack_require__(806); +const settings_1 = __webpack_require__(808); +const utils = __webpack_require__(780); +async function FastGlob(source, options) { + assertPatternsInput(source); + const works = getWorks(source, async_1.default, options); + const result = await Promise.all(works); + return utils.array.flatten(result); +} +// https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare +(function (FastGlob) { + function sync(source, options) { + assertPatternsInput(source); + const works = getWorks(source, sync_1.default, options); + return utils.array.flatten(works); + } + FastGlob.sync = sync; + function stream(source, options) { + assertPatternsInput(source); + const works = getWorks(source, stream_1.default, options); + /** + * The stream returned by the provider cannot work with an asynchronous iterator. + * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. + * This affects performance (+25%). I don't see best solution right now. + */ + return utils.stream.merge(works); + } + FastGlob.stream = stream; + function generateTasks(source, options) { + assertPatternsInput(source); + const patterns = [].concat(source); + const settings = new settings_1.default(options); + return taskManager.generate(patterns, settings); + } + FastGlob.generateTasks = generateTasks; + function isDynamicPattern(source, options) { + assertPatternsInput(source); + const settings = new settings_1.default(options); + return utils.pattern.isDynamicPattern(source, settings); + } + FastGlob.isDynamicPattern = isDynamicPattern; + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escape(source); + } + FastGlob.escapePath = escapePath; +})(FastGlob || (FastGlob = {})); +function getWorks(source, _Provider, options) { + const patterns = [].concat(source); + const settings = new settings_1.default(options); + const tasks = taskManager.generate(patterns, settings); + const provider = new _Provider(settings); + return tasks.map(provider.read, provider); +} +function assertPatternsInput(input) { + const source = [].concat(input); + const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item)); + if (!isValidSource) { + throw new TypeError('Patterns must be a string (non empty) or an array of strings'); + } +} +module.exports = FastGlob; /***/ }), -/* 785 */ +/* 779 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; -const utils = __webpack_require__(786); -function generate(patterns, settings) { - const positivePatterns = getPositivePatterns(patterns); - const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); - const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); - const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); - const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); - const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); - return staticTasks.concat(dynamicTasks); -} -exports.generate = generate; -function convertPatternsToTasks(positive, negative, dynamic) { - const positivePatternsGroup = groupPatternsByBaseDirectory(positive); - // When we have a global group – there is no reason to divide the patterns into independent tasks. - // In this case, the global task covers the rest. - if ('.' in positivePatternsGroup) { - const task = convertPatternGroupToTask('.', positive, negative, dynamic); - return [task]; - } - return convertPatternGroupsToTasks(positivePatternsGroup, negative, dynamic); -} -exports.convertPatternsToTasks = convertPatternsToTasks; -function getPositivePatterns(patterns) { - return utils.pattern.getPositivePatterns(patterns); -} -exports.getPositivePatterns = getPositivePatterns; -function getNegativePatternsAsPositive(patterns, ignore) { - const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); - const positive = negative.map(utils.pattern.convertToPositivePattern); - return positive; -} -exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; -function groupPatternsByBaseDirectory(patterns) { - const group = {}; - return patterns.reduce((collection, pattern) => { - const base = utils.pattern.getBaseDirectory(pattern); - if (base in collection) { - collection[base].push(pattern); - } - else { - collection[base] = [pattern]; - } - return collection; - }, group); -} -exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; -function convertPatternGroupsToTasks(positive, negative, dynamic) { - return Object.keys(positive).map((base) => { - return convertPatternGroupToTask(base, positive[base], negative, dynamic); - }); -} -exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; -function convertPatternGroupToTask(base, positive, negative, dynamic) { - return { - dynamic, - positive, - negative, - base, - patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) - }; -} -exports.convertPatternGroupToTask = convertPatternGroupToTask; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; +const utils = __webpack_require__(780); +function generate(patterns, settings) { + const positivePatterns = getPositivePatterns(patterns); + const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); + const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); + const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); + const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); + const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); + return staticTasks.concat(dynamicTasks); +} +exports.generate = generate; +/** + * Returns tasks grouped by basic pattern directories. + * + * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately. + * This is necessary because directory traversal starts at the base directory and goes deeper. + */ +function convertPatternsToTasks(positive, negative, dynamic) { + const tasks = []; + const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive); + const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive); + const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory); + const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory); + tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic)); + /* + * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory + * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest. + */ + if ('.' in insideCurrentDirectoryGroup) { + tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic)); + } + else { + tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic)); + } + return tasks; +} +exports.convertPatternsToTasks = convertPatternsToTasks; +function getPositivePatterns(patterns) { + return utils.pattern.getPositivePatterns(patterns); +} +exports.getPositivePatterns = getPositivePatterns; +function getNegativePatternsAsPositive(patterns, ignore) { + const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); + const positive = negative.map(utils.pattern.convertToPositivePattern); + return positive; +} +exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; +function groupPatternsByBaseDirectory(patterns) { + const group = {}; + return patterns.reduce((collection, pattern) => { + const base = utils.pattern.getBaseDirectory(pattern); + if (base in collection) { + collection[base].push(pattern); + } + else { + collection[base] = [pattern]; + } + return collection; + }, group); +} +exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; +function convertPatternGroupsToTasks(positive, negative, dynamic) { + return Object.keys(positive).map((base) => { + return convertPatternGroupToTask(base, positive[base], negative, dynamic); + }); +} +exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; +function convertPatternGroupToTask(base, positive, negative, dynamic) { + return { + dynamic, + positive, + negative, + base, + patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) + }; +} +exports.convertPatternGroupToTask = convertPatternGroupToTask; /***/ }), -/* 786 */ +/* 780 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; -const array = __webpack_require__(787); -exports.array = array; -const errno = __webpack_require__(788); -exports.errno = errno; -const fs = __webpack_require__(789); -exports.fs = fs; -const path = __webpack_require__(790); -exports.path = path; -const pattern = __webpack_require__(791); -exports.pattern = pattern; -const stream = __webpack_require__(799); -exports.stream = stream; -const string = __webpack_require__(800); -exports.string = string; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; +const array = __webpack_require__(781); +exports.array = array; +const errno = __webpack_require__(782); +exports.errno = errno; +const fs = __webpack_require__(783); +exports.fs = fs; +const path = __webpack_require__(784); +exports.path = path; +const pattern = __webpack_require__(785); +exports.pattern = pattern; +const stream = __webpack_require__(793); +exports.stream = stream; +const string = __webpack_require__(794); +exports.string = string; /***/ }), -/* 787 */ +/* 781 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.splitWhen = exports.flatten = void 0; -function flatten(items) { - return items.reduce((collection, item) => [].concat(collection, item), []); -} -exports.flatten = flatten; -function splitWhen(items, predicate) { - const result = [[]]; - let groupIndex = 0; - for (const item of items) { - if (predicate(item)) { - groupIndex++; - result[groupIndex] = []; - } - else { - result[groupIndex].push(item); - } - } - return result; -} -exports.splitWhen = splitWhen; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.splitWhen = exports.flatten = void 0; +function flatten(items) { + return items.reduce((collection, item) => [].concat(collection, item), []); +} +exports.flatten = flatten; +function splitWhen(items, predicate) { + const result = [[]]; + let groupIndex = 0; + for (const item of items) { + if (predicate(item)) { + groupIndex++; + result[groupIndex] = []; + } + else { + result[groupIndex].push(item); + } + } + return result; +} +exports.splitWhen = splitWhen; /***/ }), -/* 788 */ +/* 782 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isEnoentCodeError = void 0; -function isEnoentCodeError(error) { - return error.code === 'ENOENT'; -} -exports.isEnoentCodeError = isEnoentCodeError; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isEnoentCodeError = void 0; +function isEnoentCodeError(error) { + return error.code === 'ENOENT'; +} +exports.isEnoentCodeError = isEnoentCodeError; /***/ }), -/* 789 */ +/* 783 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createDirentFromStats = void 0; -class DirentFromStats { - constructor(name, stats) { - this.name = name; - this.isBlockDevice = stats.isBlockDevice.bind(stats); - this.isCharacterDevice = stats.isCharacterDevice.bind(stats); - this.isDirectory = stats.isDirectory.bind(stats); - this.isFIFO = stats.isFIFO.bind(stats); - this.isFile = stats.isFile.bind(stats); - this.isSocket = stats.isSocket.bind(stats); - this.isSymbolicLink = stats.isSymbolicLink.bind(stats); - } -} -function createDirentFromStats(name, stats) { - return new DirentFromStats(name, stats); -} -exports.createDirentFromStats = createDirentFromStats; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDirentFromStats = void 0; +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; /***/ }), -/* 790 */ +/* 784 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.removeLeadingDotSegment = exports.escape = exports.makeAbsolute = exports.unixify = void 0; -const path = __webpack_require__(4); -const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ -const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g; -/** - * Designed to work only with simple paths: `dir\\file`. - */ -function unixify(filepath) { - return filepath.replace(/\\/g, '/'); -} -exports.unixify = unixify; -function makeAbsolute(cwd, filepath) { - return path.resolve(cwd, filepath); -} -exports.makeAbsolute = makeAbsolute; -function escape(pattern) { - return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); -} -exports.escape = escape; -function removeLeadingDotSegment(entry) { - // We do not use `startsWith` because this is 10x slower than current implementation for some cases. - // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with - if (entry.charAt(0) === '.') { - const secondCharactery = entry.charAt(1); - if (secondCharactery === '/' || secondCharactery === '\\') { - return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); - } - } - return entry; -} -exports.removeLeadingDotSegment = removeLeadingDotSegment; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.removeLeadingDotSegment = exports.escape = exports.makeAbsolute = exports.unixify = void 0; +const path = __webpack_require__(4); +const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ +const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g; +/** + * Designed to work only with simple paths: `dir\\file`. + */ +function unixify(filepath) { + return filepath.replace(/\\/g, '/'); +} +exports.unixify = unixify; +function makeAbsolute(cwd, filepath) { + return path.resolve(cwd, filepath); +} +exports.makeAbsolute = makeAbsolute; +function escape(pattern) { + return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); +} +exports.escape = escape; +function removeLeadingDotSegment(entry) { + // We do not use `startsWith` because this is 10x slower than current implementation for some cases. + // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with + if (entry.charAt(0) === '.') { + const secondCharactery = entry.charAt(1); + if (secondCharactery === '/' || secondCharactery === '\\') { + return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); + } + } + return entry; +} +exports.removeLeadingDotSegment = removeLeadingDotSegment; /***/ }), -/* 791 */ +/* 785 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; -const path = __webpack_require__(4); -const globParent = __webpack_require__(265); -const micromatch = __webpack_require__(792); -const picomatch = __webpack_require__(285); -const GLOBSTAR = '**'; -const ESCAPE_SYMBOL = '\\'; -const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; -const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/; -const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/; -const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/; -const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/; -function isStaticPattern(pattern, options = {}) { - return !isDynamicPattern(pattern, options); -} -exports.isStaticPattern = isStaticPattern; -function isDynamicPattern(pattern, options = {}) { - /** - * A special case with an empty string is necessary for matching patterns that start with a forward slash. - * An empty string cannot be a dynamic pattern. - * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'. - */ - if (pattern === '') { - return false; - } - /** - * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check - * filepath directly (without read directory). - */ - if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { - return true; - } - if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { - return true; - } - if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { - return true; - } - if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) { - return true; - } - return false; -} -exports.isDynamicPattern = isDynamicPattern; -function convertToPositivePattern(pattern) { - return isNegativePattern(pattern) ? pattern.slice(1) : pattern; -} -exports.convertToPositivePattern = convertToPositivePattern; -function convertToNegativePattern(pattern) { - return '!' + pattern; -} -exports.convertToNegativePattern = convertToNegativePattern; -function isNegativePattern(pattern) { - return pattern.startsWith('!') && pattern[1] !== '('; -} -exports.isNegativePattern = isNegativePattern; -function isPositivePattern(pattern) { - return !isNegativePattern(pattern); -} -exports.isPositivePattern = isPositivePattern; -function getNegativePatterns(patterns) { - return patterns.filter(isNegativePattern); -} -exports.getNegativePatterns = getNegativePatterns; -function getPositivePatterns(patterns) { - return patterns.filter(isPositivePattern); -} -exports.getPositivePatterns = getPositivePatterns; -function getBaseDirectory(pattern) { - return globParent(pattern, { flipBackslashes: false }); -} -exports.getBaseDirectory = getBaseDirectory; -function hasGlobStar(pattern) { - return pattern.includes(GLOBSTAR); -} -exports.hasGlobStar = hasGlobStar; -function endsWithSlashGlobStar(pattern) { - return pattern.endsWith('/' + GLOBSTAR); -} -exports.endsWithSlashGlobStar = endsWithSlashGlobStar; -function isAffectDepthOfReadingPattern(pattern) { - const basename = path.basename(pattern); - return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); -} -exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; -function expandPatternsWithBraceExpansion(patterns) { - return patterns.reduce((collection, pattern) => { - return collection.concat(expandBraceExpansion(pattern)); - }, []); -} -exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; -function expandBraceExpansion(pattern) { - return micromatch.braces(pattern, { - expand: true, - nodupes: true - }); -} -exports.expandBraceExpansion = expandBraceExpansion; -function getPatternParts(pattern, options) { - let { parts } = picomatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); - /** - * The scan method returns an empty array in some cases. - * See micromatch/picomatch#58 for more details. - */ - if (parts.length === 0) { - parts = [pattern]; - } - /** - * The scan method does not return an empty part for the pattern with a forward slash. - * This is another part of micromatch/picomatch#58. - */ - if (parts[0].startsWith('/')) { - parts[0] = parts[0].slice(1); - parts.unshift(''); - } - return parts; -} -exports.getPatternParts = getPatternParts; -function makeRe(pattern, options) { - return micromatch.makeRe(pattern, options); -} -exports.makeRe = makeRe; -function convertPatternsToRe(patterns, options) { - return patterns.map((pattern) => makeRe(pattern, options)); -} -exports.convertPatternsToRe = convertPatternsToRe; -function matchAny(entry, patternsRe) { - return patternsRe.some((patternRe) => patternRe.test(entry)); -} -exports.matchAny = matchAny; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; +const path = __webpack_require__(4); +const globParent = __webpack_require__(265); +const micromatch = __webpack_require__(786); +const GLOBSTAR = '**'; +const ESCAPE_SYMBOL = '\\'; +const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; +const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/; +const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/; +const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/; +const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/; +function isStaticPattern(pattern, options = {}) { + return !isDynamicPattern(pattern, options); +} +exports.isStaticPattern = isStaticPattern; +function isDynamicPattern(pattern, options = {}) { + /** + * A special case with an empty string is necessary for matching patterns that start with a forward slash. + * An empty string cannot be a dynamic pattern. + * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'. + */ + if (pattern === '') { + return false; + } + /** + * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check + * filepath directly (without read directory). + */ + if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { + return true; + } + if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) { + return true; + } + return false; +} +exports.isDynamicPattern = isDynamicPattern; +function convertToPositivePattern(pattern) { + return isNegativePattern(pattern) ? pattern.slice(1) : pattern; +} +exports.convertToPositivePattern = convertToPositivePattern; +function convertToNegativePattern(pattern) { + return '!' + pattern; +} +exports.convertToNegativePattern = convertToNegativePattern; +function isNegativePattern(pattern) { + return pattern.startsWith('!') && pattern[1] !== '('; +} +exports.isNegativePattern = isNegativePattern; +function isPositivePattern(pattern) { + return !isNegativePattern(pattern); +} +exports.isPositivePattern = isPositivePattern; +function getNegativePatterns(patterns) { + return patterns.filter(isNegativePattern); +} +exports.getNegativePatterns = getNegativePatterns; +function getPositivePatterns(patterns) { + return patterns.filter(isPositivePattern); +} +exports.getPositivePatterns = getPositivePatterns; +/** + * Returns patterns that can be applied inside the current directory. + * + * @example + * // ['./*', '*', 'a/*'] + * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*']) + */ +function getPatternsInsideCurrentDirectory(patterns) { + return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern)); +} +exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory; +/** + * Returns patterns to be expanded relative to (outside) the current directory. + * + * @example + * // ['../*', './../*'] + * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*']) + */ +function getPatternsOutsideCurrentDirectory(patterns) { + return patterns.filter(isPatternRelatedToParentDirectory); +} +exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory; +function isPatternRelatedToParentDirectory(pattern) { + return pattern.startsWith('..') || pattern.startsWith('./..'); +} +exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory; +function getBaseDirectory(pattern) { + return globParent(pattern, { flipBackslashes: false }); +} +exports.getBaseDirectory = getBaseDirectory; +function hasGlobStar(pattern) { + return pattern.includes(GLOBSTAR); +} +exports.hasGlobStar = hasGlobStar; +function endsWithSlashGlobStar(pattern) { + return pattern.endsWith('/' + GLOBSTAR); +} +exports.endsWithSlashGlobStar = endsWithSlashGlobStar; +function isAffectDepthOfReadingPattern(pattern) { + const basename = path.basename(pattern); + return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); +} +exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; +function expandPatternsWithBraceExpansion(patterns) { + return patterns.reduce((collection, pattern) => { + return collection.concat(expandBraceExpansion(pattern)); + }, []); +} +exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; +function expandBraceExpansion(pattern) { + return micromatch.braces(pattern, { + expand: true, + nodupes: true + }); +} +exports.expandBraceExpansion = expandBraceExpansion; +function getPatternParts(pattern, options) { + let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); + /** + * The scan method returns an empty array in some cases. + * See micromatch/picomatch#58 for more details. + */ + if (parts.length === 0) { + parts = [pattern]; + } + /** + * The scan method does not return an empty part for the pattern with a forward slash. + * This is another part of micromatch/picomatch#58. + */ + if (parts[0].startsWith('/')) { + parts[0] = parts[0].slice(1); + parts.unshift(''); + } + return parts; +} +exports.getPatternParts = getPatternParts; +function makeRe(pattern, options) { + return micromatch.makeRe(pattern, options); +} +exports.makeRe = makeRe; +function convertPatternsToRe(patterns, options) { + return patterns.map((pattern) => makeRe(pattern, options)); +} +exports.convertPatternsToRe = convertPatternsToRe; +function matchAny(entry, patternsRe) { + return patternsRe.some((patternRe) => patternRe.test(entry)); +} +exports.matchAny = matchAny; /***/ }), -/* 792 */ +/* 786 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -91381,8 +89373,8 @@ exports.matchAny = matchAny; const util = __webpack_require__(113); const braces = __webpack_require__(269); -const picomatch = __webpack_require__(793); -const utils = __webpack_require__(796); +const picomatch = __webpack_require__(787); +const utils = __webpack_require__(790); const isEmptyString = val => val === '' || val === './'; /** @@ -91847,27 +89839,27 @@ module.exports = micromatch; /***/ }), -/* 793 */ +/* 787 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -module.exports = __webpack_require__(794); +module.exports = __webpack_require__(788); /***/ }), -/* 794 */ +/* 788 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(4); -const scan = __webpack_require__(795); -const parse = __webpack_require__(798); -const utils = __webpack_require__(796); -const constants = __webpack_require__(797); +const scan = __webpack_require__(789); +const parse = __webpack_require__(792); +const utils = __webpack_require__(790); +const constants = __webpack_require__(791); const isObject = val => val && typeof val === 'object' && !Array.isArray(val); /** @@ -92206,13 +90198,13 @@ module.exports = picomatch; /***/ }), -/* 795 */ +/* 789 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const utils = __webpack_require__(796); +const utils = __webpack_require__(790); const { CHAR_ASTERISK, /* * */ CHAR_AT, /* @ */ @@ -92229,7 +90221,7 @@ const { CHAR_RIGHT_CURLY_BRACE, /* } */ CHAR_RIGHT_PARENTHESES, /* ) */ CHAR_RIGHT_SQUARE_BRACKET /* ] */ -} = __webpack_require__(797); +} = __webpack_require__(791); const isPathSeparator = code => { return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; @@ -92604,7 +90596,7 @@ module.exports = scan; /***/ }), -/* 796 */ +/* 790 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -92617,7 +90609,7 @@ const { REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL -} = __webpack_require__(797); +} = __webpack_require__(791); exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); @@ -92675,7 +90667,7 @@ exports.wrapOutput = (input, state = {}, options = {}) => { /***/ }), -/* 797 */ +/* 791 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -92861,14 +90853,14 @@ module.exports = { /***/ }), -/* 798 */ +/* 792 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const constants = __webpack_require__(797); -const utils = __webpack_require__(796); +const constants = __webpack_require__(791); +const utils = __webpack_require__(790); /** * Constants @@ -93952,712 +91944,712 @@ module.exports = parse; /***/ }), -/* 799 */ +/* 793 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.merge = void 0; -const merge2 = __webpack_require__(243); -function merge(streams) { - const mergedStream = merge2(streams); - streams.forEach((stream) => { - stream.once('error', (error) => mergedStream.emit('error', error)); - }); - mergedStream.once('close', () => propagateCloseEventToSources(streams)); - mergedStream.once('end', () => propagateCloseEventToSources(streams)); - return mergedStream; -} -exports.merge = merge; -function propagateCloseEventToSources(streams) { - streams.forEach((stream) => stream.emit('close')); -} + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.merge = void 0; +const merge2 = __webpack_require__(243); +function merge(streams) { + const mergedStream = merge2(streams); + streams.forEach((stream) => { + stream.once('error', (error) => mergedStream.emit('error', error)); + }); + mergedStream.once('close', () => propagateCloseEventToSources(streams)); + mergedStream.once('end', () => propagateCloseEventToSources(streams)); + return mergedStream; +} +exports.merge = merge; +function propagateCloseEventToSources(streams) { + streams.forEach((stream) => stream.emit('close')); +} /***/ }), -/* 800 */ +/* 794 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isEmpty = exports.isString = void 0; -function isString(input) { - return typeof input === 'string'; -} -exports.isString = isString; -function isEmpty(input) { - return input === ''; -} -exports.isEmpty = isEmpty; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isEmpty = exports.isString = void 0; +function isString(input) { + return typeof input === 'string'; +} +exports.isString = isString; +function isEmpty(input) { + return input === ''; +} +exports.isEmpty = isEmpty; /***/ }), -/* 801 */ +/* 795 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(802); -const provider_1 = __webpack_require__(804); -class ProviderAsync extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new stream_1.default(this._settings); - } - read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const entries = []; - return new Promise((resolve, reject) => { - const stream = this.api(root, task, options); - stream.once('error', reject); - stream.on('data', (entry) => entries.push(options.transform(entry))); - stream.once('end', () => resolve(entries)); - }); - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } -} -exports.default = ProviderAsync; + +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = __webpack_require__(796); +const provider_1 = __webpack_require__(798); +class ProviderAsync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new stream_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = []; + return new Promise((resolve, reject) => { + const stream = this.api(root, task, options); + stream.once('error', reject); + stream.on('data', (entry) => entries.push(options.transform(entry))); + stream.once('end', () => resolve(entries)); + }); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports.default = ProviderAsync; /***/ }), -/* 802 */ +/* 796 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(173); -const fsStat = __webpack_require__(295); -const fsWalk = __webpack_require__(300); -const reader_1 = __webpack_require__(803); -class ReaderStream extends reader_1.default { - constructor() { - super(...arguments); - this._walkStream = fsWalk.walkStream; - this._stat = fsStat.stat; - } - dynamic(root, options) { - return this._walkStream(root, options); - } - static(patterns, options) { - const filepaths = patterns.map(this._getFullEntryPath, this); - const stream = new stream_1.PassThrough({ objectMode: true }); - stream._write = (index, _enc, done) => { - return this._getEntry(filepaths[index], patterns[index], options) - .then((entry) => { - if (entry !== null && options.entryFilter(entry)) { - stream.push(entry); - } - if (index === filepaths.length - 1) { - stream.end(); - } - done(); - }) - .catch(done); - }; - for (let i = 0; i < filepaths.length; i++) { - stream.write(i); - } - return stream; - } - _getEntry(filepath, pattern, options) { - return this._getStat(filepath) - .then((stats) => this._makeEntry(stats, pattern)) - .catch((error) => { - if (options.errorFilter(error)) { - return null; - } - throw error; - }); - } - _getStat(filepath) { - return new Promise((resolve, reject) => { - this._stat(filepath, this._fsStatSettings, (error, stats) => { - return error === null ? resolve(stats) : reject(error); - }); - }); - } -} -exports.default = ReaderStream; + +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = __webpack_require__(173); +const fsStat = __webpack_require__(289); +const fsWalk = __webpack_require__(294); +const reader_1 = __webpack_require__(797); +class ReaderStream extends reader_1.default { + constructor() { + super(...arguments); + this._walkStream = fsWalk.walkStream; + this._stat = fsStat.stat; + } + dynamic(root, options) { + return this._walkStream(root, options); + } + static(patterns, options) { + const filepaths = patterns.map(this._getFullEntryPath, this); + const stream = new stream_1.PassThrough({ objectMode: true }); + stream._write = (index, _enc, done) => { + return this._getEntry(filepaths[index], patterns[index], options) + .then((entry) => { + if (entry !== null && options.entryFilter(entry)) { + stream.push(entry); + } + if (index === filepaths.length - 1) { + stream.end(); + } + done(); + }) + .catch(done); + }; + for (let i = 0; i < filepaths.length; i++) { + stream.write(i); + } + return stream; + } + _getEntry(filepath, pattern, options) { + return this._getStat(filepath) + .then((stats) => this._makeEntry(stats, pattern)) + .catch((error) => { + if (options.errorFilter(error)) { + return null; + } + throw error; + }); + } + _getStat(filepath) { + return new Promise((resolve, reject) => { + this._stat(filepath, this._fsStatSettings, (error, stats) => { + return error === null ? resolve(stats) : reject(error); + }); + }); + } +} +exports.default = ReaderStream; /***/ }), -/* 803 */ +/* 797 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(4); -const fsStat = __webpack_require__(295); -const utils = __webpack_require__(786); -class Reader { - constructor(_settings) { - this._settings = _settings; - this._fsStatSettings = new fsStat.Settings({ - followSymbolicLink: this._settings.followSymbolicLinks, - fs: this._settings.fs, - throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks - }); - } - _getFullEntryPath(filepath) { - return path.resolve(this._settings.cwd, filepath); - } - _makeEntry(stats, pattern) { - const entry = { - name: pattern, - path: pattern, - dirent: utils.fs.createDirentFromStats(pattern, stats) - }; - if (this._settings.stats) { - entry.stats = stats; - } - return entry; - } - _isFatalError(error) { - return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; - } -} -exports.default = Reader; + +Object.defineProperty(exports, "__esModule", { value: true }); +const path = __webpack_require__(4); +const fsStat = __webpack_require__(289); +const utils = __webpack_require__(780); +class Reader { + constructor(_settings) { + this._settings = _settings; + this._fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this._settings.followSymbolicLinks, + fs: this._settings.fs, + throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks + }); + } + _getFullEntryPath(filepath) { + return path.resolve(this._settings.cwd, filepath); + } + _makeEntry(stats, pattern) { + const entry = { + name: pattern, + path: pattern, + dirent: utils.fs.createDirentFromStats(pattern, stats) + }; + if (this._settings.stats) { + entry.stats = stats; + } + return entry; + } + _isFatalError(error) { + return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; + } +} +exports.default = Reader; /***/ }), -/* 804 */ +/* 798 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(4); -const deep_1 = __webpack_require__(805); -const entry_1 = __webpack_require__(808); -const error_1 = __webpack_require__(809); -const entry_2 = __webpack_require__(810); -class Provider { - constructor(_settings) { - this._settings = _settings; - this.errorFilter = new error_1.default(this._settings); - this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions()); - this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions()); - this.entryTransformer = new entry_2.default(this._settings); - } - _getRootDirectory(task) { - return path.resolve(this._settings.cwd, task.base); - } - _getReaderOptions(task) { - const basePath = task.base === '.' ? '' : task.base; - return { - basePath, - pathSegmentSeparator: '/', - concurrency: this._settings.concurrency, - deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), - entryFilter: this.entryFilter.getFilter(task.positive, task.negative), - errorFilter: this.errorFilter.getFilter(), - followSymbolicLinks: this._settings.followSymbolicLinks, - fs: this._settings.fs, - stats: this._settings.stats, - throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, - transform: this.entryTransformer.getTransformer() - }; - } - _getMicromatchOptions() { - return { - dot: this._settings.dot, - matchBase: this._settings.baseNameMatch, - nobrace: !this._settings.braceExpansion, - nocase: !this._settings.caseSensitiveMatch, - noext: !this._settings.extglob, - noglobstar: !this._settings.globstar, - posix: true, - strictSlashes: false - }; - } -} -exports.default = Provider; + +Object.defineProperty(exports, "__esModule", { value: true }); +const path = __webpack_require__(4); +const deep_1 = __webpack_require__(799); +const entry_1 = __webpack_require__(802); +const error_1 = __webpack_require__(803); +const entry_2 = __webpack_require__(804); +class Provider { + constructor(_settings) { + this._settings = _settings; + this.errorFilter = new error_1.default(this._settings); + this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions()); + this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions()); + this.entryTransformer = new entry_2.default(this._settings); + } + _getRootDirectory(task) { + return path.resolve(this._settings.cwd, task.base); + } + _getReaderOptions(task) { + const basePath = task.base === '.' ? '' : task.base; + return { + basePath, + pathSegmentSeparator: '/', + concurrency: this._settings.concurrency, + deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), + entryFilter: this.entryFilter.getFilter(task.positive, task.negative), + errorFilter: this.errorFilter.getFilter(), + followSymbolicLinks: this._settings.followSymbolicLinks, + fs: this._settings.fs, + stats: this._settings.stats, + throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, + transform: this.entryTransformer.getTransformer() + }; + } + _getMicromatchOptions() { + return { + dot: this._settings.dot, + matchBase: this._settings.baseNameMatch, + nobrace: !this._settings.braceExpansion, + nocase: !this._settings.caseSensitiveMatch, + noext: !this._settings.extglob, + noglobstar: !this._settings.globstar, + posix: true, + strictSlashes: false + }; + } +} +exports.default = Provider; /***/ }), -/* 805 */ +/* 799 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(786); -const partial_1 = __webpack_require__(806); -class DeepFilter { - constructor(_settings, _micromatchOptions) { - this._settings = _settings; - this._micromatchOptions = _micromatchOptions; - } - getFilter(basePath, positive, negative) { - const matcher = this._getMatcher(positive); - const negativeRe = this._getNegativePatternsRe(negative); - return (entry) => this._filter(basePath, entry, matcher, negativeRe); - } - _getMatcher(patterns) { - return new partial_1.default(patterns, this._settings, this._micromatchOptions); - } - _getNegativePatternsRe(patterns) { - const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern); - return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); - } - _filter(basePath, entry, matcher, negativeRe) { - if (this._isSkippedByDeep(basePath, entry.path)) { - return false; - } - if (this._isSkippedSymbolicLink(entry)) { - return false; - } - const filepath = utils.path.removeLeadingDotSegment(entry.path); - if (this._isSkippedByPositivePatterns(filepath, matcher)) { - return false; - } - return this._isSkippedByNegativePatterns(filepath, negativeRe); - } - _isSkippedByDeep(basePath, entryPath) { - /** - * Avoid unnecessary depth calculations when it doesn't matter. - */ - if (this._settings.deep === Infinity) { - return false; - } - return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; - } - _getEntryLevel(basePath, entryPath) { - const entryPathDepth = entryPath.split('/').length; - if (basePath === '') { - return entryPathDepth; - } - const basePathDepth = basePath.split('/').length; - return entryPathDepth - basePathDepth; - } - _isSkippedSymbolicLink(entry) { - return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); - } - _isSkippedByPositivePatterns(entryPath, matcher) { - return !this._settings.baseNameMatch && !matcher.match(entryPath); - } - _isSkippedByNegativePatterns(entryPath, patternsRe) { - return !utils.pattern.matchAny(entryPath, patternsRe); - } -} -exports.default = DeepFilter; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(780); +const partial_1 = __webpack_require__(800); +class DeepFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + } + getFilter(basePath, positive, negative) { + const matcher = this._getMatcher(positive); + const negativeRe = this._getNegativePatternsRe(negative); + return (entry) => this._filter(basePath, entry, matcher, negativeRe); + } + _getMatcher(patterns) { + return new partial_1.default(patterns, this._settings, this._micromatchOptions); + } + _getNegativePatternsRe(patterns) { + const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern); + return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); + } + _filter(basePath, entry, matcher, negativeRe) { + if (this._isSkippedByDeep(basePath, entry.path)) { + return false; + } + if (this._isSkippedSymbolicLink(entry)) { + return false; + } + const filepath = utils.path.removeLeadingDotSegment(entry.path); + if (this._isSkippedByPositivePatterns(filepath, matcher)) { + return false; + } + return this._isSkippedByNegativePatterns(filepath, negativeRe); + } + _isSkippedByDeep(basePath, entryPath) { + /** + * Avoid unnecessary depth calculations when it doesn't matter. + */ + if (this._settings.deep === Infinity) { + return false; + } + return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; + } + _getEntryLevel(basePath, entryPath) { + const entryPathDepth = entryPath.split('/').length; + if (basePath === '') { + return entryPathDepth; + } + const basePathDepth = basePath.split('/').length; + return entryPathDepth - basePathDepth; + } + _isSkippedSymbolicLink(entry) { + return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); + } + _isSkippedByPositivePatterns(entryPath, matcher) { + return !this._settings.baseNameMatch && !matcher.match(entryPath); + } + _isSkippedByNegativePatterns(entryPath, patternsRe) { + return !utils.pattern.matchAny(entryPath, patternsRe); + } +} +exports.default = DeepFilter; /***/ }), -/* 806 */ +/* 800 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const matcher_1 = __webpack_require__(807); -class PartialMatcher extends matcher_1.default { - match(filepath) { - const parts = filepath.split('/'); - const levels = parts.length; - const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels); - for (const pattern of patterns) { - const section = pattern.sections[0]; - /** - * In this case, the pattern has a globstar and we must read all directories unconditionally, - * but only if the level has reached the end of the first group. - * - * fixtures/{a,b}/** - * ^ true/false ^ always true - */ - if (!pattern.complete && levels > section.length) { - return true; - } - const match = parts.every((part, index) => { - const segment = pattern.segments[index]; - if (segment.dynamic && segment.patternRe.test(part)) { - return true; - } - if (!segment.dynamic && segment.pattern === part) { - return true; - } - return false; - }); - if (match) { - return true; - } - } - return false; - } -} -exports.default = PartialMatcher; + +Object.defineProperty(exports, "__esModule", { value: true }); +const matcher_1 = __webpack_require__(801); +class PartialMatcher extends matcher_1.default { + match(filepath) { + const parts = filepath.split('/'); + const levels = parts.length; + const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels); + for (const pattern of patterns) { + const section = pattern.sections[0]; + /** + * In this case, the pattern has a globstar and we must read all directories unconditionally, + * but only if the level has reached the end of the first group. + * + * fixtures/{a,b}/** + * ^ true/false ^ always true + */ + if (!pattern.complete && levels > section.length) { + return true; + } + const match = parts.every((part, index) => { + const segment = pattern.segments[index]; + if (segment.dynamic && segment.patternRe.test(part)) { + return true; + } + if (!segment.dynamic && segment.pattern === part) { + return true; + } + return false; + }); + if (match) { + return true; + } + } + return false; + } +} +exports.default = PartialMatcher; /***/ }), -/* 807 */ +/* 801 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(786); -class Matcher { - constructor(_patterns, _settings, _micromatchOptions) { - this._patterns = _patterns; - this._settings = _settings; - this._micromatchOptions = _micromatchOptions; - this._storage = []; - this._fillStorage(); - } - _fillStorage() { - /** - * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level). - * So, before expand patterns with brace expansion into separated patterns. - */ - const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns); - for (const pattern of patterns) { - const segments = this._getPatternSegments(pattern); - const sections = this._splitSegmentsIntoSections(segments); - this._storage.push({ - complete: sections.length <= 1, - pattern, - segments, - sections - }); - } - } - _getPatternSegments(pattern) { - const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions); - return parts.map((part) => { - const dynamic = utils.pattern.isDynamicPattern(part, this._settings); - if (!dynamic) { - return { - dynamic: false, - pattern: part - }; - } - return { - dynamic: true, - pattern: part, - patternRe: utils.pattern.makeRe(part, this._micromatchOptions) - }; - }); - } - _splitSegmentsIntoSections(segments) { - return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern)); - } -} -exports.default = Matcher; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(780); +class Matcher { + constructor(_patterns, _settings, _micromatchOptions) { + this._patterns = _patterns; + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this._storage = []; + this._fillStorage(); + } + _fillStorage() { + /** + * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level). + * So, before expand patterns with brace expansion into separated patterns. + */ + const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns); + for (const pattern of patterns) { + const segments = this._getPatternSegments(pattern); + const sections = this._splitSegmentsIntoSections(segments); + this._storage.push({ + complete: sections.length <= 1, + pattern, + segments, + sections + }); + } + } + _getPatternSegments(pattern) { + const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions); + return parts.map((part) => { + const dynamic = utils.pattern.isDynamicPattern(part, this._settings); + if (!dynamic) { + return { + dynamic: false, + pattern: part + }; + } + return { + dynamic: true, + pattern: part, + patternRe: utils.pattern.makeRe(part, this._micromatchOptions) + }; + }); + } + _splitSegmentsIntoSections(segments) { + return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern)); + } +} +exports.default = Matcher; /***/ }), -/* 808 */ +/* 802 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(786); -class EntryFilter { - constructor(_settings, _micromatchOptions) { - this._settings = _settings; - this._micromatchOptions = _micromatchOptions; - this.index = new Map(); - } - getFilter(positive, negative) { - const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions); - const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions); - return (entry) => this._filter(entry, positiveRe, negativeRe); - } - _filter(entry, positiveRe, negativeRe) { - if (this._settings.unique && this._isDuplicateEntry(entry)) { - return false; - } - if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { - return false; - } - if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) { - return false; - } - const filepath = this._settings.baseNameMatch ? entry.name : entry.path; - const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe); - if (this._settings.unique && isMatched) { - this._createIndexRecord(entry); - } - return isMatched; - } - _isDuplicateEntry(entry) { - return this.index.has(entry.path); - } - _createIndexRecord(entry) { - this.index.set(entry.path, undefined); - } - _onlyFileFilter(entry) { - return this._settings.onlyFiles && !entry.dirent.isFile(); - } - _onlyDirectoryFilter(entry) { - return this._settings.onlyDirectories && !entry.dirent.isDirectory(); - } - _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) { - if (!this._settings.absolute) { - return false; - } - const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath); - return utils.pattern.matchAny(fullpath, patternsRe); - } - _isMatchToPatterns(entryPath, patternsRe) { - const filepath = utils.path.removeLeadingDotSegment(entryPath); - return utils.pattern.matchAny(filepath, patternsRe); - } -} -exports.default = EntryFilter; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(780); +class EntryFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this.index = new Map(); + } + getFilter(positive, negative) { + const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions); + const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions); + return (entry) => this._filter(entry, positiveRe, negativeRe); + } + _filter(entry, positiveRe, negativeRe) { + if (this._settings.unique && this._isDuplicateEntry(entry)) { + return false; + } + if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { + return false; + } + if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) { + return false; + } + const filepath = this._settings.baseNameMatch ? entry.name : entry.path; + const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe); + if (this._settings.unique && isMatched) { + this._createIndexRecord(entry); + } + return isMatched; + } + _isDuplicateEntry(entry) { + return this.index.has(entry.path); + } + _createIndexRecord(entry) { + this.index.set(entry.path, undefined); + } + _onlyFileFilter(entry) { + return this._settings.onlyFiles && !entry.dirent.isFile(); + } + _onlyDirectoryFilter(entry) { + return this._settings.onlyDirectories && !entry.dirent.isDirectory(); + } + _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) { + if (!this._settings.absolute) { + return false; + } + const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath); + return utils.pattern.matchAny(fullpath, patternsRe); + } + _isMatchToPatterns(entryPath, patternsRe) { + const filepath = utils.path.removeLeadingDotSegment(entryPath); + return utils.pattern.matchAny(filepath, patternsRe); + } +} +exports.default = EntryFilter; /***/ }), -/* 809 */ +/* 803 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(786); -class ErrorFilter { - constructor(_settings) { - this._settings = _settings; - } - getFilter() { - return (error) => this._isNonFatalError(error); - } - _isNonFatalError(error) { - return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; - } -} -exports.default = ErrorFilter; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(780); +class ErrorFilter { + constructor(_settings) { + this._settings = _settings; + } + getFilter() { + return (error) => this._isNonFatalError(error); + } + _isNonFatalError(error) { + return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; + } +} +exports.default = ErrorFilter; /***/ }), -/* 810 */ +/* 804 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(786); -class EntryTransformer { - constructor(_settings) { - this._settings = _settings; - } - getTransformer() { - return (entry) => this._transform(entry); - } - _transform(entry) { - let filepath = entry.path; - if (this._settings.absolute) { - filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); - filepath = utils.path.unixify(filepath); - } - if (this._settings.markDirectories && entry.dirent.isDirectory()) { - filepath += '/'; - } - if (!this._settings.objectMode) { - return filepath; - } - return Object.assign(Object.assign({}, entry), { path: filepath }); - } -} -exports.default = EntryTransformer; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(780); +class EntryTransformer { + constructor(_settings) { + this._settings = _settings; + } + getTransformer() { + return (entry) => this._transform(entry); + } + _transform(entry) { + let filepath = entry.path; + if (this._settings.absolute) { + filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); + filepath = utils.path.unixify(filepath); + } + if (this._settings.markDirectories && entry.dirent.isDirectory()) { + filepath += '/'; + } + if (!this._settings.objectMode) { + return filepath; + } + return Object.assign(Object.assign({}, entry), { path: filepath }); + } +} +exports.default = EntryTransformer; /***/ }), -/* 811 */ +/* 805 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(173); -const stream_2 = __webpack_require__(802); -const provider_1 = __webpack_require__(804); -class ProviderStream extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new stream_2.default(this._settings); - } - read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const source = this.api(root, task, options); - const destination = new stream_1.Readable({ objectMode: true, read: () => { } }); - source - .once('error', (error) => destination.emit('error', error)) - .on('data', (entry) => destination.emit('data', options.transform(entry))) - .once('end', () => destination.emit('end')); - destination - .once('close', () => source.destroy()); - return destination; - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } -} -exports.default = ProviderStream; + +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = __webpack_require__(173); +const stream_2 = __webpack_require__(796); +const provider_1 = __webpack_require__(798); +class ProviderStream extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new stream_2.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const source = this.api(root, task, options); + const destination = new stream_1.Readable({ objectMode: true, read: () => { } }); + source + .once('error', (error) => destination.emit('error', error)) + .on('data', (entry) => destination.emit('data', options.transform(entry))) + .once('end', () => destination.emit('end')); + destination + .once('close', () => source.destroy()); + return destination; + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports.default = ProviderStream; /***/ }), -/* 812 */ +/* 806 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const sync_1 = __webpack_require__(813); -const provider_1 = __webpack_require__(804); -class ProviderSync extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new sync_1.default(this._settings); - } - read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const entries = this.api(root, task, options); - return entries.map(options.transform); - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } -} -exports.default = ProviderSync; + +Object.defineProperty(exports, "__esModule", { value: true }); +const sync_1 = __webpack_require__(807); +const provider_1 = __webpack_require__(798); +class ProviderSync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new sync_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = this.api(root, task, options); + return entries.map(options.transform); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports.default = ProviderSync; /***/ }), -/* 813 */ +/* 807 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(295); -const fsWalk = __webpack_require__(300); -const reader_1 = __webpack_require__(803); -class ReaderSync extends reader_1.default { - constructor() { - super(...arguments); - this._walkSync = fsWalk.walkSync; - this._statSync = fsStat.statSync; - } - dynamic(root, options) { - return this._walkSync(root, options); - } - static(patterns, options) { - const entries = []; - for (const pattern of patterns) { - const filepath = this._getFullEntryPath(pattern); - const entry = this._getEntry(filepath, pattern, options); - if (entry === null || !options.entryFilter(entry)) { - continue; - } - entries.push(entry); - } - return entries; - } - _getEntry(filepath, pattern, options) { - try { - const stats = this._getStat(filepath); - return this._makeEntry(stats, pattern); - } - catch (error) { - if (options.errorFilter(error)) { - return null; - } - throw error; - } - } - _getStat(filepath) { - return this._statSync(filepath, this._fsStatSettings); - } -} -exports.default = ReaderSync; + +Object.defineProperty(exports, "__esModule", { value: true }); +const fsStat = __webpack_require__(289); +const fsWalk = __webpack_require__(294); +const reader_1 = __webpack_require__(797); +class ReaderSync extends reader_1.default { + constructor() { + super(...arguments); + this._walkSync = fsWalk.walkSync; + this._statSync = fsStat.statSync; + } + dynamic(root, options) { + return this._walkSync(root, options); + } + static(patterns, options) { + const entries = []; + for (const pattern of patterns) { + const filepath = this._getFullEntryPath(pattern); + const entry = this._getEntry(filepath, pattern, options); + if (entry === null || !options.entryFilter(entry)) { + continue; + } + entries.push(entry); + } + return entries; + } + _getEntry(filepath, pattern, options) { + try { + const stats = this._getStat(filepath); + return this._makeEntry(stats, pattern); + } + catch (error) { + if (options.errorFilter(error)) { + return null; + } + throw error; + } + } + _getStat(filepath) { + return this._statSync(filepath, this._fsStatSettings); + } +} +exports.default = ReaderSync; /***/ }), -/* 814 */ +/* 808 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; -const fs = __webpack_require__(132); -const os = __webpack_require__(122); -/** - * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero. - * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107 - */ -const CPU_COUNT = Math.max(os.cpus().length, 1); -exports.DEFAULT_FILE_SYSTEM_ADAPTER = { - lstat: fs.lstat, - lstatSync: fs.lstatSync, - stat: fs.stat, - statSync: fs.statSync, - readdir: fs.readdir, - readdirSync: fs.readdirSync -}; -class Settings { - constructor(_options = {}) { - this._options = _options; - this.absolute = this._getValue(this._options.absolute, false); - this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); - this.braceExpansion = this._getValue(this._options.braceExpansion, true); - this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); - this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); - this.cwd = this._getValue(this._options.cwd, process.cwd()); - this.deep = this._getValue(this._options.deep, Infinity); - this.dot = this._getValue(this._options.dot, false); - this.extglob = this._getValue(this._options.extglob, true); - this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); - this.fs = this._getFileSystemMethods(this._options.fs); - this.globstar = this._getValue(this._options.globstar, true); - this.ignore = this._getValue(this._options.ignore, []); - this.markDirectories = this._getValue(this._options.markDirectories, false); - this.objectMode = this._getValue(this._options.objectMode, false); - this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); - this.onlyFiles = this._getValue(this._options.onlyFiles, true); - this.stats = this._getValue(this._options.stats, false); - this.suppressErrors = this._getValue(this._options.suppressErrors, false); - this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); - this.unique = this._getValue(this._options.unique, true); - if (this.onlyDirectories) { - this.onlyFiles = false; - } - if (this.stats) { - this.objectMode = true; - } - } - _getValue(option, value) { - return option === undefined ? value : option; - } - _getFileSystemMethods(methods = {}) { - return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); - } -} -exports.default = Settings; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; +const fs = __webpack_require__(132); +const os = __webpack_require__(122); +/** + * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero. + * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107 + */ +const CPU_COUNT = Math.max(os.cpus().length, 1); +exports.DEFAULT_FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + lstatSync: fs.lstatSync, + stat: fs.stat, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; +class Settings { + constructor(_options = {}) { + this._options = _options; + this.absolute = this._getValue(this._options.absolute, false); + this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); + this.braceExpansion = this._getValue(this._options.braceExpansion, true); + this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); + this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); + this.cwd = this._getValue(this._options.cwd, process.cwd()); + this.deep = this._getValue(this._options.deep, Infinity); + this.dot = this._getValue(this._options.dot, false); + this.extglob = this._getValue(this._options.extglob, true); + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); + this.fs = this._getFileSystemMethods(this._options.fs); + this.globstar = this._getValue(this._options.globstar, true); + this.ignore = this._getValue(this._options.ignore, []); + this.markDirectories = this._getValue(this._options.markDirectories, false); + this.objectMode = this._getValue(this._options.objectMode, false); + this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); + this.onlyFiles = this._getValue(this._options.onlyFiles, true); + this.stats = this._getValue(this._options.stats, false); + this.suppressErrors = this._getValue(this._options.suppressErrors, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); + this.unique = this._getValue(this._options.unique, true); + if (this.onlyDirectories) { + this.onlyFiles = false; + } + if (this.stats) { + this.objectMode = true; + } + } + _getValue(option, value) { + return option === undefined ? value : option; + } + _getFileSystemMethods(methods = {}) { + return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); + } +} +exports.default = Settings; /***/ }), -/* 815 */ +/* 809 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -94665,9 +92657,9 @@ exports.default = Settings; const {promisify} = __webpack_require__(113); const fs = __webpack_require__(132); const path = __webpack_require__(4); -const fastGlob = __webpack_require__(784); -const gitIgnore = __webpack_require__(335); -const slash = __webpack_require__(336); +const fastGlob = __webpack_require__(778); +const gitIgnore = __webpack_require__(329); +const slash = __webpack_require__(330); const DEFAULT_IGNORE = [ '**/node_modules/**', @@ -94784,7 +92776,7 @@ module.exports.sync = options => { /***/ }), -/* 816 */ +/* 810 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -94837,7 +92829,7 @@ module.exports = { /***/ }), -/* 817 */ +/* 811 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -94845,17 +92837,17 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildNonBazelProductionProjects", function() { return buildNonBazelProductionProjects; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getProductionProjects", function() { return getProductionProjects; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildProject", function() { return buildProject; }); -/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(571); +/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(565); /* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cpy__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(240); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(568); +/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(562); /* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(231); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(220); -/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(349); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(346); +/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(343); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(340); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License diff --git a/packages/kbn-react-field/BUILD.bazel b/packages/kbn-react-field/BUILD.bazel index d7645d86dbd1a..5165ca2fc90fc 100644 --- a/packages/kbn-react-field/BUILD.bazel +++ b/packages/kbn-react-field/BUILD.bazel @@ -49,7 +49,6 @@ TYPES_DEPS = [ "@npm//@types/classnames", "@npm//@types/react", "@npm//@elastic/eui", - "@npm//resize-observer-polyfill", ] jsts_transpiler( diff --git a/packages/kbn-react-field/tsconfig.json b/packages/kbn-react-field/tsconfig.json index 90c8a63c746f1..4d37e1825c85a 100644 --- a/packages/kbn-react-field/tsconfig.json +++ b/packages/kbn-react-field/tsconfig.json @@ -10,7 +10,6 @@ "types": [ "jest", "node", - "resize-observer-polyfill" ] }, "include": [ diff --git a/packages/kbn-securitysolution-autocomplete/BUILD.bazel b/packages/kbn-securitysolution-autocomplete/BUILD.bazel index ac90a0479ce2a..57ac8c62273e0 100644 --- a/packages/kbn-securitysolution-autocomplete/BUILD.bazel +++ b/packages/kbn-securitysolution-autocomplete/BUILD.bazel @@ -42,7 +42,6 @@ RUNTIME_DEPS = [ "@npm//enzyme", "@npm//moment", "@npm//react", - "@npm//resize-observer-polyfill", ] TYPES_DEPS = [ @@ -55,7 +54,6 @@ TYPES_DEPS = [ "@npm//@testing-library/react", "@npm//@testing-library/react-hooks", "@npm//moment", - "@npm//resize-observer-polyfill", "@npm//@types/enzyme", "@npm//@types/jest", "@npm//@types/node", diff --git a/packages/kbn-securitysolution-autocomplete/tsconfig.json b/packages/kbn-securitysolution-autocomplete/tsconfig.json index fa7eff8234011..b2e24676cdbd4 100644 --- a/packages/kbn-securitysolution-autocomplete/tsconfig.json +++ b/packages/kbn-securitysolution-autocomplete/tsconfig.json @@ -8,7 +8,7 @@ "sourceMap": true, "sourceRoot": "../../../../packages/kbn-securitysolution-autocomplete/src", "rootDir": "src", - "types": ["jest", "node", "resize-observer-polyfill"] + "types": ["jest", "node"] }, "include": ["src/**/*"], } diff --git a/packages/kbn-storybook/src/webpack.config.ts b/packages/kbn-storybook/src/webpack.config.ts index 53f9c82b86815..94b1a34728779 100644 --- a/packages/kbn-storybook/src/webpack.config.ts +++ b/packages/kbn-storybook/src/webpack.config.ts @@ -32,9 +32,11 @@ function isHtmlPlugin(plugin: any): plugin is { options: { template: string } } return !!(typeof plugin.options?.template === 'string'); } -function isBabelLoaderRule(rule: webpack.RuleSetRule): rule is webpack.RuleSetRule & { +interface BabelLoaderRule extends webpack.RuleSetRule { use: webpack.RuleSetLoader[]; -} { +} + +function isBabelLoaderRule(rule: webpack.RuleSetRule): rule is BabelLoaderRule { return !!( rule.use && Array.isArray(rule.use) && diff --git a/packages/kbn-test/src/jest/run.ts b/packages/kbn-test/src/jest/run.ts index 697402adf3dd1..26fa12497357c 100644 --- a/packages/kbn-test/src/jest/run.ts +++ b/packages/kbn-test/src/jest/run.ts @@ -36,8 +36,7 @@ declare global { interface Global {} interface InspectOptions {} - interface ConsoleConstructor - extends console.ConsoleConstructor {} + interface ConsoleConstructor extends console.ConsoleConstructor {} } } /* eslint-enable */ @@ -59,7 +58,7 @@ export function runJest(configName = 'jest.config.js') { const cwd: string = process.env.INIT_CWD || process.cwd(); if (!argv.config) { - testFiles = argv._.splice(2).map((p) => resolve(cwd, p)); + testFiles = argv._.splice(2).map((p) => resolve(cwd, p.toString())); const commonTestFiles = commonBasePath(testFiles); const testFilesProvided = testFiles.length > 0; diff --git a/packages/kbn-typed-react-router-config/BUILD.bazel b/packages/kbn-typed-react-router-config/BUILD.bazel index 7fccc53bd7449..b347915ae3310 100644 --- a/packages/kbn-typed-react-router-config/BUILD.bazel +++ b/packages/kbn-typed-react-router-config/BUILD.bazel @@ -41,6 +41,7 @@ TYPES_DEPS = [ "@npm//query-string", "@npm//utility-types", "@npm//@types/jest", + "@npm//@types/history", "@npm//@types/node", "@npm//@types/react-router-config", "@npm//@types/react-router-dom", diff --git a/packages/kbn-typed-react-router-config/src/create_router.test.tsx b/packages/kbn-typed-react-router-config/src/create_router.test.tsx index ac337f8bb5b87..e82fcf791804e 100644 --- a/packages/kbn-typed-react-router-config/src/create_router.test.tsx +++ b/packages/kbn-typed-react-router-config/src/create_router.test.tsx @@ -267,6 +267,7 @@ describe('createRouter', () => { const matches = router.matchRoutes('/', history.location); + // @ts-expect-error 4.3.5 upgrade - router doesn't seem able to merge properly when two routes match expect(matches[1]?.match.params).toEqual({ query: { rangeFrom: 'now-30m', @@ -285,6 +286,7 @@ describe('createRouter', () => { expect(matchedRoutes.length).toEqual(4); + // @ts-expect-error 4.3.5 upgrade - router doesn't seem able to merge properly when two routes match expect(matchedRoutes[matchedRoutes.length - 1].match).toEqual({ isExact: true, params: { diff --git a/packages/kbn-typed-react-router-config/src/create_router.ts b/packages/kbn-typed-react-router-config/src/create_router.ts index 89ff4fc6b0c6c..186f949d9c8e8 100644 --- a/packages/kbn-typed-react-router-config/src/create_router.ts +++ b/packages/kbn-typed-react-router-config/src/create_router.ts @@ -23,7 +23,7 @@ function toReactRouterPath(path: string) { return path.replace(/(?:{([^\/]+)})/g, ':$1'); } -export function createRouter(routes: TRoutes): Router { +export function createRouter(routes: TRoute[]): Router { const routesByReactRouterConfig = new Map(); const reactRouterConfigsByRoute = new Map(); @@ -181,10 +181,8 @@ export function createRouter(routes: TRoutes): Router { - return link(path, ...args); - }, + const router = { + link, getParams: (...args: any[]) => { const matches = matchRoutes(...args); return matches.length @@ -197,11 +195,13 @@ export function createRouter(routes: TRoutes): Router { return matchRoutes(...args) as any; }, - getRoutePath: (route) => { + getRoutePath: (route: Route) => { return reactRouterConfigsByRoute.get(route)!.path as string; }, getRoutesToMatch: (path: string) => { - return getRoutesToMatch(path) as unknown as FlattenRoutesOf; + return getRoutesToMatch(path) as unknown as FlattenRoutesOf; }, }; + + return router; } diff --git a/packages/kbn-typed-react-router-config/src/types/index.ts b/packages/kbn-typed-react-router-config/src/types/index.ts index c1ae5afd816ee..3c09b60054a0c 100644 --- a/packages/kbn-typed-react-router-config/src/types/index.ts +++ b/packages/kbn-typed-react-router-config/src/types/index.ts @@ -115,7 +115,7 @@ export interface RouteMatch { params: t.Type; } ? t.TypeOf - : {}; + : AnyObj; }; } @@ -160,10 +160,11 @@ interface ReadonlyPlainRoute { } export type Route = PlainRoute | ReadonlyPlainRoute; +type AnyObj = Record; interface DefaultOutput { - path: {}; - query: {}; + path: AnyObj; + query: AnyObj; } type OutputOfRouteMatch = TRouteMatch extends { @@ -190,20 +191,21 @@ type TypeOfRouteMatch = TRouteMatch extends { route: { params: t.Type }; } ? t.TypeOf - : {}; + : AnyObj; type TypeOfMatches = TRouteMatches extends [RouteMatch] ? TypeOfRouteMatch : TRouteMatches extends [RouteMatch, ...infer TNextRouteMatches] ? TypeOfRouteMatch & - (TNextRouteMatches extends RouteMatch[] ? TypeOfMatches : {}) - : {}; + (TNextRouteMatches extends RouteMatch[] ? TypeOfMatches : AnyObj) + : AnyObj; export type TypeOf< TRoutes extends Route[], TPath extends PathsOf, TWithDefaultOutput extends boolean = true -> = TypeOfMatches> & (TWithDefaultOutput extends true ? DefaultOutput : {}); +> = TypeOfMatches> & + (TWithDefaultOutput extends true ? DefaultOutput : AnyObj); export type TypeAsArgs = keyof TObject extends never ? [] @@ -276,7 +278,7 @@ type MapRoute = MaybeUnion< >; } > - : {} + : AnyObj >; type MapRoutes = TRoutes extends [Route] @@ -341,7 +343,7 @@ type MapRoutes = TRoutes extends [Route] MapRoute & MapRoute & MapRoute - : {}; + : AnyObj; // const element = null as any; diff --git a/packages/kbn-ui-shared-deps-npm/BUILD.bazel b/packages/kbn-ui-shared-deps-npm/BUILD.bazel index b75315120e90d..2beedafd699fd 100644 --- a/packages/kbn-ui-shared-deps-npm/BUILD.bazel +++ b/packages/kbn-ui-shared-deps-npm/BUILD.bazel @@ -53,7 +53,6 @@ RUNTIME_DEPS = [ "@npm//react-router", "@npm//react", "@npm//regenerator-runtime", - "@npm//resize-observer-polyfill", "@npm//rison-node", "@npm//rxjs", "@npm//styled-components", @@ -90,7 +89,6 @@ TYPES_DEPS = [ "@npm//react-router", "@npm//react-router-dom", "@npm//regenerator-runtime", - "@npm//resize-observer-polyfill", "@npm//rison-node", "@npm//rxjs", "@npm//styled-components", diff --git a/packages/kbn-ui-shared-deps-npm/tsconfig.json b/packages/kbn-ui-shared-deps-npm/tsconfig.json index be9a9462f76d8..107d82aa59ee8 100644 --- a/packages/kbn-ui-shared-deps-npm/tsconfig.json +++ b/packages/kbn-ui-shared-deps-npm/tsconfig.json @@ -11,7 +11,6 @@ "sourceRoot": "../../../../packages/kbn-ui-shared-deps-npm/src", "types": [ "node", - "resize-observer-polyfill" ] }, "include": [ diff --git a/packages/kbn-ui-shared-deps-src/tsconfig.json b/packages/kbn-ui-shared-deps-src/tsconfig.json index bfee34694748d..521fb122e4659 100644 --- a/packages/kbn-ui-shared-deps-src/tsconfig.json +++ b/packages/kbn-ui-shared-deps-src/tsconfig.json @@ -11,7 +11,6 @@ "sourceRoot": "../../../../packages/kbn-ui-shared-deps-src/src", "types": [ "node", - "resize-observer-polyfill" ] }, "include": [ diff --git a/src/core/public/application/scoped_history.ts b/src/core/public/application/scoped_history.ts index 2ab60e66b860f..284465c8f305b 100644 --- a/src/core/public/application/scoped_history.ts +++ b/src/core/public/application/scoped_history.ts @@ -57,7 +57,10 @@ export class ScopedHistory */ private blockUnregisterCallbacks: Set = new Set(); - constructor(private readonly parentHistory: History, private readonly basePath: string) { + constructor( + private readonly parentHistory: History, + private readonly basePath: string + ) { const parentPath = this.parentHistory.location.pathname; if (!parentPath.startsWith(basePath)) { throw new Error( @@ -75,10 +78,8 @@ export class ScopedHistory * * @param basePath the URL path scope for the sub history */ - public createSubHistory = ( - basePath: string - ): ScopedHistory => { - return new ScopedHistory(this, basePath); + public createSubHistory = (basePath: string) => { + return new ScopedHistory(this, basePath); }; /** diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index ceb65827cd9a4..1a2f9d4296f8a 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -43,7 +43,7 @@ interface ConstructorParams { kibanaVersion: string; } -interface StartDeps { +export interface StartDeps { application: InternalApplicationStart; docLinks: DocLinksStart; http: HttpStart; diff --git a/src/core/public/core_app/core_app.ts b/src/core/public/core_app/core_app.ts index 00532b9150aef..648677e67e1cf 100644 --- a/src/core/public/core_app/core_app.ts +++ b/src/core/public/core_app/core_app.ts @@ -26,14 +26,14 @@ import { import { renderApp as renderStatusApp } from './status'; import { DocLinksStart } from '../doc_links'; -interface SetupDeps { +export interface SetupDeps { application: InternalApplicationSetup; http: HttpSetup; injectedMetadata: InjectedMetadataSetup; notifications: NotificationsSetup; } -interface StartDeps { +export interface StartDeps { application: InternalApplicationStart; docLinks: DocLinksStart; http: HttpStart; diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index f99f621a52c83..24c085ef64de3 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -9,7 +9,7 @@ import { deepFreeze } from '@kbn/std'; import { InjectedMetadataSetup } from '../injected_metadata'; -interface StartDeps { +export interface StartDeps { injectedMetadata: InjectedMetadataSetup; } diff --git a/src/core/public/fatal_errors/fatal_errors_service.tsx b/src/core/public/fatal_errors/fatal_errors_service.tsx index 975c0160d83b2..262ee9e702f40 100644 --- a/src/core/public/fatal_errors/fatal_errors_service.tsx +++ b/src/core/public/fatal_errors/fatal_errors_service.tsx @@ -16,7 +16,7 @@ import { InjectedMetadataSetup } from '../injected_metadata'; import { FatalErrorsScreen } from './fatal_errors_screen'; import { FatalErrorInfo, getErrorInfo } from './get_error_info'; -interface Deps { +export interface Deps { i18n: I18nStart; injectedMetadata: InjectedMetadataSetup; } diff --git a/src/core/public/integrations/integrations_service.ts b/src/core/public/integrations/integrations_service.ts index d6f2b8c5fb2f7..7c52205022440 100644 --- a/src/core/public/integrations/integrations_service.ts +++ b/src/core/public/integrations/integrations_service.ts @@ -12,7 +12,7 @@ import { CoreService } from '../../types'; import { MomentService } from './moment'; import { StylesService } from './styles'; -interface Deps { +export interface Deps { uiSettings: IUiSettingsClient; } diff --git a/src/core/public/notifications/notifications_service.ts b/src/core/public/notifications/notifications_service.ts index 383fa2d1914cc..d31909a19ff75 100644 --- a/src/core/public/notifications/notifications_service.ts +++ b/src/core/public/notifications/notifications_service.ts @@ -15,11 +15,11 @@ import { ToastsService, ToastsSetup, ToastsStart } from './toasts'; import { IUiSettingsClient } from '../ui_settings'; import { OverlayStart } from '../overlays'; -interface SetupDeps { +export interface SetupDeps { uiSettings: IUiSettingsClient; } -interface StartDeps { +export interface StartDeps { i18n: I18nStart; overlays: OverlayStart; theme: ThemeServiceStart; diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 9bb65a9dd0b57..30225acb3dd8d 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -42,6 +42,7 @@ import { Request as Request_2 } from '@hapi/hapi'; import * as Rx from 'rxjs'; import { SchemaTypeError } from '@kbn/config-schema'; import type { ThemeVersion } from '@kbn/ui-shared-deps-npm'; +import { TransitionPromptHook } from 'history'; import type { TransportRequestOptions } from '@elastic/elasticsearch'; import type { TransportRequestParams } from '@elastic/elasticsearch'; import type { TransportResult } from '@elastic/elasticsearch'; @@ -1680,13 +1681,13 @@ export interface SavedObjectsUpdateOptions { // @public export class ScopedHistory implements History_2 { - constructor(parentHistory: History_2, basePath: string); + constructor(parentHistory: History_2, basePath: string); get action(): Action; - block: (prompt?: string | boolean | History_2.TransitionPromptHook | undefined) => UnregisterCallback; + block: (prompt?: string | boolean | TransitionPromptHook | undefined) => UnregisterCallback; createHref: (location: LocationDescriptorObject, { prependBasePath }?: { prependBasePath?: boolean | undefined; }) => Href; - createSubHistory: (basePath: string) => ScopedHistory; + createSubHistory: (basePath: string) => ScopedHistory; go: (n: number) => void; goBack: () => void; goForward: () => void; diff --git a/src/core/public/rendering/rendering_service.tsx b/src/core/public/rendering/rendering_service.tsx index 7c84146d1aa86..92c0f2a9b7fca 100644 --- a/src/core/public/rendering/rendering_service.tsx +++ b/src/core/public/rendering/rendering_service.tsx @@ -18,7 +18,7 @@ import type { I18nStart } from '../i18n'; import { CoreContextProvider } from '../utils'; import { AppWrapper } from './app_containers'; -interface StartDeps { +export interface StartDeps { application: InternalApplicationStart; chrome: InternalChromeStart; overlays: OverlayStart; diff --git a/src/core/public/theme/theme_service.ts b/src/core/public/theme/theme_service.ts index fc67ac4a595eb..bdb00ee4fdce9 100644 --- a/src/core/public/theme/theme_service.ts +++ b/src/core/public/theme/theme_service.ts @@ -11,7 +11,7 @@ import { shareReplay, takeUntil } from 'rxjs/operators'; import { InjectedMetadataSetup } from '../injected_metadata'; import type { CoreTheme, ThemeServiceSetup, ThemeServiceStart } from './types'; -interface SetupDeps { +export interface SetupDeps { injectedMetadata: InjectedMetadataSetup; } diff --git a/src/core/public/ui_settings/ui_settings_service.ts b/src/core/public/ui_settings/ui_settings_service.ts index 6bbbed9a1ca60..1a3f275aa31ed 100644 --- a/src/core/public/ui_settings/ui_settings_service.ts +++ b/src/core/public/ui_settings/ui_settings_service.ts @@ -15,7 +15,7 @@ import { UiSettingsApi } from './ui_settings_api'; import { UiSettingsClient } from './ui_settings_client'; import { IUiSettingsClient } from './types'; -interface UiSettingsServiceDeps { +export interface UiSettingsServiceDeps { http: HttpSetup; injectedMetadata: InjectedMetadataSetup; } diff --git a/src/core/server/context/container/context.mock.ts b/src/core/server/context/container/context.mock.ts index 9996d609fc074..c8fcea83eae45 100644 --- a/src/core/server/context/container/context.mock.ts +++ b/src/core/server/context/container/context.mock.ts @@ -12,7 +12,6 @@ export type ContextContainerMock = jest.Mocked; const createContextMock = (mockContext: any = {}) => { const contextMock: ContextContainerMock = { - // @ts-expect-error since ContextContainerMock cannot infer ContextName and fallsback to never registerContext: jest.fn(), createHandler: jest.fn(), }; diff --git a/src/core/server/context/context_service.ts b/src/core/server/context/context_service.ts index 9e77786c1562c..b2948a4d59129 100644 --- a/src/core/server/context/context_service.ts +++ b/src/core/server/context/context_service.ts @@ -12,7 +12,7 @@ import { CoreContext } from '../core_context'; type PrebootDeps = SetupDeps; -interface SetupDeps { +export interface SetupDeps { pluginDependencies: ReadonlyMap; } diff --git a/src/core/server/http/http_service.mock.ts b/src/core/server/http/http_service.mock.ts index 894ff38e12a35..1b6aa2de3c192 100644 --- a/src/core/server/http/http_service.mock.ts +++ b/src/core/server/http/http_service.mock.ts @@ -81,7 +81,6 @@ const createAuthMock = () => { const createInternalPrebootContractMock = () => { const mock: InternalHttpServicePrebootMock = { registerRoutes: jest.fn(), - // @ts-expect-error tsc cannot infer ContextName and uses never registerRouteHandlerContext: jest.fn(), registerStaticDir: jest.fn(), basePath: createBasePathMock(), @@ -89,6 +88,15 @@ const createInternalPrebootContractMock = () => { externalUrl: ExternalUrlConfig.DEFAULT, auth: createAuthMock(), getServerInfo: jest.fn(), + server: { + name: 'http-preboot-server-test', + version: 'kibana', + route: jest.fn(), + start: jest.fn(), + stop: jest.fn(), + config: jest.fn().mockReturnValue(configMock.create()), + // @ts-expect-error somehow it thinks that `Server` isn't a `Construtable` + } as unknown as jest.MockedClass, }; return mock; }; @@ -122,7 +130,6 @@ const createInternalSetupContractMock = () => { registerOnPreAuth: jest.fn(), registerAuth: jest.fn(), registerOnPostAuth: jest.fn(), - // @ts-expect-error tsc cannot infer ContextName and uses never registerRouteHandlerContext: jest.fn(), registerOnPreResponse: jest.fn(), createRouter: jest.fn().mockImplementation(() => mockRouter.create({})), @@ -134,6 +141,7 @@ const createInternalSetupContractMock = () => { getAuthHeaders: jest.fn(), getServerInfo: jest.fn(), registerPrebootRoutes: jest.fn(), + registerRouterAfterListening: jest.fn(), }; mock.createCookieSessionStorageFactory.mockResolvedValue(sessionStorageMock.createFactory()); mock.createRouter.mockImplementation(() => mockRouter.create()); @@ -160,7 +168,6 @@ const createSetupContractMock = () => { basePath: internalMock.basePath, csp: CspConfig.DEFAULT, createRouter: jest.fn(), - // @ts-expect-error tsc cannot infer ContextName and uses never registerRouteHandlerContext: jest.fn(), auth: { get: internalMock.auth.get, diff --git a/src/core/server/http/http_service.ts b/src/core/server/http/http_service.ts index 98ae0f8b81aa6..ca031e8ab282b 100644 --- a/src/core/server/http/http_service.ts +++ b/src/core/server/http/http_service.ts @@ -40,11 +40,11 @@ import { ExternalUrlConfig, } from '../external_url'; -interface PrebootDeps { +export interface PrebootDeps { context: InternalContextPreboot; } -interface SetupDeps { +export interface SetupDeps { context: ContextSetup; executionContext: InternalExecutionContextSetup; } diff --git a/src/core/server/http/router/headers.ts b/src/core/server/http/router/headers.ts index 715337ba813b5..89a32d6dc5d2f 100644 --- a/src/core/server/http/router/headers.ts +++ b/src/core/server/http/router/headers.ts @@ -9,6 +9,16 @@ import { IncomingHttpHeaders } from 'http'; import { pick } from '@kbn/std'; +/** + * Converts an object type to a new object type where each string + * key is copied to the values of the object, and non string keys are + * given a `never` value. This allows us to map over the values and + * get the list of all string keys on a type in `KnownKeys` + */ +type StringKeysAsVals = { + [K in keyof T]: string extends K ? never : number extends K ? never : K; +}; + /** * Creates a Union type of all known keys of a given interface. * @example @@ -21,11 +31,7 @@ import { pick } from '@kbn/std'; * type PersonKnownKeys = KnownKeys; // "age" | "name" * ``` */ -type KnownKeys = { - [K in keyof T]: string extends K ? never : number extends K ? never : K; -} extends { [_ in keyof T]: infer U } - ? U - : never; +type KnownKeys = StringKeysAsVals extends { [_ in keyof T]: infer U } ? U : never; /** * Set of well-known HTTP headers. diff --git a/src/core/server/i18n/i18n_service.ts b/src/core/server/i18n/i18n_service.ts index 02a809b3c2c36..5772703a5a6b8 100644 --- a/src/core/server/i18n/i18n_service.ts +++ b/src/core/server/i18n/i18n_service.ts @@ -16,12 +16,12 @@ import { getKibanaTranslationFiles } from './get_kibana_translation_files'; import { initTranslations } from './init_translations'; import { registerRoutes } from './routes'; -interface PrebootDeps { +export interface PrebootDeps { http: InternalHttpServicePreboot; pluginPaths: string[]; } -interface SetupDeps { +export interface SetupDeps { http: InternalHttpServiceSetup; pluginPaths: string[]; } diff --git a/src/core/server/logging/logging_service.ts b/src/core/server/logging/logging_service.ts index 6c3eee4981725..f5c6bbf8e9422 100644 --- a/src/core/server/logging/logging_service.ts +++ b/src/core/server/logging/logging_service.ts @@ -49,7 +49,7 @@ export interface InternalLoggingServicePreboot { /** @internal */ export type InternalLoggingServiceSetup = InternalLoggingServicePreboot; -interface PrebootDeps { +export interface PrebootDeps { loggingSystem: ILoggingSystem; } diff --git a/src/core/server/metrics/metrics_service.ts b/src/core/server/metrics/metrics_service.ts index 8e9604b50fb57..30609837447d1 100644 --- a/src/core/server/metrics/metrics_service.ts +++ b/src/core/server/metrics/metrics_service.ts @@ -17,7 +17,7 @@ import { OpsMetricsCollector } from './ops_metrics_collector'; import { opsConfig, OpsConfigType } from './ops_config'; import { getEcsOpsMetricsLog } from './logging'; -interface MetricsServiceSetupDeps { +export interface MetricsServiceSetupDeps { http: InternalHttpServiceSetup; } diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index fa461946d397f..d4393791a74fa 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -33,7 +33,6 @@ import type { KibanaClient } from '@elastic/elasticsearch/lib/api/kibana'; import { Logger } from '@kbn/logging'; import { LoggerFactory } from '@kbn/logging'; import { LogLevel as LogLevel_2 } from '@kbn/logging'; -import { LogLevelId } from '@kbn/logging'; import { LogMeta } from '@kbn/logging'; import { LogRecord } from '@kbn/logging'; import type { MaybePromise } from '@kbn/utility-types'; @@ -1372,14 +1371,32 @@ export type KibanaResponseFactory = typeof kibanaResponseFactory; export const kibanaResponseFactory: { custom: | Error | Buffer | Stream | { message: string | Error; - attributes?: Record | undefined; + attributes?: ResponseErrorAttributes | undefined; } | undefined>(options: CustomHttpResponseOptions) => KibanaResponse; - badRequest: (options?: ErrorHttpResponseOptions) => KibanaResponse; - unauthorized: (options?: ErrorHttpResponseOptions) => KibanaResponse; - forbidden: (options?: ErrorHttpResponseOptions) => KibanaResponse; - notFound: (options?: ErrorHttpResponseOptions) => KibanaResponse; - conflict: (options?: ErrorHttpResponseOptions) => KibanaResponse; - customError: (options: CustomHttpResponseOptions) => KibanaResponse; + badRequest: (options?: ErrorHttpResponseOptions) => KibanaResponse; + unauthorized: (options?: ErrorHttpResponseOptions) => KibanaResponse; + forbidden: (options?: ErrorHttpResponseOptions) => KibanaResponse; + notFound: (options?: ErrorHttpResponseOptions) => KibanaResponse; + conflict: (options?: ErrorHttpResponseOptions) => KibanaResponse; + customError: (options: CustomHttpResponseOptions) => KibanaResponse; redirected: (options: RedirectResponseOptions) => KibanaResponse | Buffer | Stream>; ok: (options?: HttpResponseOptions) => KibanaResponse | Buffer | Stream>; accepted: (options?: HttpResponseOptions) => KibanaResponse | Buffer | Stream>; diff --git a/src/core/server/status/status_service.ts b/src/core/server/status/status_service.ts index 29cc01da3f63d..63a1b02d5b2e7 100644 --- a/src/core/server/status/status_service.ts +++ b/src/core/server/status/status_service.ts @@ -32,7 +32,7 @@ interface StatusLogMeta extends LogMeta { kibana: { status: ServiceStatus }; } -interface SetupDeps { +export interface SetupDeps { elasticsearch: Pick; environment: InternalEnvironmentServiceSetup; pluginDependencies: ReadonlyMap; diff --git a/src/core/types/elasticsearch/search.ts b/src/core/types/elasticsearch/search.ts index 2e79bf6fea57c..c28bf3c258f77 100644 --- a/src/core/types/elasticsearch/search.ts +++ b/src/core/types/elasticsearch/search.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { ValuesType } from 'utility-types'; +import { ValuesType, UnionToIntersection } from 'utility-types'; import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; type InvalidAggregationRequest = unknown; @@ -21,11 +21,15 @@ type KeyOfSource = Record< (T extends Record ? null : never) | string | number >; -type KeysOfSources = T extends [infer U, ...infer V] - ? KeyOfSource & KeysOfSources - : T extends Array - ? KeyOfSource - : {}; +type KeysOfSources = T extends [any] + ? KeyOfSource + : T extends [any, any] + ? KeyOfSource & KeyOfSource + : T extends [any, any, any] + ? KeyOfSource & KeyOfSource & KeyOfSource + : T extends [any, any, any, any] + ? KeyOfSource & KeyOfSource & KeyOfSource & KeyOfSource + : Record; type CompositeKeysOf = TAggregationContainer extends { @@ -36,6 +40,13 @@ type CompositeKeysOf = + TAggregationContainer extends { top_metrics: { metrics: { field: infer TField } } } + ? TField + : TAggregationContainer extends { top_metrics: { metrics: Array<{ field: infer TField }> } } + ? TField + : string; + type ValueTypeOfField = T extends Record ? ValuesType : T extends Array @@ -532,12 +543,7 @@ export type AggregateOf< top_metrics: { top: Array<{ sort: number[] | string[]; - metrics: Record< - TAggregationContainer extends Record }> - ? TKeys - : string, - string | number | null - >; + metrics: Record, string | number | null>; }>; }; weighted_avg: { value: number | null }; @@ -547,8 +553,8 @@ export type AggregateOf< // t_test: {} not defined })[ValidAggregationKeysOf & AggregationTypeName]; -type AggregateOfMap = { - [TAggregationName in keyof TAggregationMap]: TAggregationMap[TAggregationName] extends estypes.AggregationsAggregationContainer +type AggregateOfMap = { + [TAggregationName in keyof TAggregationMap]: Required[TAggregationName] extends estypes.AggregationsAggregationContainer ? AggregateOf : never; // using never means we effectively ignore optional keys, using {} creates a union type of { ... } | {} }; @@ -567,7 +573,7 @@ type SearchResponseOf< > = SubAggregateOf; // if aggregation response cannot be inferred, fall back to unknown -type WrapAggregationResponse = keyof T extends never +type WrapAggregationResponse = keyof UnionToIntersection extends never ? { aggregations?: unknown } : { aggregations?: T }; diff --git a/src/dev/build/build_distributables.ts b/src/dev/build/build_distributables.ts index a5ed81c15c9b1..9e3a419d63964 100644 --- a/src/dev/build/build_distributables.ts +++ b/src/dev/build/build_distributables.ts @@ -8,7 +8,7 @@ import { ToolingLog } from '@kbn/dev-utils'; -import { Config, createRunner } from './lib'; +import { Config, createRunner, Task, GlobalTask } from './lib'; import * as Tasks from './tasks'; export interface BuildOptions { @@ -32,12 +32,12 @@ export interface BuildOptions { createExamplePlugins: boolean; } -export async function buildDistributables(log: ToolingLog, options: BuildOptions) { +export async function buildDistributables(log: ToolingLog, options: BuildOptions): Promise { log.verbose('building distributables with options:', options); - const config = await Config.create(options); + const config: Config = await Config.create(options); - const run = createRunner({ + const run: (task: Task | GlobalTask) => Promise = createRunner({ config, log, }); diff --git a/src/dev/precommit_hook/casing_check_config.js b/src/dev/precommit_hook/casing_check_config.js index f5c1755b228e9..e3d9688e60962 100644 --- a/src/dev/precommit_hook/casing_check_config.js +++ b/src/dev/precommit_hook/casing_check_config.js @@ -97,6 +97,7 @@ export const IGNORE_DIRECTORY_GLOBS = [ 'packages/kbn-pm/src/utils/__fixtures__/*', 'x-pack/dev-tools', 'packages/kbn-optimizer/src/__fixtures__/mock_repo/x-pack', + 'typings/*', ]; /** diff --git a/src/dev/typescript/run_type_check_cli.ts b/src/dev/typescript/run_type_check_cli.ts index 27998f881a03d..5888e6eaf6806 100644 --- a/src/dev/typescript/run_type_check_cli.ts +++ b/src/dev/typescript/run_type_check_cli.ts @@ -75,7 +75,7 @@ export async function runTypeCheckCli() { [ '--max-old-space-size=5120', require.resolve('typescript/bin/tsc'), - ...['--project', p.tsConfigPath, ...(flags.verbose ? ['--verbose'] : [])], + ...['--project', p.tsConfigPath], ...tscArgs, ], { diff --git a/src/plugins/console/public/application/models/sense_editor/sense_editor.ts b/src/plugins/console/public/application/models/sense_editor/sense_editor.ts index 0f65d3f1e33e2..01a7786c5d856 100644 --- a/src/plugins/console/public/application/models/sense_editor/sense_editor.ts +++ b/src/plugins/console/public/application/models/sense_editor/sense_editor.ts @@ -492,7 +492,9 @@ export class SenseEditor { return result.join('\n'); }; - updateActionsBar = () => this.coreEditor.legacyUpdateUI(this.currentReqRange); + updateActionsBar = () => { + return this.coreEditor.legacyUpdateUI(this.currentReqRange); + }; getCoreEditor() { return this.coreEditor; diff --git a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx index 09ac0c1dd94bb..8be3526e3ad29 100644 --- a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx +++ b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx @@ -17,7 +17,7 @@ import classNames from 'classnames'; import _ from 'lodash'; import React from 'react'; import { Subscription } from 'rxjs'; -import ReactGridLayout, { Layout } from 'react-grid-layout'; +import ReactGridLayout, { Layout, ReactGridLayoutProps } from 'react-grid-layout'; import { GridData } from '../../../../common'; import { ViewMode } from '../../../services/embeddable'; import { DASHBOARD_GRID_COLUMN_COUNT, DASHBOARD_GRID_HEIGHT } from '../dashboard_constants'; @@ -54,9 +54,9 @@ function ResponsiveGrid({ size: { width: number }; isViewMode: boolean; layout: Layout[]; - onLayoutChange: () => void; + onLayoutChange: ReactGridLayoutProps['onLayoutChange']; children: JSX.Element[]; - maximizedPanelId: string; + maximizedPanelId?: string; useMargins: boolean; }) { // This is to prevent a bug where view mode changes when the panel is expanded. View mode changes will trigger diff --git a/src/plugins/data/public/search/search_interceptor/search_interceptor.ts b/src/plugins/data/public/search/search_interceptor/search_interceptor.ts index 180e826b5bc4e..9e968c9bae8a0 100644 --- a/src/plugins/data/public/search/search_interceptor/search_interceptor.ts +++ b/src/plugins/data/public/search/search_interceptor/search_interceptor.ts @@ -383,7 +383,7 @@ export class SearchInterceptor { private showTimeoutErrorMemoized = memoize( this.showTimeoutErrorToast, - (_: SearchTimeoutError, sessionId: string) => { + (_: SearchTimeoutError, sessionId?: string) => { return sessionId; } ); @@ -400,12 +400,7 @@ export class SearchInterceptor { ); }; - private showRestoreWarning = memoize( - this.showRestoreWarningToast, - (_: SearchTimeoutError, sessionId: string) => { - return sessionId; - } - ); + private showRestoreWarning = memoize(this.showRestoreWarningToast); /** * Show one error notification per session. diff --git a/src/plugins/data/public/ui/search_bar/search_bar.tsx b/src/plugins/data/public/ui/search_bar/search_bar.tsx index 9478d84741b7e..385f052adece6 100644 --- a/src/plugins/data/public/ui/search_bar/search_bar.tsx +++ b/src/plugins/data/public/ui/search_bar/search_bar.tsx @@ -25,7 +25,7 @@ import { FilterBar } from '../filter_bar/filter_bar'; import { SavedQueryMeta, SaveQueryForm } from '../saved_query_form'; import { SavedQueryManagementComponent } from '../saved_query_management'; -interface SearchBarInjectedDeps { +export interface SearchBarInjectedDeps { kibana: KibanaReactContextValue; intl: InjectedIntl; timeHistory: TimeHistoryContract; diff --git a/src/plugins/data/server/search/collectors/usage.ts b/src/plugins/data/server/search/collectors/usage.ts index f9d703900fc04..836ff33b335c4 100644 --- a/src/plugins/data/server/search/collectors/usage.ts +++ b/src/plugins/data/server/search/collectors/usage.ts @@ -62,15 +62,15 @@ export function usageProvider(core: CoreSetup): SearchUsage { { maxWait: 5000 } ); - const trackSuccess = (duration: number) => { + const trackSuccess = async (duration: number) => { collectedUsage.successCount++; collectedUsage.totalDuration += duration; - return updateSearchUsage(); + return await updateSearchUsage(); }; - const trackError = () => { + const trackError = async () => { collectedUsage.errorCount++; - return updateSearchUsage(); + return await updateSearchUsage(); }; return { trackSuccess, trackError }; diff --git a/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/number/number.tsx b/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/number/number.tsx index 4a86d8322b9ef..dfbd43f99142c 100644 --- a/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/number/number.tsx +++ b/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/number/number.tsx @@ -26,7 +26,7 @@ export class NumberFormatEditor extends DefaultFormatEditor; + declare context: React.ContextType; state = { ...defaultState, sampleInputs: [10000, 12.345678, -1, -999, 0.52], diff --git a/src/plugins/data_view_management/public/components/field_editor/components/scripting_help/test_script.tsx b/src/plugins/data_view_management/public/components/field_editor/components/scripting_help/test_script.tsx index 76c460de4ed42..36e61af6cea33 100644 --- a/src/plugins/data_view_management/public/components/field_editor/components/scripting_help/test_script.tsx +++ b/src/plugins/data_view_management/public/components/field_editor/components/scripting_help/test_script.tsx @@ -51,7 +51,7 @@ interface TestScriptState { export class TestScript extends Component { static contextType = contextType; - public readonly context!: IndexPatternManagmentContextValue; + public declare readonly context: IndexPatternManagmentContextValue; defaultProps = { name: 'myScriptedField', diff --git a/src/plugins/data_view_management/public/components/field_editor/field_editor.tsx b/src/plugins/data_view_management/public/components/field_editor/field_editor.tsx index ceaad76d6d124..5beb4fb989d5b 100644 --- a/src/plugins/data_view_management/public/components/field_editor/field_editor.tsx +++ b/src/plugins/data_view_management/public/components/field_editor/field_editor.tsx @@ -125,7 +125,7 @@ export interface FieldEdiorProps { export class FieldEditor extends PureComponent { static contextType = contextType; - public readonly context!: IndexPatternManagmentContextValue; + public declare readonly context: IndexPatternManagmentContextValue; supportedLangs: estypes.ScriptLanguage[] = []; deprecatedLangs: estypes.ScriptLanguage[] = []; diff --git a/src/plugins/discover/public/application/main/services/discover_search_session.ts b/src/plugins/discover/public/application/main/services/discover_search_session.ts index cace655a82a0f..c864c06e4003c 100644 --- a/src/plugins/discover/public/application/main/services/discover_search_session.ts +++ b/src/plugins/discover/public/application/main/services/discover_search_session.ts @@ -31,8 +31,10 @@ export class DiscoverSearchSessionManager { * skips if `searchSessionId` matches current search session id */ readonly newSearchSessionIdFromURL$: Rx.Observable; + private readonly deps: DiscoverSearchSessionManagerDeps; - constructor(private readonly deps: DiscoverSearchSessionManagerDeps) { + constructor(deps: DiscoverSearchSessionManagerDeps) { + this.deps = deps; this.newSearchSessionIdFromURL$ = createQueryParamObservable( this.deps.history, SEARCH_SESSION_ID_QUERY_PARAM diff --git a/src/plugins/discover/public/build_services.ts b/src/plugins/discover/public/build_services.ts index b86212251cb74..9cc2eb78aafbe 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -40,6 +40,10 @@ import { EmbeddableStart } from '../../embeddable/public'; import type { SpacesApi } from '../../../../x-pack/plugins/spaces/public'; +export interface HistoryLocationState { + referrer: string; +} + export interface DiscoverServices { addBasePath: (path: string) => string; capabilities: Capabilities; @@ -48,7 +52,7 @@ export interface DiscoverServices { data: DataPublicPluginStart; docLinks: DocLinksStart; embeddable: EmbeddableStart; - history: () => History; + history: () => History; theme: ChartsPluginStart['theme']; filterManager: FilterManager; fieldFormats: FieldFormatsStart; diff --git a/src/plugins/discover/public/kibana_services.ts b/src/plugins/discover/public/kibana_services.ts index 12b0a77a7865d..ffdfd82058693 100644 --- a/src/plugins/discover/public/kibana_services.ts +++ b/src/plugins/discover/public/kibana_services.ts @@ -10,7 +10,7 @@ import { once } from 'lodash'; import { createHashHistory } from 'history'; import type { ScopedHistory, AppMountParameters } from 'kibana/public'; import type { UiActionsStart } from 'src/plugins/ui_actions/public'; -import { DiscoverServices } from './build_services'; +import { DiscoverServices, HistoryLocationState } from './build_services'; import { createGetterSetter } from '../../kibana_utils/public'; import { DocViewsRegistry } from './services/doc_views/doc_views_registry'; @@ -46,7 +46,7 @@ export const [getDocViewsRegistry, setDocViewsRegistry] = * Makes sure discover and context are using one instance of history. */ export const getHistory = once(() => { - const history = createHashHistory(); + const history = createHashHistory(); history.listen(() => { // keep at least one listener so that `history.location` always in sync }); diff --git a/src/plugins/embeddable/public/lib/attribute_service/attribute_service.tsx b/src/plugins/embeddable/public/lib/attribute_service/attribute_service.tsx index 507d2be7198d5..9a575a9446a01 100644 --- a/src/plugins/embeddable/public/lib/attribute_service/attribute_service.tsx +++ b/src/plugins/embeddable/public/lib/attribute_service/attribute_service.tsx @@ -94,7 +94,7 @@ export class AttributeService< ? await this.options.unwrapMethod(input.savedObjectId) : await this.defaultUnwrapMethod(input); } - return { attributes: input[ATTRIBUTE_SERVICE_KEY] }; + return { attributes: (input as ValType)[ATTRIBUTE_SERVICE_KEY] }; } public async wrapAttributes( @@ -141,7 +141,7 @@ export class AttributeService< getInputAsValueType = async (input: ValType | RefType): Promise => { if (!this.inputIsRefType(input)) { - return input; + return input as ValType; } const { attributes } = await this.unwrapAttributes(input); const { savedObjectId, ...originalInputToPropagate } = input; @@ -162,7 +162,7 @@ export class AttributeService< const onSave = async (props: OnSaveProps): Promise => { await this.options.checkForDuplicateTitle(props); try { - const newAttributes = { ...input[ATTRIBUTE_SERVICE_KEY] }; + const newAttributes = { ...(input as ValType)[ATTRIBUTE_SERVICE_KEY] }; newAttributes.title = props.newTitle; const wrappedInput = (await this.wrapAttributes(newAttributes, true)) as RefType; @@ -182,7 +182,11 @@ export class AttributeService< reject()} - title={get(saveOptions, 'saveModalTitle', input[ATTRIBUTE_SERVICE_KEY].title)} + title={get( + saveOptions, + 'saveModalTitle', + (input as ValType)[ATTRIBUTE_SERVICE_KEY].title + )} showCopyOnSave={false} objectType={this.type} showDescription={false} diff --git a/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts b/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts index 26d366bb8dabe..fe471ef853b23 100644 --- a/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts +++ b/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts @@ -29,15 +29,17 @@ export const EMBEDDABLE_STATE_TRANSFER_STORAGE_KEY = 'EMBEDDABLE_STATE_TRANSFER' export class EmbeddableStateTransfer { public isTransferInProgress: boolean; private storage: Storage; + private appList: ReadonlyMap | undefined; constructor( private navigateToApp: ApplicationStart['navigateToApp'], currentAppId$: ApplicationStart['currentAppId$'], - private appList?: ReadonlyMap | undefined, + appList?: ReadonlyMap | undefined, customStorage?: Storage ) { this.storage = customStorage ? customStorage : new Storage(sessionStorage); this.isTransferInProgress = false; + this.appList = appList; currentAppId$.subscribe(() => { this.isTransferInProgress = false; }); diff --git a/src/plugins/expressions/common/execution/execution_contract.ts b/src/plugins/expressions/common/execution/execution_contract.ts index 14ab7bebbf057..69587c58f1045 100644 --- a/src/plugins/expressions/common/execution/execution_contract.ts +++ b/src/plugins/expressions/common/execution/execution_contract.ts @@ -24,7 +24,11 @@ export class ExecutionContract) {} + protected readonly execution: Execution; + + constructor(execution: Execution) { + this.execution = execution; + } /** * Cancel the execution of the expression. This will set abort signal diff --git a/src/plugins/expressions/common/expression_types/expression_type.ts b/src/plugins/expressions/common/expression_types/expression_type.ts index d179beeb76860..bf8a96a4ab1e6 100644 --- a/src/plugins/expressions/common/expression_types/expression_type.ts +++ b/src/plugins/expressions/common/expression_types/expression_type.ts @@ -30,8 +30,9 @@ export class ExpressionType { */ serialize?: (value: Serializable) => unknown; deserialize?: (serialized: unknown[]) => Serializable; + private readonly definition: AnyExpressionTypeDefinition; - constructor(private readonly definition: AnyExpressionTypeDefinition) { + constructor(definition: AnyExpressionTypeDefinition) { const { name, help, deserialize, serialize, validate } = definition; this.name = name; @@ -43,6 +44,7 @@ export class ExpressionType { this.serialize = serialize; this.deserialize = deserialize; + this.definition = definition; } getToFn = ( diff --git a/src/plugins/field_formats/common/field_formats_registry.ts b/src/plugins/field_formats/common/field_formats_registry.ts index 3d856e4686126..19af3a1f976ab 100644 --- a/src/plugins/field_formats/common/field_formats_registry.ts +++ b/src/plugins/field_formats/common/field_formats_registry.ts @@ -177,7 +177,7 @@ export class FieldFormatsRegistry { return new ConcreteFieldFormat(params, this.getConfig); }, - (formatId: FieldFormatId, params: FieldFormatParams) => + (formatId: FieldFormatId, params?: FieldFormatParams) => JSON.stringify({ formatId, ...params, @@ -212,10 +212,10 @@ export class FieldFormatsRegistry { * https://lodash.com/docs#memoize * * @param {KBN_FIELD_TYPES} fieldType - * @param {ES_FIELD_TYPES[]} esTypes + * @param {ES_FIELD_TYPES[] | undefined} esTypes * @return {String} */ - getDefaultInstanceCacheResolver(fieldType: KBN_FIELD_TYPES, esTypes: ES_FIELD_TYPES[]): string { + getDefaultInstanceCacheResolver(fieldType: KBN_FIELD_TYPES, esTypes?: ES_FIELD_TYPES[]): string { // @ts-ignore return Array.isArray(esTypes) && esTypes.indexOf(fieldType) === -1 ? [fieldType, ...esTypes].join('-') diff --git a/src/plugins/input_control_vis/public/components/vis/input_control_vis.tsx b/src/plugins/input_control_vis/public/components/vis/input_control_vis.tsx index 956a6c55b61ba..faeae649021df 100644 --- a/src/plugins/input_control_vis/public/components/vis/input_control_vis.tsx +++ b/src/plugins/input_control_vis/public/components/vis/input_control_vis.tsx @@ -25,6 +25,10 @@ function isRangeControl(control: RangeControl | ListControl): control is RangeCo return control.type === CONTROL_TYPES.RANGE; } +interface UnknownControl { + type: string; +} + interface InputControlVisProps { stageFilter: (controlIndex: number, newValue: any) => void; submitFilters: () => void; @@ -90,7 +94,7 @@ export class InputControlVis extends Component { /> ); } else { - throw new Error(`Unhandled control type ${control!.type}`); + throw new Error(`Unhandled control type ${(control as UnknownControl)!.type}`); } return ( diff --git a/src/plugins/kibana_overview/public/components/add_data/add_data.tsx b/src/plugins/kibana_overview/public/components/add_data/add_data.tsx index 81121a17080c2..1be7cd133bca2 100644 --- a/src/plugins/kibana_overview/public/components/add_data/add_data.tsx +++ b/src/plugins/kibana_overview/public/components/add_data/add_data.tsx @@ -12,7 +12,10 @@ import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from ' import { FormattedMessage } from '@kbn/i18n-react'; import { CoreStart } from 'kibana/public'; import { RedirectAppLinks, useKibana } from '../../../../../../src/plugins/kibana_react/public'; -import { FeatureCatalogueEntry } from '../../../../../../src/plugins/home/public'; +import { + FeatureCatalogueEntry, + FeatureCatalogueCategory, +} from '../../../../../../src/plugins/home/public'; // @ts-expect-error untyped component import { Synopsis } from '../synopsis'; import { METRIC_TYPE, trackUiMetric } from '../../lib/ui_metric'; @@ -94,8 +97,8 @@ AddData.propTypes = { icon: PropTypes.string.isRequired, path: PropTypes.string.isRequired, showOnHomePage: PropTypes.bool.isRequired, - category: PropTypes.string.isRequired, - order: PropTypes.number, - }) - ), + category: PropTypes.oneOf(Object.values(FeatureCatalogueCategory)).isRequired, + order: PropTypes.number as PropTypes.Validator, + }).isRequired + ).isRequired, }; diff --git a/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx b/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx index fa9e33a2ba82c..85f354d8a81cb 100644 --- a/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx +++ b/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx @@ -12,7 +12,10 @@ import { EuiFlexGroup, EuiFlexItem, EuiHorizontalRule, EuiSpacer, EuiTitle } fro import { FormattedMessage } from '@kbn/i18n-react'; import { CoreStart } from 'kibana/public'; import { RedirectAppLinks, useKibana } from '../../../../../../src/plugins/kibana_react/public'; -import { FeatureCatalogueEntry } from '../../../../../../src/plugins/home/public'; +import { + FeatureCatalogueEntry, + FeatureCatalogueCategory, +} from '../../../../../../src/plugins/home/public'; // @ts-expect-error untyped component import { Synopsis } from '../synopsis'; import { METRIC_TYPE, trackUiMetric } from '../../lib/ui_metric'; @@ -81,8 +84,8 @@ ManageData.propTypes = { icon: PropTypes.string.isRequired, path: PropTypes.string.isRequired, showOnHomePage: PropTypes.bool.isRequired, - category: PropTypes.string.isRequired, - order: PropTypes.number, - }) - ), + category: PropTypes.oneOf(Object.values(FeatureCatalogueCategory)).isRequired, + order: PropTypes.number as PropTypes.Validator, + }).isRequired + ).isRequired, }; diff --git a/src/plugins/presentation_util/public/components/controls/control_group/embeddable/control_group_container_factory.ts b/src/plugins/presentation_util/public/components/controls/control_group/embeddable/control_group_container_factory.ts index 33d0d079d26f8..5a71355da8bbe 100644 --- a/src/plugins/presentation_util/public/components/controls/control_group/embeddable/control_group_container_factory.ts +++ b/src/plugins/presentation_util/public/components/controls/control_group/embeddable/control_group_container_factory.ts @@ -26,7 +26,6 @@ import { export class ControlGroupContainerFactory implements EmbeddableFactoryDefinition { public readonly isContainerType = true; public readonly type = CONTROL_GROUP_TYPE; - public inject: EmbeddablePersistableStateService['inject']; public extract: EmbeddablePersistableStateService['extract']; diff --git a/src/plugins/visualize/public/application/utils/use/use_editor_updates.test.ts b/src/plugins/visualize/public/application/utils/use/use_editor_updates.test.ts index 9e1cfe60caa3c..0a1127cf11b3d 100644 --- a/src/plugins/visualize/public/application/utils/use/use_editor_updates.test.ts +++ b/src/plugins/visualize/public/application/utils/use/use_editor_updates.test.ts @@ -253,7 +253,7 @@ describe('useEditorUpdates', () => { describe('handle linked search changes', () => { test('should update saved search id in saved instance', () => { - // @ts-expect-error + // @ts-expect-error 4.3.5 upgrade savedVisInstance.savedSearch = { id: 'saved_search_id', }; @@ -287,7 +287,8 @@ describe('useEditorUpdates', () => { savedVisInstance.savedVis = { savedSearchId: 'saved_search_id', }; - // @ts-expect-error + + // @ts-expect-error 4.3.5 upgrade savedVisInstance.savedSearch = { id: 'saved_search_id', }; diff --git a/test/tsconfig.json b/test/tsconfig.json index 64c85dad73312..abf320a696714 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -5,7 +5,7 @@ "emitDeclarationOnly": true, "declaration": true, "declarationMap": true, - "types": ["node", "resize-observer-polyfill", "@emotion/react/types/css-prop"] + "types": ["node", "@emotion/react/types/css-prop"] }, "include": [ "**/*", diff --git a/tsconfig.base.json b/tsconfig.base.json index 18c0ad38f4601..ae06e39f7a274 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -16,6 +16,9 @@ "@emotion/core": [ "typings/@emotion" ], + "resize-observer-polyfill": [ + "typings/resize-observer-polyfill" + ] }, // Support .tsx files and transform JSX into calls to React.createElement "jsx": "react", @@ -68,7 +71,6 @@ "flot", "jest-styled-components", "@testing-library/jest-dom", - "resize-observer-polyfill", "@emotion/react/types/css-prop" ] } diff --git a/typings/resize-observer-polyfill/index.d.ts b/typings/resize-observer-polyfill/index.d.ts new file mode 100644 index 0000000000000..a2d9c88664722 --- /dev/null +++ b/typings/resize-observer-polyfill/index.d.ts @@ -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. + */ + +// eslint-disable-next-line import/no-default-export +export default ResizeObserver; diff --git a/x-pack/examples/ui_actions_enhanced_examples/public/drilldowns/dashboard_to_discover_drilldown/drilldown.tsx b/x-pack/examples/ui_actions_enhanced_examples/public/drilldowns/dashboard_to_discover_drilldown/drilldown.tsx index d1482c55429f4..91fb8552beed8 100644 --- a/x-pack/examples/ui_actions_enhanced_examples/public/drilldowns/dashboard_to_discover_drilldown/drilldown.tsx +++ b/x-pack/examples/ui_actions_enhanced_examples/public/drilldowns/dashboard_to_discover_drilldown/drilldown.tsx @@ -33,7 +33,9 @@ export interface Params { export class DashboardToDiscoverDrilldown implements Drilldown { - constructor(protected readonly params: Params) {} + constructor(protected readonly params: Params) { + this.ReactCollectConfig = (props) => ; + } public readonly id = SAMPLE_DASHBOARD_TO_DISCOVER_DRILLDOWN; @@ -47,9 +49,7 @@ export class DashboardToDiscoverDrilldown return [APPLY_FILTER_TRIGGER]; } - private readonly ReactCollectConfig: React.FC = (props) => ( - - ); + private readonly ReactCollectConfig!: React.FC; public readonly CollectConfig = reactToUiComponent(this.ReactCollectConfig); diff --git a/x-pack/plugins/apm/kibana.json b/x-pack/plugins/apm/kibana.json index e57859bfa253e..846847dcd7e05 100644 --- a/x-pack/plugins/apm/kibana.json +++ b/x-pack/plugins/apm/kibana.json @@ -22,14 +22,14 @@ "actions", "alerting", "cloud", + "fleet", "home", "maps", "ml", "security", "spaces", "taskManager", - "usageCollection", - "fleet" + "usageCollection" ], "server": true, "ui": true, diff --git a/x-pack/plugins/apm/public/application/uxApp.tsx b/x-pack/plugins/apm/public/application/uxApp.tsx index cfb1a5c354c2d..f7a8f7030d4f9 100644 --- a/x-pack/plugins/apm/public/application/uxApp.tsx +++ b/x-pack/plugins/apm/public/application/uxApp.tsx @@ -130,6 +130,7 @@ export function UXAppRoot({ services={{ ...core, ...plugins, embeddable, data }} > + {/* @ts-expect-error Type instantiation is excessively deep */} 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 155de8fbdd947..6ca632eac4f2e 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 @@ -46,7 +46,9 @@ function useServicesFetcher() { const { query: { rangeFrom, rangeTo, environment, kuery }, - } = useApmParams('/services/{serviceName}', '/services'); + } = + // @ts-ignore 4.3.5 upgrade - Type instantiation is excessively deep and possibly infinite. + useApmParams('/services/{serviceName}', '/services'); const { start, end } = useTimeRange({ rangeFrom, rangeTo }); diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/backend_contents.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/backend_contents.tsx index b61b225c2fe94..a862ff872f61a 100644 --- a/x-pack/plugins/apm/public/components/app/service_map/Popover/backend_contents.tsx +++ b/x-pack/plugins/apm/public/components/app/service_map/Popover/backend_contents.tsx @@ -25,6 +25,7 @@ export function BackendContents({ start, end, }: ContentsProps) { + // @ts-ignore 4.3.5 upgrade - Type instantiation is excessively deep and possibly infinite. const { query } = useApmParams( '/service-map', '/services/{serviceName}/service-map' 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 5d49f1d9a8f18..30ca3e79f6d7b 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 @@ -138,6 +138,7 @@ function UnoptimizedManagedTable(props: Props) { }, [isLoading, noItemsMessage]); return ( + // @ts-expect-error TS thinks pagination should be non-nullable, but it's not { - // a little too much effort needed to satisfy TS here - // @ts-ignore + const link = (...args: [any]) => { return core.http.basePath.prepend('/app/apm' + router.link(...args)); }; diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.test.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.test.ts index e9280ba3e5976..68e29f7afcc79 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.test.ts @@ -11,9 +11,9 @@ import { } from '../../../../../../../../src/core/server/mocks'; import { createHttpServer } from 'src/core/server/test_utils'; import supertest from 'supertest'; -import { createApmEventClient } from '.'; +import { APMEventClient } from '.'; -describe('createApmEventClient', () => { +describe('APMEventClient', () => { let server: ReturnType; beforeEach(() => { @@ -38,7 +38,7 @@ describe('createApmEventClient', () => { router.get( { path: '/', validate: false }, async (context, request, res) => { - const eventClient = createApmEventClient({ + const eventClient = new APMEventClient({ esClient: { search: async ( params: any, diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts index 6c9a0cb45e273..6e09e2aecfd48 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts @@ -57,26 +57,13 @@ type TypeOfProcessorEvent = { profile: Profile; }[T]; -type ESSearchRequestOf = Omit< - TParams, - 'apm' -> & { index: string[] | string }; - type TypedSearchResponse = InferSearchResponseOf< TypeOfProcessorEvent>, - ESSearchRequestOf + TParams >; -export type APMEventClient = ReturnType; - -export function createApmEventClient({ - esClient, - debug, - request, - indices, - options: { includeFrozen } = { includeFrozen: false }, -}: { +export interface APMEventClientConfig { esClient: ElasticsearchClient; debug: boolean; request: KibanaRequest; @@ -84,102 +71,119 @@ export function createApmEventClient({ options: { includeFrozen: boolean; }; -}) { - return { - async search( - operationName: string, - params: TParams - ): Promise> { - const withProcessorEventFilter = unpackProcessorEvents(params, indices); - - const { includeLegacyData = false } = params.apm; - - const withPossibleLegacyDataFilter = !includeLegacyData - ? addFilterToExcludeLegacyData(withProcessorEventFilter) - : withProcessorEventFilter; - - const searchParams = { - ...withPossibleLegacyDataFilter, - ...(includeFrozen ? { ignore_throttled: false } : {}), - ignore_unavailable: true, - preference: 'any', - }; - - // only "search" operation is currently supported - const requestType = 'search'; - - return callAsyncWithDebug({ - cb: () => { - const searchPromise = withApmSpan(operationName, () => { - const controller = new AbortController(); - return cancelEsRequestOnAbort( - esClient.search(searchParams, { signal: controller.signal }), - request, - controller - ); - }); - - return unwrapEsResponse(searchPromise); - }, - getDebugMessage: () => ({ - body: getDebugBody({ - params: searchParams, - requestType, - operationName, - }), - title: getDebugTitle(request), +} + +export class APMEventClient { + private readonly esClient: ElasticsearchClient; + private readonly debug: boolean; + private readonly request: KibanaRequest; + private readonly indices: ApmIndicesConfig; + private readonly includeFrozen: boolean; + + constructor(config: APMEventClientConfig) { + this.esClient = config.esClient; + this.debug = config.debug; + this.request = config.request; + this.indices = config.indices; + this.includeFrozen = config.options.includeFrozen; + } + + async search( + operationName: string, + params: TParams + ): Promise> { + const withProcessorEventFilter = unpackProcessorEvents( + params, + this.indices + ); + + const { includeLegacyData = false } = params.apm; + + const withPossibleLegacyDataFilter = !includeLegacyData + ? addFilterToExcludeLegacyData(withProcessorEventFilter) + : withProcessorEventFilter; + + const searchParams = { + ...withPossibleLegacyDataFilter, + ...(this.includeFrozen ? { ignore_throttled: false } : {}), + ignore_unavailable: true, + preference: 'any', + }; + + // only "search" operation is currently supported + const requestType = 'search'; + + return callAsyncWithDebug({ + cb: () => { + const searchPromise = withApmSpan(operationName, () => { + const controller = new AbortController(); + return cancelEsRequestOnAbort( + this.esClient.search(searchParams, { signal: controller.signal }), + this.request, + controller + ); + }); + + return unwrapEsResponse(searchPromise); + }, + getDebugMessage: () => ({ + body: getDebugBody({ + params: searchParams, + requestType, + operationName, }), - isCalledWithInternalUser: false, - debug, - request, - requestType, - operationName, - requestParams: searchParams, - }); - }, - - async termsEnum( - operationName: string, - params: APMEventESTermsEnumRequest - ): Promise { - const requestType = 'terms_enum'; - const { index } = unpackProcessorEvents(params, indices); - - return callAsyncWithDebug({ - cb: () => { - const { apm, ...rest } = params; - const termsEnumPromise = withApmSpan(operationName, () => { - const controller = new AbortController(); - return cancelEsRequestOnAbort( - esClient.termsEnum( - { - index: Array.isArray(index) ? index.join(',') : index, - ...rest, - }, - { signal: controller.signal } - ), - request, - controller - ); - }); - - return unwrapEsResponse(termsEnumPromise); - }, - getDebugMessage: () => ({ - body: getDebugBody({ - params, - requestType, - operationName, - }), - title: getDebugTitle(request), + title: getDebugTitle(this.request), + }), + isCalledWithInternalUser: false, + debug: this.debug, + request: this.request, + requestType, + operationName, + requestParams: searchParams, + }); + } + + async termsEnum( + operationName: string, + params: APMEventESTermsEnumRequest + ): Promise { + const requestType = 'terms_enum'; + const { index } = unpackProcessorEvents(params, this.indices); + + return callAsyncWithDebug({ + cb: () => { + const { apm, ...rest } = params; + const termsEnumPromise = withApmSpan(operationName, () => { + const controller = new AbortController(); + return cancelEsRequestOnAbort( + this.esClient.termsEnum( + { + index: Array.isArray(index) ? index.join(',') : index, + ...rest, + }, + { signal: controller.signal } + ), + this.request, + controller + ); + }); + + return unwrapEsResponse(termsEnumPromise); + }, + getDebugMessage: () => ({ + body: getDebugBody({ + params, + requestType, + operationName, }), - isCalledWithInternalUser: false, - debug, - request, - requestType, - operationName, - requestParams: params, - }); - }, - }; + title: getDebugTitle(this.request), + }), + isCalledWithInternalUser: false, + debug: this.debug, + request: this.request, + requestType, + operationName, + requestParams: params, + }); + } } diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts index 85fb94dd765b0..fb2d46bfa5aa2 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts @@ -14,10 +14,7 @@ import { ApmIndicesConfig, getApmIndices, } from '../../routes/settings/apm_indices/get_apm_indices'; -import { - APMEventClient, - createApmEventClient, -} from './create_es_client/create_apm_event_client'; +import { APMEventClient } from './create_es_client/create_apm_event_client'; import { APMInternalClient, createInternalESClient, @@ -58,7 +55,7 @@ export async function setupRequest({ return { indices, - apmEventClient: createApmEventClient({ + apmEventClient: new APMEventClient({ esClient: context.core.elasticsearch.client.asCurrentUser, debug: query._inspect, request, diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts index 04cee211c78db..97dc298d11c56 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts @@ -8,8 +8,10 @@ import { merge } from 'lodash'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { - TRANSACTION_TYPE, AGENT_NAME, + TRANSACTION_TYPE, + TRANSACTION_NAME, + SERVICE_NAME, } from '../../../common/elasticsearch_fieldnames'; import { arrayUnionToCallable } from '../../../common/utils/array_union_to_callable'; import { TransactionGroupRequestBase, TransactionGroupSetup } from './fetcher'; @@ -21,7 +23,7 @@ interface MetricParams { searchAggregatedTransactions: boolean; } -type BucketKey = Record; +type BucketKey = Record; function mergeRequestWithAggs< TRequestBase extends TransactionGroupRequestBase, diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index b0c21fe28abb2..b603d9e72a2b0 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -23,7 +23,7 @@ import { APM_FEATURE, registerFeaturesUsage } from './feature'; import { registerApmAlerts } from './routes/alerts/register_apm_alerts'; import { registerFleetPolicyCallbacks } from './routes/fleet/register_fleet_policy_callbacks'; import { createApmTelemetry } from './lib/apm_telemetry'; -import { createApmEventClient } from './lib/helpers/create_es_client/create_apm_event_client'; +import { APMEventClient } from './lib/helpers/create_es_client/create_apm_event_client'; import { getInternalSavedObjectsClient } from './lib/helpers/get_internal_saved_objects_client'; import { createApmAgentConfigurationIndex } from './routes/settings/agent_configuration/create_agent_config_index'; import { getApmIndices } from './routes/settings/apm_indices/get_apm_indices'; @@ -66,7 +66,7 @@ export class APMPlugin public setup( core: CoreSetup, - plugins: Omit + plugins: APMPluginSetupDependencies ) { this.logger = this.initContext.logger.get(); const config$ = this.initContext.config.create(); @@ -224,7 +224,7 @@ export class APMPlugin const esClient = context.core.elasticsearch.client.asCurrentUser; - return createApmEventClient({ + return new APMEventClient({ debug: debug ?? false, esClient, request, diff --git a/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts b/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts index f196b718968da..773b1ce694125 100644 --- a/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts +++ b/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts @@ -171,27 +171,29 @@ export function registerTransactionErrorRateAlertType({ return {}; } - const results = response.aggregations.series.buckets - .map((bucket) => { - const [serviceName, environment, transactionType] = bucket.key; - - const failed = - bucket.outcomes.buckets.find( - (outcomeBucket) => outcomeBucket.key === EventOutcome.failure - )?.doc_count ?? 0; - const succesful = - bucket.outcomes.buckets.find( - (outcomeBucket) => outcomeBucket.key === EventOutcome.success - )?.doc_count ?? 0; - - return { + const results = []; + for (const bucket of response.aggregations.series.buckets) { + const [serviceName, environment, transactionType] = bucket.key; + + const failed = + bucket.outcomes.buckets.find( + (outcomeBucket) => outcomeBucket.key === EventOutcome.failure + )?.doc_count ?? 0; + const succesful = + bucket.outcomes.buckets.find( + (outcomeBucket) => outcomeBucket.key === EventOutcome.success + )?.doc_count ?? 0; + const errorRate = (failed / (failed + succesful)) * 100; + + if (errorRate >= alertParams.threshold) { + results.push({ serviceName, environment, transactionType, - errorRate: (failed / (failed + succesful)) * 100, - }; - }) - .filter((result) => result.errorRate >= alertParams.threshold); + errorRate, + }); + } + } results.forEach((result) => { const { serviceName, environment, transactionType, errorRate } = diff --git a/x-pack/plugins/apm/server/routes/data_view/route.ts b/x-pack/plugins/apm/server/routes/data_view/route.ts index 4e1c0ca050a09..83d2ac35b3672 100644 --- a/x-pack/plugins/apm/server/routes/data_view/route.ts +++ b/x-pack/plugins/apm/server/routes/data_view/route.ts @@ -22,12 +22,13 @@ const staticDataViewRoute = createApmServerRoute({ config, } = resources; - const [setup, savedObjectsClient] = await Promise.all([ - setupRequest(resources), - core - .start() - .then((coreStart) => coreStart.savedObjects.createInternalRepository()), - ]); + const setupPromise = setupRequest(resources); + const clientPromise = core + .start() + .then((coreStart) => coreStart.savedObjects.createInternalRepository()); + + const setup = await setupPromise; + const savedObjectsClient = await clientPromise; const spaceId = spaces?.setup.spacesService.getSpaceId(request); diff --git a/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts b/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts index e460991029915..d32e751a6ca99 100644 --- a/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts +++ b/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts @@ -110,6 +110,7 @@ export async function getErrorGroupMainStatistics({ ); return ( + // @ts-ignore 4.3.5 upgrade - Expression produces a union type that is too complex to represent. ts(2590) response.aggregations?.error_groups.buckets.map((bucket) => ({ groupId: bucket.key as string, name: getErrorName(bucket.sample.hits.hits[0]._source), diff --git a/x-pack/plugins/apm/server/routes/service_map/get_service_anomalies.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_anomalies.ts index 66b12dab59775..0a0a92760decd 100644 --- a/x-pack/plugins/apm/server/routes/service_map/get_service_anomalies.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_anomalies.ts @@ -120,6 +120,7 @@ export async function getServiceAnomalies({ const relevantBuckets = uniqBy( sortBy( // make sure we only return data for jobs that are available in this space + // @ts-ignore 4.3.5 upgrade typedAnomalyResponse.aggregations?.services.buckets.filter((bucket) => jobIds.includes(bucket.key.jobId as string) ) ?? [], diff --git a/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_transaction_statistics.ts b/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_transaction_statistics.ts index ec081916f455d..a9f5615acb1c0 100644 --- a/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_transaction_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_transaction_statistics.ts @@ -168,6 +168,7 @@ export async function getServiceInstancesTransactionStatistics< const { timeseries } = serviceNodeBucket; return { serviceNodeName, + // @ts-ignore 4.3.5 upgrade - Expression produces a union type that is too complex to represent. errorRate: timeseries.buckets.map((dateBucket) => ({ x: dateBucket.key, y: dateBucket.failures.doc_count / dateBucket.doc_count, diff --git a/x-pack/plugins/apm/server/routes/settings/apm_indices/get_apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices/get_apm_indices.ts index 6b917919bade5..347fca380c863 100644 --- a/x-pack/plugins/apm/server/routes/settings/apm_indices/get_apm_indices.ts +++ b/x-pack/plugins/apm/server/routes/settings/apm_indices/get_apm_indices.ts @@ -52,7 +52,7 @@ export async function getApmIndices({ }: { config: APMConfig; savedObjectsClient: ISavedObjectsClient; -}) { +}): Promise { try { const apmIndicesSavedObject = await getApmIndicesSavedObject( savedObjectsClient diff --git a/x-pack/plugins/apm/server/routes/traces/get_trace_items.ts b/x-pack/plugins/apm/server/routes/traces/get_trace_items.ts index 419c3e44d68a6..7a38988ac1b17 100644 --- a/x-pack/plugins/apm/server/routes/traces/get_trace_items.ts +++ b/x-pack/plugins/apm/server/routes/traces/get_trace_items.ts @@ -71,10 +71,8 @@ export async function getTraceItems( }, }); - const [errorResponse, traceResponse] = await Promise.all([ - errorResponsePromise, - traceResponsePromise, - ]); + const errorResponse = await errorResponsePromise; + const traceResponse = await traceResponsePromise; const exceedsMax = traceResponse.hits.total.value > maxTraceItems; const traceDocs = traceResponse.hits.hits.map((hit) => hit._source); diff --git a/x-pack/plugins/apm/server/routes/typings.ts b/x-pack/plugins/apm/server/routes/typings.ts index 5b6d44ab9295d..a089c7bf3968a 100644 --- a/x-pack/plugins/apm/server/routes/typings.ts +++ b/x-pack/plugins/apm/server/routes/typings.ts @@ -17,7 +17,10 @@ import { AlertingApiRequestHandlerContext } from '../../../alerting/server'; import type { RacApiRequestHandlerContext } from '../../../rule_registry/server'; import { LicensingApiRequestHandlerContext } from '../../../licensing/server'; import { APMConfig } from '..'; -import { APMPluginDependencies } from '../types'; +import { + APMPluginSetupDependencies, + APMPluginStartDependencies, +} from '../types'; import { UsageCollectionSetup } from '../../../../../src/plugins/usage_collection/server'; import { UxUIFilters } from '../../typings/ui_filters'; @@ -62,9 +65,9 @@ export interface APMRouteHandlerResources { start: () => Promise; }; plugins: { - [key in keyof APMPluginDependencies]: { - setup: Required[key]['setup']; - start: () => Promise[key]['start']>; + [key in keyof APMPluginSetupDependencies]: { + setup: Required[key]; + start: () => Promise[key]>; }; }; ruleDataClient: IRuleDataClient; diff --git a/x-pack/plugins/apm/server/types.ts b/x-pack/plugins/apm/server/types.ts index 02aae547407e5..0044a5abe8176 100644 --- a/x-pack/plugins/apm/server/types.ts +++ b/x-pack/plugins/apm/server/types.ts @@ -4,9 +4,9 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { ValuesType } from 'utility-types'; + import { Observable } from 'rxjs'; -import { CoreSetup, CoreStart, KibanaRequest } from 'kibana/server'; +import { KibanaRequest } from 'kibana/server'; import { RuleRegistryPluginSetupContract, RuleRegistryPluginStartContract, @@ -47,130 +47,58 @@ import { FleetStartContract as FleetPluginStart, } from '../../fleet/server'; import { APMConfig } from '.'; -import { getApmIndices } from './routes/settings/apm_indices/get_apm_indices'; -import { createApmEventClient } from './lib/helpers/create_es_client/create_apm_event_client'; +import { ApmIndicesConfig } from './routes/settings/apm_indices/get_apm_indices'; +import { APMEventClient } from './lib/helpers/create_es_client/create_apm_event_client'; import { ApmPluginRequestHandlerContext } from './routes/typings'; export interface APMPluginSetup { config$: Observable; - getApmIndices: () => ReturnType; + getApmIndices: () => Promise; createApmEventClient: (params: { debug?: boolean; request: KibanaRequest; context: ApmPluginRequestHandlerContext; - }) => Promise>; -} - -interface DependencyMap { - core: { - setup: CoreSetup; - start: CoreStart; - }; - spaces: { - setup: SpacesPluginSetup; - start: SpacesPluginStart; - }; - home: { - setup: HomeServerPluginSetup; - start: HomeServerPluginStart; - }; - licensing: { - setup: LicensingPluginSetup; - start: LicensingPluginStart; - }; - cloud: { - setup: CloudSetup; - start: undefined; - }; - usageCollection: { - setup: UsageCollectionSetup; - start: undefined; - }; - taskManager: { - setup: TaskManagerSetupContract; - start: TaskManagerStartContract; - }; - alerting: { - setup: AlertingPlugin['setup']; - start: AlertingPlugin['start']; - }; - actions: { - setup: ActionsPlugin['setup']; - start: ActionsPlugin['start']; - }; - observability: { - setup: ObservabilityPluginSetup; - start: undefined; - }; - features: { - setup: FeaturesPluginSetup; - start: FeaturesPluginStart; - }; - security: { - setup: SecurityPluginSetup; - start: SecurityPluginStart; - }; - ml: { - setup: MlPluginSetup; - start: MlPluginStart; - }; - data: { - setup: DataPluginSetup; - start: DataPluginStart; - }; - ruleRegistry: { - setup: RuleRegistryPluginSetupContract; - start: RuleRegistryPluginStartContract; - }; - fleet: { - setup: FleetPluginSetup; - start: FleetPluginStart; - }; + }) => Promise; } -const requiredDependencies = [ - 'features', - 'data', - 'licensing', - 'triggersActionsUi', - 'embeddable', - 'infra', - 'observability', - 'ruleRegistry', -] as const; - -const optionalDependencies = [ - 'spaces', - 'cloud', - 'usageCollection', - 'taskManager', - 'actions', - 'alerting', - 'security', - 'ml', - 'home', - 'maps', - 'fleet', -] as const; +export interface APMPluginSetupDependencies { + // required dependencies + data: DataPluginSetup; + features: FeaturesPluginSetup; + licensing: LicensingPluginSetup; + observability: ObservabilityPluginSetup; + ruleRegistry: RuleRegistryPluginSetupContract; -type RequiredDependencies = Pick< - DependencyMap, - ValuesType & keyof DependencyMap ->; - -type OptionalDependencies = Partial< - Pick< - DependencyMap, - ValuesType & keyof DependencyMap - > ->; - -export type APMPluginDependencies = RequiredDependencies & OptionalDependencies; + // optional dependencies + actions?: ActionsPlugin['setup']; + alerting?: AlertingPlugin['setup']; + cloud?: CloudSetup; + fleet?: FleetPluginSetup; + home?: HomeServerPluginSetup; + ml?: MlPluginSetup; + security?: SecurityPluginSetup; + spaces?: SpacesPluginSetup; + taskManager?: TaskManagerSetupContract; + usageCollection?: UsageCollectionSetup; +} -export type APMPluginSetupDependencies = { - [key in keyof APMPluginDependencies]: Required[key]['setup']; -}; +export interface APMPluginStartDependencies { + // required dependencies + data: DataPluginStart; + features: FeaturesPluginStart; + licensing: LicensingPluginStart; + observability: undefined; + ruleRegistry: RuleRegistryPluginStartContract; -export type APMPluginStartDependencies = { - [key in keyof APMPluginDependencies]: Required[key]['start']; -}; + // optional dependencies + actions?: ActionsPlugin['start']; + alerting?: AlertingPlugin['start']; + cloud?: undefined; + fleet?: FleetPluginStart; + home?: HomeServerPluginStart; + ml?: MlPluginStart; + security?: SecurityPluginStart; + spaces?: SpacesPluginStart; + taskManager?: TaskManagerStartContract; + usageCollection?: undefined; +} diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/abstract_dashboard_drilldown.tsx b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/abstract_dashboard_drilldown.tsx index 96a17bd894391..daec52bccda37 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/abstract_dashboard_drilldown.tsx +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/abstract_dashboard_drilldown.tsx @@ -9,6 +9,7 @@ import type { KibanaLocation } from 'src/plugins/share/public'; import React from 'react'; import { DataPublicPluginStart } from 'src/plugins/data/public'; import { DashboardStart } from 'src/plugins/dashboard/public'; +import { DrilldownConfig } from '../../../../common/drilldowns/dashboard_drilldown/types'; import { reactToUiComponent } from '../../../../../../../src/plugins/kibana_react/public'; import { CollectConfigContainer } from './components'; import { @@ -20,6 +21,7 @@ import { txtGoToDashboard } from './i18n'; import { CollectConfigProps, StartServicesGetter, + UiComponent, } from '../../../../../../../src/plugins/kibana_utils/public'; import { Config } from './types'; @@ -34,7 +36,10 @@ export interface Params { export abstract class AbstractDashboardDrilldown implements Drilldown { - constructor(protected readonly params: Params) {} + constructor(protected readonly params: Params) { + this.ReactCollectConfig = (props) => ; + this.CollectConfig = reactToUiComponent(this.ReactCollectConfig); + } public abstract readonly id: string; @@ -50,9 +55,11 @@ export abstract class AbstractDashboardDrilldown - > = (props) => ; + >; - public readonly CollectConfig = reactToUiComponent(this.ReactCollectConfig); + public readonly CollectConfig: UiComponent< + CollectConfigProps + >; public readonly createConfig = () => ({ dashboardId: '', diff --git a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/utils/saved_search_utils.test.ts b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/utils/saved_search_utils.test.ts index 586f636a088e1..60be59ab2db6c 100644 --- a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/utils/saved_search_utils.test.ts +++ b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/utils/saved_search_utils.test.ts @@ -75,7 +75,7 @@ const kqlSavedSearch: SavedSearch = { title: 'farequote_filter_and_kuery', description: '', columns: ['_source'], - // @ts-expect-error + // @ts-expect-error this isn't a valid SavedSearch object... but does anyone care? kibanaSavedObjectMeta: { searchSourceJSON: '{"highlightAll":true,"version":true,"query":{"query":"responsetime > 49","language":"kuery"},"filter":[{"meta":{"index":"90a978e0-1c80-11ec-b1d7-f7e5cf21b9e0","negate":false,"disabled":false,"alias":null,"type":"phrase","key":"airline","value":"ASA","params":{"query":"ASA","type":"phrase"}},"query":{"match":{"airline":{"query":"ASA","type":"phrase"}}},"$state":{"store":"appState"}}],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}', diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_details_flyout/accordion_list.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_details_flyout/accordion_list.test.tsx index 2219a50a5e7f3..2109160f5bb25 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_details_flyout/accordion_list.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_details_flyout/accordion_list.test.tsx @@ -48,7 +48,9 @@ describe('AccordionList', () => { expect(table.prop('items')).toEqual([{ item: 'first item' }, { item: 'second item' }]); - expect(table.prop('columns')[0].render({ item: 'first item' })).toEqual('first item'); + // columns from accordion_list.tsx always have a render function, so avoid type errors and just convert to any + const column: any = table.prop('columns')[0]; + expect(column.render({ item: 'first item' })).toEqual('first item'); }); it('is disabled when there are no items', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.test.tsx index e11661e4a942e..03e5d835df9b3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.test.tsx @@ -83,6 +83,7 @@ describe('CrawlRequestsTable', () => { const table = wrapper.find(EuiBasicTable); const columns = table.prop('columns'); + // @ts-expect-error 4.3.5 upgrade const crawlID = shallow(columns[0].render('618d0e66abe97bc688328900', { stage: 'crawl' })); expect(crawlID.text()).toContain('618d0e66abe97bc688328900'); @@ -90,6 +91,7 @@ describe('CrawlRequestsTable', () => { expect(actions.fetchCrawlRequest).toHaveBeenCalledWith('618d0e66abe97bc688328900'); expect(actions.openFlyout).toHaveBeenCalled(); + // @ts-expect-error 4.3.5 upgrade const processCrawlID = shallow(columns[0].render('54325423aef7890543', { stage: 'process' })); expect(processCrawlID.text()).toContain('54325423aef7890543'); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.tsx index 0949be0ced0a6..70dd55f40ad4b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.tsx @@ -12,7 +12,8 @@ import { useActions, useValues } from 'kea'; import { EuiBadge, EuiBasicTable, - EuiBasicTableColumn, + EuiTableFieldDataColumnType, + EuiTableComputedColumnType, EuiEmptyPrompt, EuiLink, } from '@elastic/eui'; @@ -30,7 +31,9 @@ export const CrawlRequestsTable: React.FC = () => { const { events } = useValues(CrawlerLogic); const { fetchCrawlRequest, openFlyout } = useActions(CrawlDetailLogic); - const columns: Array> = [ + const columns: Array< + EuiTableFieldDataColumnType | EuiTableComputedColumnType + > = [ { field: 'id', name: i18n.translate( diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_list/credentials_list.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_list/credentials_list.test.tsx index 13dd77da40931..32e1b61a2c3e6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_list/credentials_list.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_list/credentials_list.test.tsx @@ -81,8 +81,8 @@ describe('CredentialsList', () => { ], }); const wrapper = shallow(); - const { items } = wrapper.find(EuiBasicTable).props(); - expect(items.map((i: ApiToken) => i.id)).toEqual([undefined, 1, 2]); + const items = wrapper.find(EuiBasicTable).props().items as ApiToken[]; + expect(items.map((i) => i.id)).toEqual([undefined, 1, 2]); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_history/components/ignored_queries_panel/ignored_queries_panel.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_history/components/ignored_queries_panel/ignored_queries_panel.test.tsx index 919e1e8706c94..8c1b4212040aa 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_history/components/ignored_queries_panel/ignored_queries_panel.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_history/components/ignored_queries_panel/ignored_queries_panel.test.tsx @@ -66,6 +66,7 @@ describe('IgnoredQueriesPanel', () => { }); it('show a query', () => { + // @ts-expect-error 4.3.5 upgrade const column = getColumn(0).render('test query'); expect(column).toEqual('test query'); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/error_pages/components/no_data_layout.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/error_pages/components/no_data_layout.tsx index 8d867eeb74f86..04b899e3cb886 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/error_pages/components/no_data_layout.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/error_pages/components/no_data_layout.tsx @@ -18,7 +18,7 @@ interface LayoutProps { export const NoDataLayout: React.FunctionComponent = withRouter< any, React.FunctionComponent ->(({ actionSection, title, modalClosePath, children }) => { +>(({ actionSection, title, modalClosePath, children }: React.PropsWithChildren) => { return ( diff --git a/x-pack/plugins/graph/public/components/field_manager/field_manager.test.tsx b/x-pack/plugins/graph/public/components/field_manager/field_manager.test.tsx index d582572862012..be905cd67c976 100644 --- a/x-pack/plugins/graph/public/components/field_manager/field_manager.test.tsx +++ b/x-pack/plugins/graph/public/components/field_manager/field_manager.test.tsx @@ -108,7 +108,7 @@ describe('field_manager', () => { ).toEqual(['field1', 'field2', 'field3']); act(() => { - getInstance().find(FieldPicker).dive().find(EuiSelectable).prop('onChange')([ + getInstance().find(FieldPicker).dive().find(EuiSelectable).prop('onChange')!([ { checked: 'on', label: 'field3' }, ]); }); diff --git a/x-pack/plugins/graph/public/state_management/fields.ts b/x-pack/plugins/graph/public/state_management/fields.ts index 34b1a74510e1a..3e91f4c1fb58f 100644 --- a/x-pack/plugins/graph/public/state_management/fields.ts +++ b/x-pack/plugins/graph/public/state_management/fields.ts @@ -84,8 +84,8 @@ export const updateSaveButtonSaga = ({ notifyReact }: GraphStoreDependencies) => * * Won't be necessary once the workspace is moved to redux */ -export const syncFieldsSaga = ({ getWorkspace }: GraphStoreDependencies) => { - function* syncFields() { +export const syncFieldsSaga = ({ getWorkspace }: GraphStoreDependencies): (() => Generator) => { + function* syncFields(): Generator { const workspace = getWorkspace(); if (!workspace) { return; diff --git a/x-pack/plugins/graph/public/state_management/persistence.ts b/x-pack/plugins/graph/public/state_management/persistence.ts index e3f106488571e..27a635d25eeaf 100644 --- a/x-pack/plugins/graph/public/state_management/persistence.ts +++ b/x-pack/plugins/graph/public/state_management/persistence.ts @@ -25,6 +25,7 @@ import { updateMetaData, metaDataSelector } from './meta_data'; import { openSaveModal, SaveWorkspaceHandler } from '../services/save_modal'; import { getEditPath } from '../services/url'; import { saveSavedWorkspace } from '../helpers/saved_workspace_utils'; +import type { IndexPattern } from '../../../../../src/plugins/data/public'; export interface LoadSavedWorkspacePayload { indexPatterns: IndexPatternSavedObject[]; @@ -49,7 +50,7 @@ export const loadingSaga = ({ notifications, indexPatternProvider, }: GraphStoreDependencies) => { - function* deserializeWorkspace(action: Action) { + function* deserializeWorkspace(action: Action): Generator { const { indexPatterns, savedWorkspace, urlQuery } = action.payload; const migrationStatus = migrateLegacyIndexPatternRef(savedWorkspace, indexPatterns); if (!migrationStatus.success) { @@ -65,8 +66,11 @@ export const loadingSaga = ({ } const selectedIndexPatternId = lookupIndexPatternId(savedWorkspace); - const indexPattern = yield call(indexPatternProvider.get, selectedIndexPatternId); - const initialSettings = settingsSelector(yield select()); + const indexPattern = (yield call( + indexPatternProvider.get, + selectedIndexPatternId + )) as IndexPattern; + const initialSettings = settingsSelector((yield select()) as GraphState); const createdWorkspace = createWorkspace(indexPattern.title, initialSettings); @@ -87,7 +91,7 @@ export const loadingSaga = ({ yield put( setDatasource({ type: 'indexpattern', - id: indexPattern.id, + id: indexPattern.id!, title: indexPattern.title, }) ); @@ -122,13 +126,13 @@ export const savingSaga = (deps: GraphStoreDependencies) => { return; } - const savedObjectId = yield cps(showModal, { + const savedObjectId = (yield cps(showModal, { deps, workspace, savedWorkspace, state, selectedDatasource, - }); + })) as string; if (savedObjectId) { yield put(updateMetaData({ savedObjectId })); } diff --git a/x-pack/plugins/graph/public/state_management/store.ts b/x-pack/plugins/graph/public/state_management/store.ts index ba9bff98b0ca9..b2b685f51573b 100644 --- a/x-pack/plugins/graph/public/state_management/store.ts +++ b/x-pack/plugins/graph/public/state_management/store.ts @@ -83,7 +83,7 @@ function registerSagas(sagaMiddleware: SagaMiddleware, deps: GraphStoreD sagaMiddleware.run(submitSearchSaga(deps)); } -export const createGraphStore = (deps: GraphStoreDependencies) => { +export const createGraphStore = (deps: GraphStoreDependencies): Store => { const sagaMiddleware = createSagaMiddleware(); const rootReducer = createRootReducer(deps.addBasePath); diff --git a/x-pack/plugins/graph/public/state_management/workspace.ts b/x-pack/plugins/graph/public/state_management/workspace.ts index 9e8cca488e4ef..48a428fd08b4c 100644 --- a/x-pack/plugins/graph/public/state_management/workspace.ts +++ b/x-pack/plugins/graph/public/state_management/workspace.ts @@ -16,6 +16,7 @@ import { datasourceSelector } from './datasource'; import { liveResponseFieldsSelector, selectedFieldsSelector } from './fields'; import { fetchTopNodes } from '../services/fetch_top_nodes'; import { Workspace } from '../types'; +import type { ServerResultNode } from '../types'; const actionCreator = actionCreatorFactory('x-pack/graph/workspace'); @@ -52,21 +53,26 @@ export const fillWorkspaceSaga = ({ http, notifications, }: GraphStoreDependencies) => { - function* fetchNodes() { + function* fetchNodes(): Generator { try { const workspace = getWorkspace(); if (!workspace) { return; } - const state: GraphState = yield select(); + const state = (yield select()) as GraphState; const fields = selectedFieldsSelector(state); const datasource = datasourceSelector(state).current; if (datasource.type === 'none') { return; } - const topTermNodes = yield call(fetchTopNodes, http.post, datasource.title, fields); + const topTermNodes = (yield call( + fetchTopNodes, + http.post, + datasource.title, + fields + )) as ServerResultNode[]; workspace.mergeGraph({ nodes: topTermNodes, edges: [], diff --git a/x-pack/plugins/graph/public/types/app_state.ts b/x-pack/plugins/graph/public/types/app_state.ts index c2cbe16b62fb6..1ec21c4991a1b 100644 --- a/x-pack/plugins/graph/public/types/app_state.ts +++ b/x-pack/plugins/graph/public/types/app_state.ts @@ -8,7 +8,7 @@ import { SimpleSavedObject } from 'src/core/public'; import { FontawesomeIcon } from '../helpers/style_choices'; import { OutlinkEncoder } from '../helpers/outlink_encoders'; -import { IndexPattern } from '../../../../../src/plugins/data/public'; +import type { IndexPattern } from '../../../../../src/plugins/data/public'; export interface UrlTemplate { url: string; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/reducer.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/reducer.ts index 2033ad53bf7b0..a650176f5f77c 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/reducer.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/reducer.ts @@ -592,7 +592,5 @@ export const reducer = (state: State, action: Action): State => { isValid: action.value, }; } - default: - throw new Error(`Action "${action!.type}" not recognized.`); } }; diff --git a/x-pack/plugins/infra/public/alerting/log_threshold/components/expression_editor/criterion.tsx b/x-pack/plugins/infra/public/alerting/log_threshold/components/expression_editor/criterion.tsx index 3dd092fa48b99..485a104b3ff9d 100644 --- a/x-pack/plugins/infra/public/alerting/log_threshold/components/expression_editor/criterion.tsx +++ b/x-pack/plugins/infra/public/alerting/log_threshold/components/expression_editor/criterion.tsx @@ -177,7 +177,7 @@ export const Criterion: React.FC = ({ value={criterion.field ?? 'a chosen field'} isActive={isFieldPopoverOpen} color={errors.field.length === 0 ? 'success' : 'danger'} - onClick={(e) => { + onClick={(e: React.MouseEvent) => { e.stopPropagation(); setIsFieldPopoverOpen(!isFieldPopoverOpen); }} @@ -185,7 +185,7 @@ export const Criterion: React.FC = ({ } isOpen={isFieldPopoverOpen} closePopover={() => setIsFieldPopoverOpen(false)} - onClick={(e) => e.stopPropagation()} + onClick={(e: React.MouseEvent) => e.stopPropagation()} ownFocus panelPaddingSize="s" anchorPosition="downLeft" @@ -230,7 +230,7 @@ export const Criterion: React.FC = ({ ? 'success' : 'danger' } - onClick={(e) => { + onClick={(e: React.MouseEvent) => { e.stopPropagation(); setIsComparatorPopoverOpen(!isComparatorPopoverOpen); }} diff --git a/x-pack/plugins/infra/public/components/logging/log_text_stream/loading_item_view.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/loading_item_view.tsx index 286fc5f769cad..316249ec0fe3c 100644 --- a/x-pack/plugins/infra/public/components/logging/log_text_stream/loading_item_view.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/loading_item_view.tsx @@ -43,7 +43,7 @@ const TIMESTAMP_FORMAT = { hour: 'numeric', minute: 'numeric', second: 'numeric', -}; +} as const; export class LogTextStreamLoadingItemView extends React.PureComponent< LogTextStreamLoadingItemViewProps, diff --git a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_create/pipelines_create.tsx b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_create/pipelines_create.tsx index 5b437d3da69ab..097ec3d98e162 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_create/pipelines_create.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_create/pipelines_create.tsx @@ -6,7 +6,7 @@ */ import React, { useState, useEffect, useMemo } from 'react'; -import { RouteComponentProps } from 'react-router-dom'; +import { RouteComponentProps, useHistory } from 'react-router-dom'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiPageHeader, EuiButtonEmpty, EuiSpacer } from '@elastic/eui'; @@ -22,10 +22,14 @@ interface Props { sourcePipeline?: Pipeline; } +interface LocationState { + sourcePipeline?: Pipeline; +} + export const PipelinesCreate: React.FunctionComponent = ({ - history, sourcePipeline, }) => { + const history = useHistory(); const { services } = useKibana(); const [isSaving, setIsSaving] = useState(false); @@ -61,7 +65,7 @@ export const PipelinesCreate: React.FunctionComponent, getState: () => MapStoreState ) => { - const targetLayer = getLayerById(layerId, getState()); - if (!targetLayer || !('getFields' in targetLayer)) { + const targetLayer: ILayer | undefined = getLayerById(layerId, getState()); + if (!targetLayer) { return; } @@ -555,6 +555,10 @@ function updateStyleProperties(layerId: string, previousFields: IField[]) { return; } + if (!('getFields' in targetLayer)) { + return; + } + const nextFields = await (targetLayer as IVectorLayer).getFields(); // take into account all fields, since labels can be driven by any field (source or join) const { hasChanges, nextStyleDescriptor } = await ( style as IVectorStyle diff --git a/x-pack/plugins/maps/public/components/tooltip_selector/tooltip_selector.tsx b/x-pack/plugins/maps/public/components/tooltip_selector/tooltip_selector.tsx index bd178047b2251..ff00ef958acdf 100644 --- a/x-pack/plugins/maps/public/components/tooltip_selector/tooltip_selector.tsx +++ b/x-pack/plugins/maps/public/components/tooltip_selector/tooltip_selector.tsx @@ -116,6 +116,8 @@ export class TooltipSelector extends Component { const prop: FieldProps | undefined = this.state.fieldProps.find((field: FieldProps) => { return field.name === propertyName; }); + + // @ts-expect-error 4.3.5 upgrade return prop ? prop!.label : propertyName; }; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/tooltip_control/features_tooltip/feature_geometry_filter_form.tsx b/x-pack/plugins/maps/public/connected_components/mb_map/tooltip_control/features_tooltip/feature_geometry_filter_form.tsx index d5ed944f7e7c8..e42a5cc873c1c 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/tooltip_control/features_tooltip/feature_geometry_filter_form.tsx +++ b/x-pack/plugins/maps/public/connected_components/mb_map/tooltip_control/features_tooltip/feature_geometry_filter_form.tsx @@ -98,7 +98,9 @@ export class FeatureGeometryFilterForm extends Component { // Ensure filter will not overflow URL. Filters that contain geometry can be extremely large. // No elasticsearch support for pre-indexed shapes and geo_point spatial queries. if ( - window.location.href.length + rison.encode(filter as RisonObject).length + META_OVERHEAD > + window.location.href.length + + rison.encode(filter as unknown as RisonObject).length + + META_OVERHEAD > URL_MAX_LENGTH ) { this.setState({ diff --git a/x-pack/plugins/ml/server/lib/alerts/alerting_service.ts b/x-pack/plugins/ml/server/lib/alerts/alerting_service.ts index 85746298d4e51..ac5602ddd830f 100644 --- a/x-pack/plugins/ml/server/lib/alerts/alerting_service.ts +++ b/x-pack/plugins/ml/server/lib/alerts/alerting_service.ts @@ -491,8 +491,7 @@ export function alertingServiceProvider( .filter((v) => v.doc_count > 0 && v[resultsLabel.aggGroupLabel].doc_count > 0) // Map response .map(formatter) - : // @ts-expect-error - [formatter(result as AggResultsResponse)] + : [formatter(result as unknown as AggResultsResponse)] ).filter(isDefined); }; diff --git a/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.test.ts b/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.test.ts index e853d5de5899d..d4c3648d05325 100644 --- a/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.test.ts +++ b/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.test.ts @@ -35,7 +35,7 @@ describe('ML - data recognizer', () => { } as unknown as SavedObjectsClientContract, { find: jest.fn() } as unknown as DataViewsService, {} as JobSavedObjectService, - { headers: { authorization: '' } } as KibanaRequest + { headers: { authorization: '' } } as unknown as KibanaRequest ); describe('jobOverrides', () => { diff --git a/x-pack/plugins/osquery/public/routes/live_queries/new/index.tsx b/x-pack/plugins/osquery/public/routes/live_queries/new/index.tsx index be8831860c9ec..1afd36e406daf 100644 --- a/x-pack/plugins/osquery/public/routes/live_queries/new/index.tsx +++ b/x-pack/plugins/osquery/public/routes/live_queries/new/index.tsx @@ -16,10 +16,14 @@ import { useRouterNavigate } from '../../../common/lib/kibana'; import { LiveQuery } from '../../../live_queries'; import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs'; +interface LocationState { + form: Record; +} + const NewLiveQueryPageComponent = () => { useBreadcrumbs('live_query_new'); const { replace } = useHistory(); - const location = useLocation(); + const location = useLocation(); const liveQueryListProps = useRouterNavigate('live_queries'); const [initialFormData, setInitialFormData] = useState | undefined>({}); diff --git a/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts b/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts index c44427f3ca9e1..178c4e5bc9fde 100644 --- a/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts +++ b/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts @@ -69,11 +69,15 @@ interface IReportingAPI { } export class ReportingAPIClient implements IReportingAPI { + private http: HttpSetup; + constructor( - private http: HttpSetup, + http: HttpSetup, private uiSettings: IUiSettingsClient, private kibanaVersion: string - ) {} + ) { + this.http = http; + } public getKibanaAppHref(job: Job): string { const searchParams = stringify({ jobId: job.id }); diff --git a/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.mock.ts b/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.mock.ts index 323adcc756674..63a159121e009 100644 --- a/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.mock.ts +++ b/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.mock.ts @@ -30,6 +30,7 @@ export const createRuleDataClientMock = ( kibanaVersion: '7.16.0', isWriteEnabled: jest.fn(() => true), + // @ts-ignore 4.3.5 upgrade getReader: jest.fn((_options?: { namespace?: string }) => ({ search, getDynamicIndexPattern, diff --git a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts index c65fdece6c5f0..fcddcab378bc6 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts @@ -31,6 +31,7 @@ describe('createLifecycleExecutor', () => { it('wraps and unwraps the original executor state', async () => { const logger = loggerMock.create(); const ruleDataClientMock = createRuleDataClientMock(); + // @ts-ignore 4.3.5 upgrade - Expression produces a union type that is too complex to represent.ts(2590) const executor = createLifecycleExecutor( logger, ruleDataClientMock diff --git a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts index 3fa567b8aca96..2284ad5e796ee 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts @@ -276,6 +276,7 @@ describe('createLifecycleRuleTypeFactory', () => { return castArray(val); }); + // @ts-ignore 4.3.5 upgrade helpers.ruleDataClientMock.getReader().search.mockResolvedValueOnce({ hits: { hits: [{ fields: stored } as any], diff --git a/x-pack/plugins/security/public/management/users/edit_user/user_form.tsx b/x-pack/plugins/security/public/management/users/edit_user/user_form.tsx index b7c52361a33a1..722f9a3f17f6d 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/user_form.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/user_form.tsx @@ -159,7 +159,7 @@ export const UserForm: FunctionComponent = ({ } else { try { const users = await getUsersThrottled(); - if (users.some((user) => user.username === values.username)) { + if (users?.some((user) => user.username === values.username)) { errors.username = i18n.translate( 'xpack.security.management.users.userForm.usernameTakenError', { diff --git a/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.ts b/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.ts index 6e99db7e1ed0b..4b04f15682777 100644 --- a/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.ts +++ b/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.ts @@ -124,7 +124,7 @@ const EntriesSchema = schema.conditional( ) ); -const getTrustedAppForOsScheme = (forUpdateFlow: boolean = false) => +const getTrustedAppForOsScheme = () => schema.object({ name: schema.string({ minLength: 1, maxLength: 256 }), description: schema.maybe(schema.string({ minLength: 0, maxLength: 256, defaultValue: '' })), @@ -143,7 +143,7 @@ const getTrustedAppForOsScheme = (forUpdateFlow: boolean = false) => }), ]), entries: EntriesSchema, - ...(forUpdateFlow ? { version: schema.maybe(schema.string()) } : {}), + version: schema.maybe(schema.string()), }); export const PostTrustedAppCreateRequestSchema = { @@ -154,5 +154,5 @@ export const PutTrustedAppUpdateRequestSchema = { params: schema.object({ id: schema.string(), }), - body: getTrustedAppForOsScheme(true), + body: getTrustedAppForOsScheme(), }; diff --git a/x-pack/plugins/security_solution/cypress/tsconfig.json b/x-pack/plugins/security_solution/cypress/tsconfig.json index 6fdc868429138..55ba3de538060 100644 --- a/x-pack/plugins/security_solution/cypress/tsconfig.json +++ b/x-pack/plugins/security_solution/cypress/tsconfig.json @@ -15,7 +15,6 @@ "cypress-file-upload", "cypress-pipe", "node", - "resize-observer-polyfill", ], }, "references": [ diff --git a/x-pack/plugins/security_solution/public/common/mock/utils.ts b/x-pack/plugins/security_solution/public/common/mock/utils.ts index 0bafdc4fad1e8..419bd2d9e7ee1 100644 --- a/x-pack/plugins/security_solution/public/common/mock/utils.ts +++ b/x-pack/plugins/security_solution/public/common/mock/utils.ts @@ -62,5 +62,5 @@ export const SUB_PLUGINS_REDUCER: SubPluginsInitReducer = { * These state's are wrapped in `Immutable`, but for compatibility with the overall app architecture, * they are cast to mutable versions here. */ - management: managementReducer as ManagementPluginReducer['management'], + management: managementReducer as unknown as ManagementPluginReducer['management'], }; diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx index d8c17f064d016..e5381757670ea 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx @@ -35,7 +35,8 @@ import { import { getThreatMock } from '../../../../../common/detection_engine/schemas/types/threat.mock'; describe('rule helpers', () => { - // @ts-expect-error + // @ts-expect-error 4.3.5 upgrade - likely requires moment upgrade + // https://github.com/elastic/kibana/issues/120236 moment.suppressDeprecationWarnings = true; describe('getStepsData', () => { test('returns object with about, define, schedule and actions step properties formatted', () => { diff --git a/x-pack/plugins/security_solution/public/management/index.ts b/x-pack/plugins/security_solution/public/management/index.ts index 3e2c8b0ca2ec8..4ca8adee5f9a8 100644 --- a/x-pack/plugins/security_solution/public/management/index.ts +++ b/x-pack/plugins/security_solution/public/management/index.ts @@ -53,7 +53,7 @@ export class Management { * Cast the ImmutableReducer to a regular reducer for compatibility with * the subplugin architecture (which expects plain redux reducers.) */ - reducer: { management: managementReducer } as ManagementPluginReducer, + reducer: { management: managementReducer } as unknown as ManagementPluginReducer, middleware: managementMiddlewareFactory(core, plugins), }, }; diff --git a/x-pack/plugins/security_solution/public/resolver/view/side_effect_simulator_factory.ts b/x-pack/plugins/security_solution/public/resolver/view/side_effect_simulator_factory.ts index b3289a510deef..1ce268ee74a5a 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/side_effect_simulator_factory.ts +++ b/x-pack/plugins/security_solution/public/resolver/view/side_effect_simulator_factory.ts @@ -101,7 +101,14 @@ export const sideEffectSimulatorFactory: () => SideEffectSimulator = () => { */ simulateElementResize(target: Element, contentRect: DOMRect) { if (this.elements.has(target)) { - const entries: ResizeObserverEntry[] = [{ target, contentRect }]; + const entries: ResizeObserverEntry[] = [ + { + target, + contentRect, + borderBoxSize: [{ inlineSize: 0, blockSize: 0 }], + contentBoxSize: [{ inlineSize: 0, blockSize: 0 }], + }, + ]; this.callback(entries, this); } } diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/styles.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/styles.tsx index af05198ef9974..feaad62b96e79 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/styles.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/styles.tsx @@ -282,7 +282,7 @@ export const EventsTrSupplementContainer = styled.div.attrs(({ width }))``; export const EventsTrSupplement = styled.div.attrs(({ className = '' }) => ({ - className: `siemEventsTable__trSupplement ${className}`, + className: `siemEventsTable__trSupplement ${className}` as string, }))<{ className: string }>` font-size: ${({ theme }) => theme.eui.euiFontSizeXS}; line-height: ${({ theme }) => theme.eui.euiLineHeight}; @@ -410,7 +410,7 @@ export const EventsHeadingTitleSpan = styled.span.attrs(({ className }) => ({ `; export const EventsHeadingExtra = styled.div.attrs(({ className = '' }) => ({ - className: `siemEventsHeading__extra ${className}`, + className: `siemEventsHeading__extra ${className}` as string, }))` margin-left: auto; margin-right: 2px; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/query_signals_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/query_signals_route.test.ts index 0e436760a88ee..0af6bceab26a5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/query_signals_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/query_signals_route.test.ts @@ -27,6 +27,7 @@ describe('query for signal', () => { server = serverMock.create(); ({ context } = requestContextMock.createTools()); + // @ts-expect-error 4.3.5 upgrade // eslint-disable-next-line @typescript-eslint/no-explicit-any ruleDataClient.getReader().search.mockResolvedValue(getEmptySignalsResponse() as any); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts index 8da9267daabac..13106ec3012be 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts @@ -17,7 +17,7 @@ import { ExceptionListClient } from '../../../../../lists/server'; import { getListArrayMock } from '../../../../common/detection_engine/schemas/types/lists.mock'; import { getExceptionListItemSchemaMock } from '../../../../../lists/common/schemas/response/exception_list_item_schema.mock'; -// @ts-expect-error +// @ts-expect-error 4.3.5 upgrade - likely requires moment upgrade moment.suppressDeprecationWarnings = true; import { diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/index.ts index 040ade4dad41c..c10c63db62ee3 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/index.ts @@ -21,6 +21,17 @@ import { securitySolutionFactory } from './factory'; import { SecuritySolutionFactory } from './factory/types'; import { EndpointAppContext } from '../../endpoint/types'; +function isObj(req: unknown): req is Record { + return typeof req === 'object' && req !== null; +} +function assertValidRequestType( + req: unknown +): asserts req is StrategyRequestType & { factoryQueryType: FactoryQueryTypes } { + if (!isObj(req) || req.factoryQueryType == null) { + throw new Error('factoryQueryType is required'); + } +} + export const securitySolutionSearchStrategyProvider = ( data: PluginStart, endpointContext: EndpointAppContext @@ -29,9 +40,8 @@ export const securitySolutionSearchStrategyProvider = { - if (request.factoryQueryType == null) { - throw new Error('factoryQueryType is required'); - } + assertValidRequestType(request); + const queryFactory: SecuritySolutionFactory = securitySolutionFactory[request.factoryQueryType]; const dsl = queryFactory.buildDsl(request); diff --git a/x-pack/plugins/timelines/public/components/t_grid/styles.tsx b/x-pack/plugins/timelines/public/components/t_grid/styles.tsx index 9f957e2c61910..ceb19837c434d 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/styles.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/styles.tsx @@ -281,7 +281,7 @@ export const EventsTrSupplementContainer = styled.div.attrs(({ width }))``; export const EventsTrSupplement = styled.div.attrs(({ className = '' }) => ({ - className: `siemEventsTable__trSupplement ${className}`, + className: `siemEventsTable__trSupplement ${className}` as string, }))<{ className: string }>` font-size: ${({ theme }) => theme.eui.euiFontSizeXS}; line-height: ${({ theme }) => theme.eui.euiLineHeight}; @@ -409,7 +409,7 @@ export const EventsHeadingTitleSpan = styled.span.attrs(({ className }) => ({ `; export const EventsHeadingExtra = styled.div.attrs(({ className = '' }) => ({ - className: `siemEventsHeading__extra ${className}`, + className: `siemEventsHeading__extra ${className}` as string, }))` margin-left: auto; margin-right: 2px; diff --git a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/credential_store.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/credential_store.test.ts index 8532e2e4eece4..90adfdfa8fced 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/credential_store.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/credential_store.test.ts @@ -8,7 +8,7 @@ import { KibanaRequest } from 'src/core/server'; import { loggingSystemMock, httpServerMock } from 'src/core/server/mocks'; import { securityMock } from '../../../../security/server/mocks'; -import { ReindexSavedObject } from '../../../common/types'; +import { ReindexStep, ReindexStatus, ReindexSavedObject } from '../../../common/types'; import { credentialStoreFactory } from './credential_store'; const basicAuthHeader = 'Basic abc'; @@ -25,7 +25,19 @@ const securityStartMock = securityMock.createStart(); const reindexOpMock = { id: 'asdf', - attributes: { indexName: 'test', lastCompletedStep: 1, locked: null }, + type: 'type', + references: [], + attributes: { + indexName: 'test', + newIndexName: 'new-index', + status: ReindexStatus.inProgress, + lastCompletedStep: ReindexStep.created, + locked: null, + reindexTaskId: null, + reindexTaskPercComplete: null, + errorMessage: null, + runningReindexCount: null, + }, } as ReindexSavedObject; describe('credentialStore', () => { @@ -52,7 +64,7 @@ describe('credentialStore', () => { security: securityStartMock, }); - reindexOpMock.attributes.lastCompletedStep = 0; + reindexOpMock.attributes.lastCompletedStep = ReindexStep.readonly; expect(credStore.get(reindexOpMock)).toBeUndefined(); }); diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/use_monitor_histogram.ts b/x-pack/plugins/uptime/public/components/overview/monitor_list/use_monitor_histogram.ts index 8f500f54cf4ba..82299825b4154 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/use_monitor_histogram.ts +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/use_monitor_histogram.ts @@ -46,6 +46,7 @@ export const useMonitorHistogram = ({ items }: { items: MonitorSummary[] }) => { ); const histogramBuckets = data?.aggregations?.histogram.buckets ?? []; + // @ts-ignore 4.3.5 upgrade const simplified = histogramBuckets.map((histogramBucket) => { const byId: { [key: string]: number } = {}; histogramBucket.by_id.buckets.forEach((idBucket) => { diff --git a/x-pack/plugins/uptime/public/state/alerts/alerts.ts b/x-pack/plugins/uptime/public/state/alerts/alerts.ts index cc934a8c68d8b..a86de3ac02b83 100644 --- a/x-pack/plugins/uptime/public/state/alerts/alerts.ts +++ b/x-pack/plugins/uptime/public/state/alerts/alerts.ts @@ -10,7 +10,7 @@ import { handleActions, Action } from 'redux-actions'; import { call, put, select, takeLatest } from 'redux-saga/effects'; import { createAsyncAction } from '../actions/utils'; import { asyncInitState, handleAsyncAction } from '../reducers/utils'; -import { AppState } from '../index'; +import type { AppState } from '../../state'; import { AsyncInitState } from '../reducers/types'; import { fetchEffectFactory } from '../effects/fetch_effect'; import { @@ -110,7 +110,7 @@ export function* fetchAlertsEffect() { yield call(disableAlertById, action.payload); yield put(deleteAnomalyAlertAction.success(action.payload.alertId)); showAlertDisabledSuccess(); - const monitorId = yield select(monitorIdSelector); + const monitorId = (yield select(monitorIdSelector)) as AppState['ui']['monitorId']; yield put(getAnomalyAlertAction.get({ monitorId })); } catch (err) { showAlertDisabledFailed(err); @@ -145,9 +145,9 @@ export function* fetchAlertsEffect() { getMonitorAlertsAction.fail ) ); - yield takeLatest(createAlertAction.get, function* (action: Action) { + yield takeLatest(createAlertAction.get, function* (action: Action): Generator { try { - const response = yield call(createAlert, action.payload); + const response = (yield call(createAlert, action.payload)) as Alert; yield put(createAlertAction.success(response)); kibanaService.core.notifications.toasts.addSuccess( diff --git a/x-pack/plugins/uptime/public/state/effects/alerts.ts b/x-pack/plugins/uptime/public/state/effects/alerts.ts index c63c6c4bdb120..4463a55b1744a 100644 --- a/x-pack/plugins/uptime/public/state/effects/alerts.ts +++ b/x-pack/plugins/uptime/public/state/effects/alerts.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { Action } from 'redux-actions'; +import type { Action } from 'redux-actions'; import { call, put, takeLatest, select } from 'redux-saga/effects'; + import { fetchEffectFactory } from './fetch_effect'; import { deleteAlertAction, getExistingAlertAction } from '../actions/alerts'; import { disableAlertById, fetchAlertRecords } from '../api/alerts'; @@ -23,18 +24,21 @@ export function* fetchAlertsEffect() { ) ); - yield takeLatest(String(deleteAlertAction.get), function* (action: Action<{ alertId: string }>) { - try { - const response = yield call(disableAlertById, action.payload); - yield put(deleteAlertAction.success(response)); - kibanaService.core.notifications.toasts.addSuccess('Alert successfully deleted!'); - const monitorId = yield select(monitorIdSelector); - yield put(getExistingAlertAction.get({ monitorId })); - } catch (err) { - kibanaService.core.notifications.toasts.addError(err, { - title: 'Alert cannot be deleted', - }); - yield put(deleteAlertAction.fail(err)); + yield takeLatest( + String(deleteAlertAction.get), + function* (action: Action<{ alertId: string }>): Generator { + try { + const response = yield call(disableAlertById, action.payload); + yield put(deleteAlertAction.success(response)); + kibanaService.core.notifications.toasts.addSuccess('Alert successfully deleted!'); + const monitorId = (yield select(monitorIdSelector)) as ReturnType; + yield put(getExistingAlertAction.get({ monitorId })); + } catch (err) { + kibanaService.core.notifications.toasts.addError(err, { + title: 'Alert cannot be deleted', + }); + yield put(deleteAlertAction.fail(err)); + } } - }); + ); } diff --git a/x-pack/plugins/uptime/public/state/effects/fetch_effect.ts b/x-pack/plugins/uptime/public/state/effects/fetch_effect.ts index 250873b90f1a0..4fbd60f7929ce 100644 --- a/x-pack/plugins/uptime/public/state/effects/fetch_effect.ts +++ b/x-pack/plugins/uptime/public/state/effects/fetch_effect.ts @@ -25,7 +25,7 @@ export function fetchEffectFactory( success: (response: R) => Action, fail: (error: IHttpFetchError) => Action ) { - return function* (action: Action) { + return function* (action: Action): Generator { try { const response = yield call(fetch, action.payload); if (response instanceof Error) { @@ -34,7 +34,7 @@ export function fetchEffectFactory( yield put(fail(response as IHttpFetchError)); } else { - yield put(success(response)); + yield put(success(response as R)); } } catch (error) { // eslint-disable-next-line no-console diff --git a/x-pack/plugins/uptime/public/state/effects/journey.ts b/x-pack/plugins/uptime/public/state/effects/journey.ts index 8d33179bde402..8898eb0e5c521 100644 --- a/x-pack/plugins/uptime/public/state/effects/journey.ts +++ b/x-pack/plugins/uptime/public/state/effects/journey.ts @@ -14,11 +14,15 @@ import { FetchJourneyStepsParams, } from '../actions/journey'; import { fetchJourneySteps } from '../api/journey'; +import type { SyntheticsJourneyApiResponse } from '../../../common/runtime_types'; -export function* fetchJourneyStepsEffect() { +export function* fetchJourneyStepsEffect(): Generator { yield takeLatest(getJourneySteps, function* (action: Action) { try { - const response = yield call(fetchJourneySteps, action.payload); + const response = (yield call( + fetchJourneySteps, + action.payload + )) as SyntheticsJourneyApiResponse; yield put(getJourneyStepsSuccess(response)); } catch (e) { yield put(getJourneyStepsFail({ checkGroup: action.payload.checkGroup, error: e })); diff --git a/x-pack/plugins/uptime/public/state/effects/ml_anomaly.ts b/x-pack/plugins/uptime/public/state/effects/ml_anomaly.ts index 6b2fa92a63b08..00c911e001fb3 100644 --- a/x-pack/plugins/uptime/public/state/effects/ml_anomaly.ts +++ b/x-pack/plugins/uptime/public/state/effects/ml_anomaly.ts @@ -22,8 +22,9 @@ import { deleteMLJob, getMLCapabilities, } from '../api/ml_anomaly'; -import { MonitorIdParam } from '../actions/types'; +import type { MonitorIdParam, DeleteJobResults } from '../actions/types'; import { anomalyAlertSelector, deleteAlertAction } from '../alerts/alerts'; +import type { AppState } from '../../state'; export function* fetchMLJobEffect() { yield takeLatest( @@ -43,20 +44,25 @@ export function* fetchMLJobEffect() { ) ); - yield takeLatest(String(deleteMLJobAction.get), function* (action: Action) { - try { - const response = yield call(deleteMLJob, action.payload); - yield put(deleteMLJobAction.success(response)); + yield takeLatest( + String(deleteMLJobAction.get), + function* (action: Action): Generator { + try { + const response = (yield call(deleteMLJob, action.payload)) as DeleteJobResults; + yield put(deleteMLJobAction.success(response)); - // let's delete alert as well if it's there - const { data: anomalyAlert } = yield select(anomalyAlertSelector); - if (anomalyAlert) { - yield put(deleteAlertAction.get({ alertId: anomalyAlert.id as string })); + // let's delete alert as well if it's there + const { data: anomalyAlert } = (yield select( + anomalyAlertSelector + )) as AppState['alerts']['anomalyAlert']; + if (anomalyAlert) { + yield put(deleteAlertAction.get({ alertId: anomalyAlert.id })); + } + } catch (err) { + yield put(deleteMLJobAction.fail(err)); } - } catch (err) { - yield put(deleteMLJobAction.fail(err)); } - }); + ); yield takeLatest( getMLCapabilitiesAction.get, diff --git a/x-pack/plugins/uptime/public/state/effects/network_events.ts b/x-pack/plugins/uptime/public/state/effects/network_events.ts index cad76dd059c01..75ea3d4467eb4 100644 --- a/x-pack/plugins/uptime/public/state/effects/network_events.ts +++ b/x-pack/plugins/uptime/public/state/effects/network_events.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Action } from 'redux-actions'; +import type { Action } from 'redux-actions'; import { call, put, takeLatest } from 'redux-saga/effects'; import { getNetworkEvents, @@ -14,27 +14,34 @@ import { FetchNetworkEventsParams, } from '../actions/network_events'; import { fetchNetworkEvents } from '../api/network_events'; +import type { SyntheticsNetworkEventsApiResponse } from '../../../common/runtime_types'; export function* fetchNetworkEventsEffect() { - yield takeLatest(getNetworkEvents, function* (action: Action) { - try { - const response = yield call(fetchNetworkEvents, action.payload); + yield takeLatest( + getNetworkEvents, + function* (action: Action): Generator { + try { + const response = (yield call( + fetchNetworkEvents, + action.payload + )) as SyntheticsNetworkEventsApiResponse; - yield put( - getNetworkEventsSuccess({ - checkGroup: action.payload.checkGroup, - stepIndex: action.payload.stepIndex, - ...response, - }) - ); - } catch (e) { - yield put( - getNetworkEventsFail({ - checkGroup: action.payload.checkGroup, - stepIndex: action.payload.stepIndex, - error: e, - }) - ); + yield put( + getNetworkEventsSuccess({ + checkGroup: action.payload.checkGroup, + stepIndex: action.payload.stepIndex, + ...response, + }) + ); + } catch (e) { + yield put( + getNetworkEventsFail({ + checkGroup: action.payload.checkGroup, + stepIndex: action.payload.stepIndex, + error: e, + }) + ); + } } - }); + ); } diff --git a/x-pack/plugins/uptime/public/state/index.ts b/x-pack/plugins/uptime/public/state/index.ts index 61b1a5f9d9527..506051b95fd5a 100644 --- a/x-pack/plugins/uptime/public/state/index.ts +++ b/x-pack/plugins/uptime/public/state/index.ts @@ -6,6 +6,7 @@ */ import { createStore, applyMiddleware } from 'redux'; +import type { Store } from 'redux'; import { composeWithDevTools } from 'redux-devtools-extension'; import createSagaMiddleware from 'redux-saga'; import { rootEffect } from './effects'; @@ -15,6 +16,6 @@ export type AppState = ReturnType; const sagaMW = createSagaMiddleware(); -export const store = createStore(rootReducer, composeWithDevTools(applyMiddleware(sagaMW))); +export const store: Store = createStore(rootReducer, composeWithDevTools(applyMiddleware(sagaMW))); sagaMW.run(rootEffect); diff --git a/x-pack/plugins/uptime/public/state/selectors/index.ts b/x-pack/plugins/uptime/public/state/selectors/index.ts index c0da9389f13af..db18cbb9e114f 100644 --- a/x-pack/plugins/uptime/public/state/selectors/index.ts +++ b/x-pack/plugins/uptime/public/state/selectors/index.ts @@ -6,7 +6,7 @@ */ import { createSelector } from 'reselect'; -import { AppState } from '../../state'; +import type { AppState } from '../../state'; // UI Selectors export const getBasePath = ({ ui: { basePath } }: AppState) => basePath; diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_status.ts b/x-pack/plugins/uptime/server/lib/requests/get_monitor_status.ts index 81a1e6ba7ca7a..4fe7e94803fd7 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_monitor_status.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_monitor_status.ts @@ -189,6 +189,7 @@ export const getMonitorStatus: UMElasticsearchQueryFn< monitors = monitors.concat(monitorRes); } while (afterKey !== undefined); + // @ts-ignore 4.3.5 upgrade - Expression produces a union type that is too complex to represent.ts(2590) return monitors .filter((monitor) => monitor?.doc_count >= numTimes) .map(({ key, doc_count: count, fields }) => ({ diff --git a/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.test.ts b/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.test.ts index 22f714e408a1c..f62c31b10e459 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.test.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.test.ts @@ -217,4 +217,42 @@ describe('getPingHistogram', () => { expect(mockEsClient.search).toHaveBeenCalledTimes(1); expect(result).toMatchSnapshot(); }); + + it('returns an empty array if agg buckets are undefined', async () => { + const { esClient: mockEsClient, uptimeEsClient } = getUptimeESMockClient(); + + mockEsClient.search.mockResolvedValueOnce({ + body: { + aggregations: { + timeseries: { + buckets: undefined, + interval: '1m', + }, + }, + }, + } as any); + + const result = await getPingHistogram({ uptimeEsClient, dateStart: 'now-15m', dateEnd: 'now' }); + + expect(result.histogram).toEqual([]); + }); + + it('returns an empty array if agg buckets are empty', async () => { + const { esClient: mockEsClient, uptimeEsClient } = getUptimeESMockClient(); + + mockEsClient.search.mockResolvedValueOnce({ + body: { + aggregations: { + timeseries: { + buckets: [], + interval: '1m', + }, + }, + }, + } as any); + + const result = await getPingHistogram({ uptimeEsClient, dateStart: 'now-15m', dateEnd: 'now' }); + + expect(result.histogram).toEqual([]); + }); }); diff --git a/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.ts b/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.ts index 600a335effe2c..139ac8bad417c 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.ts @@ -90,7 +90,7 @@ export const getPingHistogram: UMElasticsearchQueryFn { + const histogram = buckets.map((bucket: Pick) => { const x: number = bucket.key; const downCount = bucket.down.value || 0; const upCount = bucket.up.value || 0; diff --git a/x-pack/test/functional/services/observability/users.ts b/x-pack/test/functional/services/observability/users.ts index 7cb98603548ba..ac2fc8ddd324e 100644 --- a/x-pack/test/functional/services/observability/users.ts +++ b/x-pack/test/functional/services/observability/users.ts @@ -96,7 +96,6 @@ const defineBasicObservabilityRole = ( { spaces: ['*'], base: [], - // @ts-expect-error TypeScript doesn't distinguish between missing and // undefined props yet feature: features, }, diff --git a/yarn.lock b/yarn.lock index 7a1afe15ddd33..ca0569e44007b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1477,14 +1477,6 @@ dependencies: tslib "^2.0.0" -"@dsherret/to-absolute-glob@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@dsherret/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz#1f6475dc8bd974cea07a2daf3864b317b1dd332c" - integrity sha1-H2R13IvZdM6gei2vOGSzF7HdMyw= - dependencies: - is-absolute "^1.0.0" - is-negated-glob "^1.0.0" - "@elastic/apm-rum-core@^5.12.1": version "5.12.1" resolved "https://registry.yarnpkg.com/@elastic/apm-rum-core/-/apm-rum-core-5.12.1.tgz#ad78787876c68b9ce718d1c42b8e7b12b12eaa69" @@ -4950,17 +4942,15 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== -"@ts-morph/common@~0.7.0": - version "0.7.3" - resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.7.3.tgz#380020c278e4aa6cecedf362a1157591d1003267" - integrity sha512-M6Tcu0EZDLL8Ht7WAYz7yJfDZ9eArhqR8XZ9Mk3q8jwU6MKFAttrw3JtW4JhneqTz7pZMv4XaimEdXI0E4K4rg== +"@ts-morph/common@~0.10.1": + version "0.10.1" + resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.10.1.tgz#be15b9ab13a32bbc1f6a6bd7dc056b2247b272eb" + integrity sha512-rKN/VtZUUlW4M+6vjLFSaFc1Z9sK+1hh0832ucPtPkXqOw/mSWE80Lau4z2zTPNTqtxAjfZbvKpQcEwJy0KIEg== dependencies: - "@dsherret/to-absolute-glob" "^2.0.2" - fast-glob "^3.2.4" - is-negated-glob "^1.0.0" + fast-glob "^3.2.5" + minimatch "^3.0.4" mkdirp "^1.0.4" - multimatch "^5.0.0" - typescript "~4.1.2" + path-browserify "^1.0.1" "@tsconfig/node10@^1.0.7": version "1.0.8" @@ -5626,11 +5616,16 @@ resolved "https://registry.yarnpkg.com/@types/he/-/he-1.1.1.tgz#19e14033c4ee8f1a702c74dcc6182664839ac2b7" integrity sha512-jpzrsR1ns0n3kyWt92QfOUQhIuJGQ9+QGa7M62rO6toe98woQjnsnzjdMtsQXCdvjjmqjS2ZBCC7xKw0cdzU+Q== -"@types/history@*", "@types/history@^4.7.3": +"@types/history@*": version "4.7.3" resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.3.tgz#856c99cdc1551d22c22b18b5402719affec9839a" integrity sha512-cS5owqtwzLN5kY+l+KgKdRJ/Cee8tlmQoGQuIE9tWnSmS3JMKzmxo2HIAk2wODMifGwO20d62xZQLYz+RLfXmw== +"@types/history@^4.7.9": + version "4.7.9" + resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.9.tgz#1cfb6d60ef3822c589f18e70f8b12f9a28ce8724" + integrity sha512-MUc6zSmU3tEVnkQ78q0peeEjKWPUADMlC/t++2bI8WnAG2tvYRPIgHG8lWkXwqc8MsUF6Z2MOf+Mh5sazOmhiQ== + "@types/hjson@^2.4.2": version "2.4.2" resolved "https://registry.yarnpkg.com/@types/hjson/-/hjson-2.4.2.tgz#fd0288a5b6778cda993c978e43cc978ddc8f22e9" @@ -13699,17 +13694,16 @@ fast-glob@2.2.7, fast-glob@^2.2.6: merge2 "^1.2.3" micromatch "^3.1.10" -fast-glob@3.2.5, fast-glob@^3.0.3, fast-glob@^3.1.1, fast-glob@^3.2.2, fast-glob@^3.2.4: - version "3.2.5" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661" - integrity sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg== +fast-glob@3.2.7, fast-glob@^3.0.3, fast-glob@^3.1.1, fast-glob@^3.2.2, fast-glob@^3.2.4, fast-glob@^3.2.5: + version "3.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" + integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.0" + glob-parent "^5.1.2" merge2 "^1.3.0" - micromatch "^4.0.2" - picomatch "^2.2.1" + micromatch "^4.0.4" fast-json-parse@^1.0.3: version "1.0.3" @@ -14751,7 +14745,7 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" -glob-parent@^5.1.0, glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.0: +glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.0: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -20022,17 +20016,6 @@ multimatch@^4.0.0: arrify "^2.0.1" minimatch "^3.0.4" -multimatch@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-5.0.0.tgz#932b800963cea7a31a033328fa1e0c3a1874dbe6" - integrity sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA== - dependencies: - "@types/minimatch" "^3.0.3" - array-differ "^3.0.0" - array-union "^2.1.0" - arrify "^2.0.1" - minimatch "^3.0.4" - multiparty@^4.1.2: version "4.2.1" resolved "https://registry.yarnpkg.com/multiparty/-/multiparty-4.2.1.tgz#d9b6c46d8b8deab1ee70c734b0af771dd46e0b13" @@ -21495,6 +21478,11 @@ path-browserify@0.0.1, path-browserify@~0.0.0: resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== +path-browserify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" + integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== + path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" @@ -27509,13 +27497,12 @@ ts-loader@^7.0.5: micromatch "^4.0.0" semver "^6.0.0" -ts-morph@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-9.1.0.tgz#10d2088387c71f3c674f82492a3cec1e3538f0dd" - integrity sha512-sei4u651MBenr27sD6qLDXN3gZ4thiX71E3qV7SuVtDas0uvK2LtgZkIYUf9DKm/fLJ6AB/+yhRJ1vpEBJgy7Q== +ts-morph@^11.0.0: + version "11.0.3" + resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-11.0.3.tgz#01a92b3c2b5a48ccdf318ec90864229b8061d056" + integrity sha512-ymuPkndv9rzqTLiHWMkVrFXWcN4nBiBGhRP/kTC9F5amAAl7BNLfyrsTzMD1o9A0zishKoF1KQT/0yyFhJnPgA== dependencies: - "@dsherret/to-absolute-glob" "^2.0.2" - "@ts-morph/common" "~0.7.0" + "@ts-morph/common" "~0.10.1" code-block-writer "^10.1.1" ts-node@^10.2.1: @@ -27737,10 +27724,10 @@ typescript-tuple@^2.2.1: dependencies: typescript-compare "^0.0.2" -typescript@4.1.3, typescript@^3.3.3333, typescript@^3.5.3, typescript@^4.3.5, typescript@~4.1.2, typescript@~4.4.2: - version "4.1.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" - integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg== +typescript@4.3.5, typescript@^3.3.3333, typescript@^3.5.3, typescript@^4.3.5, typescript@~4.4.2: + version "4.3.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" + integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== ua-parser-js@^0.7.18: version "0.7.24" From 1b38b8ea1516d996432e9a280e455ef8d0d2fbd0 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 3 Dec 2021 02:48:51 +0000 Subject: [PATCH 02/62] chore(NA): splits types from code on @kbn/config (#120267) --- package.json | 1 + packages/BUILD.bazel | 1 + packages/kbn-cli-dev-mode/BUILD.bazel | 2 +- packages/kbn-config/BUILD.bazel | 26 ++++++++++++++++++++++---- packages/kbn-config/package.json | 1 - packages/kbn-docs-utils/BUILD.bazel | 2 +- packages/kbn-optimizer/BUILD.bazel | 4 +++- yarn.lock | 4 ++++ 8 files changed, 33 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 06e338ab87ca7..a6dfd03893c81 100644 --- a/package.json +++ b/package.json @@ -561,6 +561,7 @@ "@types/kbn__apm-config-loader": "link:bazel-bin/packages/kbn-apm-config-loader/npm_module_types", "@types/kbn__apm-utils": "link:bazel-bin/packages/kbn-apm-utils/npm_module_types", "@types/kbn__cli-dev-mode": "link:bazel-bin/packages/kbn-cli-dev-mode/npm_module_types", + "@types/kbn__config": "link:bazel-bin/packages/kbn-config/npm_module_types", "@types/kbn__i18n": "link:bazel-bin/packages/kbn-i18n/npm_module_types", "@types/kbn__i18n-react": "link:bazel-bin/packages/kbn-i18n-react/npm_module_types", "@types/license-checker": "15.0.0", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 9e124cf63a391..8208496f7d800 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -83,6 +83,7 @@ filegroup( "//packages/kbn-apm-config-loader:build_types", "//packages/kbn-apm-utils:build_types", "//packages/kbn-cli-dev-mode:build_types", + "//packages/kbn-config:build_types", "//packages/kbn-i18n:build_types", "//packages/kbn-i18n-react:build_types", ], diff --git a/packages/kbn-cli-dev-mode/BUILD.bazel b/packages/kbn-cli-dev-mode/BUILD.bazel index 686866ce7bc88..c6611e71e35ab 100644 --- a/packages/kbn-cli-dev-mode/BUILD.bazel +++ b/packages/kbn-cli-dev-mode/BUILD.bazel @@ -48,7 +48,7 @@ RUNTIME_DEPS = [ ] TYPES_DEPS = [ - "//packages/kbn-config", + "//packages/kbn-config:npm_module_types", "//packages/kbn-config-schema", "//packages/kbn-dev-utils", "//packages/kbn-logging", diff --git a/packages/kbn-config/BUILD.bazel b/packages/kbn-config/BUILD.bazel index 061b8306bcc6f..c0b75ab491ac0 100644 --- a/packages/kbn-config/BUILD.bazel +++ b/packages/kbn-config/BUILD.bazel @@ -1,9 +1,10 @@ -load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") -load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") -load("//src/dev/bazel:index.bzl", "jsts_transpiler") +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") PKG_BASE_NAME = "kbn-config" PKG_REQUIRE_NAME = "@kbn/config" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__config" SOURCE_FILES = glob( [ @@ -91,7 +92,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], + deps = RUNTIME_DEPS + [":target_node"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) @@ -110,3 +111,20 @@ filegroup( ], visibility = ["//visibility:public"], ) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = TYPES_PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [ + ":npm_module_types", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-config/package.json b/packages/kbn-config/package.json index e30db61ae0c28..012b39d733a78 100644 --- a/packages/kbn-config/package.json +++ b/packages/kbn-config/package.json @@ -1,7 +1,6 @@ { "name": "@kbn/config", "main": "./target_node/index.js", - "types": "./target_types/index.d.ts", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true diff --git a/packages/kbn-docs-utils/BUILD.bazel b/packages/kbn-docs-utils/BUILD.bazel index ab018a0ab73b0..6bb37b3500152 100644 --- a/packages/kbn-docs-utils/BUILD.bazel +++ b/packages/kbn-docs-utils/BUILD.bazel @@ -36,7 +36,7 @@ RUNTIME_DEPS = [ ] TYPES_DEPS = [ - "//packages/kbn-config", + "//packages/kbn-config:npm_module_types", "//packages/kbn-dev-utils", "//packages/kbn-utils", "@npm//ts-morph", diff --git a/packages/kbn-optimizer/BUILD.bazel b/packages/kbn-optimizer/BUILD.bazel index 647fcdfcbaad3..cc03c81070745 100644 --- a/packages/kbn-optimizer/BUILD.bazel +++ b/packages/kbn-optimizer/BUILD.bazel @@ -46,6 +46,7 @@ RUNTIME_DEPS = [ "@npm//execa", "@npm//jest-diff", "@npm//json-stable-stringify", + "@npm//js-yaml", "@npm//lmdb-store", "@npm//loader-utils", "@npm//node-sass", @@ -61,7 +62,7 @@ RUNTIME_DEPS = [ ] TYPES_DEPS = [ - "//packages/kbn-config", + "//packages/kbn-config:npm_module_types", "//packages/kbn-config-schema", "//packages/kbn-dev-utils", "//packages/kbn-std", @@ -81,6 +82,7 @@ TYPES_DEPS = [ "@npm//@types/compression-webpack-plugin", "@npm//@types/jest", "@npm//@types/json-stable-stringify", + "@npm//@types/js-yaml", "@npm//@types/loader-utils", "@npm//@types/node", "@npm//@types/normalize-path", diff --git a/yarn.lock b/yarn.lock index ca0569e44007b..9472271c20998 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5824,6 +5824,10 @@ version "0.0.0" uid "" +"@types/kbn__config@link:bazel-bin/packages/kbn-config/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__i18n-react@link:bazel-bin/packages/kbn-i18n-react/npm_module_types": version "0.0.0" uid "" From 31042342d61dfc3e778e9217eefd589c795f903c Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 2 Dec 2021 21:14:13 -0700 Subject: [PATCH 03/62] [jest] restore integration test running x-pack (#120252) --- jest.config.integration.js | 16 +++++++++++++++- .../get_searchable_types.test.ts | 3 ++- .../managed_configuration.test.ts | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/jest.config.integration.js b/jest.config.integration.js index e2b2afaa715ee..a2ac498986c08 100644 --- a/jest.config.integration.js +++ b/jest.config.integration.js @@ -6,8 +6,22 @@ * Side Public License, v 1. */ +const Fs = require('fs'); +const Path = require('path'); + module.exports = { preset: '@kbn/test/jest_integration', rootDir: '.', - roots: ['/src', '/packages'], + roots: [ + '/src', + '/packages', + ...Fs.readdirSync(Path.resolve(__dirname, 'x-pack')).flatMap((name) => { + // create roots for all x-pack/* dirs except for test + if (name !== 'test' && Fs.statSync(Path.resolve(__dirname, 'x-pack', name)).isDirectory()) { + return [`/x-pack/${name}`]; + } + + return []; + }), + ], }; diff --git a/x-pack/plugins/global_search/server/routes/integration_tests/get_searchable_types.test.ts b/x-pack/plugins/global_search/server/routes/integration_tests/get_searchable_types.test.ts index d1a9f692c2e9f..b8224d9a30d08 100644 --- a/x-pack/plugins/global_search/server/routes/integration_tests/get_searchable_types.test.ts +++ b/x-pack/plugins/global_search/server/routes/integration_tests/get_searchable_types.test.ts @@ -14,7 +14,8 @@ import { registerInternalSearchableTypesRoute } from '../get_searchable_types'; type SetupServerReturn = UnwrapPromise>; const pluginId = Symbol('globalSearch'); -describe('GET /internal/global_search/searchable_types', () => { +// FAILING: https://github.com/elastic/kibana/issues/120268 +describe.skip('GET /internal/global_search/searchable_types', () => { let server: SetupServerReturn['server']; let httpSetup: SetupServerReturn['httpSetup']; let globalSearchHandlerContext: ReturnType< diff --git a/x-pack/plugins/task_manager/server/integration_tests/managed_configuration.test.ts b/x-pack/plugins/task_manager/server/integration_tests/managed_configuration.test.ts index 271d24d73357b..3442e69aab44a 100644 --- a/x-pack/plugins/task_manager/server/integration_tests/managed_configuration.test.ts +++ b/x-pack/plugins/task_manager/server/integration_tests/managed_configuration.test.ts @@ -16,7 +16,8 @@ import { TaskManagerPlugin, TaskManagerStartContract } from '../plugin'; import { coreMock } from '../../../../../src/core/server/mocks'; import { TaskManagerConfig } from '../config'; -describe('managed configuration', () => { +// FAILING: https://github.com/elastic/kibana/issues/120269 +describe.skip('managed configuration', () => { let taskManagerStart: TaskManagerStartContract; let logger: Logger; From 3ede8c4a8b09578b54d37f1e694bee58521be557 Mon Sep 17 00:00:00 2001 From: Peter Dyson Date: Fri, 3 Dec 2021 15:53:25 +1000 Subject: [PATCH 04/62] [DOCS] document missing enabledActionTypes value for Microsoft Teams action (#113211) * [DOCS] document missing value for Microsoft Teams action [DOCS] document missing value for Microsoft Teams action for xpack.actions.enabledActionTypes config. eg: xpack.actions.enabledActionTypes: ['.email','.teams'] * include the full list of possible values * Update docs/settings/alert-action-settings.asciidoc LGTM Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * commit using @elastic.co Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> --- docs/settings/alert-action-settings.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings/alert-action-settings.asciidoc b/docs/settings/alert-action-settings.asciidoc index 66e23686e14e0..f0c22ebf8b730 100644 --- a/docs/settings/alert-action-settings.asciidoc +++ b/docs/settings/alert-action-settings.asciidoc @@ -126,7 +126,7 @@ into a single string. This configuration can be used for environments where the files cannot be made available. `xpack.actions.enabledActionTypes` {ess-icon}:: -A list of action types that are enabled. It defaults to `[*]`, enabling all types. The names for built-in {kib} action types are prefixed with a `.` and include: `.server-log`, `.slack`, `.email`, `.index`, `.pagerduty`, and `.webhook`. An empty list `[]` will disable all action types. +A list of action types that are enabled. It defaults to `[*]`, enabling all types. The names for built-in {kib} action types are prefixed with a `.` and include: `.email`, `.index`, `.jira`, `.pagerduty`, `.resilient`, `.server-log`, `.servicenow`, .`servicenow-itom`, `.servicenow-sir`, `.slack`, `.swimlane`, `.teams`, and `.webhook`. An empty list `[]` will disable all action types. + Disabled action types will not appear as an option when creating new connectors, but existing connectors and actions of that type will remain in {kib} and will not function. From 8e5b3a0fd33939a371e37be7e076ea7d19fb8b02 Mon Sep 17 00:00:00 2001 From: Yaroslav Kuznietsov Date: Fri, 3 Dec 2021 09:05:04 +0200 Subject: [PATCH 05/62] [Canvas] Filters panel for element settings. (#117270) * Added filters panel on selecting the element. * Added unit tests. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../element_settings.component.tsx | 38 +++++++- .../workpad_filters/__stories__/elements.ts | 19 +++- .../__stories__/workpad_filters.stories.tsx | 5 +- .../hooks/use_canvas_filters.ts | 7 +- .../workpad_filters/workpad_filters.tsx | 19 +++- .../canvas/public/functions/filters.ts | 7 +- .../plugins/canvas/public/lib/filter.test.ts | 89 +++++++++++++++++++ x-pack/plugins/canvas/public/lib/filter.ts | 42 ++++++++- 8 files changed, 206 insertions(+), 20 deletions(-) diff --git a/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.component.tsx b/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.component.tsx index a912668d91432..0dcafd012ee7c 100644 --- a/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.component.tsx +++ b/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.component.tsx @@ -5,9 +5,9 @@ * 2.0. */ -import React, { FunctionComponent } from 'react'; +import React, { FunctionComponent, useState } from 'react'; import PropTypes from 'prop-types'; -import { EuiTabbedContent } from '@elastic/eui'; +import { EuiTabbedContent, EuiTabbedContentTab } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; // @ts-expect-error unconverted component @@ -15,6 +15,8 @@ import { Datasource } from '../../datasource'; // @ts-expect-error unconverted component import { FunctionFormList } from '../../function_form_list'; import { PositionedElement } from '../../../../types'; +import { WorkpadFilters } from '../../workpad_filters/workpad_filters'; +import { isExpressionWithFilters } from '../../../lib/filter'; const strings = { getDataTabLabel: () => @@ -29,6 +31,11 @@ const strings = { defaultMessage: 'Display', description: 'This tab contains the settings for how data is displayed in a Canvas element', }), + getFiltersTabLabel: () => + i18n.translate('xpack.canvas.elementSettings.filtersTabLabel', { + defaultMessage: 'Filters', + description: 'This tab contains information about filters related to a Canvas element', + }), }; interface Props { @@ -39,6 +46,16 @@ interface Props { } export const ElementSettings: FunctionComponent = ({ element }) => { + const filtersTab = isExpressionWithFilters(element.expression) && { + id: 'filters', + name: strings.getFiltersTabLabel(), + content: ( +
+ +
+ ), + }; + const tabs = [ { id: 'edit', @@ -60,8 +77,23 @@ export const ElementSettings: FunctionComponent = ({ element }) => { ), }, + ...(filtersTab ? [filtersTab] : []), ]; - return ; + + const [selectedTab, setSelectedTab] = useState(tabs[0]); + + const onTabClick = (tab: EuiTabbedContentTab) => setSelectedTab(tab); + + const getTab = (tabId: string) => tabs.filter((tab) => tab.id === tabId)[0] ?? tabs[0]; + + return ( + + ); }; ElementSettings.propTypes = { diff --git a/x-pack/plugins/canvas/public/components/workpad_filters/__stories__/elements.ts b/x-pack/plugins/canvas/public/components/workpad_filters/__stories__/elements.ts index 9eacfb54a411f..56df931ffade5 100644 --- a/x-pack/plugins/canvas/public/components/workpad_filters/__stories__/elements.ts +++ b/x-pack/plugins/canvas/public/components/workpad_filters/__stories__/elements.ts @@ -6,7 +6,7 @@ */ import moment from 'moment'; -import { CanvasElement } from '../../../../types'; +import { CanvasElement, PositionedElement } from '../../../../types'; const timeFormat = 'MM.dd.YYYY HH:mm'; @@ -31,6 +31,14 @@ const time2 = { }; const group2 = 'Group 2'; +export const element: CanvasElement = { + id: '0', + position: generatePosition(0), + type: 'element', + expression: `filters group="${group2}"`, + filter: '', +}; + const element1: CanvasElement = { id: '1', position: generatePosition(1), @@ -44,7 +52,7 @@ const element2: CanvasElement = { position: generatePosition(2), type: 'element', expression: '', - filter: `exactly value="machine-learning" column="project1" filterGroup="${group1}"`, + filter: `exactly value="machine-learning" column="project1" filterGroup="${group2}"`, }; const element3: CanvasElement = { @@ -63,4 +71,9 @@ const element4: CanvasElement = { filter: `exactly value="kibana" column="project2" filterGroup="${group2}"`, }; -export const elements = [element1, element2, element3, element4]; +export const elementWithGroup: PositionedElement = { + ...element, + ast: { type: 'expression', chain: [] }, +}; + +export const elements = [element, element1, element2, element3, element4]; diff --git a/x-pack/plugins/canvas/public/components/workpad_filters/__stories__/workpad_filters.stories.tsx b/x-pack/plugins/canvas/public/components/workpad_filters/__stories__/workpad_filters.stories.tsx index b97043bf83304..b477ac220f6a9 100644 --- a/x-pack/plugins/canvas/public/components/workpad_filters/__stories__/workpad_filters.stories.tsx +++ b/x-pack/plugins/canvas/public/components/workpad_filters/__stories__/workpad_filters.stories.tsx @@ -9,7 +9,7 @@ import { storiesOf } from '@storybook/react'; import React from 'react'; import { reduxDecorator } from '../../../../storybook'; import { WorkpadFilters } from '../workpad_filters'; -import { elements } from './elements'; +import { elementWithGroup, elements } from './elements'; storiesOf('components/WorkpadFilters/WorkpadFilters', module) .addDecorator((story) => ( @@ -20,4 +20,5 @@ storiesOf('components/WorkpadFilters/WorkpadFilters', module) )) .addDecorator(reduxDecorator({ elements })) - .add('redux: default', () => ); + .add('redux: default', () => ) + .add('redux: selected element with group', () => ); diff --git a/x-pack/plugins/canvas/public/components/workpad_filters/hooks/use_canvas_filters.ts b/x-pack/plugins/canvas/public/components/workpad_filters/hooks/use_canvas_filters.ts index ce8e90def5aad..10643e729d837 100644 --- a/x-pack/plugins/canvas/public/components/workpad_filters/hooks/use_canvas_filters.ts +++ b/x-pack/plugins/canvas/public/components/workpad_filters/hooks/use_canvas_filters.ts @@ -8,15 +8,18 @@ import { fromExpression } from '@kbn/interpreter/common'; import { shallowEqual, useSelector } from 'react-redux'; import { State } from '../../../../types'; +import { getFiltersByGroups } from '../../../lib/filter'; import { adaptCanvasFilter } from '../../../lib/filter_adapters'; import { getGlobalFilters } from '../../../state/selectors/workpad'; const extractExpressionAST = (filtersExpressions: string[]) => fromExpression(filtersExpressions.join(' | ')); -export function useCanvasFilters() { +export function useCanvasFilters(groups: string[] = [], ungrouped: boolean = false) { const filterExpressions = useSelector((state: State) => getGlobalFilters(state), shallowEqual); - const expression = extractExpressionAST(filterExpressions); + const filtersByGroups = getFiltersByGroups(filterExpressions, groups, ungrouped); + + const expression = extractExpressionAST(filtersByGroups); const filters = expression.chain.map(adaptCanvasFilter); return filters; diff --git a/x-pack/plugins/canvas/public/components/workpad_filters/workpad_filters.tsx b/x-pack/plugins/canvas/public/components/workpad_filters/workpad_filters.tsx index c04fe543804b4..610e6e56af350 100644 --- a/x-pack/plugins/canvas/public/components/workpad_filters/workpad_filters.tsx +++ b/x-pack/plugins/canvas/public/components/workpad_filters/workpad_filters.tsx @@ -7,14 +7,22 @@ import React, { FC, useCallback } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { State, FilterField } from '../../../types'; -import { groupFiltersBy } from '../../lib/filter'; +import { State, FilterField, PositionedElement } from '../../../types'; +import { + extractGroupsFromElementsFilters, + groupFiltersBy, + extractUngroupedFromElementsFilters, +} from '../../lib/filter'; import { setGroupFiltersByOption } from '../../state/actions/sidebar'; import { getGroupFiltersByOption } from '../../state/selectors/sidebar'; import { useCanvasFilters } from './hooks'; import { WorkpadFilters as Component } from './workpad_filters.component'; -export const WorkpadFilters: FC = () => { +interface Props { + element?: PositionedElement | null; +} + +export const WorkpadFilters: FC = ({ element }) => { const groupFiltersByField: FilterField = useSelector((state: State) => getGroupFiltersByOption(state) ); @@ -28,7 +36,10 @@ export const WorkpadFilters: FC = () => { [dispatch] ); - const canvasFilters = useCanvasFilters(); + const groups = element ? extractGroupsFromElementsFilters(element.expression) : undefined; + const ungrouped = element ? extractUngroupedFromElementsFilters(element.expression) : false; + + const canvasFilters = useCanvasFilters(groups, ungrouped); const filtersGroups = groupFiltersByField ? groupFiltersBy(canvasFilters, groupFiltersByField) diff --git a/x-pack/plugins/canvas/public/functions/filters.ts b/x-pack/plugins/canvas/public/functions/filters.ts index bc6aedd4662c1..ca2cede4e8555 100644 --- a/x-pack/plugins/canvas/public/functions/filters.ts +++ b/x-pack/plugins/canvas/public/functions/filters.ts @@ -15,6 +15,7 @@ import { getGlobalFilters, getWorkpadVariablesAsObject } from '../state/selector import { ExpressionValueFilter } from '../../types'; import { getFunctionHelp } from '../../i18n'; import { InitializeArguments } from '.'; +import { getFiltersByGroups } from '../lib/filter'; export interface Arguments { group: string[]; @@ -35,11 +36,7 @@ function getFiltersByGroup(allFilters: string[], groups?: string[], ungrouped = }); } - return allFilters.filter((filter: string) => { - const ast = fromExpression(filter); - const expGroups: string[] = get(ast, 'chain[0].arguments.filterGroup', []); - return expGroups.length > 0 && expGroups.every((expGroup) => groups.includes(expGroup)); - }); + return getFiltersByGroups(allFilters, groups); } type FiltersFunction = ExpressionFunctionDefinition< diff --git a/x-pack/plugins/canvas/public/lib/filter.test.ts b/x-pack/plugins/canvas/public/lib/filter.test.ts index 497f75b91650f..bf19bd6ecf4b8 100644 --- a/x-pack/plugins/canvas/public/lib/filter.test.ts +++ b/x-pack/plugins/canvas/public/lib/filter.test.ts @@ -18,6 +18,10 @@ import { flattenFilterView, createFilledFilterView, groupFiltersBy, + getFiltersByGroups, + extractGroupsFromElementsFilters, + extractUngroupedFromElementsFilters, + isExpressionWithFilters, } from './filter'; const formatterFactory = (value: unknown) => () => JSON.stringify(value); @@ -280,3 +284,88 @@ describe('groupFiltersBy', () => { expect(grouped).toEqual([{ name: null, filters: filtersWithoutGroups }]); }); }); + +describe('getFiltersByGroups', () => { + const group1 = 'Group 1'; + const group2 = 'Group 2'; + + const filters = [ + `exactly value="x-pack" column="project1" filterGroup="${group1}"`, + `exactly value="beats" column="project1" filterGroup="${group2}"`, + `exactly value="machine-learning" column="project1"`, + `exactly value="kibana" column="project2" filterGroup="${group2}"`, + ]; + + it('returns all filters related to a specified groups', () => { + expect(getFiltersByGroups(filters, [group1, group2])).toEqual([ + filters[0], + filters[1], + filters[3], + ]); + + expect(getFiltersByGroups(filters, [group2])).toEqual([filters[1], filters[3]]); + }); + + it('returns filters without group if ungrouped is true', () => { + expect(getFiltersByGroups(filters, [], true)).toEqual([filters[2]]); + }); + + it('returns filters with group if ungrouped is true and groups are not empty', () => { + expect(getFiltersByGroups(filters, [group1], true)).toEqual([filters[0]]); + }); + + it('returns empty array if not found any filter with a specified group', () => { + expect(getFiltersByGroups(filters, ['absent group'])).toEqual([]); + }); + + it('returns empty array if not groups specified', () => { + expect(getFiltersByGroups(filters, [])).toEqual(filters); + }); +}); + +describe('extractGroupsFromElementsFilters', () => { + const exprFilters = 'filters'; + const exprRest = 'demodata | plot | render'; + + it('returns groups which are specified at filters expression', () => { + const groups = ['group 1', 'group 2', 'group 3', 'group 4']; + const additionalGroups = [...groups, 'group 5']; + const groupsExpr = groups.map((group) => `group="${group}"`).join(' '); + const additionalGroupsExpr = additionalGroups.map((group) => `group="${group}"`).join(' '); + + expect( + extractGroupsFromElementsFilters( + `${exprFilters} ${groupsExpr} | ${exprFilters} ${additionalGroupsExpr} | ${exprRest}` + ) + ).toEqual(additionalGroups); + }); + + it('returns empty array if no groups were specified at filters expression', () => { + expect(extractGroupsFromElementsFilters(`${exprFilters} | ${exprRest}`)).toEqual([]); + }); +}); + +describe('extractUngroupedFromElementsFilters', () => { + it('checks if ungrouped filters expression exist at the element', () => { + const expression = + 'filters group="10" group="11" | filters group="15" ungrouped=true | demodata | plot | render'; + const isUngrouped = extractUngroupedFromElementsFilters(expression); + expect(isUngrouped).toBeTruthy(); + + const nextExpression = + 'filters group="10" group="11" | filters group="15" | demodata | plot | render'; + const nextIsUngrouped = extractUngroupedFromElementsFilters(nextExpression); + expect(nextIsUngrouped).toBeFalsy(); + }); +}); + +describe('isExpressionWithFilters', () => { + it('checks if the expression is applying filters', () => { + const expression = + 'filters group="10" group="11" | filters group="15" ungrouped=true | demodata | plot | render'; + expect(isExpressionWithFilters(expression)).toBeTruthy(); + + const nextExpression = 'demodata | plot | render'; + expect(isExpressionWithFilters(nextExpression)).toBeFalsy(); + }); +}); diff --git a/x-pack/plugins/canvas/public/lib/filter.ts b/x-pack/plugins/canvas/public/lib/filter.ts index ae75822e4a7c9..56f6558eff48b 100644 --- a/x-pack/plugins/canvas/public/lib/filter.ts +++ b/x-pack/plugins/canvas/public/lib/filter.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { flowRight, groupBy } from 'lodash'; +import { fromExpression } from '@kbn/interpreter/common'; +import { flowRight, get, groupBy } from 'lodash'; import { Filter as FilterType, FilterField, @@ -53,3 +54,42 @@ export const groupFiltersBy = (filters: FilterType[], groupByField: FilterField) filters: groupedFilters[key], })); }; + +export const getFiltersByGroups = ( + filters: string[], + groups: string[], + ungrouped: boolean = false +) => + filters.filter((filter: string) => { + const ast = fromExpression(filter); + const expGroups: string[] = get(ast, 'chain[0].arguments.filterGroup', []); + if (!groups?.length && ungrouped) { + return expGroups.length === 0; + } + + return ( + !groups.length || + (expGroups.length > 0 && expGroups.every((expGroup) => groups.includes(expGroup))) + ); + }); + +export const extractGroupsFromElementsFilters = (expr: string) => { + const ast = fromExpression(expr); + const filtersFns = ast.chain.filter((expression) => expression.function === 'filters'); + const groups = filtersFns.reduce((foundGroups, filterFn) => { + const filterGroups = filterFn?.arguments.group?.map((g) => g.toString()) ?? []; + return [...foundGroups, ...filterGroups]; + }, []); + return [...new Set(groups)]; +}; + +export const extractUngroupedFromElementsFilters = (expr: string) => { + const ast = fromExpression(expr); + const filtersFns = ast.chain.filter((expression) => expression.function === 'filters'); + return filtersFns.some((filterFn) => filterFn?.arguments.ungrouped?.[0]); +}; + +export const isExpressionWithFilters = (expr: string) => { + const ast = fromExpression(expr); + return ast.chain.some((expression) => expression.function === 'filters'); +}; From fea14a0da5de5adf4baa54b5cfe4876952afe8d2 Mon Sep 17 00:00:00 2001 From: Yaroslav Kuznietsov Date: Fri, 3 Dec 2021 09:12:46 +0200 Subject: [PATCH 06/62] [Canvas] Added KibanaThemeProvider to expression_error. (#120073) * Wrapped up debug and error with KibanaThemeProvider. 1. Replaced renderer with getRenderer function and factory. 2. Updated storybook. 3. Moved defaultTheme$ to presentain_util. * Fixed exports. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../__stories__/error_renderer.stories.tsx | 4 +- .../expression_renderers/debug_renderer.tsx | 35 ++++++++---- .../expression_renderers/error_renderer.tsx | 55 +++++++++++-------- .../public/expression_renderers/index.ts | 8 +-- src/plugins/expression_error/public/index.ts | 11 ++-- src/plugins/expression_error/public/plugin.ts | 6 +- .../common/lib/utils}/default_theme.ts | 6 +- .../common/lib/utils/index.ts | 1 + .../canvas_plugin_src/renderers/external.ts | 9 +-- .../renderers/markdown/index.tsx | 2 +- .../canvas_plugin_src/renderers/table.tsx | 2 +- .../canvas_plugin_src/renderers/text.tsx | 2 +- .../shareable_runtime/supported_renderers.js | 14 +++-- 13 files changed, 93 insertions(+), 62 deletions(-) rename {x-pack/plugins/canvas/public/lib => src/plugins/presentation_util/common/lib/utils}/default_theme.ts (66%) diff --git a/src/plugins/expression_error/public/expression_renderers/__stories__/error_renderer.stories.tsx b/src/plugins/expression_error/public/expression_renderers/__stories__/error_renderer.stories.tsx index 9081a8512c11a..378e22f834e1d 100644 --- a/src/plugins/expression_error/public/expression_renderers/__stories__/error_renderer.stories.tsx +++ b/src/plugins/expression_error/public/expression_renderers/__stories__/error_renderer.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; -import { errorRenderer } from '../error_renderer'; +import { getErrorRenderer } from '../error_renderer'; import { Render } from '../../../../presentation_util/public/__stories__'; storiesOf('renderers/error', module).add('default', () => { @@ -16,5 +16,5 @@ storiesOf('renderers/error', module).add('default', () => { const config = { error: thrownError, }; - return ; + return ; }); diff --git a/src/plugins/expression_error/public/expression_renderers/debug_renderer.tsx b/src/plugins/expression_error/public/expression_renderers/debug_renderer.tsx index e3cf86b67148f..d4c74a9c646e7 100644 --- a/src/plugins/expression_error/public/expression_renderers/debug_renderer.tsx +++ b/src/plugins/expression_error/public/expression_renderers/debug_renderer.tsx @@ -8,9 +8,13 @@ import { render, unmountComponentAtNode } from 'react-dom'; import React from 'react'; +import { Observable } from 'rxjs'; +import { CoreTheme } from 'kibana/public'; import { ExpressionRenderDefinition } from 'src/plugins/expressions/common'; import { i18n } from '@kbn/i18n'; -import { withSuspense } from '../../../../../src/plugins/presentation_util/public'; +import { CoreSetup } from '../../../../core/public'; +import { KibanaThemeProvider } from '../../../kibana_react/public'; +import { withSuspense, defaultTheme$ } from '../../../../../src/plugins/presentation_util/public'; import { LazyDebugRenderComponent } from '../components'; import { JSON } from '../../common'; @@ -30,13 +34,22 @@ const strings = { }), }; -export const debugRenderer = (): ExpressionRenderDefinition => ({ - name: 'debug', - displayName: strings.getDisplayName(), - help: strings.getHelpDescription(), - reuseDomNode: true, - render(domNode, config, handlers) { - handlers.onDestroy(() => unmountComponentAtNode(domNode)); - render(, domNode); - }, -}); +export const getDebugRenderer = + (theme$: Observable = defaultTheme$) => + (): ExpressionRenderDefinition => ({ + name: 'debug', + displayName: strings.getDisplayName(), + help: strings.getHelpDescription(), + reuseDomNode: true, + render(domNode, config, handlers) { + handlers.onDestroy(() => unmountComponentAtNode(domNode)); + render( + + + , + domNode + ); + }, + }); + +export const debugRendererFactory = (core: CoreSetup) => getDebugRenderer(core.theme.theme$); diff --git a/src/plugins/expression_error/public/expression_renderers/error_renderer.tsx b/src/plugins/expression_error/public/expression_renderers/error_renderer.tsx index f0fbed22f38a0..65847a18d4e0a 100644 --- a/src/plugins/expression_error/public/expression_renderers/error_renderer.tsx +++ b/src/plugins/expression_error/public/expression_renderers/error_renderer.tsx @@ -5,12 +5,17 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ + import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; +import { Observable } from 'rxjs'; +import { CoreTheme } from 'kibana/public'; import { I18nProvider } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { ExpressionRenderDefinition, IInterpreterRenderHandlers } from 'src/plugins/expressions'; -import { withSuspense } from '../../../presentation_util/public'; +import { CoreSetup } from '../../../../core/public'; +import { KibanaThemeProvider } from '../../../kibana_react/public'; +import { withSuspense, defaultTheme$ } from '../../../presentation_util/public'; import { ErrorRendererConfig } from '../../common/types'; import { LazyErrorRenderComponent } from '../components'; @@ -27,25 +32,31 @@ const errorStrings = { const ErrorComponent = withSuspense(LazyErrorRenderComponent); -export const errorRenderer = (): ExpressionRenderDefinition => ({ - name: 'error', - displayName: errorStrings.getDisplayName(), - help: errorStrings.getHelpDescription(), - reuseDomNode: true, - render: async ( - domNode: HTMLElement, - config: ErrorRendererConfig, - handlers: IInterpreterRenderHandlers - ) => { - handlers.onDestroy(() => { - unmountComponentAtNode(domNode); - }); +export const getErrorRenderer = + (theme$: Observable = defaultTheme$) => + (): ExpressionRenderDefinition => ({ + name: 'error', + displayName: errorStrings.getDisplayName(), + help: errorStrings.getHelpDescription(), + reuseDomNode: true, + render: async ( + domNode: HTMLElement, + config: ErrorRendererConfig, + handlers: IInterpreterRenderHandlers + ) => { + handlers.onDestroy(() => { + unmountComponentAtNode(domNode); + }); + + render( + + + + + , + domNode + ); + }, + }); - render( - - - , - domNode - ); - }, -}); +export const errorRendererFactory = (core: CoreSetup) => getErrorRenderer(core.theme.theme$); diff --git a/src/plugins/expression_error/public/expression_renderers/index.ts b/src/plugins/expression_error/public/expression_renderers/index.ts index 237ee5644cdc0..295e30fc1bffd 100644 --- a/src/plugins/expression_error/public/expression_renderers/index.ts +++ b/src/plugins/expression_error/public/expression_renderers/index.ts @@ -6,9 +6,5 @@ * Side Public License, v 1. */ -import { errorRenderer } from './error_renderer'; -import { debugRenderer } from './debug_renderer'; - -export const renderers = [errorRenderer, debugRenderer]; - -export { errorRenderer, debugRenderer }; +export { getErrorRenderer, errorRendererFactory } from './error_renderer'; +export { getDebugRenderer, debugRendererFactory } from './debug_renderer'; diff --git a/src/plugins/expression_error/public/index.ts b/src/plugins/expression_error/public/index.ts index be34980045395..acc5133f5b7d1 100755 --- a/src/plugins/expression_error/public/index.ts +++ b/src/plugins/expression_error/public/index.ts @@ -6,9 +6,6 @@ * Side Public License, v 1. */ -// TODO: https://github.com/elastic/kibana/issues/110893 -/* eslint-disable @kbn/eslint/no_export_all */ - import { ExpressionErrorPlugin } from './plugin'; export type { ExpressionErrorPluginSetup, ExpressionErrorPluginStart } from './plugin'; @@ -17,5 +14,11 @@ export function plugin() { return new ExpressionErrorPlugin(); } -export * from './expression_renderers'; +export { + getErrorRenderer, + getDebugRenderer, + errorRendererFactory, + debugRendererFactory, +} from './expression_renderers'; + export { LazyDebugComponent, LazyErrorComponent } from './components'; diff --git a/src/plugins/expression_error/public/plugin.ts b/src/plugins/expression_error/public/plugin.ts index 0b82ccf5d2dba..de3793b6a30ae 100755 --- a/src/plugins/expression_error/public/plugin.ts +++ b/src/plugins/expression_error/public/plugin.ts @@ -8,7 +8,7 @@ import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; import { ExpressionsStart, ExpressionsSetup } from '../../expressions/public'; -import { errorRenderer, debugRenderer } from './expression_renderers'; +import { debugRendererFactory, errorRendererFactory } from './expression_renderers'; interface SetupDeps { expressions: ExpressionsSetup; @@ -25,8 +25,8 @@ export class ExpressionErrorPlugin implements Plugin { public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionErrorPluginSetup { - expressions.registerRenderer(errorRenderer); - expressions.registerRenderer(debugRenderer); + expressions.registerRenderer(errorRendererFactory(core)); + expressions.registerRenderer(debugRendererFactory(core)); } public start(core: CoreStart): ExpressionErrorPluginStart {} diff --git a/x-pack/plugins/canvas/public/lib/default_theme.ts b/src/plugins/presentation_util/common/lib/utils/default_theme.ts similarity index 66% rename from x-pack/plugins/canvas/public/lib/default_theme.ts rename to src/plugins/presentation_util/common/lib/utils/default_theme.ts index 5256ba81c9b8a..c403937016ec8 100644 --- a/x-pack/plugins/canvas/public/lib/default_theme.ts +++ b/src/plugins/presentation_util/common/lib/utils/default_theme.ts @@ -1,9 +1,11 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 { CoreTheme } from 'kibana/public'; import { Observable } from 'rxjs'; diff --git a/src/plugins/presentation_util/common/lib/utils/index.ts b/src/plugins/presentation_util/common/lib/utils/index.ts index 232ec09cf8b06..5fc7e31fdf9f5 100644 --- a/src/plugins/presentation_util/common/lib/utils/index.ts +++ b/src/plugins/presentation_util/common/lib/utils/index.ts @@ -10,6 +10,7 @@ export * from './dataurl'; export * from './httpurl'; export * from './resolve_dataurl'; export * from './url'; +export { defaultTheme$ } from './default_theme'; export async function getElasticLogo() { return await import('./elastic_logo'); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts b/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts index 94aadf6598b5a..572771537ec72 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts @@ -7,7 +7,10 @@ import { imageRenderer } from '../../../../../src/plugins/expression_image/public'; import { metricRenderer } from '../../../../../src/plugins/expression_metric/public'; -import { errorRenderer, debugRenderer } from '../../../../../src/plugins/expression_error/public'; +import { + errorRendererFactory, + debugRendererFactory, +} from '../../../../../src/plugins/expression_error/public'; import { repeatImageRenderer } from '../../../../../src/plugins/expression_repeat_image/public'; import { revealImageRenderer } from '../../../../../src/plugins/expression_reveal_image/public'; import { @@ -16,8 +19,6 @@ import { } from '../../../../../src/plugins/expression_shape/public'; export const renderFunctions = [ - debugRenderer, - errorRenderer, imageRenderer, metricRenderer, revealImageRenderer, @@ -26,4 +27,4 @@ export const renderFunctions = [ progressRenderer, ]; -export const renderFunctionFactories = []; +export const renderFunctionFactories = [debugRendererFactory, errorRendererFactory]; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx index bc9748fa8f6ab..498e09e14b7e0 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx @@ -10,12 +10,12 @@ import ReactDOM from 'react-dom'; import { CoreTheme } from 'kibana/public'; import { Observable } from 'rxjs'; import { KibanaThemeProvider } from '../../../../../../src/plugins/kibana_react/public'; +import { defaultTheme$ } from '../../../../../../src/plugins/presentation_util/common/lib'; import { StartInitializer } from '../../plugin'; import { RendererStrings } from '../../../i18n'; import { Return as Config } from '../../functions/browser/markdown'; import { Markdown } from '../../../../../../src/plugins/kibana_react/public'; import { RendererFactory } from '../../../types'; -import { defaultTheme$ } from '../../../public/lib/default_theme'; const { markdown: strings } = RendererStrings; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/table.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/table.tsx index 3af0fe00f2465..ec918f89321ad 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/table.tsx +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/table.tsx @@ -10,11 +10,11 @@ import React from 'react'; import { CoreTheme } from 'kibana/public'; import { Observable } from 'rxjs'; import { KibanaThemeProvider } from '../../../../../src/plugins/kibana_react/public'; +import { defaultTheme$ } from '../../../../../src/plugins/presentation_util/common/lib'; import { StartInitializer } from '../plugin'; import { Datatable as DatatableComponent } from '../../public/components/datatable'; import { RendererStrings } from '../../i18n'; import { RendererFactory, Style, Datatable } from '../../types'; -import { defaultTheme$ } from '../../public/lib/default_theme'; const { dropdownFilter: strings } = RendererStrings; export interface TableArguments { diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/text.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/text.tsx index 3bc62d888e02f..a89c56c66ce27 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/text.tsx +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/text.tsx @@ -10,10 +10,10 @@ import React from 'react'; import { CoreTheme } from 'kibana/public'; import { Observable } from 'rxjs'; import { KibanaThemeProvider } from '../../../../../src/plugins/kibana_react/public'; +import { defaultTheme$ } from '../../../../../src/plugins/presentation_util/common/lib'; import { StartInitializer } from '../plugin'; import { RendererStrings } from '../../i18n'; import { RendererFactory } from '../../types'; -import { defaultTheme$ } from '../../public/lib/default_theme'; const { text: strings } = RendererStrings; diff --git a/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js b/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js index db61cfaf86c51..1d2326b77dd26 100644 --- a/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js +++ b/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js @@ -12,8 +12,8 @@ import { getTableRenderer } from '../canvas_plugin_src/renderers/table'; import { getTextRenderer } from '../canvas_plugin_src/renderers/text'; import { imageRenderer as image } from '../../../../src/plugins/expression_image/public'; import { - errorRenderer as error, - debugRenderer as debug, + getErrorRenderer, + getDebugRenderer, } from '../../../../src/plugins/expression_error/public'; import { repeatImageRenderer as repeatImage } from '../../../../src/plugins/expression_repeat_image/public'; import { revealImageRenderer as revealImage } from '../../../../src/plugins/expression_reveal_image/public'; @@ -25,7 +25,13 @@ import { metricRenderer as metric } from '../../../../src/plugins/expression_met const unboxFactory = (factory) => factory(); -const renderFunctionsFactories = [getMarkdownRenderer, getTextRenderer, getTableRenderer]; +const renderFunctionsFactories = [ + getMarkdownRenderer, + getTextRenderer, + getTableRenderer, + getErrorRenderer, + getDebugRenderer, +]; /** * This is a collection of renderers which are bundled with the runtime. If @@ -33,8 +39,6 @@ const renderFunctionsFactories = [getMarkdownRenderer, getTextRenderer, getTable * not render. This includes any plugins. */ export const renderFunctions = [ - debug, - error, image, repeatImage, revealImage, From 7033517ced3a333ce421ff65926cba7273c0d4ba Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Fri, 3 Dec 2021 09:36:38 +0100 Subject: [PATCH 07/62] [navSearch] handle `displayName` for `savedObjects` result provider (#119442) * [navSearch] use the type's displayName in the `savedObjects` result provider * add unit tests * update documentation * adapt unit tests * address review comments and start to cleanup searchbar component * wrap onChange with useCallback * add unit tests for resultToOption Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- docs/user/introduction.asciidoc | 2 +- .../public/components/popover_footer.tsx | 78 ++++ .../public/components/popover_placeholder.tsx | 44 +++ .../public/components/result_tag_list.tsx | 70 ++++ .../public/components/search_bar.tsx | 344 ++++-------------- .../global_search_bar/public/lib/index.ts | 9 + .../public/lib/result_to_option.test.ts | 92 +++++ .../public/lib/result_to_option.tsx | 48 +++ .../public/lib/suggestion_to_option.ts | 24 ++ .../get_searchable_types.test.ts | 130 +++++++ .../saved_objects/get_searchable_types.ts | 29 ++ .../map_object_to_result.test.ts | 12 +- .../saved_objects/map_object_to_result.ts | 1 + .../providers/saved_objects/provider.test.ts | 4 +- .../providers/saved_objects/provider.ts | 12 +- 15 files changed, 617 insertions(+), 282 deletions(-) create mode 100644 x-pack/plugins/global_search_bar/public/components/popover_footer.tsx create mode 100644 x-pack/plugins/global_search_bar/public/components/popover_placeholder.tsx create mode 100644 x-pack/plugins/global_search_bar/public/components/result_tag_list.tsx create mode 100644 x-pack/plugins/global_search_bar/public/lib/index.ts create mode 100644 x-pack/plugins/global_search_bar/public/lib/result_to_option.test.ts create mode 100644 x-pack/plugins/global_search_bar/public/lib/result_to_option.tsx create mode 100644 x-pack/plugins/global_search_bar/public/lib/suggestion_to_option.ts create mode 100644 x-pack/plugins/global_search_providers/server/providers/saved_objects/get_searchable_types.test.ts create mode 100644 x-pack/plugins/global_search_providers/server/providers/saved_objects/get_searchable_types.ts diff --git a/docs/user/introduction.asciidoc b/docs/user/introduction.asciidoc index 89a21b0424ed0..fa5801e622706 100644 --- a/docs/user/introduction.asciidoc +++ b/docs/user/introduction.asciidoc @@ -233,7 +233,7 @@ To get the most from the search feature, follow these tips: |Search by type |`type:dashboard` -Available types: `application`, `canvas-workpad`, `dashboard`, `index-pattern`, `lens`, `maps`, `query`, `search`, `visualization` +Available types: `application`, `canvas-workpad`, `dashboard`, `data-view`, `lens`, `maps`, `query`, `search`, `visualization` |Search by tag |`tag:mytagname` + diff --git a/x-pack/plugins/global_search_bar/public/components/popover_footer.tsx b/x-pack/plugins/global_search_bar/public/components/popover_footer.tsx new file mode 100644 index 0000000000000..da7f8997a16b6 --- /dev/null +++ b/x-pack/plugins/global_search_bar/public/components/popover_footer.tsx @@ -0,0 +1,78 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import { EuiCode, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; + +interface PopoverFooterProps { + isMac: boolean; +} + +export const PopoverFooter: FC = ({ isMac }) => { + return ( + + + +

+ +   + type:  + +   + tag: +

+
+
+ + +

+ + ), + commandDescription: ( + + {isMac ? ( + + ) : ( + + )} + + ), + }} + /> +

+
+
+
+ ); +}; diff --git a/x-pack/plugins/global_search_bar/public/components/popover_placeholder.tsx b/x-pack/plugins/global_search_bar/public/components/popover_placeholder.tsx new file mode 100644 index 0000000000000..2dd191a7bf672 --- /dev/null +++ b/x-pack/plugins/global_search_bar/public/components/popover_placeholder.tsx @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import { EuiImage, EuiSelectableMessage, EuiText } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n-react'; + +interface PopoverPlaceholderProps { + darkMode: boolean; + basePath: string; +} + +export const PopoverPlaceholder: FC = ({ basePath, darkMode }) => { + return ( + + + +

+ +

+
+

+ +

+
+ ); +}; diff --git a/x-pack/plugins/global_search_bar/public/components/result_tag_list.tsx b/x-pack/plugins/global_search_bar/public/components/result_tag_list.tsx new file mode 100644 index 0000000000000..4cc75d207e287 --- /dev/null +++ b/x-pack/plugins/global_search_bar/public/components/result_tag_list.tsx @@ -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 React, { FC } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiBadge } from '@elastic/eui'; +import type { Tag } from '../../../saved_objects_tagging/public'; + +const MAX_TAGS_TO_SHOW = 3; + +const TagListWrapper: FC = ({ children }) => ( +
    + {children} +
+); + +const buildListItem = ({ color, name, id }: Tag) => { + return ( +
  • + {name} +
  • + ); +}; + +interface ResultTagListProps { + tags: Tag[]; + searchTagIds: string[]; +} + +export const ResultTagList: FC = ({ tags, searchTagIds }) => { + const showOverflow = tags.length > MAX_TAGS_TO_SHOW; + + if (!showOverflow) { + return {tags.map(buildListItem)}; + } + + // float searched tags to the start of the list, actual order doesn't matter + tags.sort((a) => { + if (searchTagIds.find((id) => id === a.id)) return -1; + return 1; + }); + + const overflowList = tags.splice(MAX_TAGS_TO_SHOW); + const overflowMessage = i18n.translate('xpack.globalSearchBar.searchbar.overflowTagsAriaLabel', { + defaultMessage: '{n} more {n, plural, one {tag} other {tags}}: {tags}', + values: { + n: overflowList.length, + // @ts-ignore-line + tags: overflowList.map(({ name }) => name), + }, + }); + + return ( + + {tags.map(buildListItem)} +
  • + +{overflowList.length} +
  • +
    + ); +}; diff --git a/x-pack/plugins/global_search_bar/public/components/search_bar.tsx b/x-pack/plugins/global_search_bar/public/components/search_bar.tsx index fbf412ca704d8..995f685d4287f 100644 --- a/x-pack/plugins/global_search_bar/public/components/search_bar.tsx +++ b/x-pack/plugins/global_search_bar/public/components/search_bar.tsx @@ -5,48 +5,34 @@ * 2.0. */ +import React, { FC, useCallback, useRef, useState, useEffect } from 'react'; +import useDebounce from 'react-use/lib/useDebounce'; +import useEvent from 'react-use/lib/useEvent'; +import useMountedState from 'react-use/lib/useMountedState'; +import { Subscription } from 'rxjs'; import { - EuiCode, - EuiFlexGroup, - EuiFlexItem, EuiHeaderSectionItemButton, EuiIcon, - EuiImage, - EuiSelectableMessage, EuiSelectableTemplateSitewide, EuiSelectableTemplateSitewideOption, - EuiText, - EuiBadge, euiSelectableTemplateSitewideRenderOptions, } from '@elastic/eui'; import { METRIC_TYPE, UiCounterMetricType } from '@kbn/analytics'; import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n-react'; -import { ApplicationStart } from 'kibana/public'; -import React, { ReactNode, useCallback, useRef, useState, useEffect } from 'react'; -import useDebounce from 'react-use/lib/useDebounce'; -import useEvent from 'react-use/lib/useEvent'; -import useMountedState from 'react-use/lib/useMountedState'; -import { Subscription } from 'rxjs'; -import { +import type { ApplicationStart } from 'kibana/public'; +import type { GlobalSearchPluginStart, GlobalSearchResult, GlobalSearchFindParams, } from '../../../global_search/public'; -import { SavedObjectTaggingPluginStart, Tag } from '../../../saved_objects_tagging/public'; +import type { SavedObjectTaggingPluginStart } from '../../../saved_objects_tagging/public'; import { parseSearchParams } from '../search_syntax'; import { getSuggestions, SearchSuggestion } from '../suggestions'; +import { resultToOption, suggestionToOption } from '../lib'; +import { PopoverFooter } from './popover_footer'; +import { PopoverPlaceholder } from './popover_placeholder'; import './search_bar.scss'; -interface Props { - globalSearch: GlobalSearchPluginStart; - navigateToUrl: ApplicationStart['navigateToUrl']; - trackUiMetric: (metricType: UiCounterMetricType, eventName: string | string[]) => void; - taggingApi?: SavedObjectTaggingPluginStart; - basePathUrl: string; - darkMode: boolean; -} - const isMac = navigator.platform.toLowerCase().indexOf('mac') >= 0; const setFieldValue = (field: HTMLInputElement, value: string) => { @@ -60,7 +46,6 @@ const setFieldValue = (field: HTMLInputElement, value: string) => { const clearField = (field: HTMLInputElement) => setFieldValue(field, ''); -const cleanMeta = (str: string) => (str.charAt(0).toUpperCase() + str.slice(1)).replace(/-/g, ' '); const blurEvent = new FocusEvent('blur'); const sortByScore = (a: GlobalSearchResult, b: GlobalSearchResult): number => { @@ -77,108 +62,23 @@ const sortByTitle = (a: GlobalSearchResult, b: GlobalSearchResult): number => { return 0; }; -const TagListWrapper = ({ children }: { children: ReactNode }) => ( -
      - {children} -
    -); - -const buildListItem = ({ color, name, id }: Tag) => { - return ( -
  • - {name} -
  • - ); -}; - -const tagList = (tags: Tag[], searchTagIds: string[]) => { - const TAGS_TO_SHOW = 3; - const showOverflow = tags.length > TAGS_TO_SHOW; - - if (!showOverflow) return {tags.map(buildListItem)}; - - // float searched tags to the start of the list, actual order doesn't matter - tags.sort((a) => { - if (searchTagIds.find((id) => id === a.id)) return -1; - return 1; - }); - - const overflowList = tags.splice(TAGS_TO_SHOW); - const overflowMessage = i18n.translate('xpack.globalSearchBar.searchbar.overflowTagsAriaLabel', { - defaultMessage: '{n} more {n, plural, one {tag} other {tags}}: {tags}', - values: { - n: overflowList.length, - // @ts-ignore-line - tags: overflowList.map(({ name }) => name), - }, - }); - - return ( - - {tags.map(buildListItem)} -
  • - +{overflowList.length} -
  • -
    - ); -}; - -const resultToOption = ( - result: GlobalSearchResult, - searchTagIds: string[], - getTag?: SavedObjectTaggingPluginStart['ui']['getTag'] -): EuiSelectableTemplateSitewideOption => { - const { id, title, url, icon, type, meta = {} } = result; - const { tagIds = [], categoryLabel = '' } = meta as { tagIds: string[]; categoryLabel: string }; - // only displaying icons for applications and integrations - const useIcon = type === 'application' || type === 'integration'; - const option: EuiSelectableTemplateSitewideOption = { - key: id, - label: title, - url, - type, - icon: { type: useIcon && icon ? icon : 'empty' }, - 'data-test-subj': `nav-search-option`, - }; - - if (type === 'application') option.meta = [{ text: categoryLabel }]; - else option.meta = [{ text: cleanMeta(type) }]; - - if (getTag && tagIds.length) { - // TODO #85189 - refactor to use TagList instead of getTag - // Casting to Tag[] because we know all our IDs will be valid here, no need to check for undefined - option.append = tagList(tagIds.map(getTag) as Tag[], searchTagIds); - } - - return option; -}; - -const suggestionToOption = (suggestion: SearchSuggestion): EuiSelectableTemplateSitewideOption => { - const { key, label, description, icon, suggestedSearch } = suggestion; - return { - key, - label, - type: '__suggestion__', - icon: { type: icon }, - suggestion: suggestedSearch, - meta: [{ text: description }], - 'data-test-subj': `nav-search-option`, - }; -}; +interface SearchBarProps { + globalSearch: GlobalSearchPluginStart; + navigateToUrl: ApplicationStart['navigateToUrl']; + trackUiMetric: (metricType: UiCounterMetricType, eventName: string | string[]) => void; + taggingApi?: SavedObjectTaggingPluginStart; + basePathUrl: string; + darkMode: boolean; +} -export function SearchBar({ +export const SearchBar: FC = ({ globalSearch, taggingApi, navigateToUrl, trackUiMetric, basePathUrl, darkMode, -}: Props) { +}) => { const isMounted = useMountedState(); const [initialLoad, setInitialLoad] = useState(false); const [searchValue, setSearchValue] = useState(''); @@ -312,79 +212,59 @@ export function SearchBar({ [buttonRef, searchRef, trackUiMetric] ); - const onChange = (selection: EuiSelectableTemplateSitewideOption[]) => { - const selected = selection.find(({ checked }) => checked === 'on'); - if (!selected) { - return; - } - - // @ts-ignore - ts error is "union type is too complex to express" - const { url, type, suggestion } = selected; + const onChange = useCallback( + (selection: EuiSelectableTemplateSitewideOption[]) => { + const selected = selection.find(({ checked }) => checked === 'on'); + if (!selected) { + return; + } - // if the type is a suggestion, we change the query on the input and trigger a new search - // by setting the searchValue (only setting the field value does not trigger a search) - if (type === '__suggestion__') { - setFieldValue(searchRef!, suggestion); - setSearchValue(suggestion); - return; - } + // @ts-ignore - ts error is "union type is too complex to express" + const { url, type, suggestion } = selected; - // errors in tracking should not prevent selection behavior - try { - if (type === 'application') { - const key = selected.keys ?? 'unknown'; - trackUiMetric(METRIC_TYPE.CLICK, [ - 'user_navigated_to_application', - `user_navigated_to_application_${key.toLowerCase().replaceAll(' ', '_')}`, // which application - ]); - } else { - trackUiMetric(METRIC_TYPE.CLICK, [ - 'user_navigated_to_saved_object', - `user_navigated_to_saved_object_${type}`, // which type of saved object - ]); + // if the type is a suggestion, we change the query on the input and trigger a new search + // by setting the searchValue (only setting the field value does not trigger a search) + if (type === '__suggestion__') { + setFieldValue(searchRef!, suggestion); + setSearchValue(suggestion); + return; } - } catch (e) { - // eslint-disable-next-line no-console - console.log('Error trying to track searchbar metrics', e); - } - navigateToUrl(url); + // errors in tracking should not prevent selection behavior + try { + if (type === 'application') { + const key = selected.keys ?? 'unknown'; + trackUiMetric(METRIC_TYPE.CLICK, [ + 'user_navigated_to_application', + `user_navigated_to_application_${key.toLowerCase().replaceAll(' ', '_')}`, // which application + ]); + } else { + trackUiMetric(METRIC_TYPE.CLICK, [ + 'user_navigated_to_saved_object', + `user_navigated_to_saved_object_${type}`, // which type of saved object + ]); + } + } catch (e) { + // eslint-disable-next-line no-console + console.log('Error trying to track searchbar metrics', e); + } - (document.activeElement as HTMLElement).blur(); - if (searchRef) { - clearField(searchRef); - searchRef.dispatchEvent(blurEvent); - } - }; + navigateToUrl(url); - const emptyMessage = ( - - - -

    - -

    -
    -

    - -

    -
    + (document.activeElement as HTMLElement).blur(); + if (searchRef) { + clearField(searchRef); + searchRef.dispatchEvent(blurEvent); + } + }, + [trackUiMetric, navigateToUrl, searchRef] ); + const emptyMessage = ; + const placeholderText = i18n.translate('xpack.globalSearchBar.searchBar.placeholder', { + defaultMessage: 'Search Elastic', + }); + useEvent('keydown', onKeyDown); return ( @@ -395,102 +275,38 @@ export function SearchBar({ popoverButtonBreakpoints={['xs', 's']} singleSelection={true} renderOption={(option) => euiSelectableTemplateSitewideRenderOptions(option, searchTerm)} - popoverButton={ - - - - } searchProps={{ onInput: (e: React.UIEvent) => setSearchValue(e.currentTarget.value), 'data-test-subj': 'nav-search-input', inputRef: setSearchRef, compressed: true, className: 'kbnSearchBar', - 'aria-label': i18n.translate('xpack.globalSearchBar.searchBar.placeholder', { - defaultMessage: 'Search Elastic', - }), - placeholder: i18n.translate('xpack.globalSearchBar.searchBar.placeholder', { - defaultMessage: 'Search Elastic', - }), + 'aria-label': placeholderText, + placeholder: placeholderText, onFocus: () => { trackUiMetric(METRIC_TYPE.COUNT, 'search_focus'); setInitialLoad(true); }, }} + emptyMessage={emptyMessage} + noMatchesMessage={emptyMessage} popoverProps={{ 'data-test-subj': 'nav-search-popover', panelClassName: 'navSearch__panel', repositionOnScroll: true, buttonRef: setButtonRef, }} - emptyMessage={emptyMessage} - noMatchesMessage={emptyMessage} - popoverFooter={ - - - -

    - -   - type:  - -   - tag: -

    -
    -
    - - -

    - - ), - commandDescription: ( - - {isMac ? ( - - ) : ( - - )} - - ), - }} - /> -

    -
    -
    -
    + + } + popoverFooter={} /> ); -} +}; diff --git a/x-pack/plugins/global_search_bar/public/lib/index.ts b/x-pack/plugins/global_search_bar/public/lib/index.ts new file mode 100644 index 0000000000000..91f4922c27e05 --- /dev/null +++ b/x-pack/plugins/global_search_bar/public/lib/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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { resultToOption } from './result_to_option'; +export { suggestionToOption } from './suggestion_to_option'; diff --git a/x-pack/plugins/global_search_bar/public/lib/result_to_option.test.ts b/x-pack/plugins/global_search_bar/public/lib/result_to_option.test.ts new file mode 100644 index 0000000000000..ab935522ab921 --- /dev/null +++ b/x-pack/plugins/global_search_bar/public/lib/result_to_option.test.ts @@ -0,0 +1,92 @@ +/* + * Copyright 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 { GlobalSearchResult } from '../../../global_search/common/types'; +import { resultToOption } from './result_to_option'; + +const createSearchResult = (parts: Partial = {}): GlobalSearchResult => ({ + id: 'id', + title: 'title', + type: 'application', + icon: 'some-icon', + score: 100, + url: '/url', + meta: {}, + ...parts, +}); + +describe('resultToOption', () => { + it('converts the result to the expected format', () => { + const input = createSearchResult({}); + expect(resultToOption(input, [])).toEqual({ + key: input.id, + label: input.title, + url: input.url, + type: input.type, + icon: { type: expect.any(String) }, + 'data-test-subj': expect.any(String), + meta: expect.any(Array), + }); + }); + + it('uses icon for `application` type', () => { + const input = createSearchResult({ type: 'application', icon: 'app-icon' }); + expect(resultToOption(input, [])).toEqual( + expect.objectContaining({ + icon: { type: 'app-icon' }, + }) + ); + }); + + it('uses icon for `integration` type', () => { + const input = createSearchResult({ type: 'integration', icon: 'integ-icon' }); + expect(resultToOption(input, [])).toEqual( + expect.objectContaining({ + icon: { type: 'integ-icon' }, + }) + ); + }); + + it('does not use icon for other types', () => { + const input = createSearchResult({ type: 'dashboard', icon: 'dash-icon' }); + expect(resultToOption(input, [])).toEqual( + expect.objectContaining({ + icon: { type: 'empty' }, + }) + ); + }); + + it('uses the category label as meta for `application` type', () => { + const input = createSearchResult({ type: 'application', meta: { categoryLabel: 'category' } }); + expect(resultToOption(input, [])).toEqual( + expect.objectContaining({ + meta: [{ text: 'category' }], + }) + ); + }); + + it('uses the type as meta for non-`application` type', () => { + const input = createSearchResult({ type: 'dashboard', meta: { categoryLabel: 'category' } }); + expect(resultToOption(input, [])).toEqual( + expect.objectContaining({ + meta: [{ text: 'Dashboard' }], + }) + ); + }); + + it('uses the displayName as meta for non-`application` type when provided', () => { + const input = createSearchResult({ + type: 'dashboard', + meta: { categoryLabel: 'category', displayName: 'foo' }, + }); + expect(resultToOption(input, [])).toEqual( + expect.objectContaining({ + meta: [{ text: 'Foo' }], + }) + ); + }); +}); diff --git a/x-pack/plugins/global_search_bar/public/lib/result_to_option.tsx b/x-pack/plugins/global_search_bar/public/lib/result_to_option.tsx new file mode 100644 index 0000000000000..85bf99f5e5a6d --- /dev/null +++ b/x-pack/plugins/global_search_bar/public/lib/result_to_option.tsx @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import type { EuiSelectableTemplateSitewideOption } from '@elastic/eui'; +import type { GlobalSearchResult } from '../../../global_search/common/types'; +import type { SavedObjectTaggingPluginStart, Tag } from '../../../saved_objects_tagging/public'; +import { ResultTagList } from '../components/result_tag_list'; + +const cleanMeta = (str: string) => (str.charAt(0).toUpperCase() + str.slice(1)).replace(/-/g, ' '); + +export const resultToOption = ( + result: GlobalSearchResult, + searchTagIds: string[], + getTag?: SavedObjectTaggingPluginStart['ui']['getTag'] +): EuiSelectableTemplateSitewideOption => { + const { id, title, url, icon, type, meta = {} } = result; + const { tagIds = [], categoryLabel = '' } = meta as { tagIds: string[]; categoryLabel: string }; + // only displaying icons for applications and integrations + const useIcon = type === 'application' || type === 'integration'; + const option: EuiSelectableTemplateSitewideOption = { + key: id, + label: title, + url, + type, + icon: { type: useIcon && icon ? icon : 'empty' }, + 'data-test-subj': `nav-search-option`, + }; + + option.meta = + type === 'application' + ? [{ text: categoryLabel }] + : [{ text: cleanMeta((meta.displayName as string) ?? type) }]; + + if (getTag && tagIds.length) { + // TODO #85189 - refactor to use TagList instead of getTag + // Casting to Tag[] because we know all our IDs will be valid here, no need to check for undefined + option.append = ( + + ); + } + + return option; +}; diff --git a/x-pack/plugins/global_search_bar/public/lib/suggestion_to_option.ts b/x-pack/plugins/global_search_bar/public/lib/suggestion_to_option.ts new file mode 100644 index 0000000000000..d0ce6364208bc --- /dev/null +++ b/x-pack/plugins/global_search_bar/public/lib/suggestion_to_option.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 { EuiSelectableTemplateSitewideOption } from '@elastic/eui'; +import { SearchSuggestion } from '../suggestions'; + +export const suggestionToOption = ( + suggestion: SearchSuggestion +): EuiSelectableTemplateSitewideOption => { + const { key, label, description, icon, suggestedSearch } = suggestion; + return { + key, + label, + type: '__suggestion__', + icon: { type: icon }, + suggestion: suggestedSearch, + meta: [{ text: description }], + 'data-test-subj': `nav-search-option`, + }; +}; diff --git a/x-pack/plugins/global_search_providers/server/providers/saved_objects/get_searchable_types.test.ts b/x-pack/plugins/global_search_providers/server/providers/saved_objects/get_searchable_types.test.ts new file mode 100644 index 0000000000000..3a8494cb7d0e8 --- /dev/null +++ b/x-pack/plugins/global_search_providers/server/providers/saved_objects/get_searchable_types.test.ts @@ -0,0 +1,130 @@ +/* + * Copyright 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 { SavedObjectTypeRegistry } from '../../../../../../src/core/server'; +import { getSearchableTypes } from './get_searchable_types'; + +describe('getSearchableTypes', () => { + let registry: SavedObjectTypeRegistry; + + beforeEach(() => { + registry = new SavedObjectTypeRegistry(); + }); + + const registerType = ({ + name, + displayName, + hidden = false, + noSearchField = false, + noGetInAppUrl = false, + }: { + name: string; + displayName?: string; + hidden?: boolean; + noSearchField?: boolean; + noGetInAppUrl?: boolean; + }) => { + registry.registerType({ + name, + hidden, + management: { + displayName, + defaultSearchField: noSearchField ? undefined : 'title', + getInAppUrl: noGetInAppUrl + ? undefined + : () => ({ path: 'path', uiCapabilitiesPath: 'uiCapabilitiesPath' }), + }, + namespaceType: 'multiple', + mappings: { properties: {} }, + }); + }; + + it('returns registered types that match', () => { + registerType({ name: 'foo' }); + registerType({ name: 'bar' }); + registerType({ name: 'dolly' }); + + const matching = getSearchableTypes(registry, ['foo', 'dolly']).map((type) => type.name); + expect(matching).toEqual(['foo', 'dolly']); + }); + + it('ignores hidden types', () => { + registerType({ name: 'foo', hidden: true }); + registerType({ name: 'bar' }); + registerType({ name: 'dolly' }); + + const matching = getSearchableTypes(registry, ['foo', 'dolly']).map((type) => type.name); + expect(matching).toEqual(['dolly']); + }); + + it('ignores types without `defaultSearchField`', () => { + registerType({ name: 'foo' }); + registerType({ name: 'bar' }); + registerType({ name: 'dolly', noSearchField: true }); + + const matching = getSearchableTypes(registry, ['foo', 'dolly']).map((type) => type.name); + expect(matching).toEqual(['foo']); + }); + + it('ignores types without `getInAppUrl`', () => { + registerType({ name: 'foo' }); + registerType({ name: 'bar' }); + registerType({ name: 'dolly', noGetInAppUrl: true }); + + const matching = getSearchableTypes(registry, ['foo', 'dolly']).map((type) => type.name); + expect(matching).toEqual(['foo']); + }); + + it('matches ignoring case', () => { + registerType({ name: 'foo' }); + registerType({ name: 'bar' }); + registerType({ name: 'dolly' }); + + const matching = getSearchableTypes(registry, ['FOO', 'DolLy']).map((type) => type.name); + expect(matching).toEqual(['foo', 'dolly']); + }); + + it('matches against the display name when provided', () => { + registerType({ name: 'foo' }); + registerType({ name: 'bar', displayName: 'display' }); + registerType({ name: 'dolly', displayName: 'name' }); + + const matching = getSearchableTypes(registry, ['display', 'name']).map((type) => type.name); + expect(matching).toEqual(['bar', 'dolly']); + }); + + it('ignores cases against the display name', () => { + registerType({ name: 'foo' }); + registerType({ name: 'bar', displayName: 'display' }); + registerType({ name: 'dolly', displayName: 'name' }); + + const matching = getSearchableTypes(registry, ['DISPLAY', 'NaMe']).map((type) => type.name); + expect(matching).toEqual(['bar', 'dolly']); + }); + + it('replaces whitespaces with dashes when matching against the display name', () => { + registerType({ name: 'dashboard' }); + registerType({ name: 'index-pattern', displayName: 'data view' }); + registerType({ name: 'map', displayName: 'my super display name' }); + + const matching = getSearchableTypes(registry, ['data-view', 'my-super-display-name']).map( + (type) => type.name + ); + expect(matching).toEqual(['index-pattern', 'map']); + }); + + it('replaces whitespaces with dashes when matching against the name', () => { + registerType({ name: 'dashboard' }); + registerType({ name: 'index-pattern' }); + registerType({ name: 'new-map' }); + + const matching = getSearchableTypes(registry, ['index pattern', 'new map']).map( + (type) => type.name + ); + expect(matching).toEqual(['index-pattern', 'new-map']); + }); +}); diff --git a/x-pack/plugins/global_search_providers/server/providers/saved_objects/get_searchable_types.ts b/x-pack/plugins/global_search_providers/server/providers/saved_objects/get_searchable_types.ts new file mode 100644 index 0000000000000..fa8153dc161ca --- /dev/null +++ b/x-pack/plugins/global_search_providers/server/providers/saved_objects/get_searchable_types.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 { ISavedObjectTypeRegistry, SavedObjectsType } from 'src/core/server'; + +export const getSearchableTypes = (typeRegistry: ISavedObjectTypeRegistry, types?: string[]) => { + const typeFilter = types + ? (type: SavedObjectsType) => { + if (type.management?.displayName && isTypeMatching(types, type.management.displayName)) { + return true; + } + return isTypeMatching(types, type.name); + } + : () => true; + + return typeRegistry + .getVisibleTypes() + .filter(typeFilter) + .filter((type) => type.management?.defaultSearchField && type.management?.getInAppUrl); +}; + +const isTypeMatching = (list: string[], item: string) => + list.some((e) => toCompareFormat(e) === toCompareFormat(item)); + +const toCompareFormat = (str: string) => str.toLowerCase().replace(/\s/g, '-'); diff --git a/x-pack/plugins/global_search_providers/server/providers/saved_objects/map_object_to_result.test.ts b/x-pack/plugins/global_search_providers/server/providers/saved_objects/map_object_to_result.test.ts index 277be1ef8ac80..3b6011aeab7fc 100644 --- a/x-pack/plugins/global_search_providers/server/providers/saved_objects/map_object_to_result.test.ts +++ b/x-pack/plugins/global_search_providers/server/providers/saved_objects/map_object_to_result.test.ts @@ -44,6 +44,7 @@ describe('mapToResult', () => { const type = createType({ name: 'dashboard', management: { + displayName: 'dashDisplayName', defaultSearchField: 'title', icon: 'dashboardApp', getInAppUrl: (obj) => ({ path: `/dashboard/${obj.id}`, uiCapabilitiesPath: '' }), @@ -68,7 +69,7 @@ describe('mapToResult', () => { url: '/dashboard/dash1', icon: 'dashboardApp', score: 42, - meta: { tagIds: [] }, + meta: { tagIds: [], displayName: 'dashDisplayName' }, }); }); @@ -140,6 +141,7 @@ describe('mapToResults', () => { createType({ name: 'typeB', management: { + displayName: 'typeBDisplayName', defaultSearchField: 'description', getInAppUrl: (obj) => ({ path: `/type-b/${obj.id}`, uiCapabilitiesPath: 'test.typeB' }), }, @@ -229,7 +231,7 @@ describe('mapToResults', () => { type: 'typeA', url: '/type-a/resultA', score: 100, - meta: { tagIds: [] }, + meta: { tagIds: [], displayName: 'typeA' }, }, { id: 'resultC', @@ -237,7 +239,7 @@ describe('mapToResults', () => { type: 'typeC', url: '/type-c/resultC', score: 42, - meta: { tagIds: ['1', '2'] }, + meta: { tagIds: ['1', '2'], displayName: 'typeC' }, }, { id: 'resultB', @@ -245,7 +247,7 @@ describe('mapToResults', () => { type: 'typeB', url: '/type-b/resultB', score: 69, - meta: { tagIds: [] }, + meta: { tagIds: [], displayName: 'typeBDisplayName' }, }, ]); }); @@ -283,7 +285,7 @@ describe('mapToResults', () => { type: 'typeA', url: '/type-a/resultA', score: 100, - meta: { tagIds: [] }, + meta: { tagIds: [], displayName: 'typeA' }, }, ]); }); diff --git a/x-pack/plugins/global_search_providers/server/providers/saved_objects/map_object_to_result.ts b/x-pack/plugins/global_search_providers/server/providers/saved_objects/map_object_to_result.ts index c96666dfbfe3c..871710abee11b 100644 --- a/x-pack/plugins/global_search_providers/server/providers/saved_objects/map_object_to_result.ts +++ b/x-pack/plugins/global_search_providers/server/providers/saved_objects/map_object_to_result.ts @@ -56,6 +56,7 @@ export const mapToResult = ( score: object.score, meta: { tagIds: object.references.filter((ref) => ref.type === 'tag').map(({ id }) => id), + displayName: type.management?.displayName ?? object.type, }, }; }; diff --git a/x-pack/plugins/global_search_providers/server/providers/saved_objects/provider.test.ts b/x-pack/plugins/global_search_providers/server/providers/saved_objects/provider.test.ts index 2aa95fa5cb6ca..f332747f1ccfc 100644 --- a/x-pack/plugins/global_search_providers/server/providers/saved_objects/provider.test.ts +++ b/x-pack/plugins/global_search_providers/server/providers/saved_objects/provider.test.ts @@ -202,7 +202,7 @@ describe('savedObjectsResultProvider', () => { type: 'typeA', url: '/type-a/resultA', score: 50, - meta: { tagIds: [] }, + meta: { tagIds: [], displayName: 'typeA' }, }, { id: 'resultB', @@ -210,7 +210,7 @@ describe('savedObjectsResultProvider', () => { type: 'typeB', url: '/type-b/resultB', score: 78, - meta: { tagIds: [] }, + meta: { tagIds: [], displayName: 'typeB' }, }, ]); }); diff --git a/x-pack/plugins/global_search_providers/server/providers/saved_objects/provider.ts b/x-pack/plugins/global_search_providers/server/providers/saved_objects/provider.ts index 6557e6fe7b663..ae1f6da10bc6e 100644 --- a/x-pack/plugins/global_search_providers/server/providers/saved_objects/provider.ts +++ b/x-pack/plugins/global_search_providers/server/providers/saved_objects/provider.ts @@ -7,9 +7,10 @@ import { from, combineLatest, of } from 'rxjs'; import { map, takeUntil, first } from 'rxjs/operators'; -import { SavedObjectsFindOptionsReference, ISavedObjectTypeRegistry } from 'src/core/server'; +import { SavedObjectsFindOptionsReference } from 'src/core/server'; import { GlobalSearchResultProvider } from '../../../../global_search/server'; import { mapToResults } from './map_object_to_result'; +import { getSearchableTypes } from './get_searchable_types'; export const createSavedObjectsResultProvider = (): GlobalSearchResultProvider => { return { @@ -58,13 +59,4 @@ export const createSavedObjectsResultProvider = (): GlobalSearchResultProvider = }; }; -const getSearchableTypes = (typeRegistry: ISavedObjectTypeRegistry, types?: string[]) => - typeRegistry - .getVisibleTypes() - .filter(types ? (type) => includeIgnoreCase(types, type.name) : () => true) - .filter((type) => type.management?.defaultSearchField && type.management?.getInAppUrl); - const uniq = (values: T[]): T[] => [...new Set(values)]; - -const includeIgnoreCase = (list: string[], item: string) => - list.find((e) => e.toLowerCase() === item.toLowerCase()) !== undefined; From cc46febd519f79731f26b485d92249d84944a42e Mon Sep 17 00:00:00 2001 From: Thom Heymann <190132+thomheymann@users.noreply.github.com> Date: Fri, 3 Dec 2021 09:07:49 +0000 Subject: [PATCH 08/62] Bump json-schema and uglify-js (#120142) --- package.json | 3 +++ src/dev/license_checker/config.ts | 1 + yarn.lock | 21 +++++++++------------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index a6dfd03893c81..1e5a135b723ed 100644 --- a/package.json +++ b/package.json @@ -79,9 +79,12 @@ "**/chokidar": "^3.4.3", "**/deepmerge": "^4.2.2", "**/fast-deep-equal": "^3.1.1", + "**/handlebars/uglify-js": "^3.14.3", "**/hoist-non-react-statics": "^3.3.2", + "**/html-minifier/uglify-js": "^3.14.3", "**/isomorphic-fetch/node-fetch": "^2.6.1", "**/istanbul-instrumenter-loader/schema-utils": "1.0.0", + "**/json-schema": "^0.4.0", "**/minimist": "^1.2.5", "**/node-jose/node-forge": "^0.10.0", "**/pdfkit/crypto-js": "4.0.0", diff --git a/src/dev/license_checker/config.ts b/src/dev/license_checker/config.ts index 078786abb8c64..52b1f816090df 100644 --- a/src/dev/license_checker/config.ts +++ b/src/dev/license_checker/config.ts @@ -25,6 +25,7 @@ export const LICENSE_ALLOWED = [ '(MIT OR WTFPL)', '(Unlicense OR Apache-2.0)', 'AFLv2.1', + '(AFL-2.1 OR BSD-3-Clause)', 'Apache 2.0', 'Apache License, v2.0', 'Apache License, Version 2.0', diff --git a/yarn.lock b/yarn.lock index 9472271c20998..fc670fda132ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10093,7 +10093,7 @@ commander@2, commander@^2.19.0, commander@^2.20.0, commander@^2.7.1, commander@^ resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@2.17.x, commander@~2.17.1: +commander@2.17.x: version "2.17.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== @@ -17982,10 +17982,10 @@ json-schema-traverse@^1.0.0: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= +json-schema@0.2.3, json-schema@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" + integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" @@ -27743,13 +27743,10 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.5.tgz#0c65f15f815aa08b560a61ce8b4db7ffc3f45376" integrity sha512-JoLI4g5zv5qNyT09f4YAvEZIIV1oOjqnewYg5D38dkQljIzpPT296dbIGvKro3digYI1bkb7W6EP1y4uDlmzLg== -uglify-js@3.4.x, uglify-js@^3.1.4: - version "3.4.9" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3" - integrity sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q== - dependencies: - commander "~2.17.1" - source-map "~0.6.1" +uglify-js@3.4.x, uglify-js@^3.1.4, uglify-js@^3.14.3: + version "3.14.4" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.14.4.tgz#68756f17d1b90b9d289341736cb9a567d6882f90" + integrity sha512-AbiSR44J0GoCeV81+oxcy/jDOElO2Bx3d0MfQCUShq7JRXaM4KtQopZsq2vFv8bCq2yMaGrw1FgygUd03RyRDA== uglify-js@^2.6.2: version "2.8.29" From 3fed3a4360f58476cca4535cc799b35d40538a52 Mon Sep 17 00:00:00 2001 From: Yaroslav Kuznietsov Date: Fri, 3 Dec 2021 11:17:38 +0200 Subject: [PATCH 09/62] [Canvas] Added KibanaThemeProvider to expression_metric. (#120078) * Added KibanaThemeProvider to metric and changed exports. * Added kibanaReact bundle. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- src/plugins/expression_metric/kibana.json | 3 +- .../__stories__/metric_renderer.stories.tsx | 16 ++--- .../public/expression_renderers/index.ts | 6 +- .../expression_renderers/metric_renderer.tsx | 64 +++++++++++-------- src/plugins/expression_metric/public/index.ts | 5 +- .../expression_metric/public/plugin.ts | 4 +- .../canvas_plugin_src/renderers/external.ts | 9 ++- .../shareable_runtime/supported_renderers.js | 4 +- 8 files changed, 59 insertions(+), 52 deletions(-) diff --git a/src/plugins/expression_metric/kibana.json b/src/plugins/expression_metric/kibana.json index 2aaef04e3bec3..3d844fa4de9fc 100755 --- a/src/plugins/expression_metric/kibana.json +++ b/src/plugins/expression_metric/kibana.json @@ -10,5 +10,6 @@ "server": true, "ui": true, "requiredPlugins": ["expressions", "presentationUtil"], - "optionalPlugins": [] + "optionalPlugins": [], + "requiredBundles": ["kibanaReact"] } diff --git a/src/plugins/expression_metric/public/expression_renderers/__stories__/metric_renderer.stories.tsx b/src/plugins/expression_metric/public/expression_renderers/__stories__/metric_renderer.stories.tsx index 0e04c32f52ba2..5835730e35f9b 100644 --- a/src/plugins/expression_metric/public/expression_renderers/__stories__/metric_renderer.stories.tsx +++ b/src/plugins/expression_metric/public/expression_renderers/__stories__/metric_renderer.stories.tsx @@ -9,7 +9,7 @@ import React, { CSSProperties } from 'react'; import { storiesOf } from '@storybook/react'; import { Style } from 'src/plugins/expressions'; -import { metricRenderer } from '../metric_renderer'; +import { getMetricRenderer } from '../metric_renderer'; import { Render } from '../../../../presentation_util/public/__stories__'; import { MetricRendererConfig } from '../../../common'; @@ -45,7 +45,7 @@ storiesOf('renderers/Metric', module) label: '', metricFormat: '', }; - return ; + return ; }) .add('with number metric', () => { const config: MetricRendererConfig = { @@ -55,7 +55,7 @@ storiesOf('renderers/Metric', module) label: '', metricFormat: '', }; - return ; + return ; }) .add('with string metric', () => { const config: MetricRendererConfig = { @@ -65,7 +65,7 @@ storiesOf('renderers/Metric', module) label: '', metricFormat: '', }; - return ; + return ; }) .add('with label', () => { const config: MetricRendererConfig = { @@ -75,7 +75,7 @@ storiesOf('renderers/Metric', module) label: 'Average price', metricFormat: '', }; - return ; + return ; }) .add('with number metric and a specified format', () => { const config: MetricRendererConfig = { @@ -85,7 +85,7 @@ storiesOf('renderers/Metric', module) label: 'Average price', metricFormat: '0.00%', }; - return ; + return ; }) .add('with formatted string metric and a specified format', () => { const config: MetricRendererConfig = { @@ -95,7 +95,7 @@ storiesOf('renderers/Metric', module) label: 'Total Revenue', metricFormat: '$0a', }; - return ; + return ; }) .add('with invalid metricFont', () => { const config: MetricRendererConfig = { @@ -105,5 +105,5 @@ storiesOf('renderers/Metric', module) label: 'Total Revenue', metricFormat: '$0a', }; - return ; + return ; }); diff --git a/src/plugins/expression_metric/public/expression_renderers/index.ts b/src/plugins/expression_metric/public/expression_renderers/index.ts index b77e0bb76f1fd..c8d6fa08147ea 100644 --- a/src/plugins/expression_metric/public/expression_renderers/index.ts +++ b/src/plugins/expression_metric/public/expression_renderers/index.ts @@ -6,8 +6,4 @@ * Side Public License, v 1. */ -import { metricRenderer } from './metric_renderer'; - -export const renderers = [metricRenderer]; - -export { metricRenderer }; +export { metricRendererFactory, getMetricRenderer } from './metric_renderer'; diff --git a/src/plugins/expression_metric/public/expression_renderers/metric_renderer.tsx b/src/plugins/expression_metric/public/expression_renderers/metric_renderer.tsx index 02c910640edeb..6a11910d4f26f 100644 --- a/src/plugins/expression_metric/public/expression_renderers/metric_renderer.tsx +++ b/src/plugins/expression_metric/public/expression_renderers/metric_renderer.tsx @@ -6,10 +6,14 @@ * Side Public License, v 1. */ import React, { CSSProperties, lazy } from 'react'; +import { Observable } from 'rxjs'; +import { CoreTheme } from 'kibana/public'; import { render, unmountComponentAtNode } from 'react-dom'; import { ExpressionRenderDefinition, IInterpreterRenderHandlers } from 'src/plugins/expressions'; import { i18n } from '@kbn/i18n'; -import { withSuspense } from '../../../presentation_util/public'; +import { CoreSetup } from '../../../../core/public'; +import { KibanaThemeProvider } from '../../../kibana_react/public'; +import { withSuspense, defaultTheme$ } from '../../../presentation_util/public'; import { MetricRendererConfig } from '../../common/types'; const strings = { @@ -26,30 +30,36 @@ const strings = { const LazyMetricComponent = lazy(() => import('../components/metric_component')); const MetricComponent = withSuspense(LazyMetricComponent); -export const metricRenderer = (): ExpressionRenderDefinition => ({ - name: 'metric', - displayName: strings.getDisplayName(), - help: strings.getHelpDescription(), - reuseDomNode: true, - render: async ( - domNode: HTMLElement, - config: MetricRendererConfig, - handlers: IInterpreterRenderHandlers - ) => { - handlers.onDestroy(() => { - unmountComponentAtNode(domNode); - }); +export const getMetricRenderer = + (theme$: Observable = defaultTheme$) => + (): ExpressionRenderDefinition => ({ + name: 'metric', + displayName: strings.getDisplayName(), + help: strings.getHelpDescription(), + reuseDomNode: true, + render: async ( + domNode: HTMLElement, + config: MetricRendererConfig, + handlers: IInterpreterRenderHandlers + ) => { + handlers.onDestroy(() => { + unmountComponentAtNode(domNode); + }); - render( - , - domNode, - () => handlers.done() - ); - }, -}); + render( + + + , + domNode, + () => handlers.done() + ); + }, + }); + +export const metricRendererFactory = (core: CoreSetup) => getMetricRenderer(core.theme.theme$); diff --git a/src/plugins/expression_metric/public/index.ts b/src/plugins/expression_metric/public/index.ts index 87499f279524d..8a23c2319a3c2 100755 --- a/src/plugins/expression_metric/public/index.ts +++ b/src/plugins/expression_metric/public/index.ts @@ -6,9 +6,6 @@ * Side Public License, v 1. */ -// TODO: https://github.com/elastic/kibana/issues/110893 -/* eslint-disable @kbn/eslint/no_export_all */ - import { ExpressionMetricPlugin } from './plugin'; export type { ExpressionMetricPluginSetup, ExpressionMetricPluginStart } from './plugin'; @@ -17,4 +14,4 @@ export function plugin() { return new ExpressionMetricPlugin(); } -export * from './expression_renderers'; +export { metricRendererFactory, getMetricRenderer } from './expression_renderers'; diff --git a/src/plugins/expression_metric/public/plugin.ts b/src/plugins/expression_metric/public/plugin.ts index 8711a824fb7b5..6830fd904751c 100755 --- a/src/plugins/expression_metric/public/plugin.ts +++ b/src/plugins/expression_metric/public/plugin.ts @@ -9,7 +9,7 @@ import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; import { ExpressionsStart, ExpressionsSetup } from '../../expressions/public'; import { metricFunction } from '../common/expression_functions'; -import { metricRenderer } from './expression_renderers'; +import { metricRendererFactory } from './expression_renderers'; interface SetupDeps { expressions: ExpressionsSetup; @@ -27,7 +27,7 @@ export class ExpressionMetricPlugin { public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionMetricPluginSetup { expressions.registerFunction(metricFunction); - expressions.registerRenderer(metricRenderer); + expressions.registerRenderer(metricRendererFactory(core)); } public start(core: CoreStart): ExpressionMetricPluginStart {} diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts b/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts index 572771537ec72..f97ac6e538575 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts @@ -6,7 +6,7 @@ */ import { imageRenderer } from '../../../../../src/plugins/expression_image/public'; -import { metricRenderer } from '../../../../../src/plugins/expression_metric/public'; +import { metricRendererFactory } from '../../../../../src/plugins/expression_metric/public'; import { errorRendererFactory, debugRendererFactory, @@ -20,11 +20,14 @@ import { export const renderFunctions = [ imageRenderer, - metricRenderer, revealImageRenderer, shapeRenderer, repeatImageRenderer, progressRenderer, ]; -export const renderFunctionFactories = [debugRendererFactory, errorRendererFactory]; +export const renderFunctionFactories = [ + debugRendererFactory, + errorRendererFactory, + metricRendererFactory, +]; diff --git a/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js b/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js index 1d2326b77dd26..b71e60e5ef0be 100644 --- a/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js +++ b/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js @@ -21,7 +21,7 @@ import { shapeRenderer as shape, progressRenderer as progress, } from '../../../../src/plugins/expression_shape/public'; -import { metricRenderer as metric } from '../../../../src/plugins/expression_metric/public'; +import { getMetricRenderer } from '../../../../src/plugins/expression_metric/public'; const unboxFactory = (factory) => factory(); @@ -31,6 +31,7 @@ const renderFunctionsFactories = [ getTableRenderer, getErrorRenderer, getDebugRenderer, + getMetricRenderer, ]; /** @@ -42,7 +43,6 @@ export const renderFunctions = [ image, repeatImage, revealImage, - metric, pie, plot, progress, From 680d0e19ccbf4b78faa8781caa1875c9794e78e9 Mon Sep 17 00:00:00 2001 From: Maja Grubic Date: Fri, 3 Dec 2021 10:55:07 +0100 Subject: [PATCH 10/62] [Discover] Add new KibanaThemeProvider (#119784) * [Discover] Add new KibanaThemeProvider * Wrap remaining components in KibanaThemeProvider * Fix failing unit test * Fix failing unit test * Add missing theme Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../application/context/context_app.test.tsx | 6 +++- .../utils/use_context_app_fetch.test.ts | 6 +++- .../context/utils/use_context_app_fetch.tsx | 26 ++++++++++------ .../discover/public/application/index.tsx | 8 +++-- .../components/top_nav/get_top_nav_links.ts | 2 ++ .../top_nav/open_options_popover.tsx | 10 +++++-- .../top_nav/show_open_search_panel.tsx | 10 +++++-- .../application/not_found/not_found_route.tsx | 29 ++++++++++-------- .../embeddable/saved_search_embeddable.tsx | 30 ++++++++++++------- 9 files changed, 86 insertions(+), 41 deletions(-) diff --git a/src/plugins/discover/public/application/context/context_app.test.tsx b/src/plugins/discover/public/application/context/context_app.test.tsx index 7f78bb1c698ab..a31557124d49a 100644 --- a/src/plugins/discover/public/application/context/context_app.test.tsx +++ b/src/plugins/discover/public/application/context/context_app.test.tsx @@ -19,6 +19,7 @@ import { DiscoverServices } from '../../build_services'; import { indexPatternsMock } from '../../__mocks__/index_patterns'; import { act } from 'react-dom/test-utils'; import { uiSettingsMock } from '../../__mocks__/ui_settings'; +import { themeServiceMock } from '../../../../../core/public/mocks'; const mockFilterManager = createFilterManagerMock(); const mockNavigationPlugin = { ui: { TopNavMenu: mockTopNavMenu } }; @@ -60,7 +61,10 @@ describe('ContextApp test', () => { indexPatterns: indexPatternsMock, toastNotifications: { addDanger: () => {} }, navigation: mockNavigationPlugin, - core: { notifications: { toasts: [] } }, + core: { + notifications: { toasts: [] }, + theme: { theme$: themeServiceMock.createStartContract().theme$ }, + }, history: () => {}, fieldFormats: { getDefaultInstance: jest.fn(() => ({ convert: (value: unknown) => value })), diff --git a/src/plugins/discover/public/application/context/utils/use_context_app_fetch.test.ts b/src/plugins/discover/public/application/context/utils/use_context_app_fetch.test.ts index cd7bcd810dc39..0fc8bd99c021d 100644 --- a/src/plugins/discover/public/application/context/utils/use_context_app_fetch.test.ts +++ b/src/plugins/discover/public/application/context/utils/use_context_app_fetch.test.ts @@ -21,6 +21,7 @@ import { import { indexPatternWithTimefieldMock } from '../../../__mocks__/index_pattern_with_timefield'; import { createContextSearchSourceStub } from '../services/_stubs'; import { IndexPattern } from '../../../../../data_views/common'; +import { themeServiceMock } from '../../../../../../core/public/mocks'; const mockFilterManager = createFilterManagerMock(); @@ -60,7 +61,10 @@ const initDefaults = (tieBreakerFields: string[], indexPatternId = 'the-index-pa }, }, toastNotifications: { addDanger: dangerNotification }, - core: { notifications: { toasts: [] } }, + core: { + notifications: { toasts: [] }, + theme: { theme$: themeServiceMock.createStartContract().theme$ }, + }, history: () => {}, filterManager: mockFilterManager, uiSettings: { diff --git a/src/plugins/discover/public/application/context/utils/use_context_app_fetch.tsx b/src/plugins/discover/public/application/context/utils/use_context_app_fetch.tsx index e5ed24d475497..fc5718abb43f0 100644 --- a/src/plugins/discover/public/application/context/utils/use_context_app_fetch.tsx +++ b/src/plugins/discover/public/application/context/utils/use_context_app_fetch.tsx @@ -11,7 +11,7 @@ import { CONTEXT_TIE_BREAKER_FIELDS_SETTING } from '../../../../common'; import { DiscoverServices } from '../../../build_services'; import { fetchAnchor } from '../services/anchor'; import { fetchSurroundingDocs, SurrDocType } from '../services/context'; -import { MarkdownSimple, toMountPoint } from '../../../../../kibana_react/public'; +import { MarkdownSimple, toMountPoint, wrapWithTheme } from '../../../../../kibana_react/public'; import { IndexPattern, SortDirection } from '../../../../../data/public'; import { ContextFetchState, @@ -42,7 +42,8 @@ export function useContextAppFetch({ useNewFieldsApi, services, }: ContextAppFetchProps) { - const { uiSettings: config, data, toastNotifications, filterManager } = services; + const { uiSettings: config, data, toastNotifications, filterManager, core } = services; + const { theme$ } = core.theme; const searchSource = useMemo(() => { return data.search.searchSource.createEmpty(); @@ -70,11 +71,14 @@ export function useContextAppFetch({ toastNotifications.addDanger({ title: errorTitle, text: toMountPoint( - - {i18n.translate('discover.context.invalidTieBreakerFiledSetting', { - defaultMessage: 'Invalid tie breaker field setting', - })} - + wrapWithTheme( + + {i18n.translate('discover.context.invalidTieBreakerFiledSetting', { + defaultMessage: 'Invalid tie breaker field setting', + })} + , + theme$ + ) ), }); return; @@ -93,7 +97,7 @@ export function useContextAppFetch({ setState(createError('anchorStatus', FailureReason.UNKNOWN, error)); toastNotifications.addDanger({ title: errorTitle, - text: toMountPoint({error.message}), + text: toMountPoint(wrapWithTheme({error.message}, theme$)), }); } }, [ @@ -104,6 +108,7 @@ export function useContextAppFetch({ anchorId, searchSource, useNewFieldsApi, + theme$, ]); const fetchSurroundingRows = useCallback( @@ -135,7 +140,9 @@ export function useContextAppFetch({ setState(createError(statusKey, FailureReason.UNKNOWN, error)); toastNotifications.addDanger({ title: errorTitle, - text: toMountPoint({error.message}), + text: toMountPoint( + wrapWithTheme({error.message}, theme$) + ), }); } }, @@ -148,6 +155,7 @@ export function useContextAppFetch({ indexPattern, toastNotifications, useNewFieldsApi, + theme$, ] ); diff --git a/src/plugins/discover/public/application/index.tsx b/src/plugins/discover/public/application/index.tsx index f6c7d60ed7db8..55407835c0a4b 100644 --- a/src/plugins/discover/public/application/index.tsx +++ b/src/plugins/discover/public/application/index.tsx @@ -8,11 +8,11 @@ import { i18n } from '@kbn/i18n'; import { getServices } from '../kibana_services'; import { discoverRouter } from './discover_router'; -import { toMountPoint } from '../../../kibana_react/public'; +import { toMountPoint, wrapWithTheme } from '../../../kibana_react/public'; export const renderApp = (element: HTMLElement) => { const services = getServices(); - const { history: getHistory, capabilities, chrome, data } = services; + const { history: getHistory, capabilities, chrome, data, core } = services; const history = getHistory(); if (!capabilities.discover.save) { @@ -26,7 +26,9 @@ export const renderApp = (element: HTMLElement) => { iconType: 'glasses', }); } - const unmount = toMountPoint(discoverRouter(services, history))(element); + const unmount = toMountPoint(wrapWithTheme(discoverRouter(services, history), core.theme.theme$))( + element + ); return () => { unmount(); diff --git a/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.ts b/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.ts index 4b9d48a92e0f5..6e93bc40f7d7f 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.ts +++ b/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.ts @@ -52,6 +52,7 @@ export const getTopNavLinks = ({ openOptionsPopover({ I18nContext: services.core.i18n.Context, anchorElement, + theme$: services.core.theme.theme$, }), testId: 'discoverOptionsButton', }; @@ -95,6 +96,7 @@ export const getTopNavLinks = ({ showOpenSearchPanel({ onOpenSavedSearch, I18nContext: services.core.i18n.Context, + theme$: services.core.theme.theme$, }), }; diff --git a/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.tsx b/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.tsx index 0d359c865220f..ea0cd804efec0 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.tsx @@ -8,7 +8,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { I18nStart } from 'kibana/public'; +import { CoreTheme, I18nStart } from 'kibana/public'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { @@ -22,8 +22,10 @@ import { EuiTextAlign, } from '@elastic/eui'; import './open_options_popover.scss'; +import { Observable } from 'rxjs'; import { DOC_TABLE_LEGACY } from '../../../../../common'; import { getServices } from '../../../../kibana_services'; +import { KibanaThemeProvider } from '../../../../../../kibana_react/public'; const container = document.createElement('div'); let isOpen = false; @@ -125,9 +127,11 @@ function onClose() { export function openOptionsPopover({ I18nContext, anchorElement, + theme$, }: { I18nContext: I18nStart['Context']; anchorElement: HTMLElement; + theme$: Observable; }) { if (isOpen) { onClose(); @@ -139,7 +143,9 @@ export function openOptionsPopover({ const element = ( - + + + ); ReactDOM.render(element, container); diff --git a/src/plugins/discover/public/application/main/components/top_nav/show_open_search_panel.tsx b/src/plugins/discover/public/application/main/components/top_nav/show_open_search_panel.tsx index 1a9bfd7e30c57..d506de357675a 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/show_open_search_panel.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/show_open_search_panel.tsx @@ -8,17 +8,21 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { I18nStart } from 'kibana/public'; +import { CoreTheme, I18nStart } from 'kibana/public'; +import { Observable } from 'rxjs'; import { OpenSearchPanel } from './open_search_panel'; +import { KibanaThemeProvider } from '../../../../../../kibana_react/public'; let isOpen = false; export function showOpenSearchPanel({ I18nContext, onOpenSavedSearch, + theme$, }: { I18nContext: I18nStart['Context']; onOpenSavedSearch: (id: string) => void; + theme$: Observable; }) { if (isOpen) { return; @@ -35,7 +39,9 @@ export function showOpenSearchPanel({ document.body.appendChild(container); const element = ( - + + + ); ReactDOM.render(element, container); diff --git a/src/plugins/discover/public/application/not_found/not_found_route.tsx b/src/plugins/discover/public/application/not_found/not_found_route.tsx index 80e4e5c8057f6..7b42e85584428 100644 --- a/src/plugins/discover/public/application/not_found/not_found_route.tsx +++ b/src/plugins/discover/public/application/not_found/not_found_route.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { EuiCallOut } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { Redirect } from 'react-router-dom'; -import { toMountPoint } from '../../../../kibana_react/public'; +import { toMountPoint, wrapWithTheme } from '../../../../kibana_react/public'; import { DiscoverServices } from '../../build_services'; import { getUrlTracker } from '../../kibana_services'; @@ -39,17 +39,20 @@ export function NotFoundRoute(props: NotFoundRouteProps) { bannerId = core.overlays.banners.replace( bannerId, toMountPoint( - -

    - -

    -
    + wrapWithTheme( + +

    + +

    +
    , + core.theme.theme$ + ) ) ); @@ -59,7 +62,7 @@ export function NotFoundRoute(props: NotFoundRouteProps) { core.overlays.banners.remove(bannerId); } }, 15000); - }, [core.overlays.banners, history, urlForwarding]); + }, [core.overlays.banners, history, urlForwarding, core.theme.theme$]); return ; } diff --git a/src/plugins/discover/public/embeddable/saved_search_embeddable.tsx b/src/plugins/discover/public/embeddable/saved_search_embeddable.tsx index 4a7f0b1c36868..6d7e515e33fa4 100644 --- a/src/plugins/discover/public/embeddable/saved_search_embeddable.tsx +++ b/src/plugins/discover/public/embeddable/saved_search_embeddable.tsx @@ -48,6 +48,7 @@ import { VIEW_MODE } from '../components/view_mode_toggle'; import { updateSearchSource } from './utils/update_search_source'; import { FieldStatsTableSavedSearchEmbeddable } from '../application/main/components/field_stats_table'; import { ElasticSearchHit } from '../types'; +import { KibanaThemeProvider } from '../../../kibana_react/public'; export type SearchProps = Partial & Partial & { @@ -391,15 +392,17 @@ export class SavedSearchEmbeddable Array.isArray(searchProps.columns) ) { ReactDOM.render( - , + + + , domNode ); return; @@ -410,7 +413,14 @@ export class SavedSearchEmbeddable useLegacyTable, refs: domNode, }; - ReactDOM.render(, domNode); + if (searchProps.services) { + ReactDOM.render( + + + , + domNode + ); + } } public reload() { From 1928beade8b18003580ef6264cad9d178d0c8ba7 Mon Sep 17 00:00:00 2001 From: Vitalii Dmyterko <92328789+vitaliidm@users.noreply.github.com> Date: Fri, 3 Dec 2021 10:14:47 +0000 Subject: [PATCH 11/62] [Security Solution][Detections] Adds Rules monitoring table actions (#119644) [Security Solution][Detections] Adds actions for Rules monitoring table: single/bulk enable, disable, duplicate, export, remove (#119644) --- .../detection_rules/prebuilt_rules.spec.ts | 15 + .../cypress/screens/alerts_detection_rules.ts | 2 + .../rules/all_rules_tables/index.test.tsx | 122 ------ .../rules/all_rules_tables/index.tsx | 102 ----- .../rules/use_rule_status.test.tsx | 2 - .../rules/use_rule_status.tsx | 8 +- .../rules/all/columns.test.tsx | 4 - .../detection_engine/rules/all/columns.tsx | 392 ++++++++---------- .../detection_engine/rules/all/index.test.tsx | 2 - .../rules/all/popover_tooltip.tsx | 3 +- .../rules/all/rules_tables.tsx | 75 ++-- .../all/table_header_tooltip_cell.test.tsx | 36 ++ .../rules/all/table_header_tooltip_cell.tsx | 46 ++ 13 files changed, 334 insertions(+), 475 deletions(-) delete mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.test.tsx delete mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.tsx create mode 100644 x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/table_header_tooltip_cell.test.tsx create mode 100644 x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/table_header_tooltip_cell.tsx diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_rules/prebuilt_rules.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_rules/prebuilt_rules.spec.ts index b259c0f1d9e33..38f5eec836bd6 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_rules/prebuilt_rules.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_rules/prebuilt_rules.spec.ts @@ -13,6 +13,8 @@ import { RULES_EMPTY_PROMPT, RULE_SWITCH, SHOWING_RULES_TEXT, + RULES_MONIROTING_TABLE, + SELECT_ALL_RULES_ON_PAGE_CHECKBOX, } from '../../screens/alerts_detection_rules'; import { goToManageAlertsDetectionRules, waitForAlertsIndexToBeCreated } from '../../tasks/alerts'; @@ -94,6 +96,19 @@ describe('Actions with prebuilt rules', () => { cy.get(RULE_SWITCH).should('have.attr', 'aria-checked', 'false'); }); + it('Allows to activate all rules on a page and deactivate single one at monitoring table', () => { + cy.get(RULES_MONIROTING_TABLE).click(); + cy.get(SELECT_ALL_RULES_ON_PAGE_CHECKBOX).click(); + activateSelectedRules(); + waitForRuleToChangeStatus(); + cy.get(RULE_SWITCH).should('have.attr', 'aria-checked', 'true'); + + selectNumberOfRules(1); + cy.get(RULE_SWITCH).first().click(); + waitForRuleToChangeStatus(); + cy.get(RULE_SWITCH).first().should('have.attr', 'aria-checked', 'false'); + }); + it('Allows to delete all rules at once', () => { selectAllRules(); deleteSelectedRules(); diff --git a/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts b/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts index 39e08e29bdc2a..2fff4c2e92676 100644 --- a/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts +++ b/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts @@ -97,3 +97,5 @@ export const RULE_DETAILS_DELETE_BTN = '[data-test-subj="rules-details-delete-ru export const ALERT_DETAILS_CELLS = '[data-test-subj="dataGridRowCell"]'; export const SERVER_SIDE_EVENT_COUNT = '[data-test-subj="server-side-event-count"]'; + +export const SELECT_ALL_RULES_ON_PAGE_CHECKBOX = '[data-test-subj="checkboxSelectAll"]'; diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.test.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.test.tsx deleted file mode 100644 index d1dfd6ccfd565..0000000000000 --- a/x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.test.tsx +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { useRef } from 'react'; -import { shallow } from 'enzyme'; - -import '../../../../common/mock/match_media'; -import { AllRulesTables } from './index'; -import { AllRulesTabs } from '../../../pages/detection_engine/rules/all'; - -describe('AllRulesTables', () => { - it('renders correctly', () => { - const Component = () => { - const ref = useRef(null); - - return ( - - ); - }; - const wrapper = shallow(); - - expect(wrapper.dive().find('[data-test-subj="rules-table"]')).toHaveLength(1); - }); - - it('renders rules tab when "selectedTab" is "rules"', () => { - const Component = () => { - const ref = useRef(null); - - return ( - - ); - }; - const wrapper = shallow(); - - expect(wrapper.dive().find('[data-test-subj="rules-table"]')).toHaveLength(1); - expect(wrapper.dive().find('[data-test-subj="monitoring-table"]')).toHaveLength(0); - }); - - it('renders monitoring tab when "selectedTab" is "monitoring"', () => { - const Component = () => { - const ref = useRef(null); - - return ( - - ); - }; - const wrapper = shallow(); - - expect(wrapper.dive().find('[data-test-subj="rules-table"]')).toHaveLength(0); - expect(wrapper.dive().find('[data-test-subj="monitoring-table"]')).toHaveLength(1); - }); -}); diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.tsx deleted file mode 100644 index 82e54b5b86072..0000000000000 --- a/x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.tsx +++ /dev/null @@ -1,102 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { - Direction, - EuiBasicTable, - EuiBasicTableColumn, - EuiEmptyPrompt, - EuiTableSelectionType, -} from '@elastic/eui'; - -import React, { memo } from 'react'; -import { Rule, Rules, RulesSortingFields } from '../../../containers/detection_engine/rules/types'; -import { AllRulesTabs } from '../../../pages/detection_engine/rules/all'; -import { - RulesColumns, - RuleStatusRowItemType, -} from '../../../pages/detection_engine/rules/all/columns'; -import * as i18n from '../../../pages/detection_engine/rules/translations'; -import { EuiBasicTableOnChange } from '../../../pages/detection_engine/rules/types'; - -export interface SortingType { - sort: { - field: RulesSortingFields; - direction: Direction; - }; -} - -interface AllRulesTablesProps { - euiBasicTableSelectionProps: EuiTableSelectionType; - hasPermissions: boolean; - monitoringColumns: Array>; - pagination: { - pageIndex: number; - pageSize: number; - totalItemCount: number; - pageSizeOptions: number[]; - }; - rules: Rules; - rulesColumns: RulesColumns[]; - rulesStatuses: RuleStatusRowItemType[]; - sorting: SortingType; - tableOnChangeCallback: ({ page, sort }: EuiBasicTableOnChange) => void; - tableRef?: React.MutableRefObject; - selectedTab: AllRulesTabs; -} - -const emptyPrompt = ( - {i18n.NO_RULES}} titleSize="xs" body={i18n.NO_RULES_BODY} /> -); - -export const AllRulesTablesComponent: React.FC = ({ - euiBasicTableSelectionProps, - hasPermissions, - monitoringColumns, - pagination, - rules, - rulesColumns, - rulesStatuses, - sorting, - tableOnChangeCallback, - tableRef, - selectedTab, -}) => { - return ( - <> - {selectedTab === AllRulesTabs.rules && ( - - )} - {selectedTab === AllRulesTabs.monitoring && ( - - )} - - ); -}; - -export const AllRulesTables = memo(AllRulesTablesComponent); diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_status.test.tsx b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_status.test.tsx index 4d01e2ff00ec1..a5809ea776322 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_status.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_status.test.tsx @@ -178,8 +178,6 @@ describe('useRuleStatus', () => { }, failures: [], id: '12345678987654321', - activate: true, - name: 'Test rule', }, ], }); diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_status.tsx b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_status.tsx index 4f524886935cd..d0c75e08ae01b 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_status.tsx +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_status.tsx @@ -9,7 +9,7 @@ import { useEffect, useRef, useState } from 'react'; import { isNotFoundError } from '@kbn/securitysolution-t-grid'; import { useAppToasts } from '../../../../common/hooks/use_app_toasts'; -import { RuleStatusRowItemType } from '../../../pages/detection_engine/rules/all/columns'; +import { EnhancedRuleStatus } from '../../../pages/detection_engine/rules/all/columns'; import { getRuleStatusById, getRulesStatusByIds } from './api'; import * as i18n from './translations'; import { RuleStatus, Rules } from './types'; @@ -18,7 +18,7 @@ type Func = (ruleId: string) => void; export type ReturnRuleStatus = [boolean, RuleStatus | null, Func | null]; export interface ReturnRulesStatuses { loading: boolean; - rulesStatuses: RuleStatusRowItemType[]; + rulesStatuses: EnhancedRuleStatus[]; } /** @@ -78,7 +78,7 @@ export const useRuleStatus = (id: string | undefined | null): ReturnRuleStatus = * */ export const useRulesStatuses = (rules: Rules): ReturnRulesStatuses => { - const [rulesStatuses, setRuleStatuses] = useState([]); + const [rulesStatuses, setRuleStatuses] = useState([]); const [loading, setLoading] = useState(false); const { addError } = useAppToasts(); @@ -98,8 +98,6 @@ export const useRulesStatuses = (rules: Rules): ReturnRulesStatuses => { setRuleStatuses( rules.map((rule) => ({ id: rule.id, - activate: rule.enabled, - name: rule.name, ...ruleStatusesResponse[rule.id], })) ); diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.test.tsx index 3920aa40e1f15..59c09c415f50e 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.test.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import { scopedHistoryMock } from 'src/core/public/mocks'; import uuid from 'uuid'; import '../../../../../common/mock/match_media'; import { deleteRulesAction, duplicateRulesAction, editRuleAction } from './actions'; @@ -18,7 +17,6 @@ jest.mock('./actions', () => ({ editRuleAction: jest.fn(), })); -const history = scopedHistoryMock.create(); const duplicateRulesActionMock = duplicateRulesAction as jest.Mock; const deleteRulesActionMock = deleteRulesAction as jest.Mock; const editRuleActionMock = editRuleAction as jest.Mock; @@ -45,7 +43,6 @@ describe('AllRulesTable Columns', () => { const duplicateRulesActionObject = getActions( dispatch, dispatchToaster, - history, navigateToApp, reFetchRules, refetchPrePackagedRulesStatus, @@ -62,7 +59,6 @@ describe('AllRulesTable Columns', () => { const deleteRulesActionObject = getActions( dispatch, dispatchToaster, - history, navigateToApp, reFetchRules, refetchPrePackagedRulesStatus, diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.tsx index 235cdd9c740ee..d586f0e4856d4 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.tsx @@ -10,12 +10,10 @@ import { EuiTableActionsColumnType, EuiText, EuiToolTip, - EuiIcon, EuiLink, EuiBadge, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import * as H from 'history'; import { sum } from 'lodash'; import React, { Dispatch } from 'react'; @@ -40,6 +38,7 @@ import { RulesTableAction } from '../../../../containers/detection_engine/rules/ import { LinkAnchor } from '../../../../../common/components/links'; import { getToolTipContent, canEditRuleWithActions } from '../../../../../common/utils/privileges'; import { PopoverTooltip } from './popover_tooltip'; +import { TableHeaderTooltipCell } from './table_header_tooltip_cell'; import { APP_UI_ID, @@ -48,18 +47,25 @@ import { } from '../../../../../../common/constants'; import { DocLinksStart, NavigateToAppOptions } from '../../../../../../../../../src/core/public'; +type FormatUrl = (path: string) => string; +type HasReadActionsPrivileges = + | boolean + | Readonly<{ + [x: string]: boolean; + }>; + +export type TableItem = Rule & Partial; +export type TableColumn = EuiBasicTableColumn | EuiTableActionsColumnType; + +const extractRuleFromRow = ({ current_status: _, failures, ...rule }: TableItem): Rule => rule; + export const getActions = ( dispatch: React.Dispatch, dispatchToaster: Dispatch, - history: H.History, navigateToApp: (appId: string, options?: NavigateToAppOptions | undefined) => Promise, reFetchRules: () => Promise, refetchPrePackagedRulesStatus: () => Promise, - actionsPrivileges: - | boolean - | Readonly<{ - [x: string]: boolean; - }> + actionsPrivileges: HasReadActionsPrivileges ) => [ { 'data-test-subj': 'editRuleAction', @@ -72,8 +78,9 @@ export const getActions = ( i18n.EDIT_RULE_SETTINGS ), icon: 'controlsHorizontal', - onClick: (rowItem: Rule) => editRuleAction(rowItem.id, navigateToApp), - enabled: (rowItem: Rule) => canEditRuleWithActions(rowItem, actionsPrivileges), + onClick: (rowItem: TableItem) => editRuleAction(rowItem.id, navigateToApp), + enabled: (rowItem: TableItem) => + canEditRuleWithActions(extractRuleFromRow(rowItem), actionsPrivileges), }, { 'data-test-subj': 'duplicateRuleAction', @@ -86,10 +93,10 @@ export const getActions = ( ) : ( i18n.DUPLICATE_RULE ), - enabled: (rowItem: Rule) => canEditRuleWithActions(rowItem, actionsPrivileges), - onClick: async (rowItem: Rule) => { + enabled: (rowItem: TableItem) => canEditRuleWithActions(rowItem, actionsPrivileges), + onClick: async (rowItem: TableItem) => { const createdRules = await duplicateRulesAction( - [rowItem], + [extractRuleFromRow(rowItem)], [rowItem.id], dispatch, dispatchToaster @@ -120,97 +127,139 @@ export const getActions = ( }, ]; -export type RuleStatusRowItemType = RuleStatus & { - name: string; +export type EnhancedRuleStatus = RuleStatus & { id: string; }; -export type RulesColumns = EuiBasicTableColumn | EuiTableActionsColumnType; -export type RulesStatusesColumns = EuiBasicTableColumn; -type FormatUrl = (path: string) => string; -interface GetColumns { + +interface GetColumnsProps { dispatch: React.Dispatch; - dispatchToaster: Dispatch; formatUrl: FormatUrl; - history: H.History; hasMlPermissions: boolean; hasPermissions: boolean; loadingRuleIds: string[]; navigateToApp: (appId: string, options?: NavigateToAppOptions | undefined) => Promise; + hasReadActionsPrivileges: HasReadActionsPrivileges; + dispatchToaster: Dispatch; reFetchRules: () => Promise; refetchPrePackagedRulesStatus: () => Promise; - hasReadActionsPrivileges: - | boolean - | Readonly<{ - [x: string]: boolean; - }>; + docLinks: DocLinksStart; } -export const getColumns = ({ - dispatch, - dispatchToaster, - formatUrl, - history, +const getColumnEnabled = ({ hasMlPermissions, + hasReadActionsPrivileges, + dispatch, hasPermissions, loadingRuleIds, +}: GetColumnsProps): TableColumn => ({ + field: 'enabled', + name: i18n.COLUMN_ACTIVATE, + render: (_, rule: TableItem) => ( + + + + ), + width: '95px', + sortable: true, +}); + +const getColumnRuleName = ({ navigateToApp, formatUrl }: GetColumnsProps): TableColumn => ({ + field: 'name', + name: i18n.COLUMN_RULE, + render: (value: Rule['name'], item: TableItem) => ( + + void }) => { + ev.preventDefault(); + navigateToApp(APP_UI_ID, { + deepLinkId: SecurityPageName.rules, + path: getRuleDetailsUrl(item.id), + }); + }} + href={formatUrl(getRuleDetailsUrl(item.id))} + > + {value} + + + ), + width: '38%', + sortable: true, + truncateText: true, +}); + +const getColumnTags = (): TableColumn => ({ + field: 'tags', + name: null, + align: 'center', + render: (tags: Rule['tags']) => { + if (tags.length === 0) { + return null; + } + + const renderItem = (tag: string, i: number) => ( + + {tag} + + ); + return ( + + ); + }, + width: '65px', + truncateText: true, +}); + +const getActionsColumns = ({ + hasPermissions, + hasReadActionsPrivileges, + dispatch, + dispatchToaster, navigateToApp, reFetchRules, refetchPrePackagedRulesStatus, - hasReadActionsPrivileges, -}: GetColumns): RulesColumns[] => { - const cols: RulesColumns[] = [ - { - field: 'name', - name: i18n.COLUMN_RULE, - render: (value: Rule['name'], item: Rule) => ( - - void }) => { - ev.preventDefault(); - navigateToApp(APP_UI_ID, { - deepLinkId: SecurityPageName.rules, - path: getRuleDetailsUrl(item.id), - }); - }} - href={formatUrl(getRuleDetailsUrl(item.id))} - > - {value} - - - ), - width: '38%', - sortable: true, - truncateText: true, - }, - { - field: 'tags', - name: null, - align: 'center', - render: (tags: Rule['tags']) => { - if (tags.length === 0) { - return null; - } +}: GetColumnsProps): TableColumn[] => + hasPermissions + ? [ + { + actions: getActions( + dispatch, + dispatchToaster, + navigateToApp, + reFetchRules, + refetchPrePackagedRulesStatus, + hasReadActionsPrivileges + ), + width: '40px', + } as EuiTableActionsColumnType, + ] + : []; - const renderItem = (tag: string, i: number) => ( - - {tag} - - ); - return ( - - ); - }, - width: '65px', - truncateText: true, - }, +export const getRulesColumns = (columnsProps: GetColumnsProps): TableColumn[] => { + return [ + getColumnRuleName(columnsProps), + getColumnTags(), { field: 'risk_score', name: i18n.COLUMN_RISK_SCORE, @@ -288,112 +337,41 @@ export const getColumns = ({ width: '65px', truncateText: true, }, - { - align: 'center', - field: 'enabled', - name: i18n.COLUMN_ACTIVATE, - render: (value: Rule['enabled'], item: Rule) => ( - - - - ), - sortable: true, - width: '95px', - truncateText: true, - }, - ]; - const actions: RulesColumns[] = [ - { - actions: getActions( - dispatch, - dispatchToaster, - history, - navigateToApp, - reFetchRules, - refetchPrePackagedRulesStatus, - hasReadActionsPrivileges - ), - width: '40px', - } as EuiTableActionsColumnType, + getColumnEnabled(columnsProps), + ...getActionsColumns(columnsProps), ]; - - return hasPermissions ? [...cols, ...actions] : cols; }; -export const getMonitoringColumns = ( - navigateToApp: (appId: string, options?: NavigateToAppOptions | undefined) => Promise, - formatUrl: FormatUrl, - docLinks: DocLinksStart -): RulesStatusesColumns[] => { - const cols: RulesStatusesColumns[] = [ - { - field: 'name', - name: i18n.COLUMN_RULE, - render: (value: RuleStatus['current_status']['status'], item: RuleStatusRowItemType) => { - return ( - - void }) => { - ev.preventDefault(); - navigateToApp(APP_UI_ID, { - deepLinkId: SecurityPageName.rules, - path: getRuleDetailsUrl(item.id), - }); - }} - href={formatUrl(getRuleDetailsUrl(item.id))} - > - {value} - - - ); - }, - width: '28%', - truncateText: true, - }, +export const getMonitoringColumns = (columnsProps: GetColumnsProps): TableColumn[] => { + const { docLinks } = columnsProps; + return [ + { ...getColumnRuleName(columnsProps), width: '28%' }, + getColumnTags(), { field: 'current_status.bulk_create_time_durations', name: ( - <> - {i18n.COLUMN_INDEXING_TIMES} - - - - + ), - render: (value: RuleStatus['current_status']['bulk_create_time_durations']) => ( + render: (value: RuleStatus['current_status']['bulk_create_time_durations'] | undefined) => ( {value?.length ? sum(value.map(Number)).toFixed() : getEmptyTagValue()} ), - width: '14%', + width: '16%', truncateText: true, }, { field: 'current_status.search_after_time_durations', name: ( - <> - {i18n.COLUMN_QUERY_TIMES} - - - - + ), - render: (value: RuleStatus['current_status']['search_after_time_durations']) => ( + render: (value: RuleStatus['current_status']['search_after_time_durations'] | undefined) => ( {value?.length ? sum(value.map(Number)).toFixed() : getEmptyTagValue()} @@ -404,28 +382,32 @@ export const getMonitoringColumns = ( { field: 'current_status.gap', name: ( - <> - {i18n.COLUMN_GAP} - - -

    - - {'see documentation'} - - ), - }} - /> -

    -
    -
    - + + + +

    + + {'see documentation'} + + ), + }} + /> +

    +
    +
    + + } + /> ), - render: (value: RuleStatus['current_status']['gap']) => ( + render: (value: RuleStatus['current_status']['gap'] | undefined) => ( {value ?? getEmptyTagValue()} @@ -436,7 +418,7 @@ export const getMonitoringColumns = ( { field: 'current_status.status', name: i18n.COLUMN_LAST_RESPONSE, - render: (value: RuleStatus['current_status']['status']) => ( + render: (value: RuleStatus['current_status']['status'] | undefined) => ( ), width: '12%', @@ -445,7 +427,7 @@ export const getMonitoringColumns = ( { field: 'current_status.status_date', name: i18n.COLUMN_LAST_COMPLETE_RUN, - render: (value: RuleStatus['current_status']['status_date']) => { + render: (value: RuleStatus['current_status']['status_date'] | undefined) => { return value == null ? ( getEmptyTagValue() ) : ( @@ -457,20 +439,10 @@ export const getMonitoringColumns = ( /> ); }, - width: '18%', + width: '16%', truncateText: true, }, - { - field: 'activate', - name: i18n.COLUMN_ACTIVATE, - render: (value: Rule['enabled']) => ( - - {value ? i18n.ACTIVE : i18n.INACTIVE} - - ), - width: '95px', - }, + getColumnEnabled(columnsProps), + ...getActionsColumns(columnsProps), ]; - - return cols; }; diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/index.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/index.test.tsx index 200bf0c719320..487d0862cf467 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/index.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/index.test.tsx @@ -166,8 +166,6 @@ describe('AllRules', () => { }, failures: [], id: '12345678987654321', - activate: true, - name: 'Test rule', }, ], }); diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/popover_tooltip.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/popover_tooltip.tsx index 5cf0a0c0b28fc..22bad4fffade9 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/popover_tooltip.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/popover_tooltip.tsx @@ -31,9 +31,10 @@ const PopoverTooltipComponent = ({ columnName, children }: PopoverTooltipProps) setIsPopoverOpen(!isPopoverOpen)} - size="s" + size="xs" color="primary" iconType="questionInCircle" + style={{ height: 'auto' }} /> } > diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/rules_tables.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/rules_tables.tsx index bc2172a257635..54c2500d03b03 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/rules_tables.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/rules_tables.tsx @@ -13,6 +13,7 @@ import { EuiProgress, EuiConfirmModal, EuiWindowEvent, + EuiEmptyPrompt, } from '@elastic/eui'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { debounce } from 'lodash/fp'; @@ -23,7 +24,6 @@ import { useRulesStatuses, CreatePreBuiltRules, FilterOptions, - Rule, RulesSortingFields, } from '../../../../containers/detection_engine/rules'; @@ -33,12 +33,11 @@ import { useKibana, useUiSetting$ } from '../../../../../common/lib/kibana'; import { useStateToaster } from '../../../../../common/components/toasters'; import { Loader } from '../../../../../common/components/loader'; import { PrePackagedRulesPrompt } from '../../../../components/rules/pre_packaged_rules/load_empty_prompt'; -import { AllRulesTables, SortingType } from '../../../../components/rules/all_rules_tables'; import { getPrePackagedRuleStatus } from '../helpers'; import * as i18n from '../translations'; import { EuiBasicTableOnChange } from '../types'; import { getBatchItems } from './batch_actions'; -import { getColumns, getMonitoringColumns } from './columns'; +import { getRulesColumns, getMonitoringColumns, TableItem } from './columns'; import { showRulesTable } from './helpers'; import { RulesTableFilters } from './rules_table_filters/rules_table_filters'; import { useMlCapabilities } from '../../../../../common/components/ml/hooks/use_ml_capabilities'; @@ -167,7 +166,7 @@ export const RulesTables = React.memo( }, [loadingRuleIds, loadingRulesAction]); const sorting = useMemo( - (): SortingType => ({ + () => ({ sort: { field: filterOptions.sortField, direction: filterOptions.sortOrder, @@ -265,12 +264,10 @@ export const RulesTables = React.memo( [updateOptions, setLastRefreshDate] ); - const rulesColumns = useMemo(() => { - return getColumns({ + const [rulesColumns, monitoringColumns] = useMemo(() => { + const props = { dispatch, - dispatchToaster, formatUrl, - history, hasMlPermissions, hasPermissions, loadingRuleIds: @@ -279,10 +276,14 @@ export const RulesTables = React.memo( ? loadingRuleIds : [], navigateToApp, + hasReadActionsPrivileges: hasActionsPrivileges, + dispatchToaster, + history, reFetchRules, refetchPrePackagedRulesStatus, - hasReadActionsPrivileges: hasActionsPrivileges, - }); + docLinks, + }; + return [getRulesColumns(props), getMonitoringColumns(props)]; }, [ dispatch, dispatchToaster, @@ -296,13 +297,9 @@ export const RulesTables = React.memo( loadingRulesAction, navigateToApp, reFetchRules, + docLinks, ]); - const monitoringColumns = useMemo( - () => getMonitoringColumns(navigateToApp, formatUrl, docLinks), - [navigateToApp, formatUrl, docLinks] - ); - useEffect(() => { setRefreshRulesData(reFetchRules); }, [reFetchRules, setRefreshRulesData]); @@ -332,8 +329,8 @@ export const RulesTables = React.memo( const euiBasicTableSelectionProps = useMemo( () => ({ - selectable: (item: Rule) => !loadingRuleIds.includes(item.id), - onSelectionChange: (selected: Rule[]) => { + selectable: (item: TableItem) => !loadingRuleIds.includes(item.id), + onSelectionChange: (selected: TableItem[]) => { /** * EuiBasicTable doesn't provide declarative API to control selected rows. * This limitation requires us to synchronize selection state manually using setSelection(). @@ -447,6 +444,25 @@ export const RulesTables = React.memo( [initLoading, prePackagedRuleStatus, rulesCustomInstalled] ); + const items = useMemo(() => { + const rulesStatusesMap = new Map(rulesStatuses.map((item) => [item.id, item])); + + return rules.map((rule) => { + return { + ...rule, + ...rulesStatusesMap.get(rule.id), + }; + }); + }, [rulesStatuses, rules]); + + const tableProps = + selectedTab === AllRulesTabs.rules + ? { + 'data-test-subj': 'rules-table', + columns: rulesColumns, + } + : { 'data-test-subj': 'monitoring-table', columns: monitoringColumns }; + return ( <> @@ -535,18 +551,23 @@ export const RulesTables = React.memo( onToggleSelectAll={toggleSelectAll} showBulkActions /> - {i18n.NO_RULES}} + titleSize="xs" + body={i18n.NO_RULES_BODY} + /> + } + onChange={tableOnChangeCallback} pagination={paginationMemo} - rules={rules} - rulesColumns={rulesColumns} - rulesStatuses={rulesStatuses} + ref={tableRef} + selection={euiBasicTableSelectionProps} sorting={sorting} - tableOnChangeCallback={tableOnChangeCallback} - tableRef={tableRef} + {...tableProps} /> )} diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/table_header_tooltip_cell.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/table_header_tooltip_cell.test.tsx new file mode 100644 index 0000000000000..216dcc98c0e41 --- /dev/null +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/table_header_tooltip_cell.test.tsx @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { TableHeaderTooltipCell } from './table_header_tooltip_cell'; + +import { render, screen, fireEvent } from '@testing-library/react'; + +describe('Component TableHeaderTooltipCell', () => { + it('shoud render text with icon and tooltip', async () => { + render(); + + expect(screen.getByText('test title')).toBeInTheDocument(); + expect(screen.getByTestId('tableHeaderIcon')).toBeInTheDocument(); + + fireEvent.mouseOver(screen.getByTestId('tableHeaderIcon')); + expect(await screen.findByText('test tooltip content')).toBeInTheDocument(); + }); + + it('shoud render test element as custom tooltip', () => { + render( + } + /> + ); + + expect(screen.getByText('test title')).toBeInTheDocument(); + expect(screen.getByTestId('customTestTooltip')).toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/table_header_tooltip_cell.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/table_header_tooltip_cell.tsx new file mode 100644 index 0000000000000..3ec474974917b --- /dev/null +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/table_header_tooltip_cell.tsx @@ -0,0 +1,46 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { EuiToolTip, EuiIcon, EuiFlexGrid, EuiFlexItem } from '@elastic/eui'; + +interface Props { + title: string; + tooltipContent?: string; + customTooltip?: React.ReactNode; +} + +/** + * Table header cell component that includes icon(question mark) tooltip with additional details about column + * Icon tooltip will never be truncated and always be visible for user interaction + * @param title string - column header title + * @param tooltipContent string - text content of tooltip + * @param customTooltip React.ReactNode - any custom tooltip + */ +const TableHeaderTooltipCellComponent = ({ title, tooltipContent, customTooltip }: Props) => ( + + + {title} + + {customTooltip ?? ( + + + + )} + +); + +export const TableHeaderTooltipCell = React.memo(TableHeaderTooltipCellComponent); + +TableHeaderTooltipCell.displayName = 'TableHeaderTooltipCell'; From c6e9da28108fa0bd9f14ba85f8ef35fd59b7386b Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Fri, 3 Dec 2021 11:25:11 +0100 Subject: [PATCH 12/62] change ownership of `advanced_settings` to core team (#120331) --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c398316e634b9..a64ab63494b35 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -22,7 +22,6 @@ # Vis Editors /x-pack/plugins/lens/ @elastic/kibana-vis-editors -/src/plugins/advanced_settings/ @elastic/kibana-vis-editors /src/plugins/charts/ @elastic/kibana-vis-editors /src/plugins/vis_default_editor/ @elastic/kibana-vis-editors /src/plugins/vis_types/metric/ @elastic/kibana-vis-editors @@ -263,6 +262,7 @@ /src/plugins/home/server/*.ts @elastic/kibana-core /src/plugins/home/server/services/ @elastic/kibana-core /src/plugins/kibana_overview/ @elastic/kibana-core +/src/plugins/advanced_settings/ @elastic/kibana-core /x-pack/plugins/global_search_bar/ @elastic/kibana-core #CC# /src/core/server/csp/ @elastic/kibana-core #CC# /src/plugins/saved_objects/ @elastic/kibana-core From fd741b47e79bea44d8269c27d79d0d59007bc725 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Fri, 3 Dec 2021 12:01:37 +0100 Subject: [PATCH 13/62] [Watcher] Prevent expensive queries on ES by using PointInTimeFinder to get indexPatterns (#119717) * Use PointInTimeFinder to paginate through indexPatterns in a more performant way * commit using @elastic.co * Start working on tests * Add tests * Add missing types * Fix tests * Update tests responses * Remove unnecessary mocks * Fix type Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../watch_create_threshold.test.tsx | 8 ---- .../client_integration/watch_edit.test.ts | 8 ---- .../watcher/public/application/lib/api.ts | 8 ++-- .../threshold_watch_edit.tsx | 5 +- .../register_get_index_patterns_route.ts | 47 +++++++++++++++++++ .../api/indices/register_indices_routes.ts | 2 + x-pack/test/api_integration/apis/index.ts | 1 + .../api_integration/apis/watcher/index.ts | 14 ++++++ .../api_integration/apis/watcher/watcher.ts | 47 +++++++++++++++++++ 9 files changed, 116 insertions(+), 24 deletions(-) create mode 100644 x-pack/plugins/watcher/server/routes/api/indices/register_get_index_patterns_route.ts create mode 100644 x-pack/test/api_integration/apis/watcher/index.ts create mode 100644 x-pack/test/api_integration/apis/watcher/watcher.ts diff --git a/x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx b/x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx index 481f59093d7dc..52c3a69938d74 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx +++ b/x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx @@ -50,14 +50,6 @@ jest.mock('../../public/application/lib/api', () => { return { ...original, - loadIndexPatterns: async () => { - const INDEX_PATTERNS = [ - { attributes: { title: 'index1' } }, - { attributes: { title: 'index2' } }, - { attributes: { title: 'index3' } }, - ]; - return await INDEX_PATTERNS; - }, getHttpClient: () => mockHttpClient, }; }); diff --git a/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts b/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts index 1188cc8469a58..b5fb2aa9d915a 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts @@ -23,14 +23,6 @@ jest.mock('../../public/application/lib/api', () => { return { ...original, - loadIndexPatterns: async () => { - const INDEX_PATTERNS = [ - { attributes: { title: 'index1' } }, - { attributes: { title: 'index2' } }, - { attributes: { title: 'index3' } }, - ]; - return await INDEX_PATTERNS; - }, getHttpClient: () => mockHttpClient, }; }); diff --git a/x-pack/plugins/watcher/public/application/lib/api.ts b/x-pack/plugins/watcher/public/application/lib/api.ts index 61ea124695cb9..0971371f7949b 100644 --- a/x-pack/plugins/watcher/public/application/lib/api.ts +++ b/x-pack/plugins/watcher/public/application/lib/api.ts @@ -151,12 +151,10 @@ export const executeWatch = async (executeWatchDetails: ExecutedWatchDetails, wa }; export const loadIndexPatterns = async () => { - const { savedObjects } = await getSavedObjectsClient().find({ - type: 'index-pattern', - fields: ['title'], - perPage: 10000, + return sendRequest({ + path: `${basePath}/indices/index_patterns`, + method: 'get', }); - return savedObjects; }; const getWatchVisualizationDataDeserializer = (data: { visualizeData: any }) => data?.visualizeData; diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx index a4c19827c902a..a885c86bc8817 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx @@ -182,9 +182,8 @@ export const ThresholdWatchEdit = ({ pageTitle }: { pageTitle: string }) => { useEffect(() => { const getIndexPatterns = async () => { - const indexPatternObjects = await loadIndexPatterns(); - const titles = indexPatternObjects.map((indexPattern: any) => indexPattern.attributes.title); - setIndexPatterns(titles); + const { data: indexPatternTitles } = await loadIndexPatterns(); + setIndexPatterns(indexPatternTitles); }; const loadData = async () => { diff --git a/x-pack/plugins/watcher/server/routes/api/indices/register_get_index_patterns_route.ts b/x-pack/plugins/watcher/server/routes/api/indices/register_get_index_patterns_route.ts new file mode 100644 index 0000000000000..237f6dac6a254 --- /dev/null +++ b/x-pack/plugins/watcher/server/routes/api/indices/register_get_index_patterns_route.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { SavedObjectsFindResult } from 'src/core/server'; +import { RouteDependencies } from '../../../types'; + +export function registerGetIndexPatternsRoute({ + router, + license, + lib: { handleEsError }, +}: RouteDependencies) { + router.get( + { + path: '/api/watcher/indices/index_patterns', + validate: false, + }, + license.guardApiRoute(async ({ core: { savedObjects } }, request, response) => { + try { + const finder = savedObjects.client.createPointInTimeFinder({ + type: 'index-pattern', + fields: ['title'], + perPage: 1000, + }); + + const responses: string[] = []; + + for await (const result of finder.find()) { + responses.push( + ...result.saved_objects.map( + (indexPattern: SavedObjectsFindResult) => indexPattern.attributes.title + ) + ); + } + + await finder.close(); + + return response.ok({ body: responses }); + } catch (error) { + return handleEsError({ error, response }); + } + }) + ); +} diff --git a/x-pack/plugins/watcher/server/routes/api/indices/register_indices_routes.ts b/x-pack/plugins/watcher/server/routes/api/indices/register_indices_routes.ts index 041457aadf8eb..6e7003f1cafed 100644 --- a/x-pack/plugins/watcher/server/routes/api/indices/register_indices_routes.ts +++ b/x-pack/plugins/watcher/server/routes/api/indices/register_indices_routes.ts @@ -6,8 +6,10 @@ */ import { registerGetRoute } from './register_get_route'; +import { registerGetIndexPatternsRoute } from './register_get_index_patterns_route'; import { RouteDependencies } from '../../../types'; export function registerIndicesRoutes(deps: RouteDependencies) { registerGetRoute(deps); + registerGetIndexPatternsRoute(deps); } diff --git a/x-pack/test/api_integration/apis/index.ts b/x-pack/test/api_integration/apis/index.ts index 56b2042dc4854..b37d88a5dc426 100644 --- a/x-pack/test/api_integration/apis/index.ts +++ b/x-pack/test/api_integration/apis/index.ts @@ -34,5 +34,6 @@ export default function ({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./painless_lab')); loadTestFile(require.resolve('./file_upload')); loadTestFile(require.resolve('./ml')); + loadTestFile(require.resolve('./watcher')); }); } diff --git a/x-pack/test/api_integration/apis/watcher/index.ts b/x-pack/test/api_integration/apis/watcher/index.ts new file mode 100644 index 0000000000000..964b7fa0099af --- /dev/null +++ b/x-pack/test/api_integration/apis/watcher/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. + */ + +import { FtrProviderContext } from '../../ftr_provider_context'; + +export default function ({ loadTestFile }: FtrProviderContext) { + describe('Watcher', () => { + loadTestFile(require.resolve('./watcher')); + }); +} diff --git a/x-pack/test/api_integration/apis/watcher/watcher.ts b/x-pack/test/api_integration/apis/watcher/watcher.ts new file mode 100644 index 0000000000000..734b6c8c6212d --- /dev/null +++ b/x-pack/test/api_integration/apis/watcher/watcher.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../ftr_provider_context'; + +export default function ({ getService }: FtrProviderContext) { + const log = getService('log'); + const supertest = getService('supertest'); + const transform = getService('transform'); + + describe('watcher', () => { + before(async () => { + try { + await transform.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date'); + } catch (error) { + log.debug('[Setup error] Error creating index pattern'); + throw error; + } + }); + + after(async () => { + try { + await transform.testResources.deleteIndexPatternByTitle('ft_ecommerce'); + } catch (error) { + log.debug('[Cleanup error] Error deleting index pattern'); + throw error; + } + }); + + describe('POST /api/watcher/indices/index_patterns', () => { + it('returns list of index patterns', async () => { + const response = await supertest + .get('/api/watcher/indices/index_patterns') + .set('kbn-xsrf', 'kibana') + .expect(200); + + expect(response.body).to.contain('ft_ecommerce'); + }); + }); + }); +} From bfa8b3c9b6f3e7d58335cbfe991de519e2f087ec Mon Sep 17 00:00:00 2001 From: Yaroslav Kuznietsov Date: Fri, 3 Dec 2021 13:34:00 +0200 Subject: [PATCH 14/62] [Canvas] Added KibanaThemeProvider to expression_repeat_image. (#120089) * Added kibanaThemeProvider to expression_repeat_image. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../expression_repeat_image/kibana.json | 2 +- .../components/repeat_image_component.tsx | 4 +- .../repeat_image_renderer.stories.tsx | 4 +- .../public/expression_renderers/index.ts | 6 +- .../repeat_image_renderer.tsx | 74 +++++++++++-------- .../expression_repeat_image/public/index.ts | 5 +- .../expression_repeat_image/public/plugin.ts | 4 +- .../canvas_plugin_src/renderers/external.ts | 4 +- .../shareable_runtime/supported_renderers.js | 4 +- 9 files changed, 59 insertions(+), 48 deletions(-) diff --git a/src/plugins/expression_repeat_image/kibana.json b/src/plugins/expression_repeat_image/kibana.json index 5694e0160042c..0df2eb9842312 100755 --- a/src/plugins/expression_repeat_image/kibana.json +++ b/src/plugins/expression_repeat_image/kibana.json @@ -11,5 +11,5 @@ "ui": true, "requiredPlugins": ["expressions", "presentationUtil"], "optionalPlugins": [], - "requiredBundles": [] + "requiredBundles": ["kibanaReact"] } diff --git a/src/plugins/expression_repeat_image/public/components/repeat_image_component.tsx b/src/plugins/expression_repeat_image/public/components/repeat_image_component.tsx index 7a136b470e943..7da6735c6ce86 100644 --- a/src/plugins/expression_repeat_image/public/components/repeat_image_component.tsx +++ b/src/plugins/expression_repeat_image/public/components/repeat_image_component.tsx @@ -46,7 +46,9 @@ function setImageSize(img: HTMLImageElement, size: number) { } function createImageJSX(img: HTMLImageElement | null) { - if (!img) return null; + if (!img) { + return null; + } const params = img.width > img.height ? { heigth: img.height } : { width: img.width }; return ; } diff --git a/src/plugins/expression_repeat_image/public/expression_renderers/__stories__/repeat_image_renderer.stories.tsx b/src/plugins/expression_repeat_image/public/expression_renderers/__stories__/repeat_image_renderer.stories.tsx index 42f008b2570ea..c727ca9562fad 100644 --- a/src/plugins/expression_repeat_image/public/expression_renderers/__stories__/repeat_image_renderer.stories.tsx +++ b/src/plugins/expression_repeat_image/public/expression_renderers/__stories__/repeat_image_renderer.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; import { Render } from '../../../../presentation_util/public/__stories__'; -import { repeatImageRenderer } from '../repeat_image_renderer'; +import { getRepeatImageRenderer } from '../repeat_image_renderer'; import { getElasticLogo, getElasticOutline, @@ -31,7 +31,7 @@ const Renderer = ({ emptyImage: elasticOutline, }; - return ; + return ; }; storiesOf('enderers/repeatImage', module).add( diff --git a/src/plugins/expression_repeat_image/public/expression_renderers/index.ts b/src/plugins/expression_repeat_image/public/expression_renderers/index.ts index 5c5625f8c7730..eb161e6e0f2a3 100644 --- a/src/plugins/expression_repeat_image/public/expression_renderers/index.ts +++ b/src/plugins/expression_repeat_image/public/expression_renderers/index.ts @@ -6,8 +6,4 @@ * Side Public License, v 1. */ -import { repeatImageRenderer } from './repeat_image_renderer'; - -export const renderers = [repeatImageRenderer]; - -export { repeatImageRenderer }; +export { getRepeatImageRenderer, repeatImageRendererFactory } from './repeat_image_renderer'; diff --git a/src/plugins/expression_repeat_image/public/expression_renderers/repeat_image_renderer.tsx b/src/plugins/expression_repeat_image/public/expression_renderers/repeat_image_renderer.tsx index 330bf16e038fa..5e5bc04f317d2 100644 --- a/src/plugins/expression_repeat_image/public/expression_renderers/repeat_image_renderer.tsx +++ b/src/plugins/expression_repeat_image/public/expression_renderers/repeat_image_renderer.tsx @@ -7,10 +7,19 @@ */ import React, { lazy } from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { I18nProvider } from '@kbn/i18n-react'; +import { Observable } from 'rxjs'; +import { CoreTheme } from 'kibana/public'; import { ExpressionRenderDefinition, IInterpreterRenderHandlers } from 'src/plugins/expressions'; import { i18n } from '@kbn/i18n'; -import { getElasticOutline, isValidUrl, withSuspense } from '../../../presentation_util/public'; +import { I18nProvider } from '@kbn/i18n-react'; +import { KibanaThemeProvider } from '../../../kibana_react/public'; +import { CoreSetup } from '../../../../core/public'; +import { + defaultTheme$, + getElasticOutline, + isValidUrl, + withSuspense, +} from '../../../presentation_util/public'; import { RepeatImageRendererConfig } from '../../common/types'; const strings = { @@ -27,32 +36,39 @@ const strings = { const LazyRepeatImageComponent = lazy(() => import('../components/repeat_image_component')); const RepeatImageComponent = withSuspense(LazyRepeatImageComponent, null); -export const repeatImageRenderer = (): ExpressionRenderDefinition => ({ - name: 'repeatImage', - displayName: strings.getDisplayName(), - help: strings.getHelpDescription(), - reuseDomNode: true, - render: async ( - domNode: HTMLElement, - config: RepeatImageRendererConfig, - handlers: IInterpreterRenderHandlers - ) => { - const { elasticOutline } = await getElasticOutline(); - const settings = { - ...config, - image: isValidUrl(config.image) ? config.image : elasticOutline, - emptyImage: config.emptyImage || '', - }; +export const getRepeatImageRenderer = + (theme$: Observable = defaultTheme$) => + (): ExpressionRenderDefinition => ({ + name: 'repeatImage', + displayName: strings.getDisplayName(), + help: strings.getHelpDescription(), + reuseDomNode: true, + render: async ( + domNode: HTMLElement, + config: RepeatImageRendererConfig, + handlers: IInterpreterRenderHandlers + ) => { + const { elasticOutline } = await getElasticOutline(); + const settings = { + ...config, + image: isValidUrl(config.image) ? config.image : elasticOutline, + emptyImage: config.emptyImage || '', + }; + + handlers.onDestroy(() => { + unmountComponentAtNode(domNode); + }); - handlers.onDestroy(() => { - unmountComponentAtNode(domNode); - }); + render( + + + + + , + domNode + ); + }, + }); - render( - - - , - domNode - ); - }, -}); +export const repeatImageRendererFactory = (core: CoreSetup) => + getRepeatImageRenderer(core.theme.theme$); diff --git a/src/plugins/expression_repeat_image/public/index.ts b/src/plugins/expression_repeat_image/public/index.ts index 21e8f449dcc70..4080ad4f1359f 100755 --- a/src/plugins/expression_repeat_image/public/index.ts +++ b/src/plugins/expression_repeat_image/public/index.ts @@ -6,9 +6,6 @@ * Side Public License, v 1. */ -// TODO: https://github.com/elastic/kibana/issues/110893 -/* eslint-disable @kbn/eslint/no_export_all */ - import { ExpressionRepeatImagePlugin } from './plugin'; export type { ExpressionRepeatImagePluginSetup, ExpressionRepeatImagePluginStart } from './plugin'; @@ -17,4 +14,4 @@ export function plugin() { return new ExpressionRepeatImagePlugin(); } -export * from './expression_renderers'; +export { getRepeatImageRenderer, repeatImageRendererFactory } from './expression_renderers'; diff --git a/src/plugins/expression_repeat_image/public/plugin.ts b/src/plugins/expression_repeat_image/public/plugin.ts index d71ce99eb1bd1..2f275f9218d50 100755 --- a/src/plugins/expression_repeat_image/public/plugin.ts +++ b/src/plugins/expression_repeat_image/public/plugin.ts @@ -9,7 +9,7 @@ import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; import { ExpressionsStart, ExpressionsSetup } from '../../expressions/public'; import { repeatImageFunction } from '../common/expression_functions'; -import { repeatImageRenderer } from './expression_renderers'; +import { repeatImageRendererFactory } from './expression_renderers'; interface SetupDeps { expressions: ExpressionsSetup; @@ -33,7 +33,7 @@ export class ExpressionRepeatImagePlugin { public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionRepeatImagePluginSetup { expressions.registerFunction(repeatImageFunction); - expressions.registerRenderer(repeatImageRenderer); + expressions.registerRenderer(repeatImageRendererFactory(core)); } public start(core: CoreStart): ExpressionRepeatImagePluginStart {} diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts b/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts index f97ac6e538575..9e2a51065eb6c 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts @@ -11,7 +11,7 @@ import { errorRendererFactory, debugRendererFactory, } from '../../../../../src/plugins/expression_error/public'; -import { repeatImageRenderer } from '../../../../../src/plugins/expression_repeat_image/public'; +import { repeatImageRendererFactory } from '../../../../../src/plugins/expression_repeat_image/public'; import { revealImageRenderer } from '../../../../../src/plugins/expression_reveal_image/public'; import { shapeRenderer, @@ -22,12 +22,12 @@ export const renderFunctions = [ imageRenderer, revealImageRenderer, shapeRenderer, - repeatImageRenderer, progressRenderer, ]; export const renderFunctionFactories = [ debugRendererFactory, errorRendererFactory, + repeatImageRendererFactory, metricRendererFactory, ]; diff --git a/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js b/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js index b71e60e5ef0be..84150a6a9e82e 100644 --- a/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js +++ b/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js @@ -15,7 +15,7 @@ import { getErrorRenderer, getDebugRenderer, } from '../../../../src/plugins/expression_error/public'; -import { repeatImageRenderer as repeatImage } from '../../../../src/plugins/expression_repeat_image/public'; +import { getRepeatImageRenderer } from '../../../../src/plugins/expression_repeat_image/public'; import { revealImageRenderer as revealImage } from '../../../../src/plugins/expression_reveal_image/public'; import { shapeRenderer as shape, @@ -31,6 +31,7 @@ const renderFunctionsFactories = [ getTableRenderer, getErrorRenderer, getDebugRenderer, + getRepeatImageRenderer, getMetricRenderer, ]; @@ -41,7 +42,6 @@ const renderFunctionsFactories = [ */ export const renderFunctions = [ image, - repeatImage, revealImage, pie, plot, From 5bfaf51816c733df0dba4a6d61e7e8237d10ec57 Mon Sep 17 00:00:00 2001 From: Claudio Procida Date: Fri, 3 Dec 2021 13:09:47 +0100 Subject: [PATCH 15/62] [RAC] Fixes terminology and splits tests to new case (#120335) * Includes errors in the total number of rules * Fixes terminology and splits tests to new case * Removes unused vars * Review feedback --- .../containers/alerts_page/alerts_page.tsx | 11 +- .../services/observability/alerts/common.ts | 4 +- .../apps/observability/alerts/index.ts | 75 +----------- .../apps/observability/alerts/rule_stats.ts | 107 ++++++++++++++++++ .../apps/observability/helpers.ts | 12 ++ .../apps/observability/index.ts | 13 ++- 6 files changed, 133 insertions(+), 89 deletions(-) create mode 100644 x-pack/test/observability_functional/apps/observability/alerts/rule_stats.ts create mode 100644 x-pack/test/observability_functional/apps/observability/helpers.ts diff --git a/x-pack/plugins/observability/public/pages/alerts/containers/alerts_page/alerts_page.tsx b/x-pack/plugins/observability/public/pages/alerts/containers/alerts_page/alerts_page.tsx index 06040d9a186ff..4462daa1cbf28 100644 --- a/x-pack/plugins/observability/public/pages/alerts/containers/alerts_page/alerts_page.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/containers/alerts_page/alerts_page.tsx @@ -107,15 +107,10 @@ function AlertsPage() { // Note that the API uses the semantics of 'alerts' instead of 'rules' const { alertExecutionStatus, ruleMutedStatus, ruleEnabledStatus } = response; if (alertExecutionStatus && ruleMutedStatus && ruleEnabledStatus) { - const total = Object.entries(alertExecutionStatus).reduce((acc, [key, value]) => { - if (key !== 'error') { - acc = acc + value; - } - return acc; - }, 0); - const { error } = alertExecutionStatus; - const { muted } = ruleMutedStatus; + const total = Object.values(alertExecutionStatus).reduce((acc, value) => acc + value, 0); const { disabled } = ruleEnabledStatus; + const { muted } = ruleMutedStatus; + const { error } = alertExecutionStatus; setRuleStats({ ...ruleStats, total, diff --git a/x-pack/test/functional/services/observability/alerts/common.ts b/x-pack/test/functional/services/observability/alerts/common.ts index 2f888d3d733c0..270ab84f01d7a 100644 --- a/x-pack/test/functional/services/observability/alerts/common.ts +++ b/x-pack/test/functional/services/observability/alerts/common.ts @@ -271,7 +271,7 @@ export function ObservabilityAlertsCommonProvider({ return actionsOverflowButtons[index] || null; }; - const getAlertStatValue = async (testSubj: string) => { + const getRuleStatValue = async (testSubj: string) => { const stat = await testSubjects.find(testSubj); const title = await stat.findByCssSelector('.euiStat__title'); const count = await title.getVisibleText(); @@ -317,6 +317,6 @@ export function ObservabilityAlertsCommonProvider({ viewRuleDetailsButtonClick, viewRuleDetailsLinkClick, getAlertsFlyoutViewRuleDetailsLinkOrFail, - getAlertStatValue, + getRuleStatValue, }; } diff --git a/x-pack/test/observability_functional/apps/observability/alerts/index.ts b/x-pack/test/observability_functional/apps/observability/alerts/index.ts index 12a83f19ca258..40c4e53ba869b 100644 --- a/x-pack/test/observability_functional/apps/observability/alerts/index.ts +++ b/x-pack/test/observability_functional/apps/observability/alerts/index.ts @@ -7,19 +7,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; -import { ObjectRemover } from '../../../../functional_with_es_ssl/lib/object_remover'; -import { - createAlert, - disableAlert, - muteAlert, -} from '../../../../functional_with_es_ssl/lib/alert_api_actions'; -import { generateUniqueKey } from '../../../../functional_with_es_ssl/lib/get_test_data'; - -async function asyncForEach(array: T[], callback: (item: T, index: number) => void) { - for (let index = 0; index < array.length; index++) { - await callback(array[index], index); - } -} +import { asyncForEach } from '../helpers'; const ACTIVE_ALERTS_CELL_COUNT = 78; const RECOVERED_ALERTS_CELL_COUNT = 120; @@ -28,8 +16,6 @@ const TOTAL_ALERTS_CELL_COUNT = 165; export default ({ getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const find = getService('find'); - const supertest = getService('supertest'); - const objectRemover = new ObjectRemover(supertest); describe('Observability alerts', function () { this.tags('includeFirefox'); @@ -245,65 +231,6 @@ export default ({ getService }: FtrProviderContext) => { expect(await find.existsByCssSelector('[title="Rules and Connectors"]')).to.eql(true); }); }); - - describe('Stat counters', () => { - beforeEach(async () => { - const uniqueKey = generateUniqueKey(); - - const alertToDisable = await createAlert({ - supertest, - objectRemover, - overwrites: { name: 'b', tags: [uniqueKey] }, - }); - await createAlert({ - supertest, - objectRemover, - overwrites: { name: 'c', tags: [uniqueKey] }, - }); - await createAlert({ - supertest, - objectRemover, - overwrites: { name: 'a', tags: [uniqueKey] }, - }); - await createAlert({ - supertest, - objectRemover, - overwrites: { name: 'd', tags: [uniqueKey] }, - }); - await createAlert({ - supertest, - objectRemover, - overwrites: { name: 'e', tags: [uniqueKey] }, - }); - const alertToMute = await createAlert({ - supertest, - objectRemover, - overwrites: { name: 'f', tags: [uniqueKey] }, - }); - - await disableAlert({ supertest, alertId: alertToDisable.id }); - await muteAlert({ supertest, alertId: alertToMute.id }); - - await observability.alerts.common.navigateToTimeWithData(); - }); - - afterEach(async () => { - await objectRemover.removeAll(); - }); - - it('Exist and display expected values', async () => { - const subjToValueMap: { [key: string]: number } = { - statRuleCount: 6, - statDisabled: 1, - statMuted: 1, - statErrors: 0, - }; - await asyncForEach(Object.keys(subjToValueMap), async (subject: string) => { - const value = await observability.alerts.common.getAlertStatValue(subject); - expect(value).to.be(subjToValueMap[subject]); - }); - }); - }); }); }); }; diff --git a/x-pack/test/observability_functional/apps/observability/alerts/rule_stats.ts b/x-pack/test/observability_functional/apps/observability/alerts/rule_stats.ts new file mode 100644 index 0000000000000..41ff88be079d4 --- /dev/null +++ b/x-pack/test/observability_functional/apps/observability/alerts/rule_stats.ts @@ -0,0 +1,107 @@ +/* + * Copyright 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 expect from '@kbn/expect'; +import { FtrProviderContext } from '../../../ftr_provider_context'; +import { ObjectRemover } from '../../../../functional_with_es_ssl/lib/object_remover'; +import { + createAlert as createRule, + disableAlert as disableRule, + muteAlert as muteRule, +} from '../../../../functional_with_es_ssl/lib/alert_api_actions'; +import { generateUniqueKey } from '../../../../functional_with_es_ssl/lib/get_test_data'; +import { asyncForEach } from '../helpers'; + +export default ({ getService }: FtrProviderContext) => { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertest'); + const objectRemover = new ObjectRemover(supertest); + + describe('Observability rules', function () { + this.tags('includeFirefox'); + + const observability = getService('observability'); + + before(async () => { + await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts'); + const setup = async () => { + await observability.alerts.common.setKibanaTimeZoneToUTC(); + await observability.alerts.common.navigateToTimeWithData(); + }; + await setup(); + }); + + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts'); + }); + + describe('With no data', () => { + it('Shows the no data screen', async () => { + await observability.alerts.common.getNoDataPageOrFail(); + }); + }); + + describe('Stat counters', () => { + beforeEach(async () => { + const uniqueKey = generateUniqueKey(); + + const ruleToDisable = await createRule({ + supertest, + objectRemover, + overwrites: { name: 'b', tags: [uniqueKey] }, + }); + await createRule({ + supertest, + objectRemover, + overwrites: { name: 'c', tags: [uniqueKey] }, + }); + await createRule({ + supertest, + objectRemover, + overwrites: { name: 'a', tags: [uniqueKey] }, + }); + await createRule({ + supertest, + objectRemover, + overwrites: { name: 'd', tags: [uniqueKey] }, + }); + await createRule({ + supertest, + objectRemover, + overwrites: { name: 'e', tags: [uniqueKey] }, + }); + const ruleToMute = await createRule({ + supertest, + objectRemover, + overwrites: { name: 'f', tags: [uniqueKey] }, + }); + + await disableRule({ supertest, alertId: ruleToDisable.id }); + await muteRule({ supertest, alertId: ruleToMute.id }); + + await observability.alerts.common.navigateToTimeWithData(); + }); + + afterEach(async () => { + await objectRemover.removeAll(); + }); + + it('Exist and display expected values', async () => { + const subjToValueMap: { [key: string]: number } = { + statRuleCount: 6, + statDisabled: 1, + statMuted: 1, + statErrors: 0, + }; + await asyncForEach(Object.keys(subjToValueMap), async (subject: string) => { + const value = await observability.alerts.common.getRuleStatValue(subject); + expect(value).to.be(subjToValueMap[subject]); + }); + }); + }); + }); +}; diff --git a/x-pack/test/observability_functional/apps/observability/helpers.ts b/x-pack/test/observability_functional/apps/observability/helpers.ts new file mode 100644 index 0000000000000..72a91881ab97a --- /dev/null +++ b/x-pack/test/observability_functional/apps/observability/helpers.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 async function asyncForEach(array: T[], callback: (item: T, index: number) => void) { + for (let index = 0; index < array.length; index++) { + await callback(array[index], index); + } +} diff --git a/x-pack/test/observability_functional/apps/observability/index.ts b/x-pack/test/observability_functional/apps/observability/index.ts index bc78fa138c39b..de681d5c17f2c 100644 --- a/x-pack/test/observability_functional/apps/observability/index.ts +++ b/x-pack/test/observability_functional/apps/observability/index.ts @@ -10,15 +10,18 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('ObservabilityApp', function () { this.tags('ciGroup6'); - loadTestFile(require.resolve('./feature_controls')); - loadTestFile(require.resolve('./exploratory_view')); + loadTestFile(require.resolve('./alerts')); + loadTestFile(require.resolve('./alerts/add_to_case')); loadTestFile(require.resolve('./alerts/alert_disclaimer')); - loadTestFile(require.resolve('./alerts/workflow_status')); + loadTestFile(require.resolve('./alerts/bulk_actions')); loadTestFile(require.resolve('./alerts/pagination')); - loadTestFile(require.resolve('./alerts/add_to_case')); + loadTestFile(require.resolve('./alerts/rule_stats')); loadTestFile(require.resolve('./alerts/state_synchronization')); - loadTestFile(require.resolve('./alerts/bulk_actions')); loadTestFile(require.resolve('./alerts/table_storage')); + loadTestFile(require.resolve('./alerts/workflow_status')); + + loadTestFile(require.resolve('./exploratory_view')); + loadTestFile(require.resolve('./feature_controls')); }); } From 4436b267b74193e397bc7d3907638248af03b6b4 Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Fri, 3 Dec 2021 14:31:43 +0100 Subject: [PATCH 16/62] Fix globalsearchg functional tests (#120333) --- .../integration_tests/get_searchable_types.test.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/global_search/server/routes/integration_tests/get_searchable_types.test.ts b/x-pack/plugins/global_search/server/routes/integration_tests/get_searchable_types.test.ts index b8224d9a30d08..e3b237bffaf95 100644 --- a/x-pack/plugins/global_search/server/routes/integration_tests/get_searchable_types.test.ts +++ b/x-pack/plugins/global_search/server/routes/integration_tests/get_searchable_types.test.ts @@ -14,8 +14,7 @@ import { registerInternalSearchableTypesRoute } from '../get_searchable_types'; type SetupServerReturn = UnwrapPromise>; const pluginId = Symbol('globalSearch'); -// FAILING: https://github.com/elastic/kibana/issues/120268 -describe.skip('GET /internal/global_search/searchable_types', () => { +describe('GET /internal/global_search/searchable_types', () => { let server: SetupServerReturn['server']; let httpSetup: SetupServerReturn['httpSetup']; let globalSearchHandlerContext: ReturnType< @@ -47,7 +46,7 @@ describe.skip('GET /internal/global_search/searchable_types', () => { it('calls the handler context with correct parameters', async () => { await supertest(httpSetup.server.listener) - .post('/internal/global_search/searchable_types') + .get('/internal/global_search/searchable_types') .expect(200); expect(globalSearchHandlerContext.getSearchableTypes).toHaveBeenCalledTimes(1); @@ -57,7 +56,7 @@ describe.skip('GET /internal/global_search/searchable_types', () => { globalSearchHandlerContext.getSearchableTypes.mockResolvedValue(['type-a', 'type-b']); const response = await supertest(httpSetup.server.listener) - .post('/internal/global_search/searchable_types') + .get('/internal/global_search/searchable_types') .expect(200); expect(response.body).toEqual({ @@ -69,8 +68,8 @@ describe.skip('GET /internal/global_search/searchable_types', () => { globalSearchHandlerContext.getSearchableTypes.mockRejectedValue(new Error()); const response = await supertest(httpSetup.server.listener) - .post('/internal/global_search/searchable_types') - .expect(200); + .get('/internal/global_search/searchable_types') + .expect(500); expect(response.body).toEqual( expect.objectContaining({ From 265c8dcd434369dbc47fe844a29855ce79e2e398 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Fri, 3 Dec 2021 08:33:09 -0500 Subject: [PATCH 17/62] [Fleet] Configure fleet default output on prem with ES host and CA fingerprint (#120276) --- .../server/kibana_config_writer.test.ts | 27 ++++++++++ .../server/kibana_config_writer.ts | 52 ++++++++++++++++++- 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/src/plugins/interactive_setup/server/kibana_config_writer.test.ts b/src/plugins/interactive_setup/server/kibana_config_writer.test.ts index 005e280fcc744..82d02882698d4 100644 --- a/src/plugins/interactive_setup/server/kibana_config_writer.test.ts +++ b/src/plugins/interactive_setup/server/kibana_config_writer.test.ts @@ -7,6 +7,7 @@ */ jest.mock('fs/promises'); +jest.mock('crypto'); import { constants } from 'fs'; import { loggingSystemMock } from 'src/core/server/mocks'; @@ -28,6 +29,16 @@ describe('KibanaConfigWriter', () => { mockReadFile.mockResolvedValue(''); + const mockCrypto = jest.requireMock('crypto'); + mockCrypto.X509Certificate = function (cert: string) { + if (cert === 'invalid-cert') { + throw new Error('Invalid certificate'); + } + return { + fingerprint256: 'fingerprint256', + }; + }; + kibanaConfigWriter = new KibanaConfigWriter( '/some/path/kibana.yml', '/data', @@ -120,6 +131,7 @@ describe('KibanaConfigWriter', () => { elasticsearch.hosts: [some-host] elasticsearch.serviceAccountToken: some-value elasticsearch.ssl.certificateAuthorities: [/data/ca_1234.crt] + xpack.fleet.outputs: [{id: fleet-default-output, name: default, is_default: true, is_default_monitoring: true, type: elasticsearch, hosts: [some-host], ca_sha256: fingerprint256}] ", ], @@ -186,6 +198,7 @@ describe('KibanaConfigWriter', () => { elasticsearch.username: username elasticsearch.password: password elasticsearch.ssl.certificateAuthorities: [/data/ca_1234.crt] + xpack.fleet.outputs: [{id: fleet-default-output, name: default, is_default: true, is_default_monitoring: true, type: elasticsearch, hosts: [some-host], ca_sha256: fingerprint256}] ", ], @@ -193,6 +206,18 @@ describe('KibanaConfigWriter', () => { `); }); + it('throws if it cannot parse CA certificate', async () => { + await expect( + kibanaConfigWriter.writeConfig({ + caCert: 'invalid-cert', + host: 'some-host', + serviceAccountToken: { name: 'some-token', value: 'some-value' }, + }) + ).rejects.toMatchInlineSnapshot(`[Error: Invalid certificate]`); + + expect(mockWriteFile).not.toHaveBeenCalled(); + }); + it('can successfully write elasticsearch config without CA certificate', async () => { await expect( kibanaConfigWriter.writeConfig({ @@ -250,6 +275,7 @@ describe('KibanaConfigWriter', () => { elasticsearch.hosts: [some-host] elasticsearch.serviceAccountToken: some-value elasticsearch.ssl.certificateAuthorities: [/data/ca_1234.crt] + xpack.fleet.outputs: [{id: fleet-default-output, name: default, is_default: true, is_default_monitoring: true, type: elasticsearch, hosts: [some-host], ca_sha256: fingerprint256}] ", ], @@ -303,6 +329,7 @@ describe('KibanaConfigWriter', () => { monitoring.ui.container.elasticsearch.enabled: true elasticsearch.serviceAccountToken: some-value elasticsearch.ssl.certificateAuthorities: [/data/ca_1234.crt] + xpack.fleet.outputs: [{id: fleet-default-output, name: default, is_default: true, is_default_monitoring: true, type: elasticsearch, hosts: [some-host], ca_sha256: fingerprint256}] ", ], diff --git a/src/plugins/interactive_setup/server/kibana_config_writer.ts b/src/plugins/interactive_setup/server/kibana_config_writer.ts index 949bc25ddd253..af177fee33bce 100644 --- a/src/plugins/interactive_setup/server/kibana_config_writer.ts +++ b/src/plugins/interactive_setup/server/kibana_config_writer.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { X509Certificate } from 'crypto'; import { constants } from 'fs'; import fs from 'fs/promises'; import yaml from 'js-yaml'; @@ -30,6 +31,16 @@ export type WriteConfigParameters = { | {} ); +interface FleetOutputConfig { + id: string; + name: string; + is_default: boolean; + is_default_monitoring: boolean; + type: 'elasticsearch'; + hosts: string[]; + ca_sha256: string; +} + export class KibanaConfigWriter { constructor( private readonly configPath: string, @@ -61,7 +72,9 @@ export class KibanaConfigWriter { */ public async writeConfig(params: WriteConfigParameters) { const caPath = path.join(this.dataDirectoryPath, `ca_${Date.now()}.crt`); - const config: Record = { 'elasticsearch.hosts': [params.host] }; + const config: Record = { + 'elasticsearch.hosts': [params.host], + }; if ('serviceAccountToken' in params && params.serviceAccountToken) { config['elasticsearch.serviceAccountToken'] = params.serviceAccountToken.value; } else if ('username' in params && params.username) { @@ -72,6 +85,21 @@ export class KibanaConfigWriter { config['elasticsearch.ssl.certificateAuthorities'] = [caPath]; } + // If a certificate is passed configure Fleet default output + if (params.caCert) { + try { + config['xpack.fleet.outputs'] = KibanaConfigWriter.getFleetDefaultOutputConfig( + params.caCert, + params.host + ); + } catch (err) { + this.logger.error( + `Failed to generate Fleet default output: ${getDetailedErrorMessage(err)}.` + ); + throw err; + } + } + // Load and parse existing configuration file to check if it already has values for the config // entries we want to write. const existingConfig = await this.loadAndParseKibanaConfig(); @@ -152,6 +180,28 @@ export class KibanaConfigWriter { return { raw: rawConfig, parsed: parsedConfig }; } + /** + * Build config for Fleet outputs + * @param caCert + * @param host + */ + private static getFleetDefaultOutputConfig(caCert: string, host: string): FleetOutputConfig[] { + const cert = new X509Certificate(caCert); + const certFingerprint = cert.fingerprint256; + + return [ + { + id: 'fleet-default-output', + name: 'default', + is_default: true, + is_default_monitoring: true, + type: 'elasticsearch', + hosts: [host], + ca_sha256: certFingerprint, + }, + ]; + } + /** * Comments out all non-commented entries in the Kibana configuration file. * @param rawConfig Content of the Kibana configuration file. From 89b1f9056c29ac9c35e29fde14d5a7e27b7d731f Mon Sep 17 00:00:00 2001 From: Joe Portner <5295965+jportner@users.noreply.github.com> Date: Fri, 3 Dec 2021 08:42:54 -0500 Subject: [PATCH 18/62] Prevent endless loop for saved object migrations (#120146) --- dev_docs/tutorials/saved_objects.mdx | 2 + .../core/saved-objects-service.asciidoc | 3 ++ .../migrations/core/document_migrator.test.ts | 45 +++---------------- .../migrations/core/document_migrator.ts | 16 +------ .../service/lib/repository.test.ts | 23 ++++++++-- .../saved_objects/service/lib/repository.ts | 3 ++ 6 files changed, 35 insertions(+), 57 deletions(-) diff --git a/dev_docs/tutorials/saved_objects.mdx b/dev_docs/tutorials/saved_objects.mdx index 9583e195d1c82..a9d8cd7c6ec1c 100644 --- a/dev_docs/tutorials/saved_objects.mdx +++ b/dev_docs/tutorials/saved_objects.mdx @@ -252,6 +252,8 @@ Having said that, if a document is encountered that is not in the expected shape fail an upgrade than to silently ignore a corrupt document which can cause unexpected behaviour at some future point in time. When such a scenario is encountered, the error should be verbose and informative so that the corrupt document can be corrected, if possible. +**WARNING:** Do not attempt to change the `migrationVersion`, `id`, or `type` fields within a migration function, this is not supported. + ### Testing Migrations Bugs in a migration function cause downtime for our users and therefore have a very high impact. Follow the . diff --git a/docs/developer/architecture/core/saved-objects-service.asciidoc b/docs/developer/architecture/core/saved-objects-service.asciidoc index a7ce86ea46359..54a5c319c6222 100644 --- a/docs/developer/architecture/core/saved-objects-service.asciidoc +++ b/docs/developer/architecture/core/saved-objects-service.asciidoc @@ -259,6 +259,9 @@ upgrade. In most scenarios, it is better to fail an upgrade than to silently ignore a corrupt document which can cause unexpected behaviour at some future point in time. +WARNING: Do not attempt to change the `migrationVersion`, `id`, or `type` fields +within a migration function, this is not supported. + It is critical that you have extensive tests to ensure that migrations behave as expected with all possible input documents. Given how simple it is to test all the branch conditions in a migration function and the high impact of a bug diff --git a/src/core/server/saved_objects/migrations/core/document_migrator.test.ts b/src/core/server/saved_objects/migrations/core/document_migrator.test.ts index 64c1c4ce2fa9f..f92d505c058ed 100644 --- a/src/core/server/saved_objects/migrations/core/document_migrator.test.ts +++ b/src/core/server/saved_objects/migrations/core/document_migrator.test.ts @@ -664,39 +664,6 @@ describe('DocumentMigrator', () => { ); }); - it('allows updating a migrationVersion prop to a later version', () => { - const migrator = new DocumentMigrator({ - ...testOpts(), - typeRegistry: createRegistry({ - name: 'cat', - migrations: { - '1.0.0': setAttr('migrationVersion.cat', '2.9.1'), - '2.0.0': () => { - throw new Error('POW!'); - }, - '2.9.1': () => { - throw new Error('BANG!'); - }, - '3.0.0': setAttr('attributes.name', 'Shiny'), - }, - }), - }); - migrator.prepareMigrations(); - const actual = migrator.migrate({ - id: 'smelly', - type: 'cat', - attributes: { name: 'Boo' }, - migrationVersion: { cat: '0.5.6' }, - }); - expect(actual).toEqual({ - id: 'smelly', - type: 'cat', - attributes: { name: 'Shiny' }, - migrationVersion: { cat: '3.0.0' }, - coreMigrationVersion: kibanaVersion, - }); - }); - it('allows adding props to migrationVersion', () => { const migrator = new DocumentMigrator({ ...testOpts(), @@ -1072,7 +1039,8 @@ describe('DocumentMigrator', () => { name: 'dog', namespaceType: 'single', migrations: { - '1.0.0': setAttr('migrationVersion.dog', '2.0.0'), + '1.1.0': setAttr('attributes.age', '12'), + '1.5.0': setAttr('attributes.color', 'tri-color'), '2.0.0': (doc) => doc, // noop }, }, @@ -1083,9 +1051,10 @@ describe('DocumentMigrator', () => { const obj = { id: 'sleepy', type: 'dog', - attributes: { name: 'Patches' }, - migrationVersion: {}, + attributes: { name: 'Patches', age: '11' }, + migrationVersion: { dog: '1.1.0' }, // skip the first migration transform, only apply the second and third references: [{ id: 'favorite', type: 'toy', name: 'BALL!' }], + coreMigrationVersion: undefined, // this is intentional }; it('in the default space', () => { @@ -1095,7 +1064,7 @@ describe('DocumentMigrator', () => { { id: 'sleepy', type: 'dog', - attributes: { name: 'Patches' }, + attributes: { name: 'Patches', age: '11', color: 'tri-color' }, migrationVersion: { dog: '2.0.0' }, references: [{ id: 'favorite', type: 'toy', name: 'BALL!' }], // no change coreMigrationVersion: kibanaVersion, @@ -1111,7 +1080,7 @@ describe('DocumentMigrator', () => { { id: 'sleepy', type: 'dog', - attributes: { name: 'Patches' }, + attributes: { name: 'Patches', age: '11', color: 'tri-color' }, migrationVersion: { dog: '2.0.0' }, references: [{ id: 'uuidv5', type: 'toy', name: 'BALL!' }], // changed coreMigrationVersion: kibanaVersion, diff --git a/src/core/server/saved_objects/migrations/core/document_migrator.ts b/src/core/server/saved_objects/migrations/core/document_migrator.ts index da16dbc5e69e8..5f2870fb6e244 100644 --- a/src/core/server/saved_objects/migrations/core/document_migrator.ts +++ b/src/core/server/saved_objects/migrations/core/document_migrator.ts @@ -27,15 +27,7 @@ * handle property addition / deletion / renaming. * * A caveat is that this means we must restrict what a migration can do to the doc's - * migrationVersion itself. We allow only these kinds of changes: - * - * - Add a new property to migrationVersion - * - Move a migrationVersion property forward to a later version - * - * Migrations *cannot* move a migrationVersion property backwards (e.g. from 2.0.0 to 1.0.0), and they - * cannot clear a migrationVersion property, as allowing either of these could produce infinite loops. - * However, we do wish to allow migrations to modify migrationVersion if they wish, so that - * they could transform a type from "foo 1.0.0" to "bar 3.0.0". + * migrationVersion itself. Migrations should *not* make any changes to the migrationVersion property. * * One last gotcha is that any docs which have no migrationVersion are assumed to be up-to-date. * This is because Kibana UI and other clients really can't be expected build the migrationVersion @@ -753,12 +745,6 @@ function migrateProp( let additionalDocs: SavedObjectUnsanitizedDoc[] = []; for (const { version, transform, transformType } of applicableTransforms(migrations, doc, prop)) { - const currentVersion = propVersion(doc, prop); - if (currentVersion && Semver.gt(currentVersion, version)) { - // the previous transform function increased the object's migrationVersion; break out of the loop - break; - } - if (convertNamespaceTypes || (transformType !== 'convert' && transformType !== 'reference')) { // migrate transforms are always applied, but conversion transforms and reference transforms are only applied during index migrations const result = transform(doc); diff --git a/src/core/server/saved_objects/service/lib/repository.test.ts b/src/core/server/saved_objects/service/lib/repository.test.ts index 46a532cdefef4..ab692b146e7f6 100644 --- a/src/core/server/saved_objects/service/lib/repository.test.ts +++ b/src/core/server/saved_objects/service/lib/repository.test.ts @@ -976,8 +976,9 @@ describe('SavedObjectsRepository', () => { describe('migration', () => { it(`migrates the docs and serializes the migrated docs`, async () => { migrator.migrateDocument.mockImplementation(mockMigrateDocument); - await bulkCreateSuccess([obj1, obj2]); - const docs = [obj1, obj2].map((x) => ({ ...x, ...mockTimestampFields })); + const modifiedObj1 = { ...obj1, coreMigrationVersion: '8.0.0' }; + await bulkCreateSuccess([modifiedObj1, obj2]); + const docs = [modifiedObj1, obj2].map((x) => ({ ...x, ...mockTimestampFields })); expectMigrationArgs(docs[0], true, 1); expectMigrationArgs(docs[1], true, 2); @@ -2556,8 +2557,22 @@ describe('SavedObjectsRepository', () => { it(`migrates a document and serializes the migrated doc`, async () => { const migrationVersion = mockMigrationVersion; - await createSuccess(type, attributes, { id, references, migrationVersion }); - const doc = { type, id, attributes, references, migrationVersion, ...mockTimestampFields }; + const coreMigrationVersion = '8.0.0'; + await createSuccess(type, attributes, { + id, + references, + migrationVersion, + coreMigrationVersion, + }); + const doc = { + type, + id, + attributes, + references, + migrationVersion, + coreMigrationVersion, + ...mockTimestampFields, + }; expectMigrationArgs(doc); const migratedDoc = migrator.migrateDocument(doc); diff --git a/src/core/server/saved_objects/service/lib/repository.ts b/src/core/server/saved_objects/service/lib/repository.ts index 9be58f1b71861..0d17525016043 100644 --- a/src/core/server/saved_objects/service/lib/repository.ts +++ b/src/core/server/saved_objects/service/lib/repository.ts @@ -305,6 +305,7 @@ export class SavedObjectsRepository { const { id = SavedObjectsUtils.generateId(), migrationVersion, + coreMigrationVersion, overwrite = false, references = [], refresh = DEFAULT_REFRESH_SETTING, @@ -359,6 +360,7 @@ export class SavedObjectsRepository { originId, attributes, migrationVersion, + coreMigrationVersion, updated_at: time, ...(Array.isArray(references) && { references }), }); @@ -523,6 +525,7 @@ export class SavedObjectsRepository { type: object.type, attributes: object.attributes, migrationVersion: object.migrationVersion, + coreMigrationVersion: object.coreMigrationVersion, ...(savedObjectNamespace && { namespace: savedObjectNamespace }), ...(savedObjectNamespaces && { namespaces: savedObjectNamespaces }), updated_at: time, From 6640357eb6e2a4b5db39e468dc315bce74109259 Mon Sep 17 00:00:00 2001 From: Khristinin Nikita Date: Fri, 3 Dec 2021 14:54:44 +0100 Subject: [PATCH 19/62] [CTI] Threat Intel Card on Overview page needs to accommodate Fleet TI integrations (#115940) * Add support integrations * Fix types * fix unit tests * Fix tests and types * fix eslint * fix file case * add cy tests * Revert test * Add tests * Add support of installed integrations * Fix types * Add isntalled ingtegration case for cypress tests * Fix cypress tests * Fix comments * Fix capital naming * Fix again capital naming * Add dynamic dashboard for a new integrations packages * intermidiate changes, to keep it remote * Big refactoring * Tests and refactoring * Remove unused constanrs * Fix e2e tests * PR comments fix * fix ts * Fix translations * Remove stubs * Rename isSomeIntegrationsDisabled -> allIntegrationsInstalled * Add buildQuery tests * Fix type * Add tests for Enable Source button * Remove copied file * Move api call to api.ts * Rename fetchFleetIntegrations * Remove __mocks__ Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../security_solution/common/cti/constants.ts | 13 +- .../security_solution/cti/index.ts | 37 +++- .../security_solution/index.ts | 7 + .../overview/cti_link_panel.spec.ts | 13 +- .../cypress/screens/overview.ts | 4 +- .../overview/components/link_panel/helpers.ts | 7 - .../overview/components/link_panel/index.ts | 1 - .../components/link_panel/link_panel.tsx | 20 +- .../overview/components/link_panel/types.ts | 1 + .../cti_disabled_module.tsx | 11 +- .../cti_enabled_module.test.tsx | 49 +---- .../overview_cti_links/cti_enabled_module.tsx | 49 ++--- .../overview_cti_links/cti_no_events.test.tsx | 70 ------- .../overview_cti_links/cti_no_events.tsx | 42 ----- .../cti_with_events.test.tsx | 57 ------ .../overview_cti_links/cti_with_events.tsx | 49 ----- .../overview_cti_links/index.test.tsx | 38 ++-- .../components/overview_cti_links/index.tsx | 36 ++-- .../components/overview_cti_links/mock.ts | 13 +- .../threat_intel_panel_view.tsx | 62 +++---- .../overview_cti_links/translations.ts | 21 ++- .../use_integrations_page_link.tsx | 11 ++ .../containers/overview_cti_links/api.ts | 28 +++ .../containers/overview_cti_links/helpers.ts | 60 ------ .../containers/overview_cti_links/index.tsx | 116 +++++------- .../use_all_ti_data_sources.ts | 22 +++ .../use_cti_event_counts.ts | 64 ------- .../use_is_threat_intel_module_enabled.ts | 32 ---- .../use_request_event_counts.ts | 54 ------ .../overview_cti_links/use_ti_data_sources.ts | 174 ++++++++++++++++++ .../overview_cti_links/use_ti_integrations.ts | 55 ++++++ .../public/overview/pages/overview.test.tsx | 28 ++- .../public/overview/pages/overview.tsx | 25 ++- .../security_solution/factory/cti/index.ts | 2 + .../factory/cti/threat_intel_source/index.ts | 33 ++++ .../query.threat_intel_source.dsl.test.ts | 71 +++++++ .../query.threat_intel_source.dsl.ts | 59 ++++++ .../translations/translations/ja-JP.json | 2 - .../translations/translations/zh-CN.json | 2 - .../es_archives/threat_indicator/data.json | 5 +- .../threat_indicator/mappings.json | 8 + 41 files changed, 731 insertions(+), 720 deletions(-) delete mode 100644 x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.test.tsx delete mode 100644 x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.tsx delete mode 100644 x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.test.tsx delete mode 100644 x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.tsx create mode 100644 x-pack/plugins/security_solution/public/overview/components/overview_cti_links/use_integrations_page_link.tsx create mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/api.ts delete mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/helpers.ts create mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_all_ti_data_sources.ts delete mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_cti_event_counts.ts delete mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_is_threat_intel_module_enabled.ts delete mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_request_event_counts.ts create mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_data_sources.ts create mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_integrations.ts create mode 100644 x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/index.ts create mode 100644 x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.test.ts create mode 100644 x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.ts diff --git a/x-pack/plugins/security_solution/common/cti/constants.ts b/x-pack/plugins/security_solution/common/cti/constants.ts index b33541c5057d8..7a88b065d8701 100644 --- a/x-pack/plugins/security_solution/common/cti/constants.ts +++ b/x-pack/plugins/security_solution/common/cti/constants.ts @@ -58,14 +58,5 @@ export const EVENT_ENRICHMENT_INDICATOR_FIELD_MAP = { export const DEFAULT_EVENT_ENRICHMENT_FROM = 'now-30d'; export const DEFAULT_EVENT_ENRICHMENT_TO = 'now'; -export const CTI_DATASET_KEY_MAP: { [key: string]: string } = { - 'AbuseCH URL': 'ti_abusech.url', - 'AbuseCH Malware': 'ti_abusech.malware', - 'AbuseCH MalwareBazaar': 'ti_abusech.malwarebazaar', - 'AlienVault OTX': 'ti_otx.threat', - 'Anomali Limo': 'ti_anomali.limo', - 'Anomali Threatstream': 'ti_anomali.threatstream', - MISP: 'ti_misp.threat', - ThreatQuotient: 'ti_threatq.threat', - Cybersixgill: 'ti_cybersixgill.threat', -}; +export const TI_INTEGRATION_PREFIX = 'ti'; +export const OTHER_TI_DATASET_KEY = '_others_ti_'; diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/cti/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/cti/index.ts index 26bf4ce6740a9..a6e7eef88724b 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/cti/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/cti/index.ts @@ -5,13 +5,16 @@ * 2.0. */ -import type { IEsSearchResponse } from 'src/plugins/data/public'; +import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { IEsSearchResponse, IEsSearchRequest } from 'src/plugins/data/public'; +import { FactoryQueryTypes } from '../..'; import { EVENT_ENRICHMENT_INDICATOR_FIELD_MAP } from '../../../cti/constants'; -import { Inspect } from '../../common'; +import { Inspect, Maybe, TimerangeInput } from '../../common'; import { RequestBasicOptions } from '..'; export enum CtiQueries { eventEnrichment = 'eventEnrichment', + dataSource = 'dataSource', } export interface CtiEventEnrichmentRequestOptions extends RequestBasicOptions { @@ -40,3 +43,33 @@ export const validEventFields = Object.keys(EVENT_ENRICHMENT_INDICATOR_FIELD_MAP export const isValidEventField = (field: string): field is EventField => validEventFields.includes(field as EventField); + +export interface CtiDataSourceRequestOptions extends IEsSearchRequest { + defaultIndex: string[]; + factoryQueryType?: FactoryQueryTypes; + timerange?: TimerangeInput; +} + +export interface BucketItem { + key: string; + doc_count: number; +} +export interface Bucket { + buckets: Array; +} + +export type DatasetBucket = { + name?: Bucket; + dashboard?: Bucket; +} & BucketItem; + +export interface CtiDataSourceStrategyResponse extends Omit { + inspect?: Maybe; + rawResponse: { + aggregations?: Record & { + dataset?: { + buckets: DatasetBucket[]; + }; + }; + }; +} diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts index 00cbdb941c11b..340093995b297 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts @@ -72,6 +72,8 @@ import { CtiEventEnrichmentRequestOptions, CtiEventEnrichmentStrategyResponse, CtiQueries, + CtiDataSourceRequestOptions, + CtiDataSourceStrategyResponse, } from './cti'; import { HostRulesRequestOptions, @@ -85,6 +87,7 @@ import { UserRulesStrategyResponse, } from './ueba'; +export * from './cti'; export * from './hosts'; export * from './matrix_histogram'; export * from './network'; @@ -178,6 +181,8 @@ export type StrategyResponseType = T extends HostsQ ? MatrixHistogramStrategyResponse : T extends CtiQueries.eventEnrichment ? CtiEventEnrichmentStrategyResponse + : T extends CtiQueries.dataSource + ? CtiDataSourceStrategyResponse : never; export type StrategyRequestType = T extends HostsQueries.hosts @@ -238,6 +243,8 @@ export type StrategyRequestType = T extends HostsQu ? MatrixHistogramRequestOptions : T extends CtiQueries.eventEnrichment ? CtiEventEnrichmentRequestOptions + : T extends CtiQueries.dataSource + ? CtiDataSourceRequestOptions : never; export interface DocValueFieldsInput { diff --git a/x-pack/plugins/security_solution/cypress/integration/overview/cti_link_panel.spec.ts b/x-pack/plugins/security_solution/cypress/integration/overview/cti_link_panel.spec.ts index 095401ff31422..75ff13b66b29c 100644 --- a/x-pack/plugins/security_solution/cypress/integration/overview/cti_link_panel.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/overview/cti_link_panel.spec.ts @@ -10,9 +10,8 @@ import { OVERVIEW_CTI_LINKS, OVERVIEW_CTI_LINKS_ERROR_INNER_PANEL, OVERVIEW_CTI_LINKS_INFO_INNER_PANEL, - OVERVIEW_CTI_LINKS_WARNING_INNER_PANEL, OVERVIEW_CTI_TOTAL_EVENT_COUNT, - OVERVIEW_CTI_VIEW_DASHBOARD_BUTTON, + OVERVIEW_CTI_ENABLE_INTEGRATIONS_BUTTON, } from '../../screens/overview'; import { loginAndWaitForPage } from '../../tasks/login'; @@ -28,12 +27,11 @@ describe('CTI Link Panel', () => { it('renders disabled threat intel module as expected', () => { loginAndWaitForPage(OVERVIEW_URL); cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_LINKS_ERROR_INNER_PANEL}`).should('exist'); - cy.get(`${OVERVIEW_CTI_VIEW_DASHBOARD_BUTTON}`).should('be.disabled'); cy.get(`${OVERVIEW_CTI_TOTAL_EVENT_COUNT}`).should('have.text', 'Showing: 0 indicators'); cy.get(`${OVERVIEW_CTI_ENABLE_MODULE_BUTTON}`).should('exist'); cy.get(`${OVERVIEW_CTI_ENABLE_MODULE_BUTTON}`) .should('have.attr', 'href') - .and('match', /filebeat-module-threatintel.html/); + .and('match', /app\/integrations\/browse\?q=threat%20intelligence/); }); describe('enabled threat intel module', () => { @@ -49,17 +47,16 @@ describe('CTI Link Panel', () => { loginAndWaitForPage( `${OVERVIEW_URL}?sourcerer=(timerange:(from:%272021-07-08T04:00:00.000Z%27,kind:absolute,to:%272021-07-09T03:59:59.999Z%27))` ); - cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_LINKS_WARNING_INNER_PANEL}`).should('exist'); cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_LINKS_INFO_INNER_PANEL}`).should('exist'); - cy.get(`${OVERVIEW_CTI_VIEW_DASHBOARD_BUTTON}`).should('be.disabled'); cy.get(`${OVERVIEW_CTI_TOTAL_EVENT_COUNT}`).should('have.text', 'Showing: 0 indicators'); }); it('renders dashboard module as expected when there are events in the selected time period', () => { loginAndWaitForPage(OVERVIEW_URL); - cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_LINKS_WARNING_INNER_PANEL}`).should('not.exist'); cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_LINKS_INFO_INNER_PANEL}`).should('exist'); - cy.get(`${OVERVIEW_CTI_VIEW_DASHBOARD_BUTTON}`).should('be.disabled'); + cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_ENABLE_INTEGRATIONS_BUTTON}`).should('exist'); + cy.get(OVERVIEW_CTI_LINKS).should('not.contain.text', 'Anomali'); + cy.get(OVERVIEW_CTI_LINKS).should('contain.text', 'AbuseCH malware'); cy.get(`${OVERVIEW_CTI_TOTAL_EVENT_COUNT}`).should('have.text', 'Showing: 1 indicator'); }); }); diff --git a/x-pack/plugins/security_solution/cypress/screens/overview.ts b/x-pack/plugins/security_solution/cypress/screens/overview.ts index 1945b7e3ce3e7..bc335ff6680ee 100644 --- a/x-pack/plugins/security_solution/cypress/screens/overview.ts +++ b/x-pack/plugins/security_solution/cypress/screens/overview.ts @@ -150,9 +150,9 @@ export const OVERVIEW_REVENT_TIMELINES = '[data-test-subj="overview-recent-timel export const OVERVIEW_CTI_LINKS = '[data-test-subj="cti-dashboard-links"]'; export const OVERVIEW_CTI_LINKS_ERROR_INNER_PANEL = '[data-test-subj="cti-inner-panel-danger"]'; -export const OVERVIEW_CTI_LINKS_WARNING_INNER_PANEL = '[data-test-subj="cti-inner-panel-warning"]'; export const OVERVIEW_CTI_LINKS_INFO_INNER_PANEL = '[data-test-subj="cti-inner-panel-info"]'; -export const OVERVIEW_CTI_VIEW_DASHBOARD_BUTTON = '[data-test-subj="cti-view-dashboard-button"]'; +export const OVERVIEW_CTI_ENABLE_INTEGRATIONS_BUTTON = + '[data-test-subj="cti-enable-integrations-button"]'; export const OVERVIEW_CTI_TOTAL_EVENT_COUNT = `${OVERVIEW_CTI_LINKS} [data-test-subj="header-panel-subtitle"]`; export const OVERVIEW_CTI_ENABLE_MODULE_BUTTON = '[data-test-subj="cti-enable-module-button"]'; diff --git a/x-pack/plugins/security_solution/public/overview/components/link_panel/helpers.ts b/x-pack/plugins/security_solution/public/overview/components/link_panel/helpers.ts index 45d26d9269f6e..e2adaaae35547 100644 --- a/x-pack/plugins/security_solution/public/overview/components/link_panel/helpers.ts +++ b/x-pack/plugins/security_solution/public/overview/components/link_panel/helpers.ts @@ -5,13 +5,6 @@ * 2.0. */ -import { LinkPanelListItem } from '.'; - -export const isLinkPanelListItem = ( - item: LinkPanelListItem | Partial -): item is LinkPanelListItem => - typeof item.title === 'string' && typeof item.path === 'string' && typeof item.count === 'number'; - export interface EventCounts { [key: string]: number; } 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 9d404abcf2223..9a827b137ae78 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 @@ -6,6 +6,5 @@ */ export { InnerLinkPanel } from './inner_link_panel'; -export { isLinkPanelListItem } from './helpers'; export { LinkPanel } from './link_panel'; export type { LinkPanelListItem } from './types'; diff --git a/x-pack/plugins/security_solution/public/overview/components/link_panel/link_panel.tsx b/x-pack/plugins/security_solution/public/overview/components/link_panel/link_panel.tsx index ed67fdb1c96f6..00a225635fb8b 100644 --- a/x-pack/plugins/security_solution/public/overview/components/link_panel/link_panel.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/link_panel/link_panel.tsx @@ -71,7 +71,7 @@ const LinkPanelComponent = ({ splitPanel, subtitle, }: { - button: React.ReactNode; + button?: React.ReactNode; columns: Array>; dataTestSubj: string; defaultSortField?: string; @@ -134,14 +134,16 @@ const LinkPanelComponent = ({ {splitPanel} {infoPanel} - + {chunkedItems.length > 0 && ( + + )} diff --git a/x-pack/plugins/security_solution/public/overview/components/link_panel/types.ts b/x-pack/plugins/security_solution/public/overview/components/link_panel/types.ts index f6c0fb6f3837f..1b8836fc2438d 100644 --- a/x-pack/plugins/security_solution/public/overview/components/link_panel/types.ts +++ b/x-pack/plugins/security_solution/public/overview/components/link_panel/types.ts @@ -21,4 +21,5 @@ export interface LinkPanelViewProps { listItems: LinkPanelListItem[]; splitPanel?: JSX.Element; totalCount?: number; + allIntegrationsInstalled?: boolean; } diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_disabled_module.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_disabled_module.tsx index 2697e4a571ad8..36f386e49c5c7 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_disabled_module.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_disabled_module.tsx @@ -6,24 +6,21 @@ */ import React from 'react'; -import { EMPTY_LIST_ITEMS } from '../../containers/overview_cti_links/helpers'; -import { useKibana } from '../../../common/lib/kibana'; import * as i18n from './translations'; import { DisabledLinkPanel } from '../link_panel/disabled_link_panel'; import { ThreatIntelPanelView } from './threat_intel_panel_view'; +import { useIntegrationsPageLink } from './use_integrations_page_link'; export const CtiDisabledModuleComponent = () => { - const threatIntelDocLink = `${ - useKibana().services.docLinks.links.filebeat.base - }/filebeat-module-threatintel.html`; + const integrationsLink = useIntegrationsPageLink(); return ( diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.test.tsx index db83d9e1bcfe5..fc36a0c4337cf 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.test.tsx @@ -19,20 +19,15 @@ import { mockGlobalState, SUB_PLUGINS_REDUCER, } from '../../../common/mock'; -import { mockTheme, mockProps, mockCtiEventCountsResponse, mockCtiLinksResponse } from './mock'; -import { useCtiEventCounts } from '../../containers/overview_cti_links/use_cti_event_counts'; +import { mockTheme, mockProps, mockTiDataSources, mockCtiLinksResponse } from './mock'; import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; -import { useRequestEventCounts } from '../../containers/overview_cti_links/use_request_event_counts'; +import { useTiDataSources } from '../../containers/overview_cti_links/use_ti_data_sources'; jest.mock('../../../common/lib/kibana'); -jest.mock('../../containers/overview_cti_links/use_cti_event_counts'); -const useCTIEventCountsMock = useCtiEventCounts as jest.Mock; -useCTIEventCountsMock.mockReturnValue(mockCtiEventCountsResponse); - -jest.mock('../../containers/overview_cti_links/use_request_event_counts'); -const useRequestEventCountsMock = useRequestEventCounts as jest.Mock; -useRequestEventCountsMock.mockReturnValue([true, {}]); +jest.mock('../../containers/overview_cti_links/use_ti_data_sources'); +const useTiDataSourcesMock = useTiDataSources as jest.Mock; +useTiDataSourcesMock.mockReturnValue(mockTiDataSources); jest.mock('../../containers/overview_cti_links'); const useCtiDashboardLinksMock = useCtiDashboardLinks as jest.Mock; @@ -54,42 +49,12 @@ describe('CtiEnabledModule', () => { - - - - - ); - - expect(screen.getByTestId('cti-with-events')).toBeInTheDocument(); - }); - - it('renders CtiWithNoEvents when there are no events', () => { - useCTIEventCountsMock.mockReturnValueOnce({ totalCount: 0 }); - render( - - - - - - - - ); - - expect(screen.getByTestId('cti-with-no-events')).toBeInTheDocument(); - }); - - it('renders null while event counts are loading', () => { - useCTIEventCountsMock.mockReturnValueOnce({ totalCount: -1 }); - const { container } = render( - - - - + ); - expect(container.firstChild).toBeNull(); + expect(screen.getByText('Showing: 5 indicators')).toBeInTheDocument(); }); }); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.tsx index 5a40c79d6e5ec..a339676ac361f 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.tsx @@ -7,37 +7,28 @@ import React from 'react'; import { ThreatIntelLinkPanelProps } from '.'; -import { useCtiEventCounts } from '../../containers/overview_cti_links/use_cti_event_counts'; -import { CtiNoEvents } from './cti_no_events'; -import { CtiWithEvents } from './cti_with_events'; +import { useTiDataSources } from '../../containers/overview_cti_links/use_ti_data_sources'; +import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; +import { ThreatIntelPanelView } from './threat_intel_panel_view'; -export type CtiEnabledModuleProps = Omit; +export const CtiEnabledModuleComponent: React.FC = (props) => { + const { to, from, allIntegrationsInstalled, allTiDataSources, setQuery, deleteQuery } = props; + const { tiDataSources, totalCount } = useTiDataSources({ + to, + from, + allTiDataSources, + setQuery, + deleteQuery, + }); + const { listItems } = useCtiDashboardLinks({ to, from, tiDataSources }); -export const CtiEnabledModuleComponent: React.FC = (props) => { - const { eventCountsByDataset, totalCount } = useCtiEventCounts(props); - const { to, from } = props; - - switch (totalCount) { - case -1: - return null; - case 0: - return ( -
    - -
    - ); - default: - return ( -
    - -
    - ); - } + return ( + + ); }; export const CtiEnabledModule = React.memo(CtiEnabledModuleComponent); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.test.tsx deleted file mode 100644 index 8f624dabd64d1..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.test.tsx +++ /dev/null @@ -1,70 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { Provider } from 'react-redux'; -import { cloneDeep } from 'lodash/fp'; -import { render, screen } from '@testing-library/react'; -import { I18nProvider } from '@kbn/i18n-react'; -import { CtiNoEvents } from './cti_no_events'; -import { ThemeProvider } from 'styled-components'; -import { createStore, State } from '../../../common/store'; -import { - createSecuritySolutionStorageMock, - kibanaObservable, - mockGlobalState, - SUB_PLUGINS_REDUCER, -} from '../../../common/mock'; -import { mockEmptyCtiLinksResponse, mockTheme, mockProps } from './mock'; -import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; - -jest.mock('../../../common/lib/kibana'); - -jest.mock('../../containers/overview_cti_links'); -const useCtiDashboardLinksMock = useCtiDashboardLinks as jest.Mock; -useCtiDashboardLinksMock.mockReturnValue(mockEmptyCtiLinksResponse); - -describe('CtiNoEvents', () => { - const state: State = mockGlobalState; - - const { storage } = createSecuritySolutionStorageMock(); - let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); - - beforeEach(() => { - const myState = cloneDeep(state); - store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); - }); - - it('renders warning inner panel', () => { - render( - - - - - - - - ); - - expect(screen.getByTestId('cti-dashboard-links')).toBeInTheDocument(); - expect(screen.getByTestId('cti-inner-panel-warning')).toBeInTheDocument(); - }); - - it('renders event counts as 0', () => { - render( - - - - - - - - ); - - expect(screen.getByText('Showing: 0 indicators')).toBeInTheDocument(); - }); -}); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.tsx deleted file mode 100644 index fa7ac50c08765..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; -import { ThreatIntelPanelView } from './threat_intel_panel_view'; -import { InnerLinkPanel } from '../link_panel'; -import * as i18n from './translations'; -import { emptyEventCountsByDataset } from '../../containers/overview_cti_links/helpers'; - -const warning = ( - -); - -export const CtiNoEventsComponent = ({ to, from }: { to: string; from: string }) => { - const { buttonHref, listItems, isPluginDisabled } = useCtiDashboardLinks( - emptyEventCountsByDataset, - to, - from - ); - - return ( - - ); -}; - -export const CtiNoEvents = React.memo(CtiNoEventsComponent); -CtiNoEvents.displayName = 'CtiNoEvents'; diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.test.tsx deleted file mode 100644 index a50e3e91ab9e5..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.test.tsx +++ /dev/null @@ -1,57 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { Provider } from 'react-redux'; -import { cloneDeep } from 'lodash/fp'; -import { mount } from 'enzyme'; -import { I18nProvider } from '@kbn/i18n-react'; -import { CtiWithEvents } from './cti_with_events'; -import { ThemeProvider } from 'styled-components'; -import { createStore, State } from '../../../common/store'; -import { - createSecuritySolutionStorageMock, - kibanaObservable, - mockGlobalState, - SUB_PLUGINS_REDUCER, -} from '../../../common/mock'; -import { mockCtiLinksResponse, mockTheme, mockCtiWithEventsProps } from './mock'; -import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; - -jest.mock('../../../common/lib/kibana'); - -jest.mock('../../containers/overview_cti_links'); -const useCtiDashboardLinksMock = useCtiDashboardLinks as jest.Mock; -useCtiDashboardLinksMock.mockReturnValue(mockCtiLinksResponse); - -describe('CtiWithEvents', () => { - const state: State = mockGlobalState; - - const { storage } = createSecuritySolutionStorageMock(); - let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); - - beforeEach(() => { - const myState = cloneDeep(state); - store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); - }); - - it('renders total event count as expected', () => { - const wrapper = mount( - - - - - - - - ); - - expect(wrapper.find('[data-test-subj="cti-total-event-count"]').text()).toEqual( - `Showing: ${mockCtiWithEventsProps.totalCount} indicators` - ); - }); -}); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.tsx deleted file mode 100644 index f78451e205b1e..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.tsx +++ /dev/null @@ -1,49 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { isEqual } from 'lodash'; -import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; -import { ThreatIntelPanelView } from './threat_intel_panel_view'; - -export const CtiWithEventsComponent = ({ - eventCountsByDataset, - from, - to, - totalCount, -}: { - eventCountsByDataset: { [key: string]: number }; - from: string; - to: string; - totalCount: number; -}) => { - const { buttonHref, isPluginDisabled, listItems } = useCtiDashboardLinks( - eventCountsByDataset, - to, - from - ); - - return ( - - ); -}; - -CtiWithEventsComponent.displayName = 'CtiWithEvents'; - -export const CtiWithEvents = React.memo( - CtiWithEventsComponent, - (prevProps, nextProps) => - prevProps.to === nextProps.to && - prevProps.from === nextProps.from && - prevProps.totalCount === nextProps.totalCount && - isEqual(prevProps.eventCountsByDataset, nextProps.eventCountsByDataset) -); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx index dfd9c6c9a7fcd..71d6d5eb0c583 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx @@ -19,19 +19,19 @@ import { mockGlobalState, SUB_PLUGINS_REDUCER, } from '../../../common/mock'; -import { mockTheme, mockProps, mockCtiEventCountsResponse } from './mock'; -import { useRequestEventCounts } from '../../containers/overview_cti_links/use_request_event_counts'; -import { useCtiEventCounts } from '../../containers/overview_cti_links/use_cti_event_counts'; +import { mockTheme, mockProps, mockTiDataSources, mockCtiLinksResponse } from './mock'; +import { useTiDataSources } from '../../containers/overview_cti_links/use_ti_data_sources'; +import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; jest.mock('../../../common/lib/kibana'); -jest.mock('../../containers/overview_cti_links/use_request_event_counts'); -const useRequestEventCountsMock = useRequestEventCounts as jest.Mock; -useRequestEventCountsMock.mockReturnValue([true, {}]); +jest.mock('../../containers/overview_cti_links/use_ti_data_sources'); +const useTiDataSourcesMock = useTiDataSources as jest.Mock; +useTiDataSourcesMock.mockReturnValue(mockTiDataSources); -jest.mock('../../containers/overview_cti_links/use_cti_event_counts'); -const useCTIEventCountsMock = useCtiEventCounts as jest.Mock; -useCTIEventCountsMock.mockReturnValue(mockCtiEventCountsResponse); +jest.mock('../../containers/overview_cti_links'); +const useCtiDashboardLinksMock = useCtiDashboardLinks as jest.Mock; +useCtiDashboardLinksMock.mockReturnValue(mockCtiLinksResponse); describe('ThreatIntelLinkPanel', () => { const state: State = mockGlobalState; @@ -49,40 +49,44 @@ describe('ThreatIntelLinkPanel', () => { - + ); expect(wrapper.find('[data-test-subj="cti-enabled-module"]').length).toEqual(1); + expect(wrapper.find('[data-test-subj="cti-enable-integrations-button"]').length).toEqual(0); }); - it('renders CtiDisabledModule when Threat Intel module is disabled', () => { + it('renders Enable source buttons when not all integrations installed', () => { const wrapper = mount( - + ); - - expect(wrapper.find('[data-test-subj="cti-disabled-module"]').length).toEqual(1); + expect(wrapper.find('[data-test-subj="cti-enable-integrations-button"]').length).not.toBe(0); }); - it('renders null while Threat Intel module state is loading', () => { + it('renders CtiDisabledModule when Threat Intel module is disabled', () => { const wrapper = mount( - + ); - expect(wrapper.html()).toEqual(''); + expect(wrapper.find('[data-test-subj="cti-disabled-module"]').length).toEqual(1); }); }); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx index 5348c12fb6c8e..c89199c2cb0c5 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { GlobalTimeArgs } from '../../../common/containers/use_global_time'; +import { TiDataSources } from '../../containers/overview_cti_links/use_ti_data_sources'; import { CtiEnabledModule } from './cti_enabled_module'; import { CtiDisabledModule } from './cti_disabled_module'; @@ -15,27 +16,26 @@ export type ThreatIntelLinkPanelProps = Pick< GlobalTimeArgs, 'from' | 'to' | 'deleteQuery' | 'setQuery' > & { - isThreatIntelModuleEnabled: boolean | undefined; + allIntegrationsInstalled: boolean | undefined; + allTiDataSources: TiDataSources[]; }; const ThreatIntelLinkPanelComponent: React.FC = (props) => { - switch (props.isThreatIntelModuleEnabled) { - case true: - return ( -
    - -
    - ); - case false: - return ( -
    - -
    - ); - case undefined: - default: - return null; - } + const { allIntegrationsInstalled, allTiDataSources } = props; + const isThreatIntelModuleEnabled = allTiDataSources.length > 0; + return isThreatIntelModuleEnabled ? ( +
    + +
    + ) : ( +
    + +
    + ); }; export const ThreatIntelLinkPanel = React.memo(ThreatIntelLinkPanelComponent); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/mock.ts b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/mock.ts index 1d02acaf65f48..c4cf876cbdc7d 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/mock.ts +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/mock.ts @@ -15,6 +15,13 @@ export const mockTheme = getMockTheme({ }, }); +export const mockTiDataSources = { + totalCount: 5, + tiDataSources: [ + { dataset: 'ti_abusech', name: 'AbuseCH', count: 5, path: '/dashboard_path_abuseurl' }, + ], +}; + export const mockEventCountsByDataset = { abuseurl: 1, abusemalware: 1, @@ -31,8 +38,6 @@ export const mockCtiEventCountsResponse = { }; export const mockCtiLinksResponse = { - isPluginDisabled: false, - buttonHref: '/button', listItems: [ { title: 'abuseurl', count: 1, path: '/dashboard_path_abuseurl' }, { title: 'abusemalware', count: 2, path: '/dashboard_path_abusemalware' }, @@ -63,6 +68,10 @@ export const mockProps = { from: '2020-01-21T20:49:57.080Z', setQuery: jest.fn(), deleteQuery: jest.fn(), + allIntegrationsInstalled: true, + allTiDataSources: [ + { dataset: 'ti_abusech', name: 'AbuseCH', count: 5, path: '/dashboard_path_abuseurl' }, + ], }; export const mockCtiWithEventsProps = { diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/threat_intel_panel_view.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/threat_intel_panel_view.tsx index 189f230c02c8d..3697d27015fdc 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/threat_intel_panel_view.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/threat_intel_panel_view.tsx @@ -9,14 +9,14 @@ import React, { useMemo } from 'react'; import { EuiButton, EuiTableFieldDataColumnType } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { useKibana } from '../../../common/lib/kibana'; import * as i18n from './translations'; import { LinkPanel, InnerLinkPanel, LinkPanelListItem } from '../link_panel'; import { LinkPanelViewProps } from '../link_panel/types'; import { shortenCountIntoString } from '../../../common/utils/shorten_count_into_string'; import { Link } from '../link_panel/link'; -import { ID as CTIEventCountQueryId } from '../../containers/overview_cti_links/use_cti_event_counts'; +import { ID as CTIEventCountQueryId } from '../../containers/overview_cti_links/use_ti_data_sources'; import { LINK_COPY } from '../overview_risky_host_links/translations'; +import { useIntegrationsPageLink } from './use_integrations_page_link'; const columns: Array> = [ { name: 'Name', field: 'title', sortable: true, truncateText: true, width: '100%' }, @@ -39,51 +39,43 @@ const columns: Array> = [ ]; export const ThreatIntelPanelView: React.FC = ({ - buttonHref = '', - isPluginDisabled, isInspectEnabled = true, listItems, splitPanel, totalCount = 0, + allIntegrationsInstalled, }) => { - const threatIntelDashboardDocLink = `${ - useKibana().services.docLinks.links.filebeat.base - }/load-kibana-dashboards.html`; + const integrationsLink = useIntegrationsPageLink(); return ( ( - - {i18n.VIEW_DASHBOARD} - - ), - [buttonHref] - ), columns, dataTestSubj: 'cti-dashboard-links', infoPanel: useMemo( - () => - isPluginDisabled ? ( - - {i18n.INFO_BUTTON} - - } - /> - ) : null, - [isPluginDisabled, threatIntelDashboardDocLink] + () => ( + <> + {allIntegrationsInstalled === false ? ( + + {i18n.DANGER_BUTTON} + + } + /> + ) : null} + + ), + [allIntegrationsInstalled, integrationsLink] ), inspectQueryId: isInspectEnabled ? CTIEventCountQueryId : undefined, listItems, diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/translations.ts b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/translations.ts index 4a64462b27ad5..e112942b09749 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/translations.ts +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/translations.ts @@ -53,15 +53,14 @@ export const DANGER_TITLE = i18n.translate( export const DANGER_BODY = i18n.translate( 'xpack.securitySolution.overview.ctiDashboardEnableThreatIntel', { - defaultMessage: - 'You need to enable the filebeat threatintel module in order to view data from different sources.', + defaultMessage: 'You need to enable threat intel sources in order to view data.', } ); export const DANGER_BUTTON = i18n.translate( - 'xpack.securitySolution.overview.ctiDashboardDangerPanelButton', + 'xpack.securitySolution.overview.ctiDashboardDangerButton', { - defaultMessage: 'Enable Module', + defaultMessage: 'Enable sources', } ); @@ -72,3 +71,17 @@ export const PANEL_TITLE = i18n.translate('xpack.securitySolution.overview.ctiDa export const VIEW_DASHBOARD = i18n.translate('xpack.securitySolution.overview.ctiViewDasboard', { defaultMessage: 'View dashboard', }); + +export const SOME_MODULES_DISABLE_TITLE = i18n.translate( + 'xpack.securitySolution.overview.ctiDashboardSomeModulesDisabledTItle', + { + defaultMessage: 'Some threat intel sources are disabled', + } +); + +export const OTHER_DATA_SOURCE_TITLE = i18n.translate( + 'xpack.securitySolution.overview.ctiDashboardOtherDatasourceTitle', + { + defaultMessage: 'Others', + } +); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/use_integrations_page_link.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/use_integrations_page_link.tsx new file mode 100644 index 0000000000000..de710c2f1b17c --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/use_integrations_page_link.tsx @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useBasePath } from '../../../common/lib/kibana'; + +export const useIntegrationsPageLink = () => + `${useBasePath()}/app/integrations/browse?q=threat%20intelligence`; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/api.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/api.ts new file mode 100644 index 0000000000000..ad737ac410e3b --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/api.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 { KibanaServices } from '../../../common/lib/kibana'; +import { EPM_API_ROUTES } from '../../../../../fleet/common'; + +export interface IntegrationResponse { + id: string; + status: string; + savedObject?: { + attributes?: { + installed_kibana: Array<{ + type: string; + id: string; + }>; + }; + }; +} + +export const fetchFleetIntegrations = () => + KibanaServices.get().http.fetch<{ + response: IntegrationResponse[]; + }>(EPM_API_ROUTES.LIST_PATTERN, { + method: 'GET', + }); diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/helpers.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/helpers.ts deleted file mode 100644 index 9ac61cc9487ee..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/helpers.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { SavedObjectAttributes } from '@kbn/securitysolution-io-ts-alerting-types'; -import { CTI_DATASET_KEY_MAP } from '../../../../common/cti/constants'; -import { LinkPanelListItem } from '../../components/link_panel'; -import { EventCounts } from '../../components/link_panel/helpers'; - -export const ctiTitles = Object.keys(CTI_DATASET_KEY_MAP) as string[]; - -export const EMPTY_LIST_ITEMS: LinkPanelListItem[] = ctiTitles.map((title) => ({ - title, - count: 0, - path: '', -})); - -const TAG_REQUEST_BODY_SEARCH = 'threat intel'; -export const TAG_REQUEST_BODY = { - type: 'tag', - search: TAG_REQUEST_BODY_SEARCH, - searchFields: ['name'], -}; - -export const DASHBOARD_SO_TITLE_PREFIX = '[Filebeat Threat Intel] '; -export const OVERVIEW_DASHBOARD_LINK_TITLE = 'Overview'; - -export const getCtiListItemsWithoutLinks = (eventCounts: EventCounts): LinkPanelListItem[] => { - return EMPTY_LIST_ITEMS.map((item) => ({ - ...item, - count: eventCounts[CTI_DATASET_KEY_MAP[item.title]] ?? 0, - })); -}; - -export const isOverviewItem = (item: { path?: string; title?: string }) => - item.title === OVERVIEW_DASHBOARD_LINK_TITLE; - -export const createLinkFromDashboardSO = ( - dashboardSO: { attributes?: SavedObjectAttributes }, - eventCountsByDataset: EventCounts, - path: string -) => { - const title = - typeof dashboardSO.attributes?.title === 'string' - ? dashboardSO.attributes.title.replace(DASHBOARD_SO_TITLE_PREFIX, '') - : undefined; - return { - title, - count: typeof title === 'string' ? eventCountsByDataset[CTI_DATASET_KEY_MAP[title]] : undefined, - path, - }; -}; - -export const emptyEventCountsByDataset = Object.values(CTI_DATASET_KEY_MAP).reduce((acc, id) => { - acc[id] = 0; - return acc; -}, {} as { [key: string]: number }); diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/index.tsx b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/index.tsx index a546d20e49583..b1310e363eef0 100644 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/index.tsx @@ -6,34 +6,29 @@ */ import { useState, useEffect, useCallback } from 'react'; import { SavedObjectAttributes } from '@kbn/securitysolution-io-ts-alerting-types'; +import { TiDataSources } from '../../containers/overview_cti_links/use_ti_data_sources'; +import { LinkPanelListItem } from '../../components/link_panel'; import { useKibana } from '../../../common/lib/kibana'; -import { - TAG_REQUEST_BODY, - createLinkFromDashboardSO, - getCtiListItemsWithoutLinks, - isOverviewItem, - EMPTY_LIST_ITEMS, -} from './helpers'; -import { LinkPanelListItem, isLinkPanelListItem } from '../../components/link_panel'; -export const useCtiDashboardLinks = ( - eventCountsByDataset: { [key: string]: number }, - to: string, - from: string -) => { - const createDashboardUrl = useKibana().services.dashboard?.dashboardUrlGenerator?.createUrl; - const savedObjectsClient = useKibana().services.savedObjects.client; - - const [buttonHref, setButtonHref] = useState(); - const [listItems, setListItems] = useState(EMPTY_LIST_ITEMS); +const TAG_REQUEST_BODY_SEARCH = 'threat intel'; +export const TAG_REQUEST_BODY = { + type: 'tag', + search: TAG_REQUEST_BODY_SEARCH, + searchFields: ['name'], +}; - const [isPluginDisabled, setIsDashboardPluginDisabled] = useState(false); - const handleDisabledPlugin = useCallback(() => { - if (!isPluginDisabled) { - setIsDashboardPluginDisabled(true); - } - setListItems(getCtiListItemsWithoutLinks(eventCountsByDataset)); - }, [setIsDashboardPluginDisabled, setListItems, eventCountsByDataset, isPluginDisabled]); +export const useCtiDashboardLinks = ({ + to, + from, + tiDataSources = [], +}: { + to: string; + from: string; + tiDataSources?: TiDataSources[]; +}) => { + const [installedDashboardIds, setInstalledDashboardIds] = useState([]); + const dashboardLocator = useKibana().services.dashboard?.locator; + const savedObjectsClient = useKibana().services.savedObjects.client; const handleTagsReceived = useCallback( (TagsSO?) => { @@ -49,9 +44,7 @@ export const useCtiDashboardLinks = ( ); useEffect(() => { - if (!createDashboardUrl || !savedObjectsClient) { - handleDisabledPlugin(); - } else { + if (savedObjectsClient) { savedObjectsClient .find(TAG_REQUEST_BODY) .then(handleTagsReceived) @@ -63,53 +56,40 @@ export const useCtiDashboardLinks = ( }>; }) => { if (DashboardsSO?.savedObjects?.length) { - const dashboardUrls = await Promise.all( - DashboardsSO.savedObjects.map((SO) => - createDashboardUrl({ - dashboardId: SO.id, - timeRange: { - to, - from, - }, - }) - ) + setInstalledDashboardIds( + DashboardsSO.savedObjects.map((SO) => SO.id ?? '').filter(Boolean) ); - const items = DashboardsSO.savedObjects - ?.reduce((acc: LinkPanelListItem[], dashboardSO, i) => { - const item = createLinkFromDashboardSO( - dashboardSO, - eventCountsByDataset, - dashboardUrls[i] - ); - if (isOverviewItem(item)) { - setButtonHref(item.path); - } else if (isLinkPanelListItem(item)) { - acc.push(item); - } - return acc; - }, []) - .sort((a, b) => (a.title > b.title ? 1 : -1)); - setListItems(items); - } else { - handleDisabledPlugin(); } } ); } - }, [ - createDashboardUrl, - eventCountsByDataset, - from, - handleDisabledPlugin, - handleTagsReceived, - isPluginDisabled, - savedObjectsClient, - to, - ]); + }, [handleTagsReceived, savedObjectsClient]); + + const listItems = tiDataSources.map((tiDataSource) => { + const listItem: LinkPanelListItem = { + title: tiDataSource.name, + count: tiDataSource.count, + path: '', + }; + + if ( + tiDataSource.dashboardId && + installedDashboardIds.includes(tiDataSource.dashboardId) && + dashboardLocator + ) { + listItem.path = dashboardLocator.getRedirectUrl({ + dashboardId: tiDataSource.dashboardId, + timeRange: { + to, + from, + }, + }); + } + + return listItem; + }); return { - buttonHref, - isPluginDisabled, listItems, }; }; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_all_ti_data_sources.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_all_ti_data_sources.ts new file mode 100644 index 0000000000000..5686be269121a --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_all_ti_data_sources.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { useMemo } from 'react'; +import { useTiDataSources } from './use_ti_data_sources'; + +export const useAllTiDataSources = () => { + const { to, from } = useMemo( + () => ({ + to: new Date().toISOString(), + from: new Date(0).toISOString(), + }), + [] + ); + + const { tiDataSources, isInitiallyLoaded } = useTiDataSources({ to, from }); + + return { tiDataSources, isInitiallyLoaded }; +}; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_cti_event_counts.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_cti_event_counts.ts deleted file mode 100644 index c8076ab6a4484..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_cti_event_counts.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { useEffect, useState, useMemo } from 'react'; -import { useRequestEventCounts } from './use_request_event_counts'; -import { emptyEventCountsByDataset } from './helpers'; -import { CtiEnabledModuleProps } from '../../components/overview_cti_links/cti_enabled_module'; - -export const ID = 'ctiEventCountQuery'; - -export const useCtiEventCounts = ({ deleteQuery, from, setQuery, to }: CtiEnabledModuleProps) => { - const [isInitialLoading, setIsInitialLoading] = useState(true); - - const [loading, { data, inspect, totalCount, refetch }] = useRequestEventCounts(to, from); - - const eventCountsByDataset = useMemo( - () => - data.reduce( - (acc, item) => { - if (item.y && item.g) { - const id = item.g; - acc[id] += item.y; - } - return acc; - }, - { ...emptyEventCountsByDataset } as { [key: string]: number } - ), - [data] - ); - - useEffect(() => { - if (isInitialLoading && data) { - setIsInitialLoading(false); - } - }, [isInitialLoading, data]); - - useEffect(() => { - if (!loading && !isInitialLoading) { - setQuery({ id: ID, inspect, loading, refetch }); - } - }, [setQuery, inspect, loading, refetch, isInitialLoading, setIsInitialLoading]); - - useEffect(() => { - return () => { - if (deleteQuery) { - deleteQuery({ id: ID }); - } - }; - }, [deleteQuery]); - - useEffect(() => { - refetch(); - }, [to, from, refetch]); - - return { - eventCountsByDataset, - loading, - totalCount, - }; -}; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_is_threat_intel_module_enabled.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_is_threat_intel_module_enabled.ts deleted file mode 100644 index 0dc0e8a3fe1f2..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_is_threat_intel_module_enabled.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { useState, useEffect, useMemo } from 'react'; -import { useRequestEventCounts } from './use_request_event_counts'; - -export const useIsThreatIntelModuleEnabled = () => { - const [isThreatIntelModuleEnabled, setIsThreatIntelModuleEnabled] = useState< - boolean | undefined - >(); - - const { to, from } = useMemo( - () => ({ - to: new Date().toISOString(), - from: new Date(0).toISOString(), - }), - [] - ); - - const [, { totalCount }] = useRequestEventCounts(to, from); - - useEffect(() => { - if (totalCount !== -1) { - setIsThreatIntelModuleEnabled(totalCount > 0); - } - }, [totalCount]); - - return isThreatIntelModuleEnabled; -}; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_request_event_counts.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_request_event_counts.ts deleted file mode 100644 index a1bf4d9d35f65..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_request_event_counts.ts +++ /dev/null @@ -1,54 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { useMemo } from 'react'; -import { i18n } from '@kbn/i18n'; -import { convertToBuildEsQuery } from '../../../common/lib/keury'; -import { getEsQueryConfig } from '../../../../../../../src/plugins/data/common'; -import { MatrixHistogramType } from '../../../../common/search_strategy'; -import { EVENT_DATASET } from '../../../../common/cti/constants'; -import { useMatrixHistogram } from '../../../common/containers/matrix_histogram'; -import { useKibana } from '../../../common/lib/kibana'; -import { DEFAULT_THREAT_INDEX_KEY } from '../../../../common/constants'; - -export const useRequestEventCounts = (to: string, from: string) => { - const { uiSettings } = useKibana().services; - const defaultThreatIndices = uiSettings.get(DEFAULT_THREAT_INDEX_KEY); - - const [filterQuery] = convertToBuildEsQuery({ - config: getEsQueryConfig(uiSettings), - indexPattern: { - fields: [ - { - name: 'event.kind', - type: 'string', - }, - ], - title: defaultThreatIndices.toString(), - }, - queries: [{ query: 'event.type:indicator', language: 'kuery' }], - filters: [], - }); - - const matrixHistogramRequest = useMemo(() => { - return { - endDate: to, - errorMessage: i18n.translate('xpack.securitySolution.overview.errorFetchingEvents', { - defaultMessage: 'Error fetching events', - }), - filterQuery, - histogramType: MatrixHistogramType.events, - indexNames: defaultThreatIndices, - stackByField: EVENT_DATASET, - startDate: from, - size: 0, - }; - }, [to, from, filterQuery, defaultThreatIndices]); - - const results = useMatrixHistogram(matrixHistogramRequest); - - return results; -}; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_data_sources.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_data_sources.ts new file mode 100644 index 0000000000000..865af2266f2e0 --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_data_sources.ts @@ -0,0 +1,174 @@ +/* + * Copyright 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 { Observable } from 'rxjs'; +import { filter } from 'rxjs/operators'; +import { useEffect, useState } from 'react'; +import { useObservable, withOptionalSignal } from '@kbn/securitysolution-hook-utils'; +import { useKibana } from '../../../common/lib/kibana'; +import { + DataPublicPluginStart, + isCompleteResponse, + isErrorResponse, +} from '../../../../../../../src/plugins/data/public'; +import { + Bucket, + CtiQueries, + CtiDataSourceStrategyResponse, + CtiDataSourceRequestOptions, +} from '../../../../common'; +import { DEFAULT_THREAT_INDEX_KEY } from '../../../../common/constants'; +import { GlobalTimeArgs } from '../../../common/containers/use_global_time'; +import { OTHER_DATA_SOURCE_TITLE } from '../../components/overview_cti_links/translations'; +import { OTHER_TI_DATASET_KEY } from '../../../../common/cti/constants'; + +type GetThreatIntelSourcProps = CtiDataSourceRequestOptions & { + data: DataPublicPluginStart; + signal: AbortSignal; +}; +export const ID = 'ctiEventCountQuery'; + +export const getTiDataSources = ({ + data, + defaultIndex, + timerange, + signal, +}: GetThreatIntelSourcProps): Observable => + data.search.search( + { + defaultIndex, + factoryQueryType: CtiQueries.dataSource, + timerange, + }, + { + strategy: 'securitySolutionSearchStrategy', + abortSignal: signal, + } + ); + +export const getTiDataSourcesComplete = ( + props: GetThreatIntelSourcProps +): Observable => { + return getTiDataSources(props).pipe( + filter((response) => { + return isErrorResponse(response) || isCompleteResponse(response); + }) + ); +}; + +const getTiDataSourcesWithOptionalSignal = withOptionalSignal(getTiDataSourcesComplete); + +export const useTiDataSourcesComplete = () => useObservable(getTiDataSourcesWithOptionalSignal); + +export interface TiDataSources { + dataset: string; + name: string; + count: number; + dashboardId?: string; +} +interface TiDataSourcesProps extends Partial { + allTiDataSources?: TiDataSources[]; +} + +export const useTiDataSources = ({ + to, + from, + allTiDataSources, + setQuery, + deleteQuery, +}: TiDataSourcesProps) => { + const [tiDataSources, setTiDataSources] = useState([]); + const [isInitiallyLoaded, setIsInitiallyLoaded] = useState(false); + const { data, uiSettings } = useKibana().services; + const defaultThreatIndices = uiSettings.get(DEFAULT_THREAT_INDEX_KEY); + const { result, start, loading } = useTiDataSourcesComplete(); + + useEffect(() => { + start({ + data, + timerange: to && from ? { to, from, interval: '' } : undefined, + defaultIndex: defaultThreatIndices, + }); + }, [to, from, start, data, defaultThreatIndices]); + + useEffect(() => { + if (!loading && result?.rawResponse && result?.inspect && setQuery) { + setQuery({ + id: ID, + inspect: { + dsl: result?.inspect?.dsl ?? [], + response: [JSON.stringify(result.rawResponse, null, 2)], + }, + loading, + refetch: () => {}, + }); + } + }, [setQuery, loading, result]); + + useEffect(() => { + return () => { + if (deleteQuery) { + deleteQuery({ id: ID }); + } + }; + }, [deleteQuery]); + + useEffect(() => { + if (result && !isInitiallyLoaded) { + setIsInitiallyLoaded(true); + } + }, [isInitiallyLoaded, result]); + + useEffect(() => { + if (!loading && result) { + const datasets = result?.rawResponse?.aggregations?.dataset?.buckets ?? []; + const getChildAggregationValue = (aggregation?: Bucket) => aggregation?.buckets?.[0]?.key; + + const integrationMap = datasets.reduce((acc: Record, dataset) => { + const datasetName = getChildAggregationValue(dataset?.name); + if (datasetName) { + return { + ...acc, + [dataset.key]: { + dataset: dataset?.key, + name: datasetName, + dashboardId: getChildAggregationValue(dataset?.dashboard), + count: dataset?.doc_count, + }, + }; + } else { + const otherTiDatasetKey = OTHER_TI_DATASET_KEY; + const otherDatasetCount = acc[otherTiDatasetKey]?.count ?? 0; + return { + ...acc, + [otherTiDatasetKey]: { + dataset: otherTiDatasetKey, + name: OTHER_DATA_SOURCE_TITLE, + count: otherDatasetCount + (dataset?.doc_count ?? 0), + }, + }; + } + }, {}); + + if (Array.isArray(allTiDataSources)) { + allTiDataSources.forEach((integration) => { + if (!integrationMap[integration.dataset]) { + integrationMap[integration.dataset] = { + ...integration, + count: 0, + }; + } + }); + } + + setTiDataSources(Object.values(integrationMap)); + } + }, [result, loading, allTiDataSources]); + + const totalCount = tiDataSources.reduce((acc, val) => acc + val.count, 0); + + return { tiDataSources, totalCount, isInitiallyLoaded }; +}; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_integrations.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_integrations.ts new file mode 100644 index 0000000000000..24bdc191b3d66 --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_integrations.ts @@ -0,0 +1,55 @@ +/* + * Copyright 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 { useEffect, useState } from 'react'; + +import { installationStatuses } from '../../../../../fleet/common'; +import { TI_INTEGRATION_PREFIX } from '../../../../common/cti/constants'; +import { fetchFleetIntegrations, IntegrationResponse } from './api'; + +export interface Integration { + id: string; + dashboardIds: string[]; +} + +interface TiIntegrationStatus { + allIntegrationsInstalled: boolean; +} + +export const useTiIntegrations = () => { + const [tiIntegrationsStatus, setTiIntegrationsStatus] = useState( + null + ); + + useEffect(() => { + const getPackages = async () => { + try { + const { response: integrations } = await fetchFleetIntegrations(); + const tiIntegrations = integrations.filter((integration: IntegrationResponse) => + integration.id.startsWith(TI_INTEGRATION_PREFIX) + ); + + const allIntegrationsInstalled = tiIntegrations.every( + (integration: IntegrationResponse) => + integration.status === installationStatuses.Installed + ); + + setTiIntegrationsStatus({ + allIntegrationsInstalled, + }); + } catch (e) { + setTiIntegrationsStatus({ + allIntegrationsInstalled: false, + }); + } + }; + + getPackages(); + }, []); + + return tiIntegrationsStatus; +}; diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx index 2539490be16fb..b38072464c653 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx @@ -23,12 +23,9 @@ import { } from '../../common/components/user_privileges'; import { useSourcererDataView } from '../../common/containers/sourcerer'; import { useFetchIndex } from '../../common/containers/source'; -import { useIsThreatIntelModuleEnabled } from '../containers/overview_cti_links/use_is_threat_intel_module_enabled'; -import { useCtiEventCounts } from '../containers/overview_cti_links/use_cti_event_counts'; -import { - mockCtiEventCountsResponse, - mockCtiLinksResponse, -} from '../components/overview_cti_links/mock'; +import { useAllTiDataSources } from '../containers/overview_cti_links/use_all_ti_data_sources'; +import { useTiIntegrations } from '../containers/overview_cti_links/use_ti_integrations'; +import { mockCtiLinksResponse, mockTiDataSources } from '../components/overview_cti_links/mock'; import { useCtiDashboardLinks } from '../containers/overview_cti_links'; import { EndpointPrivileges } from '../../common/components/user_privileges/endpoint/use_endpoint_privileges'; import { useIsExperimentalFeatureEnabled } from '../../common/hooks/use_experimental_features'; @@ -73,18 +70,17 @@ jest.mock('../../common/components/user_privileges', () => { jest.mock('../../common/containers/local_storage/use_messages_storage'); jest.mock('../containers/overview_cti_links'); -jest.mock('../containers/overview_cti_links/use_cti_event_counts'); const useCtiDashboardLinksMock = useCtiDashboardLinks as jest.Mock; useCtiDashboardLinksMock.mockReturnValue(mockCtiLinksResponse); -jest.mock('../containers/overview_cti_links/use_cti_event_counts'); -const useCTIEventCountsMock = useCtiEventCounts as jest.Mock; -useCTIEventCountsMock.mockReturnValue(mockCtiEventCountsResponse); +jest.mock('../containers/overview_cti_links/use_all_ti_data_sources'); +const useAllTiDataSourcesMock = useAllTiDataSources as jest.Mock; +useAllTiDataSourcesMock.mockReturnValue(mockTiDataSources); -jest.mock('../containers/overview_cti_links/use_is_threat_intel_module_enabled'); -const useIsThreatIntelModuleEnabledMock = useIsThreatIntelModuleEnabled as jest.Mock; -useIsThreatIntelModuleEnabledMock.mockReturnValue(true); +jest.mock('../containers/overview_cti_links/use_ti_integrations'); +const useTiIntegrationsMock = useTiIntegrations as jest.Mock; +useTiIntegrationsMock.mockReturnValue({}); jest.mock('../containers/overview_risky_host_links/use_hosts_risk_score'); const useHostsRiskScoreMock = useHostsRiskScore as jest.Mock; @@ -303,8 +299,8 @@ describe('Overview', () => { }); describe('Threat Intel Dashboard Links', () => { - it('invokes useIsThreatIntelModuleEnabled hook only once', () => { - useIsThreatIntelModuleEnabledMock.mockClear(); + it('invokes useAllTiDataSourcesMock hook only once', () => { + useAllTiDataSourcesMock.mockClear(); mount( @@ -312,7 +308,7 @@ describe('Overview', () => { ); - expect(useIsThreatIntelModuleEnabledMock).toHaveBeenCalledTimes(1); + expect(useAllTiDataSourcesMock).toHaveBeenCalledTimes(1); }); }); }); diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.tsx index 67ee6c55ac06f..1df49fed07358 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.tsx @@ -30,7 +30,8 @@ import { ENDPOINT_METADATA_INDEX } from '../../../common/constants'; import { useSourcererDataView } from '../../common/containers/sourcerer'; import { useDeepEqualSelector } from '../../common/hooks/use_selector'; import { ThreatIntelLinkPanel } from '../components/overview_cti_links'; -import { useIsThreatIntelModuleEnabled } from '../containers/overview_cti_links/use_is_threat_intel_module_enabled'; +import { useAllTiDataSources } from '../containers/overview_cti_links/use_all_ti_data_sources'; +import { useTiIntegrations } from '../containers/overview_cti_links/use_ti_integrations'; import { useUserPrivileges } from '../../common/components/user_privileges'; import { RiskyHostLinks } from '../components/overview_risky_host_links'; import { useAlertsPrivileges } from '../../detections/containers/detection_engine/alerts/use_alerts_privileges'; @@ -75,7 +76,10 @@ const OverviewComponent = () => { endpointPrivileges: { canAccessFleet }, } = useUserPrivileges(); const { hasIndexRead, hasKibanaREAD } = useAlertsPrivileges(); - const isThreatIntelModuleEnabled = useIsThreatIntelModuleEnabled(); + const { tiDataSources: allTiDataSources, isInitiallyLoaded: allTiDataSourcesLoaded } = + useAllTiDataSources(); + const tiIntegrationStatus = useTiIntegrations(); + const isTiLoaded = tiIntegrationStatus && allTiDataSourcesLoaded; const riskyHostsEnabled = useIsExperimentalFeatureEnabled('riskyHostsEnabled'); @@ -150,13 +154,16 @@ const OverviewComponent = () => { - + {isTiLoaded && ( + + )} {riskyHostsEnabled && ( diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/index.ts index 5857a0417239c..e43af97e84af0 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/index.ts @@ -9,7 +9,9 @@ import type { FactoryQueryTypes } from '../../../../../common/search_strategy/se import { CtiQueries } from '../../../../../common/search_strategy/security_solution/cti'; import type { SecuritySolutionFactory } from '../types'; import { eventEnrichment } from './event_enrichment'; +import { dataSource } from './threat_intel_source'; export const ctiFactoryTypes: Record> = { [CtiQueries.eventEnrichment]: eventEnrichment, + [CtiQueries.dataSource]: dataSource, }; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/index.ts new file mode 100644 index 0000000000000..0951503b04cd4 --- /dev/null +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/index.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 { SecuritySolutionFactory } from '../../types'; +import { + CtiDataSourceStrategyResponse, + CtiQueries, + CtiDataSourceRequestOptions, +} from '../../../../../../common'; +import { IEsSearchResponse } from '../../../../../../../../../src/plugins/data/common'; +import { inspectStringifyObject } from '../../../../../utils/build_query'; +import { buildTiDataSourceQuery } from './query.threat_intel_source.dsl'; + +export const dataSource: SecuritySolutionFactory = { + buildDsl: (options: CtiDataSourceRequestOptions) => buildTiDataSourceQuery(options), + parse: async ( + options: CtiDataSourceRequestOptions, + response: IEsSearchResponse + ): Promise => { + const inspect = { + dsl: [inspectStringifyObject(buildTiDataSourceQuery(options))], + }; + + return { + ...response, + inspect, + }; + }, +}; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.test.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.test.ts new file mode 100644 index 0000000000000..832006930a326 --- /dev/null +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.test.ts @@ -0,0 +1,71 @@ +/* + * Copyright 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 { buildTiDataSourceQuery } from './query.threat_intel_source.dsl'; +import { CtiQueries } from '../../../../../../common'; + +export const mockOptions = { + defaultIndex: ['logs-ti_*', 'filebeat-8*'], + docValueFields: [], + factoryQueryType: CtiQueries.dataSource, + filterQuery: '', + timerange: { + interval: '12h', + from: '2020-09-06T15:23:52.757Z', + to: '2020-09-07T15:23:52.757Z', + }, +}; + +export const expectedDsl = { + body: { + aggs: { + dataset: { + terms: { + field: 'event.dataset', + }, + aggs: { + name: { + terms: { + field: 'threat.feed.name', + }, + }, + dashboard: { + terms: { + field: 'threat.feed.dashboard_id', + }, + }, + }, + }, + }, + query: { + bool: { + filter: [ + { + range: { + '@timestamp': { + gte: '2020-09-06T15:23:52.757Z', + lte: '2020-09-07T15:23:52.757Z', + format: 'strict_date_optional_time', + }, + }, + }, + ], + }, + }, + }, + ignore_unavailable: true, + index: ['logs-ti_*', 'filebeat-8*'], + size: 0, + track_total_hits: true, + allow_no_indices: true, +}; + +describe('buildbuildTiDataSourceQueryQuery', () => { + test('build query from options correctly', () => { + expect(buildTiDataSourceQuery(mockOptions)).toEqual(expectedDsl); + }); +}); diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.ts new file mode 100644 index 0000000000000..08463146a683e --- /dev/null +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.ts @@ -0,0 +1,59 @@ +/* + * Copyright 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 { CtiDataSourceRequestOptions } from '../../../../../../common'; + +export const buildTiDataSourceQuery = ({ + timerange, + defaultIndex, +}: CtiDataSourceRequestOptions) => { + const filter = []; + + if (timerange) { + filter.push({ + range: { + '@timestamp': { + gte: timerange.from, + lte: timerange.to, + format: 'strict_date_optional_time', + }, + }, + }); + } + + const dslQuery = { + size: 0, + index: defaultIndex, + allow_no_indices: true, + ignore_unavailable: true, + track_total_hits: true, + body: { + aggs: { + dataset: { + terms: { field: 'event.dataset' }, + aggs: { + name: { + terms: { field: 'threat.feed.name' }, + }, + dashboard: { + terms: { + field: 'threat.feed.dashboard_id', + }, + }, + }, + }, + }, + query: { + bool: { + filter, + }, + }, + }, + }; + + return dslQuery; +}; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 76d3f07facf05..58d04788e98eb 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -23438,7 +23438,6 @@ "xpack.securitySolution.overview.auditBeatProcessTitle": "プロセス", "xpack.securitySolution.overview.auditBeatSocketTitle": "ソケット", "xpack.securitySolution.overview.auditBeatUserTitle": "ユーザー", - "xpack.securitySolution.overview.ctiDashboardDangerPanelButton": "モジュールを有効にする", "xpack.securitySolution.overview.ctiDashboardDangerPanelTitle": "表示する脅威インテリジェンスデータがありません", "xpack.securitySolution.overview.ctiDashboardEnableThreatIntel": "別のソースからデータを表示するには、filebeat脅威インテリジェンスモジュールを有効にする必要があります。", "xpack.securitySolution.overview.ctiDashboardInfoPanelBody": "このガイドに従い、ダッシュボードを有効にして、ビジュアライゼーションにソースを表示できるようにしてください。", @@ -23460,7 +23459,6 @@ "xpack.securitySolution.overview.endpointNotice.message": "脅威防御、検出、深いセキュリティデータの可視化を実現し、ホストを保護します。", "xpack.securitySolution.overview.endpointNotice.title": "Endpoint Security", "xpack.securitySolution.overview.endpointNotice.tryButton": "Endpoint Securityを試す", - "xpack.securitySolution.overview.errorFetchingEvents": "イベントの取得エラー", "xpack.securitySolution.overview.eventsTitle": "イベント数", "xpack.securitySolution.overview.filebeatCiscoTitle": "Cisco", "xpack.securitySolution.overview.filebeatNetflowTitle": "Netflow", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 01997e32f243e..da71c1796066f 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -23828,7 +23828,6 @@ "xpack.securitySolution.overview.auditBeatProcessTitle": "进程", "xpack.securitySolution.overview.auditBeatSocketTitle": "套接字", "xpack.securitySolution.overview.auditBeatUserTitle": "用户", - "xpack.securitySolution.overview.ctiDashboardDangerPanelButton": "启用模块", "xpack.securitySolution.overview.ctiDashboardDangerPanelTitle": "没有可显示的威胁情报数据", "xpack.securitySolution.overview.ctiDashboardEnableThreatIntel": "您需要启用 filebeat threatintel 模块,以便查看不同源的数据。", "xpack.securitySolution.overview.ctiDashboardInfoPanelBody": "按照此指南启用您的仪表板,以便可以在可视化中查看您的源。", @@ -23851,7 +23850,6 @@ "xpack.securitySolution.overview.endpointNotice.message": "使用威胁防御、检测和深度安全数据可见性功能保护您的主机。", "xpack.securitySolution.overview.endpointNotice.title": "Endpoint Security", "xpack.securitySolution.overview.endpointNotice.tryButton": "试用 Endpoint Security", - "xpack.securitySolution.overview.errorFetchingEvents": "提取事件时出错", "xpack.securitySolution.overview.eventsTitle": "事件计数", "xpack.securitySolution.overview.filebeatCiscoTitle": "Cisco", "xpack.securitySolution.overview.filebeatNetflowTitle": "NetFlow", diff --git a/x-pack/test/security_solution_cypress/es_archives/threat_indicator/data.json b/x-pack/test/security_solution_cypress/es_archives/threat_indicator/data.json index a2e0c2d2921dc..ec5e2aae6e2e2 100644 --- a/x-pack/test/security_solution_cypress/es_archives/threat_indicator/data.json +++ b/x-pack/test/security_solution_cypress/es_archives/threat_indicator/data.json @@ -31,6 +31,9 @@ } }, "type": "file" + }, + "feed": { + "name": "AbuseCH malware" } }, "abusemalware": { @@ -72,4 +75,4 @@ } } } -} +} \ No newline at end of file diff --git a/x-pack/test/security_solution_cypress/es_archives/threat_indicator/mappings.json b/x-pack/test/security_solution_cypress/es_archives/threat_indicator/mappings.json index 8840cd4bee0dd..bc5f6e3db9169 100644 --- a/x-pack/test/security_solution_cypress/es_archives/threat_indicator/mappings.json +++ b/x-pack/test/security_solution_cypress/es_archives/threat_indicator/mappings.json @@ -796,6 +796,14 @@ "type": "keyword" } } + }, + "feed":{ + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } } } } From 4ad3044daedb66319d2231d4b62b332880fb54d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20S=C3=A1nchez?= Date: Fri, 3 Dec 2021 15:35:36 +0100 Subject: [PATCH 20/62] [Security solution] [Endpoint] Adds missing parenthesis to fix trusted apps query (#120326) * Initial commit to add search bar for trusted apps in policy view page * Retrieve all assigned trusted apps to ensure if there are something assigned without the search filters or not. Also fixes unit tests * remove useless if condition * Adds more unit tests and fixes some pr suggestions * Fix weird bug when loading empty state * Fix ts errors due changes in api mocks * Fixes unit test * Remove grid loader to use paginated results one. Fix selectors and tests * Remove unused imports due ts errors * remove unused import * Adds parenthesis to fix a query error. Also fixes related unit test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../policy_details/middleware/policy_trusted_apps_middleware.ts | 2 +- .../trusted_apps/layout/policy_trusted_apps_layout.test.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/middleware/policy_trusted_apps_middleware.ts b/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/middleware/policy_trusted_apps_middleware.ts index e9cbda1f487cb..1630d63aee5c6 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/middleware/policy_trusted_apps_middleware.ts +++ b/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/middleware/policy_trusted_apps_middleware.ts @@ -157,7 +157,7 @@ const checkIfPolicyHasTrustedAppsAssigned = async ( } try { const policyId = policyIdFromParams(state); - const kuery = `exception-list-agnostic.attributes.tags:"policy:${policyId}" OR exception-list-agnostic.attributes.tags:"policy:all"`; + const kuery = `(exception-list-agnostic.attributes.tags:"policy:${policyId}" OR exception-list-agnostic.attributes.tags:"policy:all")`; const trustedApps = await trustedAppsService.getTrustedAppsList({ page: 1, per_page: 100, diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.test.tsx index 40997de054c7f..089bbd4bcb4e8 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.test.tsx @@ -136,7 +136,7 @@ describe('Policy trusted apps layout', () => { mockedApis.responseProvider.trustedAppsList.mockImplementation( (options: HttpFetchOptionsWithPath) => { const hasAnyQuery = - 'exception-list-agnostic.attributes.tags:"policy:1234" OR exception-list-agnostic.attributes.tags:"policy:all"'; + '(exception-list-agnostic.attributes.tags:"policy:1234" OR exception-list-agnostic.attributes.tags:"policy:all")'; if (options.query?.filter === hasAnyQuery) { const exceptionsGenerator = new ExceptionsListItemGenerator('seed'); return { From 3b516b6dd1e1fc38ca931f7c04b44e39fa679d24 Mon Sep 17 00:00:00 2001 From: Marco Liberati Date: Fri, 3 Dec 2021 15:39:48 +0100 Subject: [PATCH 21/62] :bug: Keep the behindText color flag for treemap (#120228) --- .../plugins/lens/public/pie_visualization/render_function.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/lens/public/pie_visualization/render_function.tsx b/x-pack/plugins/lens/public/pie_visualization/render_function.tsx index 539d69207f5f9..3b9fdaf094822 100644 --- a/x-pack/plugins/lens/public/pie_visualization/render_function.tsx +++ b/x-pack/plugins/lens/public/pie_visualization/render_function.tsx @@ -186,7 +186,7 @@ export function PieComponent( const outputColor = paletteService.get(palette.name).getCategoricalColor( seriesLayers, { - behindText: categoryDisplay !== 'hide', + behindText: categoryDisplay !== 'hide' || isTreemapOrMosaicShape(shape), maxDepth: bucketColumns.length, totalSeries: totalSeriesCount, syncColors, From a0db43e07bfe611bc7d89a234c8511a2a49769fd Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Fri, 3 Dec 2021 10:50:17 -0500 Subject: [PATCH 22/62] Revert " [CTI] Threat Intel Card on Overview page needs to accommodate Fleet TI integrations (#115940)" This reverts commit 6640357eb6e2a4b5db39e468dc315bce74109259. --- .../security_solution/common/cti/constants.ts | 13 +- .../security_solution/cti/index.ts | 37 +--- .../security_solution/index.ts | 7 - .../overview/cti_link_panel.spec.ts | 13 +- .../cypress/screens/overview.ts | 4 +- .../overview/components/link_panel/helpers.ts | 7 + .../overview/components/link_panel/index.ts | 1 + .../components/link_panel/link_panel.tsx | 20 +- .../overview/components/link_panel/types.ts | 1 - .../cti_disabled_module.tsx | 11 +- .../cti_enabled_module.test.tsx | 49 ++++- .../overview_cti_links/cti_enabled_module.tsx | 49 +++-- .../overview_cti_links/cti_no_events.test.tsx | 70 +++++++ .../overview_cti_links/cti_no_events.tsx | 42 +++++ .../cti_with_events.test.tsx | 57 ++++++ .../overview_cti_links/cti_with_events.tsx | 49 +++++ .../overview_cti_links/index.test.tsx | 38 ++-- .../components/overview_cti_links/index.tsx | 36 ++-- .../components/overview_cti_links/mock.ts | 13 +- .../threat_intel_panel_view.tsx | 62 ++++--- .../overview_cti_links/translations.ts | 21 +-- .../use_integrations_page_link.tsx | 11 -- .../containers/overview_cti_links/api.ts | 28 --- .../containers/overview_cti_links/helpers.ts | 60 ++++++ .../containers/overview_cti_links/index.tsx | 116 +++++++----- .../use_all_ti_data_sources.ts | 22 --- .../use_cti_event_counts.ts | 64 +++++++ .../use_is_threat_intel_module_enabled.ts | 32 ++++ .../use_request_event_counts.ts | 54 ++++++ .../overview_cti_links/use_ti_data_sources.ts | 174 ------------------ .../overview_cti_links/use_ti_integrations.ts | 55 ------ .../public/overview/pages/overview.test.tsx | 28 +-- .../public/overview/pages/overview.tsx | 25 +-- .../security_solution/factory/cti/index.ts | 2 - .../factory/cti/threat_intel_source/index.ts | 33 ---- .../query.threat_intel_source.dsl.test.ts | 71 ------- .../query.threat_intel_source.dsl.ts | 59 ------ .../translations/translations/ja-JP.json | 2 + .../translations/translations/zh-CN.json | 2 + .../es_archives/threat_indicator/data.json | 5 +- .../threat_indicator/mappings.json | 8 - 41 files changed, 720 insertions(+), 731 deletions(-) create mode 100644 x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.test.tsx create mode 100644 x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.tsx create mode 100644 x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.test.tsx create mode 100644 x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.tsx delete mode 100644 x-pack/plugins/security_solution/public/overview/components/overview_cti_links/use_integrations_page_link.tsx delete mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/api.ts create mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/helpers.ts delete mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_all_ti_data_sources.ts create mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_cti_event_counts.ts create mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_is_threat_intel_module_enabled.ts create mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_request_event_counts.ts delete mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_data_sources.ts delete mode 100644 x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_integrations.ts delete mode 100644 x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/index.ts delete mode 100644 x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.test.ts delete mode 100644 x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.ts diff --git a/x-pack/plugins/security_solution/common/cti/constants.ts b/x-pack/plugins/security_solution/common/cti/constants.ts index 7a88b065d8701..b33541c5057d8 100644 --- a/x-pack/plugins/security_solution/common/cti/constants.ts +++ b/x-pack/plugins/security_solution/common/cti/constants.ts @@ -58,5 +58,14 @@ export const EVENT_ENRICHMENT_INDICATOR_FIELD_MAP = { export const DEFAULT_EVENT_ENRICHMENT_FROM = 'now-30d'; export const DEFAULT_EVENT_ENRICHMENT_TO = 'now'; -export const TI_INTEGRATION_PREFIX = 'ti'; -export const OTHER_TI_DATASET_KEY = '_others_ti_'; +export const CTI_DATASET_KEY_MAP: { [key: string]: string } = { + 'AbuseCH URL': 'ti_abusech.url', + 'AbuseCH Malware': 'ti_abusech.malware', + 'AbuseCH MalwareBazaar': 'ti_abusech.malwarebazaar', + 'AlienVault OTX': 'ti_otx.threat', + 'Anomali Limo': 'ti_anomali.limo', + 'Anomali Threatstream': 'ti_anomali.threatstream', + MISP: 'ti_misp.threat', + ThreatQuotient: 'ti_threatq.threat', + Cybersixgill: 'ti_cybersixgill.threat', +}; diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/cti/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/cti/index.ts index a6e7eef88724b..26bf4ce6740a9 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/cti/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/cti/index.ts @@ -5,16 +5,13 @@ * 2.0. */ -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { IEsSearchResponse, IEsSearchRequest } from 'src/plugins/data/public'; -import { FactoryQueryTypes } from '../..'; +import type { IEsSearchResponse } from 'src/plugins/data/public'; import { EVENT_ENRICHMENT_INDICATOR_FIELD_MAP } from '../../../cti/constants'; -import { Inspect, Maybe, TimerangeInput } from '../../common'; +import { Inspect } from '../../common'; import { RequestBasicOptions } from '..'; export enum CtiQueries { eventEnrichment = 'eventEnrichment', - dataSource = 'dataSource', } export interface CtiEventEnrichmentRequestOptions extends RequestBasicOptions { @@ -43,33 +40,3 @@ export const validEventFields = Object.keys(EVENT_ENRICHMENT_INDICATOR_FIELD_MAP export const isValidEventField = (field: string): field is EventField => validEventFields.includes(field as EventField); - -export interface CtiDataSourceRequestOptions extends IEsSearchRequest { - defaultIndex: string[]; - factoryQueryType?: FactoryQueryTypes; - timerange?: TimerangeInput; -} - -export interface BucketItem { - key: string; - doc_count: number; -} -export interface Bucket { - buckets: Array; -} - -export type DatasetBucket = { - name?: Bucket; - dashboard?: Bucket; -} & BucketItem; - -export interface CtiDataSourceStrategyResponse extends Omit { - inspect?: Maybe; - rawResponse: { - aggregations?: Record & { - dataset?: { - buckets: DatasetBucket[]; - }; - }; - }; -} diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts index 340093995b297..00cbdb941c11b 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts @@ -72,8 +72,6 @@ import { CtiEventEnrichmentRequestOptions, CtiEventEnrichmentStrategyResponse, CtiQueries, - CtiDataSourceRequestOptions, - CtiDataSourceStrategyResponse, } from './cti'; import { HostRulesRequestOptions, @@ -87,7 +85,6 @@ import { UserRulesStrategyResponse, } from './ueba'; -export * from './cti'; export * from './hosts'; export * from './matrix_histogram'; export * from './network'; @@ -181,8 +178,6 @@ export type StrategyResponseType = T extends HostsQ ? MatrixHistogramStrategyResponse : T extends CtiQueries.eventEnrichment ? CtiEventEnrichmentStrategyResponse - : T extends CtiQueries.dataSource - ? CtiDataSourceStrategyResponse : never; export type StrategyRequestType = T extends HostsQueries.hosts @@ -243,8 +238,6 @@ export type StrategyRequestType = T extends HostsQu ? MatrixHistogramRequestOptions : T extends CtiQueries.eventEnrichment ? CtiEventEnrichmentRequestOptions - : T extends CtiQueries.dataSource - ? CtiDataSourceRequestOptions : never; export interface DocValueFieldsInput { diff --git a/x-pack/plugins/security_solution/cypress/integration/overview/cti_link_panel.spec.ts b/x-pack/plugins/security_solution/cypress/integration/overview/cti_link_panel.spec.ts index 75ff13b66b29c..095401ff31422 100644 --- a/x-pack/plugins/security_solution/cypress/integration/overview/cti_link_panel.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/overview/cti_link_panel.spec.ts @@ -10,8 +10,9 @@ import { OVERVIEW_CTI_LINKS, OVERVIEW_CTI_LINKS_ERROR_INNER_PANEL, OVERVIEW_CTI_LINKS_INFO_INNER_PANEL, + OVERVIEW_CTI_LINKS_WARNING_INNER_PANEL, OVERVIEW_CTI_TOTAL_EVENT_COUNT, - OVERVIEW_CTI_ENABLE_INTEGRATIONS_BUTTON, + OVERVIEW_CTI_VIEW_DASHBOARD_BUTTON, } from '../../screens/overview'; import { loginAndWaitForPage } from '../../tasks/login'; @@ -27,11 +28,12 @@ describe('CTI Link Panel', () => { it('renders disabled threat intel module as expected', () => { loginAndWaitForPage(OVERVIEW_URL); cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_LINKS_ERROR_INNER_PANEL}`).should('exist'); + cy.get(`${OVERVIEW_CTI_VIEW_DASHBOARD_BUTTON}`).should('be.disabled'); cy.get(`${OVERVIEW_CTI_TOTAL_EVENT_COUNT}`).should('have.text', 'Showing: 0 indicators'); cy.get(`${OVERVIEW_CTI_ENABLE_MODULE_BUTTON}`).should('exist'); cy.get(`${OVERVIEW_CTI_ENABLE_MODULE_BUTTON}`) .should('have.attr', 'href') - .and('match', /app\/integrations\/browse\?q=threat%20intelligence/); + .and('match', /filebeat-module-threatintel.html/); }); describe('enabled threat intel module', () => { @@ -47,16 +49,17 @@ describe('CTI Link Panel', () => { loginAndWaitForPage( `${OVERVIEW_URL}?sourcerer=(timerange:(from:%272021-07-08T04:00:00.000Z%27,kind:absolute,to:%272021-07-09T03:59:59.999Z%27))` ); + cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_LINKS_WARNING_INNER_PANEL}`).should('exist'); cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_LINKS_INFO_INNER_PANEL}`).should('exist'); + cy.get(`${OVERVIEW_CTI_VIEW_DASHBOARD_BUTTON}`).should('be.disabled'); cy.get(`${OVERVIEW_CTI_TOTAL_EVENT_COUNT}`).should('have.text', 'Showing: 0 indicators'); }); it('renders dashboard module as expected when there are events in the selected time period', () => { loginAndWaitForPage(OVERVIEW_URL); + cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_LINKS_WARNING_INNER_PANEL}`).should('not.exist'); cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_LINKS_INFO_INNER_PANEL}`).should('exist'); - cy.get(`${OVERVIEW_CTI_LINKS} ${OVERVIEW_CTI_ENABLE_INTEGRATIONS_BUTTON}`).should('exist'); - cy.get(OVERVIEW_CTI_LINKS).should('not.contain.text', 'Anomali'); - cy.get(OVERVIEW_CTI_LINKS).should('contain.text', 'AbuseCH malware'); + cy.get(`${OVERVIEW_CTI_VIEW_DASHBOARD_BUTTON}`).should('be.disabled'); cy.get(`${OVERVIEW_CTI_TOTAL_EVENT_COUNT}`).should('have.text', 'Showing: 1 indicator'); }); }); diff --git a/x-pack/plugins/security_solution/cypress/screens/overview.ts b/x-pack/plugins/security_solution/cypress/screens/overview.ts index bc335ff6680ee..1945b7e3ce3e7 100644 --- a/x-pack/plugins/security_solution/cypress/screens/overview.ts +++ b/x-pack/plugins/security_solution/cypress/screens/overview.ts @@ -150,9 +150,9 @@ export const OVERVIEW_REVENT_TIMELINES = '[data-test-subj="overview-recent-timel export const OVERVIEW_CTI_LINKS = '[data-test-subj="cti-dashboard-links"]'; export const OVERVIEW_CTI_LINKS_ERROR_INNER_PANEL = '[data-test-subj="cti-inner-panel-danger"]'; +export const OVERVIEW_CTI_LINKS_WARNING_INNER_PANEL = '[data-test-subj="cti-inner-panel-warning"]'; export const OVERVIEW_CTI_LINKS_INFO_INNER_PANEL = '[data-test-subj="cti-inner-panel-info"]'; -export const OVERVIEW_CTI_ENABLE_INTEGRATIONS_BUTTON = - '[data-test-subj="cti-enable-integrations-button"]'; +export const OVERVIEW_CTI_VIEW_DASHBOARD_BUTTON = '[data-test-subj="cti-view-dashboard-button"]'; export const OVERVIEW_CTI_TOTAL_EVENT_COUNT = `${OVERVIEW_CTI_LINKS} [data-test-subj="header-panel-subtitle"]`; export const OVERVIEW_CTI_ENABLE_MODULE_BUTTON = '[data-test-subj="cti-enable-module-button"]'; diff --git a/x-pack/plugins/security_solution/public/overview/components/link_panel/helpers.ts b/x-pack/plugins/security_solution/public/overview/components/link_panel/helpers.ts index e2adaaae35547..45d26d9269f6e 100644 --- a/x-pack/plugins/security_solution/public/overview/components/link_panel/helpers.ts +++ b/x-pack/plugins/security_solution/public/overview/components/link_panel/helpers.ts @@ -5,6 +5,13 @@ * 2.0. */ +import { LinkPanelListItem } from '.'; + +export const isLinkPanelListItem = ( + item: LinkPanelListItem | Partial +): item is LinkPanelListItem => + typeof item.title === 'string' && typeof item.path === 'string' && typeof item.count === 'number'; + export interface EventCounts { [key: string]: number; } 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 9a827b137ae78..9d404abcf2223 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 @@ -6,5 +6,6 @@ */ export { InnerLinkPanel } from './inner_link_panel'; +export { isLinkPanelListItem } from './helpers'; export { LinkPanel } from './link_panel'; export type { LinkPanelListItem } from './types'; diff --git a/x-pack/plugins/security_solution/public/overview/components/link_panel/link_panel.tsx b/x-pack/plugins/security_solution/public/overview/components/link_panel/link_panel.tsx index 00a225635fb8b..ed67fdb1c96f6 100644 --- a/x-pack/plugins/security_solution/public/overview/components/link_panel/link_panel.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/link_panel/link_panel.tsx @@ -71,7 +71,7 @@ const LinkPanelComponent = ({ splitPanel, subtitle, }: { - button?: React.ReactNode; + button: React.ReactNode; columns: Array>; dataTestSubj: string; defaultSortField?: string; @@ -134,16 +134,14 @@ const LinkPanelComponent = ({ {splitPanel} {infoPanel} - {chunkedItems.length > 0 && ( - - )} + diff --git a/x-pack/plugins/security_solution/public/overview/components/link_panel/types.ts b/x-pack/plugins/security_solution/public/overview/components/link_panel/types.ts index 1b8836fc2438d..f6c0fb6f3837f 100644 --- a/x-pack/plugins/security_solution/public/overview/components/link_panel/types.ts +++ b/x-pack/plugins/security_solution/public/overview/components/link_panel/types.ts @@ -21,5 +21,4 @@ export interface LinkPanelViewProps { listItems: LinkPanelListItem[]; splitPanel?: JSX.Element; totalCount?: number; - allIntegrationsInstalled?: boolean; } diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_disabled_module.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_disabled_module.tsx index 36f386e49c5c7..2697e4a571ad8 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_disabled_module.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_disabled_module.tsx @@ -6,21 +6,24 @@ */ import React from 'react'; +import { EMPTY_LIST_ITEMS } from '../../containers/overview_cti_links/helpers'; +import { useKibana } from '../../../common/lib/kibana'; import * as i18n from './translations'; import { DisabledLinkPanel } from '../link_panel/disabled_link_panel'; import { ThreatIntelPanelView } from './threat_intel_panel_view'; -import { useIntegrationsPageLink } from './use_integrations_page_link'; export const CtiDisabledModuleComponent = () => { - const integrationsLink = useIntegrationsPageLink(); + const threatIntelDocLink = `${ + useKibana().services.docLinks.links.filebeat.base + }/filebeat-module-threatintel.html`; return ( diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.test.tsx index fc36a0c4337cf..db83d9e1bcfe5 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.test.tsx @@ -19,15 +19,20 @@ import { mockGlobalState, SUB_PLUGINS_REDUCER, } from '../../../common/mock'; -import { mockTheme, mockProps, mockTiDataSources, mockCtiLinksResponse } from './mock'; +import { mockTheme, mockProps, mockCtiEventCountsResponse, mockCtiLinksResponse } from './mock'; +import { useCtiEventCounts } from '../../containers/overview_cti_links/use_cti_event_counts'; import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; -import { useTiDataSources } from '../../containers/overview_cti_links/use_ti_data_sources'; +import { useRequestEventCounts } from '../../containers/overview_cti_links/use_request_event_counts'; jest.mock('../../../common/lib/kibana'); -jest.mock('../../containers/overview_cti_links/use_ti_data_sources'); -const useTiDataSourcesMock = useTiDataSources as jest.Mock; -useTiDataSourcesMock.mockReturnValue(mockTiDataSources); +jest.mock('../../containers/overview_cti_links/use_cti_event_counts'); +const useCTIEventCountsMock = useCtiEventCounts as jest.Mock; +useCTIEventCountsMock.mockReturnValue(mockCtiEventCountsResponse); + +jest.mock('../../containers/overview_cti_links/use_request_event_counts'); +const useRequestEventCountsMock = useRequestEventCounts as jest.Mock; +useRequestEventCountsMock.mockReturnValue([true, {}]); jest.mock('../../containers/overview_cti_links'); const useCtiDashboardLinksMock = useCtiDashboardLinks as jest.Mock; @@ -49,12 +54,42 @@ describe('CtiEnabledModule', () => { - + + + + + ); + + expect(screen.getByTestId('cti-with-events')).toBeInTheDocument(); + }); + + it('renders CtiWithNoEvents when there are no events', () => { + useCTIEventCountsMock.mockReturnValueOnce({ totalCount: 0 }); + render( + + + + + + + + ); + + expect(screen.getByTestId('cti-with-no-events')).toBeInTheDocument(); + }); + + it('renders null while event counts are loading', () => { + useCTIEventCountsMock.mockReturnValueOnce({ totalCount: -1 }); + const { container } = render( + + + + ); - expect(screen.getByText('Showing: 5 indicators')).toBeInTheDocument(); + expect(container.firstChild).toBeNull(); }); }); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.tsx index a339676ac361f..5a40c79d6e5ec 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_enabled_module.tsx @@ -7,28 +7,37 @@ import React from 'react'; import { ThreatIntelLinkPanelProps } from '.'; -import { useTiDataSources } from '../../containers/overview_cti_links/use_ti_data_sources'; -import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; -import { ThreatIntelPanelView } from './threat_intel_panel_view'; +import { useCtiEventCounts } from '../../containers/overview_cti_links/use_cti_event_counts'; +import { CtiNoEvents } from './cti_no_events'; +import { CtiWithEvents } from './cti_with_events'; -export const CtiEnabledModuleComponent: React.FC = (props) => { - const { to, from, allIntegrationsInstalled, allTiDataSources, setQuery, deleteQuery } = props; - const { tiDataSources, totalCount } = useTiDataSources({ - to, - from, - allTiDataSources, - setQuery, - deleteQuery, - }); - const { listItems } = useCtiDashboardLinks({ to, from, tiDataSources }); +export type CtiEnabledModuleProps = Omit; - return ( - - ); +export const CtiEnabledModuleComponent: React.FC = (props) => { + const { eventCountsByDataset, totalCount } = useCtiEventCounts(props); + const { to, from } = props; + + switch (totalCount) { + case -1: + return null; + case 0: + return ( +
    + +
    + ); + default: + return ( +
    + +
    + ); + } }; export const CtiEnabledModule = React.memo(CtiEnabledModuleComponent); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.test.tsx new file mode 100644 index 0000000000000..8f624dabd64d1 --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.test.tsx @@ -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 React from 'react'; +import { Provider } from 'react-redux'; +import { cloneDeep } from 'lodash/fp'; +import { render, screen } from '@testing-library/react'; +import { I18nProvider } from '@kbn/i18n-react'; +import { CtiNoEvents } from './cti_no_events'; +import { ThemeProvider } from 'styled-components'; +import { createStore, State } from '../../../common/store'; +import { + createSecuritySolutionStorageMock, + kibanaObservable, + mockGlobalState, + SUB_PLUGINS_REDUCER, +} from '../../../common/mock'; +import { mockEmptyCtiLinksResponse, mockTheme, mockProps } from './mock'; +import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; + +jest.mock('../../../common/lib/kibana'); + +jest.mock('../../containers/overview_cti_links'); +const useCtiDashboardLinksMock = useCtiDashboardLinks as jest.Mock; +useCtiDashboardLinksMock.mockReturnValue(mockEmptyCtiLinksResponse); + +describe('CtiNoEvents', () => { + const state: State = mockGlobalState; + + const { storage } = createSecuritySolutionStorageMock(); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); + + beforeEach(() => { + const myState = cloneDeep(state); + store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); + }); + + it('renders warning inner panel', () => { + render( + + + + + + + + ); + + expect(screen.getByTestId('cti-dashboard-links')).toBeInTheDocument(); + expect(screen.getByTestId('cti-inner-panel-warning')).toBeInTheDocument(); + }); + + it('renders event counts as 0', () => { + render( + + + + + + + + ); + + expect(screen.getByText('Showing: 0 indicators')).toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.tsx new file mode 100644 index 0000000000000..fa7ac50c08765 --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_no_events.tsx @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; +import { ThreatIntelPanelView } from './threat_intel_panel_view'; +import { InnerLinkPanel } from '../link_panel'; +import * as i18n from './translations'; +import { emptyEventCountsByDataset } from '../../containers/overview_cti_links/helpers'; + +const warning = ( + +); + +export const CtiNoEventsComponent = ({ to, from }: { to: string; from: string }) => { + const { buttonHref, listItems, isPluginDisabled } = useCtiDashboardLinks( + emptyEventCountsByDataset, + to, + from + ); + + return ( + + ); +}; + +export const CtiNoEvents = React.memo(CtiNoEventsComponent); +CtiNoEvents.displayName = 'CtiNoEvents'; diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.test.tsx new file mode 100644 index 0000000000000..a50e3e91ab9e5 --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.test.tsx @@ -0,0 +1,57 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { Provider } from 'react-redux'; +import { cloneDeep } from 'lodash/fp'; +import { mount } from 'enzyme'; +import { I18nProvider } from '@kbn/i18n-react'; +import { CtiWithEvents } from './cti_with_events'; +import { ThemeProvider } from 'styled-components'; +import { createStore, State } from '../../../common/store'; +import { + createSecuritySolutionStorageMock, + kibanaObservable, + mockGlobalState, + SUB_PLUGINS_REDUCER, +} from '../../../common/mock'; +import { mockCtiLinksResponse, mockTheme, mockCtiWithEventsProps } from './mock'; +import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; + +jest.mock('../../../common/lib/kibana'); + +jest.mock('../../containers/overview_cti_links'); +const useCtiDashboardLinksMock = useCtiDashboardLinks as jest.Mock; +useCtiDashboardLinksMock.mockReturnValue(mockCtiLinksResponse); + +describe('CtiWithEvents', () => { + const state: State = mockGlobalState; + + const { storage } = createSecuritySolutionStorageMock(); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); + + beforeEach(() => { + const myState = cloneDeep(state); + store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); + }); + + it('renders total event count as expected', () => { + const wrapper = mount( + + + + + + + + ); + + expect(wrapper.find('[data-test-subj="cti-total-event-count"]').text()).toEqual( + `Showing: ${mockCtiWithEventsProps.totalCount} indicators` + ); + }); +}); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.tsx new file mode 100644 index 0000000000000..f78451e205b1e --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/cti_with_events.tsx @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { isEqual } from 'lodash'; +import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; +import { ThreatIntelPanelView } from './threat_intel_panel_view'; + +export const CtiWithEventsComponent = ({ + eventCountsByDataset, + from, + to, + totalCount, +}: { + eventCountsByDataset: { [key: string]: number }; + from: string; + to: string; + totalCount: number; +}) => { + const { buttonHref, isPluginDisabled, listItems } = useCtiDashboardLinks( + eventCountsByDataset, + to, + from + ); + + return ( + + ); +}; + +CtiWithEventsComponent.displayName = 'CtiWithEvents'; + +export const CtiWithEvents = React.memo( + CtiWithEventsComponent, + (prevProps, nextProps) => + prevProps.to === nextProps.to && + prevProps.from === nextProps.from && + prevProps.totalCount === nextProps.totalCount && + isEqual(prevProps.eventCountsByDataset, nextProps.eventCountsByDataset) +); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx index 71d6d5eb0c583..dfd9c6c9a7fcd 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.test.tsx @@ -19,19 +19,19 @@ import { mockGlobalState, SUB_PLUGINS_REDUCER, } from '../../../common/mock'; -import { mockTheme, mockProps, mockTiDataSources, mockCtiLinksResponse } from './mock'; -import { useTiDataSources } from '../../containers/overview_cti_links/use_ti_data_sources'; -import { useCtiDashboardLinks } from '../../containers/overview_cti_links'; +import { mockTheme, mockProps, mockCtiEventCountsResponse } from './mock'; +import { useRequestEventCounts } from '../../containers/overview_cti_links/use_request_event_counts'; +import { useCtiEventCounts } from '../../containers/overview_cti_links/use_cti_event_counts'; jest.mock('../../../common/lib/kibana'); -jest.mock('../../containers/overview_cti_links/use_ti_data_sources'); -const useTiDataSourcesMock = useTiDataSources as jest.Mock; -useTiDataSourcesMock.mockReturnValue(mockTiDataSources); +jest.mock('../../containers/overview_cti_links/use_request_event_counts'); +const useRequestEventCountsMock = useRequestEventCounts as jest.Mock; +useRequestEventCountsMock.mockReturnValue([true, {}]); -jest.mock('../../containers/overview_cti_links'); -const useCtiDashboardLinksMock = useCtiDashboardLinks as jest.Mock; -useCtiDashboardLinksMock.mockReturnValue(mockCtiLinksResponse); +jest.mock('../../containers/overview_cti_links/use_cti_event_counts'); +const useCTIEventCountsMock = useCtiEventCounts as jest.Mock; +useCTIEventCountsMock.mockReturnValue(mockCtiEventCountsResponse); describe('ThreatIntelLinkPanel', () => { const state: State = mockGlobalState; @@ -49,44 +49,40 @@ describe('ThreatIntelLinkPanel', () => { - + ); expect(wrapper.find('[data-test-subj="cti-enabled-module"]').length).toEqual(1); - expect(wrapper.find('[data-test-subj="cti-enable-integrations-button"]').length).toEqual(0); }); - it('renders Enable source buttons when not all integrations installed', () => { + it('renders CtiDisabledModule when Threat Intel module is disabled', () => { const wrapper = mount( - + ); - expect(wrapper.find('[data-test-subj="cti-enable-integrations-button"]').length).not.toBe(0); + + expect(wrapper.find('[data-test-subj="cti-disabled-module"]').length).toEqual(1); }); - it('renders CtiDisabledModule when Threat Intel module is disabled', () => { + it('renders null while Threat Intel module state is loading', () => { const wrapper = mount( - + ); - expect(wrapper.find('[data-test-subj="cti-disabled-module"]').length).toEqual(1); + expect(wrapper.html()).toEqual(''); }); }); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx index c89199c2cb0c5..5348c12fb6c8e 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/index.tsx @@ -8,7 +8,6 @@ import React from 'react'; import { GlobalTimeArgs } from '../../../common/containers/use_global_time'; -import { TiDataSources } from '../../containers/overview_cti_links/use_ti_data_sources'; import { CtiEnabledModule } from './cti_enabled_module'; import { CtiDisabledModule } from './cti_disabled_module'; @@ -16,26 +15,27 @@ export type ThreatIntelLinkPanelProps = Pick< GlobalTimeArgs, 'from' | 'to' | 'deleteQuery' | 'setQuery' > & { - allIntegrationsInstalled: boolean | undefined; - allTiDataSources: TiDataSources[]; + isThreatIntelModuleEnabled: boolean | undefined; }; const ThreatIntelLinkPanelComponent: React.FC = (props) => { - const { allIntegrationsInstalled, allTiDataSources } = props; - const isThreatIntelModuleEnabled = allTiDataSources.length > 0; - return isThreatIntelModuleEnabled ? ( -
    - -
    - ) : ( -
    - -
    - ); + switch (props.isThreatIntelModuleEnabled) { + case true: + return ( +
    + +
    + ); + case false: + return ( +
    + +
    + ); + case undefined: + default: + return null; + } }; export const ThreatIntelLinkPanel = React.memo(ThreatIntelLinkPanelComponent); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/mock.ts b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/mock.ts index c4cf876cbdc7d..1d02acaf65f48 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/mock.ts +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/mock.ts @@ -15,13 +15,6 @@ export const mockTheme = getMockTheme({ }, }); -export const mockTiDataSources = { - totalCount: 5, - tiDataSources: [ - { dataset: 'ti_abusech', name: 'AbuseCH', count: 5, path: '/dashboard_path_abuseurl' }, - ], -}; - export const mockEventCountsByDataset = { abuseurl: 1, abusemalware: 1, @@ -38,6 +31,8 @@ export const mockCtiEventCountsResponse = { }; export const mockCtiLinksResponse = { + isPluginDisabled: false, + buttonHref: '/button', listItems: [ { title: 'abuseurl', count: 1, path: '/dashboard_path_abuseurl' }, { title: 'abusemalware', count: 2, path: '/dashboard_path_abusemalware' }, @@ -68,10 +63,6 @@ export const mockProps = { from: '2020-01-21T20:49:57.080Z', setQuery: jest.fn(), deleteQuery: jest.fn(), - allIntegrationsInstalled: true, - allTiDataSources: [ - { dataset: 'ti_abusech', name: 'AbuseCH', count: 5, path: '/dashboard_path_abuseurl' }, - ], }; export const mockCtiWithEventsProps = { diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/threat_intel_panel_view.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/threat_intel_panel_view.tsx index 3697d27015fdc..189f230c02c8d 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/threat_intel_panel_view.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/threat_intel_panel_view.tsx @@ -9,14 +9,14 @@ import React, { useMemo } from 'react'; import { EuiButton, EuiTableFieldDataColumnType } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; +import { useKibana } from '../../../common/lib/kibana'; import * as i18n from './translations'; import { LinkPanel, InnerLinkPanel, LinkPanelListItem } from '../link_panel'; import { LinkPanelViewProps } from '../link_panel/types'; import { shortenCountIntoString } from '../../../common/utils/shorten_count_into_string'; import { Link } from '../link_panel/link'; -import { ID as CTIEventCountQueryId } from '../../containers/overview_cti_links/use_ti_data_sources'; +import { ID as CTIEventCountQueryId } from '../../containers/overview_cti_links/use_cti_event_counts'; import { LINK_COPY } from '../overview_risky_host_links/translations'; -import { useIntegrationsPageLink } from './use_integrations_page_link'; const columns: Array> = [ { name: 'Name', field: 'title', sortable: true, truncateText: true, width: '100%' }, @@ -39,43 +39,51 @@ const columns: Array> = [ ]; export const ThreatIntelPanelView: React.FC = ({ + buttonHref = '', + isPluginDisabled, isInspectEnabled = true, listItems, splitPanel, totalCount = 0, - allIntegrationsInstalled, }) => { - const integrationsLink = useIntegrationsPageLink(); + const threatIntelDashboardDocLink = `${ + useKibana().services.docLinks.links.filebeat.base + }/load-kibana-dashboards.html`; return ( ( + + {i18n.VIEW_DASHBOARD} + + ), + [buttonHref] + ), columns, dataTestSubj: 'cti-dashboard-links', infoPanel: useMemo( - () => ( - <> - {allIntegrationsInstalled === false ? ( - - {i18n.DANGER_BUTTON} - - } - /> - ) : null} - - ), - [allIntegrationsInstalled, integrationsLink] + () => + isPluginDisabled ? ( + + {i18n.INFO_BUTTON} + + } + /> + ) : null, + [isPluginDisabled, threatIntelDashboardDocLink] ), inspectQueryId: isInspectEnabled ? CTIEventCountQueryId : undefined, listItems, diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/translations.ts b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/translations.ts index e112942b09749..4a64462b27ad5 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/translations.ts +++ b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/translations.ts @@ -53,14 +53,15 @@ export const DANGER_TITLE = i18n.translate( export const DANGER_BODY = i18n.translate( 'xpack.securitySolution.overview.ctiDashboardEnableThreatIntel', { - defaultMessage: 'You need to enable threat intel sources in order to view data.', + defaultMessage: + 'You need to enable the filebeat threatintel module in order to view data from different sources.', } ); export const DANGER_BUTTON = i18n.translate( - 'xpack.securitySolution.overview.ctiDashboardDangerButton', + 'xpack.securitySolution.overview.ctiDashboardDangerPanelButton', { - defaultMessage: 'Enable sources', + defaultMessage: 'Enable Module', } ); @@ -71,17 +72,3 @@ export const PANEL_TITLE = i18n.translate('xpack.securitySolution.overview.ctiDa export const VIEW_DASHBOARD = i18n.translate('xpack.securitySolution.overview.ctiViewDasboard', { defaultMessage: 'View dashboard', }); - -export const SOME_MODULES_DISABLE_TITLE = i18n.translate( - 'xpack.securitySolution.overview.ctiDashboardSomeModulesDisabledTItle', - { - defaultMessage: 'Some threat intel sources are disabled', - } -); - -export const OTHER_DATA_SOURCE_TITLE = i18n.translate( - 'xpack.securitySolution.overview.ctiDashboardOtherDatasourceTitle', - { - defaultMessage: 'Others', - } -); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/use_integrations_page_link.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/use_integrations_page_link.tsx deleted file mode 100644 index de710c2f1b17c..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/overview_cti_links/use_integrations_page_link.tsx +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { useBasePath } from '../../../common/lib/kibana'; - -export const useIntegrationsPageLink = () => - `${useBasePath()}/app/integrations/browse?q=threat%20intelligence`; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/api.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/api.ts deleted file mode 100644 index ad737ac410e3b..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/api.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { KibanaServices } from '../../../common/lib/kibana'; -import { EPM_API_ROUTES } from '../../../../../fleet/common'; - -export interface IntegrationResponse { - id: string; - status: string; - savedObject?: { - attributes?: { - installed_kibana: Array<{ - type: string; - id: string; - }>; - }; - }; -} - -export const fetchFleetIntegrations = () => - KibanaServices.get().http.fetch<{ - response: IntegrationResponse[]; - }>(EPM_API_ROUTES.LIST_PATTERN, { - method: 'GET', - }); diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/helpers.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/helpers.ts new file mode 100644 index 0000000000000..9ac61cc9487ee --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/helpers.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. + */ + +import { SavedObjectAttributes } from '@kbn/securitysolution-io-ts-alerting-types'; +import { CTI_DATASET_KEY_MAP } from '../../../../common/cti/constants'; +import { LinkPanelListItem } from '../../components/link_panel'; +import { EventCounts } from '../../components/link_panel/helpers'; + +export const ctiTitles = Object.keys(CTI_DATASET_KEY_MAP) as string[]; + +export const EMPTY_LIST_ITEMS: LinkPanelListItem[] = ctiTitles.map((title) => ({ + title, + count: 0, + path: '', +})); + +const TAG_REQUEST_BODY_SEARCH = 'threat intel'; +export const TAG_REQUEST_BODY = { + type: 'tag', + search: TAG_REQUEST_BODY_SEARCH, + searchFields: ['name'], +}; + +export const DASHBOARD_SO_TITLE_PREFIX = '[Filebeat Threat Intel] '; +export const OVERVIEW_DASHBOARD_LINK_TITLE = 'Overview'; + +export const getCtiListItemsWithoutLinks = (eventCounts: EventCounts): LinkPanelListItem[] => { + return EMPTY_LIST_ITEMS.map((item) => ({ + ...item, + count: eventCounts[CTI_DATASET_KEY_MAP[item.title]] ?? 0, + })); +}; + +export const isOverviewItem = (item: { path?: string; title?: string }) => + item.title === OVERVIEW_DASHBOARD_LINK_TITLE; + +export const createLinkFromDashboardSO = ( + dashboardSO: { attributes?: SavedObjectAttributes }, + eventCountsByDataset: EventCounts, + path: string +) => { + const title = + typeof dashboardSO.attributes?.title === 'string' + ? dashboardSO.attributes.title.replace(DASHBOARD_SO_TITLE_PREFIX, '') + : undefined; + return { + title, + count: typeof title === 'string' ? eventCountsByDataset[CTI_DATASET_KEY_MAP[title]] : undefined, + path, + }; +}; + +export const emptyEventCountsByDataset = Object.values(CTI_DATASET_KEY_MAP).reduce((acc, id) => { + acc[id] = 0; + return acc; +}, {} as { [key: string]: number }); diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/index.tsx b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/index.tsx index b1310e363eef0..a546d20e49583 100644 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/index.tsx @@ -6,30 +6,35 @@ */ import { useState, useEffect, useCallback } from 'react'; import { SavedObjectAttributes } from '@kbn/securitysolution-io-ts-alerting-types'; -import { TiDataSources } from '../../containers/overview_cti_links/use_ti_data_sources'; -import { LinkPanelListItem } from '../../components/link_panel'; import { useKibana } from '../../../common/lib/kibana'; +import { + TAG_REQUEST_BODY, + createLinkFromDashboardSO, + getCtiListItemsWithoutLinks, + isOverviewItem, + EMPTY_LIST_ITEMS, +} from './helpers'; +import { LinkPanelListItem, isLinkPanelListItem } from '../../components/link_panel'; -const TAG_REQUEST_BODY_SEARCH = 'threat intel'; -export const TAG_REQUEST_BODY = { - type: 'tag', - search: TAG_REQUEST_BODY_SEARCH, - searchFields: ['name'], -}; - -export const useCtiDashboardLinks = ({ - to, - from, - tiDataSources = [], -}: { - to: string; - from: string; - tiDataSources?: TiDataSources[]; -}) => { - const [installedDashboardIds, setInstalledDashboardIds] = useState([]); - const dashboardLocator = useKibana().services.dashboard?.locator; +export const useCtiDashboardLinks = ( + eventCountsByDataset: { [key: string]: number }, + to: string, + from: string +) => { + const createDashboardUrl = useKibana().services.dashboard?.dashboardUrlGenerator?.createUrl; const savedObjectsClient = useKibana().services.savedObjects.client; + const [buttonHref, setButtonHref] = useState(); + const [listItems, setListItems] = useState(EMPTY_LIST_ITEMS); + + const [isPluginDisabled, setIsDashboardPluginDisabled] = useState(false); + const handleDisabledPlugin = useCallback(() => { + if (!isPluginDisabled) { + setIsDashboardPluginDisabled(true); + } + setListItems(getCtiListItemsWithoutLinks(eventCountsByDataset)); + }, [setIsDashboardPluginDisabled, setListItems, eventCountsByDataset, isPluginDisabled]); + const handleTagsReceived = useCallback( (TagsSO?) => { if (TagsSO?.savedObjects?.length) { @@ -44,7 +49,9 @@ export const useCtiDashboardLinks = ({ ); useEffect(() => { - if (savedObjectsClient) { + if (!createDashboardUrl || !savedObjectsClient) { + handleDisabledPlugin(); + } else { savedObjectsClient .find(TAG_REQUEST_BODY) .then(handleTagsReceived) @@ -56,40 +63,53 @@ export const useCtiDashboardLinks = ({ }>; }) => { if (DashboardsSO?.savedObjects?.length) { - setInstalledDashboardIds( - DashboardsSO.savedObjects.map((SO) => SO.id ?? '').filter(Boolean) + const dashboardUrls = await Promise.all( + DashboardsSO.savedObjects.map((SO) => + createDashboardUrl({ + dashboardId: SO.id, + timeRange: { + to, + from, + }, + }) + ) ); + const items = DashboardsSO.savedObjects + ?.reduce((acc: LinkPanelListItem[], dashboardSO, i) => { + const item = createLinkFromDashboardSO( + dashboardSO, + eventCountsByDataset, + dashboardUrls[i] + ); + if (isOverviewItem(item)) { + setButtonHref(item.path); + } else if (isLinkPanelListItem(item)) { + acc.push(item); + } + return acc; + }, []) + .sort((a, b) => (a.title > b.title ? 1 : -1)); + setListItems(items); + } else { + handleDisabledPlugin(); } } ); } - }, [handleTagsReceived, savedObjectsClient]); - - const listItems = tiDataSources.map((tiDataSource) => { - const listItem: LinkPanelListItem = { - title: tiDataSource.name, - count: tiDataSource.count, - path: '', - }; - - if ( - tiDataSource.dashboardId && - installedDashboardIds.includes(tiDataSource.dashboardId) && - dashboardLocator - ) { - listItem.path = dashboardLocator.getRedirectUrl({ - dashboardId: tiDataSource.dashboardId, - timeRange: { - to, - from, - }, - }); - } - - return listItem; - }); + }, [ + createDashboardUrl, + eventCountsByDataset, + from, + handleDisabledPlugin, + handleTagsReceived, + isPluginDisabled, + savedObjectsClient, + to, + ]); return { + buttonHref, + isPluginDisabled, listItems, }; }; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_all_ti_data_sources.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_all_ti_data_sources.ts deleted file mode 100644 index 5686be269121a..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_all_ti_data_sources.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { useMemo } from 'react'; -import { useTiDataSources } from './use_ti_data_sources'; - -export const useAllTiDataSources = () => { - const { to, from } = useMemo( - () => ({ - to: new Date().toISOString(), - from: new Date(0).toISOString(), - }), - [] - ); - - const { tiDataSources, isInitiallyLoaded } = useTiDataSources({ to, from }); - - return { tiDataSources, isInitiallyLoaded }; -}; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_cti_event_counts.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_cti_event_counts.ts new file mode 100644 index 0000000000000..c8076ab6a4484 --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_cti_event_counts.ts @@ -0,0 +1,64 @@ +/* + * Copyright 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 { useEffect, useState, useMemo } from 'react'; +import { useRequestEventCounts } from './use_request_event_counts'; +import { emptyEventCountsByDataset } from './helpers'; +import { CtiEnabledModuleProps } from '../../components/overview_cti_links/cti_enabled_module'; + +export const ID = 'ctiEventCountQuery'; + +export const useCtiEventCounts = ({ deleteQuery, from, setQuery, to }: CtiEnabledModuleProps) => { + const [isInitialLoading, setIsInitialLoading] = useState(true); + + const [loading, { data, inspect, totalCount, refetch }] = useRequestEventCounts(to, from); + + const eventCountsByDataset = useMemo( + () => + data.reduce( + (acc, item) => { + if (item.y && item.g) { + const id = item.g; + acc[id] += item.y; + } + return acc; + }, + { ...emptyEventCountsByDataset } as { [key: string]: number } + ), + [data] + ); + + useEffect(() => { + if (isInitialLoading && data) { + setIsInitialLoading(false); + } + }, [isInitialLoading, data]); + + useEffect(() => { + if (!loading && !isInitialLoading) { + setQuery({ id: ID, inspect, loading, refetch }); + } + }, [setQuery, inspect, loading, refetch, isInitialLoading, setIsInitialLoading]); + + useEffect(() => { + return () => { + if (deleteQuery) { + deleteQuery({ id: ID }); + } + }; + }, [deleteQuery]); + + useEffect(() => { + refetch(); + }, [to, from, refetch]); + + return { + eventCountsByDataset, + loading, + totalCount, + }; +}; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_is_threat_intel_module_enabled.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_is_threat_intel_module_enabled.ts new file mode 100644 index 0000000000000..0dc0e8a3fe1f2 --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_is_threat_intel_module_enabled.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { useState, useEffect, useMemo } from 'react'; +import { useRequestEventCounts } from './use_request_event_counts'; + +export const useIsThreatIntelModuleEnabled = () => { + const [isThreatIntelModuleEnabled, setIsThreatIntelModuleEnabled] = useState< + boolean | undefined + >(); + + const { to, from } = useMemo( + () => ({ + to: new Date().toISOString(), + from: new Date(0).toISOString(), + }), + [] + ); + + const [, { totalCount }] = useRequestEventCounts(to, from); + + useEffect(() => { + if (totalCount !== -1) { + setIsThreatIntelModuleEnabled(totalCount > 0); + } + }, [totalCount]); + + return isThreatIntelModuleEnabled; +}; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_request_event_counts.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_request_event_counts.ts new file mode 100644 index 0000000000000..a1bf4d9d35f65 --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_request_event_counts.ts @@ -0,0 +1,54 @@ +/* + * Copyright 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 { useMemo } from 'react'; +import { i18n } from '@kbn/i18n'; +import { convertToBuildEsQuery } from '../../../common/lib/keury'; +import { getEsQueryConfig } from '../../../../../../../src/plugins/data/common'; +import { MatrixHistogramType } from '../../../../common/search_strategy'; +import { EVENT_DATASET } from '../../../../common/cti/constants'; +import { useMatrixHistogram } from '../../../common/containers/matrix_histogram'; +import { useKibana } from '../../../common/lib/kibana'; +import { DEFAULT_THREAT_INDEX_KEY } from '../../../../common/constants'; + +export const useRequestEventCounts = (to: string, from: string) => { + const { uiSettings } = useKibana().services; + const defaultThreatIndices = uiSettings.get(DEFAULT_THREAT_INDEX_KEY); + + const [filterQuery] = convertToBuildEsQuery({ + config: getEsQueryConfig(uiSettings), + indexPattern: { + fields: [ + { + name: 'event.kind', + type: 'string', + }, + ], + title: defaultThreatIndices.toString(), + }, + queries: [{ query: 'event.type:indicator', language: 'kuery' }], + filters: [], + }); + + const matrixHistogramRequest = useMemo(() => { + return { + endDate: to, + errorMessage: i18n.translate('xpack.securitySolution.overview.errorFetchingEvents', { + defaultMessage: 'Error fetching events', + }), + filterQuery, + histogramType: MatrixHistogramType.events, + indexNames: defaultThreatIndices, + stackByField: EVENT_DATASET, + startDate: from, + size: 0, + }; + }, [to, from, filterQuery, defaultThreatIndices]); + + const results = useMatrixHistogram(matrixHistogramRequest); + + return results; +}; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_data_sources.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_data_sources.ts deleted file mode 100644 index 865af2266f2e0..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_data_sources.ts +++ /dev/null @@ -1,174 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { Observable } from 'rxjs'; -import { filter } from 'rxjs/operators'; -import { useEffect, useState } from 'react'; -import { useObservable, withOptionalSignal } from '@kbn/securitysolution-hook-utils'; -import { useKibana } from '../../../common/lib/kibana'; -import { - DataPublicPluginStart, - isCompleteResponse, - isErrorResponse, -} from '../../../../../../../src/plugins/data/public'; -import { - Bucket, - CtiQueries, - CtiDataSourceStrategyResponse, - CtiDataSourceRequestOptions, -} from '../../../../common'; -import { DEFAULT_THREAT_INDEX_KEY } from '../../../../common/constants'; -import { GlobalTimeArgs } from '../../../common/containers/use_global_time'; -import { OTHER_DATA_SOURCE_TITLE } from '../../components/overview_cti_links/translations'; -import { OTHER_TI_DATASET_KEY } from '../../../../common/cti/constants'; - -type GetThreatIntelSourcProps = CtiDataSourceRequestOptions & { - data: DataPublicPluginStart; - signal: AbortSignal; -}; -export const ID = 'ctiEventCountQuery'; - -export const getTiDataSources = ({ - data, - defaultIndex, - timerange, - signal, -}: GetThreatIntelSourcProps): Observable => - data.search.search( - { - defaultIndex, - factoryQueryType: CtiQueries.dataSource, - timerange, - }, - { - strategy: 'securitySolutionSearchStrategy', - abortSignal: signal, - } - ); - -export const getTiDataSourcesComplete = ( - props: GetThreatIntelSourcProps -): Observable => { - return getTiDataSources(props).pipe( - filter((response) => { - return isErrorResponse(response) || isCompleteResponse(response); - }) - ); -}; - -const getTiDataSourcesWithOptionalSignal = withOptionalSignal(getTiDataSourcesComplete); - -export const useTiDataSourcesComplete = () => useObservable(getTiDataSourcesWithOptionalSignal); - -export interface TiDataSources { - dataset: string; - name: string; - count: number; - dashboardId?: string; -} -interface TiDataSourcesProps extends Partial { - allTiDataSources?: TiDataSources[]; -} - -export const useTiDataSources = ({ - to, - from, - allTiDataSources, - setQuery, - deleteQuery, -}: TiDataSourcesProps) => { - const [tiDataSources, setTiDataSources] = useState([]); - const [isInitiallyLoaded, setIsInitiallyLoaded] = useState(false); - const { data, uiSettings } = useKibana().services; - const defaultThreatIndices = uiSettings.get(DEFAULT_THREAT_INDEX_KEY); - const { result, start, loading } = useTiDataSourcesComplete(); - - useEffect(() => { - start({ - data, - timerange: to && from ? { to, from, interval: '' } : undefined, - defaultIndex: defaultThreatIndices, - }); - }, [to, from, start, data, defaultThreatIndices]); - - useEffect(() => { - if (!loading && result?.rawResponse && result?.inspect && setQuery) { - setQuery({ - id: ID, - inspect: { - dsl: result?.inspect?.dsl ?? [], - response: [JSON.stringify(result.rawResponse, null, 2)], - }, - loading, - refetch: () => {}, - }); - } - }, [setQuery, loading, result]); - - useEffect(() => { - return () => { - if (deleteQuery) { - deleteQuery({ id: ID }); - } - }; - }, [deleteQuery]); - - useEffect(() => { - if (result && !isInitiallyLoaded) { - setIsInitiallyLoaded(true); - } - }, [isInitiallyLoaded, result]); - - useEffect(() => { - if (!loading && result) { - const datasets = result?.rawResponse?.aggregations?.dataset?.buckets ?? []; - const getChildAggregationValue = (aggregation?: Bucket) => aggregation?.buckets?.[0]?.key; - - const integrationMap = datasets.reduce((acc: Record, dataset) => { - const datasetName = getChildAggregationValue(dataset?.name); - if (datasetName) { - return { - ...acc, - [dataset.key]: { - dataset: dataset?.key, - name: datasetName, - dashboardId: getChildAggregationValue(dataset?.dashboard), - count: dataset?.doc_count, - }, - }; - } else { - const otherTiDatasetKey = OTHER_TI_DATASET_KEY; - const otherDatasetCount = acc[otherTiDatasetKey]?.count ?? 0; - return { - ...acc, - [otherTiDatasetKey]: { - dataset: otherTiDatasetKey, - name: OTHER_DATA_SOURCE_TITLE, - count: otherDatasetCount + (dataset?.doc_count ?? 0), - }, - }; - } - }, {}); - - if (Array.isArray(allTiDataSources)) { - allTiDataSources.forEach((integration) => { - if (!integrationMap[integration.dataset]) { - integrationMap[integration.dataset] = { - ...integration, - count: 0, - }; - } - }); - } - - setTiDataSources(Object.values(integrationMap)); - } - }, [result, loading, allTiDataSources]); - - const totalCount = tiDataSources.reduce((acc, val) => acc + val.count, 0); - - return { tiDataSources, totalCount, isInitiallyLoaded }; -}; diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_integrations.ts b/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_integrations.ts deleted file mode 100644 index 24bdc191b3d66..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_cti_links/use_ti_integrations.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { useEffect, useState } from 'react'; - -import { installationStatuses } from '../../../../../fleet/common'; -import { TI_INTEGRATION_PREFIX } from '../../../../common/cti/constants'; -import { fetchFleetIntegrations, IntegrationResponse } from './api'; - -export interface Integration { - id: string; - dashboardIds: string[]; -} - -interface TiIntegrationStatus { - allIntegrationsInstalled: boolean; -} - -export const useTiIntegrations = () => { - const [tiIntegrationsStatus, setTiIntegrationsStatus] = useState( - null - ); - - useEffect(() => { - const getPackages = async () => { - try { - const { response: integrations } = await fetchFleetIntegrations(); - const tiIntegrations = integrations.filter((integration: IntegrationResponse) => - integration.id.startsWith(TI_INTEGRATION_PREFIX) - ); - - const allIntegrationsInstalled = tiIntegrations.every( - (integration: IntegrationResponse) => - integration.status === installationStatuses.Installed - ); - - setTiIntegrationsStatus({ - allIntegrationsInstalled, - }); - } catch (e) { - setTiIntegrationsStatus({ - allIntegrationsInstalled: false, - }); - } - }; - - getPackages(); - }, []); - - return tiIntegrationsStatus; -}; diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx index b38072464c653..2539490be16fb 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx @@ -23,9 +23,12 @@ import { } from '../../common/components/user_privileges'; import { useSourcererDataView } from '../../common/containers/sourcerer'; import { useFetchIndex } from '../../common/containers/source'; -import { useAllTiDataSources } from '../containers/overview_cti_links/use_all_ti_data_sources'; -import { useTiIntegrations } from '../containers/overview_cti_links/use_ti_integrations'; -import { mockCtiLinksResponse, mockTiDataSources } from '../components/overview_cti_links/mock'; +import { useIsThreatIntelModuleEnabled } from '../containers/overview_cti_links/use_is_threat_intel_module_enabled'; +import { useCtiEventCounts } from '../containers/overview_cti_links/use_cti_event_counts'; +import { + mockCtiEventCountsResponse, + mockCtiLinksResponse, +} from '../components/overview_cti_links/mock'; import { useCtiDashboardLinks } from '../containers/overview_cti_links'; import { EndpointPrivileges } from '../../common/components/user_privileges/endpoint/use_endpoint_privileges'; import { useIsExperimentalFeatureEnabled } from '../../common/hooks/use_experimental_features'; @@ -70,17 +73,18 @@ jest.mock('../../common/components/user_privileges', () => { jest.mock('../../common/containers/local_storage/use_messages_storage'); jest.mock('../containers/overview_cti_links'); +jest.mock('../containers/overview_cti_links/use_cti_event_counts'); const useCtiDashboardLinksMock = useCtiDashboardLinks as jest.Mock; useCtiDashboardLinksMock.mockReturnValue(mockCtiLinksResponse); -jest.mock('../containers/overview_cti_links/use_all_ti_data_sources'); -const useAllTiDataSourcesMock = useAllTiDataSources as jest.Mock; -useAllTiDataSourcesMock.mockReturnValue(mockTiDataSources); +jest.mock('../containers/overview_cti_links/use_cti_event_counts'); +const useCTIEventCountsMock = useCtiEventCounts as jest.Mock; +useCTIEventCountsMock.mockReturnValue(mockCtiEventCountsResponse); -jest.mock('../containers/overview_cti_links/use_ti_integrations'); -const useTiIntegrationsMock = useTiIntegrations as jest.Mock; -useTiIntegrationsMock.mockReturnValue({}); +jest.mock('../containers/overview_cti_links/use_is_threat_intel_module_enabled'); +const useIsThreatIntelModuleEnabledMock = useIsThreatIntelModuleEnabled as jest.Mock; +useIsThreatIntelModuleEnabledMock.mockReturnValue(true); jest.mock('../containers/overview_risky_host_links/use_hosts_risk_score'); const useHostsRiskScoreMock = useHostsRiskScore as jest.Mock; @@ -299,8 +303,8 @@ describe('Overview', () => { }); describe('Threat Intel Dashboard Links', () => { - it('invokes useAllTiDataSourcesMock hook only once', () => { - useAllTiDataSourcesMock.mockClear(); + it('invokes useIsThreatIntelModuleEnabled hook only once', () => { + useIsThreatIntelModuleEnabledMock.mockClear(); mount( @@ -308,7 +312,7 @@ describe('Overview', () => { ); - expect(useAllTiDataSourcesMock).toHaveBeenCalledTimes(1); + expect(useIsThreatIntelModuleEnabledMock).toHaveBeenCalledTimes(1); }); }); }); diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.tsx index 1df49fed07358..67ee6c55ac06f 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.tsx @@ -30,8 +30,7 @@ import { ENDPOINT_METADATA_INDEX } from '../../../common/constants'; import { useSourcererDataView } from '../../common/containers/sourcerer'; import { useDeepEqualSelector } from '../../common/hooks/use_selector'; import { ThreatIntelLinkPanel } from '../components/overview_cti_links'; -import { useAllTiDataSources } from '../containers/overview_cti_links/use_all_ti_data_sources'; -import { useTiIntegrations } from '../containers/overview_cti_links/use_ti_integrations'; +import { useIsThreatIntelModuleEnabled } from '../containers/overview_cti_links/use_is_threat_intel_module_enabled'; import { useUserPrivileges } from '../../common/components/user_privileges'; import { RiskyHostLinks } from '../components/overview_risky_host_links'; import { useAlertsPrivileges } from '../../detections/containers/detection_engine/alerts/use_alerts_privileges'; @@ -76,10 +75,7 @@ const OverviewComponent = () => { endpointPrivileges: { canAccessFleet }, } = useUserPrivileges(); const { hasIndexRead, hasKibanaREAD } = useAlertsPrivileges(); - const { tiDataSources: allTiDataSources, isInitiallyLoaded: allTiDataSourcesLoaded } = - useAllTiDataSources(); - const tiIntegrationStatus = useTiIntegrations(); - const isTiLoaded = tiIntegrationStatus && allTiDataSourcesLoaded; + const isThreatIntelModuleEnabled = useIsThreatIntelModuleEnabled(); const riskyHostsEnabled = useIsExperimentalFeatureEnabled('riskyHostsEnabled'); @@ -154,16 +150,13 @@ const OverviewComponent = () => { - {isTiLoaded && ( - - )} + {riskyHostsEnabled && ( diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/index.ts index e43af97e84af0..5857a0417239c 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/index.ts @@ -9,9 +9,7 @@ import type { FactoryQueryTypes } from '../../../../../common/search_strategy/se import { CtiQueries } from '../../../../../common/search_strategy/security_solution/cti'; import type { SecuritySolutionFactory } from '../types'; import { eventEnrichment } from './event_enrichment'; -import { dataSource } from './threat_intel_source'; export const ctiFactoryTypes: Record> = { [CtiQueries.eventEnrichment]: eventEnrichment, - [CtiQueries.dataSource]: dataSource, }; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/index.ts deleted file mode 100644 index 0951503b04cd4..0000000000000 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { SecuritySolutionFactory } from '../../types'; -import { - CtiDataSourceStrategyResponse, - CtiQueries, - CtiDataSourceRequestOptions, -} from '../../../../../../common'; -import { IEsSearchResponse } from '../../../../../../../../../src/plugins/data/common'; -import { inspectStringifyObject } from '../../../../../utils/build_query'; -import { buildTiDataSourceQuery } from './query.threat_intel_source.dsl'; - -export const dataSource: SecuritySolutionFactory = { - buildDsl: (options: CtiDataSourceRequestOptions) => buildTiDataSourceQuery(options), - parse: async ( - options: CtiDataSourceRequestOptions, - response: IEsSearchResponse - ): Promise => { - const inspect = { - dsl: [inspectStringifyObject(buildTiDataSourceQuery(options))], - }; - - return { - ...response, - inspect, - }; - }, -}; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.test.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.test.ts deleted file mode 100644 index 832006930a326..0000000000000 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.test.ts +++ /dev/null @@ -1,71 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { buildTiDataSourceQuery } from './query.threat_intel_source.dsl'; -import { CtiQueries } from '../../../../../../common'; - -export const mockOptions = { - defaultIndex: ['logs-ti_*', 'filebeat-8*'], - docValueFields: [], - factoryQueryType: CtiQueries.dataSource, - filterQuery: '', - timerange: { - interval: '12h', - from: '2020-09-06T15:23:52.757Z', - to: '2020-09-07T15:23:52.757Z', - }, -}; - -export const expectedDsl = { - body: { - aggs: { - dataset: { - terms: { - field: 'event.dataset', - }, - aggs: { - name: { - terms: { - field: 'threat.feed.name', - }, - }, - dashboard: { - terms: { - field: 'threat.feed.dashboard_id', - }, - }, - }, - }, - }, - query: { - bool: { - filter: [ - { - range: { - '@timestamp': { - gte: '2020-09-06T15:23:52.757Z', - lte: '2020-09-07T15:23:52.757Z', - format: 'strict_date_optional_time', - }, - }, - }, - ], - }, - }, - }, - ignore_unavailable: true, - index: ['logs-ti_*', 'filebeat-8*'], - size: 0, - track_total_hits: true, - allow_no_indices: true, -}; - -describe('buildbuildTiDataSourceQueryQuery', () => { - test('build query from options correctly', () => { - expect(buildTiDataSourceQuery(mockOptions)).toEqual(expectedDsl); - }); -}); diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.ts deleted file mode 100644 index 08463146a683e..0000000000000 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/cti/threat_intel_source/query.threat_intel_source.dsl.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { CtiDataSourceRequestOptions } from '../../../../../../common'; - -export const buildTiDataSourceQuery = ({ - timerange, - defaultIndex, -}: CtiDataSourceRequestOptions) => { - const filter = []; - - if (timerange) { - filter.push({ - range: { - '@timestamp': { - gte: timerange.from, - lte: timerange.to, - format: 'strict_date_optional_time', - }, - }, - }); - } - - const dslQuery = { - size: 0, - index: defaultIndex, - allow_no_indices: true, - ignore_unavailable: true, - track_total_hits: true, - body: { - aggs: { - dataset: { - terms: { field: 'event.dataset' }, - aggs: { - name: { - terms: { field: 'threat.feed.name' }, - }, - dashboard: { - terms: { - field: 'threat.feed.dashboard_id', - }, - }, - }, - }, - }, - query: { - bool: { - filter, - }, - }, - }, - }; - - return dslQuery; -}; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 58d04788e98eb..76d3f07facf05 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -23438,6 +23438,7 @@ "xpack.securitySolution.overview.auditBeatProcessTitle": "プロセス", "xpack.securitySolution.overview.auditBeatSocketTitle": "ソケット", "xpack.securitySolution.overview.auditBeatUserTitle": "ユーザー", + "xpack.securitySolution.overview.ctiDashboardDangerPanelButton": "モジュールを有効にする", "xpack.securitySolution.overview.ctiDashboardDangerPanelTitle": "表示する脅威インテリジェンスデータがありません", "xpack.securitySolution.overview.ctiDashboardEnableThreatIntel": "別のソースからデータを表示するには、filebeat脅威インテリジェンスモジュールを有効にする必要があります。", "xpack.securitySolution.overview.ctiDashboardInfoPanelBody": "このガイドに従い、ダッシュボードを有効にして、ビジュアライゼーションにソースを表示できるようにしてください。", @@ -23459,6 +23460,7 @@ "xpack.securitySolution.overview.endpointNotice.message": "脅威防御、検出、深いセキュリティデータの可視化を実現し、ホストを保護します。", "xpack.securitySolution.overview.endpointNotice.title": "Endpoint Security", "xpack.securitySolution.overview.endpointNotice.tryButton": "Endpoint Securityを試す", + "xpack.securitySolution.overview.errorFetchingEvents": "イベントの取得エラー", "xpack.securitySolution.overview.eventsTitle": "イベント数", "xpack.securitySolution.overview.filebeatCiscoTitle": "Cisco", "xpack.securitySolution.overview.filebeatNetflowTitle": "Netflow", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index da71c1796066f..01997e32f243e 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -23828,6 +23828,7 @@ "xpack.securitySolution.overview.auditBeatProcessTitle": "进程", "xpack.securitySolution.overview.auditBeatSocketTitle": "套接字", "xpack.securitySolution.overview.auditBeatUserTitle": "用户", + "xpack.securitySolution.overview.ctiDashboardDangerPanelButton": "启用模块", "xpack.securitySolution.overview.ctiDashboardDangerPanelTitle": "没有可显示的威胁情报数据", "xpack.securitySolution.overview.ctiDashboardEnableThreatIntel": "您需要启用 filebeat threatintel 模块,以便查看不同源的数据。", "xpack.securitySolution.overview.ctiDashboardInfoPanelBody": "按照此指南启用您的仪表板,以便可以在可视化中查看您的源。", @@ -23850,6 +23851,7 @@ "xpack.securitySolution.overview.endpointNotice.message": "使用威胁防御、检测和深度安全数据可见性功能保护您的主机。", "xpack.securitySolution.overview.endpointNotice.title": "Endpoint Security", "xpack.securitySolution.overview.endpointNotice.tryButton": "试用 Endpoint Security", + "xpack.securitySolution.overview.errorFetchingEvents": "提取事件时出错", "xpack.securitySolution.overview.eventsTitle": "事件计数", "xpack.securitySolution.overview.filebeatCiscoTitle": "Cisco", "xpack.securitySolution.overview.filebeatNetflowTitle": "NetFlow", diff --git a/x-pack/test/security_solution_cypress/es_archives/threat_indicator/data.json b/x-pack/test/security_solution_cypress/es_archives/threat_indicator/data.json index ec5e2aae6e2e2..a2e0c2d2921dc 100644 --- a/x-pack/test/security_solution_cypress/es_archives/threat_indicator/data.json +++ b/x-pack/test/security_solution_cypress/es_archives/threat_indicator/data.json @@ -31,9 +31,6 @@ } }, "type": "file" - }, - "feed": { - "name": "AbuseCH malware" } }, "abusemalware": { @@ -75,4 +72,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/test/security_solution_cypress/es_archives/threat_indicator/mappings.json b/x-pack/test/security_solution_cypress/es_archives/threat_indicator/mappings.json index bc5f6e3db9169..8840cd4bee0dd 100644 --- a/x-pack/test/security_solution_cypress/es_archives/threat_indicator/mappings.json +++ b/x-pack/test/security_solution_cypress/es_archives/threat_indicator/mappings.json @@ -796,14 +796,6 @@ "type": "keyword" } } - }, - "feed":{ - "properties": { - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } } } } From 2c4b1ff37130af73093f304bc83c556150cb2ebe Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 3 Dec 2021 15:59:02 +0000 Subject: [PATCH 23/62] fix(NA): @kbn/utils build on windows native environment (#120317) * fix(NA): @kbn/utils build on windows native environment * chore(NA): remove circular dep from @kbn/utils --- packages/kbn-utils/src/path/index.test.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/kbn-utils/src/path/index.test.ts b/packages/kbn-utils/src/path/index.test.ts index 307d47af9ac50..e4c80a0783b5d 100644 --- a/packages/kbn-utils/src/path/index.test.ts +++ b/packages/kbn-utils/src/path/index.test.ts @@ -7,10 +7,17 @@ */ import { accessSync, constants } from 'fs'; -import { createAbsolutePathSerializer } from '@kbn/dev-utils'; import { getConfigPath, getDataPath, getLogsPath, getConfigDirectory } from './'; - -expect.addSnapshotSerializer(createAbsolutePathSerializer()); +import { REPO_ROOT } from '../repo_root'; + +expect.addSnapshotSerializer( + ((rootPath: string = REPO_ROOT, replacement = '') => { + return { + test: (value: any) => typeof value === 'string' && value.startsWith(rootPath), + serialize: (value: string) => value.replace(rootPath, replacement).replace(/\\/g, '/'), + }; + })() +); describe('Default path finder', () => { it('should expose a path to the config directory', () => { From 7ba6e7f68811aed560cf1211e384dc2d57c0c43c Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Fri, 3 Dec 2021 16:11:57 +0000 Subject: [PATCH 24/62] [ML] Fixing job selector time range charts (#120343) --- .../public/application/components/job_selector/job_selector.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx b/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx index f67a9df4a4a85..4b0d8cdc55094 100644 --- a/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx +++ b/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx @@ -10,6 +10,8 @@ import React, { useState, useEffect, useCallback } from 'react'; import { EuiButtonEmpty, EuiFlexItem, EuiFlexGroup, EuiFlyout } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import './_index.scss'; + import { Dictionary } from '../../../../common/types/common'; import { useUrlState } from '../../util/url_state'; // @ts-ignore From 63bbc45ec24a7441b4cac4441a75147e10cee6a8 Mon Sep 17 00:00:00 2001 From: Paul Tavares <56442535+paul-tavares@users.noreply.github.com> Date: Fri, 3 Dec 2021 11:16:52 -0500 Subject: [PATCH 25/62] [Security Solution][Endpoint] Remove checks for `superuser` role and instead look at fleet kibana privileges (#120027) * Change endpoint privileges to use fleet authz instead of checking for superuser * split user privileges react context component from hook in order to better support mocking * remove `isPlatinumPlus` from endpoint privileges and refactor to use `useUserPrivileges()` hook instead * add `endpointAuthz` to the Server API route handler context * moved fleet's `createFleetAuthzMock` to `fleet/common` --- x-pack/plugins/fleet/common/index.ts | 1 + x-pack/plugins/fleet/common/mocks.ts | 27 ++++- x-pack/plugins/fleet/server/mocks/index.ts | 30 +----- .../server/routes/setup/handlers.test.ts | 4 +- .../endpoint/service/authz/authz.test.ts | 75 +++++++++++++ .../common/endpoint/service/authz/authz.ts | 43 ++++++++ .../common/endpoint/service/authz/index.ts | 9 ++ .../common/endpoint/service/authz/mocks.ts | 29 +++++ .../common/endpoint/types/authz.ts | 27 +++++ .../common/endpoint/types/index.ts | 2 + .../security_solution/public/app/app.tsx | 2 +- .../user_privileges/__mocks__/index.ts | 18 ++++ .../user_privileges/endpoint/index.ts | 2 +- .../user_privileges/endpoint/mocks.ts | 24 ++--- .../endpoint/use_endpoint_privileges.test.ts | 100 ++++-------------- .../endpoint/use_endpoint_privileges.ts | 79 ++++++-------- .../user_privileges/endpoint/utils.ts | 9 +- .../components/user_privileges/index.ts | 13 +++ ...{index.tsx => user_privileges_context.tsx} | 22 ++-- .../public/common/mock/test_providers.tsx | 2 +- .../components/user_info/index.test.tsx | 2 +- .../search_exceptions.test.tsx | 42 ++++---- .../search_exceptions/search_exceptions.tsx | 6 +- .../host_isolation_exceptions_list.test.tsx | 24 ++++- .../view/host_isolation_exceptions_list.tsx | 4 +- .../policy_trusted_apps_empty_unassigned.tsx | 6 +- .../policy_trusted_apps_layout.test.tsx | 4 +- .../layout/policy_trusted_apps_layout.tsx | 10 +- .../list/policy_trusted_apps_list.test.tsx | 28 ++--- .../list/policy_trusted_apps_list.tsx | 15 ++- .../public/overview/pages/overview.test.tsx | 8 +- .../server/endpoint/mocks.ts | 7 +- .../endpoint/routes/actions/isolation.test.ts | 46 +++++--- .../endpoint/routes/actions/isolation.ts | 20 ++-- .../routes/__mocks__/request_context.ts | 2 + .../server/request_context_factory.ts | 37 ++++++- .../plugins/security_solution/server/types.ts | 2 + 37 files changed, 490 insertions(+), 291 deletions(-) create mode 100644 x-pack/plugins/security_solution/common/endpoint/service/authz/authz.test.ts create mode 100644 x-pack/plugins/security_solution/common/endpoint/service/authz/authz.ts create mode 100644 x-pack/plugins/security_solution/common/endpoint/service/authz/index.ts create mode 100644 x-pack/plugins/security_solution/common/endpoint/service/authz/mocks.ts create mode 100644 x-pack/plugins/security_solution/common/endpoint/types/authz.ts create mode 100644 x-pack/plugins/security_solution/public/common/components/user_privileges/__mocks__/index.ts create mode 100644 x-pack/plugins/security_solution/public/common/components/user_privileges/index.ts rename x-pack/plugins/security_solution/public/common/components/user_privileges/{index.tsx => user_privileges_context.tsx} (81%) diff --git a/x-pack/plugins/fleet/common/index.ts b/x-pack/plugins/fleet/common/index.ts index 611e150323855..46a8e2d01fc96 100644 --- a/x-pack/plugins/fleet/common/index.ts +++ b/x-pack/plugins/fleet/common/index.ts @@ -13,3 +13,4 @@ export * from './services'; export * from './types'; export type { FleetAuthz } from './authz'; export { calculateAuthz } from './authz'; +export { createFleetAuthzMock } from './mocks'; diff --git a/x-pack/plugins/fleet/common/mocks.ts b/x-pack/plugins/fleet/common/mocks.ts index eb81ea2d6a0ac..5b71e9b15860e 100644 --- a/x-pack/plugins/fleet/common/mocks.ts +++ b/x-pack/plugins/fleet/common/mocks.ts @@ -5,7 +5,8 @@ * 2.0. */ -import type { NewPackagePolicy, PackagePolicy, DeletePackagePoliciesResponse } from './types'; +import type { DeletePackagePoliciesResponse, NewPackagePolicy, PackagePolicy } from './types'; +import type { FleetAuthz } from './authz'; export const createNewPackagePolicyMock = (): NewPackagePolicy => { return { @@ -56,3 +57,27 @@ export const deletePackagePolicyMock = (): DeletePackagePoliciesResponse => { }, ]; }; + +/** + * Creates mock `authz` object + */ +export const createFleetAuthzMock = (): FleetAuthz => { + return { + fleet: { + all: true, + setup: true, + readEnrollmentTokens: true, + }, + integrations: { + readPackageInfo: true, + readInstalledPackages: true, + installPackages: true, + upgradePackages: true, + removePackages: true, + readPackageSettings: true, + writePackageSettings: true, + readIntegrationPolicies: true, + writeIntegrationPolicies: true, + }, + }; +}; diff --git a/x-pack/plugins/fleet/server/mocks/index.ts b/x-pack/plugins/fleet/server/mocks/index.ts index 90a0addfae490..90c9181b5007a 100644 --- a/x-pack/plugins/fleet/server/mocks/index.ts +++ b/x-pack/plugins/fleet/server/mocks/index.ts @@ -7,11 +7,11 @@ import { of } from 'rxjs'; import { + coreMock, elasticsearchServiceMock, loggingSystemMock, - savedObjectsServiceMock, - coreMock, savedObjectsClientMock, + savedObjectsServiceMock, } from '../../../../../src/core/server/mocks'; import { dataPluginMock } from '../../../../../src/plugins/data/server/mocks'; import { licensingMock } from '../../../../plugins/licensing/server/mocks'; @@ -21,7 +21,7 @@ import type { PackagePolicyServiceInterface } from '../services/package_policy'; import type { AgentPolicyServiceInterface, PackageService } from '../services'; import type { FleetAppContext } from '../plugin'; import { createMockTelemetryEventsSender } from '../telemetry/__mocks__'; -import type { FleetAuthz } from '../../common'; +import { createFleetAuthzMock } from '../../common'; import { agentServiceMock } from '../services/agents/agent_service.mock'; import type { FleetRequestHandlerContext } from '../types'; @@ -145,27 +145,3 @@ export const createMockPackageService = (): PackageService => { ensureInstalledPackage: jest.fn(), }; }; - -/** - * Creates mock `authz` object - */ -export const createFleetAuthzMock = (): FleetAuthz => { - return { - fleet: { - all: true, - setup: true, - readEnrollmentTokens: true, - }, - integrations: { - readPackageInfo: true, - readInstalledPackages: true, - installPackages: true, - upgradePackages: true, - removePackages: true, - readPackageSettings: true, - writePackageSettings: true, - readIntegrationPolicies: true, - writeIntegrationPolicies: true, - }, - }; -}; diff --git a/x-pack/plugins/fleet/server/routes/setup/handlers.test.ts b/x-pack/plugins/fleet/server/routes/setup/handlers.test.ts index d48d80add2435..035659185955d 100644 --- a/x-pack/plugins/fleet/server/routes/setup/handlers.test.ts +++ b/x-pack/plugins/fleet/server/routes/setup/handlers.test.ts @@ -9,12 +9,14 @@ import { httpServerMock, savedObjectsClientMock } from 'src/core/server/mocks'; import type { PostFleetSetupResponse } from '../../../common'; import { RegistryError } from '../../errors'; -import { createAppContextStartContractMock, xpackMocks, createFleetAuthzMock } from '../../mocks'; +import { createAppContextStartContractMock, xpackMocks } from '../../mocks'; import { agentServiceMock } from '../../services/agents/agent_service.mock'; import { appContextService } from '../../services/app_context'; import { setupFleet } from '../../services/setup'; import type { FleetRequestHandlerContext } from '../../types'; +import { createFleetAuthzMock } from '../../../common'; + import { fleetSetupHandler } from './handlers'; jest.mock('../../services/setup', () => { diff --git a/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.test.ts b/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.test.ts new file mode 100644 index 0000000000000..588366036932f --- /dev/null +++ b/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.test.ts @@ -0,0 +1,75 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { calculateEndpointAuthz, getEndpointAuthzInitialState } from './authz'; +import { createFleetAuthzMock, FleetAuthz } from '../../../../../fleet/common'; +import { createLicenseServiceMock } from '../../../license/mocks'; +import type { EndpointAuthz } from '../../types/authz'; + +describe('Endpoint Authz service', () => { + let licenseService: ReturnType; + let fleetAuthz: FleetAuthz; + + beforeEach(() => { + licenseService = createLicenseServiceMock(); + fleetAuthz = createFleetAuthzMock(); + }); + + describe('calculateEndpointAuthz()', () => { + describe('and `fleet.all` access is true', () => { + it.each>([ + ['canAccessFleet'], + ['canAccessEndpointManagement'], + ['canIsolateHost'], + ])('should set `%s` to `true`', (authProperty) => { + expect(calculateEndpointAuthz(licenseService, fleetAuthz)[authProperty]).toBe(true); + }); + + it('should set `canIsolateHost` to false if not proper license', () => { + licenseService.isPlatinumPlus.mockReturnValue(false); + + expect(calculateEndpointAuthz(licenseService, fleetAuthz).canIsolateHost).toBe(false); + }); + + it('should set `canUnIsolateHost` to true even if not proper license', () => { + licenseService.isPlatinumPlus.mockReturnValue(false); + + expect(calculateEndpointAuthz(licenseService, fleetAuthz).canUnIsolateHost).toBe(true); + }); + }); + + describe('and `fleet.all` access is false', () => { + beforeEach(() => (fleetAuthz.fleet.all = false)); + + it.each>([ + ['canAccessFleet'], + ['canAccessEndpointManagement'], + ['canIsolateHost'], + ])('should set `%s` to `false`', (authProperty) => { + expect(calculateEndpointAuthz(licenseService, fleetAuthz)[authProperty]).toBe(false); + }); + + it('should set `canUnIsolateHost` to true even if not proper license', () => { + licenseService.isPlatinumPlus.mockReturnValue(false); + + expect(calculateEndpointAuthz(licenseService, fleetAuthz).canUnIsolateHost).toBe(true); + }); + }); + }); + + describe('getEndpointAuthzInitialState()', () => { + it('returns expected initial state', () => { + expect(getEndpointAuthzInitialState()).toEqual({ + canAccessFleet: false, + canAccessEndpointManagement: false, + canIsolateHost: false, + canUnIsolateHost: true, + canCreateArtifactsByPolicy: false, + }); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.ts b/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.ts new file mode 100644 index 0000000000000..766843311cfdc --- /dev/null +++ b/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.ts @@ -0,0 +1,43 @@ +/* + * Copyright 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 { LicenseService } from '../../../license'; +import { FleetAuthz } from '../../../../../fleet/common'; +import { EndpointAuthz } from '../../types/authz'; + +/** + * Used by both the server and the UI to generate the Authorization for access to Endpoint related + * functionality + * + * @param licenseService + * @param fleetAuthz + */ +export const calculateEndpointAuthz = ( + licenseService: LicenseService, + fleetAuthz: FleetAuthz +): EndpointAuthz => { + const isPlatinumPlusLicense = licenseService.isPlatinumPlus(); + const hasAllAccessToFleet = fleetAuthz.fleet.all; + + return { + canAccessFleet: hasAllAccessToFleet, + canAccessEndpointManagement: hasAllAccessToFleet, + canCreateArtifactsByPolicy: isPlatinumPlusLicense, + canIsolateHost: isPlatinumPlusLicense && hasAllAccessToFleet, + canUnIsolateHost: true, + }; +}; + +export const getEndpointAuthzInitialState = (): EndpointAuthz => { + return { + canAccessFleet: false, + canAccessEndpointManagement: false, + canCreateArtifactsByPolicy: false, + canIsolateHost: false, + canUnIsolateHost: true, + }; +}; diff --git a/x-pack/plugins/security_solution/common/endpoint/service/authz/index.ts b/x-pack/plugins/security_solution/common/endpoint/service/authz/index.ts new file mode 100644 index 0000000000000..975d28eb9dcbf --- /dev/null +++ b/x-pack/plugins/security_solution/common/endpoint/service/authz/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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { getEndpointAuthzInitialState, calculateEndpointAuthz } from './authz'; +export { getEndpointAuthzInitialStateMock } from './mocks'; diff --git a/x-pack/plugins/security_solution/common/endpoint/service/authz/mocks.ts b/x-pack/plugins/security_solution/common/endpoint/service/authz/mocks.ts new file mode 100644 index 0000000000000..7f1a6f969272b --- /dev/null +++ b/x-pack/plugins/security_solution/common/endpoint/service/authz/mocks.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 { EndpointAuthz } from '../../types/authz'; +import { getEndpointAuthzInitialState } from './authz'; + +export const getEndpointAuthzInitialStateMock = ( + overrides: Partial = {} +): EndpointAuthz => { + const authz: EndpointAuthz = { + ...( + Object.entries(getEndpointAuthzInitialState()) as Array<[keyof EndpointAuthz, boolean]> + ).reduce((mockPrivileges, [key, value]) => { + // Invert the initial values (from `false` to `true`) so that everything is authorized + mockPrivileges[key] = !value; + + return mockPrivileges; + }, {} as EndpointAuthz), + // this one is currently treated special in that everyone can un-isolate + canUnIsolateHost: true, + ...overrides, + }; + + return authz; +}; diff --git a/x-pack/plugins/security_solution/common/endpoint/types/authz.ts b/x-pack/plugins/security_solution/common/endpoint/types/authz.ts new file mode 100644 index 0000000000000..da0a372db8aa2 --- /dev/null +++ b/x-pack/plugins/security_solution/common/endpoint/types/authz.ts @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/** + * Set of Endpoint Specific privileges that control application authorization. This interface is + * used both on the client and server for consistency + */ +export interface EndpointAuthz { + /** If user has permissions to access Fleet */ + canAccessFleet: boolean; + /** If user has permissions to access Endpoint management (includes check to ensure they also have access to fleet) */ + canAccessEndpointManagement: boolean; + /** if user has permissions to create Artifacts by Policy */ + canCreateArtifactsByPolicy: boolean; + /** If user has permissions to isolate hosts */ + canIsolateHost: boolean; + /** If user has permissions to un-isolate (release) hosts */ + canUnIsolateHost: boolean; +} + +export interface EndpointPrivileges extends EndpointAuthz { + loading: boolean; +} diff --git a/x-pack/plugins/security_solution/common/endpoint/types/index.ts b/x-pack/plugins/security_solution/common/endpoint/types/index.ts index c869c9c780bd9..1fce6f17bdea6 100644 --- a/x-pack/plugins/security_solution/common/endpoint/types/index.ts +++ b/x-pack/plugins/security_solution/common/endpoint/types/index.ts @@ -1246,3 +1246,5 @@ interface BaseListResponse { * Returned by the server via GET /api/endpoint/metadata */ export type MetadataListResponse = BaseListResponse; + +export type { EndpointPrivileges } from './authz'; diff --git a/x-pack/plugins/security_solution/public/app/app.tsx b/x-pack/plugins/security_solution/public/app/app.tsx index 78a340d6bbca0..6d5f81b076560 100644 --- a/x-pack/plugins/security_solution/public/app/app.tsx +++ b/x-pack/plugins/security_solution/public/app/app.tsx @@ -25,7 +25,7 @@ import { State } from '../common/store'; import { StartServices } from '../types'; import { PageRouter } from './routes'; import { EuiThemeProvider } from '../../../../../src/plugins/kibana_react/common'; -import { UserPrivilegesProvider } from '../common/components/user_privileges'; +import { UserPrivilegesProvider } from '../common/components/user_privileges/user_privileges_context'; interface StartAppComponent { children: React.ReactNode; diff --git a/x-pack/plugins/security_solution/public/common/components/user_privileges/__mocks__/index.ts b/x-pack/plugins/security_solution/public/common/components/user_privileges/__mocks__/index.ts new file mode 100644 index 0000000000000..dc77a6b9eea8d --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/user_privileges/__mocks__/index.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { initialUserPrivilegesState, UserPrivilegesState } from '../user_privileges_context'; +import { getEndpointPrivilegesInitialStateMock } from '../endpoint/mocks'; + +export const useUserPrivileges = jest.fn(() => { + const mockedPrivileges: UserPrivilegesState = { + ...initialUserPrivilegesState(), + endpointPrivileges: getEndpointPrivilegesInitialStateMock(), + }; + + return mockedPrivileges; +}); diff --git a/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/index.ts b/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/index.ts index adea89ce1a051..83443dc20b9b8 100644 --- a/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/index.ts +++ b/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/index.ts @@ -5,5 +5,5 @@ * 2.0. */ -export * from './use_endpoint_privileges'; +export { useEndpointPrivileges } from './use_endpoint_privileges'; export { getEndpointPrivilegesInitialState } from './utils'; diff --git a/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/mocks.ts b/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/mocks.ts index 2851c92816cea..2348fdf017c86 100644 --- a/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/mocks.ts +++ b/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/mocks.ts @@ -5,24 +5,16 @@ * 2.0. */ -import type { EndpointPrivileges } from './use_endpoint_privileges'; -import { getEndpointPrivilegesInitialState } from './utils'; +import { EndpointPrivileges } from '../../../../../common/endpoint/types'; +import { getEndpointAuthzInitialStateMock } from '../../../../../common/endpoint/service/authz/mocks'; -export const getEndpointPrivilegesInitialStateMock = ( - overrides: Partial = {} -): EndpointPrivileges => { - // Get the initial state and set all permissions to `true` (enabled) for testing +export const getEndpointPrivilegesInitialStateMock = ({ + loading = false, + ...overrides +}: Partial = {}): EndpointPrivileges => { const endpointPrivilegesMock: EndpointPrivileges = { - ...( - Object.entries(getEndpointPrivilegesInitialState()) as Array< - [keyof EndpointPrivileges, boolean] - > - ).reduce((mockPrivileges, [key, value]) => { - mockPrivileges[key] = !value; - - return mockPrivileges; - }, {} as EndpointPrivileges), - ...overrides, + ...getEndpointAuthzInitialStateMock(overrides), + loading, }; return endpointPrivilegesMock; diff --git a/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/use_endpoint_privileges.test.ts b/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/use_endpoint_privileges.test.ts index d4ba29a4ef950..4daef6cca45bd 100644 --- a/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/use_endpoint_privileges.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/use_endpoint_privileges.test.ts @@ -6,14 +6,14 @@ */ import { act, renderHook, RenderHookResult, RenderResult } from '@testing-library/react-hooks'; -import { useHttp, useCurrentUser } from '../../../lib/kibana'; -import { EndpointPrivileges, useEndpointPrivileges } from './use_endpoint_privileges'; +import { useCurrentUser, useKibana } from '../../../lib/kibana'; +import { useEndpointPrivileges } from './use_endpoint_privileges'; import { securityMock } from '../../../../../../security/public/mocks'; -import { appRoutesService } from '../../../../../../fleet/common'; import { AuthenticatedUser } from '../../../../../../security/common'; import { licenseService } from '../../../hooks/use_license'; -import { fleetGetCheckPermissionsHttpMock } from '../../../../management/pages/mocks'; import { getEndpointPrivilegesInitialStateMock } from './mocks'; +import { EndpointPrivileges } from '../../../../../common/endpoint/types'; +import { getEndpointPrivilegesInitialState } from './utils'; jest.mock('../../../lib/kibana'); jest.mock('../../../hooks/use_license', () => { @@ -32,10 +32,9 @@ const licenseServiceMock = licenseService as jest.Mocked; describe('When using useEndpointPrivileges hook', () => { let authenticatedUser: AuthenticatedUser; - let fleetApiMock: ReturnType; let result: RenderResult; let unmount: ReturnType['unmount']; - let waitForNextUpdate: ReturnType['waitForNextUpdate']; + let releaseFleetAuthz: () => void; let render: () => RenderHookResult; beforeEach(() => { @@ -45,14 +44,19 @@ describe('When using useEndpointPrivileges hook', () => { (useCurrentUser as jest.Mock).mockReturnValue(authenticatedUser); - fleetApiMock = fleetGetCheckPermissionsHttpMock( - useHttp() as Parameters[0] - ); licenseServiceMock.isPlatinumPlus.mockReturnValue(true); + // Add a daly to fleet service that provides authz information + const fleetAuthz = useKibana().services.fleet!.authz; + + // Add a delay to the fleet Authz promise to test out the `loading` property + useKibana().services.fleet!.authz = new Promise((resolve) => { + releaseFleetAuthz = () => resolve(fleetAuthz); + }); + render = () => { const hookRenderResponse = renderHook(() => useEndpointPrivileges()); - ({ result, unmount, waitForNextUpdate } = hookRenderResponse); + ({ result, unmount } = hookRenderResponse); return hookRenderResponse; }; }); @@ -62,88 +66,22 @@ describe('When using useEndpointPrivileges hook', () => { }); it('should return `loading: true` while retrieving privileges', async () => { - // Add a daly to the API response that we can control from the test - let releaseApiResponse: () => void; - fleetApiMock.responseProvider.checkPermissions.mockDelay.mockReturnValue( - new Promise((resolve) => { - releaseApiResponse = () => resolve(); - }) - ); (useCurrentUser as jest.Mock).mockReturnValue(null); const { rerender } = render(); - expect(result.current).toEqual( - getEndpointPrivilegesInitialStateMock({ - canAccessEndpointManagement: false, - canAccessFleet: false, - loading: true, - }) - ); + expect(result.current).toEqual(getEndpointPrivilegesInitialState()); // Make user service available (useCurrentUser as jest.Mock).mockReturnValue(authenticatedUser); rerender(); - expect(result.current).toEqual( - getEndpointPrivilegesInitialStateMock({ - canAccessEndpointManagement: false, - canAccessFleet: false, - loading: true, - }) - ); + expect(result.current).toEqual(getEndpointPrivilegesInitialState()); // Release the API response await act(async () => { - fleetApiMock.waitForApi(); - releaseApiResponse!(); + releaseFleetAuthz(); + await useKibana().services.fleet!.authz; }); - expect(result.current).toEqual(getEndpointPrivilegesInitialStateMock()); - }); - - it('should call Fleet permissions api to determine user privilege to fleet', async () => { - render(); - await waitForNextUpdate(); - await fleetApiMock.waitForApi(); - expect(useHttp().get as jest.Mock).toHaveBeenCalledWith( - appRoutesService.getCheckPermissionsPath() - ); - }); - it('should set privileges to false if user does not have superuser role', async () => { - authenticatedUser.roles = []; - render(); - await waitForNextUpdate(); - await fleetApiMock.waitForApi(); - expect(result.current).toEqual( - getEndpointPrivilegesInitialStateMock({ - canAccessEndpointManagement: false, - }) - ); - }); - - it('should set privileges to false if fleet api check returns failure', async () => { - fleetApiMock.responseProvider.checkPermissions.mockReturnValue({ - error: 'MISSING_SECURITY', - success: false, - }); - - render(); - await waitForNextUpdate(); - await fleetApiMock.waitForApi(); - expect(result.current).toEqual( - getEndpointPrivilegesInitialStateMock({ - canAccessEndpointManagement: false, - canAccessFleet: false, - }) - ); + expect(result.current).toEqual(getEndpointPrivilegesInitialStateMock()); }); - - it.each([['canIsolateHost'], ['canCreateArtifactsByPolicy']])( - 'should set %s to false if license is not PlatinumPlus', - async (privilege) => { - licenseServiceMock.isPlatinumPlus.mockReturnValue(false); - render(); - await waitForNextUpdate(); - expect(result.current).toEqual(expect.objectContaining({ [privilege]: false })); - } - ); }); diff --git a/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/use_endpoint_privileges.ts b/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/use_endpoint_privileges.ts index 448cb215941de..6fa0c51f500da 100644 --- a/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/use_endpoint_privileges.ts +++ b/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/use_endpoint_privileges.ts @@ -6,24 +6,14 @@ */ import { useEffect, useMemo, useRef, useState } from 'react'; -import { useCurrentUser, useHttp } from '../../../lib/kibana'; -import { appRoutesService, CheckPermissionsResponse } from '../../../../../../fleet/common'; +import { useCurrentUser, useKibana } from '../../../lib/kibana'; import { useLicense } from '../../../hooks/use_license'; -import { Immutable } from '../../../../../common/endpoint/types'; - -export interface EndpointPrivileges { - loading: boolean; - /** If user has permissions to access Fleet */ - canAccessFleet: boolean; - /** If user has permissions to access Endpoint management (includes check to ensure they also have access to fleet) */ - canAccessEndpointManagement: boolean; - /** if user has permissions to create Artifacts by Policy */ - canCreateArtifactsByPolicy: boolean; - /** If user has permissions to use the Host isolation feature */ - canIsolateHost: boolean; - /** @deprecated do not use. instead, use one of the other privileges defined */ - isPlatinumPlus: boolean; -} +import { EndpointPrivileges, Immutable } from '../../../../../common/endpoint/types'; +import { + calculateEndpointAuthz, + getEndpointAuthzInitialState, +} from '../../../../../common/endpoint/service/authz'; +import { FleetAuthz } from '../../../../../../fleet/common'; /** * Retrieve the endpoint privileges for the current user. @@ -32,23 +22,39 @@ export interface EndpointPrivileges { * to keep API calls to a minimum. */ export const useEndpointPrivileges = (): Immutable => { - const http = useHttp(); const user = useCurrentUser(); + const fleetServices = useKibana().services.fleet; const isMounted = useRef(true); - const isPlatinumPlusLicense = useLicense().isPlatinumPlus(); - const [canAccessFleet, setCanAccessFleet] = useState(false); + const licenseService = useLicense(); const [fleetCheckDone, setFleetCheckDone] = useState(false); + const [fleetAuthz, setFleetAuthz] = useState(null); + + const privileges = useMemo(() => { + const privilegeList: EndpointPrivileges = Object.freeze({ + loading: !fleetCheckDone || !user, + ...(fleetAuthz + ? calculateEndpointAuthz(licenseService, fleetAuthz) + : getEndpointAuthzInitialState()), + }); + + return privilegeList; + }, [fleetCheckDone, user, fleetAuthz, licenseService]); // Check if user can access fleet useEffect(() => { + if (!fleetServices) { + setFleetCheckDone(true); + return; + } + + setFleetCheckDone(false); + (async () => { try { - const fleetPermissionsResponse = await http.get( - appRoutesService.getCheckPermissionsPath() - ); + const fleetAuthzForCurrentUser = await fleetServices.authz; if (isMounted.current) { - setCanAccessFleet(fleetPermissionsResponse.success); + setFleetAuthz(fleetAuthzForCurrentUser); } } finally { if (isMounted.current) { @@ -56,30 +62,7 @@ export const useEndpointPrivileges = (): Immutable => { } } })(); - }, [http]); - - // Check if user has `superuser` role - const isSuperUser = useMemo(() => { - if (user?.roles) { - return user.roles.includes('superuser'); - } - return false; - }, [user?.roles]); - - const privileges = useMemo(() => { - const privilegeList: EndpointPrivileges = Object.freeze({ - loading: !fleetCheckDone || !user, - canAccessFleet, - canAccessEndpointManagement: canAccessFleet && isSuperUser, - canCreateArtifactsByPolicy: isPlatinumPlusLicense, - canIsolateHost: isPlatinumPlusLicense, - // FIXME: Remove usages of the property below - /** @deprecated */ - isPlatinumPlus: isPlatinumPlusLicense, - }); - - return privilegeList; - }, [canAccessFleet, fleetCheckDone, isSuperUser, user, isPlatinumPlusLicense]); + }, [fleetServices]); // Capture if component is unmounted useEffect( diff --git a/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/utils.ts b/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/utils.ts index df91314479f18..0c314ba5573c8 100644 --- a/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/utils.ts +++ b/x-pack/plugins/security_solution/public/common/components/user_privileges/endpoint/utils.ts @@ -5,15 +5,12 @@ * 2.0. */ -import { EndpointPrivileges } from './use_endpoint_privileges'; +import { EndpointPrivileges } from '../../../../../common/endpoint/types'; +import { getEndpointAuthzInitialState } from '../../../../../common/endpoint/service/authz'; export const getEndpointPrivilegesInitialState = (): EndpointPrivileges => { return { loading: true, - canAccessFleet: false, - canAccessEndpointManagement: false, - canIsolateHost: false, - canCreateArtifactsByPolicy: false, - isPlatinumPlus: false, + ...getEndpointAuthzInitialState(), }; }; diff --git a/x-pack/plugins/security_solution/public/common/components/user_privileges/index.ts b/x-pack/plugins/security_solution/public/common/components/user_privileges/index.ts new file mode 100644 index 0000000000000..3a5d942d3b532 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/user_privileges/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useContext } from 'react'; +import { DeepReadonly } from 'utility-types'; +import { UserPrivilegesContext, UserPrivilegesState } from './user_privileges_context'; + +export const useUserPrivileges = (): DeepReadonly => + useContext(UserPrivilegesContext); diff --git a/x-pack/plugins/security_solution/public/common/components/user_privileges/index.tsx b/x-pack/plugins/security_solution/public/common/components/user_privileges/user_privileges_context.tsx similarity index 81% rename from x-pack/plugins/security_solution/public/common/components/user_privileges/index.tsx rename to x-pack/plugins/security_solution/public/common/components/user_privileges/user_privileges_context.tsx index 05ccadeaf67ac..5c681e5dbbaec 100644 --- a/x-pack/plugins/security_solution/public/common/components/user_privileges/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/user_privileges/user_privileges_context.tsx @@ -5,16 +5,14 @@ * 2.0. */ -import React, { createContext, useContext, useEffect, useState } from 'react'; -import { DeepReadonly } from 'utility-types'; - -import { Capabilities } from '../../../../../../../src/core/public'; -import { useFetchDetectionEnginePrivileges } from '../../../detections/components/user_privileges/use_fetch_detection_engine_privileges'; +import React, { createContext, useEffect, useState } from 'react'; +import { Capabilities } from '../../../../../../../src/core/types'; +import { SERVER_APP_ID } from '../../../../common/constants'; import { useFetchListPrivileges } from '../../../detections/components/user_privileges/use_fetch_list_privileges'; -import { EndpointPrivileges, useEndpointPrivileges } from './endpoint'; +import { useFetchDetectionEnginePrivileges } from '../../../detections/components/user_privileges/use_fetch_detection_engine_privileges'; +import { getEndpointPrivilegesInitialState, useEndpointPrivileges } from './endpoint'; +import { EndpointPrivileges } from '../../../../common/endpoint/types'; -import { SERVER_APP_ID } from '../../../../common/constants'; -import { getEndpointPrivilegesInitialState } from './endpoint/utils'; export interface UserPrivilegesState { listPrivileges: ReturnType; detectionEnginePrivileges: ReturnType; @@ -28,8 +26,9 @@ export const initialUserPrivilegesState = (): UserPrivilegesState => ({ endpointPrivileges: getEndpointPrivilegesInitialState(), kibanaSecuritySolutionsPrivileges: { crud: false, read: false }, }); - -const UserPrivilegesContext = createContext(initialUserPrivilegesState()); +export const UserPrivilegesContext = createContext( + initialUserPrivilegesState() +); interface UserPrivilegesProviderProps { kibanaCapabilities: Capabilities; @@ -73,6 +72,3 @@ export const UserPrivilegesProvider = ({ ); }; - -export const useUserPrivileges = (): DeepReadonly => - useContext(UserPrivilegesContext); diff --git a/x-pack/plugins/security_solution/public/common/mock/test_providers.tsx b/x-pack/plugins/security_solution/public/common/mock/test_providers.tsx index 528592051ccce..9ad5abc1c7ed2 100644 --- a/x-pack/plugins/security_solution/public/common/mock/test_providers.tsx +++ b/x-pack/plugins/security_solution/public/common/mock/test_providers.tsx @@ -25,8 +25,8 @@ import { import { FieldHook } from '../../shared_imports'; import { SUB_PLUGINS_REDUCER } from './utils'; import { createSecuritySolutionStorageMock, localStorageMock } from './mock_local_storage'; -import { UserPrivilegesProvider } from '../components/user_privileges'; import { CASES_FEATURE_ID } from '../../../common/constants'; +import { UserPrivilegesProvider } from '../components/user_privileges/user_privileges_context'; const state: State = mockGlobalState; diff --git a/x-pack/plugins/security_solution/public/detections/components/user_info/index.test.tsx b/x-pack/plugins/security_solution/public/detections/components/user_info/index.test.tsx index 0447130e1bd14..32911a2c8e4ab 100644 --- a/x-pack/plugins/security_solution/public/detections/components/user_info/index.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/user_info/index.test.tsx @@ -13,7 +13,7 @@ import { Capabilities } from 'src/core/public'; import { useKibana } from '../../../common/lib/kibana'; import * as api from '../../containers/detection_engine/alerts/api'; import { TestProviders } from '../../../common/mock/test_providers'; -import { UserPrivilegesProvider } from '../../../common/components/user_privileges'; +import { UserPrivilegesProvider } from '../../../common/components/user_privileges/user_privileges_context'; jest.mock('../../../common/lib/kibana'); jest.mock('../../containers/detection_engine/alerts/api'); diff --git a/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.test.tsx b/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.test.tsx index 3b987a7211411..493b41bc0165c 100644 --- a/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.test.tsx @@ -8,18 +8,21 @@ import React from 'react'; import { act, fireEvent } from '@testing-library/react'; import { AppContextTestRender, createAppRootMockRenderer } from '../../../common/mock/endpoint'; -import { - EndpointPrivileges, - useEndpointPrivileges, -} from '../../../common/components/user_privileges/endpoint/use_endpoint_privileges'; import { EndpointDocGenerator } from '../../../../common/endpoint/generate_data'; +import { useUserPrivileges } from '../../../common/components/user_privileges'; import { SearchExceptions, SearchExceptionsProps } from '.'; import { getEndpointPrivilegesInitialStateMock } from '../../../common/components/user_privileges/endpoint/mocks'; -jest.mock('../../../common/components/user_privileges/endpoint/use_endpoint_privileges'); +import { + initialUserPrivilegesState, + UserPrivilegesState, +} from '../../../common/components/user_privileges/user_privileges_context'; +import { EndpointPrivileges } from '../../../../common/endpoint/types'; + +jest.mock('../../../common/components/user_privileges'); let onSearchMock: jest.Mock; -const mockUseEndpointPrivileges = useEndpointPrivileges as jest.Mock; +const mockUseUserPrivileges = useUserPrivileges as jest.Mock; describe('Search exceptions', () => { let appTestContext: AppContextTestRender; @@ -28,13 +31,16 @@ describe('Search exceptions', () => { props?: Partial ) => ReturnType; - const loadedUserEndpointPrivilegesState = ( + const loadedUserPrivilegesState = ( endpointOverrides: Partial = {} - ): EndpointPrivileges => - getEndpointPrivilegesInitialStateMock({ - isPlatinumPlus: false, - ...endpointOverrides, - }); + ): UserPrivilegesState => { + return { + ...initialUserPrivilegesState(), + endpointPrivileges: getEndpointPrivilegesInitialStateMock({ + ...endpointOverrides, + }), + }; + }; beforeEach(() => { onSearchMock = jest.fn(); @@ -51,11 +57,11 @@ describe('Search exceptions', () => { return renderResult; }; - mockUseEndpointPrivileges.mockReturnValue(loadedUserEndpointPrivilegesState()); + mockUseUserPrivileges.mockReturnValue(loadedUserPrivilegesState()); }); afterAll(() => { - mockUseEndpointPrivileges.mockReset(); + mockUseUserPrivileges.mockReset(); }); it('should have a default value', () => { @@ -102,8 +108,8 @@ describe('Search exceptions', () => { it('should hide policies selector when no license', () => { const generator = new EndpointDocGenerator('policy-list'); const policy = generator.generatePolicyPackagePolicy(); - mockUseEndpointPrivileges.mockReturnValue( - loadedUserEndpointPrivilegesState({ isPlatinumPlus: false }) + mockUseUserPrivileges.mockReturnValue( + loadedUserPrivilegesState({ canCreateArtifactsByPolicy: false }) ); const element = render({ policyList: [policy], hasPolicyFilter: true }); @@ -113,8 +119,8 @@ describe('Search exceptions', () => { it('should display policies selector when right license', () => { const generator = new EndpointDocGenerator('policy-list'); const policy = generator.generatePolicyPackagePolicy(); - mockUseEndpointPrivileges.mockReturnValue( - loadedUserEndpointPrivilegesState({ isPlatinumPlus: true }) + mockUseUserPrivileges.mockReturnValue( + loadedUserPrivilegesState({ canCreateArtifactsByPolicy: true }) ); const element = render({ policyList: [policy], hasPolicyFilter: true }); diff --git a/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.tsx b/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.tsx index 569916ac20315..5489f7a394c99 100644 --- a/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.tsx +++ b/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.tsx @@ -10,7 +10,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiFieldSearch, EuiButton } from '@elastic/e import { i18n } from '@kbn/i18n'; import { PolicySelectionItem, PoliciesSelector } from '../policies_selector'; import { ImmutableArray, PolicyData } from '../../../../common/endpoint/types'; -import { useEndpointPrivileges } from '../../../common/components/user_privileges/endpoint/use_endpoint_privileges'; +import { useUserPrivileges } from '../../../common/components/user_privileges'; export interface SearchExceptionsProps { defaultValue?: string; @@ -34,7 +34,7 @@ export const SearchExceptions = memo( defaultExcludedPolicies, hideRefreshButton = false, }) => { - const { isPlatinumPlus } = useEndpointPrivileges(); + const { canCreateArtifactsByPolicy } = useUserPrivileges().endpointPrivileges; const [query, setQuery] = useState(defaultValue); const [includedPolicies, setIncludedPolicies] = useState(defaultIncludedPolicies || ''); const [excludedPolicies, setExcludedPolicies] = useState(defaultExcludedPolicies || ''); @@ -92,7 +92,7 @@ export const SearchExceptions = memo( data-test-subj="searchField" /> - {isPlatinumPlus && hasPolicyFilter && policyList ? ( + {canCreateArtifactsByPolicy && hasPolicyFilter && policyList ? ( { let history: AppContextTestRender['history']; let mockedContext: AppContextTestRender; - const useEndpointPrivilegesMock = useEndpointPrivileges as jest.Mock; + const useUserPrivilegesMock = _useUserPrivileges as jest.Mock; + + const setEndpointPrivileges = (overrides: Partial = {}) => { + const newPrivileges = _useUserPrivileges(); + + useUserPrivilegesMock.mockReturnValue({ + ...newPrivileges, + endpointPrivileges: { + ...newPrivileges.endpointPrivileges, + ...overrides, + }, + }); + }; + const waitForApiCall = () => { return waitFor(() => expect(getHostIsolationExceptionItemsMock).toHaveBeenCalled()); }; @@ -162,7 +176,7 @@ describe('When on the host isolation exceptions page', () => { describe('has canIsolateHost privileges', () => { beforeEach(async () => { - useEndpointPrivilegesMock.mockReturnValue({ canIsolateHost: true }); + setEndpointPrivileges({ canIsolateHost: true }); getHostIsolationExceptionItemsMock.mockImplementation(getFoundExceptionListItemSchemaMock); }); @@ -185,7 +199,7 @@ describe('When on the host isolation exceptions page', () => { describe('does not have canIsolateHost privileges', () => { beforeEach(() => { - useEndpointPrivilegesMock.mockReturnValue({ canIsolateHost: false }); + setEndpointPrivileges({ canIsolateHost: false }); }); it('should not show the create flyout if the user navigates to the create url', () => { diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.tsx b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.tsx index a9da5c6d135a3..816aef5ca2dce 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.tsx @@ -31,11 +31,11 @@ import { EDIT_HOST_ISOLATION_EXCEPTION_LABEL, } from './components/translations'; import { getEndpointListPath } from '../../../common/routing'; -import { useEndpointPrivileges } from '../../../../common/components/user_privileges/endpoint'; import { MANAGEMENT_DEFAULT_PAGE_SIZE, MANAGEMENT_PAGE_SIZE_OPTIONS, } from '../../../common/constants'; +import { useUserPrivileges } from '../../../../common/components/user_privileges'; type HostIsolationExceptionPaginatedContent = PaginatedContentProps< Immutable, @@ -44,7 +44,7 @@ type HostIsolationExceptionPaginatedContent = PaginatedContentProps< export const HostIsolationExceptionsList = () => { const history = useHistory(); - const privileges = useEndpointPrivileges(); + const privileges = useUserPrivileges().endpointPrivileges; const location = useHostIsolationExceptionsSelector(getCurrentLocation); const navigateCallback = useHostIsolationExceptionsNavigateCallback(); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/empty/policy_trusted_apps_empty_unassigned.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/empty/policy_trusted_apps_empty_unassigned.tsx index 3252c5a27d85d..3a7308fef75f1 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/empty/policy_trusted_apps_empty_unassigned.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/empty/policy_trusted_apps_empty_unassigned.tsx @@ -10,7 +10,7 @@ import { EuiEmptyPrompt, EuiButton, EuiPageTemplate, EuiLink } from '@elastic/eu import { FormattedMessage } from '@kbn/i18n-react'; import { usePolicyDetailsNavigateCallback } from '../../policy_hooks'; import { useGetLinkTo } from './use_policy_trusted_apps_empty_hooks'; -import { useEndpointPrivileges } from '../../../../../../common/components/user_privileges/endpoint/use_endpoint_privileges'; +import { useUserPrivileges } from '../../../../../../common/components/user_privileges'; interface CommonProps { policyId: string; @@ -18,7 +18,7 @@ interface CommonProps { } export const PolicyTrustedAppsEmptyUnassigned = memo(({ policyId, policyName }) => { - const { isPlatinumPlus } = useEndpointPrivileges(); + const { canCreateArtifactsByPolicy } = useUserPrivileges().endpointPrivileges; const navigateCallback = usePolicyDetailsNavigateCallback(); const { onClickHandler, toRouteUrl } = useGetLinkTo(policyId, policyName); const onClickPrimaryButtonHandler = useCallback( @@ -49,7 +49,7 @@ export const PolicyTrustedAppsEmptyUnassigned = memo(({ policyId, p /> } actions={[ - ...(isPlatinumPlus + ...(canCreateArtifactsByPolicy ? [ { it('should hide assign button on empty state with unassigned policies when downgraded to a gold or below license', async () => { mockUseEndpointPrivileges.mockReturnValue( getEndpointPrivilegesInitialStateMock({ - isPlatinumPlus: false, + canCreateArtifactsByPolicy: false, }) ); const component = render(); @@ -184,7 +184,7 @@ describe('Policy trusted apps layout', () => { it('should hide the `Assign trusted applications` button when there is data and the license is downgraded to gold or below', async () => { mockUseEndpointPrivileges.mockReturnValue( getEndpointPrivilegesInitialStateMock({ - isPlatinumPlus: false, + canCreateArtifactsByPolicy: false, }) ); const component = render(); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.tsx index f39b080e56e30..3cf8e60c5e168 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.tsx @@ -32,10 +32,10 @@ import { import { usePolicyDetailsNavigateCallback, usePolicyDetailsSelector } from '../../policy_hooks'; import { PolicyTrustedAppsFlyout } from '../flyout'; import { PolicyTrustedAppsList } from '../list/policy_trusted_apps_list'; -import { useEndpointPrivileges } from '../../../../../../common/components/user_privileges/endpoint/use_endpoint_privileges'; import { useAppUrl } from '../../../../../../common/lib/kibana'; import { APP_UI_ID } from '../../../../../../../common/constants'; import { getTrustedAppsListPath } from '../../../../../common/routing'; +import { useUserPrivileges } from '../../../../../../common/components/user_privileges'; export const PolicyTrustedAppsLayout = React.memo(() => { const { getAppUrl } = useAppUrl(); @@ -44,7 +44,7 @@ export const PolicyTrustedAppsLayout = React.memo(() => { const isDoesTrustedAppExistsLoading = usePolicyDetailsSelector(doesTrustedAppExistsLoading); const policyItem = usePolicyDetailsSelector(policyDetails); const navigateCallback = usePolicyDetailsNavigateCallback(); - const { isPlatinumPlus } = useEndpointPrivileges(); + const { canCreateArtifactsByPolicy } = useUserPrivileges().endpointPrivileges; const totalAssignedCount = usePolicyDetailsSelector(getTotalPolicyTrustedAppsListPagination); const hasTrustedApps = usePolicyDetailsSelector(getHasTrustedApps); const isLoadedHasTrustedApps = usePolicyDetailsSelector(getIsLoadedHasTrustedApps); @@ -138,7 +138,9 @@ export const PolicyTrustedAppsLayout = React.memo(() => { - {isPlatinumPlus && assignTrustedAppButton} + + {canCreateArtifactsByPolicy && assignTrustedAppButton} + @@ -169,7 +171,7 @@ export const PolicyTrustedAppsLayout = React.memo(() => { )} - {isPlatinumPlus && showListFlyout ? : null} + {canCreateArtifactsByPolicy && showListFlyout ? : null} ) : null; }); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.test.tsx index 7410dd20d9286..32568ec2b48ee 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.test.tsx @@ -16,14 +16,12 @@ import { policyDetailsPageAllApiHttpMocks } from '../../../test_utils'; import { isFailedResourceState, isLoadedResourceState } from '../../../../../state'; import { fireEvent, within, act, waitFor } from '@testing-library/react'; import { APP_UI_ID } from '../../../../../../../common/constants'; -import { - EndpointPrivileges, - useEndpointPrivileges, -} from '../../../../../../common/components/user_privileges/endpoint/use_endpoint_privileges'; +import { useUserPrivileges } from '../../../../../../common/components/user_privileges'; import { getEndpointPrivilegesInitialStateMock } from '../../../../../../common/components/user_privileges/endpoint/mocks'; +import { EndpointPrivileges } from '../../../../../../../common/endpoint/types'; -jest.mock('../../../../../../common/components/user_privileges/endpoint/use_endpoint_privileges'); -const mockUseEndpointPrivileges = useEndpointPrivileges as jest.Mock; +jest.mock('../../../../../../common/components/user_privileges'); +const mockUseUserPrivileges = useUserPrivileges as jest.Mock; describe('when rendering the PolicyTrustedAppsList', () => { // The index (zero based) of the card created by the generator that is policy specific @@ -78,11 +76,14 @@ describe('when rendering the PolicyTrustedAppsList', () => { }; afterAll(() => { - mockUseEndpointPrivileges.mockReset(); + mockUseUserPrivileges.mockReset(); }); beforeEach(() => { appTestContext = createAppRootMockRenderer(); - mockUseEndpointPrivileges.mockReturnValue(loadedUserEndpointPrivilegesState()); + mockUseUserPrivileges.mockReturnValue({ + ...mockUseUserPrivileges(), + endpointPrivileges: loadedUserEndpointPrivilegesState(), + }); mockedApis = policyDetailsPageAllApiHttpMocks(appTestContext.coreStart.http); appTestContext.setExperimentalFlag({ trustedAppsByPolicyEnabled: true }); @@ -317,11 +318,12 @@ describe('when rendering the PolicyTrustedAppsList', () => { }); it('does not show remove option in actions menu if license is downgraded to gold or below', async () => { - mockUseEndpointPrivileges.mockReturnValue( - loadedUserEndpointPrivilegesState({ - isPlatinumPlus: false, - }) - ); + mockUseUserPrivileges.mockReturnValue({ + ...mockUseUserPrivileges(), + endpointPrivileges: loadedUserEndpointPrivilegesState({ + canCreateArtifactsByPolicy: false, + }), + }); await render(); await toggleCardActionMenu(POLICY_SPECIFIC_CARD_INDEX); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.tsx index 3453bc529b272..fa4d4e40b3e52 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.tsx @@ -38,7 +38,7 @@ import { ContextMenuItemNavByRouterProps } from '../../../../../components/conte import { ArtifactEntryCollapsibleCardProps } from '../../../../../components/artifact_entry_card'; import { useTestIdGenerator } from '../../../../../components/hooks/use_test_id_generator'; import { RemoveTrustedAppFromPolicyModal } from './remove_trusted_app_from_policy_modal'; -import { useEndpointPrivileges } from '../../../../../../common/components/user_privileges/endpoint/use_endpoint_privileges'; +import { useUserPrivileges } from '../../../../../../common/components/user_privileges'; const DATA_TEST_SUBJ = 'policyTrustedAppsGrid'; @@ -52,7 +52,7 @@ export const PolicyTrustedAppsList = memo( const toasts = useToasts(); const history = useHistory(); const { getAppUrl } = useAppUrl(); - const { isPlatinumPlus } = useEndpointPrivileges(); + const { canCreateArtifactsByPolicy } = useUserPrivileges().endpointPrivileges; const policyId = usePolicyDetailsSelector(policyIdFromParams); const isLoading = usePolicyDetailsSelector(isPolicyTrustedAppListLoading); const defaultFilter = usePolicyDetailsSelector(getCurrentPolicyArtifactsFilter); @@ -158,7 +158,7 @@ export const PolicyTrustedAppsList = memo( ]; const thisTrustedAppCardProps: ArtifactCardGridCardComponentProps = { expanded: Boolean(isCardExpanded[trustedApp.id]), - actions: isPlatinumPlus + actions: canCreateArtifactsByPolicy ? [ ...fullDetailsAction, { @@ -194,7 +194,14 @@ export const PolicyTrustedAppsList = memo( } return newCardProps; - }, [allPoliciesById, getAppUrl, getTestId, isCardExpanded, trustedAppItems, isPlatinumPlus]); + }, [ + allPoliciesById, + getAppUrl, + getTestId, + isCardExpanded, + trustedAppItems, + canCreateArtifactsByPolicy, + ]); const provideCardProps = useCallback['cardComponentProps']>( (item) => { diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx index 2539490be16fb..33fd1918dad59 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx @@ -17,10 +17,7 @@ import { UseMessagesStorage, } from '../../common/containers/local_storage/use_messages_storage'; import { Overview } from './index'; -import { - initialUserPrivilegesState, - useUserPrivileges, -} from '../../common/components/user_privileges'; +import { useUserPrivileges } from '../../common/components/user_privileges'; import { useSourcererDataView } from '../../common/containers/sourcerer'; import { useFetchIndex } from '../../common/containers/source'; import { useIsThreatIntelModuleEnabled } from '../containers/overview_cti_links/use_is_threat_intel_module_enabled'; @@ -30,9 +27,10 @@ import { mockCtiLinksResponse, } from '../components/overview_cti_links/mock'; import { useCtiDashboardLinks } from '../containers/overview_cti_links'; -import { EndpointPrivileges } from '../../common/components/user_privileges/endpoint/use_endpoint_privileges'; import { useIsExperimentalFeatureEnabled } from '../../common/hooks/use_experimental_features'; import { useHostsRiskScore } from '../containers/overview_risky_host_links/use_hosts_risk_score'; +import { initialUserPrivilegesState } from '../../common/components/user_privileges/user_privileges_context'; +import { EndpointPrivileges } from '../../../common/endpoint/types'; jest.mock('../../common/lib/kibana'); jest.mock('../../common/containers/source'); diff --git a/x-pack/plugins/security_solution/server/endpoint/mocks.ts b/x-pack/plugins/security_solution/server/endpoint/mocks.ts index 9b9d72805425a..dce08e2522beb 100644 --- a/x-pack/plugins/security_solution/server/endpoint/mocks.ts +++ b/x-pack/plugins/security_solution/server/endpoint/mocks.ts @@ -17,9 +17,8 @@ import { createMockAgentPolicyService, createMockAgentService, createArtifactsClientMock, - createFleetAuthzMock, } from '../../../fleet/server/mocks'; -import { createMockConfig } from '../lib/detection_engine/routes/__mocks__'; +import { createMockConfig, requestContextMock } from '../lib/detection_engine/routes/__mocks__'; import { EndpointAppContextService, EndpointAppContextServiceSetupContract, @@ -40,6 +39,7 @@ import { parseExperimentalConfigValue } from '../../common/experimental_features import { createCasesClientMock } from '../../../cases/server/client/mocks'; import { requestContextFactoryMock } from '../request_context_factory.mock'; import { EndpointMetadataService } from './services/metadata'; +import { createFleetAuthzMock } from '../../../fleet/common'; /** * Creates a mocked EndpointAppContext. @@ -183,8 +183,7 @@ export function createRouteHandlerContext( dataClient: jest.Mocked, savedObjectsClient: jest.Mocked ) { - const context = - xpackMocks.createRequestHandlerContext() as unknown as jest.Mocked; + const context = requestContextMock.create() as jest.Mocked; context.core.elasticsearch.client = dataClient; context.core.savedObjects.client = savedObjectsClient; return context; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.test.ts index 29a4e5ce0b299..bd72c5a4044ee 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.test.ts @@ -48,6 +48,7 @@ import { EndpointDocGenerator } from '../../../../common/endpoint/generate_data' import { legacyMetadataSearchResponseMock } from '../metadata/support/test_support'; import { AGENT_ACTIONS_INDEX, ElasticsearchAssetType } from '../../../../../fleet/common'; import { CasesClientMock } from '../../../../../cases/server/client/mocks'; +import { EndpointAuthz } from '../../../../common/endpoint/types/authz'; interface CallRouteInterface { body?: HostIsolationRequestBody; @@ -55,6 +56,7 @@ interface CallRouteInterface { searchResponse?: HostMetadata; mockUser?: any; license?: License; + authz?: Partial; } const Platinum = licenseMock.createLicense({ license: { type: 'platinum', mode: 'platinum' } }); @@ -182,7 +184,7 @@ describe('Host Isolation', () => { // it returns the requestContext mock used in the call, to assert internal calls (e.g. the indexed document) callRoute = async ( routePrefix: string, - { body, idxResponse, searchResponse, mockUser, license }: CallRouteInterface, + { body, idxResponse, searchResponse, mockUser, license, authz = {} }: CallRouteInterface, indexExists?: { endpointDsExists: boolean } ): Promise> => { const asUser = mockUser ? mockUser : superUser; @@ -191,6 +193,12 @@ describe('Host Isolation', () => { ); const ctx = createRouteHandlerContext(mockScopedClient, mockSavedObjectClient); + + ctx.securitySolution.endpointAuthz = { + ...ctx.securitySolution.endpointAuthz, + ...authz, + }; + // mock _index_template ctx.core.elasticsearch.client.asInternalUser.indices.existsIndexTemplate = jest .fn() @@ -206,6 +214,7 @@ describe('Host Isolation', () => { statusCode: 404, }); }); + const withIdxResp = idxResponse ? idxResponse : { statusCode: 201 }; const mockIndexResponse = jest.fn().mockImplementation(() => Promise.resolve(withIdxResp)); const mockSearchResponse = jest @@ -213,19 +222,25 @@ describe('Host Isolation', () => { .mockImplementation(() => Promise.resolve({ body: legacyMetadataSearchResponseMock(searchResponse) }) ); + if (indexExists) { ctx.core.elasticsearch.client.asInternalUser.index = mockIndexResponse; } + ctx.core.elasticsearch.client.asCurrentUser.index = mockIndexResponse; ctx.core.elasticsearch.client.asCurrentUser.search = mockSearchResponse; + const withLicense = license ? license : Platinum; licenseEmitter.next(withLicense); + const mockRequest = httpServerMock.createKibanaRequest({ body }); const [, routeHandler]: [ RouteConfig, RequestHandler ] = routerMock.post.mock.calls.find(([{ path }]) => path.startsWith(routePrefix))!; + await routeHandler(ctx, mockRequest, mockResponse); + return ctx as unknown as jest.Mocked; }; }); @@ -424,14 +439,17 @@ describe('Host Isolation', () => { }); expect(mockResponse.ok).toBeCalled(); }); - it('prohibits license levels less than platinum from isolating hosts', async () => { - licenseEmitter.next(Gold); + + it('prohibits isolating hosts if no authz for it', async () => { await callRoute(ISOLATE_HOST_ROUTE, { body: { endpoint_ids: ['XYZ'] }, + authz: { canIsolateHost: false }, license: Gold, }); + expect(mockResponse.forbidden).toBeCalled(); }); + it('allows any license level to unisolate', async () => { licenseEmitter.next(Gold); await callRoute(UNISOLATE_HOST_ROUTE, { @@ -442,37 +460,33 @@ describe('Host Isolation', () => { }); }); - describe('User Level', () => { - it('allows superuser to perform isolation', async () => { - const superU = { username: 'foo', roles: ['superuser'] }; + describe('User Authorization Level', () => { + it('allows user to perform isolation when canIsolateHost is true', async () => { await callRoute(ISOLATE_HOST_ROUTE, { body: { endpoint_ids: ['XYZ'] }, - mockUser: superU, }); expect(mockResponse.ok).toBeCalled(); }); - it('allows superuser to perform unisolation', async () => { - const superU = { username: 'foo', roles: ['superuser'] }; + + it('allows user to perform unisolation when canUnIsolateHost is true', async () => { await callRoute(UNISOLATE_HOST_ROUTE, { body: { endpoint_ids: ['XYZ'] }, - mockUser: superU, }); expect(mockResponse.ok).toBeCalled(); }); - it('prohibits non-admin user from performing isolation', async () => { - const superU = { username: 'foo', roles: ['user'] }; + it('prohibits user from performing isolation if canIsolateHost is false', async () => { await callRoute(ISOLATE_HOST_ROUTE, { body: { endpoint_ids: ['XYZ'] }, - mockUser: superU, + authz: { canIsolateHost: false }, }); expect(mockResponse.forbidden).toBeCalled(); }); - it('prohibits non-admin user from performing unisolation', async () => { - const superU = { username: 'foo', roles: ['user'] }; + + it('prohibits user from performing un-isolation if canUnIsolateHost is false', async () => { await callRoute(UNISOLATE_HOST_ROUTE, { body: { endpoint_ids: ['XYZ'] }, - mockUser: superU, + authz: { canUnIsolateHost: false }, }); expect(mockResponse.forbidden).toBeCalled(); }); diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.ts b/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.ts index 02f0cb4867646..51f88730eb6fd 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.ts @@ -33,7 +33,6 @@ import { import { getMetadataForEndpoints } from '../../services'; import { EndpointAppContext } from '../../types'; import { APP_ID } from '../../../../common/constants'; -import { userCanIsolate } from '../../../../common/endpoint/actions'; import { doLogsEndpointActionDsExists } from '../../utils'; /** @@ -100,25 +99,20 @@ export const isolationRequestHandler = function ( SecuritySolutionRequestHandlerContext > { return async (context, req, res) => { - // only allow admin users - const user = endpointContext.service.security?.authc.getCurrentUser(req); - if (!userCanIsolate(user?.roles)) { - return res.forbidden({ - body: { - message: 'You do not have permission to perform this action', - }, - }); - } + const { canIsolateHost, canUnIsolateHost } = context.securitySolution.endpointAuthz; - // isolation requires plat+ - if (isolate && !endpointContext.service.getLicenseService()?.isPlatinumPlus()) { + // Ensure user has authorization to use this api + if ((!canIsolateHost && isolate) || (!canUnIsolateHost && !isolate)) { return res.forbidden({ body: { - message: 'Your license level does not allow for this action', + message: + 'You do not have permission to perform this action or license level does not allow for this action', }, }); } + const user = endpointContext.service.security?.authc.getCurrentUser(req); + // fetch the Agent IDs to send the commands to const endpointIDs = [...new Set(req.body.endpoint_ids)]; // dedupe const endpointData = await getMetadataForEndpoints(endpointIDs, context); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts index 86bba69699195..8abe054daeaf5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts @@ -30,6 +30,7 @@ import type { SecuritySolutionApiRequestHandlerContext, SecuritySolutionRequestHandlerContext, } from '../../../../types'; +import { getEndpointAuthzInitialStateMock } from '../../../../../common/endpoint/service/authz'; const createMockClients = () => { const core = coreMock.createRequestHandlerContext(); @@ -93,6 +94,7 @@ const createSecuritySolutionRequestContextMock = ( return { core, + endpointAuthz: getEndpointAuthzInitialStateMock(), getConfig: jest.fn(() => clients.config), getFrameworkRequest: jest.fn(() => { return { diff --git a/x-pack/plugins/security_solution/server/request_context_factory.ts b/x-pack/plugins/security_solution/server/request_context_factory.ts index f6c1d6b44eca6..d4adf55004389 100644 --- a/x-pack/plugins/security_solution/server/request_context_factory.ts +++ b/x-pack/plugins/security_solution/server/request_context_factory.ts @@ -17,7 +17,18 @@ import { SecuritySolutionPluginCoreSetupDependencies, SecuritySolutionPluginSetupDependencies, } from './plugin_contract'; -import { SecuritySolutionApiRequestHandlerContext } from './types'; +import { + SecuritySolutionApiRequestHandlerContext, + SecuritySolutionRequestHandlerContext, +} from './types'; +import { Immutable } from '../common/endpoint/types'; +import { EndpointAuthz } from '../common/endpoint/types/authz'; +import { + calculateEndpointAuthz, + getEndpointAuthzInitialState, +} from '../common/endpoint/service/authz'; +import { licenseService } from './lib/license'; +import { FleetAuthz } from '../../fleet/common'; export interface IRequestContextFactory { create( @@ -41,7 +52,7 @@ export class RequestContextFactory implements IRequestContextFactory { } public async create( - context: RequestHandlerContext, + context: Omit, request: KibanaRequest ): Promise { const { options, appClientFactory } = this; @@ -55,9 +66,31 @@ export class RequestContextFactory implements IRequestContextFactory { config, }); + let endpointAuthz: Immutable; + let fleetAuthz: FleetAuthz; + + // If Fleet is enabled, then get its Authz + if (startPlugins.fleet) { + fleetAuthz = context.fleet?.authz ?? (await startPlugins.fleet?.authz.fromRequest(request)); + } + return { core: context.core, + get endpointAuthz(): Immutable { + // Lazy getter of endpoint Authz. No point in defining it if it is never used. + if (!endpointAuthz) { + // If no fleet (fleet plugin is optional in the configuration), then just turn off all permissions + if (!startPlugins.fleet) { + endpointAuthz = getEndpointAuthzInitialState(); + } else { + endpointAuthz = calculateEndpointAuthz(licenseService, fleetAuthz); + } + } + + return endpointAuthz; + }, + getConfig: () => config, getFrameworkRequest: () => frameworkRequest, diff --git a/x-pack/plugins/security_solution/server/types.ts b/x-pack/plugins/security_solution/server/types.ts index 82616aa36d27e..75686d7834070 100644 --- a/x-pack/plugins/security_solution/server/types.ts +++ b/x-pack/plugins/security_solution/server/types.ts @@ -17,10 +17,12 @@ import { AppClient } from './client'; import { ConfigType } from './config'; import { IRuleExecutionLogClient } from './lib/detection_engine/rule_execution_log/types'; import { FrameworkRequest } from './lib/framework'; +import { EndpointAuthz } from '../common/endpoint/types/authz'; export { AppClient }; export interface SecuritySolutionApiRequestHandlerContext extends RequestHandlerContext { + endpointAuthz: EndpointAuthz; getConfig: () => ConfigType; getFrameworkRequest: () => FrameworkRequest; getAppClient: () => AppClient; From 7fb9dee206e045520a1f271f48f498b010340639 Mon Sep 17 00:00:00 2001 From: Miriam <31922082+MiriamAparicio@users.noreply.github.com> Date: Fri, 3 Dec 2021 16:24:16 +0000 Subject: [PATCH 26/62] Rename error rate to failed transactions rate (#120255) * Rename error rate to failed transactions rate * Fix conflict --- ..._error_rate.ts => get_failed_transaction_rate.ts} | 12 ++++++++---- .../service_map/get_service_map_service_node_info.ts | 4 ++-- .../plugins/apm/server/routes/transactions/route.ts | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) rename x-pack/plugins/apm/server/lib/transaction_groups/{get_error_rate.ts => get_failed_transaction_rate.ts} (94%) diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts b/x-pack/plugins/apm/server/lib/transaction_groups/get_failed_transaction_rate.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts rename to x-pack/plugins/apm/server/lib/transaction_groups/get_failed_transaction_rate.ts index e1dde61bfc3ff..b4f2c4b4bee11 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/get_failed_transaction_rate.ts @@ -32,7 +32,7 @@ import { getFailedTransactionRateTimeSeries, } from '../helpers/transaction_error_rate'; -export async function getErrorRate({ +export async function getFailedTransactionRate({ environment, kuery, serviceName, @@ -122,7 +122,7 @@ export async function getErrorRate({ return { timeseries, average }; } -export async function getErrorRatePeriods({ +export async function getFailedTransactionRatePeriods({ environment, kuery, serviceName, @@ -157,11 +157,15 @@ export async function getErrorRatePeriods({ searchAggregatedTransactions, }; - const currentPeriodPromise = getErrorRate({ ...commonProps, start, end }); + const currentPeriodPromise = getFailedTransactionRate({ + ...commonProps, + start, + end, + }); const previousPeriodPromise = comparisonStart && comparisonEnd - ? getErrorRate({ + ? getFailedTransactionRate({ ...commonProps, start: comparisonStart, end: comparisonEnd, diff --git a/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts index ad2ab74098c22..545fb4dbc4606 100644 --- a/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts @@ -29,7 +29,7 @@ import { getDurationFieldForTransactions, getProcessorEventForTransactions, } from '../../lib/helpers/transactions'; -import { getErrorRate } from '../../lib/transaction_groups/get_error_rate'; +import { getFailedTransactionRate } from '../../lib/transaction_groups/get_failed_transaction_rate'; import { withApmSpan } from '../../utils/with_apm_span'; import { percentCgroupMemoryUsedScript, @@ -123,7 +123,7 @@ async function getFailedTransactionsRateStats({ numBuckets, }: TaskParameters): Promise { return withApmSpan('get_error_rate_for_service_map_node', async () => { - const { average, timeseries } = await getErrorRate({ + const { average, timeseries } = await getFailedTransactionRate({ environment, setup, serviceName, diff --git a/x-pack/plugins/apm/server/routes/transactions/route.ts b/x-pack/plugins/apm/server/routes/transactions/route.ts index fb73fe1555965..b9db2762bce93 100644 --- a/x-pack/plugins/apm/server/routes/transactions/route.ts +++ b/x-pack/plugins/apm/server/routes/transactions/route.ts @@ -19,7 +19,7 @@ import { getServiceTransactionGroupDetailedStatisticsPeriods } from '../services import { getTransactionBreakdown } from './breakdown'; import { getTransactionTraceSamples } from './trace_samples'; import { getLatencyPeriods } from './get_latency_charts'; -import { getErrorRatePeriods } from '../../lib/transaction_groups/get_error_rate'; +import { getFailedTransactionRatePeriods } from '../../lib/transaction_groups/get_failed_transaction_rate'; import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; import { @@ -349,7 +349,7 @@ const transactionChartsErrorRateRoute = createApmServerRoute({ end, }); - return getErrorRatePeriods({ + return getFailedTransactionRatePeriods({ environment, kuery, serviceName, From 80660f168676604791870f91fe8eaf691ed75808 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Fri, 3 Dec 2021 08:27:41 -0800 Subject: [PATCH 27/62] [Fleet] Renable skipped test for limited packages (#120293) * Renable skipped test for limited packages * Try with newer endpoint package version. Test pass locally... --- .../fleet_api_integration/apis/package_policy/create.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 d568e7224fd20..1815ab91b5316 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 @@ -199,8 +199,7 @@ export default function (providerContext: FtrProviderContext) { .expect(400); }); - // https://github.com/elastic/kibana/issues/118257 - it.skip('should not allow multiple limited packages on the same agent policy', async function () { + it('should not allow multiple limited packages on the same agent policy', async function () { await supertest .post(`/api/fleet/package_policies`) .set('kbn-xsrf', 'xxxx') @@ -215,7 +214,7 @@ export default function (providerContext: FtrProviderContext) { package: { name: 'endpoint', title: 'Endpoint', - version: '0.13.0', + version: '1.3.0-dev.0', }, }) .expect(200); @@ -233,7 +232,7 @@ export default function (providerContext: FtrProviderContext) { package: { name: 'endpoint', title: 'Endpoint', - version: '0.13.0', + version: '1.3.0-dev.0', }, }) .expect(400); From c7a06cdcbf844cdfecdbf9856c891915e124f3e3 Mon Sep 17 00:00:00 2001 From: Kyle Pollich Date: Fri, 3 Dec 2021 11:58:56 -0500 Subject: [PATCH 28/62] [Fleet] Wire Fleet setup status to core Kibana status API (#120020) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Wire Fleet setup status to core Kibana status API * Remove fake error from testing 🙃 * Apply suggestion for PR review Co-authored-by: Josh Dover <1813008+joshdover@users.noreply.github.com> * Add error message to meta upon Fleet setup failure * Mark fleet as available if setup fails - for now * Fix failing API key tests Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Josh Dover <1813008+joshdover@users.noreply.github.com> --- x-pack/plugins/fleet/server/plugin.ts | 37 ++++++++++++++++++- .../functional/apps/api_keys/home_page.ts | 3 ++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/server/plugin.ts b/x-pack/plugins/fleet/server/plugin.ts index 4b45cf645201c..1e421fefce835 100644 --- a/x-pack/plugins/fleet/server/plugin.ts +++ b/x-pack/plugins/fleet/server/plugin.ts @@ -6,6 +6,7 @@ */ import type { Observable } from 'rxjs'; +import { BehaviorSubject } from 'rxjs'; import type { CoreSetup, CoreStart, @@ -16,13 +17,18 @@ import type { SavedObjectsServiceStart, HttpServiceSetup, KibanaRequest, + ServiceStatus, ElasticsearchClient, } 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, SavedObjectsClient } from '../../../../src/core/server'; +import { + DEFAULT_APP_CATEGORIES, + SavedObjectsClient, + ServiceStatusLevels, +} from '../../../../src/core/server'; import type { PluginStart as DataPluginStart } from '../../../../src/plugins/data/server'; import type { LicensingPluginSetup, ILicense } from '../../licensing/server'; import type { @@ -182,6 +188,7 @@ export class FleetPlugin private securitySetup?: SecurityPluginSetup; private encryptedSavedObjectsSetup?: EncryptedSavedObjectsPluginSetup; private readonly telemetryEventsSender: TelemetryEventsSender; + private readonly fleetStatus$: BehaviorSubject; private agentService?: AgentService; @@ -193,6 +200,11 @@ export class FleetPlugin this.logger = this.initializerContext.logger.get(); this.configInitialValue = this.initializerContext.config.get(); this.telemetryEventsSender = new TelemetryEventsSender(this.logger.get('telemetry_events')); + + this.fleetStatus$ = new BehaviorSubject({ + level: ServiceStatusLevels.unavailable, + summary: 'Fleet is unavailable', + }); } public setup(core: CoreSetup, deps: FleetSetupDeps) { @@ -203,6 +215,8 @@ export class FleetPlugin this.securitySetup = deps.security; const config = this.configInitialValue; + core.status.set(this.fleetStatus$.asObservable()); + registerSavedObjects(core.savedObjects, deps.encryptedSavedObjects); registerEncryptedSavedObjects(deps.encryptedSavedObjects); @@ -357,13 +371,33 @@ export class FleetPlugin const fleetSetupPromise = (async () => { try { + this.fleetStatus$.next({ + level: ServiceStatusLevels.degraded, + summary: 'Fleet is setting up', + }); + await setupFleet( new SavedObjectsClient(core.savedObjects.createInternalRepository()), core.elasticsearch.client.asInternalUser ); + + this.fleetStatus$.next({ + level: ServiceStatusLevels.available, + summary: 'Fleet is available', + }); } catch (error) { logger.warn('Fleet setup failed'); logger.warn(error); + + this.fleetStatus$.next({ + // As long as Fleet has a dependency on EPR, we can't reliably set Kibana status to `unavailable` here. + // See https://github.com/elastic/kibana/issues/120237 + level: ServiceStatusLevels.available, + summary: 'Fleet setup failed', + meta: { + error: error.message, + }, + }); } })(); @@ -400,6 +434,7 @@ export class FleetPlugin appContextService.stop(); licenseService.stop(); this.telemetryEventsSender.stop(); + this.fleetStatus$.complete(); } private setupAgentService(internalEsClient: ElasticsearchClient): AgentService { diff --git a/x-pack/test/functional/apps/api_keys/home_page.ts b/x-pack/test/functional/apps/api_keys/home_page.ts index 5907247527585..c2dbcc1046f54 100644 --- a/x-pack/test/functional/apps/api_keys/home_page.ts +++ b/x-pack/test/functional/apps/api_keys/home_page.ts @@ -42,6 +42,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await security.testUser.setRoles(['kibana_admin']); await security.testUser.setRoles(['test_api_keys']); await pageObjects.common.navigateToApp('apiKeys'); + + // Delete any API keys created outside of these tests + await pageObjects.apiKeys.bulkDeleteApiKeys(); }); afterEach(async () => { From ffbe19cf4658ad64f274bd913a43465162da70a5 Mon Sep 17 00:00:00 2001 From: Yaroslav Kuznietsov Date: Fri, 3 Dec 2021 19:26:03 +0200 Subject: [PATCH 29/62] [Canvas] Added KibanaThemeProvider to expression_reveal_image. (#120094) * Added kibanaThemeProvider to expression_reveal_image. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../expression_reveal_image/kibana.json | 2 +- .../reveal_image_renderer.stories.tsx | 4 +- .../public/expression_renderers/index.ts | 6 +- .../reveal_image_renderer.tsx | 55 +++++++++++-------- .../expression_reveal_image/public/index.ts | 5 +- .../expression_reveal_image/public/plugin.ts | 4 +- .../canvas_plugin_src/renderers/external.ts | 10 +--- .../shareable_runtime/supported_renderers.js | 4 +- 8 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/plugins/expression_reveal_image/kibana.json b/src/plugins/expression_reveal_image/kibana.json index dad7fdfe2bc5f..5fb13ce31247b 100755 --- a/src/plugins/expression_reveal_image/kibana.json +++ b/src/plugins/expression_reveal_image/kibana.json @@ -11,5 +11,5 @@ "ui": true, "requiredPlugins": ["expressions", "presentationUtil"], "optionalPlugins": [], - "requiredBundles": [] + "requiredBundles": ["kibanaReact"] } diff --git a/src/plugins/expression_reveal_image/public/expression_renderers/__stories__/reveal_image_renderer.stories.tsx b/src/plugins/expression_reveal_image/public/expression_renderers/__stories__/reveal_image_renderer.stories.tsx index 863d8d1000f38..22dd2ef4156df 100644 --- a/src/plugins/expression_reveal_image/public/expression_renderers/__stories__/reveal_image_renderer.stories.tsx +++ b/src/plugins/expression_reveal_image/public/expression_renderers/__stories__/reveal_image_renderer.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; -import { revealImageRenderer } from '../'; +import { getRevealImageRenderer } from '../'; import { getElasticOutline, getElasticLogo } from '../../../../presentation_util/public'; import { Render, waitFor } from '../../../../presentation_util/public/__stories__'; import { Origin } from '../../../common/types/expression_functions'; @@ -26,7 +26,7 @@ const Renderer = ({ origin: Origin.LEFT, percent: 0.45, }; - return ; + return ; }; storiesOf('renderers/revealImage', module).add( diff --git a/src/plugins/expression_reveal_image/public/expression_renderers/index.ts b/src/plugins/expression_reveal_image/public/expression_renderers/index.ts index 433a81884f157..959a630b08b51 100644 --- a/src/plugins/expression_reveal_image/public/expression_renderers/index.ts +++ b/src/plugins/expression_reveal_image/public/expression_renderers/index.ts @@ -6,8 +6,4 @@ * Side Public License, v 1. */ -import { revealImageRenderer } from './reveal_image_renderer'; - -export const renderers = [revealImageRenderer]; - -export { revealImageRenderer }; +export { revealImageRendererFactory, getRevealImageRenderer } from './reveal_image_renderer'; diff --git a/src/plugins/expression_reveal_image/public/expression_renderers/reveal_image_renderer.tsx b/src/plugins/expression_reveal_image/public/expression_renderers/reveal_image_renderer.tsx index d4dec3a8a5825..6bdd014296419 100644 --- a/src/plugins/expression_reveal_image/public/expression_renderers/reveal_image_renderer.tsx +++ b/src/plugins/expression_reveal_image/public/expression_renderers/reveal_image_renderer.tsx @@ -7,10 +7,14 @@ */ import React, { lazy } from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; +import { Observable } from 'rxjs'; +import { CoreTheme } from 'kibana/public'; import { I18nProvider } from '@kbn/i18n-react'; import { ExpressionRenderDefinition, IInterpreterRenderHandlers } from 'src/plugins/expressions'; import { i18n } from '@kbn/i18n'; -import { withSuspense } from '../../../presentation_util/public'; +import { CoreSetup } from '../../../../core/public'; +import { KibanaThemeProvider } from '../../../kibana_react/public'; +import { withSuspense, defaultTheme$ } from '../../../presentation_util/public'; import { RevealImageRendererConfig } from '../../common/types'; export const strings = { @@ -27,25 +31,32 @@ export const strings = { const LazyRevealImageComponent = lazy(() => import('../components/reveal_image_component')); const RevealImageComponent = withSuspense(LazyRevealImageComponent, null); -export const revealImageRenderer = (): ExpressionRenderDefinition => ({ - name: 'revealImage', - displayName: strings.getDisplayName(), - help: strings.getHelpDescription(), - reuseDomNode: true, - render: ( - domNode: HTMLElement, - config: RevealImageRendererConfig, - handlers: IInterpreterRenderHandlers - ) => { - handlers.onDestroy(() => { - unmountComponentAtNode(domNode); - }); +export const getRevealImageRenderer = + (theme$: Observable = defaultTheme$) => + (): ExpressionRenderDefinition => ({ + name: 'revealImage', + displayName: strings.getDisplayName(), + help: strings.getHelpDescription(), + reuseDomNode: true, + render: ( + domNode: HTMLElement, + config: RevealImageRendererConfig, + handlers: IInterpreterRenderHandlers + ) => { + handlers.onDestroy(() => { + unmountComponentAtNode(domNode); + }); - render( - - - , - domNode - ); - }, -}); + render( + + + + + , + domNode + ); + }, + }); + +export const revealImageRendererFactory = (core: CoreSetup) => + getRevealImageRenderer(core.theme.theme$); diff --git a/src/plugins/expression_reveal_image/public/index.ts b/src/plugins/expression_reveal_image/public/index.ts index 66512a1126b06..736e062475e6a 100755 --- a/src/plugins/expression_reveal_image/public/index.ts +++ b/src/plugins/expression_reveal_image/public/index.ts @@ -6,9 +6,6 @@ * Side Public License, v 1. */ -// TODO: https://github.com/elastic/kibana/issues/110893 -/* eslint-disable @kbn/eslint/no_export_all */ - import { ExpressionRevealImagePlugin } from './plugin'; export type { ExpressionRevealImagePluginSetup, ExpressionRevealImagePluginStart } from './plugin'; @@ -17,4 +14,4 @@ export function plugin() { return new ExpressionRevealImagePlugin(); } -export * from './expression_renderers'; +export { revealImageRendererFactory, getRevealImageRenderer } from './expression_renderers'; diff --git a/src/plugins/expression_reveal_image/public/plugin.ts b/src/plugins/expression_reveal_image/public/plugin.ts index c5e1b5c8d916f..17bff3f33e8ac 100755 --- a/src/plugins/expression_reveal_image/public/plugin.ts +++ b/src/plugins/expression_reveal_image/public/plugin.ts @@ -8,7 +8,7 @@ import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; import { ExpressionsStart, ExpressionsSetup } from '../../expressions/public'; -import { revealImageRenderer } from './expression_renderers'; +import { revealImageRendererFactory } from './expression_renderers'; import { revealImageFunction } from '../common/expression_functions'; interface SetupDeps { @@ -33,7 +33,7 @@ export class ExpressionRevealImagePlugin { public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionRevealImagePluginSetup { expressions.registerFunction(revealImageFunction); - expressions.registerRenderer(revealImageRenderer); + expressions.registerRenderer(revealImageRendererFactory(core)); } public start(core: CoreStart): ExpressionRevealImagePluginStart {} diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts b/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts index 9e2a51065eb6c..569669032cb0b 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts @@ -11,23 +11,19 @@ import { errorRendererFactory, debugRendererFactory, } from '../../../../../src/plugins/expression_error/public'; +import { revealImageRendererFactory } from '../../../../../src/plugins/expression_reveal_image/public'; import { repeatImageRendererFactory } from '../../../../../src/plugins/expression_repeat_image/public'; -import { revealImageRenderer } from '../../../../../src/plugins/expression_reveal_image/public'; import { shapeRenderer, progressRenderer, } from '../../../../../src/plugins/expression_shape/public'; -export const renderFunctions = [ - imageRenderer, - revealImageRenderer, - shapeRenderer, - progressRenderer, -]; +export const renderFunctions = [imageRenderer, shapeRenderer, progressRenderer]; export const renderFunctionFactories = [ debugRendererFactory, errorRendererFactory, + revealImageRendererFactory, repeatImageRendererFactory, metricRendererFactory, ]; diff --git a/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js b/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js index 84150a6a9e82e..01b8cc98ba5ec 100644 --- a/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js +++ b/x-pack/plugins/canvas/shareable_runtime/supported_renderers.js @@ -15,8 +15,8 @@ import { getErrorRenderer, getDebugRenderer, } from '../../../../src/plugins/expression_error/public'; +import { getRevealImageRenderer } from '../../../../src/plugins/expression_reveal_image/public'; import { getRepeatImageRenderer } from '../../../../src/plugins/expression_repeat_image/public'; -import { revealImageRenderer as revealImage } from '../../../../src/plugins/expression_reveal_image/public'; import { shapeRenderer as shape, progressRenderer as progress, @@ -31,6 +31,7 @@ const renderFunctionsFactories = [ getTableRenderer, getErrorRenderer, getDebugRenderer, + getRevealImageRenderer, getRepeatImageRenderer, getMetricRenderer, ]; @@ -42,7 +43,6 @@ const renderFunctionsFactories = [ */ export const renderFunctions = [ image, - revealImage, pie, plot, progress, From 72765c9de4247161e2672abae4e4bfc0282cb5aa Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Fri, 3 Dec 2021 11:33:28 -0700 Subject: [PATCH 30/62] [maps] rename layer types provide more distinguishable names that better reflect layer (#118617) * [maps] rename layer types provide more distinguishable names that better refect layer * fix migration rename * revert extends change for EmsVectorTileLayer * tsling * fix regression and jest test * extend from Abstract instead of RasterTile * better fix * fix tests * more test fixes * update path for newly merged code Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../__mocks__/regions_layer.mock.ts | 4 +- .../VisitorBreakdownMap/useLayerList.ts | 4 +- .../choropleth_map.tsx | 2 +- x-pack/plugins/maps/common/constants.ts | 8 +- .../layer_descriptor_types.ts | 2 +- .../migrations/add_field_meta_options.js | 5 +- .../migrations/add_field_meta_options.test.js | 6 +- .../migrations/add_type_to_termjoin.test.ts | 4 +- .../ems_raster_tile_to_ems_vector_tile.js | 8 +- .../common/migrations/join_agg_key.test.ts | 3 +- .../maps/common/migrations/join_agg_key.ts | 3 +- .../migrate_symbol_style_descriptor.js | 5 +- .../migrate_symbol_style_descriptor.test.js | 8 +- .../migrations/rename_layer_types.test.ts | 83 +++++++++++++++++++ .../common/migrations/rename_layer_types.ts | 49 +++++++++++ .../public/actions/data_request_actions.ts | 2 +- .../create_basemap_layer_descriptor.test.ts | 4 +- .../layers/create_basemap_layer_descriptor.ts | 8 +- .../ems_vector_tile_layer.test.ts | 53 ++++++++++++ .../ems_vector_tile_layer.tsx} | 43 ++++++++-- .../raster_tile_layer.test.ts} | 12 ++- .../raster_tile_layer.ts} | 18 ++-- .../geojson_vector_layer.tsx | 2 +- .../mvt_vector_layer/mvt_vector_layer.tsx | 2 +- .../layers/vector_layer/vector_layer.tsx | 2 +- .../vector_tile_layer.test.ts | 75 ----------------- .../create_layer_descriptor.test.ts | 4 +- .../security/create_layer_descriptors.test.ts | 18 ++-- .../ems_base_map_layer_wizard.tsx | 6 +- .../update_source_editor.test.tsx | 2 +- .../update_source_editor.tsx | 8 +- .../es_search_source/util/scaling_form.tsx | 4 +- .../kibana_base_map_layer_wizard.tsx | 4 +- .../sources/wms_source/wms_layer_wizard.tsx | 4 +- .../sources/xyz_tms_source/layer_wizard.tsx | 4 +- .../edit_layer_panel.test.tsx | 2 +- .../connected_components/mb_map/utils.ts | 2 +- x-pack/plugins/maps/public/locators.test.ts | 4 +- .../public/selectors/map_selectors.test.ts | 4 +- .../maps/public/selectors/map_selectors.ts | 18 ++-- .../visualize_geo_field_action.ts | 2 +- .../maps/server/embeddable_migrations.ts | 13 +++ .../maps_telemetry/maps_telemetry.test.js | 2 +- .../server/maps_telemetry/maps_telemetry.ts | 2 +- .../sample_map_saved_objects.json | 8 +- .../maps/server/maps_telemetry/util.ts | 2 +- .../saved_objects/saved_object_migrations.js | 14 ++++ .../application/explorer/anomalies_map.tsx | 2 +- .../api_integration/apis/maps/migrations.js | 4 +- 49 files changed, 359 insertions(+), 189 deletions(-) create mode 100644 x-pack/plugins/maps/common/migrations/rename_layer_types.test.ts create mode 100644 x-pack/plugins/maps/common/migrations/rename_layer_types.ts create mode 100644 x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.test.ts rename x-pack/plugins/maps/public/classes/layers/{vector_tile_layer/vector_tile_layer.tsx => ems_vector_tile_layer/ems_vector_tile_layer.tsx} (93%) rename x-pack/plugins/maps/public/classes/layers/{tile_layer/tile_layer.test.ts => raster_tile_layer/raster_tile_layer.test.ts} (88%) rename x-pack/plugins/maps/public/classes/layers/{tile_layer/tile_layer.ts => raster_tile_layer/raster_tile_layer.ts} (92%) delete mode 100644 x-pack/plugins/maps/public/classes/layers/vector_tile_layer/vector_tile_layer.test.ts diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/__mocks__/regions_layer.mock.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/__mocks__/regions_layer.mock.ts index 52bd024d8116b..81b0a71e8d943 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/__mocks__/regions_layer.mock.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/__mocks__/regions_layer.mock.ts @@ -79,7 +79,7 @@ export const mockLayerList = [ maxZoom: 24, alpha: 0.75, visible: true, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', }, { joins: [ @@ -148,6 +148,6 @@ export const mockLayerList = [ maxZoom: 24, alpha: 0.75, visible: true, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', }, ]; 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 7f81e9d105186..f573a2641b864 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 @@ -155,7 +155,7 @@ export function useLayerList() { maxZoom: 24, alpha: 0.75, visible: true, - type: LAYER_TYPE.VECTOR, + type: LAYER_TYPE.GEOJSON_VECTOR, }; ES_TERM_SOURCE_REGION.whereQuery = getWhereQuery(serviceName!); @@ -179,7 +179,7 @@ export function useLayerList() { maxZoom: 24, alpha: 0.75, visible: true, - type: LAYER_TYPE.VECTOR, + type: LAYER_TYPE.GEOJSON_VECTOR, }; return [ diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/field_data_expanded_row/choropleth_map.tsx b/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/field_data_expanded_row/choropleth_map.tsx index 507bfc36d47f0..bf767c7e65207 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/field_data_expanded_row/choropleth_map.tsx +++ b/x-pack/plugins/data_visualizer/public/application/common/components/stats_table/components/field_data_expanded_row/choropleth_map.tsx @@ -87,7 +87,7 @@ export const getChoroplethTopValuesLayer = ( }, isTimeAware: true, }, - type: LAYER_TYPE.VECTOR, + type: LAYER_TYPE.GEOJSON_VECTOR, }; }; diff --git a/x-pack/plugins/maps/common/constants.ts b/x-pack/plugins/maps/common/constants.ts index 0f2ce2c917738..43cca5f0c6a07 100644 --- a/x-pack/plugins/maps/common/constants.ts +++ b/x-pack/plugins/maps/common/constants.ts @@ -49,12 +49,12 @@ export function getEditPath(id: string | undefined) { } export enum LAYER_TYPE { - TILE = 'TILE', - VECTOR = 'VECTOR', - VECTOR_TILE = 'VECTOR_TILE', // for static display of mvt vector tiles with a mapbox stylesheet. Does not support any ad-hoc configurations. Used for consuming EMS vector tiles. + RASTER_TILE = 'RASTER_TILE', + GEOJSON_VECTOR = 'GEOJSON_VECTOR', + EMS_VECTOR_TILE = 'EMS_VECTOR_TILE', HEATMAP = 'HEATMAP', BLENDED_VECTOR = 'BLENDED_VECTOR', - TILED_VECTOR = 'TILED_VECTOR', // similar to a regular vector-layer, but it consumes the data as .mvt tilea iso GeoJson. It supports similar ad-hoc configurations like a regular vector layer (E.g. using IVectorStyle), although there is some loss of functionality e.g. does not support term joining + MVT_VECTOR = 'MVT_VECTOR', } export enum SOURCE_TYPES { diff --git a/x-pack/plugins/maps/common/descriptor_types/layer_descriptor_types.ts b/x-pack/plugins/maps/common/descriptor_types/layer_descriptor_types.ts index 4d687969308bb..044678b918fde 100644 --- a/x-pack/plugins/maps/common/descriptor_types/layer_descriptor_types.ts +++ b/x-pack/plugins/maps/common/descriptor_types/layer_descriptor_types.ts @@ -66,7 +66,7 @@ export type LayerDescriptor = { }; export type VectorLayerDescriptor = LayerDescriptor & { - type: LAYER_TYPE.VECTOR | LAYER_TYPE.TILED_VECTOR | LAYER_TYPE.BLENDED_VECTOR; + type: LAYER_TYPE.GEOJSON_VECTOR | LAYER_TYPE.MVT_VECTOR | LAYER_TYPE.BLENDED_VECTOR; joins?: JoinDescriptor[]; style: VectorStyleDescriptor; }; diff --git a/x-pack/plugins/maps/common/migrations/add_field_meta_options.js b/x-pack/plugins/maps/common/migrations/add_field_meta_options.js index 33a98c7dbf33c..736fd30bfbcbb 100644 --- a/x-pack/plugins/maps/common/migrations/add_field_meta_options.js +++ b/x-pack/plugins/maps/common/migrations/add_field_meta_options.js @@ -6,11 +6,12 @@ */ import _ from 'lodash'; -import { LAYER_TYPE, STYLE_TYPE } from '../constants'; +import { STYLE_TYPE } from '../constants'; function isVectorLayer(layerDescriptor) { const layerType = _.get(layerDescriptor, 'type'); - return layerType === LAYER_TYPE.VECTOR; + // can not use LAYER_TYPE because LAYER_TYPE.VECTOR does not exist >8.1 + return layerType === 'VECTOR'; } export function addFieldMetaOptions({ attributes }) { diff --git a/x-pack/plugins/maps/common/migrations/add_field_meta_options.test.js b/x-pack/plugins/maps/common/migrations/add_field_meta_options.test.js index 31300707d147d..60587e56bdbae 100644 --- a/x-pack/plugins/maps/common/migrations/add_field_meta_options.test.js +++ b/x-pack/plugins/maps/common/migrations/add_field_meta_options.test.js @@ -41,7 +41,7 @@ describe('addFieldMetaOptions', () => { test('Should ignore static style properties', () => { const layerListJSON = JSON.stringify([ { - type: LAYER_TYPE.VECTOR, + type: 'VECTOR', style: { type: 'VECTOR', properties: { @@ -68,7 +68,7 @@ describe('addFieldMetaOptions', () => { test('Should add field meta options to dynamic style properties', () => { const layerListJSON = JSON.stringify([ { - type: LAYER_TYPE.VECTOR, + type: 'VECTOR', style: { type: 'VECTOR', properties: { @@ -94,7 +94,7 @@ describe('addFieldMetaOptions', () => { title: 'my map', layerListJSON: JSON.stringify([ { - type: LAYER_TYPE.VECTOR, + type: 'VECTOR', style: { type: 'VECTOR', properties: { diff --git a/x-pack/plugins/maps/common/migrations/add_type_to_termjoin.test.ts b/x-pack/plugins/maps/common/migrations/add_type_to_termjoin.test.ts index d795e63bf81d1..5229380ac55f4 100644 --- a/x-pack/plugins/maps/common/migrations/add_type_to_termjoin.test.ts +++ b/x-pack/plugins/maps/common/migrations/add_type_to_termjoin.test.ts @@ -6,14 +6,14 @@ */ import { addTypeToTermJoin } from './add_type_to_termjoin'; -import { LAYER_TYPE, SOURCE_TYPES } from '../constants'; +import { SOURCE_TYPES } from '../constants'; import { LayerDescriptor } from '../descriptor_types'; describe('addTypeToTermJoin', () => { test('Should handle missing type attribute', () => { const layerListJSON = JSON.stringify([ { - type: LAYER_TYPE.VECTOR, + type: 'VECTOR', joins: [ { right: {}, diff --git a/x-pack/plugins/maps/common/migrations/ems_raster_tile_to_ems_vector_tile.js b/x-pack/plugins/maps/common/migrations/ems_raster_tile_to_ems_vector_tile.js index 2945b9efed958..4cf5407d79691 100644 --- a/x-pack/plugins/maps/common/migrations/ems_raster_tile_to_ems_vector_tile.js +++ b/x-pack/plugins/maps/common/migrations/ems_raster_tile_to_ems_vector_tile.js @@ -6,7 +6,7 @@ */ import _ from 'lodash'; -import { SOURCE_TYPES, LAYER_TYPE } from '../constants'; +import { SOURCE_TYPES } from '../constants'; function isEmsTileSource(layerDescriptor) { const sourceType = _.get(layerDescriptor, 'sourceDescriptor.type'); @@ -15,7 +15,8 @@ function isEmsTileSource(layerDescriptor) { function isTileLayer(layerDescriptor) { const layerType = _.get(layerDescriptor, 'type'); - return layerType === LAYER_TYPE.TILE; + // can not use LAYER_TYPE because LAYER_TYPE.TILE does not exist >8.1 + return layerType === 'TILE'; } export function emsRasterTileToEmsVectorTile({ attributes }) { @@ -33,7 +34,8 @@ export function emsRasterTileToEmsVectorTile({ attributes }) { layerList.forEach((layer) => { if (isTileLayer(layer) && isEmsTileSource(layer)) { // Just need to switch layer type to migrate TILE layer to VECTOR_TILE layer - layer.type = LAYER_TYPE.VECTOR_TILE; + // can not use LAYER_TYPE because LAYER_TYPE.VECTOR_TILE does not exist >8.1 + layer.type = 'VECTOR_TILE'; } }); diff --git a/x-pack/plugins/maps/common/migrations/join_agg_key.test.ts b/x-pack/plugins/maps/common/migrations/join_agg_key.test.ts index 96d60e2f92385..3926c017a9502 100644 --- a/x-pack/plugins/maps/common/migrations/join_agg_key.test.ts +++ b/x-pack/plugins/maps/common/migrations/join_agg_key.test.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { LAYER_TYPE } from '../constants'; import { migrateJoinAggKey } from './join_agg_key'; describe('migrateJoinAggKey', () => { @@ -65,7 +64,7 @@ describe('migrateJoinAggKey', () => { test('Should migrate vector styles from legacy join agg key to new join agg key', () => { const layerListJSON = JSON.stringify([ { - type: LAYER_TYPE.VECTOR, + type: 'VECTOR', joins, style: { properties: { diff --git a/x-pack/plugins/maps/common/migrations/join_agg_key.ts b/x-pack/plugins/maps/common/migrations/join_agg_key.ts index 726855783be63..ae102f2ed540f 100644 --- a/x-pack/plugins/maps/common/migrations/join_agg_key.ts +++ b/x-pack/plugins/maps/common/migrations/join_agg_key.ts @@ -71,7 +71,8 @@ export function migrateJoinAggKey({ layerList.forEach((layerDescriptor: LayerDescriptor) => { if ( - layerDescriptor.type === LAYER_TYPE.VECTOR || + // can not use LAYER_TYPE because LAYER_TYPE.VECTOR does not exist >8.1 + layerDescriptor.type === 'VECTOR' || layerDescriptor.type === LAYER_TYPE.BLENDED_VECTOR ) { const vectorLayerDescriptor = layerDescriptor as VectorLayerDescriptor; diff --git a/x-pack/plugins/maps/common/migrations/migrate_symbol_style_descriptor.js b/x-pack/plugins/maps/common/migrations/migrate_symbol_style_descriptor.js index 6dab8595663ed..4aa0b74148438 100644 --- a/x-pack/plugins/maps/common/migrations/migrate_symbol_style_descriptor.js +++ b/x-pack/plugins/maps/common/migrations/migrate_symbol_style_descriptor.js @@ -6,11 +6,12 @@ */ import _ from 'lodash'; -import { DEFAULT_ICON, LAYER_TYPE, STYLE_TYPE, SYMBOLIZE_AS_TYPES } from '../constants'; +import { DEFAULT_ICON, STYLE_TYPE, SYMBOLIZE_AS_TYPES } from '../constants'; function isVectorLayer(layerDescriptor) { const layerType = _.get(layerDescriptor, 'type'); - return layerType === LAYER_TYPE.VECTOR; + // can not use LAYER_TYPE because LAYER_TYPE.VECTOR does not exist >8.1 + return layerType === 'VECTOR'; } export function migrateSymbolStyleDescriptor({ attributes }) { diff --git a/x-pack/plugins/maps/common/migrations/migrate_symbol_style_descriptor.test.js b/x-pack/plugins/maps/common/migrations/migrate_symbol_style_descriptor.test.js index 89f3c05e621ec..9932fe1625c9d 100644 --- a/x-pack/plugins/maps/common/migrations/migrate_symbol_style_descriptor.test.js +++ b/x-pack/plugins/maps/common/migrations/migrate_symbol_style_descriptor.test.js @@ -41,7 +41,7 @@ describe('migrateSymbolStyleDescriptor', () => { test('Should migrate "symbol" style descriptor', () => { const layerListJSON = JSON.stringify([ { - type: LAYER_TYPE.VECTOR, + type: 'VECTOR', style: { properties: { fillColor: { @@ -66,7 +66,7 @@ describe('migrateSymbolStyleDescriptor', () => { title: 'my map', layerListJSON: JSON.stringify([ { - type: LAYER_TYPE.VECTOR, + type: 'VECTOR', style: { properties: { fillColor: { @@ -90,7 +90,7 @@ describe('migrateSymbolStyleDescriptor', () => { test('Should migrate style descriptor without "symbol"', () => { const layerListJSON = JSON.stringify([ { - type: LAYER_TYPE.VECTOR, + type: 'VECTOR', style: { properties: { fillColor: { @@ -109,7 +109,7 @@ describe('migrateSymbolStyleDescriptor', () => { title: 'my map', layerListJSON: JSON.stringify([ { - type: LAYER_TYPE.VECTOR, + type: 'VECTOR', style: { properties: { fillColor: { diff --git a/x-pack/plugins/maps/common/migrations/rename_layer_types.test.ts b/x-pack/plugins/maps/common/migrations/rename_layer_types.test.ts new file mode 100644 index 0000000000000..2504a2adb31aa --- /dev/null +++ b/x-pack/plugins/maps/common/migrations/rename_layer_types.test.ts @@ -0,0 +1,83 @@ +/* + * Copyright 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 { renameLayerTypes } from './rename_layer_types'; + +describe('renameLayerTypes', () => { + test('Should handle missing layerListJSON attribute', () => { + const attributes = { + title: 'my map', + }; + expect(renameLayerTypes({ attributes })).toEqual({ + title: 'my map', + }); + }); + + test('Should rename TILED_VECTOR to MVT_VECTOR', () => { + const layerListJSON = JSON.stringify([ + { + type: 'TILED_VECTOR', + }, + ]); + const attributes = { + title: 'my map', + layerListJSON, + }; + expect(renameLayerTypes({ attributes })).toEqual({ + title: 'my map', + layerListJSON: '[{"type":"MVT_VECTOR"}]', + }); + }); + + test('Should rename VECTOR_TILE to EMS_VECTOR_TILE', () => { + const layerListJSON = JSON.stringify([ + { + type: 'VECTOR_TILE', + }, + ]); + const attributes = { + title: 'my map', + layerListJSON, + }; + expect(renameLayerTypes({ attributes })).toEqual({ + title: 'my map', + layerListJSON: '[{"type":"EMS_VECTOR_TILE"}]', + }); + }); + + test('Should rename VECTOR to GEOJSON_VECTOR', () => { + const layerListJSON = JSON.stringify([ + { + type: 'VECTOR', + }, + ]); + const attributes = { + title: 'my map', + layerListJSON, + }; + expect(renameLayerTypes({ attributes })).toEqual({ + title: 'my map', + layerListJSON: '[{"type":"GEOJSON_VECTOR"}]', + }); + }); + + test('Should rename TILE to RASTER_TILE', () => { + const layerListJSON = JSON.stringify([ + { + type: 'TILE', + }, + ]); + const attributes = { + title: 'my map', + layerListJSON, + }; + expect(renameLayerTypes({ attributes })).toEqual({ + title: 'my map', + layerListJSON: '[{"type":"RASTER_TILE"}]', + }); + }); +}); diff --git a/x-pack/plugins/maps/common/migrations/rename_layer_types.ts b/x-pack/plugins/maps/common/migrations/rename_layer_types.ts new file mode 100644 index 0000000000000..6ba924ff32268 --- /dev/null +++ b/x-pack/plugins/maps/common/migrations/rename_layer_types.ts @@ -0,0 +1,49 @@ +/* + * Copyright 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 { LAYER_TYPE } from '../constants'; +import { LayerDescriptor } from '../descriptor_types'; +import { MapSavedObjectAttributes } from '../map_saved_object_type'; + +// LAYER_TYPE constants renamed in 8.1 to provide more distinguishable names that better refect layer. +// TILED_VECTOR replaced with MVT_VECTOR +// VECTOR_TILE replaced with EMS_VECTOR_TILE +// VECTOR replaced with GEOJSON_VECTOR +// TILE replaced with RASTER_TILE +export function renameLayerTypes({ + attributes, +}: { + attributes: MapSavedObjectAttributes; +}): MapSavedObjectAttributes { + if (!attributes || !attributes.layerListJSON) { + return attributes; + } + + let layerList: LayerDescriptor[] = []; + try { + layerList = JSON.parse(attributes.layerListJSON); + } catch (e) { + throw new Error('Unable to parse attribute layerListJSON'); + } + + layerList.forEach((layerDescriptor: LayerDescriptor) => { + if (layerDescriptor.type === 'TILED_VECTOR') { + layerDescriptor.type = LAYER_TYPE.MVT_VECTOR; + } else if (layerDescriptor.type === 'VECTOR_TILE') { + layerDescriptor.type = LAYER_TYPE.EMS_VECTOR_TILE; + } else if (layerDescriptor.type === 'VECTOR') { + layerDescriptor.type = LAYER_TYPE.GEOJSON_VECTOR; + } else if (layerDescriptor.type === 'TILE') { + layerDescriptor.type = LAYER_TYPE.RASTER_TILE; + } + }); + + return { + ...attributes, + layerListJSON: JSON.stringify(layerList), + }; +} diff --git a/x-pack/plugins/maps/public/actions/data_request_actions.ts b/x-pack/plugins/maps/public/actions/data_request_actions.ts index c1a6d05cc0577..730135424a4dd 100644 --- a/x-pack/plugins/maps/public/actions/data_request_actions.ts +++ b/x-pack/plugins/maps/public/actions/data_request_actions.ts @@ -287,7 +287,7 @@ function endDataLoad( const eventHandlers = getEventHandlers(getState()); if (eventHandlers && eventHandlers.onDataLoadEnd) { const resultMeta: ResultMeta = {}; - if (layer && layer.getType() === LAYER_TYPE.VECTOR) { + if (layer && layer.getType() === LAYER_TYPE.GEOJSON_VECTOR) { const featuresWithoutCentroids = features.filter((feature) => { return feature.properties ? !feature.properties[KBN_IS_CENTROID_FEATURE] : true; }); diff --git a/x-pack/plugins/maps/public/classes/layers/create_basemap_layer_descriptor.test.ts b/x-pack/plugins/maps/public/classes/layers/create_basemap_layer_descriptor.test.ts index cf3d870538004..eded70a75e4ac 100644 --- a/x-pack/plugins/maps/public/classes/layers/create_basemap_layer_descriptor.test.ts +++ b/x-pack/plugins/maps/public/classes/layers/create_basemap_layer_descriptor.test.ts @@ -53,7 +53,7 @@ describe('kibana.yml configured with map.tilemap.url', () => { type: 'KIBANA_TILEMAP', }, style: { type: 'TILE' }, - type: 'TILE', + type: 'RASTER_TILE', visible: true, }); }); @@ -89,7 +89,7 @@ describe('EMS is enabled', () => { type: 'EMS_TMS', }, style: { type: 'TILE' }, - type: 'VECTOR_TILE', + type: 'EMS_VECTOR_TILE', visible: true, }); }); diff --git a/x-pack/plugins/maps/public/classes/layers/create_basemap_layer_descriptor.ts b/x-pack/plugins/maps/public/classes/layers/create_basemap_layer_descriptor.ts index d285d3a36f66a..e104261f90847 100644 --- a/x-pack/plugins/maps/public/classes/layers/create_basemap_layer_descriptor.ts +++ b/x-pack/plugins/maps/public/classes/layers/create_basemap_layer_descriptor.ts @@ -11,14 +11,14 @@ import { getKibanaTileMap } from '../../util'; import { getEMSSettings } from '../../kibana_services'; // @ts-expect-error import { KibanaTilemapSource } from '../sources/kibana_tilemap_source'; -import { TileLayer } from './tile_layer/tile_layer'; -import { VectorTileLayer } from './vector_tile_layer/vector_tile_layer'; +import { RasterTileLayer } from './raster_tile_layer/raster_tile_layer'; +import { EmsVectorTileLayer } from './ems_vector_tile_layer/ems_vector_tile_layer'; import { EMSTMSSource } from '../sources/ems_tms_source'; export function createBasemapLayerDescriptor(): LayerDescriptor | null { const tilemapSourceFromKibana = getKibanaTileMap(); if (_.get(tilemapSourceFromKibana, 'url')) { - const layerDescriptor = TileLayer.createDescriptor({ + const layerDescriptor = RasterTileLayer.createDescriptor({ sourceDescriptor: KibanaTilemapSource.createDescriptor(), }); return layerDescriptor; @@ -26,7 +26,7 @@ export function createBasemapLayerDescriptor(): LayerDescriptor | null { const isEmsEnabled = getEMSSettings()!.isEMSEnabled(); if (isEmsEnabled) { - const layerDescriptor = VectorTileLayer.createDescriptor({ + const layerDescriptor = EmsVectorTileLayer.createDescriptor({ sourceDescriptor: EMSTMSSource.createDescriptor({ isAutoSelect: true }), }); return layerDescriptor; diff --git a/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.test.ts b/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.test.ts new file mode 100644 index 0000000000000..8b27bacff8ecb --- /dev/null +++ b/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.test.ts @@ -0,0 +1,53 @@ +/* + * Copyright 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 { SOURCE_TYPES } from '../../../../common/constants'; +import { DataFilters, XYZTMSSourceDescriptor } from '../../../../common/descriptor_types'; +import { ILayer } from '../layer'; +import { EmsVectorTileLayer } from './ems_vector_tile_layer'; +import { DataRequestContext } from '../../../actions'; +import { EMSTMSSource } from '../../sources/ems_tms_source'; + +describe('EmsVectorTileLayer', () => { + it('should correctly inject tileLayerId in meta', async () => { + const layer: ILayer = new EmsVectorTileLayer({ + source: { + getTileLayerId: () => { + return 'myTileLayerId'; + }, + getVectorStyleSheetAndSpriteMeta: () => { + throw new Error('network error'); + }, + } as unknown as EMSTMSSource, + layerDescriptor: { + id: 'layerid', + sourceDescriptor: { + type: SOURCE_TYPES.EMS_XYZ, + urlTemplate: 'https://example.com/{x}/{y}/{z}.png', + id: 'mockSourceId', + } as XYZTMSSourceDescriptor, + }, + }); + + let actualMeta; + let actualErrorMessage; + const mockContext = { + startLoading: (requestId: string, token: string, meta: unknown) => { + actualMeta = meta; + }, + onLoadError: (requestId: string, token: string, message: string) => { + actualErrorMessage = message; + }, + dataFilters: { foo: 'bar' } as unknown as DataFilters, + } as unknown as DataRequestContext; + + await layer.syncData(mockContext); + + expect(actualMeta).toStrictEqual({ tileLayerId: 'myTileLayerId' }); + expect(actualErrorMessage).toStrictEqual('network error'); + }); +}); diff --git a/x-pack/plugins/maps/public/classes/layers/vector_tile_layer/vector_tile_layer.tsx b/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.tsx similarity index 93% rename from x-pack/plugins/maps/public/classes/layers/vector_tile_layer/vector_tile_layer.tsx rename to x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.tsx index f6c4e3fd057cf..8f7471f255a5d 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_tile_layer/vector_tile_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.tsx @@ -7,7 +7,7 @@ import type { Map as MbMap, Layer as MbLayer, Style as MbStyle } from '@kbn/mapbox-gl'; import _ from 'lodash'; -import { TileLayer } from '../tile_layer/tile_layer'; +import { AbstractLayer } from '../layer'; import { SOURCE_DATA_REQUEST_ID, LAYER_TYPE, LAYER_STYLE_TYPE } from '../../../../common/constants'; import { LayerDescriptor } from '../../../../common/descriptor_types'; import { DataRequest } from '../../util/data_request'; @@ -18,6 +18,7 @@ import { } from '../../../connected_components/mb_map/utils'; import { DataRequestContext } from '../../../actions'; import { EMSTMSSource } from '../../sources/ems_tms_source'; +import { TileStyle } from '../../styles/tile/tile_style'; interface SourceRequestMeta { tileLayerId: string; @@ -46,22 +47,44 @@ interface SourceRequestData { }; } -// TODO - rename to EmsVectorTileLayer -export class VectorTileLayer extends TileLayer { - static type = LAYER_TYPE.VECTOR_TILE; - +export class EmsVectorTileLayer extends AbstractLayer { static createDescriptor(options: Partial) { const tileLayerDescriptor = super.createDescriptor(options); - tileLayerDescriptor.type = VectorTileLayer.type; + tileLayerDescriptor.type = LAYER_TYPE.EMS_VECTOR_TILE; tileLayerDescriptor.alpha = _.get(options, 'alpha', 1); tileLayerDescriptor.style = { type: LAYER_STYLE_TYPE.TILE }; return tileLayerDescriptor; } + private readonly _style: TileStyle; + + constructor({ + source, + layerDescriptor, + }: { + source: EMSTMSSource; + layerDescriptor: LayerDescriptor; + }) { + super({ source, layerDescriptor }); + this._style = new TileStyle(); + } + getSource(): EMSTMSSource { return super.getSource() as EMSTMSSource; } + getStyleForEditing() { + return this._style; + } + + getStyle() { + return this._style; + } + + getCurrentStyle() { + return this._style; + } + _canSkipSync({ prevDataRequest, nextMeta, @@ -349,4 +372,12 @@ export class VectorTileLayer extends TileLayer { async getLicensedFeatures() { return this._source.getLicensedFeatures(); } + + getLayerTypeIconName() { + return 'grid'; + } + + isBasemap(order: number) { + return order === 0; + } } diff --git a/x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.test.ts b/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.test.ts similarity index 88% rename from x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.test.ts rename to x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.test.ts index 43cc69687ffb7..66c5b8da0591c 100644 --- a/x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.test.ts +++ b/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ITileLayerArguments, TileLayer } from './tile_layer'; +import { RasterTileLayer } from './raster_tile_layer'; import { SOURCE_TYPES } from '../../../../common/constants'; import { XYZTMSSourceDescriptor } from '../../../../common/descriptor_types'; import { AbstractSource } from '../../sources/source'; @@ -34,22 +34,20 @@ class MockTileSource extends AbstractSource implements ITMSSource { } } -describe('TileLayer', () => { +describe('RasterTileLayer', () => { it('should use display-label from source', async () => { const source = new MockTileSource(sourceDescriptor); - const args: ITileLayerArguments = { + const layer: ILayer = new RasterTileLayer({ source, layerDescriptor: { id: 'layerid', sourceDescriptor }, - }; - - const layer: ILayer = new TileLayer(args); + }); expect(await source.getDisplayName()).toEqual(await layer.getDisplayName()); }); it('should override with custom display-label if present', async () => { const source = new MockTileSource(sourceDescriptor); - const layer: ILayer = new TileLayer({ + const layer: ILayer = new RasterTileLayer({ source, layerDescriptor: { id: 'layerid', sourceDescriptor, label: 'custom' }, }); diff --git a/x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.ts b/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.ts similarity index 92% rename from x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.ts rename to x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.ts index 009b447402f9e..40a7276bc10d0 100644 --- a/x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.ts +++ b/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.ts @@ -14,16 +14,10 @@ import { TileStyle } from '../../styles/tile/tile_style'; import { ITMSSource } from '../../sources/tms_source'; import { DataRequestContext } from '../../../actions'; -export interface ITileLayerArguments { - source: ITMSSource; - layerDescriptor: LayerDescriptor; -} - -// TODO - rename to RasterTileLayer -export class TileLayer extends AbstractLayer { +export class RasterTileLayer extends AbstractLayer { static createDescriptor(options: Partial) { const tileLayerDescriptor = super.createDescriptor(options); - tileLayerDescriptor.type = LAYER_TYPE.TILE; + tileLayerDescriptor.type = LAYER_TYPE.RASTER_TILE; tileLayerDescriptor.alpha = _.get(options, 'alpha', 1); tileLayerDescriptor.style = { type: LAYER_STYLE_TYPE.TILE }; return tileLayerDescriptor; @@ -31,7 +25,13 @@ export class TileLayer extends AbstractLayer { private readonly _style: TileStyle; - constructor({ source, layerDescriptor }: ITileLayerArguments) { + constructor({ + source, + layerDescriptor, + }: { + source: ITMSSource; + layerDescriptor: LayerDescriptor; + }) { super({ source, layerDescriptor }); this._style = new TileStyle(); } diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/geojson_vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/geojson_vector_layer.tsx index 3152ac27189b3..e7fa87435cf09 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/geojson_vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/geojson_vector_layer.tsx @@ -51,7 +51,7 @@ export class GeoJsonVectorLayer extends AbstractVectorLayer { mapColors?: string[] ): VectorLayerDescriptor { const layerDescriptor = super.createDescriptor(options) as VectorLayerDescriptor; - layerDescriptor.type = LAYER_TYPE.VECTOR; + layerDescriptor.type = LAYER_TYPE.GEOJSON_VECTOR; if (!options.style) { const styleProperties = VectorStyle.createDefaultStyleProperties(mapColors ? mapColors : []); diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx index e266c729f26fa..5ac95c9a91f64 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx @@ -42,7 +42,7 @@ export class MvtVectorLayer extends AbstractVectorLayer { mapColors?: string[] ): VectorLayerDescriptor { const layerDescriptor = super.createDescriptor(descriptor, mapColors); - layerDescriptor.type = LAYER_TYPE.TILED_VECTOR; + layerDescriptor.type = LAYER_TYPE.MVT_VECTOR; if (!layerDescriptor.style) { const styleProperties = VectorStyle.createDefaultStyleProperties(mapColors ? mapColors : []); diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx index 71a960fc1919b..0384517bf9834 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx @@ -113,7 +113,7 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { mapColors?: string[] ): VectorLayerDescriptor { const layerDescriptor = super.createDescriptor(options) as VectorLayerDescriptor; - layerDescriptor.type = LAYER_TYPE.VECTOR; + layerDescriptor.type = LAYER_TYPE.GEOJSON_VECTOR; if (!options.style) { const styleProperties = VectorStyle.createDefaultStyleProperties(mapColors ? mapColors : []); diff --git a/x-pack/plugins/maps/public/classes/layers/vector_tile_layer/vector_tile_layer.test.ts b/x-pack/plugins/maps/public/classes/layers/vector_tile_layer/vector_tile_layer.test.ts deleted file mode 100644 index d094e53c59a92..0000000000000 --- a/x-pack/plugins/maps/public/classes/layers/vector_tile_layer/vector_tile_layer.test.ts +++ /dev/null @@ -1,75 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ITileLayerArguments } from '../tile_layer/tile_layer'; -import { SOURCE_TYPES } from '../../../../common/constants'; -import { DataFilters, XYZTMSSourceDescriptor } from '../../../../common/descriptor_types'; -import { AbstractSource } from '../../sources/source'; -import { ITMSSource } from '../../sources/tms_source'; -import { ILayer } from '../layer'; -import { VectorTileLayer } from './vector_tile_layer'; -import { DataRequestContext } from '../../../actions'; - -const sourceDescriptor: XYZTMSSourceDescriptor = { - type: SOURCE_TYPES.EMS_XYZ, - urlTemplate: 'https://example.com/{x}/{y}/{z}.png', - id: 'mockSourceId', -}; - -class MockTileSource extends AbstractSource implements ITMSSource { - readonly _descriptor: XYZTMSSourceDescriptor; - constructor(descriptor: XYZTMSSourceDescriptor) { - super(descriptor, {}); - this._descriptor = descriptor; - } - - async getDisplayName(): Promise { - return this._descriptor.urlTemplate; - } - - async getUrlTemplate(): Promise { - return 'template/{x}/{y}/{z}.png'; - } - - getTileLayerId() { - return this._descriptor.id; - } - - getVectorStyleSheetAndSpriteMeta() { - throw new Error('network error'); - } -} - -describe('VectorTileLayer', () => { - it('should correctly inject tileLayerId in meta', async () => { - const source = new MockTileSource(sourceDescriptor); - - const args: ITileLayerArguments = { - source, - layerDescriptor: { id: 'layerid', sourceDescriptor }, - }; - - const layer: ILayer = new VectorTileLayer(args); - - let actualMeta; - let actualErrorMessage; - const mockContext = { - startLoading: (requestId: string, token: string, meta: unknown) => { - actualMeta = meta; - }, - onLoadError: (requestId: string, token: string, message: string) => { - actualErrorMessage = message; - }, - dataFilters: { foo: 'bar' } as unknown as DataFilters, - } as unknown as DataRequestContext; - - await layer.syncData(mockContext); - - expect(actualMeta).toStrictEqual({ tileLayerId: 'mockSourceId' }); - expect(actualErrorMessage).toStrictEqual('network error'); - }); -}); diff --git a/x-pack/plugins/maps/public/classes/layers/wizards/solution_layers/observability/create_layer_descriptor.test.ts b/x-pack/plugins/maps/public/classes/layers/wizards/solution_layers/observability/create_layer_descriptor.test.ts index 7c762ac3409f8..9e843c98cb649 100644 --- a/x-pack/plugins/maps/public/classes/layers/wizards/solution_layers/observability/create_layer_descriptor.test.ts +++ b/x-pack/plugins/maps/public/classes/layers/wizards/solution_layers/observability/create_layer_descriptor.test.ts @@ -165,7 +165,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }); }); @@ -345,7 +345,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }); }); diff --git a/x-pack/plugins/maps/public/classes/layers/wizards/solution_layers/security/create_layer_descriptors.test.ts b/x-pack/plugins/maps/public/classes/layers/wizards/solution_layers/security/create_layer_descriptors.test.ts index b5d4edc8cb43b..b7e07e6f8e274 100644 --- a/x-pack/plugins/maps/public/classes/layers/wizards/solution_layers/security/create_layer_descriptors.test.ts +++ b/x-pack/plugins/maps/public/classes/layers/wizards/solution_layers/security/create_layer_descriptors.test.ts @@ -138,7 +138,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }, { @@ -248,7 +248,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }, { @@ -365,7 +365,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }, ]); @@ -480,7 +480,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }, { @@ -590,7 +590,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }, { @@ -707,7 +707,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }, ]); @@ -822,7 +822,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }, { @@ -932,7 +932,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }, { @@ -1049,7 +1049,7 @@ describe('createLayerDescriptor', () => { }, type: 'VECTOR', }, - type: 'VECTOR', + type: 'GEOJSON_VECTOR', visible: true, }, ]); diff --git a/x-pack/plugins/maps/public/classes/sources/ems_tms_source/ems_base_map_layer_wizard.tsx b/x-pack/plugins/maps/public/classes/sources/ems_tms_source/ems_base_map_layer_wizard.tsx index 9138b199fd578..26afa65b9527c 100644 --- a/x-pack/plugins/maps/public/classes/sources/ems_tms_source/ems_base_map_layer_wizard.tsx +++ b/x-pack/plugins/maps/public/classes/sources/ems_tms_source/ems_base_map_layer_wizard.tsx @@ -8,10 +8,8 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { LayerWizard, RenderWizardArguments } from '../../layers'; -// @ts-ignore import { EMSTMSSource, getSourceTitle } from './ems_tms_source'; -// @ts-ignore -import { VectorTileLayer } from '../../layers/vector_tile_layer/vector_tile_layer'; +import { EmsVectorTileLayer } from '../../layers/ems_vector_tile_layer/ems_vector_tile_layer'; import { EmsTmsSourceConfig } from './tile_service_select'; import { CreateSourceEditor } from './create_source_editor'; import { getEMSSettings } from '../../../kibana_services'; @@ -45,7 +43,7 @@ export const emsBaseMapLayerWizardConfig: LayerWizard = { icon: WorldMapLayerIcon, renderWizard: ({ previewLayers }: RenderWizardArguments) => { const onSourceConfigChange = (sourceConfig: EmsTmsSourceConfig) => { - const layerDescriptor = VectorTileLayer.createDescriptor({ + const layerDescriptor = EmsVectorTileLayer.createDescriptor({ sourceDescriptor: EMSTMSSource.createDescriptor(sourceConfig), }); previewLayers([layerDescriptor]); diff --git a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/update_source_editor.test.tsx b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/update_source_editor.test.tsx index 32658447acf2b..3ddb804cac213 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/update_source_editor.test.tsx +++ b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/update_source_editor.test.tsx @@ -18,7 +18,7 @@ jest.mock('uuid/v4', () => { }); const defaultProps = { - currentLayerType: LAYER_TYPE.VECTOR, + currentLayerType: LAYER_TYPE.GEOJSON_VECTOR, indexPatternId: 'foobar', onChange: async () => {}, metrics: [], diff --git a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/update_source_editor.tsx b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/update_source_editor.tsx index ba10479a2bd2c..fb748cdc63aff 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/update_source_editor.tsx +++ b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/update_source_editor.tsx @@ -82,11 +82,13 @@ export class UpdateSourceEditor extends Component { _onResolutionChange = async (resolution: GRID_RESOLUTION, metrics: AggDescriptor[]) => { let newLayerType; if ( - this.props.currentLayerType === LAYER_TYPE.VECTOR || - this.props.currentLayerType === LAYER_TYPE.TILED_VECTOR + this.props.currentLayerType === LAYER_TYPE.GEOJSON_VECTOR || + this.props.currentLayerType === LAYER_TYPE.MVT_VECTOR ) { newLayerType = - resolution === GRID_RESOLUTION.SUPER_FINE ? LAYER_TYPE.TILED_VECTOR : LAYER_TYPE.VECTOR; + resolution === GRID_RESOLUTION.SUPER_FINE + ? LAYER_TYPE.MVT_VECTOR + : LAYER_TYPE.GEOJSON_VECTOR; } await this.props.onChange( diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.tsx b/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.tsx index ddf727842780d..fcf915618a0b7 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.tsx +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.tsx @@ -86,9 +86,9 @@ export class ScalingForm extends Component { if (optionId === SCALING_TYPES.CLUSTERS) { layerType = LAYER_TYPE.BLENDED_VECTOR; } else if (optionId === SCALING_TYPES.MVT) { - layerType = LAYER_TYPE.TILED_VECTOR; + layerType = LAYER_TYPE.MVT_VECTOR; } else { - layerType = LAYER_TYPE.VECTOR; + layerType = LAYER_TYPE.GEOJSON_VECTOR; } this.props.onChange({ propName: 'scalingType', value: optionId, newLayerType: layerType }); diff --git a/x-pack/plugins/maps/public/classes/sources/kibana_tilemap_source/kibana_base_map_layer_wizard.tsx b/x-pack/plugins/maps/public/classes/sources/kibana_tilemap_source/kibana_base_map_layer_wizard.tsx index 70f56f8f4e6d2..ec69989a8313d 100644 --- a/x-pack/plugins/maps/public/classes/sources/kibana_tilemap_source/kibana_base_map_layer_wizard.tsx +++ b/x-pack/plugins/maps/public/classes/sources/kibana_tilemap_source/kibana_base_map_layer_wizard.tsx @@ -12,7 +12,7 @@ import { LayerWizard, RenderWizardArguments } from '../../layers'; import { CreateSourceEditor } from './create_source_editor'; // @ts-ignore import { KibanaTilemapSource, sourceTitle } from './kibana_tilemap_source'; -import { TileLayer } from '../../layers/tile_layer/tile_layer'; +import { RasterTileLayer } from '../../layers/raster_tile_layer/raster_tile_layer'; import { getKibanaTileMap } from '../../../util'; import { LAYER_WIZARD_CATEGORY } from '../../../../common/constants'; @@ -29,7 +29,7 @@ export const kibanaBasemapLayerWizardConfig: LayerWizard = { icon: 'logoKibana', renderWizard: ({ previewLayers }: RenderWizardArguments) => { const onSourceConfigChange = () => { - const layerDescriptor = TileLayer.createDescriptor({ + const layerDescriptor = RasterTileLayer.createDescriptor({ sourceDescriptor: KibanaTilemapSource.createDescriptor(), }); previewLayers([layerDescriptor]); diff --git a/x-pack/plugins/maps/public/classes/sources/wms_source/wms_layer_wizard.tsx b/x-pack/plugins/maps/public/classes/sources/wms_source/wms_layer_wizard.tsx index adbb23b921d4b..19f31d481f58e 100644 --- a/x-pack/plugins/maps/public/classes/sources/wms_source/wms_layer_wizard.tsx +++ b/x-pack/plugins/maps/public/classes/sources/wms_source/wms_layer_wizard.tsx @@ -12,7 +12,7 @@ import { WMSCreateSourceEditor } from './wms_create_source_editor'; // @ts-ignore import { sourceTitle, WMSSource } from './wms_source'; import { LayerWizard, RenderWizardArguments } from '../../layers'; -import { TileLayer } from '../../layers/tile_layer/tile_layer'; +import { RasterTileLayer } from '../../layers/raster_tile_layer/raster_tile_layer'; import { LAYER_WIZARD_CATEGORY } from '../../../../common/constants'; import { WebMapServiceLayerIcon } from '../../layers/wizards/icons/web_map_service_layer_icon'; @@ -29,7 +29,7 @@ export const wmsLayerWizardConfig: LayerWizard = { return; } - const layerDescriptor = TileLayer.createDescriptor({ + const layerDescriptor = RasterTileLayer.createDescriptor({ sourceDescriptor: WMSSource.createDescriptor(sourceConfig), }); previewLayers([layerDescriptor]); diff --git a/x-pack/plugins/maps/public/classes/sources/xyz_tms_source/layer_wizard.tsx b/x-pack/plugins/maps/public/classes/sources/xyz_tms_source/layer_wizard.tsx index 95a2b104c7a1b..82aab592a1344 100644 --- a/x-pack/plugins/maps/public/classes/sources/xyz_tms_source/layer_wizard.tsx +++ b/x-pack/plugins/maps/public/classes/sources/xyz_tms_source/layer_wizard.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { XYZTMSEditor, XYZTMSSourceConfig } from './xyz_tms_editor'; import { XYZTMSSource, sourceTitle } from './xyz_tms_source'; import { LayerWizard, RenderWizardArguments } from '../../layers'; -import { TileLayer } from '../../layers/tile_layer/tile_layer'; +import { RasterTileLayer } from '../../layers/raster_tile_layer/raster_tile_layer'; import { LAYER_WIZARD_CATEGORY } from '../../../../common/constants'; import { WorldMapLayerIcon } from '../../layers/wizards/icons/world_map_layer_icon'; @@ -32,7 +32,7 @@ export const tmsLayerWizardConfig: LayerWizard = { return; } - const layerDescriptor = TileLayer.createDescriptor({ + const layerDescriptor = RasterTileLayer.createDescriptor({ sourceDescriptor: XYZTMSSource.createDescriptor(sourceConfig), }); previewLayers([layerDescriptor]); diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.test.tsx b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.test.tsx index 82795b8bd9317..ebe0cc6a4178d 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.test.tsx +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.test.tsx @@ -57,7 +57,7 @@ const mockLayer = { return '1'; }, getType: () => { - return LAYER_TYPE.VECTOR; + return LAYER_TYPE.GEOJSON_VECTOR; }, getDisplayName: () => { return 'layer 1'; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/utils.ts b/x-pack/plugins/maps/public/connected_components/mb_map/utils.ts index 17994bf799487..f5de99d04c01c 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/utils.ts +++ b/x-pack/plugins/maps/public/connected_components/mb_map/utils.ts @@ -11,7 +11,7 @@ import { TileMetaFeature } from '../../../common/descriptor_types'; import { RGBAImage } from './image_utils'; import { isGlDrawLayer } from './sort_layers'; import { ILayer } from '../../classes/layers/layer'; -import { EmsSpriteSheet } from '../../classes/layers/vector_tile_layer/vector_tile_layer'; +import { EmsSpriteSheet } from '../../classes/layers/ems_vector_tile_layer/ems_vector_tile_layer'; import { ES_MVT_META_LAYER_NAME } from '../../classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer'; export function removeOrphanedSourcesAndLayers( diff --git a/x-pack/plugins/maps/public/locators.test.ts b/x-pack/plugins/maps/public/locators.test.ts index bfcd34c4ae710..aabae1a26c1df 100644 --- a/x-pack/plugins/maps/public/locators.test.ts +++ b/x-pack/plugins/maps/public/locators.test.ts @@ -52,7 +52,7 @@ describe('visualize url generator', () => { { id: LAYER_ID, visible: true, - type: LAYER_TYPE.VECTOR, + type: LAYER_TYPE.GEOJSON_VECTOR, sourceDescriptor: { id: LAYER_ID, type: SOURCE_TYPES.ES_SEARCH, @@ -70,7 +70,7 @@ describe('visualize url generator', () => { expect(location).toMatchObject({ app: 'maps', - path: `/map#/?_g=()&_a=()&initialLayers=(id%3A'13823000-99b9-11ea-9eb6-d9e8adceb647'%2CsourceDescriptor%3A(geoField%3Atest%2Cid%3A'13823000-99b9-11ea-9eb6-d9e8adceb647'%2CindexPatternId%3A'90943e30-9a47-11e8-b64d-95841ca0b247'%2Clabel%3A'Sample%20Data'%2CscalingType%3ALIMIT%2CtooltipProperties%3A!()%2Ctype%3AES_SEARCH)%2Ctype%3AVECTOR%2Cvisible%3A!t)`, + path: `/map#/?_g=()&_a=()&initialLayers=(id%3A'13823000-99b9-11ea-9eb6-d9e8adceb647'%2CsourceDescriptor%3A(geoField%3Atest%2Cid%3A'13823000-99b9-11ea-9eb6-d9e8adceb647'%2CindexPatternId%3A'90943e30-9a47-11e8-b64d-95841ca0b247'%2Clabel%3A'Sample%20Data'%2CscalingType%3ALIMIT%2CtooltipProperties%3A!()%2Ctype%3AES_SEARCH)%2Ctype%3AGEOJSON_VECTOR%2Cvisible%3A!t)`, state: {}, }); }); diff --git a/x-pack/plugins/maps/public/selectors/map_selectors.test.ts b/x-pack/plugins/maps/public/selectors/map_selectors.test.ts index 4f336d9a8ad27..6b903214f8f97 100644 --- a/x-pack/plugins/maps/public/selectors/map_selectors.test.ts +++ b/x-pack/plugins/maps/public/selectors/map_selectors.test.ts @@ -8,7 +8,7 @@ import { LAYER_STYLE_TYPE, LAYER_TYPE, SOURCE_TYPES } from '../../common/constants'; jest.mock('../classes/layers/heatmap_layer', () => {}); -jest.mock('../classes/layers/vector_tile_layer/vector_tile_layer', () => {}); +jest.mock('../classes/layers/ems_vector_tile_layer/ems_vector_tile_layer', () => {}); jest.mock('../classes/joins/inner_join', () => {}); jest.mock('../kibana_services', () => ({ getTimeFilter: () => ({ @@ -232,7 +232,7 @@ describe('getQueryableUniqueIndexPatternIds', () => { indexPatternId: string; }) { return { - type: LAYER_TYPE.VECTOR, + type: LAYER_TYPE.GEOJSON_VECTOR, style: { type: LAYER_STYLE_TYPE.VECTOR, }, diff --git a/x-pack/plugins/maps/public/selectors/map_selectors.ts b/x-pack/plugins/maps/public/selectors/map_selectors.ts index f58525ea6f974..5f308387e9d8b 100644 --- a/x-pack/plugins/maps/public/selectors/map_selectors.ts +++ b/x-pack/plugins/maps/public/selectors/map_selectors.ts @@ -10,9 +10,8 @@ import { FeatureCollection } from 'geojson'; import _ from 'lodash'; import { Adapters } from 'src/plugins/inspector/public'; import type { Query } from 'src/plugins/data/common'; -import { TileLayer } from '../classes/layers/tile_layer/tile_layer'; -// @ts-ignore -import { VectorTileLayer } from '../classes/layers/vector_tile_layer/vector_tile_layer'; +import { RasterTileLayer } from '../classes/layers/raster_tile_layer/raster_tile_layer'; +import { EmsVectorTileLayer } from '../classes/layers/ems_vector_tile_layer/ems_vector_tile_layer'; import { BlendedVectorLayer, IVectorLayer, @@ -59,6 +58,7 @@ import { ISource } from '../classes/sources/source'; import { ITMSSource } from '../classes/sources/tms_source'; import { IVectorSource } from '../classes/sources/vector_source'; import { ESGeoGridSource } from '../classes/sources/es_geo_grid_source'; +import { EMSTMSSource } from '../classes/sources/ems_tms_source'; import { ILayer } from '../classes/layers/layer'; import { getIsReadOnly } from './ui_selectors'; @@ -70,9 +70,9 @@ export function createLayerInstance( const source: ISource = createSourceInstance(layerDescriptor.sourceDescriptor, inspectorAdapters); switch (layerDescriptor.type) { - case LAYER_TYPE.TILE: - return new TileLayer({ layerDescriptor, source: source as ITMSSource }); - case LAYER_TYPE.VECTOR: + case LAYER_TYPE.RASTER_TILE: + return new RasterTileLayer({ layerDescriptor, source: source as ITMSSource }); + case LAYER_TYPE.GEOJSON_VECTOR: const joins: InnerJoin[] = []; const vectorLayerDescriptor = layerDescriptor as VectorLayerDescriptor; if (vectorLayerDescriptor.joins) { @@ -87,8 +87,8 @@ export function createLayerInstance( joins, chartsPaletteServiceGetColor, }); - case LAYER_TYPE.VECTOR_TILE: - return new VectorTileLayer({ layerDescriptor, source: source as ITMSSource }); + case LAYER_TYPE.EMS_VECTOR_TILE: + return new EmsVectorTileLayer({ layerDescriptor, source: source as EMSTMSSource }); case LAYER_TYPE.HEATMAP: return new HeatmapLayer({ layerDescriptor: layerDescriptor as HeatmapLayerDescriptor, @@ -100,7 +100,7 @@ export function createLayerInstance( source: source as IVectorSource, chartsPaletteServiceGetColor, }); - case LAYER_TYPE.TILED_VECTOR: + case LAYER_TYPE.MVT_VECTOR: return new MvtVectorLayer({ layerDescriptor: layerDescriptor as VectorLayerDescriptor, source: source as IVectorSource, diff --git a/x-pack/plugins/maps/public/trigger_actions/visualize_geo_field_action.ts b/x-pack/plugins/maps/public/trigger_actions/visualize_geo_field_action.ts index 1cbb3e92134b8..1da2ca14bd16f 100644 --- a/x-pack/plugins/maps/public/trigger_actions/visualize_geo_field_action.ts +++ b/x-pack/plugins/maps/public/trigger_actions/visualize_geo_field_action.ts @@ -61,7 +61,7 @@ const getMapsLink = async (context: VisualizeFieldContext) => { { id: uuid(), visible: true, - type: supportsClustering ? LAYER_TYPE.BLENDED_VECTOR : LAYER_TYPE.VECTOR, + type: supportsClustering ? LAYER_TYPE.BLENDED_VECTOR : LAYER_TYPE.GEOJSON_VECTOR, sourceDescriptor: { id: uuid(), type: SOURCE_TYPES.ES_SEARCH, diff --git a/x-pack/plugins/maps/server/embeddable_migrations.ts b/x-pack/plugins/maps/server/embeddable_migrations.ts index 962f5c4fb0d7a..f5356e5eb29a5 100644 --- a/x-pack/plugins/maps/server/embeddable_migrations.ts +++ b/x-pack/plugins/maps/server/embeddable_migrations.ts @@ -9,6 +9,7 @@ import type { SerializableRecord } from '@kbn/utility-types'; import { MapSavedObjectAttributes } from '../common/map_saved_object_type'; import { moveAttribution } from '../common/migrations/move_attribution'; import { setEmsTmsDefaultModes } from '../common/migrations/set_ems_tms_default_modes'; +import { renameLayerTypes } from '../common/migrations/rename_layer_types'; /* * Embeddables such as Maps, Lens, and Visualize can be embedded by value or by reference on a dashboard. @@ -42,4 +43,16 @@ export const embeddableMigrations = { return state; } }, + '8.1.0': (state: SerializableRecord) => { + try { + return { + ...state, + attributes: renameLayerTypes(state as { attributes: MapSavedObjectAttributes }), + } as SerializableRecord; + } catch (e) { + // Do not fail migration for invalid layerListJSON + // Maps application can display invalid layerListJSON error when saved object is viewed + return state; + } + }, }; diff --git a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.test.js b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.test.js index a415d181900d7..796d641f3eff7 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.test.js +++ b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.test.js @@ -202,7 +202,7 @@ describe('buildMapsSavedObjectsTelemetry', () => { max: 1, min: 1, }, - VECTOR: { + GEOJSON_VECTOR: { avg: 1.2, max: 2, min: 1, diff --git a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts index 93a9a118d23bc..3b257fb812bf9 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts +++ b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts @@ -160,7 +160,7 @@ async function isGeoShapeAggLayer(layer: LayerDescriptor): Promise { } if ( - layer.type !== LAYER_TYPE.VECTOR && + layer.type !== LAYER_TYPE.GEOJSON_VECTOR && layer.type !== LAYER_TYPE.BLENDED_VECTOR && layer.type !== LAYER_TYPE.HEATMAP ) { diff --git a/x-pack/plugins/maps/server/maps_telemetry/test_resources/sample_map_saved_objects.json b/x-pack/plugins/maps/server/maps_telemetry/test_resources/sample_map_saved_objects.json index 3adaaaf091e08..e9427a996ad1e 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/test_resources/sample_map_saved_objects.json +++ b/x-pack/plugins/maps/server/maps_telemetry/test_resources/sample_map_saved_objects.json @@ -6,7 +6,7 @@ "title": "Italy Map", "description": "", "mapStateJSON": "{\"zoom\":4.82,\"center\":{\"lon\":11.41545,\"lat\":42.0865},\"timeFilters\":{\"from\":\"now-15w\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":false,\"interval\":0},\"query\":{\"language\":\"lucene\",\"query\":\"\"}}", - "layerListJSON": "[{\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"id\":\"csq5v\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.65,\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\"},{\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"italy_provinces\"},\"id\":\"0oye8\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#0c1f70\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\"},{\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"id\":\"053fe296-f5ae-4cb0-9e73-a5752cb9ba74\",\"indexPatternId\":\"d3d7af60-4c81-11e8-b3d7-01146121b73d\",\"geoField\":\"DestLocation\",\"requestType\":\"point\",\"resolution\":\"COARSE\"},\"id\":\"1gx22\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"Count\",\"name\":\"doc_count\",\"origin\":\"source\"},\"color\":\"Greens\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"Count\",\"name\":\"doc_count\",\"origin\":\"source\"},\"minSize\":4,\"maxSize\":32}}}},\"type\":\"VECTOR\"}]", + "layerListJSON": "[{\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"id\":\"csq5v\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.65,\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\"},{\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"italy_provinces\"},\"id\":\"0oye8\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#0c1f70\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"GEOJSON_VECTOR\"},{\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"id\":\"053fe296-f5ae-4cb0-9e73-a5752cb9ba74\",\"indexPatternId\":\"d3d7af60-4c81-11e8-b3d7-01146121b73d\",\"geoField\":\"DestLocation\",\"requestType\":\"point\",\"resolution\":\"COARSE\"},\"id\":\"1gx22\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"Count\",\"name\":\"doc_count\",\"origin\":\"source\"},\"color\":\"Greens\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"Count\",\"name\":\"doc_count\",\"origin\":\"source\"},\"minSize\":4,\"maxSize\":32}}}},\"type\":\"GEOJSON_VECTOR\"}]", "uiStateJSON": "{}" }, "references": [ @@ -21,7 +21,7 @@ "title": "France Map", "description": "", "mapStateJSON": "{\"zoom\":3.43,\"center\":{\"lon\":-16.30411,\"lat\":42.88411},\"timeFilters\":{\"from\":\"now-15w\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":false,\"interval\":0},\"query\":{\"query\":\"\",\"language\":\"lucene\"}}", - "layerListJSON": "[{\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"id\":\"csq5v\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.65,\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\"},{\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"france_departments\"},\"id\":\"65xbw\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.25,\"visible\":true,\"joins\":[{\"leftField\":\"iso_3166_2\",\"right\":{\"id\":\"6a263f96-7a96-4f5a-a00e-c89178c1d017\"}}],\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#19c1e6\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\"},{\"sourceDescriptor\":{\"id\":\"240125db-e612-4001-b853-50107e55d984\",\"type\":\"ES_SEARCH\",\"scalingType\":\"LIMIT\",\"indexPatternId\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"geoField\":\"geoip.location\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[]},\"id\":\"mdae9\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#1ce619\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\"}]", + "layerListJSON": "[{\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"id\":\"csq5v\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.65,\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\"},{\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"france_departments\"},\"id\":\"65xbw\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.25,\"visible\":true,\"joins\":[{\"leftField\":\"iso_3166_2\",\"right\":{\"id\":\"6a263f96-7a96-4f5a-a00e-c89178c1d017\"}}],\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#19c1e6\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"GEOJSON_VECTOR\"},{\"sourceDescriptor\":{\"id\":\"240125db-e612-4001-b853-50107e55d984\",\"type\":\"ES_SEARCH\",\"scalingType\":\"LIMIT\",\"indexPatternId\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"geoField\":\"geoip.location\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[]},\"id\":\"mdae9\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#1ce619\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"GEOJSON_VECTOR\"}]", "uiStateJSON": "{}" }, "references": [ @@ -36,7 +36,7 @@ "title": "Canada Map", "description": "", "mapStateJSON": "{\"zoom\":2.12,\"center\":{\"lon\":-88.67592,\"lat\":34.23257},\"timeFilters\":{\"from\":\"now-15m\",\"to\":\"now\",\"mode\":\"quick\"},\"refreshConfig\":{\"isPaused\":false,\"interval\":0},\"query\":{\"query\":\"\",\"language\":\"lucene\"}}", - "layerListJSON": "[{\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"id\":\"csq5v\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.65,\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\"},{\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"canada_provinces\"},\"id\":\"kt086\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#60895e\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\"}]", + "layerListJSON": "[{\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"id\":\"csq5v\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.65,\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\"},{\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"canada_provinces\"},\"id\":\"kt086\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#60895e\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"GEOJSON_VECTOR\"}]", "uiStateJSON": "{}" }, "references": [ @@ -51,7 +51,7 @@ "title": "Single cluster layer with geo_shape field", "description": "", "mapStateJSON": "{\"zoom\":2.12,\"center\":{\"lon\":-88.67592,\"lat\":34.23257},\"timeFilters\":{\"from\":\"now-15m\",\"to\":\"now\",\"mode\":\"quick\"},\"refreshConfig\":{\"isPaused\":false,\"interval\":0},\"query\":{\"query\":\"\",\"language\":\"lucene\"}}", - "layerListJSON": "[{\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"id\":\"51afb7d0-c628-11ea-87d0-0242ac130003\",\"geoField\":\"geometry\",\"metrics\":[{\"type\":\"count\"}],\"requestType\":\"point\",\"resolution\":\"COARSE\",\"indexPatternId\":\"4a7f6010-0aed-11ea-9dd2-95afd7ad44d4\"},\"style\":{\"type\":\"VECTOR\",\"properties\":{\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}},\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"color\":\"Blues\",\"colorCategory\":\"palette_0\",\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"fieldMetaOptions\":{\"isEnabled\":true,\"sigma\":3},\"type\":\"ORDINAL\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":0}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"minSize\":7,\"maxSize\":32,\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"fieldMetaOptions\":{\"isEnabled\":true,\"sigma\":3}}},\"iconOrientation\":{\"type\":\"STATIC\",\"options\":{\"orientation\":0}},\"labelText\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"}}},\"labelColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#000000\"}},\"labelSize\":{\"type\":\"STATIC\",\"options\":{\"size\":14}},\"labelBorderColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"labelBorderSize\":{\"options\":{\"size\":\"SMALL\"}}},\"isTimeAware\":true},\"id\":\"8d384d5d-6353-468f-b8f8-8eaa487358c4\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"visible\":true,\"type\":\"VECTOR\",\"joins\":[]}]", + "layerListJSON": "[{\"sourceDescriptor\":{\"type\":\"ES_GEO_GRID\",\"id\":\"51afb7d0-c628-11ea-87d0-0242ac130003\",\"geoField\":\"geometry\",\"metrics\":[{\"type\":\"count\"}],\"requestType\":\"point\",\"resolution\":\"COARSE\",\"indexPatternId\":\"4a7f6010-0aed-11ea-9dd2-95afd7ad44d4\"},\"style\":{\"type\":\"VECTOR\",\"properties\":{\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}},\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"color\":\"Blues\",\"colorCategory\":\"palette_0\",\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"fieldMetaOptions\":{\"isEnabled\":true,\"sigma\":3},\"type\":\"ORDINAL\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":0}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"minSize\":7,\"maxSize\":32,\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"},\"fieldMetaOptions\":{\"isEnabled\":true,\"sigma\":3}}},\"iconOrientation\":{\"type\":\"STATIC\",\"options\":{\"orientation\":0}},\"labelText\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"name\":\"doc_count\",\"origin\":\"source\"}}},\"labelColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#000000\"}},\"labelSize\":{\"type\":\"STATIC\",\"options\":{\"size\":14}},\"labelBorderColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"labelBorderSize\":{\"options\":{\"size\":\"SMALL\"}}},\"isTimeAware\":true},\"id\":\"8d384d5d-6353-468f-b8f8-8eaa487358c4\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"visible\":true,\"type\":\"GEOJSON_VECTOR\",\"joins\":[]}]", "uiStateJSON": "{}" }, "references": [ diff --git a/x-pack/plugins/maps/server/maps_telemetry/util.ts b/x-pack/plugins/maps/server/maps_telemetry/util.ts index 27190c9b82142..defc2cb9aa9b3 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/util.ts +++ b/x-pack/plugins/maps/server/maps_telemetry/util.ts @@ -265,7 +265,7 @@ export function getTermJoinsPerCluster( layerLists: LayerDescriptor[][] ): TELEMETRY_TERM_JOIN_COUNTS_PER_CLUSTER { return getCountsByCluster(layerLists, (layerDescriptor: LayerDescriptor) => { - return layerDescriptor.type === LAYER_TYPE.VECTOR && + return layerDescriptor.type === LAYER_TYPE.GEOJSON_VECTOR && (layerDescriptor as VectorLayerDescriptor)?.joins?.length ? TELEMETRY_TERM_JOIN : null; diff --git a/x-pack/plugins/maps/server/saved_objects/saved_object_migrations.js b/x-pack/plugins/maps/server/saved_objects/saved_object_migrations.js index 6d23246860423..986878e65eb8b 100644 --- a/x-pack/plugins/maps/server/saved_objects/saved_object_migrations.js +++ b/x-pack/plugins/maps/server/saved_objects/saved_object_migrations.js @@ -18,6 +18,7 @@ import { setDefaultAutoFitToBounds } from '../../common/migrations/set_default_a import { addTypeToTermJoin } from '../../common/migrations/add_type_to_termjoin'; import { moveAttribution } from '../../common/migrations/move_attribution'; import { setEmsTmsDefaultModes } from '../../common/migrations/set_ems_tms_default_modes'; +import { renameLayerTypes } from '../../common/migrations/rename_layer_types'; function logMigrationWarning(context, errorMsg, doc) { context.log.warning( @@ -172,6 +173,19 @@ export const savedObjectMigrations = { try { const attributes = setEmsTmsDefaultModes(doc); + return { + ...doc, + attributes, + }; + } catch (e) { + logMigrationWarning(context, e.message, doc); + return doc; + } + }, + '8.1.0': (doc, context) => { + try { + const attributes = renameLayerTypes(doc); + return { ...doc, attributes, diff --git a/x-pack/plugins/ml/public/application/explorer/anomalies_map.tsx b/x-pack/plugins/ml/public/application/explorer/anomalies_map.tsx index 0eb6e356e1397..cb3651e4a458a 100644 --- a/x-pack/plugins/ml/public/application/explorer/anomalies_map.tsx +++ b/x-pack/plugins/ml/public/application/explorer/anomalies_map.tsx @@ -126,7 +126,7 @@ export const getChoroplethAnomaliesLayer = ( isTimeAware: true, }, visible: false, - type: LAYER_TYPE.VECTOR, + type: LAYER_TYPE.GEOJSON_VECTOR, }; }; diff --git a/x-pack/test/api_integration/apis/maps/migrations.js b/x-pack/test/api_integration/apis/maps/migrations.js index 19f79da940253..26de152f1473e 100644 --- a/x-pack/test/api_integration/apis/maps/migrations.js +++ b/x-pack/test/api_integration/apis/maps/migrations.js @@ -44,7 +44,7 @@ export default function ({ getService }) { type: 'index-pattern', }, ]); - expect(resp.body.migrationVersion).to.eql({ map: '8.0.0' }); // migrtionVersion is derived from both "migrations" and "convertToMultiNamespaceVersion" fields when the object is registered + expect(resp.body.migrationVersion).to.eql({ map: '8.1.0' }); // migrtionVersion is derived from both "migrations" and "convertToMultiNamespaceVersion" fields when the object is registered expect(resp.body.attributes.layerListJSON.includes('indexPatternRefName')).to.be(true); }); @@ -90,7 +90,7 @@ export default function ({ getService }) { } expect(panels.length).to.be(1); expect(panels[0].type).to.be('map'); - expect(panels[0].version).to.be('8.0.0'); + expect(panels[0].version).to.be('8.1.0'); }); }); }); From ded75bdb7ba22c8bb3271594c80a5c88f2332a66 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 3 Dec 2021 18:48:25 +0000 Subject: [PATCH 31/62] chore(NA): splits types from code on @kbn/crypto (#120371) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- package.json | 1 + packages/BUILD.bazel | 1 + packages/kbn-crypto/BUILD.bazel | 26 ++++++++++++++++++---- packages/kbn-crypto/package.json | 3 +-- packages/kbn-server-http-tools/BUILD.bazel | 2 +- yarn.lock | 4 ++++ 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 1e5a135b723ed..b2299c2391886 100644 --- a/package.json +++ b/package.json @@ -565,6 +565,7 @@ "@types/kbn__apm-utils": "link:bazel-bin/packages/kbn-apm-utils/npm_module_types", "@types/kbn__cli-dev-mode": "link:bazel-bin/packages/kbn-cli-dev-mode/npm_module_types", "@types/kbn__config": "link:bazel-bin/packages/kbn-config/npm_module_types", + "@types/kbn__crypto": "link:bazel-bin/packages/kbn-crypto/npm_module_types", "@types/kbn__i18n": "link:bazel-bin/packages/kbn-i18n/npm_module_types", "@types/kbn__i18n-react": "link:bazel-bin/packages/kbn-i18n-react/npm_module_types", "@types/license-checker": "15.0.0", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 8208496f7d800..1cf887290af77 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -84,6 +84,7 @@ filegroup( "//packages/kbn-apm-utils:build_types", "//packages/kbn-cli-dev-mode:build_types", "//packages/kbn-config:build_types", + "//packages/kbn-crypto:build_types", "//packages/kbn-i18n:build_types", "//packages/kbn-i18n-react:build_types", ], diff --git a/packages/kbn-crypto/BUILD.bazel b/packages/kbn-crypto/BUILD.bazel index 0f35aab461078..81ee6d770103c 100644 --- a/packages/kbn-crypto/BUILD.bazel +++ b/packages/kbn-crypto/BUILD.bazel @@ -1,10 +1,11 @@ -load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") -load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") -load("//src/dev/bazel:index.bzl", "jsts_transpiler") +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") PKG_BASE_NAME = "kbn-crypto" PKG_REQUIRE_NAME = "@kbn/crypto" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__crypto" SOURCE_FILES = glob( [ @@ -72,7 +73,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], + deps = RUNTIME_DEPS + [":target_node"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) @@ -91,3 +92,20 @@ filegroup( ], visibility = ["//visibility:public"], ) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = TYPES_PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [ + ":npm_module_types", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-crypto/package.json b/packages/kbn-crypto/package.json index 8fa6cd3c232fa..96bf21906ed4a 100644 --- a/packages/kbn-crypto/package.json +++ b/packages/kbn-crypto/package.json @@ -3,6 +3,5 @@ "version": "1.0.0", "private": true, "license": "SSPL-1.0 OR Elastic License 2.0", - "main": "./target_node/index.js", - "types": "./target_types/index.d.ts" + "main": "./target_node/index.js" } diff --git a/packages/kbn-server-http-tools/BUILD.bazel b/packages/kbn-server-http-tools/BUILD.bazel index 609fe6d00f173..b9eae3d022439 100644 --- a/packages/kbn-server-http-tools/BUILD.bazel +++ b/packages/kbn-server-http-tools/BUILD.bazel @@ -38,7 +38,7 @@ RUNTIME_DEPS = [ TYPES_DEPS = [ "//packages/kbn-config-schema", - "//packages/kbn-crypto", + "//packages/kbn-crypto:npm_module_types", "@npm//@hapi/hapi", "@npm//@hapi/hoek", "@npm//joi", diff --git a/yarn.lock b/yarn.lock index fc670fda132ca..c4d2a31724d48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5828,6 +5828,10 @@ version "0.0.0" uid "" +"@types/kbn__crypto@link:bazel-bin/packages/kbn-crypto/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__i18n-react@link:bazel-bin/packages/kbn-i18n-react/npm_module_types": version "0.0.0" uid "" From 3521a928d57adf531ac8331ed1008ac8e5e46ce8 Mon Sep 17 00:00:00 2001 From: Joe Portner <5295965+jportner@users.noreply.github.com> Date: Fri, 3 Dec 2021 14:56:01 -0500 Subject: [PATCH 32/62] More descriptive audit integration test errors (#120354) --- .../security_api_integration/tests/audit/audit_log.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/x-pack/test/security_api_integration/tests/audit/audit_log.ts b/x-pack/test/security_api_integration/tests/audit/audit_log.ts index fd7db8faadd54..bb4c27976c857 100644 --- a/x-pack/test/security_api_integration/tests/audit/audit_log.ts +++ b/x-pack/test/security_api_integration/tests/audit/audit_log.ts @@ -22,7 +22,14 @@ class FileWrapper { } async readJSON() { const content = await this.read(); - return content.map((l) => JSON.parse(l)); + try { + return content.map((l) => JSON.parse(l)); + } catch (err) { + const contentString = content.join('\n'); + throw new Error( + `Failed to parse audit log JSON, error: "${err.message}", audit.log contents:\n${contentString}` + ); + } } // writing in a file is an async operation. we use this method to make sure logs have been written. async isNotEmpty() { From b5895ec0b441befa5d0a4ada2ac602efd5ffe386 Mon Sep 17 00:00:00 2001 From: ymao1 Date: Fri, 3 Dec 2021 15:05:24 -0500 Subject: [PATCH 33/62] [Alerting] Skip writing alerts when rule execution times out (#114518) * Added cancel() to alerting task runner and writing event log document * Updating rule saved object with timeout execution status * Skip scheduling actions and logging event log for alerts if rule execution is cancelled * Adding config for disabling skipping actions * Fixing types * Adding flag for rule types to opt out of skipping acitons * Passing function into rule executor to determine whether to write AAD * Using task runner uuid to differentiate between task instances * Adding functional test * Fixing types * Updating service function name and adding logic to persistence rule type Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/alerting/server/mocks.ts | 1 + .../server/task_runner/task_runner.ts | 1 + x-pack/plugins/alerting/server/types.ts | 1 + .../server/routes/alerts/test_utils/index.ts | 1 + .../utils/create_lifecycle_executor.test.ts | 27 +++++++++++++++++++ .../server/utils/create_lifecycle_executor.ts | 14 +++++++--- .../utils/create_lifecycle_rule_type.test.ts | 23 +++++++++++++++- .../create_persistence_rule_type_wrapper.ts | 11 +++++++- .../server/utils/rule_executor_test_utils.ts | 3 +++ .../routes/rules/preview_rules_route.ts | 3 +++ .../rule_types/__mocks__/rule_type.ts | 1 + 11 files changed, 81 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/alerting/server/mocks.ts b/x-pack/plugins/alerting/server/mocks.ts index 7fb748a305037..f23dbf05449ad 100644 --- a/x-pack/plugins/alerting/server/mocks.ts +++ b/x-pack/plugins/alerting/server/mocks.ts @@ -74,6 +74,7 @@ const createAlertServicesMock = < .mockReturnValue(alertInstanceFactoryMock), savedObjectsClient: savedObjectsClientMock.create(), scopedClusterClient: elasticsearchServiceMock.createScopedClusterClient(), + shouldWriteAlerts: () => true, }; }; export type AlertServicesMock = ReturnType; diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.ts index fb7268ef529da..0cf5202787392 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner.ts @@ -323,6 +323,7 @@ export class TaskRunner< InstanceContext, WithoutReservedActionGroups >(alertInstances), + shouldWriteAlerts: () => this.shouldLogAndScheduleActionsForAlerts(), }, params, state: alertTypeState as State, diff --git a/x-pack/plugins/alerting/server/types.ts b/x-pack/plugins/alerting/server/types.ts index c1645936c06e9..343b717dcb1aa 100644 --- a/x-pack/plugins/alerting/server/types.ts +++ b/x-pack/plugins/alerting/server/types.ts @@ -75,6 +75,7 @@ export interface AlertServices< alertInstanceFactory: ( id: string ) => PublicAlertInstance; + shouldWriteAlerts: () => boolean; } export interface AlertExecutorOptions< diff --git a/x-pack/plugins/apm/server/routes/alerts/test_utils/index.ts b/x-pack/plugins/apm/server/routes/alerts/test_utils/index.ts index 22649a7010461..a8610bbcc8d37 100644 --- a/x-pack/plugins/apm/server/routes/alerts/test_utils/index.ts +++ b/x-pack/plugins/apm/server/routes/alerts/test_utils/index.ts @@ -45,6 +45,7 @@ export const createRuleTypeMocks = () => { alertInstanceFactory: jest.fn(() => ({ scheduleActions })), alertWithLifecycle: jest.fn(), logger: loggerMock, + shouldWriteAlerts: () => true, }; return { diff --git a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts index fcddcab378bc6..2c5fe09d80563 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts @@ -350,6 +350,33 @@ describe('createLifecycleExecutor', () => { }) ); }); + + it('does not write alert documents when rule execution is cancelled and feature flags indicate to skip', async () => { + const logger = loggerMock.create(); + const ruleDataClientMock = createRuleDataClientMock(); + const executor = createLifecycleExecutor( + logger, + ruleDataClientMock + )<{}, TestRuleState, never, never, never>(async (options) => { + expect(options.state).toEqual(initialRuleState); + + const nextRuleState: TestRuleState = { + aRuleStateKey: 'NEXT_RULE_STATE_VALUE', + }; + + return nextRuleState; + }); + + await executor( + createDefaultAlertExecutorOptions({ + params: {}, + state: { wrapped: initialRuleState, trackedAlerts: {} }, + shouldWriteAlerts: false, + }) + ); + + expect(ruleDataClientMock.getWriter).not.toHaveBeenCalled(); + }); }); type TestRuleState = Record & { diff --git a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts index 1acbc0c3f43bd..c30b1654a3587 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts @@ -140,7 +140,7 @@ export const createLifecycleExecutor = > ): Promise> => { const { - services: { alertInstanceFactory }, + services: { alertInstanceFactory, shouldWriteAlerts }, state: previousState, } = options; @@ -281,7 +281,15 @@ export const createLifecycleExecutor = const newEventsToIndex = makeEventsDataMapFor(newAlertIds); const allEventsToIndex = [...trackedEventsToIndex, ...newEventsToIndex]; - if (allEventsToIndex.length > 0 && ruleDataClient.isWriteEnabled()) { + // Only write alerts if: + // - writing is enabled + // AND + // - rule execution has not been cancelled due to timeout + // OR + // - if execution has been cancelled due to timeout, if feature flags are configured to write alerts anyway + const writeAlerts = ruleDataClient.isWriteEnabled() && shouldWriteAlerts(); + + if (allEventsToIndex.length > 0 && writeAlerts) { logger.debug(`Preparing to index ${allEventsToIndex.length} alerts.`); await ruleDataClient.getWriter().bulk({ @@ -307,6 +315,6 @@ export const createLifecycleExecutor = return { wrapped: nextWrappedState ?? ({} as State), - trackedAlerts: ruleDataClient.isWriteEnabled() ? nextTrackedAlerts : {}, + trackedAlerts: writeAlerts ? nextTrackedAlerts : {}, }; }; diff --git a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts index 2284ad5e796ee..f0e2412629bb1 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts @@ -21,7 +21,7 @@ import { createLifecycleRuleTypeFactory } from './create_lifecycle_rule_type_fac type RuleTestHelpers = ReturnType; -function createRule() { +function createRule(shouldWriteAlerts: boolean = true) { const ruleDataClientMock = createRuleDataClientMock(); const factory = createLifecycleRuleTypeFactory({ @@ -110,6 +110,7 @@ function createRule() { alertInstanceFactory, savedObjectsClient: {} as any, scopedClusterClient: {} as any, + shouldWriteAlerts: () => shouldWriteAlerts, }, spaceId: 'spaceId', state, @@ -152,6 +153,26 @@ describe('createLifecycleRuleTypeFactory', () => { }); }); + describe('when rule is cancelled due to timeout and config flags indicate to skip actions', () => { + beforeEach(() => { + helpers = createRule(false); + helpers.ruleDataClientMock.isWriteEnabled.mockReturnValue(true); + }); + + it("doesn't persist anything", async () => { + await helpers.alertWithLifecycle([ + { + id: 'opbeans-java', + fields: { + 'service.name': 'opbeans-java', + }, + }, + ]); + + expect(helpers.ruleDataClientMock.getWriter().bulk).toHaveBeenCalledTimes(0); + }); + }); + describe('when alerts are new', () => { beforeEach(async () => { await helpers.alertWithLifecycle([ diff --git a/x-pack/plugins/rule_registry/server/utils/create_persistence_rule_type_wrapper.ts b/x-pack/plugins/rule_registry/server/utils/create_persistence_rule_type_wrapper.ts index afdcf856a872f..de1193771dd95 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_persistence_rule_type_wrapper.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_persistence_rule_type_wrapper.ts @@ -25,7 +25,16 @@ export const createPersistenceRuleTypeWrapper: CreatePersistenceRuleTypeWrapper const numAlerts = alerts.length; logger.debug(`Found ${numAlerts} alerts.`); - if (ruleDataClient.isWriteEnabled() && numAlerts) { + // Only write alerts if: + // - writing is enabled + // AND + // - rule execution has not been cancelled due to timeout + // OR + // - if execution has been cancelled due to timeout, if feature flags are configured to write alerts anyway + const writeAlerts = + ruleDataClient.isWriteEnabled() && options.services.shouldWriteAlerts(); + + if (writeAlerts && numAlerts) { const commonRuleFields = getCommonAlertFields(options); const CHUNK_SIZE = 10000; diff --git a/x-pack/plugins/rule_registry/server/utils/rule_executor_test_utils.ts b/x-pack/plugins/rule_registry/server/utils/rule_executor_test_utils.ts index 95a6761152371..288830f4b3804 100644 --- a/x-pack/plugins/rule_registry/server/utils/rule_executor_test_utils.ts +++ b/x-pack/plugins/rule_registry/server/utils/rule_executor_test_utils.ts @@ -31,6 +31,7 @@ export const createDefaultAlertExecutorOptions = < createdAt = new Date(), startedAt = new Date(), updatedAt = new Date(), + shouldWriteAlerts = true, }: { alertId?: string; ruleName?: string; @@ -39,6 +40,7 @@ export const createDefaultAlertExecutorOptions = < createdAt?: Date; startedAt?: Date; updatedAt?: Date; + shouldWriteAlerts?: boolean; }): AlertExecutorOptions => ({ alertId, createdBy: 'CREATED_BY', @@ -69,6 +71,7 @@ export const createDefaultAlertExecutorOptions = < .alertInstanceFactory, savedObjectsClient: savedObjectsClientMock.create(), scopedClusterClient: elasticsearchServiceMock.createScopedClusterClient(), + shouldWriteAlerts: () => shouldWriteAlerts, }, state, updatedBy: null, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts index 882732544dcbb..3949e71582020 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts @@ -122,6 +122,7 @@ export const previewRulesRoute = async ( ruleTypeId: string, ruleTypeName: string, params: TParams, + shouldWriteAlerts: () => boolean, alertInstanceFactory: ( id: string ) => Pick< @@ -157,6 +158,7 @@ export const previewRulesRoute = async ( previousStartedAt, rule, services: { + shouldWriteAlerts, alertInstanceFactory, savedObjectsClient: context.core.savedObjects.client, scopedClusterClient: context.core.elasticsearch.client, @@ -191,6 +193,7 @@ export const previewRulesRoute = async ( signalRuleAlertType.id, signalRuleAlertType.name, previewRuleParams, + () => true, alertInstanceFactoryStub ); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule_type.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule_type.ts index c6f818f04fc5d..aaab81a4c66ff 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule_type.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/__mocks__/rule_type.ts @@ -78,6 +78,7 @@ export const createRuleTypeMocks = ( findAlerts: jest.fn(), // TODO: does this stay? alertWithPersistence: jest.fn(), logger: loggerMock, + shouldWriteAlerts: () => true, }; return { From dbde0a75f92303b525d7845735085d08329006a1 Mon Sep 17 00:00:00 2001 From: Stacey Gammon Date: Fri, 3 Dec 2021 15:43:32 -0500 Subject: [PATCH 34/62] Update performance docs to touch on server-side considerations (#120356) * Update performance docs to touch on server-side considerations * update edited date --- dev_docs/key_concepts/performance.mdx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dev_docs/key_concepts/performance.mdx b/dev_docs/key_concepts/performance.mdx index 0201c7774f854..5d955c789ddeb 100644 --- a/dev_docs/key_concepts/performance.mdx +++ b/dev_docs/key_concepts/performance.mdx @@ -3,11 +3,13 @@ id: kibDevPerformance slug: /kibana-dev-docs/key-concepts/performance title: Performance summary: Performance tips for Kibana development. -date: 2021-09-02 +date: 2021-12-03 tags: ['kibana', 'onboarding', 'dev', 'performance'] --- -## Keep Kibana fast +## Client-side considerations + +### Lazy load code _tl;dr_: Load as much code lazily as possible. Everyone loves snappy applications with a responsive UI and hates spinners. Users deserve the @@ -105,3 +107,15 @@ Many OSS tools allow you to analyze the generated stats file: Webpack authors - [webpack-visualizer](https://chrisbateman.github.io/webpack-visualizer/) - [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) + +## Server-side considerations + +### Don't block the event loop + +[Node.js is single threaded](https://nodejs.dev/learn/introduction-to-nodejs) which means a single CPU-intensive server-side, synchronous operation will block any other functionality waiting to execute on the Kibana server. The affects background tasks, like alerts, and search sessions, as well as search requests and page loads. + +**When writing code that will run on the server, [don't block the event loop](https://nodejs.org/en/docs/guides/dont-block-the-event-loop/)**. Instead consider: + +- Writing async code. For example, leverage [setImmediate](https://nodejs.dev/learn/understanding-setimmediate) inside for loops. +- Executing logic on the client instead. This may not be a good option if you require a lot of data going back and forth between the server and the client, as that can also slow down the user's experience, especially over slower bandwidth internet connections. +- Worker threads are also an option if the code doesn't rely on stateful Kibana services. If you are interested in using worker threads, please reach out to a tech-lead before doing so. We will likely want to implement a worker threads pool to ensure worker threads cooperate appropriately. \ No newline at end of file From d21d721bd1104a3e231baa5775fcc6749423aafa Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Fri, 3 Dec 2021 12:44:50 -0800 Subject: [PATCH 35/62] [presentation] Create Expression Input (#119411) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- src/plugins/presentation_util/common/index.ts | 6 + src/plugins/presentation_util/kibana.json | 13 +- .../expression_input}/autocomplete.ts | 24 +- .../components/expression_input/constants.ts | 28 ++ .../expression_input.stories.tsx | 94 +++++ .../expression_input/expression_input.tsx | 82 +++++ .../components/expression_input/index.tsx | 16 + .../components/expression_input/language.ts | 23 +- .../components/expression_input/providers.ts | 189 ++++++++++ .../components/expression_input/reference.ts | 24 +- .../public/components/index.tsx | 5 + .../public/components/types.ts | 43 +++ src/plugins/presentation_util/public/index.ts | 19 +- src/plugins/presentation_util/public/mocks.ts | 2 + .../presentation_util/public/plugin.ts | 3 + .../public/services/index.ts | 3 + src/plugins/presentation_util/public/types.ts | 2 + .../presentation_util/storybook/decorator.tsx | 20 +- .../presentation_util/storybook/main.ts | 4 +- .../presentation_util/storybook/manager.ts | 5 + .../canvas/common/lib/autocomplete.test.ts | 198 ---------- x-pack/plugins/canvas/common/lib/index.ts | 1 - x-pack/plugins/canvas/public/application.tsx | 3 - .../components/expression/expression.tsx | 19 +- .../public/components/expression/index.tsx | 7 +- .../expression_input.stories.storyshot | 33 +- .../__stories__/expression_input.stories.tsx | 76 ++-- .../expression_input/expression_input.tsx | 344 ++---------------- x-pack/plugins/canvas/public/plugin.tsx | 5 + .../canvas/storybook/storyshots.test.tsx | 5 + .../translations/translations/ja-JP.json | 12 +- .../translations/translations/zh-CN.json | 12 +- 32 files changed, 663 insertions(+), 657 deletions(-) rename {x-pack/plugins/canvas/common/lib => src/plugins/presentation_util/public/components/expression_input}/autocomplete.ts (98%) create mode 100644 src/plugins/presentation_util/public/components/expression_input/constants.ts create mode 100644 src/plugins/presentation_util/public/components/expression_input/expression_input.stories.tsx create mode 100644 src/plugins/presentation_util/public/components/expression_input/expression_input.tsx create mode 100644 src/plugins/presentation_util/public/components/expression_input/index.tsx rename x-pack/plugins/canvas/public/lib/monaco_language_def.ts => src/plugins/presentation_util/public/components/expression_input/language.ts (74%) create mode 100644 src/plugins/presentation_util/public/components/expression_input/providers.ts rename {x-pack/plugins/canvas => src/plugins/presentation_util}/public/components/expression_input/reference.ts (79%) delete mode 100644 x-pack/plugins/canvas/common/lib/autocomplete.test.ts diff --git a/src/plugins/presentation_util/common/index.ts b/src/plugins/presentation_util/common/index.ts index 4510a0aac5a0b..a84a78c823a5f 100644 --- a/src/plugins/presentation_util/common/index.ts +++ b/src/plugins/presentation_util/common/index.ts @@ -12,4 +12,10 @@ export const PLUGIN_ID = 'presentationUtil'; export const PLUGIN_NAME = 'presentationUtil'; +/** + * The unique identifier for the Expressions Language for use in the ExpressionInput + * and CodeEditor components. + */ +export const EXPRESSIONS_LANGUAGE_ID = 'kibana-expressions'; + export * from './labs'; diff --git a/src/plugins/presentation_util/kibana.json b/src/plugins/presentation_util/kibana.json index 210937b335e50..32460a8455152 100644 --- a/src/plugins/presentation_util/kibana.json +++ b/src/plugins/presentation_util/kibana.json @@ -9,7 +9,16 @@ "kibanaVersion": "kibana", "server": true, "ui": true, - "extraPublicDirs": ["common/lib"], - "requiredPlugins": ["savedObjects", "data", "dataViews", "embeddable", "kibanaReact"], + "extraPublicDirs": [ + "common/lib" + ], + "requiredPlugins": [ + "savedObjects", + "data", + "dataViews", + "embeddable", + "kibanaReact", + "expressions" + ], "optionalPlugins": [] } diff --git a/x-pack/plugins/canvas/common/lib/autocomplete.ts b/src/plugins/presentation_util/public/components/expression_input/autocomplete.ts similarity index 98% rename from x-pack/plugins/canvas/common/lib/autocomplete.ts rename to src/plugins/presentation_util/public/components/expression_input/autocomplete.ts index 88fb6b052b957..5f0c9cab6215c 100644 --- a/x-pack/plugins/canvas/common/lib/autocomplete.ts +++ b/src/plugins/presentation_util/public/components/expression_input/autocomplete.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 { uniq } from 'lodash'; @@ -15,9 +16,9 @@ import { ExpressionFunction, ExpressionFunctionParameter, getByAlias, -} from '../../../../../src/plugins/expressions/common'; +} from '../../../../expressions/common'; -const MARKER = 'CANVAS_SUGGESTION_MARKER'; +const MARKER = 'EXPRESSIONS_SUGGESTION_MARKER'; interface BaseSuggestion { text: string; @@ -25,11 +26,6 @@ interface BaseSuggestion { end: number; } -export interface FunctionSuggestion extends BaseSuggestion { - type: 'function'; - fnDef: ExpressionFunction; -} - interface ArgSuggestionValue extends Omit { name: string; } @@ -43,8 +39,6 @@ interface ValueSuggestion extends BaseSuggestion { type: 'value'; } -export type AutocompleteSuggestion = FunctionSuggestion | ArgSuggestion | ValueSuggestion; - interface FnArgAtPosition { ast: ExpressionASTWithMeta; fnIndex: number; @@ -57,6 +51,7 @@ interface FnArgAtPosition { // If this function is a sub-expression function, we need the parent function and argument // name to determine the return type of the function parentFn?: string; + // If this function is a sub-expression function, the context could either be local or it // could be the parent's previous function. contextFn?: string | null; @@ -101,6 +96,13 @@ type ExpressionASTWithMeta = ASTMetaInformation< > >; +export interface FunctionSuggestion extends BaseSuggestion { + type: 'function'; + fnDef: ExpressionFunction; +} + +export type AutocompleteSuggestion = FunctionSuggestion | ArgSuggestion | ValueSuggestion; + // Typeguard for checking if ExpressionArg is a new expression function isExpression( maybeExpression: ExpressionArgASTWithMeta diff --git a/src/plugins/presentation_util/public/components/expression_input/constants.ts b/src/plugins/presentation_util/public/components/expression_input/constants.ts new file mode 100644 index 0000000000000..f937d55cbf9bb --- /dev/null +++ b/src/plugins/presentation_util/public/components/expression_input/constants.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 and the 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 { CodeEditorProps } from '../../../../kibana_react/public'; + +export const LANGUAGE_CONFIGURATION = { + autoClosingPairs: [ + { + open: '{', + close: '}', + }, + ], +}; + +export const CODE_EDITOR_OPTIONS: CodeEditorProps['options'] = { + scrollBeyondLastLine: false, + quickSuggestions: true, + minimap: { + enabled: false, + }, + wordWrap: 'on', + wrappingIndent: 'indent', +}; diff --git a/src/plugins/presentation_util/public/components/expression_input/expression_input.stories.tsx b/src/plugins/presentation_util/public/components/expression_input/expression_input.stories.tsx new file mode 100644 index 0000000000000..648171959791f --- /dev/null +++ b/src/plugins/presentation_util/public/components/expression_input/expression_input.stories.tsx @@ -0,0 +1,94 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the 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 React from 'react'; +import { action } from '@storybook/addon-actions'; +import { Meta } from '@storybook/react'; + +import { ExpressionFunction, ExpressionFunctionParameter, Style } from 'src/plugins/expressions'; +import { ExpressionInput } from '../expression_input'; +import { registerExpressionsLanguage } from './language'; + +const content: ExpressionFunctionParameter<'string'> = { + name: 'content', + required: false, + help: 'A string of text that contains Markdown. To concatenate, pass the `string` function multiple times.', + types: ['string'], + default: '', + aliases: ['_', 'expression'], + multi: true, + resolve: false, + options: [], + accepts: () => true, +}; + +const font: ExpressionFunctionParameter