diff --git a/.github/ISSUE_TEMPLATE/v8_breaking_change.md b/.github/ISSUE_TEMPLATE/v8_breaking_change.md
index 86e321990d05f5..67d2ee2d3286b4 100644
--- a/.github/ISSUE_TEMPLATE/v8_breaking_change.md
+++ b/.github/ISSUE_TEMPLATE/v8_breaking_change.md
@@ -2,7 +2,7 @@
name: 8.0 Breaking change
about: Breaking changes from 7.x -> 8.0
title: "[Breaking change]"
-labels: Team:Elasticsearch UI, Feature:Upgrade Assistant, Breaking Change
+labels: Feature:Upgrade Assistant, Breaking Change
assignees: ''
---
@@ -12,8 +12,8 @@ assignees: ''
******* LABEL CHANGES NECESSARY ********
****************************************
-Please add a "NeededFor:${TeamName}" label to denote the team that is
-requesting the breaking change to be surfaced in the Upgrade Assistant.
+Please add a team label to denote the team that the
+breaking change is applicable to.
-->
@@ -30,16 +30,14 @@ requesting the breaking change to be surfaced in the Upgrade Assistant.
-**How can we programmatically determine whether the cluster is affected by this breaking change?**
+**Can the change be registered with the [Kibana deprecation service](https://github.com/elastic/kibana/blob/master/docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md)?**
-**What can users do to address the change manually?**
+
-
-
-**How could we make migration easier with the Upgrade Assistant?**
-
-
+
**Are there any edge cases?**
diff --git a/docs/discover/search.asciidoc b/docs/discover/search.asciidoc
index 9971a6f574f9c6..0306be3eb670d7 100644
--- a/docs/discover/search.asciidoc
+++ b/docs/discover/search.asciidoc
@@ -110,7 +110,7 @@ image::discover/images/read-only-badge.png[Example of Discover's read only acces
==== Save a search
To save the current search:
-. Click *Save* in the Kibana toolbar.
+. Click *Save* in the toolbar.
. Enter a name for the search and click *Save*.
To import, export, and delete saved searches, open the main menu,
@@ -119,7 +119,7 @@ then click *Stack Management > Saved Objects*.
==== Open a saved search
To load a saved search into Discover:
-. Click *Open* in the Kibana toolbar.
+. Click *Open* in the toolbar.
. Select the search you want to open.
If the saved search is associated with a different index pattern than is currently
diff --git a/packages/kbn-cli-dev-mode/src/dev_server.ts b/packages/kbn-cli-dev-mode/src/dev_server.ts
index 3daf298c823249..60a279e456e3df 100644
--- a/packages/kbn-cli-dev-mode/src/dev_server.ts
+++ b/packages/kbn-cli-dev-mode/src/dev_server.ts
@@ -249,5 +249,11 @@ export class DevServer {
)
.subscribe(subscriber)
);
+
+ // complete state subjects when run$ completes
+ subscriber.add(() => {
+ this.phase$.complete();
+ this.ready$.complete();
+ });
});
}
diff --git a/packages/kbn-cli-dev-mode/src/optimizer.test.ts b/packages/kbn-cli-dev-mode/src/optimizer.test.ts
index e3bfb2eb0bb9e9..ee8ea5f38ae84f 100644
--- a/packages/kbn-cli-dev-mode/src/optimizer.test.ts
+++ b/packages/kbn-cli-dev-mode/src/optimizer.test.ts
@@ -180,6 +180,7 @@ it('is ready when optimizer phase is success or issue and logs in familiar forma
"ready: false",
"",
"ready: true",
+ "complete",
]
`);
diff --git a/packages/kbn-cli-dev-mode/src/optimizer.ts b/packages/kbn-cli-dev-mode/src/optimizer.ts
index 750b61140e920a..fab566829f7a6a 100644
--- a/packages/kbn-cli-dev-mode/src/optimizer.ts
+++ b/packages/kbn-cli-dev-mode/src/optimizer.ts
@@ -107,14 +107,26 @@ export class Optimizer {
},
]);
- this.run$ = runOptimizer(config).pipe(
- logOptimizerState(log, config),
- tap(({ state }) => {
- this.phase$.next(state.phase);
- this.ready$.next(state.phase === 'success' || state.phase === 'issue');
- }),
- ignoreElements()
- );
+ this.run$ = new Rx.Observable((subscriber) => {
+ subscriber.add(
+ runOptimizer(config)
+ .pipe(
+ logOptimizerState(log, config),
+ tap(({ state }) => {
+ this.phase$.next(state.phase);
+ this.ready$.next(state.phase === 'success' || state.phase === 'issue');
+ }),
+ ignoreElements()
+ )
+ .subscribe(subscriber)
+ );
+
+ // complete state subjects when run$ completes
+ subscriber.add(() => {
+ this.phase$.complete();
+ this.ready$.complete();
+ });
+ });
}
getPhase$() {
diff --git a/packages/kbn-cli-dev-mode/src/watcher.ts b/packages/kbn-cli-dev-mode/src/watcher.ts
index 8e8d2db1b20bb2..17993326cfcf3a 100644
--- a/packages/kbn-cli-dev-mode/src/watcher.ts
+++ b/packages/kbn-cli-dev-mode/src/watcher.ts
@@ -103,6 +103,11 @@ export class Watcher {
.pipe(ignoreElements())
.subscribe(subscriber)
);
+
+ // complete state subjects when run$ completes
+ subscriber.add(() => {
+ this.restart$.complete();
+ });
});
serverShouldRestart$() {
diff --git a/packages/kbn-optimizer/src/cli.ts b/packages/kbn-optimizer/src/cli.ts
index 6e3106dbc2af79..d5b9996dfb2cd2 100644
--- a/packages/kbn-optimizer/src/cli.ts
+++ b/packages/kbn-optimizer/src/cli.ts
@@ -6,8 +6,6 @@
* Side Public License, v 1.
*/
-import 'source-map-support/register';
-
import Path from 'path';
import { REPO_ROOT } from '@kbn/utils';
diff --git a/packages/kbn-storybook/tsconfig.json b/packages/kbn-storybook/tsconfig.json
index db10d4630ff9c8..5c81c9100e6017 100644
--- a/packages/kbn-storybook/tsconfig.json
+++ b/packages/kbn-storybook/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../tsconfig.json",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"outDir": "target",
diff --git a/scripts/build_kibana_platform_plugins.js b/scripts/build_kibana_platform_plugins.js
index fa630e0bb1808d..9038d08364400c 100644
--- a/scripts/build_kibana_platform_plugins.js
+++ b/scripts/build_kibana_platform_plugins.js
@@ -7,6 +7,7 @@
*/
require('../src/setup_node_env/ensure_node_preserve_symlinks');
+require('source-map-support/register');
require('@kbn/optimizer').runKbnOptimizerCli({
defaultLimitsPath: require.resolve('../packages/kbn-optimizer/limits.yml'),
});
diff --git a/src/core/tsconfig.json b/src/core/tsconfig.json
index 855962070457e7..f19e379482d3cf 100644
--- a/src/core/tsconfig.json
+++ b/src/core/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../tsconfig.base.json",
+ "extends": "../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/dev/typescript/project.ts b/src/dev/typescript/project.ts
index 8d92284e496379..04a5de945619b8 100644
--- a/src/dev/typescript/project.ts
+++ b/src/dev/typescript/project.ts
@@ -7,7 +7,7 @@
*/
import { basename, dirname, relative, resolve } from 'path';
-
+import { memoize } from 'lodash';
import { IMinimatch, Minimatch } from 'minimatch';
import { REPO_ROOT } from '@kbn/utils';
@@ -26,6 +26,10 @@ function testMatchers(matchers: IMinimatch[], path: string) {
return matchers.some((matcher) => matcher.match(path));
}
+const parentProjectFactory = memoize(function (parentConfigPath: string) {
+ return new Project(parentConfigPath);
+});
+
export class Project {
public directory: string;
public name: string;
@@ -34,6 +38,7 @@ export class Project {
private readonly include: IMinimatch[];
private readonly exclude: IMinimatch[];
+ private readonly parent?: Project;
constructor(
public tsConfigPath: string,
@@ -41,15 +46,16 @@ export class Project {
) {
this.config = parseTsConfig(tsConfigPath);
- const { files, include, exclude = [] } = this.config as {
+ const { files, include, exclude = [], extends: extendsPath } = this.config as {
files?: string[];
include?: string[];
exclude?: string[];
+ extends?: string;
};
if (files || !include) {
throw new Error(
- 'tsconfig.json files in the Kibana repo must use "include" keys and not "files"'
+ `[${tsConfigPath}]: tsconfig.json files in the Kibana repo must use "include" keys and not "files"`
);
}
@@ -58,9 +64,30 @@ export class Project {
this.name = options.name || relative(REPO_ROOT, this.directory) || basename(this.directory);
this.include = makeMatchers(this.directory, include);
this.exclude = makeMatchers(this.directory, exclude);
+
+ if (extendsPath !== undefined) {
+ const parentConfigPath = resolve(this.directory, extendsPath);
+ this.parent = parentProjectFactory(parentConfigPath);
+ }
+ }
+
+ public isAbsolutePathSelected(path: string): boolean {
+ return this.isExcluded(path) ? false : this.isIncluded(path);
}
- public isAbsolutePathSelected(path: string) {
- return testMatchers(this.exclude, path) ? false : testMatchers(this.include, path);
+ public isExcluded(path: string): boolean {
+ if (testMatchers(this.exclude, path)) return true;
+ if (this.parent) {
+ return this.parent.isExcluded(path);
+ }
+ return false;
+ }
+
+ public isIncluded(path: string): boolean {
+ if (testMatchers(this.include, path)) return true;
+ if (this.parent) {
+ return this.parent.isIncluded(path);
+ }
+ return false;
}
}
diff --git a/src/plugins/advanced_settings/tsconfig.json b/src/plugins/advanced_settings/tsconfig.json
index 4d62e410326b69..97a855959903de 100644
--- a/src/plugins/advanced_settings/tsconfig.json
+++ b/src/plugins/advanced_settings/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/apm_oss/tsconfig.json b/src/plugins/apm_oss/tsconfig.json
index aeb6837c69a998..ccb123aaec83bc 100644
--- a/src/plugins/apm_oss/tsconfig.json
+++ b/src/plugins/apm_oss/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/bfetch/tsconfig.json b/src/plugins/bfetch/tsconfig.json
index 173ff725d07d02..6c01479f1929ed 100644
--- a/src/plugins/bfetch/tsconfig.json
+++ b/src/plugins/bfetch/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/charts/tsconfig.json b/src/plugins/charts/tsconfig.json
index a4f65d5937204c..99edb2ffe3c162 100644
--- a/src/plugins/charts/tsconfig.json
+++ b/src/plugins/charts/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/console/tsconfig.json b/src/plugins/console/tsconfig.json
index 34aca5021bac4e..d9f49036be8f8f 100644
--- a/src/plugins/console/tsconfig.json
+++ b/src/plugins/console/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/dashboard/public/application/dashboard_router.tsx b/src/plugins/dashboard/public/application/dashboard_router.tsx
index f981b135c4359b..e5281a257ee13d 100644
--- a/src/plugins/dashboard/public/application/dashboard_router.tsx
+++ b/src/plugins/dashboard/public/application/dashboard_router.tsx
@@ -84,6 +84,7 @@ export async function mountApp({
const spacesApi = pluginsStart.spacesOss?.isSpacesAvailable ? pluginsStart.spacesOss : undefined;
const activeSpaceId = spacesApi && (await spacesApi.activeSpace$.pipe(first()).toPromise())?.id;
+ let globalEmbedSettings: DashboardEmbedSettings | undefined;
const dashboardServices: DashboardAppServices = {
navigation,
@@ -149,9 +150,6 @@ export async function mountApp({
const getDashboardEmbedSettings = (
routeParams: ParsedQuery
): DashboardEmbedSettings | undefined => {
- if (!routeParams.embed) {
- return undefined;
- }
return {
forceShowTopNavMenu: Boolean(routeParams[dashboardUrlParams.showTopMenu]),
forceShowQueryInput: Boolean(routeParams[dashboardUrlParams.showQueryInput]),
@@ -162,11 +160,13 @@ export async function mountApp({
const renderDashboard = (routeProps: RouteComponentProps<{ id?: string }>) => {
const routeParams = parse(routeProps.history.location.search);
- const embedSettings = getDashboardEmbedSettings(routeParams);
+ if (routeParams.embed && !globalEmbedSettings) {
+ globalEmbedSettings = getDashboardEmbedSettings(routeParams);
+ }
return (
redirect(routeProps, props)}
/>
diff --git a/src/plugins/dashboard/tsconfig.json b/src/plugins/dashboard/tsconfig.json
index dd99119cfb4570..452208b39af601 100644
--- a/src/plugins/dashboard/tsconfig.json
+++ b/src/plugins/dashboard/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/data/common/search/expressions/exists_filter.test.ts b/src/plugins/data/common/search/expressions/exists_filter.test.ts
index e3b53b22813983..60e8a9c7a09ce5 100644
--- a/src/plugins/data/common/search/expressions/exists_filter.test.ts
+++ b/src/plugins/data/common/search/expressions/exists_filter.test.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { createMockContext } from '../../../../expressions/common';
+import { createMockContext } from '../../../../expressions/common/mocks';
import { functionWrapper } from './utils';
import { existsFilterFunction } from './exists_filter';
diff --git a/src/plugins/data/common/search/expressions/kibana_filter.test.ts b/src/plugins/data/common/search/expressions/kibana_filter.test.ts
index ac8ae55492cc06..56a9e1ce660cda 100644
--- a/src/plugins/data/common/search/expressions/kibana_filter.test.ts
+++ b/src/plugins/data/common/search/expressions/kibana_filter.test.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { createMockContext } from '../../../../expressions/common';
+import { createMockContext } from '../../../../expressions/common/mocks';
import { functionWrapper } from './utils';
import { kibanaFilterFunction } from './kibana_filter';
diff --git a/src/plugins/data/common/search/expressions/phrase_filter.test.ts b/src/plugins/data/common/search/expressions/phrase_filter.test.ts
index 39bd907513a0df..90e471e166f5eb 100644
--- a/src/plugins/data/common/search/expressions/phrase_filter.test.ts
+++ b/src/plugins/data/common/search/expressions/phrase_filter.test.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { createMockContext } from '../../../../expressions/common';
+import { createMockContext } from '../../../../expressions/common/mocks';
import { functionWrapper } from './utils';
import { phraseFilterFunction } from './phrase_filter';
diff --git a/src/plugins/data/common/search/expressions/range_filter.test.ts b/src/plugins/data/common/search/expressions/range_filter.test.ts
index 92670f8a044ba6..129e6bd82e16a6 100644
--- a/src/plugins/data/common/search/expressions/range_filter.test.ts
+++ b/src/plugins/data/common/search/expressions/range_filter.test.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { createMockContext } from '../../../../expressions/common';
+import { createMockContext } from '../../../../expressions/common/mocks';
import { functionWrapper } from './utils';
import { rangeFilterFunction } from './range_filter';
diff --git a/src/plugins/data/tsconfig.json b/src/plugins/data/tsconfig.json
index 9c95878af631eb..b99a2f6f85904b 100644
--- a/src/plugins/data/tsconfig.json
+++ b/src/plugins/data/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/dev_tools/tsconfig.json b/src/plugins/dev_tools/tsconfig.json
index c17b2341fd42f8..f369396b17fbe8 100644
--- a/src/plugins/dev_tools/tsconfig.json
+++ b/src/plugins/dev_tools/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/discover/tsconfig.json b/src/plugins/discover/tsconfig.json
index ec98199c3423ea..96765d76a340b6 100644
--- a/src/plugins/discover/tsconfig.json
+++ b/src/plugins/discover/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/embeddable/tsconfig.json b/src/plugins/embeddable/tsconfig.json
index 27a887500fb68e..eacfa831ecee5d 100644
--- a/src/plugins/embeddable/tsconfig.json
+++ b/src/plugins/embeddable/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/es_ui_shared/tsconfig.json b/src/plugins/es_ui_shared/tsconfig.json
index 9bcda2e0614de6..3d102daaf3aaf2 100644
--- a/src/plugins/es_ui_shared/tsconfig.json
+++ b/src/plugins/es_ui_shared/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/expressions/common/mocks.ts b/src/plugins/expressions/common/mocks.ts
index eaeebd8e534924..20bdbca07f008b 100644
--- a/src/plugins/expressions/common/mocks.ts
+++ b/src/plugins/expressions/common/mocks.ts
@@ -34,3 +34,5 @@ export const createMockExecutionContext =
...extraContext,
};
};
+
+export { createMockContext } from './util/test_utils';
diff --git a/src/plugins/expressions/common/util/index.ts b/src/plugins/expressions/common/util/index.ts
index 470dfc3c2d436b..5f83d962d5aea8 100644
--- a/src/plugins/expressions/common/util/index.ts
+++ b/src/plugins/expressions/common/util/index.ts
@@ -10,4 +10,3 @@ export * from './create_error';
export * from './get_by_alias';
export * from './tables_adapter';
export * from './expressions_inspector_adapter';
-export * from './test_utils';
diff --git a/src/plugins/expressions/tsconfig.json b/src/plugins/expressions/tsconfig.json
index cce71013cefa55..fe76ba3050a3bf 100644
--- a/src/plugins/expressions/tsconfig.json
+++ b/src/plugins/expressions/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/home/tsconfig.json b/src/plugins/home/tsconfig.json
index b15e1fc011b926..19ab5a8e6efec5 100644
--- a/src/plugins/home/tsconfig.json
+++ b/src/plugins/home/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/index_pattern_field_editor/tsconfig.json b/src/plugins/index_pattern_field_editor/tsconfig.json
index 559b1aaf0fc26c..c638fd34c6bbbf 100644
--- a/src/plugins/index_pattern_field_editor/tsconfig.json
+++ b/src/plugins/index_pattern_field_editor/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/index_pattern_management/tsconfig.json b/src/plugins/index_pattern_management/tsconfig.json
index 37bd3e4aa5bbb9..3c8fdb1cf65979 100644
--- a/src/plugins/index_pattern_management/tsconfig.json
+++ b/src/plugins/index_pattern_management/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/input_control_vis/tsconfig.json b/src/plugins/input_control_vis/tsconfig.json
index bef7bc394a6ccd..c2f8d8783e822d 100644
--- a/src/plugins/input_control_vis/tsconfig.json
+++ b/src/plugins/input_control_vis/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/inspector/tsconfig.json b/src/plugins/inspector/tsconfig.json
index 2a9c41464532c3..0e42e577428c69 100644
--- a/src/plugins/inspector/tsconfig.json
+++ b/src/plugins/inspector/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/kibana_legacy/tsconfig.json b/src/plugins/kibana_legacy/tsconfig.json
index 709036c9e82f43..0b3f42cd3b57b6 100644
--- a/src/plugins/kibana_legacy/tsconfig.json
+++ b/src/plugins/kibana_legacy/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/kibana_overview/tsconfig.json b/src/plugins/kibana_overview/tsconfig.json
index ac3ac109cb35f0..3396861cb9179b 100644
--- a/src/plugins/kibana_overview/tsconfig.json
+++ b/src/plugins/kibana_overview/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/src/plugins/kibana_react/public/table_list_view/table_list_view.tsx b/src/plugins/kibana_react/public/table_list_view/table_list_view.tsx
index fa0a32fc3d542a..0054bb9c01b41c 100644
--- a/src/plugins/kibana_react/public/table_list_view/table_list_view.tsx
+++ b/src/plugins/kibana_react/public/table_list_view/table_list_view.tsx
@@ -347,20 +347,6 @@ class TableListView extends React.Component
- );
- }
- }
-
renderToolsLeft() {
const selection = this.state.selectedIds;
@@ -473,10 +459,9 @@ class TableListView extends React.Component
@@ -406,7 +406,7 @@
>
{
});
});
+ it('should ignore 409 errors from elasticsearch', async () => {
+ const error = new ResponseError({ statusCode: 409 } as ApiResponse);
+ // Unclear why `mockRejectedValue()` has the params value type set to `never`
+ // @ts-expect-error
+ esClientMock.create.mockRejectedValue(error);
+ await expect(() => createArtifact(esClientMock, newArtifact)).not.toThrow();
+ });
+
it('should throw an ArtifactElasticsearchError if one is encountered', async () => {
setEsClientMethodResponseToError(esClientMock, 'create');
await expect(createArtifact(esClientMock, newArtifact)).rejects.toBeInstanceOf(
diff --git a/x-pack/plugins/fleet/tsconfig.json b/x-pack/plugins/fleet/tsconfig.json
index a20d82de3c859c..66849e017395b7 100644
--- a/x-pack/plugins/fleet/tsconfig.json
+++ b/x-pack/plugins/fleet/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/global_search/tsconfig.json b/x-pack/plugins/global_search/tsconfig.json
index 2d05328f445dfc..2571f7c2e29350 100644
--- a/x-pack/plugins/global_search/tsconfig.json
+++ b/x-pack/plugins/global_search/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/global_search_bar/tsconfig.json b/x-pack/plugins/global_search_bar/tsconfig.json
index 266eecc35c84bd..595d55c3c5a0dc 100644
--- a/x-pack/plugins/global_search_bar/tsconfig.json
+++ b/x-pack/plugins/global_search_bar/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/global_search_providers/tsconfig.json b/x-pack/plugins/global_search_providers/tsconfig.json
index f2759954a68452..9be9a681ee7c59 100644
--- a/x-pack/plugins/global_search_providers/tsconfig.json
+++ b/x-pack/plugins/global_search_providers/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/graph/tsconfig.json b/x-pack/plugins/graph/tsconfig.json
index 741c603e3aae4a..ae0d143455d523 100644
--- a/x-pack/plugins/graph/tsconfig.json
+++ b/x-pack/plugins/graph/tsconfig.json
@@ -1,6 +1,6 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
@@ -27,4 +27,4 @@
{ "path": "../../../src/plugins/kibana_utils/tsconfig.json" },
{ "path": "../../../src/plugins/kibana_react/tsconfig.json" }
]
- }
\ No newline at end of file
+ }
diff --git a/x-pack/plugins/grokdebugger/tsconfig.json b/x-pack/plugins/grokdebugger/tsconfig.json
index 51d2d0b6db0eac..3e9e2f78708143 100644
--- a/x-pack/plugins/grokdebugger/tsconfig.json
+++ b/x-pack/plugins/grokdebugger/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/index_lifecycle_management/tsconfig.json b/x-pack/plugins/index_lifecycle_management/tsconfig.json
index 75bd775a367497..bf43817cbc407b 100644
--- a/x-pack/plugins/index_lifecycle_management/tsconfig.json
+++ b/x-pack/plugins/index_lifecycle_management/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
@@ -8,7 +8,6 @@
"declarationMap": true
},
"include": [
- "__jest__/**/*",
"common/**/*",
"public/**/*",
"server/**/*",
diff --git a/x-pack/plugins/index_management/tsconfig.json b/x-pack/plugins/index_management/tsconfig.json
index 81a96a77cef832..0766839a230b97 100644
--- a/x-pack/plugins/index_management/tsconfig.json
+++ b/x-pack/plugins/index_management/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
@@ -8,11 +8,9 @@
"declarationMap": true
},
"include": [
- "__jest__/**/*",
"common/**/*",
"public/**/*",
"server/**/*",
- "test/**/*",
"../../../typings/**/*",
],
"references": [
diff --git a/x-pack/plugins/infra/public/utils/enzyme_helpers.tsx b/x-pack/plugins/infra/public/utils/enzyme_helpers.tsx
deleted file mode 100644
index 33fbbd03d790a1..00000000000000
--- a/x-pack/plugins/infra/public/utils/enzyme_helpers.tsx
+++ /dev/null
@@ -1,87 +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.
- */
-
-// eslint-disable-next-line import/no-extraneous-dependencies
-import { mount, ReactWrapper } from 'enzyme';
-import React from 'react';
-import { act as reactAct } from 'react-dom/test-utils';
-/**
- * A wrapper object to provide access to the state of a hook under test and to
- * enable interaction with that hook.
- */
-interface ReactHookWrapper {
- /* Ensures that async React operations have settled before and after the
- * given actor callback is called. The actor callback arguments provide easy
- * access to the last hook value and allow for updating the arguments passed
- * to the hook body to trigger reevaluation.
- */
- act: (actor: (lastHookValue: HookValue, setArgs: (args: Args) => void) => void) => void;
- /* The enzyme wrapper around the test component. */
- component: ReactWrapper;
- /* The most recent value return the by test harness of the hook. */
- getLastHookValue: () => HookValue;
- /* The jest Mock function that receives the hook values for introspection. */
- hookValueCallback: jest.Mock;
-}
-
-/**
- * Allows for execution of hooks inside of a test component which records the
- * returned values.
- *
- * @param body A function that calls the hook and returns data derived from it
- * @param WrapperComponent A component that, if provided, will be wrapped
- * around the test component. This can be useful to provide context values.
- * @return {ReactHookWrapper} An object providing access to the hook state and
- * functions to interact with it.
- */
-export const mountHook = (
- body: (args: Args) => HookValue,
- WrapperComponent?: React.ComponentType,
- initialArgs: Args = {} as Args
-): ReactHookWrapper => {
- const hookValueCallback = jest.fn();
- let component!: ReactWrapper;
-
- const act: ReactHookWrapper['act'] = (actor) => {
- reactAct(() => {
- actor(getLastHookValue(), (args: Args) => component.setProps(args));
- component.update();
- });
- };
-
- const getLastHookValue = () => {
- const calls = hookValueCallback.mock.calls;
- if (calls.length <= 0) {
- throw Error('No recent hook value present.');
- }
- return calls[calls.length - 1][0];
- };
-
- const HookComponent = (props: Args) => {
- hookValueCallback(body(props));
- return null;
- };
- const TestComponent: React.FunctionComponent = (args) =>
- WrapperComponent ? (
-
-
-
- ) : (
-
- );
-
- reactAct(() => {
- component = mount();
- });
-
- return {
- act,
- component,
- getLastHookValue,
- hookValueCallback,
- };
-};
diff --git a/x-pack/plugins/infra/server/lib/infra_ml/queries/metrics_hosts_anomalies.ts b/x-pack/plugins/infra/server/lib/infra_ml/queries/metrics_hosts_anomalies.ts
index ab50986c3b3d5b..b9bfcd302fb838 100644
--- a/x-pack/plugins/infra/server/lib/infra_ml/queries/metrics_hosts_anomalies.ts
+++ b/x-pack/plugins/infra/server/lib/infra_ml/queries/metrics_hosts_anomalies.ts
@@ -84,7 +84,7 @@ export const createMetricsHostsAnomaliesQuery = ({
const sortOptions = [
{ [sortToMlFieldMap[field]]: querySortDirection },
{ [TIEBREAKER_FIELD]: querySortDirection }, // Tiebreaker
- ];
+ ] as const;
const resultsQuery = {
...defaultRequestParameters,
diff --git a/x-pack/plugins/infra/server/lib/infra_ml/queries/metrics_k8s_anomalies.ts b/x-pack/plugins/infra/server/lib/infra_ml/queries/metrics_k8s_anomalies.ts
index 8fb8df5eef3d75..8dadcfe87c6f9e 100644
--- a/x-pack/plugins/infra/server/lib/infra_ml/queries/metrics_k8s_anomalies.ts
+++ b/x-pack/plugins/infra/server/lib/infra_ml/queries/metrics_k8s_anomalies.ts
@@ -83,7 +83,7 @@ export const createMetricsK8sAnomaliesQuery = ({
const sortOptions = [
{ [sortToMlFieldMap[field]]: querySortDirection },
{ [TIEBREAKER_FIELD]: querySortDirection }, // Tiebreaker
- ];
+ ] as const;
const resultsQuery = {
...defaultRequestParameters,
diff --git a/x-pack/plugins/infra/tsconfig.json b/x-pack/plugins/infra/tsconfig.json
index 765af7974a2f13..b684e1866282f9 100644
--- a/x-pack/plugins/infra/tsconfig.json
+++ b/x-pack/plugins/infra/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/ingest_pipelines/tsconfig.json b/x-pack/plugins/ingest_pipelines/tsconfig.json
index a248bc9f337fe3..5917b94caf76b3 100644
--- a/x-pack/plugins/ingest_pipelines/tsconfig.json
+++ b/x-pack/plugins/ingest_pipelines/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
@@ -11,7 +11,6 @@
"common/**/*",
"public/**/*",
"server/**/*",
- "__jest__/**/*",
"../../../typings/**/*"
],
"references": [
diff --git a/x-pack/plugins/lens/tsconfig.json b/x-pack/plugins/lens/tsconfig.json
index 134f0b4185b840..69ef52535dd9d9 100644
--- a/x-pack/plugins/lens/tsconfig.json
+++ b/x-pack/plugins/lens/tsconfig.json
@@ -1,6 +1,6 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
@@ -38,4 +38,4 @@
{ "path": "../../../src/plugins/embeddable/tsconfig.json"},
{ "path": "../../../src/plugins/presentation_util/tsconfig.json"},
]
- }
\ No newline at end of file
+ }
diff --git a/x-pack/plugins/license_management/tsconfig.json b/x-pack/plugins/license_management/tsconfig.json
index e6cb0101ee838b..925049ca924cfb 100644
--- a/x-pack/plugins/license_management/tsconfig.json
+++ b/x-pack/plugins/license_management/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/licensing/tsconfig.json b/x-pack/plugins/licensing/tsconfig.json
index 6118bcd81d342c..2d744e57c1895a 100644
--- a/x-pack/plugins/licensing/tsconfig.json
+++ b/x-pack/plugins/licensing/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/logstash/tsconfig.json b/x-pack/plugins/logstash/tsconfig.json
index 6f21cfdb0b1919..6430248e46396c 100644
--- a/x-pack/plugins/logstash/tsconfig.json
+++ b/x-pack/plugins/logstash/tsconfig.json
@@ -1,6 +1,6 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/maps/public/classes/sources/source.ts b/x-pack/plugins/maps/public/classes/sources/source.ts
index 7c2aaf714c34e5..25e3595d6dffa1 100644
--- a/x-pack/plugins/maps/public/classes/sources/source.ts
+++ b/x-pack/plugins/maps/public/classes/sources/source.ts
@@ -84,7 +84,7 @@ export class AbstractSource implements ISource {
}
async supportsFitToBounds(): Promise {
- return true;
+ return false;
}
/**
diff --git a/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.tsx b/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.tsx
index 5474e62e175d10..959d6994c73395 100644
--- a/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.tsx
+++ b/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.tsx
@@ -147,6 +147,10 @@ export class AbstractVectorSource extends AbstractSource implements IVectorSourc
return false;
}
+ async supportsFitToBounds(): Promise {
+ return true;
+ }
+
async getBoundsForFilters(
boundsFilters: BoundsFilters,
registerCancelCallback: (callback: () => void) => void
diff --git a/x-pack/plugins/maps/public/components/validated_number_input.tsx b/x-pack/plugins/maps/public/components/validated_number_input.tsx
index cd525cf1ee2c97..942f31074000f9 100644
--- a/x-pack/plugins/maps/public/components/validated_number_input.tsx
+++ b/x-pack/plugins/maps/public/components/validated_number_input.tsx
@@ -6,8 +6,8 @@
*/
import React, { Component, ChangeEvent, ReactNode } from 'react';
-// @ts-expect-error
-import { EuiFieldNumber, EuiFormRow, EuiFormRowDisplayKeys } from '@elastic/eui';
+import { EuiFieldNumber, EuiFormRow } from '@elastic/eui';
+import type { EuiFormRowDisplayKeys } from '@elastic/eui/src/components/form/form_row/form_row';
import { i18n } from '@kbn/i18n';
import _ from 'lodash';
diff --git a/x-pack/plugins/maps/tsconfig.json b/x-pack/plugins/maps/tsconfig.json
index 1b74b7ee7566a8..59af94bea0b683 100644
--- a/x-pack/plugins/maps/tsconfig.json
+++ b/x-pack/plugins/maps/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/maps_legacy_licensing/tsconfig.json b/x-pack/plugins/maps_legacy_licensing/tsconfig.json
index 30a547b18a8312..3b8102b5205a88 100644
--- a/x-pack/plugins/maps_legacy_licensing/tsconfig.json
+++ b/x-pack/plugins/maps_legacy_licensing/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/ml/common/index.ts b/x-pack/plugins/ml/common/index.ts
index ac21954118e502..c15aa8f414fb1b 100644
--- a/x-pack/plugins/ml/common/index.ts
+++ b/x-pack/plugins/ml/common/index.ts
@@ -5,9 +5,11 @@
* 2.0.
*/
-export { HitsTotalRelation, SearchResponse7, HITS_TOTAL_RELATION } from './types/es_client';
+export { ES_CLIENT_TOTAL_HITS_RELATION } from './types/es_client';
export { ChartData } from './types/field_histograms';
export { ANOMALY_SEVERITY, ANOMALY_THRESHOLD, SEVERITY_COLORS } from './constants/anomalies';
export { getSeverityColor, getSeverityType } from './util/anomaly_utils';
+export { isPopulatedObject } from './util/object_utils';
+export { isRuntimeMappings } from './util/runtime_field_utils';
export { composeValidators, patternValidator } from './util/validators';
export { extractErrorMessage } from './util/errors';
diff --git a/x-pack/plugins/ml/common/types/es_client.ts b/x-pack/plugins/ml/common/types/es_client.ts
index f6db736db25194..249b3c150a082d 100644
--- a/x-pack/plugins/ml/common/types/es_client.ts
+++ b/x-pack/plugins/ml/common/types/es_client.ts
@@ -5,33 +5,24 @@
* 2.0.
*/
-import type { SearchResponse, ShardsResponse } from 'elasticsearch';
+import { estypes } from '@elastic/elasticsearch';
+
import { buildEsQuery } from '../../../../../src/plugins/data/common/es_query/es_query';
import type { DslQuery } from '../../../../../src/plugins/data/common/es_query/kuery';
import type { JsonObject } from '../../../../../src/plugins/kibana_utils/common';
-export const HITS_TOTAL_RELATION = {
+import { isPopulatedObject } from '../util/object_utils';
+
+export function isMultiBucketAggregate(arg: unknown): arg is estypes.MultiBucketAggregate {
+ return isPopulatedObject(arg, ['buckets']);
+}
+
+export const ES_CLIENT_TOTAL_HITS_RELATION: Record<
+ Uppercase,
+ estypes.TotalHitsRelation
+> = {
EQ: 'eq',
GTE: 'gte',
} as const;
-export type HitsTotalRelation = typeof HITS_TOTAL_RELATION[keyof typeof HITS_TOTAL_RELATION];
-
-// The types specified in `@types/elasticsearch` are out of date and still have `total: number`.
-interface SearchResponse7Hits {
- hits: SearchResponse['hits']['hits'];
- max_score: number;
- total: {
- value: number;
- relation: HitsTotalRelation;
- };
-}
-export interface SearchResponse7 {
- took: number;
- timed_out: boolean;
- _scroll_id?: string;
- _shards: ShardsResponse;
- hits: SearchResponse7Hits;
- aggregations?: any;
-}
export type InfluencersFilterQuery = ReturnType | DslQuery | JsonObject;
diff --git a/x-pack/plugins/ml/common/types/feature_importance.ts b/x-pack/plugins/ml/common/types/feature_importance.ts
index 964ce8c3257838..111c8432dd439a 100644
--- a/x-pack/plugins/ml/common/types/feature_importance.ts
+++ b/x-pack/plugins/ml/common/types/feature_importance.ts
@@ -88,15 +88,11 @@ export function isRegressionTotalFeatureImportance(
export function isClassificationFeatureImportanceBaseline(
baselineData: any
): baselineData is ClassificationFeatureImportanceBaseline {
- return (
- isPopulatedObject(baselineData) &&
- baselineData.hasOwnProperty('classes') &&
- Array.isArray(baselineData.classes)
- );
+ return isPopulatedObject(baselineData, ['classes']) && Array.isArray(baselineData.classes);
}
export function isRegressionFeatureImportanceBaseline(
baselineData: any
): baselineData is RegressionFeatureImportanceBaseline {
- return isPopulatedObject(baselineData) && baselineData.hasOwnProperty('baseline');
+ return isPopulatedObject(baselineData, ['baseline']);
}
diff --git a/x-pack/plugins/ml/common/util/object_utils.test.ts b/x-pack/plugins/ml/common/util/object_utils.test.ts
new file mode 100644
index 00000000000000..8e4196ed4d826e
--- /dev/null
+++ b/x-pack/plugins/ml/common/util/object_utils.test.ts
@@ -0,0 +1,50 @@
+/*
+ * Copyright 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 { isPopulatedObject } from './object_utils';
+
+describe('object_utils', () => {
+ describe('isPopulatedObject()', () => {
+ it('does not allow numbers', () => {
+ expect(isPopulatedObject(0)).toBe(false);
+ });
+ it('does not allow strings', () => {
+ expect(isPopulatedObject('')).toBe(false);
+ });
+ it('does not allow null', () => {
+ expect(isPopulatedObject(null)).toBe(false);
+ });
+ it('does not allow an empty object', () => {
+ expect(isPopulatedObject({})).toBe(false);
+ });
+ it('allows an object with an attribute', () => {
+ expect(isPopulatedObject({ attribute: 'value' })).toBe(true);
+ });
+ it('does not allow an object with a non-existing required attribute', () => {
+ expect(isPopulatedObject({ attribute: 'value' }, ['otherAttribute'])).toBe(false);
+ });
+ it('allows an object with an existing required attribute', () => {
+ expect(isPopulatedObject({ attribute: 'value' }, ['attribute'])).toBe(true);
+ });
+ it('allows an object with two existing required attributes', () => {
+ expect(
+ isPopulatedObject({ attribute1: 'value1', attribute2: 'value2' }, [
+ 'attribute1',
+ 'attribute2',
+ ])
+ ).toBe(true);
+ });
+ it('does not allow an object with two required attributes where one does not exist', () => {
+ expect(
+ isPopulatedObject({ attribute1: 'value1', attribute2: 'value2' }, [
+ 'attribute1',
+ 'otherAttribute',
+ ])
+ ).toBe(false);
+ });
+ });
+});
diff --git a/x-pack/plugins/ml/common/util/object_utils.ts b/x-pack/plugins/ml/common/util/object_utils.ts
index 4bbd0c1c2810fe..537ee9202b4dec 100644
--- a/x-pack/plugins/ml/common/util/object_utils.ts
+++ b/x-pack/plugins/ml/common/util/object_utils.ts
@@ -5,6 +5,32 @@
* 2.0.
*/
-export const isPopulatedObject = >(arg: any): arg is T => {
- return typeof arg === 'object' && arg !== null && Object.keys(arg).length > 0;
+/*
+ * A type guard to check record like object structures.
+ *
+ * Examples:
+ * - `isPopulatedObject({...})`
+ * Limits type to Record
+ *
+ * - `isPopulatedObject({...}, ['attribute'])`
+ * Limits type to Record<'attribute', unknown>
+ *
+ * - `isPopulatedObject({...})`
+ * Limits type to a record with keys of the given interface.
+ * Note that you might want to add keys from the interface to the
+ * array of requiredAttributes to satisfy runtime requirements.
+ * Otherwise you'd just satisfy TS requirements but might still
+ * run into runtime issues.
+ */
+export const isPopulatedObject = (
+ arg: unknown,
+ requiredAttributes: U[] = []
+): arg is Record => {
+ return (
+ typeof arg === 'object' &&
+ arg !== null &&
+ Object.keys(arg).length > 0 &&
+ (requiredAttributes.length === 0 ||
+ requiredAttributes.every((d) => ({}.hasOwnProperty.call(arg, d))))
+ );
};
diff --git a/x-pack/plugins/ml/common/util/runtime_field_utils.test.ts b/x-pack/plugins/ml/common/util/runtime_field_utils.test.ts
new file mode 100644
index 00000000000000..1b5e3e18b14f64
--- /dev/null
+++ b/x-pack/plugins/ml/common/util/runtime_field_utils.test.ts
@@ -0,0 +1,102 @@
+/*
+ * Copyright 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 { isRuntimeField, isRuntimeMappings } from './runtime_field_utils';
+
+describe('ML runtime field utils', () => {
+ describe('isRuntimeField()', () => {
+ it('does not allow numbers', () => {
+ expect(isRuntimeField(1)).toBe(false);
+ });
+ it('does not allow null', () => {
+ expect(isRuntimeField(null)).toBe(false);
+ });
+ it('does not allow arrays', () => {
+ expect(isRuntimeField([])).toBe(false);
+ });
+ it('does not allow empty objects', () => {
+ expect(isRuntimeField({})).toBe(false);
+ });
+ it('does not allow objects with non-matching attributes', () => {
+ expect(isRuntimeField({ someAttribute: 'someValue' })).toBe(false);
+ expect(isRuntimeField({ type: 'wrong-type' })).toBe(false);
+ expect(isRuntimeField({ type: 'keyword', someAttribute: 'some value' })).toBe(false);
+ });
+ it('allows objects with type attribute only', () => {
+ expect(isRuntimeField({ type: 'keyword' })).toBe(true);
+ });
+ it('allows objects with both type and script attributes', () => {
+ expect(isRuntimeField({ type: 'keyword', script: 'some script' })).toBe(true);
+ });
+ });
+
+ describe('isRuntimeMappings()', () => {
+ it('does not allow numbers', () => {
+ expect(isRuntimeMappings(1)).toBe(false);
+ });
+ it('does not allow null', () => {
+ expect(isRuntimeMappings(null)).toBe(false);
+ });
+ it('does not allow arrays', () => {
+ expect(isRuntimeMappings([])).toBe(false);
+ });
+ it('does not allow empty objects', () => {
+ expect(isRuntimeMappings({})).toBe(false);
+ });
+ it('does not allow objects with non-object inner structure', () => {
+ expect(isRuntimeMappings({ someAttribute: 'someValue' })).toBe(false);
+ });
+ it('does not allow objects with objects with unsupported inner structure', () => {
+ expect(isRuntimeMappings({ fieldName1: { type: 'keyword' }, fieldName2: 'someValue' })).toBe(
+ false
+ );
+ expect(
+ isRuntimeMappings({
+ fieldName1: { type: 'keyword' },
+ fieldName2: { type: 'keyword', someAttribute: 'some value' },
+ })
+ ).toBe(false);
+ expect(
+ isRuntimeMappings({
+ fieldName: { type: 'long', script: 1234 },
+ })
+ ).toBe(false);
+ expect(
+ isRuntimeMappings({
+ fieldName: { type: 'long', script: { someAttribute: 'some value' } },
+ })
+ ).toBe(false);
+ expect(
+ isRuntimeMappings({
+ fieldName: { type: 'long', script: { source: 1234 } },
+ })
+ ).toBe(false);
+ });
+
+ it('allows object with most basic runtime mapping', () => {
+ expect(isRuntimeMappings({ fieldName: { type: 'keyword' } })).toBe(true);
+ });
+ it('allows object with multiple most basic runtime mappings', () => {
+ expect(
+ isRuntimeMappings({ fieldName1: { type: 'keyword' }, fieldName2: { type: 'keyword' } })
+ ).toBe(true);
+ });
+ it('allows object with runtime mappings including scripts', () => {
+ expect(
+ isRuntimeMappings({
+ fieldName1: { type: 'keyword' },
+ fieldName2: { type: 'keyword', script: 'some script as script' },
+ })
+ ).toBe(true);
+ expect(
+ isRuntimeMappings({
+ fieldName: { type: 'long', script: { source: 'some script as source' } },
+ })
+ ).toBe(true);
+ });
+ });
+});
diff --git a/x-pack/plugins/ml/common/util/runtime_field_utils.ts b/x-pack/plugins/ml/common/util/runtime_field_utils.ts
index f2df5821268cd3..6d911ecd5d3cba 100644
--- a/x-pack/plugins/ml/common/util/runtime_field_utils.ts
+++ b/x-pack/plugins/ml/common/util/runtime_field_utils.ts
@@ -9,19 +9,18 @@ import { isPopulatedObject } from './object_utils';
import { RUNTIME_FIELD_TYPES } from '../../../../../src/plugins/data/common';
import type { RuntimeField, RuntimeMappings } from '../types/fields';
+type RuntimeType = typeof RUNTIME_FIELD_TYPES[number];
+
export function isRuntimeField(arg: unknown): arg is RuntimeField {
return (
- isPopulatedObject(arg) &&
- ((Object.keys(arg).length === 1 && arg.hasOwnProperty('type')) ||
- (Object.keys(arg).length === 2 &&
- arg.hasOwnProperty('type') &&
- arg.hasOwnProperty('script') &&
+ ((isPopulatedObject(arg, ['type']) && Object.keys(arg).length === 1) ||
+ (isPopulatedObject(arg, ['type', 'script']) &&
+ Object.keys(arg).length === 2 &&
(typeof arg.script === 'string' ||
- (isPopulatedObject(arg.script) &&
+ (isPopulatedObject(arg.script, ['source']) &&
Object.keys(arg.script).length === 1 &&
- arg.script.hasOwnProperty('source') &&
typeof arg.script.source === 'string')))) &&
- RUNTIME_FIELD_TYPES.includes(arg.type)
+ RUNTIME_FIELD_TYPES.includes(arg.type as RuntimeType)
);
}
diff --git a/x-pack/plugins/ml/public/application/components/data_grid/types.ts b/x-pack/plugins/ml/public/application/components/data_grid/types.ts
index 649968f176e186..0af8972f18558a 100644
--- a/x-pack/plugins/ml/public/application/components/data_grid/types.ts
+++ b/x-pack/plugins/ml/public/application/components/data_grid/types.ts
@@ -7,6 +7,7 @@
import { Dispatch, SetStateAction } from 'react';
+import { estypes } from '@elastic/elasticsearch';
import {
EuiDataGridCellValueElementProps,
EuiDataGridPaginationProps,
@@ -15,7 +16,6 @@ import {
} from '@elastic/eui';
import { Dictionary } from '../../../../common/types/common';
-import { HitsTotalRelation } from '../../../../common/types/es_client';
import { ChartData } from '../../../../common/types/field_histograms';
import { INDEX_STATUS } from '../../data_frame_analytics/common/analytics';
@@ -27,7 +27,7 @@ export type DataGridItem = Record;
// `undefined` is used to indicate a non-initialized state.
export type ChartsVisible = boolean | undefined;
-export type RowCountRelation = HitsTotalRelation | undefined;
+export type RowCountRelation = estypes.TotalHitsRelation | undefined;
export type IndexPagination = Pick;
diff --git a/x-pack/plugins/ml/public/application/components/data_grid/use_data_grid.tsx b/x-pack/plugins/ml/public/application/components/data_grid/use_data_grid.tsx
index 31a72a776223e7..e62f2eb2f003bb 100644
--- a/x-pack/plugins/ml/public/application/components/data_grid/use_data_grid.tsx
+++ b/x-pack/plugins/ml/public/application/components/data_grid/use_data_grid.tsx
@@ -9,7 +9,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { EuiDataGridSorting, EuiDataGridColumn } from '@elastic/eui';
-import { HITS_TOTAL_RELATION } from '../../../../common/types/es_client';
+import { ES_CLIENT_TOTAL_HITS_RELATION } from '../../../../common/types/es_client';
import { ChartData } from '../../../../common/types/field_histograms';
import { INDEX_STATUS } from '../../data_frame_analytics/common';
@@ -146,7 +146,7 @@ export const useDataGrid = (
if (chartsVisible === undefined && rowCount > 0 && rowCountRelation !== undefined) {
setChartsVisible(
rowCount <= COLUMN_CHART_DEFAULT_VISIBILITY_ROWS_THRESHOLED &&
- rowCountRelation !== HITS_TOTAL_RELATION.GTE
+ rowCountRelation !== ES_CLIENT_TOTAL_HITS_RELATION.GTE
);
}
}, [chartsVisible, rowCount, rowCountRelation]);
diff --git a/x-pack/plugins/ml/public/application/components/scatterplot_matrix/scatterplot_matrix.tsx b/x-pack/plugins/ml/public/application/components/scatterplot_matrix/scatterplot_matrix.tsx
index 4e9fd3baebe7bb..842d5fc1ae87a0 100644
--- a/x-pack/plugins/ml/public/application/components/scatterplot_matrix/scatterplot_matrix.tsx
+++ b/x-pack/plugins/ml/public/application/components/scatterplot_matrix/scatterplot_matrix.tsx
@@ -7,6 +7,8 @@
import React, { useMemo, useEffect, useState, FC } from 'react';
+import { estypes } from '@elastic/elasticsearch';
+
import {
EuiCallOut,
EuiComboBox,
@@ -24,7 +26,6 @@ import { i18n } from '@kbn/i18n';
import { extractErrorMessage } from '../../../../common';
import { stringHash } from '../../../../common/util/string_utils';
-import type { SearchResponse7 } from '../../../../common/types/es_client';
import type { ResultsSearchQuery } from '../../data_frame_analytics/common/analytics';
import { useMlApiContext } from '../../contexts/kibana';
@@ -184,7 +185,7 @@ export const ScatterplotMatrix: FC = ({
}
: searchQuery;
- const resp: SearchResponse7 = await esSearch({
+ const resp: estypes.SearchResponse = await esSearch({
index,
body: {
fields: queryFields,
@@ -198,7 +199,7 @@ export const ScatterplotMatrix: FC = ({
if (!options.didCancel) {
const items = resp.hits.hits
.map((d) =>
- getProcessedFields(d.fields, (key: string) =>
+ getProcessedFields(d.fields ?? {}, (key: string) =>
key.startsWith(`${resultsField}.feature_importance`)
)
)
diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/common/get_index_data.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/common/get_index_data.ts
index d0bcbd2ff63b45..88f403cdf0c449 100644
--- a/x-pack/plugins/ml/public/application/data_frame_analytics/common/get_index_data.ts
+++ b/x-pack/plugins/ml/public/application/data_frame_analytics/common/get_index_data.ts
@@ -5,7 +5,7 @@
* 2.0.
*/
-import type { SearchResponse7 } from '../../../../common/types/es_client';
+import type { estypes } from '@elastic/elasticsearch';
import { extractErrorMessage } from '../../../../common/util/errors';
import { EsSorting, UseDataGridReturnType, getProcessedFields } from '../../components/data_grid';
@@ -51,7 +51,7 @@ export const getIndexData = async (
const { pageIndex, pageSize } = pagination;
// TODO: remove results_field from `fields` when possible
- const resp: SearchResponse7 = await ml.esSearch({
+ const resp: estypes.SearchResponse = await ml.esSearch({
index: jobConfig.dest.index,
body: {
fields: ['*'],
@@ -64,11 +64,15 @@ export const getIndexData = async (
});
if (!options.didCancel) {
- setRowCount(resp.hits.total.value);
- setRowCountRelation(resp.hits.total.relation);
+ setRowCount(typeof resp.hits.total === 'number' ? resp.hits.total : resp.hits.total.value);
+ setRowCountRelation(
+ typeof resp.hits.total === 'number'
+ ? ('eq' as estypes.TotalHitsRelation)
+ : resp.hits.total.relation
+ );
setTableItems(
resp.hits.hits.map((d) =>
- getProcessedFields(d.fields, (key: string) =>
+ getProcessedFields(d.fields ?? {}, (key: string) =>
key.startsWith(`${jobConfig.dest.results_field}.feature_importance`)
)
)
diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts
index ecda624c71d984..4552ca34ebbae2 100644
--- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts
+++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/hooks/use_index_data.ts
@@ -7,6 +7,7 @@
import { useEffect, useMemo } from 'react';
+import { estypes } from '@elastic/elasticsearch';
import { EuiDataGridColumn } from '@elastic/eui';
import { CoreSetup } from 'src/core/public';
@@ -26,13 +27,12 @@ import {
UseIndexDataReturnType,
getProcessedFields,
} from '../../../../components/data_grid';
-import type { SearchResponse7 } from '../../../../../../common/types/es_client';
import { extractErrorMessage } from '../../../../../../common/util/errors';
import { INDEX_STATUS } from '../../../common/analytics';
import { ml } from '../../../../services/ml_api_service';
import { getRuntimeFieldsMapping } from '../../../../components/data_grid/common';
-type IndexSearchResponse = SearchResponse7;
+type IndexSearchResponse = estypes.SearchResponse;
export const useIndexData = (
indexPattern: IndexPattern,
@@ -95,9 +95,13 @@ export const useIndexData = (
try {
const resp: IndexSearchResponse = await ml.esSearch(esSearchRequest);
- const docs = resp.hits.hits.map((d) => getProcessedFields(d.fields));
- setRowCount(resp.hits.total.value);
- setRowCountRelation(resp.hits.total.relation);
+ const docs = resp.hits.hits.map((d) => getProcessedFields(d.fields ?? {}));
+ setRowCount(typeof resp.hits.total === 'number' ? resp.hits.total : resp.hits.total.value);
+ setRowCountRelation(
+ typeof resp.hits.total === 'number'
+ ? ('eq' as estypes.TotalHitsRelation)
+ : resp.hits.total.relation
+ );
setTableItems(docs);
setStatus(INDEX_STATUS.LOADED);
} catch (e) {
diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/expandable_section/expandable_section_results.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/expandable_section/expandable_section_results.tsx
index 654af03d102e5b..d67473d9d3220b 100644
--- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/expandable_section/expandable_section_results.tsx
+++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/expandable_section/expandable_section_results.tsx
@@ -18,7 +18,7 @@ import {
isClassificationAnalysis,
isRegressionAnalysis,
} from '../../../../../../../common/util/analytics_utils';
-import { HITS_TOTAL_RELATION } from '../../../../../../../common/types/es_client';
+import { ES_CLIENT_TOTAL_HITS_RELATION } from '../../../../../../../common/types/es_client';
import { getToastNotifications } from '../../../../../util/dependency_cache';
import { useColorRange, ColorRangeLegend } from '../../../../../components/color_range_legend';
@@ -77,7 +77,7 @@ const getResultsSectionHeaderItems = (
defaultMessage="Total docs"
/>
),
- value: `${rowCountRelation === HITS_TOTAL_RELATION.GTE ? '>' : ''}${rowCount}`,
+ value: `${rowCountRelation === ES_CLIENT_TOTAL_HITS_RELATION.GTE ? '>' : ''}${rowCount}`,
},
...(colorRange !== undefined
? [
diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/filter_runtime_mappings.ts b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/filter_runtime_mappings.ts
index bfed2d811e2062..5995224ef32548 100644
--- a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/filter_runtime_mappings.ts
+++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/filter_runtime_mappings.ts
@@ -22,8 +22,10 @@ interface Response {
export function filterRuntimeMappings(job: Job, datafeed: Datafeed): Response {
if (
- datafeed.runtime_mappings === undefined ||
- isPopulatedObject(datafeed.runtime_mappings) === false
+ !(
+ isPopulatedObject(datafeed, ['runtime_mappings']) &&
+ isPopulatedObject(datafeed.runtime_mappings)
+ )
) {
return {
runtime_mappings: {},
@@ -83,7 +85,7 @@ function findFieldsInJob(job: Job, datafeed: Datafeed) {
return [...usedFields];
}
-function findFieldsInAgg(obj: Record) {
+function findFieldsInAgg(obj: Record) {
const fields: string[] = [];
Object.entries(obj).forEach(([key, val]) => {
if (isPopulatedObject(val)) {
diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview.tsx
index 916a25271c63b8..a4d9293e9369dc 100644
--- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview.tsx
+++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview.tsx
@@ -22,6 +22,7 @@ import { MLJobEditor } from '../../../../../jobs_list/components/ml_job_editor';
import { mlJobService } from '../../../../../../services/job_service';
import { ML_DATA_PREVIEW_COUNT } from '../../../../../../../../common/util/job_utils';
import { isPopulatedObject } from '../../../../../../../../common/util/object_utils';
+import { isMultiBucketAggregate } from '../../../../../../../../common/types/es_client';
export const DatafeedPreview: FC<{
combinedJob: CombinedJob | null;
@@ -67,7 +68,10 @@ export const DatafeedPreview: FC<{
// the first item under aggregations can be any name
if (isPopulatedObject(resp.aggregations)) {
const accessor = Object.keys(resp.aggregations)[0];
- data = resp.aggregations[accessor].buckets.slice(0, ML_DATA_PREVIEW_COUNT);
+ const aggregate = resp.aggregations[accessor];
+ if (isMultiBucketAggregate(aggregate)) {
+ data = aggregate.buckets.slice(0, ML_DATA_PREVIEW_COUNT);
+ }
}
setPreviewJsonString(JSON.stringify(data, null, 2));
diff --git a/x-pack/plugins/ml/public/application/services/anomaly_explorer_charts_service.ts b/x-pack/plugins/ml/public/application/services/anomaly_explorer_charts_service.ts
index 59b6860cb65b78..72de5d003d4b82 100644
--- a/x-pack/plugins/ml/public/application/services/anomaly_explorer_charts_service.ts
+++ b/x-pack/plugins/ml/public/application/services/anomaly_explorer_charts_service.ts
@@ -90,11 +90,7 @@ export interface SeriesConfigWithMetadata extends SeriesConfig {
}
export const isSeriesConfigWithMetadata = (arg: unknown): arg is SeriesConfigWithMetadata => {
- return (
- isPopulatedObject(arg) &&
- {}.hasOwnProperty.call(arg, 'bucketSpanSeconds') &&
- {}.hasOwnProperty.call(arg, 'detectorLabel')
- );
+ return isPopulatedObject(arg, ['bucketSpanSeconds', 'detectorLabel']);
};
interface ChartRange {
diff --git a/x-pack/plugins/ml/public/application/services/job_service.d.ts b/x-pack/plugins/ml/public/application/services/job_service.d.ts
index 544d346341591c..ceadca12f87575 100644
--- a/x-pack/plugins/ml/public/application/services/job_service.d.ts
+++ b/x-pack/plugins/ml/public/application/services/job_service.d.ts
@@ -5,7 +5,8 @@
* 2.0.
*/
-import { SearchResponse } from 'elasticsearch';
+import { estypes } from '@elastic/elasticsearch';
+
import { TimeRange } from 'src/plugins/data/common/query/timefilter/types';
import { CombinedJob, Datafeed, Job } from '../../../common/types/anomaly_detection_jobs';
import { Calendar } from '../../../common/types/calendars';
@@ -40,7 +41,7 @@ declare interface JobService {
): Promise;
createResultsUrl(jobId: string[], start: number, end: number, location: string): string;
getJobAndGroupIds(): Promise;
- searchPreview(job: CombinedJob): Promise>;
+ searchPreview(job: CombinedJob): Promise>;
getJob(jobId: string): CombinedJob;
loadJobsWrapper(): Promise;
}
diff --git a/x-pack/plugins/ml/public/embeddables/types.ts b/x-pack/plugins/ml/public/embeddables/types.ts
index 05aea1770a4158..60355dae5baf41 100644
--- a/x-pack/plugins/ml/public/embeddables/types.ts
+++ b/x-pack/plugins/ml/public/embeddables/types.ts
@@ -81,8 +81,8 @@ export interface SwimLaneDrilldownContext extends EditSwimlanePanelContext {
export function isSwimLaneEmbeddable(arg: unknown): arg is SwimLaneDrilldownContext {
return (
- isPopulatedObject(arg) &&
- arg.hasOwnProperty('embeddable') &&
+ isPopulatedObject(arg, ['embeddable']) &&
+ isPopulatedObject(arg.embeddable, ['type']) &&
arg.embeddable.type === ANOMALY_SWIMLANE_EMBEDDABLE_TYPE
);
}
@@ -130,8 +130,8 @@ export function isAnomalyExplorerEmbeddable(
arg: unknown
): arg is AnomalyChartsFieldSelectionContext {
return (
- isPopulatedObject(arg) &&
- arg.hasOwnProperty('embeddable') &&
+ isPopulatedObject(arg, ['embeddable']) &&
+ isPopulatedObject(arg.embeddable, ['type']) &&
arg.embeddable.type === ANOMALY_EXPLORER_CHARTS_EMBEDDABLE_TYPE
);
}
diff --git a/x-pack/plugins/ml/public/index.ts b/x-pack/plugins/ml/public/index.ts
index 9280f4603b3433..56b8ca409ac0b8 100755
--- a/x-pack/plugins/ml/public/index.ts
+++ b/x-pack/plugins/ml/public/index.ts
@@ -50,7 +50,7 @@ export {
getSeverityType,
getFormattedSeverityScore,
} from '../common/util/anomaly_utils';
-export { HITS_TOTAL_RELATION } from '../common/types/es_client';
+export { ES_CLIENT_TOTAL_HITS_RELATION } from '../common/types/es_client';
export { ANOMALY_SEVERITY } from '../common';
export { useMlHref, ML_PAGES, MlUrlGenerator } from './ml_url_generator';
diff --git a/x-pack/plugins/ml/server/models/data_frame_analytics/validation.ts b/x-pack/plugins/ml/server/models/data_frame_analytics/validation.ts
index 4c79855f39e894..3f0a02f5eaad8d 100644
--- a/x-pack/plugins/ml/server/models/data_frame_analytics/validation.ts
+++ b/x-pack/plugins/ml/server/models/data_frame_analytics/validation.ts
@@ -25,7 +25,6 @@ import {
isClassificationAnalysis,
} from '../../../common/util/analytics_utils';
import { extractErrorMessage } from '../../../common/util/errors';
-import { SearchResponse7 } from '../../../common';
import {
AnalysisConfig,
DataFrameAnalyticsConfig,
@@ -42,7 +41,7 @@ interface CardinalityAgg {
};
}
-type ValidationSearchResult = Omit & {
+type ValidationSearchResult = Omit & {
aggregations: MissingAgg | CardinalityAgg;
};
diff --git a/x-pack/plugins/ml/server/models/job_service/new_job/categorization/examples.ts b/x-pack/plugins/ml/server/models/job_service/new_job/categorization/examples.ts
index b0ee20763f4305..5fecb3d9eb1ec4 100644
--- a/x-pack/plugins/ml/server/models/job_service/new_job/categorization/examples.ts
+++ b/x-pack/plugins/ml/server/models/job_service/new_job/categorization/examples.ts
@@ -5,9 +5,10 @@
* 2.0.
*/
+import type { estypes } from '@elastic/elasticsearch';
+
import { IScopedClusterClient } from 'kibana/server';
import { chunk } from 'lodash';
-import { SearchResponse } from 'elasticsearch';
import { CATEGORY_EXAMPLES_SAMPLE_SIZE } from '../../../../../common/constants/categorization_job';
import {
Token,
@@ -61,7 +62,7 @@ export function categorizationExamplesProvider({
}
}
}
- const { body } = await asCurrentUser.search>({
+ const { body } = await asCurrentUser.search>({
index: indexPatternTitle,
size,
body: {
diff --git a/x-pack/plugins/ml/server/models/job_service/new_job/categorization/top_categories.ts b/x-pack/plugins/ml/server/models/job_service/new_job/categorization/top_categories.ts
index 851336056a7f51..82d6f6ca3e1030 100644
--- a/x-pack/plugins/ml/server/models/job_service/new_job/categorization/top_categories.ts
+++ b/x-pack/plugins/ml/server/models/job_service/new_job/categorization/top_categories.ts
@@ -5,13 +5,14 @@
* 2.0.
*/
-import { SearchResponse } from 'elasticsearch';
+import type { estypes } from '@elastic/elasticsearch';
+
import { CategoryId, Category } from '../../../../../common/types/categories';
import type { MlClient } from '../../../../lib/ml_client';
export function topCategoriesProvider(mlClient: MlClient) {
async function getTotalCategories(jobId: string): Promise {
- const { body } = await mlClient.anomalySearch>(
+ const { body } = await mlClient.anomalySearch>(
{
size: 0,
body: {
@@ -35,12 +36,11 @@ export function topCategoriesProvider(mlClient: MlClient) {
},
[]
);
- // @ts-ignore total is an object here
- return body?.hits?.total?.value ?? 0;
+ return typeof body.hits.total === 'number' ? body.hits.total : body.hits.total.value;
}
async function getTopCategoryCounts(jobId: string, numberOfCategories: number) {
- const { body } = await mlClient.anomalySearch>(
+ const { body } = await mlClient.anomalySearch>(
{
size: 0,
body: {
diff --git a/x-pack/plugins/ml/server/models/job_validation/job_validation.test.ts b/x-pack/plugins/ml/server/models/job_validation/job_validation.test.ts
index 949159b67d33af..64dfb84be86689 100644
--- a/x-pack/plugins/ml/server/models/job_validation/job_validation.test.ts
+++ b/x-pack/plugins/ml/server/models/job_validation/job_validation.test.ts
@@ -8,13 +8,15 @@
import { IScopedClusterClient } from 'kibana/server';
import { validateJob, ValidateJobPayload } from './job_validation';
-import { HITS_TOTAL_RELATION } from '../../../common/types/es_client';
+import { ES_CLIENT_TOTAL_HITS_RELATION } from '../../../common/types/es_client';
import type { MlClient } from '../../lib/ml_client';
const callAs = {
fieldCaps: () => Promise.resolve({ body: { fields: [] } }),
search: () =>
- Promise.resolve({ body: { hits: { total: { value: 1, relation: HITS_TOTAL_RELATION.EQ } } } }),
+ Promise.resolve({
+ body: { hits: { total: { value: 1, relation: ES_CLIENT_TOTAL_HITS_RELATION.EQ } } },
+ }),
};
const mlClusterClient = ({
diff --git a/x-pack/plugins/ml/server/routes/apidoc_scripts/tsconfig.json b/x-pack/plugins/ml/server/routes/apidoc_scripts/tsconfig.json
index 6d01a853698b8e..599dee1e56c0f8 100644
--- a/x-pack/plugins/ml/server/routes/apidoc_scripts/tsconfig.json
+++ b/x-pack/plugins/ml/server/routes/apidoc_scripts/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../../../../tsconfig.base.json",
+ "extends": "../../../../../../tsconfig.project.json",
"compilerOptions": {
"outDir": "./target",
"target": "es6",
diff --git a/x-pack/plugins/ml/server/shared_services/providers/system.ts b/x-pack/plugins/ml/server/shared_services/providers/system.ts
index 1e3dcd7de52408..85cd73ba010af7 100644
--- a/x-pack/plugins/ml/server/shared_services/providers/system.ts
+++ b/x-pack/plugins/ml/server/shared_services/providers/system.ts
@@ -5,8 +5,9 @@
* 2.0.
*/
+import type { estypes } from '@elastic/elasticsearch';
+
import { KibanaRequest, SavedObjectsClientContract } from 'kibana/server';
-import { SearchResponse } from 'elasticsearch';
import { MlLicense } from '../../../common/license';
import { CloudSetup } from '../../../../cloud/server';
import { spacesUtilsProvider } from '../../lib/spaces_utils';
@@ -23,7 +24,7 @@ export interface MlSystemProvider {
): {
mlCapabilities(): Promise;
mlInfo(): Promise;
- mlAnomalySearch(searchParams: any, jobIds: string[]): Promise>;
+ mlAnomalySearch(searchParams: any, jobIds: string[]): Promise>;
};
}
@@ -69,7 +70,10 @@ export function getMlSystemProvider(
};
});
},
- async mlAnomalySearch(searchParams: any, jobIds: string[]): Promise> {
+ async mlAnomalySearch(
+ searchParams: any,
+ jobIds: string[]
+ ): Promise> {
return await getGuards(request, savedObjectsClient)
.isFullLicense()
.hasMlCapabilities(['canAccessML'])
diff --git a/x-pack/plugins/ml/tsconfig.json b/x-pack/plugins/ml/tsconfig.json
index 6b396b1c596429..b1135b867dc08d 100644
--- a/x-pack/plugins/ml/tsconfig.json
+++ b/x-pack/plugins/ml/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/monitoring/tsconfig.json b/x-pack/plugins/monitoring/tsconfig.json
index d0fb7e1a88dcfe..b1999101f7c122 100644
--- a/x-pack/plugins/monitoring/tsconfig.json
+++ b/x-pack/plugins/monitoring/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/observability/tsconfig.json b/x-pack/plugins/observability/tsconfig.json
index 6833948b86b18d..083c35a26c20bf 100644
--- a/x-pack/plugins/observability/tsconfig.json
+++ b/x-pack/plugins/observability/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/osquery/tsconfig.json b/x-pack/plugins/osquery/tsconfig.json
index 291b0f7c607cf1..03c9e451f3b52b 100644
--- a/x-pack/plugins/osquery/tsconfig.json
+++ b/x-pack/plugins/osquery/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/painless_lab/tsconfig.json b/x-pack/plugins/painless_lab/tsconfig.json
index a869b21e06d4d5..2519206b0fcdb6 100644
--- a/x-pack/plugins/painless_lab/tsconfig.json
+++ b/x-pack/plugins/painless_lab/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/remote_clusters/tsconfig.json b/x-pack/plugins/remote_clusters/tsconfig.json
index 0bee6300cf0b29..b48933bc9f1ecc 100644
--- a/x-pack/plugins/remote_clusters/tsconfig.json
+++ b/x-pack/plugins/remote_clusters/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/reporting/tsconfig.json b/x-pack/plugins/reporting/tsconfig.json
index 88e8d343f4700f..4f252743ed078b 100644
--- a/x-pack/plugins/reporting/tsconfig.json
+++ b/x-pack/plugins/reporting/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/rollup/tsconfig.json b/x-pack/plugins/rollup/tsconfig.json
index 9b994d1710ffc2..bf589c62713d6d 100644
--- a/x-pack/plugins/rollup/tsconfig.json
+++ b/x-pack/plugins/rollup/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/runtime_fields/tsconfig.json b/x-pack/plugins/runtime_fields/tsconfig.json
index a1efe4c9cf2dd6..e1ad141f1c702b 100644
--- a/x-pack/plugins/runtime_fields/tsconfig.json
+++ b/x-pack/plugins/runtime_fields/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/saved_objects_tagging/tsconfig.json b/x-pack/plugins/saved_objects_tagging/tsconfig.json
index d00156ad1277ca..5c37481f982d91 100644
--- a/x-pack/plugins/saved_objects_tagging/tsconfig.json
+++ b/x-pack/plugins/saved_objects_tagging/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/searchprofiler/tsconfig.json b/x-pack/plugins/searchprofiler/tsconfig.json
index f8ac3a61f7812a..57cd882422b391 100644
--- a/x-pack/plugins/searchprofiler/tsconfig.json
+++ b/x-pack/plugins/searchprofiler/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/security/tsconfig.json b/x-pack/plugins/security/tsconfig.json
index 6c3fd1851a8cbe..4ace497dbd5ad6 100644
--- a/x-pack/plugins/security/tsconfig.json
+++ b/x-pack/plugins/security/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/security_solution/cypress/tsconfig.json b/x-pack/plugins/security_solution/cypress/tsconfig.json
index 270d877a362a6d..bd8d9aa058bc3b 100644
--- a/x-pack/plugins/security_solution/cypress/tsconfig.json
+++ b/x-pack/plugins/security_solution/cypress/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../../tsconfig.base.json",
+ "extends": "../../../../tsconfig.project.json",
"exclude": [],
"include": [
"./**/*"
diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/common.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/common.ts
index 29b18ba3f5bf5c..65bd6ffd15f5f9 100644
--- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/common.ts
+++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/common.ts
@@ -15,7 +15,7 @@ import {
export const ArtifactConstants = {
GLOBAL_ALLOWLIST_NAME: 'endpoint-exceptionlist',
/**
- * Saved objects no longer used for storing artifacts. Value
+ * Saved objects no longer used for storing artifacts
* @deprecated
*/
SAVED_OBJECT_TYPE: 'endpoint:user-artifact',
diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.test.ts
index ed945347373e52..c70dd39e17e9eb 100644
--- a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.test.ts
+++ b/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.test.ts
@@ -171,7 +171,7 @@ describe('test alerts route', () => {
// and this entire test file refactored to start using fleet's exposed FleetArtifactClient class.
endpointAppContextService!
.getManifestManager()!
- .getArtifactsClient().getArtifact = jest.fn().mockResolvedValue(soFindResp);
+ .getArtifactsClient().getArtifact = jest.fn().mockResolvedValue(soFindResp.attributes);
[routeConfig, routeHandler] = routerMock.get.mock.calls.find(([{ path }]) =>
path.startsWith('/api/endpoint/artifacts/download')
diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.ts b/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.ts
index 99a39616195dd8..948cd035243bd9 100644
--- a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.ts
+++ b/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_artifact.ts
@@ -91,9 +91,9 @@ export function registerDownloadArtifactRoute(
return res.notFound({ body: `No artifact found for ${id}` });
}
- const bodyBuffer = Buffer.from(artifact.attributes.body, 'base64');
+ const bodyBuffer = Buffer.from(artifact.body, 'base64');
cache.set(id, bodyBuffer);
- return buildAndValidateResponse(artifact.attributes.identifier, bodyBuffer);
+ return buildAndValidateResponse(artifact.identifier, bodyBuffer);
}
}
);
diff --git a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/artifact_client.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/artifact_client.test.ts
index b3f098a9693363..1dcac108338bb7 100644
--- a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/artifact_client.test.ts
+++ b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/artifact_client.test.ts
@@ -5,48 +5,49 @@
* 2.0.
*/
-import { savedObjectsClientMock } from 'src/core/server/mocks';
-import { ArtifactConstants, getArtifactId } from '../../lib/artifacts';
import { getInternalArtifactMock } from '../../schemas/artifacts/saved_objects.mock';
-import { ArtifactClient } from './artifact_client';
+import { EndpointArtifactClient } from './artifact_client';
+import { createArtifactsClientMock } from '../../../../../fleet/server/mocks';
describe('artifact_client', () => {
describe('ArtifactClient sanity checks', () => {
+ let fleetArtifactClient: ReturnType;
+ let artifactClient: EndpointArtifactClient;
+
+ beforeEach(() => {
+ fleetArtifactClient = createArtifactsClientMock();
+ artifactClient = new EndpointArtifactClient(fleetArtifactClient);
+ });
+
test('can create ArtifactClient', () => {
- const artifactClient = new ArtifactClient(savedObjectsClientMock.create());
- expect(artifactClient).toBeInstanceOf(ArtifactClient);
+ expect(artifactClient).toBeInstanceOf(EndpointArtifactClient);
});
test('can get artifact', async () => {
- const savedObjectsClient = savedObjectsClientMock.create();
- const artifactClient = new ArtifactClient(savedObjectsClient);
await artifactClient.getArtifact('abcd');
- expect(savedObjectsClient.get).toHaveBeenCalled();
+ expect(fleetArtifactClient.listArtifacts).toHaveBeenCalled();
});
test('can create artifact', async () => {
- const savedObjectsClient = savedObjectsClientMock.create();
- const artifactClient = new ArtifactClient(savedObjectsClient);
- const artifact = await getInternalArtifactMock('linux', 'v1');
+ const artifact = await getInternalArtifactMock('linux', 'v1', { compress: true });
await artifactClient.createArtifact(artifact);
- expect(savedObjectsClient.create).toHaveBeenCalledWith(
- ArtifactConstants.SAVED_OBJECT_TYPE,
- {
- ...artifact,
- created: expect.any(Number),
- },
- { id: getArtifactId(artifact) }
- );
+ expect(fleetArtifactClient.createArtifact).toHaveBeenCalledWith({
+ identifier: artifact.identifier,
+ type: 'exceptionlist',
+ content:
+ '{"entries":[{"type":"simple","entries":[{"entries":[{"field":"some.nested.field","operator":"included","type":"exact_cased","value":"some value"}],' +
+ '"field":"some.parentField","type":"nested"},{"field":"some.not.nested.field","operator":"included","type":"exact_cased","value":"some value"}]},' +
+ '{"type":"simple","entries":[{"field":"some.other.not.nested.field","operator":"included","type":"exact_cased","value":"some other value"}]}]}',
+ });
});
test('can delete artifact', async () => {
- const savedObjectsClient = savedObjectsClientMock.create();
- const artifactClient = new ArtifactClient(savedObjectsClient);
- await artifactClient.deleteArtifact('abcd');
- expect(savedObjectsClient.delete).toHaveBeenCalledWith(
- ArtifactConstants.SAVED_OBJECT_TYPE,
- 'abcd'
- );
+ await artifactClient.deleteArtifact('endpoint-trustlist-linux-v1-sha26hash');
+ expect(fleetArtifactClient.listArtifacts).toHaveBeenCalledWith({
+ kuery: `decoded_sha256: "sha26hash" AND identifier: "endpoint-trustlist-linux-v1"`,
+ perPage: 1,
+ });
+ expect(fleetArtifactClient.deleteArtifact).toHaveBeenCalledWith('123');
});
});
});
diff --git a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/artifact_client.ts b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/artifact_client.ts
index d9a2e86159d6cf..ef48ed1dd43f67 100644
--- a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/artifact_client.ts
+++ b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/artifact_client.ts
@@ -5,64 +5,23 @@
* 2.0.
*/
-/* eslint-disable max-classes-per-file */
-
import { inflate as _inflate } from 'zlib';
import { promisify } from 'util';
-import { SavedObject, SavedObjectsClientContract } from 'src/core/server';
-import { ArtifactConstants, getArtifactId } from '../../lib/artifacts';
-import {
- InternalArtifactCompleteSchema,
- InternalArtifactCreateSchema,
-} from '../../schemas/artifacts';
+import { InternalArtifactCompleteSchema } from '../../schemas/artifacts';
import { Artifact, ArtifactsClientInterface } from '../../../../../fleet/server';
const inflateAsync = promisify(_inflate);
export interface EndpointArtifactClientInterface {
- getArtifact(id: string): Promise | undefined>;
+ getArtifact(id: string): Promise;
- createArtifact(
- artifact: InternalArtifactCompleteSchema
- ): Promise>;
+ createArtifact(artifact: InternalArtifactCompleteSchema): Promise;
deleteArtifact(id: string): Promise;
}
-export class ArtifactClient implements EndpointArtifactClientInterface {
- private savedObjectsClient: SavedObjectsClientContract;
-
- constructor(savedObjectsClient: SavedObjectsClientContract) {
- this.savedObjectsClient = savedObjectsClient;
- }
-
- public async getArtifact(id: string): Promise> {
- return this.savedObjectsClient.get(
- ArtifactConstants.SAVED_OBJECT_TYPE,
- id
- );
- }
-
- public async createArtifact(
- artifact: InternalArtifactCompleteSchema
- ): Promise> {
- return this.savedObjectsClient.create(
- ArtifactConstants.SAVED_OBJECT_TYPE,
- {
- ...artifact,
- created: Date.now(),
- },
- { id: getArtifactId(artifact) }
- );
- }
-
- public async deleteArtifact(id: string) {
- await this.savedObjectsClient.delete(ArtifactConstants.SAVED_OBJECT_TYPE, id);
- }
-}
-
/**
- * Endpoint specific artifact managment client which uses FleetArtifactsClient to persist artifacts
+ * Endpoint specific artifact management client which uses FleetArtifactsClient to persist artifacts
* to the Fleet artifacts index (then used by Fleet Server)
*/
export class EndpointArtifactClient implements EndpointArtifactClientInterface {
@@ -91,15 +50,12 @@ export class EndpointArtifactClient implements EndpointArtifactClientInterface {
return;
}
- // FIXME:PT change method signature so that it returns back only the `InternalArtifactCompleteSchema`
- return ({
- attributes: artifacts.items[0],
- } as unknown) as SavedObject;
+ return artifacts.items[0];
}
async createArtifact(
artifact: InternalArtifactCompleteSchema
- ): Promise> {
+ ): Promise {
// FIXME:PT refactor to make this more efficient by passing through the uncompressed artifact content
// Artifact `.body` is compressed/encoded. We need it decoded and as a string
const artifactContent = await inflateAsync(Buffer.from(artifact.body, 'base64'));
@@ -110,15 +66,13 @@ export class EndpointArtifactClient implements EndpointArtifactClientInterface {
type: this.parseArtifactId(artifact.identifier).type,
});
- return ({
- attributes: createdArtifact,
- } as unknown) as SavedObject;
+ return createdArtifact;
}
async deleteArtifact(id: string) {
// Ignoring the `id` not being in the type until we can refactor the types in endpoint.
// @ts-ignore
- const artifactId = (await this.getArtifact(id)).attributes?.id;
+ const artifactId = (await this.getArtifact(id))?.id!;
return this.fleetArtifacts.deleteArtifact(artifactId);
}
}
diff --git a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.mock.ts b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.mock.ts
index ca0088e834c3a0..ececb425af6576 100644
--- a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.mock.ts
+++ b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.mock.ts
@@ -20,8 +20,7 @@ import {
getMockArtifactsWithDiff,
getEmptyMockArtifacts,
} from '../../../lib/artifacts/mocks';
-import { ArtifactClient } from '../artifact_client';
-import { getManifestClientMock } from '../mocks';
+import { createEndpointArtifactClientMock, getManifestClientMock } from '../mocks';
import { ManifestManager, ManifestManagerContext } from './manifest_manager';
export const createExceptionListResponse = (data: ExceptionListItemSchema[], total?: number) => ({
@@ -84,7 +83,7 @@ export const buildManifestManagerContextMock = (
return {
...fullOpts,
- artifactClient: new ArtifactClient(fullOpts.savedObjectsClient),
+ artifactClient: createEndpointArtifactClientMock(),
logger: loggingSystemMock.create().get() as jest.Mocked,
};
};
diff --git a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts
index a4efdbc75fb160..423cd4fddd0aa9 100644
--- a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts
+++ b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts
@@ -6,7 +6,6 @@
*/
import { inflateSync } from 'zlib';
-import { SavedObjectsErrorHelpers } from 'src/core/server';
import { savedObjectsClientMock } from 'src/core/server/mocks';
import { ENDPOINT_LIST_ID, ENDPOINT_TRUSTED_APPS_LIST_ID } from '../../../../../../lists/common';
import { getExceptionListItemSchemaMock } from '../../../../../../lists/common/schemas/response/exception_list_item_schema.mock';
@@ -23,7 +22,6 @@ import {
toArtifactRecords,
} from '../../../lib/artifacts/mocks';
import {
- ArtifactConstants,
ManifestConstants,
getArtifactId,
isCompressed,
@@ -37,6 +35,7 @@ import {
} from './manifest_manager.mock';
import { ManifestManager } from './manifest_manager';
+import { EndpointArtifactClientInterface } from '../artifact_client';
const uncompressData = async (data: Buffer) => JSON.parse(await inflateSync(data).toString());
@@ -145,9 +144,8 @@ describe('ManifestManager', () => {
test('Retrieves non empty manifest successfully', async () => {
const savedObjectsClient = savedObjectsClientMock.create();
- const manifestManager = new ManifestManager(
- buildManifestManagerContextMock({ savedObjectsClient })
- );
+ const manifestManagerContext = buildManifestManagerContextMock({ savedObjectsClient });
+ const manifestManager = new ManifestManager(manifestManagerContext);
savedObjectsClient.get = jest
.fn()
@@ -169,13 +167,17 @@ describe('ManifestManager', () => {
},
version: '2.0.0',
};
- } else if (objectType === ArtifactConstants.SAVED_OBJECT_TYPE) {
- return { attributes: ARTIFACTS_BY_ID[id], version: '2.1.1' };
} else {
return null;
}
});
+ (manifestManagerContext.artifactClient as jest.Mocked).getArtifact.mockImplementation(
+ async (id) => {
+ return ARTIFACTS_BY_ID[id];
+ }
+ );
+
const manifest = await manifestManager.getLastComputedManifest();
expect(manifest?.getSchemaVersion()).toStrictEqual('v1');
@@ -418,8 +420,6 @@ describe('ManifestManager', () => {
const context = buildManifestManagerContextMock({});
const manifestManager = new ManifestManager(context);
- context.savedObjectsClient.delete = jest.fn().mockResolvedValue({});
-
await expect(
manifestManager.deleteArtifacts([
ARTIFACT_ID_EXCEPTIONS_MACOS,
@@ -427,32 +427,27 @@ describe('ManifestManager', () => {
])
).resolves.toStrictEqual([]);
- expect(context.savedObjectsClient.delete).toHaveBeenNthCalledWith(
+ expect(context.artifactClient.deleteArtifact).toHaveBeenNthCalledWith(
1,
- ArtifactConstants.SAVED_OBJECT_TYPE,
ARTIFACT_ID_EXCEPTIONS_MACOS
);
- expect(context.savedObjectsClient.delete).toHaveBeenNthCalledWith(
+ expect(context.artifactClient.deleteArtifact).toHaveBeenNthCalledWith(
2,
- ArtifactConstants.SAVED_OBJECT_TYPE,
ARTIFACT_ID_EXCEPTIONS_WINDOWS
);
});
test('Returns errors for partial failures', async () => {
const context = buildManifestManagerContextMock({});
+ const artifactClient = context.artifactClient as jest.Mocked;
const manifestManager = new ManifestManager(context);
const error = new Error();
- context.savedObjectsClient.delete = jest
- .fn()
- .mockImplementation(async (type: string, id: string) => {
- if (id === ARTIFACT_ID_EXCEPTIONS_WINDOWS) {
- throw error;
- } else {
- return {};
- }
- });
+ artifactClient.deleteArtifact.mockImplementation(async (id) => {
+ if (id === ARTIFACT_ID_EXCEPTIONS_WINDOWS) {
+ throw error;
+ }
+ });
await expect(
manifestManager.deleteArtifacts([
@@ -461,46 +456,35 @@ describe('ManifestManager', () => {
])
).resolves.toStrictEqual([error]);
- expect(context.savedObjectsClient.delete).toHaveBeenCalledTimes(2);
- expect(context.savedObjectsClient.delete).toHaveBeenNthCalledWith(
+ expect(artifactClient.deleteArtifact).toHaveBeenCalledTimes(2);
+ expect(artifactClient.deleteArtifact).toHaveBeenNthCalledWith(
1,
- ArtifactConstants.SAVED_OBJECT_TYPE,
ARTIFACT_ID_EXCEPTIONS_MACOS
);
- expect(context.savedObjectsClient.delete).toHaveBeenNthCalledWith(
+ expect(artifactClient.deleteArtifact).toHaveBeenNthCalledWith(
2,
- ArtifactConstants.SAVED_OBJECT_TYPE,
ARTIFACT_ID_EXCEPTIONS_WINDOWS
);
});
});
describe('pushArtifacts', () => {
- test('Successfully invokes saved objects client and stores in the cache', async () => {
+ test('Successfully invokes artifactClient and stores in the cache', async () => {
const context = buildManifestManagerContextMock({});
+ const artifactClient = context.artifactClient as jest.Mocked;
const manifestManager = new ManifestManager(context);
- context.savedObjectsClient.create = jest
- .fn()
- .mockImplementation((type: string, artifact: InternalArtifactCompleteSchema) => artifact);
-
await expect(
manifestManager.pushArtifacts([ARTIFACT_EXCEPTIONS_MACOS, ARTIFACT_EXCEPTIONS_WINDOWS])
).resolves.toStrictEqual([]);
- expect(context.savedObjectsClient.create).toHaveBeenCalledTimes(2);
- expect(context.savedObjectsClient.create).toHaveBeenNthCalledWith(
- 1,
- ArtifactConstants.SAVED_OBJECT_TYPE,
- { ...ARTIFACT_EXCEPTIONS_MACOS, created: expect.anything() },
- { id: ARTIFACT_ID_EXCEPTIONS_MACOS }
- );
- expect(context.savedObjectsClient.create).toHaveBeenNthCalledWith(
- 2,
- ArtifactConstants.SAVED_OBJECT_TYPE,
- { ...ARTIFACT_EXCEPTIONS_WINDOWS, created: expect.anything() },
- { id: ARTIFACT_ID_EXCEPTIONS_WINDOWS }
- );
+ expect(artifactClient.createArtifact).toHaveBeenCalledTimes(2);
+ expect(artifactClient.createArtifact).toHaveBeenNthCalledWith(1, {
+ ...ARTIFACT_EXCEPTIONS_MACOS,
+ });
+ expect(artifactClient.createArtifact).toHaveBeenNthCalledWith(2, {
+ ...ARTIFACT_EXCEPTIONS_WINDOWS,
+ });
expect(
await uncompressData(context.cache.get(getArtifactId(ARTIFACT_EXCEPTIONS_MACOS))!)
).toStrictEqual(await uncompressArtifact(ARTIFACT_EXCEPTIONS_MACOS));
@@ -511,19 +495,20 @@ describe('ManifestManager', () => {
test('Returns errors for partial failures', async () => {
const context = buildManifestManagerContextMock({});
+ const artifactClient = context.artifactClient as jest.Mocked;
const manifestManager = new ManifestManager(context);
const error = new Error();
const { body, ...incompleteArtifact } = ARTIFACT_TRUSTED_APPS_MACOS;
- context.savedObjectsClient.create = jest
- .fn()
- .mockImplementation(async (type: string, artifact: InternalArtifactCompleteSchema) => {
+ artifactClient.createArtifact.mockImplementation(
+ async (artifact: InternalArtifactCompleteSchema) => {
if (getArtifactId(artifact) === ARTIFACT_ID_EXCEPTIONS_WINDOWS) {
throw error;
} else {
return artifact;
}
- });
+ }
+ );
await expect(
manifestManager.pushArtifacts([
@@ -536,45 +521,15 @@ describe('ManifestManager', () => {
new Error(`Incomplete artifact: ${ARTIFACT_ID_TRUSTED_APPS_MACOS}`),
]);
- expect(context.savedObjectsClient.create).toHaveBeenCalledTimes(2);
- expect(context.savedObjectsClient.create).toHaveBeenNthCalledWith(
- 1,
- ArtifactConstants.SAVED_OBJECT_TYPE,
- { ...ARTIFACT_EXCEPTIONS_MACOS, created: expect.anything() },
- { id: ARTIFACT_ID_EXCEPTIONS_MACOS }
- );
+ expect(artifactClient.createArtifact).toHaveBeenCalledTimes(2);
+ expect(artifactClient.createArtifact).toHaveBeenNthCalledWith(1, {
+ ...ARTIFACT_EXCEPTIONS_MACOS,
+ });
expect(
await uncompressData(context.cache.get(getArtifactId(ARTIFACT_EXCEPTIONS_MACOS))!)
).toStrictEqual(await uncompressArtifact(ARTIFACT_EXCEPTIONS_MACOS));
expect(context.cache.get(getArtifactId(ARTIFACT_EXCEPTIONS_WINDOWS))).toBeUndefined();
});
-
- test('Tolerates saved objects client conflict', async () => {
- const context = buildManifestManagerContextMock({});
- const manifestManager = new ManifestManager(context);
-
- context.savedObjectsClient.create = jest
- .fn()
- .mockRejectedValue(
- SavedObjectsErrorHelpers.createConflictError(
- ArtifactConstants.SAVED_OBJECT_TYPE,
- ARTIFACT_ID_EXCEPTIONS_MACOS
- )
- );
-
- await expect(
- manifestManager.pushArtifacts([ARTIFACT_EXCEPTIONS_MACOS])
- ).resolves.toStrictEqual([]);
-
- expect(context.savedObjectsClient.create).toHaveBeenCalledTimes(1);
- expect(context.savedObjectsClient.create).toHaveBeenNthCalledWith(
- 1,
- ArtifactConstants.SAVED_OBJECT_TYPE,
- { ...ARTIFACT_EXCEPTIONS_MACOS, created: expect.anything() },
- { id: ARTIFACT_ID_EXCEPTIONS_MACOS }
- );
- expect(context.cache.get(getArtifactId(ARTIFACT_EXCEPTIONS_MACOS))).toBeUndefined();
- });
});
describe('commit', () => {
diff --git a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts
index e219da38931daa..9ed17686fd2bcc 100644
--- a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts
+++ b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts
@@ -32,7 +32,7 @@ import {
InternalArtifactCompleteSchema,
internalArtifactCompleteSchema,
} from '../../../schemas/artifacts';
-import { ArtifactClient } from '../artifact_client';
+import { EndpointArtifactClientInterface } from '../artifact_client';
import { ManifestClient } from '../manifest_client';
interface ArtifactsBuildResult {
@@ -76,7 +76,7 @@ const iterateAllListItems = async (
export interface ManifestManagerContext {
savedObjectsClient: SavedObjectsClientContract;
- artifactClient: ArtifactClient;
+ artifactClient: EndpointArtifactClientInterface;
exceptionListClient: ExceptionListClient;
packagePolicyService: PackagePolicyServiceInterface;
logger: Logger;
@@ -92,7 +92,7 @@ const manifestsEqual = (manifest1: ManifestSchema, manifest2: ManifestSchema) =>
isEqual(new Set(getArtifactIds(manifest1)), new Set(getArtifactIds(manifest2)));
export class ManifestManager {
- protected artifactClient: ArtifactClient;
+ protected artifactClient: EndpointArtifactClientInterface;
protected exceptionListClient: ExceptionListClient;
protected packagePolicyService: PackagePolicyServiceInterface;
protected savedObjectsClient: SavedObjectsClientContract;
@@ -290,10 +290,13 @@ export class ManifestManager {
);
for (const entry of manifestSo.attributes.artifacts) {
- manifest.addEntry(
- (await this.artifactClient.getArtifact(entry.artifactId)).attributes,
- entry.policyId
- );
+ const artifact = await this.artifactClient.getArtifact(entry.artifactId);
+
+ if (!artifact) {
+ throw new Error(`artifact id [${entry.artifactId}] not found!`);
+ }
+
+ manifest.addEntry(artifact, entry.policyId);
}
return manifest;
@@ -462,7 +465,7 @@ export class ManifestManager {
});
}
- public getArtifactsClient(): ArtifactClient {
+ public getArtifactsClient(): EndpointArtifactClientInterface {
return this.artifactClient;
}
}
diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.ts
index 3a6cbf5ccd34bd..0c03c0837e8e1f 100644
--- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.ts
+++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.ts
@@ -73,11 +73,12 @@ export const buildBulkBody = ({
...buildSignal([doc], rule),
...additionalSignalFields(doc),
};
- // @ts-expect-error @elastic/elasticsearch _source is optional
- delete doc._source.threshold_result;
const event = buildEventTypeSignal(doc);
+ const { threshold_result: thresholdResult, ...filteredSource } = doc._source || {
+ threshold_result: null,
+ };
const signalHit: SignalHit = {
- ...doc._source,
+ ...filteredSource,
'@timestamp': new Date().toISOString(),
event,
signal,
diff --git a/x-pack/plugins/security_solution/server/plugin.ts b/x-pack/plugins/security_solution/server/plugin.ts
index 21724e065cb995..04f98e53ea9a37 100644
--- a/x-pack/plugins/security_solution/server/plugin.ts
+++ b/x-pack/plugins/security_solution/server/plugin.ts
@@ -59,7 +59,7 @@ import { registerEndpointRoutes } from './endpoint/routes/metadata';
import { registerLimitedConcurrencyRoutes } from './endpoint/routes/limited_concurrency';
import { registerResolverRoutes } from './endpoint/routes/resolver';
import { registerPolicyRoutes } from './endpoint/routes/policy';
-import { ArtifactClient, EndpointArtifactClient, ManifestManager } from './endpoint/services';
+import { EndpointArtifactClient, ManifestManager } from './endpoint/services';
import { EndpointAppContextService } from './endpoint/endpoint_app_context_services';
import { EndpointAppContext } from './endpoint/types';
import { registerDownloadArtifactRoute } from './endpoint/routes/artifacts';
@@ -352,9 +352,9 @@ export class Plugin implements IPlugin['buckets'][0];
diff --git a/x-pack/plugins/task_manager/tsconfig.json b/x-pack/plugins/task_manager/tsconfig.json
index a72b678da1f7c1..95a098e54619e6 100644
--- a/x-pack/plugins/task_manager/tsconfig.json
+++ b/x-pack/plugins/task_manager/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/telemetry_collection_xpack/tsconfig.json b/x-pack/plugins/telemetry_collection_xpack/tsconfig.json
index 476f5926f757a4..80488bd74617d1 100644
--- a/x-pack/plugins/telemetry_collection_xpack/tsconfig.json
+++ b/x-pack/plugins/telemetry_collection_xpack/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/transform/common/api_schemas/type_guards.ts b/x-pack/plugins/transform/common/api_schemas/type_guards.ts
index 476e2bad853c95..4b66de9be20d28 100644
--- a/x-pack/plugins/transform/common/api_schemas/type_guards.ts
+++ b/x-pack/plugins/transform/common/api_schemas/type_guards.ts
@@ -5,10 +5,10 @@
* 2.0.
*/
-import type { SearchResponse7 } from '../../../ml/common';
+import type { estypes } from '@elastic/elasticsearch';
import type { EsIndex } from '../types/es_index';
-import { isPopulatedObject } from '../utils/object_utils';
+import { isPopulatedObject } from '../shared_imports';
// To be able to use the type guards on the client side, we need to make sure we don't import
// the code of '@kbn/config-schema' but just its types, otherwise the client side code will
@@ -28,20 +28,13 @@ import type { GetTransformsStatsResponseSchema } from './transforms_stats';
import type { PostTransformsUpdateResponseSchema } from './update_transforms';
const isGenericResponseSchema = (arg: any): arg is T => {
- return (
- isPopulatedObject(arg) &&
- {}.hasOwnProperty.call(arg, 'count') &&
- {}.hasOwnProperty.call(arg, 'transforms') &&
- Array.isArray(arg.transforms)
- );
+ return isPopulatedObject(arg, ['count', 'transforms']) && Array.isArray(arg.transforms);
};
export const isGetTransformNodesResponseSchema = (
arg: unknown
): arg is GetTransformNodesResponseSchema => {
- return (
- isPopulatedObject(arg) && {}.hasOwnProperty.call(arg, 'count') && typeof arg.count === 'number'
- );
+ return isPopulatedObject(arg, ['count']) && typeof arg.count === 'number';
};
export const isGetTransformsResponseSchema = (arg: unknown): arg is GetTransformsResponseSchema => {
@@ -59,7 +52,7 @@ export const isDeleteTransformsResponseSchema = (
): arg is DeleteTransformsResponseSchema => {
return (
isPopulatedObject(arg) &&
- Object.values(arg).every((d) => ({}.hasOwnProperty.call(d, 'transformDeleted')))
+ Object.values(arg).every((d) => isPopulatedObject(d, ['transformDeleted']))
);
};
@@ -67,8 +60,22 @@ export const isEsIndices = (arg: unknown): arg is EsIndex[] => {
return Array.isArray(arg);
};
-export const isEsSearchResponse = (arg: unknown): arg is SearchResponse7 => {
- return isPopulatedObject(arg) && {}.hasOwnProperty.call(arg, 'hits');
+export const isEsSearchResponse = (arg: unknown): arg is estypes.SearchResponse => {
+ return isPopulatedObject(arg, ['hits']);
+};
+
+type SearchResponseWithAggregations = Required> &
+ estypes.SearchResponse;
+export const isEsSearchResponseWithAggregations = (
+ arg: unknown
+): arg is SearchResponseWithAggregations => {
+ return isEsSearchResponse(arg) && {}.hasOwnProperty.call(arg, 'aggregations');
+};
+
+export const isMultiBucketAggregate = (
+ arg: unknown
+): arg is estypes.MultiBucketAggregate => {
+ return isPopulatedObject(arg, ['buckets']);
};
export const isFieldHistogramsResponseSchema = (
@@ -87,9 +94,7 @@ export const isPostTransformsPreviewResponseSchema = (
arg: unknown
): arg is PostTransformsPreviewResponseSchema => {
return (
- isPopulatedObject(arg) &&
- {}.hasOwnProperty.call(arg, 'generated_dest_index') &&
- {}.hasOwnProperty.call(arg, 'preview') &&
+ isPopulatedObject(arg, ['generated_dest_index', 'preview']) &&
typeof arg.generated_dest_index !== undefined &&
Array.isArray(arg.preview)
);
@@ -98,21 +103,19 @@ export const isPostTransformsPreviewResponseSchema = (
export const isPostTransformsUpdateResponseSchema = (
arg: unknown
): arg is PostTransformsUpdateResponseSchema => {
- return isPopulatedObject(arg) && {}.hasOwnProperty.call(arg, 'id') && typeof arg.id === 'string';
+ return isPopulatedObject(arg, ['id']) && typeof arg.id === 'string';
};
export const isPutTransformsResponseSchema = (arg: unknown): arg is PutTransformsResponseSchema => {
return (
- isPopulatedObject(arg) &&
- {}.hasOwnProperty.call(arg, 'transformsCreated') &&
- {}.hasOwnProperty.call(arg, 'errors') &&
+ isPopulatedObject(arg, ['transformsCreated', 'errors']) &&
Array.isArray(arg.transformsCreated) &&
Array.isArray(arg.errors)
);
};
const isGenericSuccessResponseSchema = (arg: unknown) =>
- isPopulatedObject(arg) && Object.values(arg).every((d) => ({}.hasOwnProperty.call(d, 'success')));
+ isPopulatedObject(arg) && Object.values(arg).every((d) => isPopulatedObject(d, ['success']));
export const isStartTransformsResponseSchema = (
arg: unknown
diff --git a/x-pack/plugins/transform/common/shared_imports.ts b/x-pack/plugins/transform/common/shared_imports.ts
index 3062c7ab8d23cb..38cfb6bc457f19 100644
--- a/x-pack/plugins/transform/common/shared_imports.ts
+++ b/x-pack/plugins/transform/common/shared_imports.ts
@@ -5,10 +5,10 @@
* 2.0.
*/
-export type { HitsTotalRelation, SearchResponse7 } from '../../ml/common';
export {
composeValidators,
+ isPopulatedObject,
+ isRuntimeMappings,
patternValidator,
ChartData,
- HITS_TOTAL_RELATION,
} from '../../ml/common';
diff --git a/x-pack/plugins/transform/common/types/index_pattern.ts b/x-pack/plugins/transform/common/types/index_pattern.ts
index bab31b67b2b61d..0485de8982e1a7 100644
--- a/x-pack/plugins/transform/common/types/index_pattern.ts
+++ b/x-pack/plugins/transform/common/types/index_pattern.ts
@@ -7,17 +7,17 @@
import type { IndexPattern } from '../../../../../src/plugins/data/common';
-import { isPopulatedObject } from '../utils/object_utils';
+import { isPopulatedObject } from '../shared_imports';
// Custom minimal type guard for IndexPattern to check against the attributes used in transforms code.
export function isIndexPattern(arg: any): arg is IndexPattern {
return (
- isPopulatedObject(arg) &&
- 'getComputedFields' in arg &&
- typeof arg.getComputedFields === 'function' &&
- {}.hasOwnProperty.call(arg, 'title') &&
+ isPopulatedObject(arg, ['title', 'fields']) &&
+ // `getComputedFields` is inherited, so it's not possible to
+ // check with `hasOwnProperty` which is used by isPopulatedObject()
+ 'getComputedFields' in (arg as IndexPattern) &&
+ typeof (arg as IndexPattern).getComputedFields === 'function' &&
typeof arg.title === 'string' &&
- {}.hasOwnProperty.call(arg, 'fields') &&
Array.isArray(arg.fields)
);
}
diff --git a/x-pack/plugins/transform/common/types/transform.ts b/x-pack/plugins/transform/common/types/transform.ts
index 600808c475fd10..f1e7efdadca9d5 100644
--- a/x-pack/plugins/transform/common/types/transform.ts
+++ b/x-pack/plugins/transform/common/types/transform.ts
@@ -7,7 +7,7 @@
import { EuiComboBoxOptionOption } from '@elastic/eui/src/components/combo_box/types';
import type { LatestFunctionConfig, PutTransformsRequestSchema } from '../api_schemas/transforms';
-import { isPopulatedObject } from '../utils/object_utils';
+import { isPopulatedObject } from '../shared_imports';
import { PivotGroupByDict } from './pivot_group_by';
import { PivotAggDict } from './pivot_aggs';
@@ -46,11 +46,11 @@ export type TransformLatestConfig = Omit & {
export type TransformConfigUnion = TransformPivotConfig | TransformLatestConfig;
export function isPivotTransform(transform: unknown): transform is TransformPivotConfig {
- return isPopulatedObject(transform) && transform.hasOwnProperty('pivot');
+ return isPopulatedObject(transform, ['pivot']);
}
export function isLatestTransform(transform: unknown): transform is TransformLatestConfig {
- return isPopulatedObject(transform) && transform.hasOwnProperty('latest');
+ return isPopulatedObject(transform, ['latest']);
}
export interface LatestFunctionConfigUI {
diff --git a/x-pack/plugins/transform/common/types/transform_stats.ts b/x-pack/plugins/transform/common/types/transform_stats.ts
index 03e6b2e403b69c..00ffa40b84d3b3 100644
--- a/x-pack/plugins/transform/common/types/transform_stats.ts
+++ b/x-pack/plugins/transform/common/types/transform_stats.ts
@@ -6,7 +6,7 @@
*/
import { TransformState, TRANSFORM_STATE } from '../constants';
-import { isPopulatedObject } from '../utils/object_utils';
+import { isPopulatedObject } from '../shared_imports';
import { TransformId } from './transform';
export interface TransformStats {
@@ -61,7 +61,5 @@ function isTransformState(arg: unknown): arg is TransformState {
}
export function isTransformStats(arg: unknown): arg is TransformStats {
- return (
- isPopulatedObject(arg) && {}.hasOwnProperty.call(arg, 'state') && isTransformState(arg.state)
- );
+ return isPopulatedObject(arg, ['state']) && isTransformState(arg.state);
}
diff --git a/x-pack/plugins/transform/common/utils/errors.ts b/x-pack/plugins/transform/common/utils/errors.ts
index 46ff3f9165c00b..2aff8f332b1308 100644
--- a/x-pack/plugins/transform/common/utils/errors.ts
+++ b/x-pack/plugins/transform/common/utils/errors.ts
@@ -5,7 +5,7 @@
* 2.0.
*/
-import { isPopulatedObject } from './object_utils';
+import { isPopulatedObject } from '../shared_imports';
export interface ErrorResponse {
body: {
@@ -18,7 +18,11 @@ export interface ErrorResponse {
}
export function isErrorResponse(arg: unknown): arg is ErrorResponse {
- return isPopulatedObject(arg) && isPopulatedObject(arg.body) && arg?.body?.message !== undefined;
+ return (
+ isPopulatedObject(arg, ['body']) &&
+ isPopulatedObject(arg.body, ['message']) &&
+ arg.body.message !== undefined
+ );
}
export function getErrorMessage(error: unknown) {
@@ -26,7 +30,7 @@ export function getErrorMessage(error: unknown) {
return `${error.body.error}: ${error.body.message}`;
}
- if (isPopulatedObject(error) && typeof error.message === 'string') {
+ if (isPopulatedObject(error, ['message']) && typeof error.message === 'string') {
return error.message;
}
diff --git a/x-pack/plugins/transform/common/utils/object_utils.test.ts b/x-pack/plugins/transform/common/utils/object_utils.test.ts
index 5b354b9b275894..c99adf6b6d1894 100644
--- a/x-pack/plugins/transform/common/utils/object_utils.test.ts
+++ b/x-pack/plugins/transform/common/utils/object_utils.test.ts
@@ -5,7 +5,7 @@
* 2.0.
*/
-import { getNestedProperty, isPopulatedObject } from './object_utils';
+import { getNestedProperty } from './object_utils';
describe('object_utils', () => {
test('getNestedProperty()', () => {
@@ -68,12 +68,4 @@ describe('object_utils', () => {
expect(typeof test11).toBe('number');
expect(test11).toBe(0);
});
-
- test('isPopulatedObject()', () => {
- expect(isPopulatedObject(0)).toBe(false);
- expect(isPopulatedObject('')).toBe(false);
- expect(isPopulatedObject(null)).toBe(false);
- expect(isPopulatedObject({})).toBe(false);
- expect(isPopulatedObject({ attribute: 'value' })).toBe(true);
- });
});
diff --git a/x-pack/plugins/transform/common/utils/object_utils.ts b/x-pack/plugins/transform/common/utils/object_utils.ts
index a573535da6b4fb..605af489143607 100644
--- a/x-pack/plugins/transform/common/utils/object_utils.ts
+++ b/x-pack/plugins/transform/common/utils/object_utils.ts
@@ -51,7 +51,3 @@ export const setNestedProperty = (obj: Record, accessor: string, va
return obj;
};
-
-export const isPopulatedObject = >(arg: unknown): arg is T => {
- return typeof arg === 'object' && arg !== null && Object.keys(arg).length > 0;
-};
diff --git a/x-pack/plugins/transform/public/__mocks__/shared_imports.ts b/x-pack/plugins/transform/public/__mocks__/shared_imports.ts
index 00a92865789ffb..ae072e6666e4aa 100644
--- a/x-pack/plugins/transform/public/__mocks__/shared_imports.ts
+++ b/x-pack/plugins/transform/public/__mocks__/shared_imports.ts
@@ -16,4 +16,4 @@ export const useRequest = jest.fn(() => ({
export const createSavedSearchesLoader = jest.fn();
// just passing through the reimports
-export { getMlSharedImports, HITS_TOTAL_RELATION } from '../../../ml/public';
+export { getMlSharedImports, ES_CLIENT_TOTAL_HITS_RELATION } from '../../../ml/public';
diff --git a/x-pack/plugins/transform/public/app/common/pivot_aggs.ts b/x-pack/plugins/transform/public/app/common/pivot_aggs.ts
index 905b40f16f7fbe..03e06d36f9319c 100644
--- a/x-pack/plugins/transform/public/app/common/pivot_aggs.ts
+++ b/x-pack/plugins/transform/public/app/common/pivot_aggs.ts
@@ -14,7 +14,7 @@ import type { Dictionary } from '../../../common/types/common';
import type { EsFieldName } from '../../../common/types/fields';
import type { PivotAgg, PivotSupportedAggs } from '../../../common/types/pivot_aggs';
import { PIVOT_SUPPORTED_AGGS } from '../../../common/types/pivot_aggs';
-import { isPopulatedObject } from '../../../common/utils/object_utils';
+import { isPopulatedObject } from '../../../common/shared_imports';
import { getAggFormConfig } from '../sections/create_transform/components/step_define/common/get_agg_form_config';
import { PivotAggsConfigFilter } from '../sections/create_transform/components/step_define/common/filter_agg/types';
@@ -166,11 +166,7 @@ export type PivotAggsConfigWithUiSupport =
export function isPivotAggsConfigWithUiSupport(arg: unknown): arg is PivotAggsConfigWithUiSupport {
return (
- isPopulatedObject(arg) &&
- arg.hasOwnProperty('agg') &&
- arg.hasOwnProperty('aggName') &&
- arg.hasOwnProperty('dropDownName') &&
- arg.hasOwnProperty('field') &&
+ isPopulatedObject(arg, ['agg', 'aggName', 'dropDownName', 'field']) &&
isPivotSupportedAggs(arg.agg)
);
}
@@ -181,15 +177,12 @@ export function isPivotAggsConfigWithUiSupport(arg: unknown): arg is PivotAggsCo
type PivotAggsConfigWithExtendedForm = PivotAggsConfigFilter;
export function isPivotAggsWithExtendedForm(arg: unknown): arg is PivotAggsConfigWithExtendedForm {
- return isPopulatedObject(arg) && arg.hasOwnProperty('AggFormComponent');
+ return isPopulatedObject(arg, ['AggFormComponent']);
}
export function isPivotAggsConfigPercentiles(arg: unknown): arg is PivotAggsConfigPercentiles {
return (
- isPopulatedObject(arg) &&
- arg.hasOwnProperty('agg') &&
- arg.hasOwnProperty('field') &&
- arg.hasOwnProperty('percents') &&
+ isPopulatedObject(arg, ['agg', 'field', 'percents']) &&
arg.agg === PIVOT_SUPPORTED_AGGS.PERCENTILES
);
}
diff --git a/x-pack/plugins/transform/public/app/common/pivot_group_by.ts b/x-pack/plugins/transform/public/app/common/pivot_group_by.ts
index fac0d88a84df74..0ad059fd29950a 100644
--- a/x-pack/plugins/transform/public/app/common/pivot_group_by.ts
+++ b/x-pack/plugins/transform/public/app/common/pivot_group_by.ts
@@ -9,7 +9,7 @@ import { AggName } from '../../../common/types/aggregations';
import { Dictionary } from '../../../common/types/common';
import { EsFieldName } from '../../../common/types/fields';
import { GenericAgg } from '../../../common/types/pivot_group_by';
-import { isPopulatedObject } from '../../../common/utils/object_utils';
+import { isPopulatedObject } from '../../../common/shared_imports';
import { KBN_FIELD_TYPES } from '../../../../../../src/plugins/data/common';
import { PivotAggsConfigWithUiSupport } from './pivot_aggs';
@@ -84,30 +84,21 @@ export type PivotGroupByConfigDict = Dictionary;
export function isGroupByDateHistogram(arg: unknown): arg is GroupByDateHistogram {
return (
- isPopulatedObject(arg) &&
- arg.hasOwnProperty('agg') &&
- arg.hasOwnProperty('field') &&
- arg.hasOwnProperty('calendar_interval') &&
+ isPopulatedObject(arg, ['agg', 'field', 'calendar_interval']) &&
arg.agg === PIVOT_SUPPORTED_GROUP_BY_AGGS.DATE_HISTOGRAM
);
}
export function isGroupByHistogram(arg: unknown): arg is GroupByHistogram {
return (
- isPopulatedObject(arg) &&
- arg.hasOwnProperty('agg') &&
- arg.hasOwnProperty('field') &&
- arg.hasOwnProperty('interval') &&
+ isPopulatedObject(arg, ['agg', 'field', 'interval']) &&
arg.agg === PIVOT_SUPPORTED_GROUP_BY_AGGS.HISTOGRAM
);
}
export function isGroupByTerms(arg: unknown): arg is GroupByTerms {
return (
- isPopulatedObject(arg) &&
- arg.hasOwnProperty('agg') &&
- arg.hasOwnProperty('field') &&
- arg.agg === PIVOT_SUPPORTED_GROUP_BY_AGGS.TERMS
+ isPopulatedObject(arg, ['agg', 'field']) && arg.agg === PIVOT_SUPPORTED_GROUP_BY_AGGS.TERMS
);
}
@@ -124,5 +115,5 @@ export function getEsAggFromGroupByConfig(groupByConfig: GroupByConfigBase): Gen
}
export function isPivotAggConfigWithUiSupport(arg: unknown): arg is PivotAggsConfigWithUiSupport {
- return isPopulatedObject(arg) && arg.hasOwnProperty('agg') && arg.hasOwnProperty('field');
+ return isPopulatedObject(arg, ['agg', 'field']);
}
diff --git a/x-pack/plugins/transform/public/app/common/request.ts b/x-pack/plugins/transform/public/app/common/request.ts
index 647d511cc4dcf9..a7a3a91f9429ba 100644
--- a/x-pack/plugins/transform/public/app/common/request.ts
+++ b/x-pack/plugins/transform/public/app/common/request.ts
@@ -5,7 +5,7 @@
* 2.0.
*/
-import type { DefaultOperator } from 'elasticsearch';
+import type { estypes } from '@elastic/elasticsearch';
import { HttpFetchError } from '../../../../../../src/core/public';
import type { IndexPattern } from '../../../../../../src/plugins/data/public';
@@ -17,7 +17,7 @@ import type {
PutTransformsPivotRequestSchema,
PutTransformsRequestSchema,
} from '../../../common/api_schemas/transforms';
-import { isPopulatedObject } from '../../../common/utils/object_utils';
+import { isPopulatedObject } from '../../../common/shared_imports';
import { DateHistogramAgg, HistogramAgg, TermsAgg } from '../../../common/types/pivot_group_by';
import { isIndexPattern } from '../../../common/types/index_pattern';
@@ -39,7 +39,7 @@ import {
export interface SimpleQuery {
query_string: {
query: string;
- default_operator?: DefaultOperator;
+ default_operator?: estypes.DefaultOperator;
};
}
@@ -59,14 +59,13 @@ export function getPivotQuery(search: string | SavedSearchQuery): PivotQuery {
}
export function isSimpleQuery(arg: unknown): arg is SimpleQuery {
- return isPopulatedObject(arg) && arg.hasOwnProperty('query_string');
+ return isPopulatedObject(arg, ['query_string']);
}
export const matchAllQuery = { match_all: {} };
export function isMatchAllQuery(query: unknown): boolean {
return (
- isPopulatedObject(query) &&
- query.hasOwnProperty('match_all') &&
+ isPopulatedObject(query, ['match_all']) &&
typeof query.match_all === 'object' &&
query.match_all !== null &&
Object.keys(query.match_all).length === 0
@@ -101,7 +100,7 @@ export function getCombinedRuntimeMappings(
combinedRuntimeMappings = { ...combinedRuntimeMappings, ...runtimeMappings };
}
- if (isPopulatedObject(combinedRuntimeMappings)) {
+ if (isPopulatedObject(combinedRuntimeMappings)) {
return combinedRuntimeMappings;
}
return undefined;
diff --git a/x-pack/plugins/transform/public/app/hooks/__mocks__/use_api.ts b/x-pack/plugins/transform/public/app/hooks/__mocks__/use_api.ts
index 7aaca793c2a1f5..a9455877be4298 100644
--- a/x-pack/plugins/transform/public/app/hooks/__mocks__/use_api.ts
+++ b/x-pack/plugins/transform/public/app/hooks/__mocks__/use_api.ts
@@ -5,6 +5,8 @@
* 2.0.
*/
+import { estypes } from '@elastic/elasticsearch';
+
import { HttpFetchError } from 'kibana/public';
import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public';
@@ -37,7 +39,6 @@ import type {
PostTransformsUpdateResponseSchema,
} from '../../../../common/api_schemas/update_transforms';
-import type { SearchResponse7 } from '../../../../common/shared_imports';
import { EsIndex } from '../../../../common/types/es_index';
import type { SavedSearchQuery } from '../use_search_items';
@@ -134,7 +135,7 @@ const apiFactory = () => ({
): Promise {
return Promise.resolve([]);
},
- async esSearch(payload: any): Promise {
+ async esSearch(payload: any): Promise {
return Promise.resolve({
hits: {
hits: [],
diff --git a/x-pack/plugins/transform/public/app/hooks/use_api.ts b/x-pack/plugins/transform/public/app/hooks/use_api.ts
index f3c90a688453d4..1abe2ed09444e0 100644
--- a/x-pack/plugins/transform/public/app/hooks/use_api.ts
+++ b/x-pack/plugins/transform/public/app/hooks/use_api.ts
@@ -7,6 +7,8 @@
import { useMemo } from 'react';
+import { estypes } from '@elastic/elasticsearch';
+
import { HttpFetchError } from 'kibana/public';
import { KBN_FIELD_TYPES } from '../../../../../../src/plugins/data/public';
@@ -44,7 +46,6 @@ import type { GetTransformsStatsResponseSchema } from '../../../common/api_schem
import { TransformId } from '../../../common/types/transform';
import { API_BASE_PATH } from '../../../common/constants';
import { EsIndex } from '../../../common/types/es_index';
-import type { SearchResponse7 } from '../../../common/shared_imports';
import { useAppDependencies } from '../app_dependencies';
@@ -187,7 +188,7 @@ export const useApi = () => {
return e;
}
},
- async esSearch(payload: any): Promise {
+ async esSearch(payload: any): Promise {
try {
return await http.post(`${API_BASE_PATH}es_search`, { body: JSON.stringify(payload) });
} catch (e) {
diff --git a/x-pack/plugins/transform/public/app/hooks/use_index_data.ts b/x-pack/plugins/transform/public/app/hooks/use_index_data.ts
index e12aa78e33622d..bb83de8e120043 100644
--- a/x-pack/plugins/transform/public/app/hooks/use_index_data.ts
+++ b/x-pack/plugins/transform/public/app/hooks/use_index_data.ts
@@ -7,7 +7,8 @@
import { useEffect, useMemo } from 'react';
-import { EuiDataGridColumn } from '@elastic/eui';
+import type { estypes } from '@elastic/elasticsearch';
+import type { EuiDataGridColumn } from '@elastic/eui';
import {
isEsSearchResponse,
@@ -133,10 +134,14 @@ export const useIndexData = (
return;
}
- const docs = resp.hits.hits.map((d) => getProcessedFields(d.fields));
+ const docs = resp.hits.hits.map((d) => getProcessedFields(d.fields ?? {}));
- setRowCount(resp.hits.total.value);
- setRowCountRelation(resp.hits.total.relation);
+ setRowCount(typeof resp.hits.total === 'number' ? resp.hits.total : resp.hits.total.value);
+ setRowCountRelation(
+ typeof resp.hits.total === 'number'
+ ? ('eq' as estypes.TotalHitsRelation)
+ : resp.hits.total.relation
+ );
setTableItems(docs);
setStatus(INDEX_STATUS.LOADED);
};
diff --git a/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts b/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts
index 2477c005c936d8..24c28effd12bc2 100644
--- a/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts
+++ b/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts
@@ -18,7 +18,11 @@ import type { PreviewMappingsProperties } from '../../../common/api_schemas/tran
import { isPostTransformsPreviewResponseSchema } from '../../../common/api_schemas/type_guards';
import { getNestedProperty } from '../../../common/utils/object_utils';
-import { RenderCellValue, UseIndexDataReturnType, HITS_TOTAL_RELATION } from '../../shared_imports';
+import {
+ RenderCellValue,
+ UseIndexDataReturnType,
+ ES_CLIENT_TOTAL_HITS_RELATION,
+} from '../../shared_imports';
import { getErrorMessage } from '../../../common/utils/errors';
import { useAppDependencies } from '../app_dependencies';
@@ -128,7 +132,7 @@ export const usePivotData = (
if (!validationStatus.isValid) {
setTableItems([]);
setRowCount(0);
- setRowCountRelation(HITS_TOTAL_RELATION.EQ);
+ setRowCountRelation(ES_CLIENT_TOTAL_HITS_RELATION.EQ);
setNoDataMessage(validationStatus.errorMessage!);
return;
}
@@ -149,7 +153,7 @@ export const usePivotData = (
setErrorMessage(getErrorMessage(resp));
setTableItems([]);
setRowCount(0);
- setRowCountRelation(HITS_TOTAL_RELATION.EQ);
+ setRowCountRelation(ES_CLIENT_TOTAL_HITS_RELATION.EQ);
setPreviewMappingsProperties({});
setStatus(INDEX_STATUS.ERROR);
return;
@@ -157,7 +161,7 @@ export const usePivotData = (
setTableItems(resp.preview);
setRowCount(resp.preview.length);
- setRowCountRelation(HITS_TOTAL_RELATION.EQ);
+ setRowCountRelation(ES_CLIENT_TOTAL_HITS_RELATION.EQ);
setPreviewMappingsProperties(resp.generated_dest_index.mappings.properties);
setStatus(INDEX_STATUS.LOADED);
diff --git a/x-pack/plugins/transform/public/app/lib/authorization/components/common.ts b/x-pack/plugins/transform/public/app/lib/authorization/components/common.ts
index 28e9f190a91080..5599e3f4232778 100644
--- a/x-pack/plugins/transform/public/app/lib/authorization/components/common.ts
+++ b/x-pack/plugins/transform/public/app/lib/authorization/components/common.ts
@@ -8,7 +8,7 @@
import { i18n } from '@kbn/i18n';
import { Privileges } from '../../../../../common/types/privileges';
-import { isPopulatedObject } from '../../../../../common/utils/object_utils';
+import { isPopulatedObject } from '../../../../../common/shared_imports';
export interface Capabilities {
canGetTransform: boolean;
@@ -22,10 +22,8 @@ export type Privilege = [string, string];
function isPrivileges(arg: unknown): arg is Privileges {
return (
- isPopulatedObject(arg) &&
- arg.hasOwnProperty('hasAllPrivileges') &&
+ isPopulatedObject(arg, ['hasAllPrivileges', 'missingPrivileges']) &&
typeof arg.hasAllPrivileges === 'boolean' &&
- arg.hasOwnProperty('missingPrivileges') &&
typeof arg.missingPrivileges === 'object' &&
arg.missingPrivileges !== null
);
diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor/advanced_runtime_mappings_editor.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor/advanced_runtime_mappings_editor.tsx
index 1e8397a4d9cc34..1e6e6a971a81a6 100644
--- a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor/advanced_runtime_mappings_editor.tsx
+++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor/advanced_runtime_mappings_editor.tsx
@@ -12,8 +12,9 @@ import { EuiCodeEditor } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
+import { isRuntimeMappings } from '../../../../../../common/shared_imports';
+
import { StepDefineFormHook } from '../step_define';
-import { isRuntimeMappings } from '../step_define/common/types';
export const AdvancedRuntimeMappingsEditor: FC = memo(
({
diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx
index a7f2a3cd7178d5..36bdca79216227 100644
--- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx
+++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx
@@ -47,7 +47,7 @@ import {
PutTransformsPivotRequestSchema,
} from '../../../../../../common/api_schemas/transforms';
import type { RuntimeField } from '../../../../../../../../../src/plugins/data/common/index_patterns';
-import { isPopulatedObject } from '../../../../../../common/utils/object_utils';
+import { isPopulatedObject } from '../../../../../../common/shared_imports';
import { isLatestTransform } from '../../../../../../common/types/transform';
export interface StepDetailsExposedState {
diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_agg_form.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_agg_form.tsx
index 3b5d6e0e504973..9b349541a78a3e 100644
--- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_agg_form.tsx
+++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_agg_form.tsx
@@ -16,7 +16,7 @@ import { getFilterAggTypeConfig } from '../config';
import type { FilterAggType, PivotAggsConfigFilter } from '../types';
import type { RuntimeMappings } from '../../types';
import { getKibanaFieldTypeFromEsType } from '../../get_pivot_dropdown_options';
-import { isPopulatedObject } from '../../../../../../../../../common/utils/object_utils';
+import { isPopulatedObject } from '../../../../../../../../../common/shared_imports';
/**
* Resolves supported filters for provided field.
diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_term_form.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_term_form.tsx
index f2db6167c163c6..358bb9dcafa967 100644
--- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_term_form.tsx
+++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_term_form.tsx
@@ -6,12 +6,16 @@
*/
import React, { useCallback, useContext, useEffect, useState } from 'react';
-import { EuiComboBox, EuiFormRow } from '@elastic/eui';
+import { estypes } from '@elastic/elasticsearch';
+import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { debounce } from 'lodash';
import useUpdateEffect from 'react-use/lib/useUpdateEffect';
import { i18n } from '@kbn/i18n';
-import { isEsSearchResponse } from '../../../../../../../../../common/api_schemas/type_guards';
+import {
+ isEsSearchResponseWithAggregations,
+ isMultiBucketAggregate,
+} from '../../../../../../../../../common/api_schemas/type_guards';
import { useApi } from '../../../../../../../hooks';
import { CreateTransformWizardContext } from '../../../../wizard/wizard';
import { FilterAggConfigTerm } from '../types';
@@ -29,7 +33,7 @@ export const FilterTermForm: FilterAggConfigTerm['aggTypeConfig']['FilterAggForm
const { indexPattern, runtimeMappings } = useContext(CreateTransformWizardContext);
const toastNotifications = useToastNotifications();
- const [options, setOptions] = useState([]);
+ const [options, setOptions] = useState([]);
const [isLoading, setIsLoading] = useState(true);
/* eslint-disable-next-line react-hooks/exhaustive-deps */
@@ -62,7 +66,12 @@ export const FilterTermForm: FilterAggConfigTerm['aggTypeConfig']['FilterAggForm
setIsLoading(false);
- if (!isEsSearchResponse(response)) {
+ if (
+ !(
+ isEsSearchResponseWithAggregations(response) &&
+ isMultiBucketAggregate(response.aggregations.field_values)
+ )
+ ) {
toastNotifications.addWarning(
i18n.translate('xpack.transform.agg.popoverForm.filerAgg.term.errorFetchSuggestions', {
defaultMessage: 'Unable to fetch suggestions',
@@ -72,9 +81,7 @@ export const FilterTermForm: FilterAggConfigTerm['aggTypeConfig']['FilterAggForm
}
setOptions(
- response.aggregations.field_values.buckets.map(
- (value: { key: string; doc_count: number }) => ({ label: value.key })
- )
+ response.aggregations.field_values.buckets.map((value) => ({ label: value.key + '' }))
);
}, 600),
[selectedField]
diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/get_pivot_dropdown_options.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/get_pivot_dropdown_options.ts
index 8d85988424e270..957439810adc72 100644
--- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/get_pivot_dropdown_options.ts
+++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/get_pivot_dropdown_options.ts
@@ -13,6 +13,7 @@ import {
} from '../../../../../../../../../../src/plugins/data/public';
import { getNestedProperty } from '../../../../../../../common/utils/object_utils';
+import { isRuntimeMappings } from '../../../../../../../common/shared_imports';
import {
DropDownLabel,
@@ -26,7 +27,6 @@ import {
import { getDefaultAggregationConfig } from './get_default_aggregation_config';
import { getDefaultGroupByConfig } from './get_default_group_by_config';
import type { Field, StepDefineExposedState } from './types';
-import { isRuntimeMappings } from './types';
const illegalEsAggNameChars = /[[\]>]/g;
diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/types.test.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/types.test.ts
deleted file mode 100644
index ec90d31a0d1698..00000000000000
--- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/types.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 { isRuntimeField, isRuntimeMappings } from './types';
-
-describe('Transform: step_define type guards', () => {
- it('isRuntimeField()', () => {
- expect(isRuntimeField(1)).toBe(false);
- expect(isRuntimeField(null)).toBe(false);
- expect(isRuntimeField([])).toBe(false);
- expect(isRuntimeField({})).toBe(false);
- expect(isRuntimeField({ someAttribute: 'someValue' })).toBe(false);
- expect(isRuntimeField({ type: 'wrong-type' })).toBe(false);
- expect(isRuntimeField({ type: 'keyword', someAttribute: 'some value' })).toBe(false);
-
- expect(isRuntimeField({ type: 'keyword' })).toBe(true);
- expect(isRuntimeField({ type: 'keyword', script: 'some script' })).toBe(true);
- });
-
- it('isRuntimeMappings()', () => {
- expect(isRuntimeMappings(1)).toBe(false);
- expect(isRuntimeMappings(null)).toBe(false);
- expect(isRuntimeMappings([])).toBe(false);
- expect(isRuntimeMappings({})).toBe(false);
- expect(isRuntimeMappings({ someAttribute: 'someValue' })).toBe(false);
- expect(isRuntimeMappings({ fieldName1: { type: 'keyword' }, fieldName2: 'someValue' })).toBe(
- false
- );
- expect(
- isRuntimeMappings({
- fieldName1: { type: 'keyword' },
- fieldName2: { type: 'keyword', someAttribute: 'some value' },
- })
- ).toBe(false);
- expect(
- isRuntimeMappings({
- fieldName: { type: 'long', script: 1234 },
- })
- ).toBe(false);
- expect(
- isRuntimeMappings({
- fieldName: { type: 'long', script: { someAttribute: 'some value' } },
- })
- ).toBe(false);
- expect(
- isRuntimeMappings({
- fieldName: { type: 'long', script: { source: 1234 } },
- })
- ).toBe(false);
-
- expect(isRuntimeMappings({ fieldName: { type: 'keyword' } })).toBe(true);
- expect(
- isRuntimeMappings({ fieldName1: { type: 'keyword' }, fieldName2: { type: 'keyword' } })
- ).toBe(true);
- expect(
- isRuntimeMappings({
- fieldName1: { type: 'keyword' },
- fieldName2: { type: 'keyword', script: 'some script as script' },
- })
- ).toBe(true);
- expect(
- isRuntimeMappings({
- fieldName: { type: 'long', script: { source: 'some script as source' } },
- })
- ).toBe(true);
- });
-});
diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/types.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/types.ts
index 6b4ff0090a497a..8b3b33fdde3efb 100644
--- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/types.ts
+++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/types.ts
@@ -24,7 +24,7 @@ import {
} from '../../../../../../../common/types/transform';
import { LatestFunctionConfig } from '../../../../../../../common/api_schemas/transforms';
-import { isPopulatedObject } from '../../../../../../../common/utils/object_utils';
+import { isPopulatedObject } from '../../../../../../../common/shared_imports';
export interface ErrorMessage {
query: string;
@@ -72,30 +72,10 @@ export interface StepDefineExposedState {
isRuntimeMappingsEditorEnabled: boolean;
}
-export function isRuntimeField(arg: unknown): arg is RuntimeField {
- return (
- isPopulatedObject(arg) &&
- ((Object.keys(arg).length === 1 && arg.hasOwnProperty('type')) ||
- (Object.keys(arg).length === 2 &&
- arg.hasOwnProperty('type') &&
- arg.hasOwnProperty('script') &&
- (typeof arg.script === 'string' ||
- (isPopulatedObject(arg.script) &&
- Object.keys(arg.script).length === 1 &&
- arg.script.hasOwnProperty('source') &&
- typeof arg.script.source === 'string')))) &&
- RUNTIME_FIELD_TYPES.includes(arg.type as RuntimeType)
- );
-}
-
-export function isRuntimeMappings(arg: unknown): arg is RuntimeMappings {
- return isPopulatedObject(arg) && Object.values(arg).every((d) => isRuntimeField(d));
-}
-
export function isPivotPartialRequest(arg: unknown): arg is { pivot: PivotConfigDefinition } {
- return isPopulatedObject(arg) && arg.hasOwnProperty('pivot');
+ return isPopulatedObject(arg, ['pivot']);
}
export function isLatestPartialRequest(arg: unknown): arg is { latest: LatestFunctionConfig } {
- return isPopulatedObject(arg) && arg.hasOwnProperty('latest');
+ return isPopulatedObject(arg, ['latest']);
}
diff --git a/x-pack/plugins/transform/public/shared_imports.ts b/x-pack/plugins/transform/public/shared_imports.ts
index ddf5cf7cb5cb19..edd27fd43c2af9 100644
--- a/x-pack/plugins/transform/public/shared_imports.ts
+++ b/x-pack/plugins/transform/public/shared_imports.ts
@@ -15,7 +15,7 @@ export {
UseIndexDataReturnType,
EsSorting,
RenderCellValue,
- HITS_TOTAL_RELATION,
+ ES_CLIENT_TOTAL_HITS_RELATION,
} from '../../ml/public';
import { XJson } from '../../../../src/plugins/es_ui_shared/public';
diff --git a/x-pack/plugins/transform/server/routes/api/transforms_nodes.ts b/x-pack/plugins/transform/server/routes/api/transforms_nodes.ts
index afdcc939983039..c9a0795c322103 100644
--- a/x-pack/plugins/transform/server/routes/api/transforms_nodes.ts
+++ b/x-pack/plugins/transform/server/routes/api/transforms_nodes.ts
@@ -5,7 +5,7 @@
* 2.0.
*/
-import { isPopulatedObject } from '../../../common/utils/object_utils';
+import { isPopulatedObject } from '../../../common/shared_imports';
import { RouteDependencies } from '../../types';
@@ -24,10 +24,7 @@ export const isNodes = (arg: unknown): arg is Nodes => {
return (
isPopulatedObject(arg) &&
Object.values(arg).every(
- (node) =>
- isPopulatedObject(node) &&
- {}.hasOwnProperty.call(node, NODE_ROLES) &&
- Array.isArray(node.roles)
+ (node) => isPopulatedObject(node, [NODE_ROLES]) && Array.isArray(node.roles)
)
);
};
diff --git a/x-pack/plugins/transform/tsconfig.json b/x-pack/plugins/transform/tsconfig.json
index 2717f92c7a4df1..30da887cc1c431 100644
--- a/x-pack/plugins/transform/tsconfig.json
+++ b/x-pack/plugins/transform/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index 8d223e730c5fa8..d238d3077aadce 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -3027,7 +3027,6 @@
"kibana-react.tableListView.listing.listingLimitExceeded.advancedSettingsLinkText": "高度な設定",
"kibana-react.tableListView.listing.listingLimitExceededDescription": "{totalItems} 件の {entityNamePlural} がありますが、{listingLimitText} の設定により {listingLimitValue} 件までしか下の表に表示できません。{advancedSettingsLink} の下でこの設定を変更できます。",
"kibana-react.tableListView.listing.listingLimitExceededTitle": "リスティング制限超過",
- "kibana-react.tableListView.listing.noAvailableItemsMessage": "利用可能な {entityNamePlural} がありません。",
"kibana-react.tableListView.listing.noMatchedItemsMessage": "検索条件に一致する {entityNamePlural} がありません。",
"kibana-react.tableListView.listing.table.actionTitle": "アクション",
"kibana-react.tableListView.listing.table.editActionDescription": "編集",
@@ -3455,7 +3454,6 @@
"timelion.help.configuration.valid.paragraph1Part2": "で Elasticsearch データソースの構成に関する詳細をご覧ください。",
"timelion.help.configuration.valid.paragraph2": "すでにチャートが 1 つ表示されていますが、興味深いデータを得るにはいくつか調整が必要な可能性があります。",
"timelion.help.configuration.valid.paragraph3": "これで、一定期間のデータポイントの数を示す折れ線グラフが表示されるはずです。",
- "timelion.help.configuration.valid.timeRangeText": "Kibana ツールバーのタイムピッカーで可視化するデータを含む期間を選択します。上記のすべてまたは一部の時間範囲を含む時間範囲を選択するようにしてください。",
"timelion.help.configuration.valid.timeRangeTitle": "時間範囲",
"timelion.help.configuration.validTitle": "良いお知らせです。Elasticsearch が正しく構成されました!",
"timelion.help.dataTransforming.functionReferenceLinkText": "機能リファレンス",
@@ -3465,7 +3463,6 @@
"timelion.help.dataTransforming.paragraph4": "まぁまぁですが、これでは 0 から 1 までの値になってしまいます。パーセンテージに変換するには、100 を掛けます:{multiplyDataQuery}。",
"timelion.help.dataTransforming.paragraph5": "これでトラフィックの何パーセントが米国からのものなのか分かり、一定期間内にどのように変化したのか見ることができます!Timelion には、{sum}、{subtract}、{multiply}、{divide} などのいくつもの演算機能が搭載されています。これらの多くが数列や数字を扱えます。また、{movingaverage}、{abs}、{derivative} といった他の便利な変換機能もあります。",
"timelion.help.dataTransforming.paragraph6Part1": "構文を学んだところで、",
- "timelion.help.dataTransforming.paragraph6Part2": "Timelion で利用できるすべての機能の使い方をご覧ください。Kibana ツールバーの \\{Docs\\} をクリックしていつでもリファレンスを参照することができます。このチュートリアルに戻るには、リファレンスの上にある \\{Tutorial\\} リンクをクリックします。",
"timelion.help.dataTransformingTitle": "データの変換:お楽しみの始まりです!",
"timelion.help.dontShowHelpButtonLabel": "今後表示しない",
"timelion.help.expressions.examples.customStylingDescription": "{descriptionTitle}初めの数列を赤くし、2 つ目の数列に 1 ピクセル幅のバーを使用します。",
@@ -3479,7 +3476,6 @@
"timelion.help.expressions.functionReferenceLinkText": "機能リファレンス",
"timelion.help.expressions.paragraph1": "それぞれの式はデータソース関数で始まります。ここから、新しい関数をデータソースに追加して変換や強化ができます。",
"timelion.help.expressions.paragraph2": "ところで、ここから先はデータの持ち主が一番よくご存知なのではないでしょうか。サンプルクエリをより有意義なものと自由に置き換えてみてください。",
- "timelion.help.expressions.paragraph3": "Kibana ツールバーの {strongAdd} をクリックして、他のチャートをいくつか追加してみましょう。そして、チャートを選択して次の式の内の 1 つをコピーし、インプットバーに貼り付けて、Enter を押します。リセットして繰り返し、他の式を試してみましょう。",
"timelion.help.expressions.paragraph4": "Timelion は、チャートの見た目をカスタマイズするための他のビュー変換機能も搭載しています。完全なリストは次のリソースをご覧ください",
"timelion.help.expressions.strongAddText": "追加",
"timelion.help.expressionsTitle": "式を使って式を定義",
@@ -12579,7 +12575,6 @@
"xpack.maps.mapListing.descriptionFieldTitle": "説明",
"xpack.maps.mapListing.entityName": "マップ",
"xpack.maps.mapListing.entityNamePlural": "マップ",
- "xpack.maps.mapListing.errorAttemptingToLoadSavedMaps": "マップを読み込めません",
"xpack.maps.mapListing.titleFieldTitle": "タイトル",
"xpack.maps.maps.choropleth.rightSourcePlaceholder": "インデックスパターンを選択",
"xpack.maps.mapSavedObjectLabel": "マップ",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 269926a607d959..58119a07398126 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -3048,7 +3048,6 @@
"kibana-react.tableListView.listing.listingLimitExceeded.advancedSettingsLinkText": "高级设置",
"kibana-react.tableListView.listing.listingLimitExceededDescription": "您有 {totalItems} 个{entityNamePlural},但您的“{listingLimitText}”设置阻止下表显示 {listingLimitValue} 个以上。您可以在“{advancedSettingsLink}”下更改此设置。",
"kibana-react.tableListView.listing.listingLimitExceededTitle": "已超过列表限制",
- "kibana-react.tableListView.listing.noAvailableItemsMessage": "没有可用的{entityNamePlural}。",
"kibana-react.tableListView.listing.noMatchedItemsMessage": "没有任何{entityNamePlural}匹配您的搜索。",
"kibana-react.tableListView.listing.table.actionTitle": "操作",
"kibana-react.tableListView.listing.table.editActionDescription": "编辑",
@@ -12744,7 +12743,6 @@
"xpack.maps.mapListing.descriptionFieldTitle": "描述",
"xpack.maps.mapListing.entityName": "地图",
"xpack.maps.mapListing.entityNamePlural": "地图",
- "xpack.maps.mapListing.errorAttemptingToLoadSavedMaps": "无法加载地图",
"xpack.maps.mapListing.titleFieldTitle": "标题",
"xpack.maps.maps.choropleth.rightSourcePlaceholder": "选择索引模式",
"xpack.maps.mapSavedObjectLabel": "地图",
diff --git a/x-pack/plugins/triggers_actions_ui/tsconfig.json b/x-pack/plugins/triggers_actions_ui/tsconfig.json
index 8202449b222987..b7a63d7043f496 100644
--- a/x-pack/plugins/triggers_actions_ui/tsconfig.json
+++ b/x-pack/plugins/triggers_actions_ui/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/ui_actions_enhanced/tsconfig.json b/x-pack/plugins/ui_actions_enhanced/tsconfig.json
index 39318770126e58..1513669cdc1ad0 100644
--- a/x-pack/plugins/ui_actions_enhanced/tsconfig.json
+++ b/x-pack/plugins/ui_actions_enhanced/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/upgrade_assistant/tsconfig.json b/x-pack/plugins/upgrade_assistant/tsconfig.json
index 0d65c8ddd8fed0..08e45bebf125b5 100644
--- a/x-pack/plugins/upgrade_assistant/tsconfig.json
+++ b/x-pack/plugins/upgrade_assistant/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/uptime/public/components/certificates/cert_monitors.test.tsx b/x-pack/plugins/uptime/public/components/certificates/cert_monitors.test.tsx
index 5dfc11837b72d6..719c90574b0887 100644
--- a/x-pack/plugins/uptime/public/components/certificates/cert_monitors.test.tsx
+++ b/x-pack/plugins/uptime/public/components/certificates/cert_monitors.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { CertMonitors } from './cert_monitors';
-import { renderWithRouter, shallowWithRouter } from '../../lib';
+import { renderWithRouter, shallowWithRouter } from '../../lib/helper/enzyme_helpers';
describe('CertMonitors', () => {
const certMons = [
diff --git a/x-pack/plugins/uptime/public/components/certificates/cert_search.test.tsx b/x-pack/plugins/uptime/public/components/certificates/cert_search.test.tsx
index a991634de22a6c..a0166fc5737544 100644
--- a/x-pack/plugins/uptime/public/components/certificates/cert_search.test.tsx
+++ b/x-pack/plugins/uptime/public/components/certificates/cert_search.test.tsx
@@ -6,7 +6,7 @@
*/
import React from 'react';
-import { renderWithRouter, shallowWithRouter } from '../../lib';
+import { renderWithRouter, shallowWithRouter } from '../../lib/helper/enzyme_helpers';
import { CertificateSearch } from './cert_search';
describe('CertificatesSearch', () => {
diff --git a/x-pack/plugins/uptime/public/components/certificates/cert_status.test.tsx b/x-pack/plugins/uptime/public/components/certificates/cert_status.test.tsx
index e331a6e5c34fea..999d76f6908672 100644
--- a/x-pack/plugins/uptime/public/components/certificates/cert_status.test.tsx
+++ b/x-pack/plugins/uptime/public/components/certificates/cert_status.test.tsx
@@ -6,7 +6,7 @@
*/
import React from 'react';
-import { renderWithRouter, shallowWithRouter } from '../../lib';
+import { renderWithRouter, shallowWithRouter } from '../../lib/helper/enzyme_helpers';
import { CertStatus } from './cert_status';
import * as redux from 'react-redux';
import moment from 'moment';
diff --git a/x-pack/plugins/uptime/public/components/certificates/certificates_list.test.tsx b/x-pack/plugins/uptime/public/components/certificates/certificates_list.test.tsx
index ec6a5d91a67c33..8ae0cdb791d9b1 100644
--- a/x-pack/plugins/uptime/public/components/certificates/certificates_list.test.tsx
+++ b/x-pack/plugins/uptime/public/components/certificates/certificates_list.test.tsx
@@ -6,7 +6,7 @@
*/
import React from 'react';
-import { shallowWithRouter } from '../../lib';
+import { shallowWithRouter } from '../../lib/helper/enzyme_helpers';
import { CertificateList, CertSort } from './certificates_list';
describe('CertificateList', () => {
diff --git a/x-pack/plugins/uptime/public/components/certificates/fingerprint_col.test.tsx b/x-pack/plugins/uptime/public/components/certificates/fingerprint_col.test.tsx
index 1affd1f990f90b..550b7f75623f0d 100644
--- a/x-pack/plugins/uptime/public/components/certificates/fingerprint_col.test.tsx
+++ b/x-pack/plugins/uptime/public/components/certificates/fingerprint_col.test.tsx
@@ -6,7 +6,7 @@
*/
import React from 'react';
-import { renderWithRouter, shallowWithRouter } from '../../lib';
+import { renderWithRouter, shallowWithRouter } from '../../lib/helper/enzyme_helpers';
import { FingerprintCol } from './fingerprint_col';
import moment from 'moment';
diff --git a/x-pack/plugins/uptime/public/components/common/charts/duration_charts.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/duration_charts.test.tsx
index d7ae92a0e76544..72b1145a9f34e2 100644
--- a/x-pack/plugins/uptime/public/components/common/charts/duration_charts.test.tsx
+++ b/x-pack/plugins/uptime/public/components/common/charts/duration_charts.test.tsx
@@ -9,7 +9,7 @@ import React from 'react';
import DateMath from '@elastic/datemath';
import { DurationChartComponent } from './duration_chart';
import { MonitorDurationResult } from '../../../../common/types';
-import { shallowWithRouter } from '../../../lib';
+import { shallowWithRouter } from '../../../lib/helper/enzyme_helpers';
describe('MonitorCharts component', () => {
let dateMathSpy: any;
diff --git a/x-pack/plugins/uptime/public/components/common/charts/monitor_bar_series.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/monitor_bar_series.test.tsx
index 792b357b3baba8..b11595eafae4fb 100644
--- a/x-pack/plugins/uptime/public/components/common/charts/monitor_bar_series.test.tsx
+++ b/x-pack/plugins/uptime/public/components/common/charts/monitor_bar_series.test.tsx
@@ -7,7 +7,8 @@
import React from 'react';
import { MonitorBarSeries, MonitorBarSeriesProps } from './monitor_bar_series';
-import { renderWithRouter, shallowWithRouter, MountWithReduxProvider } from '../../../lib';
+import { renderWithRouter, shallowWithRouter } from '../../../lib/helper/enzyme_helpers';
+import { MountWithReduxProvider } from '../../../lib/helper/helper_with_redux';
import { HistogramPoint } from '../../../../common/runtime_types';
describe('MonitorBarSeries component', () => {
diff --git a/x-pack/plugins/uptime/public/components/common/header/page_header.test.tsx b/x-pack/plugins/uptime/public/components/common/header/page_header.test.tsx
index 6e04648a817f0c..bede71b8ba03d8 100644
--- a/x-pack/plugins/uptime/public/components/common/header/page_header.test.tsx
+++ b/x-pack/plugins/uptime/public/components/common/header/page_header.test.tsx
@@ -9,7 +9,7 @@ import React from 'react';
import moment from 'moment';
import { PageHeader } from './page_header';
import { Ping } from '../../../../common/runtime_types';
-import { renderWithRouter } from '../../../lib';
+import { renderWithRouter } from '../../../lib/helper/enzyme_helpers';
import { mockReduxHooks } from '../../../lib/helper/test_helpers';
describe('PageHeader', () => {
diff --git a/x-pack/plugins/uptime/public/components/common/monitor_tags.test.tsx b/x-pack/plugins/uptime/public/components/common/monitor_tags.test.tsx
index fdb5498969d39d..63465aefcdd433 100644
--- a/x-pack/plugins/uptime/public/components/common/monitor_tags.test.tsx
+++ b/x-pack/plugins/uptime/public/components/common/monitor_tags.test.tsx
@@ -10,7 +10,7 @@ import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { MonitorTags } from './monitor_tags';
import * as hooks from '../../hooks/use_url_params';
-import { renderWithRouter, shallowWithRouter } from '../../lib';
+import { renderWithRouter, shallowWithRouter } from '../../lib/helper/enzyme_helpers';
describe('MonitorTags component', () => {
const summaryPing = {
diff --git a/x-pack/plugins/uptime/public/components/common/uptime_date_picker.test.tsx b/x-pack/plugins/uptime/public/components/common/uptime_date_picker.test.tsx
index 4bfe7de33cba58..d433e7fccd1b8e 100644
--- a/x-pack/plugins/uptime/public/components/common/uptime_date_picker.test.tsx
+++ b/x-pack/plugins/uptime/public/components/common/uptime_date_picker.test.tsx
@@ -10,9 +10,9 @@ import { UptimeDatePicker } from './uptime_date_picker';
import {
renderWithRouter,
shallowWithRouter,
- MountWithReduxProvider,
mountWithRouterRedux,
-} from '../../lib';
+} from '../../lib/helper/enzyme_helpers';
+import { MountWithReduxProvider } from '../../lib/helper/helper_with_redux';
import { UptimeStartupPluginsContextProvider } from '../../contexts';
import { startPlugins } from '../../lib/__mocks__/uptime_plugin_start_mock';
import { ClientPluginsStart } from '../../apps/plugin';
diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_integerations.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ml/ml_integerations.test.tsx
index f29be50633fab7..16d96148af3404 100644
--- a/x-pack/plugins/uptime/public/components/monitor/ml/ml_integerations.test.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor/ml/ml_integerations.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { MLIntegrationComponent } from './ml_integeration';
-import { renderWithRouter, shallowWithRouter } from '../../../lib';
+import { renderWithRouter, shallowWithRouter } from '../../../lib/helper/enzyme_helpers';
import * as redux from 'react-redux';
import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public';
import { coreMock } from 'src/core/public/mocks';
diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_manage_job.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ml/ml_manage_job.test.tsx
index 15a537a49ccf38..6bff0b61d7349e 100644
--- a/x-pack/plugins/uptime/public/components/monitor/ml/ml_manage_job.test.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor/ml/ml_manage_job.test.tsx
@@ -9,7 +9,7 @@ import React from 'react';
import { coreMock } from 'src/core/public/mocks';
import { ManageMLJobComponent } from './manage_ml_job';
import * as redux from 'react-redux';
-import { renderWithRouter, shallowWithRouter } from '../../../lib';
+import { renderWithRouter, shallowWithRouter } from '../../../lib/helper/enzyme_helpers';
import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public';
const core = coreMock.createStart();
diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_charts.test.tsx b/x-pack/plugins/uptime/public/components/monitor/monitor_charts.test.tsx
index 3f107581c1eea7..a1be391833bc3f 100644
--- a/x-pack/plugins/uptime/public/components/monitor/monitor_charts.test.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor/monitor_charts.test.tsx
@@ -8,7 +8,7 @@
import React from 'react';
import DateMath from '@elastic/datemath';
import { MonitorCharts } from './monitor_charts';
-import { shallowWithRouter } from '../../lib';
+import { shallowWithRouter } from '../../lib/helper/enzyme_helpers';
describe('MonitorCharts component', () => {
let dateMathSpy: any;
diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_title.test.tsx b/x-pack/plugins/uptime/public/components/monitor/monitor_title.test.tsx
index dabc0021898eb8..682be99b9b4186 100644
--- a/x-pack/plugins/uptime/public/components/monitor/monitor_title.test.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor/monitor_title.test.tsx
@@ -10,7 +10,7 @@ import moment from 'moment';
import * as reactRouterDom from 'react-router-dom';
import { Ping } from '../../../common/runtime_types';
import { MonitorPageTitle } from './monitor_title';
-import { renderWithRouter } from '../../lib';
+import { renderWithRouter } from '../../lib/helper/enzyme_helpers';
import { mockReduxHooks } from '../../lib/helper/test_helpers';
jest.mock('react-router-dom', () => {
diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/monitor_status.bar.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/monitor_status.bar.test.tsx
index af3c47b9caf30b..ba0853b5b1b60a 100644
--- a/x-pack/plugins/uptime/public/components/monitor/status_details/monitor_status.bar.test.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor/status_details/monitor_status.bar.test.tsx
@@ -10,7 +10,7 @@ import React from 'react';
import { MonitorStatusBar } from './status_bar';
import { Ping } from '../../../../common/runtime_types';
import * as redux from 'react-redux';
-import { renderWithRouter } from '../../../lib';
+import { renderWithRouter } from '../../../lib/helper/enzyme_helpers';
import { createMemoryHistory } from 'history';
describe('MonitorStatusBar component', () => {
diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/ssl_certificate.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/ssl_certificate.test.tsx
index 03ce292e63621a..0cb7ff7168404d 100644
--- a/x-pack/plugins/uptime/public/components/monitor/status_details/ssl_certificate.test.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor/status_details/ssl_certificate.test.tsx
@@ -11,7 +11,11 @@ import { EuiIcon } from '@elastic/eui';
import { Tls } from '../../../../common/runtime_types';
import { MonitorSSLCertificate } from './status_bar';
import * as redux from 'react-redux';
-import { mountWithRouter, renderWithRouter, shallowWithRouter } from '../../../lib';
+import {
+ mountWithRouter,
+ renderWithRouter,
+ shallowWithRouter,
+} from '../../../lib/helper/enzyme_helpers';
import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../common/constants';
describe('SSL Certificate component', () => {
diff --git a/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.test.tsx b/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.test.tsx
index a617ba0db1eb33..c751e6a0c24fa0 100644
--- a/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.test.tsx
+++ b/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.test.tsx
@@ -9,7 +9,7 @@ import React from 'react';
import { EmptyStateComponent } from './empty_state';
import { StatesIndexStatus } from '../../../../common/runtime_types';
import { HttpFetchError, IHttpFetchError } from 'src/core/public';
-import { mountWithRouter, shallowWithRouter } from '../../../lib';
+import { mountWithRouter, shallowWithRouter } from '../../../lib/helper/enzyme_helpers';
describe('EmptyState component', () => {
let statesIndexStatus: StatesIndexStatus;
diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/enable_alert.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/enable_alert.test.tsx
index a325edc2431291..a4e7f10d97bfc7 100644
--- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/enable_alert.test.tsx
+++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/enable_alert.test.tsx
@@ -12,7 +12,7 @@ import {
mountWithRouterRedux,
renderWithRouterRedux,
shallowWithRouterRedux,
-} from '../../../../lib';
+} from '../../../../lib/helper/enzyme_helpers';
import { EuiPopover, EuiText } from '@elastic/eui';
import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../../common/constants';
import { ReactRouterEuiLink } from '../../../common/react_router_helpers';
diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/filter_status_button.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/filter_status_button.test.tsx
index 4d0e82dc8a2969..c95e3cd61c5fd7 100644
--- a/x-pack/plugins/uptime/public/components/overview/monitor_list/filter_status_button.test.tsx
+++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/filter_status_button.test.tsx
@@ -7,7 +7,8 @@
import React from 'react';
import { FilterStatusButton, FilterStatusButtonProps } from './filter_status_button';
-import { renderWithRouter, shallowWithRouter, MountWithReduxProvider } from '../../../lib';
+import { renderWithRouter, shallowWithRouter } from '../../../lib/helper/enzyme_helpers';
+import { MountWithReduxProvider } from '../../../lib/helper/helper_with_redux';
describe('FilterStatusButton', () => {
let props: FilterStatusButtonProps;
diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.test.tsx
index 39f9b20624b630..f7a2ad9a536bd1 100644
--- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.test.tsx
+++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.test.tsx
@@ -15,7 +15,7 @@ import {
MonitorSummary,
} from '../../../../common/runtime_types';
import { MonitorListComponent, noItemsMessage } from './monitor_list';
-import { renderWithRouter, shallowWithRouter } from '../../../lib';
+import { renderWithRouter, shallowWithRouter } from '../../../lib/helper/enzyme_helpers';
import * as redux from 'react-redux';
import moment from 'moment';
import { IHttpFetchError } from '../../../../../../../src/core/public';
diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx
index d044ad4e6a3a28..39c6d6bd9215d5 100644
--- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx
+++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx
@@ -9,7 +9,7 @@ import 'jest';
import React from 'react';
import { MonitorListDrawerComponent } from './monitor_list_drawer';
import { MonitorDetails, MonitorSummary, makePing } from '../../../../../common/runtime_types';
-import { shallowWithRouter } from '../../../../lib';
+import { shallowWithRouter } from '../../../../lib/helper/enzyme_helpers';
describe('MonitorListDrawer component', () => {
let summary: MonitorSummary;
diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/status_filter.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/status_filter.test.tsx
index bbc4e13c9eca2c..c2515ab55b126b 100644
--- a/x-pack/plugins/uptime/public/components/overview/monitor_list/status_filter.test.tsx
+++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/status_filter.test.tsx
@@ -10,8 +10,8 @@ import {
mountWithRouter,
renderWithRouter,
shallowWithRouter,
- MountWithReduxProvider,
-} from '../../../lib';
+} from '../../../lib/helper/enzyme_helpers';
+import { MountWithReduxProvider } from '../../../lib/helper/helper_with_redux';
import { createMemoryHistory } from 'history';
import { StatusFilter } from './status_filter';
import { FilterStatusButton } from './filter_status_button';
diff --git a/x-pack/plugins/uptime/public/components/settings/certificate_form.test.tsx b/x-pack/plugins/uptime/public/components/settings/certificate_form.test.tsx
index 84c9923bfc4192..051c4166d0fddf 100644
--- a/x-pack/plugins/uptime/public/components/settings/certificate_form.test.tsx
+++ b/x-pack/plugins/uptime/public/components/settings/certificate_form.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { CertificateExpirationForm } from './certificate_form';
-import { shallowWithRouter, mountWithRouter } from '../../lib';
+import { shallowWithRouter, mountWithRouter } from '../../lib/helper/enzyme_helpers';
describe('CertificateForm', () => {
it('shallow renders expected elements for valid props', () => {
diff --git a/x-pack/plugins/uptime/public/components/settings/indices_form.test.tsx b/x-pack/plugins/uptime/public/components/settings/indices_form.test.tsx
index 67ca142d8a8ea8..fc2567ea98c451 100644
--- a/x-pack/plugins/uptime/public/components/settings/indices_form.test.tsx
+++ b/x-pack/plugins/uptime/public/components/settings/indices_form.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { IndicesForm } from './indices_form';
-import { shallowWithRouter } from '../../lib';
+import { shallowWithRouter } from '../../lib/helper/enzyme_helpers';
describe('CertificateForm', () => {
it('shallow renders expected elements for valid props', () => {
diff --git a/x-pack/plugins/uptime/public/hooks/use_breadcrumbs.test.tsx b/x-pack/plugins/uptime/public/hooks/use_breadcrumbs.test.tsx
index 6fc98fbaf1f5b0..7aeac9706af58c 100644
--- a/x-pack/plugins/uptime/public/hooks/use_breadcrumbs.test.tsx
+++ b/x-pack/plugins/uptime/public/hooks/use_breadcrumbs.test.tsx
@@ -8,10 +8,11 @@
import { ChromeBreadcrumb } from 'kibana/public';
import React from 'react';
import { Route } from 'react-router-dom';
-import { mountWithRouter } from '../lib';
+import { mountWithRouter } from '../lib/helper/enzyme_helpers';
import { OVERVIEW_ROUTE } from '../../common/constants';
import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public';
-import { UptimeUrlParams, getSupportedUrlParams, MountWithReduxProvider } from '../lib/helper';
+import { UptimeUrlParams, getSupportedUrlParams } from '../lib/helper';
+import { MountWithReduxProvider } from '../lib/helper/helper_with_redux';
import { makeBaseBreadcrumb, useBreadcrumbs } from './use_breadcrumbs';
describe('useBreadcrumbs', () => {
diff --git a/x-pack/plugins/uptime/public/hooks/use_url_params.test.tsx b/x-pack/plugins/uptime/public/hooks/use_url_params.test.tsx
index 3ce112b1cb835a..31580ec22d48cd 100644
--- a/x-pack/plugins/uptime/public/hooks/use_url_params.test.tsx
+++ b/x-pack/plugins/uptime/public/hooks/use_url_params.test.tsx
@@ -9,7 +9,8 @@ import DateMath from '@elastic/datemath';
import React, { useState, Fragment } from 'react';
import { useUrlParams, UptimeUrlParamsHook } from './use_url_params';
import { UptimeRefreshContext } from '../contexts';
-import { mountWithRouter, MountWithReduxProvider } from '../lib';
+import { MountWithReduxProvider } from '../lib/helper/helper_with_redux';
+import { mountWithRouter } from '../lib/helper/enzyme_helpers';
import { createMemoryHistory } from 'history';
interface MockUrlParamsComponentProps {
diff --git a/x-pack/plugins/uptime/public/lib/helper/index.ts b/x-pack/plugins/uptime/public/lib/helper/index.ts
index 2fce3cc0e54dc6..6546b5f9ae6c45 100644
--- a/x-pack/plugins/uptime/public/lib/helper/index.ts
+++ b/x-pack/plugins/uptime/public/lib/helper/index.ts
@@ -10,4 +10,3 @@ export * from './observability_integration';
export { getChartDateLabel } from './charts';
export { seriesHasDownValues } from './series_has_down_values';
export { UptimeUrlParams, getSupportedUrlParams } from './url_params';
-export { MountWithReduxProvider } from './helper_with_redux';
diff --git a/x-pack/plugins/uptime/public/lib/index.ts b/x-pack/plugins/uptime/public/lib/index.ts
deleted file mode 100644
index 9added9af65926..00000000000000
--- a/x-pack/plugins/uptime/public/lib/index.ts
+++ /dev/null
@@ -1,9 +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.
- */
-
-export { MountWithReduxProvider } from './helper';
-export * from './helper/enzyme_helpers';
diff --git a/x-pack/plugins/uptime/public/pages/certificates.test.tsx b/x-pack/plugins/uptime/public/pages/certificates.test.tsx
index ff5f1afcaa2902..1218a1882b3bf8 100644
--- a/x-pack/plugins/uptime/public/pages/certificates.test.tsx
+++ b/x-pack/plugins/uptime/public/pages/certificates.test.tsx
@@ -6,7 +6,7 @@
*/
import React from 'react';
-import { shallowWithRouter } from '../lib';
+import { shallowWithRouter } from '../lib/helper/enzyme_helpers';
import { CertificatesPage } from './certificates';
describe('CertificatesPage', () => {
diff --git a/x-pack/plugins/uptime/public/pages/monitor.test.tsx b/x-pack/plugins/uptime/public/pages/monitor.test.tsx
index 80fcfcc271964d..2664f73d260757 100644
--- a/x-pack/plugins/uptime/public/pages/monitor.test.tsx
+++ b/x-pack/plugins/uptime/public/pages/monitor.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { MonitorPage } from './monitor';
-import { shallowWithRouter } from '../lib';
+import { shallowWithRouter } from '../lib/helper/enzyme_helpers';
describe('MonitorPage', () => {
it('shallow renders expected elements for valid props', () => {
diff --git a/x-pack/plugins/uptime/public/pages/not_found.test.tsx b/x-pack/plugins/uptime/public/pages/not_found.test.tsx
index 8d5b20e45303d6..cc9ea1a62cd0f4 100644
--- a/x-pack/plugins/uptime/public/pages/not_found.test.tsx
+++ b/x-pack/plugins/uptime/public/pages/not_found.test.tsx
@@ -6,7 +6,7 @@
*/
import React from 'react';
-import { shallowWithRouter } from '../lib';
+import { shallowWithRouter } from '../lib/helper/enzyme_helpers';
import { NotFoundPage } from './not_found';
describe('NotFoundPage', () => {
diff --git a/x-pack/plugins/uptime/public/pages/overview.test.tsx b/x-pack/plugins/uptime/public/pages/overview.test.tsx
index cfc140e6b22a31..b4949a84a6e367 100644
--- a/x-pack/plugins/uptime/public/pages/overview.test.tsx
+++ b/x-pack/plugins/uptime/public/pages/overview.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { OverviewPageComponent } from './overview';
-import { shallowWithRouter } from '../lib';
+import { shallowWithRouter } from '../lib/helper/enzyme_helpers';
describe('MonitorPage', () => {
const indexPattern = {
diff --git a/x-pack/plugins/uptime/tsconfig.json b/x-pack/plugins/uptime/tsconfig.json
index 531ee2ecd8d2b1..0b982040017537 100644
--- a/x-pack/plugins/uptime/tsconfig.json
+++ b/x-pack/plugins/uptime/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
@@ -12,7 +12,6 @@
"public/**/*",
"public/components/monitor/status_details/location_map/embeddables/low_poly_layer.json",
"server/**/*",
- "server/lib/requests/__fixtures__/monitor_charts_mock.json",
"../../../typings/**/*"
],
"references": [
diff --git a/x-pack/plugins/watcher/tsconfig.json b/x-pack/plugins/watcher/tsconfig.json
index e8dabe8cd40a9c..41bcb015d2d94a 100644
--- a/x-pack/plugins/watcher/tsconfig.json
+++ b/x-pack/plugins/watcher/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/plugins/xpack_legacy/tsconfig.json b/x-pack/plugins/xpack_legacy/tsconfig.json
index 3bfc78b72cb3ef..fdac21a3913130 100644
--- a/x-pack/plugins/xpack_legacy/tsconfig.json
+++ b/x-pack/plugins/xpack_legacy/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../../../tsconfig.base.json",
+ "extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/csv_searchsource_immediate.ts b/x-pack/test/reporting_api_integration/reporting_and_security/csv_searchsource_immediate.ts
index 27c6a05f740bf7..ebc7badd88f427 100644
--- a/x-pack/test/reporting_api_integration/reporting_and_security/csv_searchsource_immediate.ts
+++ b/x-pack/test/reporting_api_integration/reporting_and_security/csv_searchsource_immediate.ts
@@ -31,7 +31,8 @@ export default function ({ getService }: FtrProviderContext) {
},
};
- describe('CSV Generation from SearchSource', () => {
+ // FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/96000
+ describe.skip('CSV Generation from SearchSource', () => {
before(async () => {
await kibanaServer.uiSettings.update({
'csv:quoteValues': false,
diff --git a/yarn.lock b/yarn.lock
index 80ad1acf7fccd0..ea663207aafa5a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10044,15 +10044,14 @@ concat-stream@~2.0.0:
typedarray "^0.0.6"
concaveman@*:
- version "1.1.1"
- resolved "https://registry.yarnpkg.com/concaveman/-/concaveman-1.1.1.tgz#6c2482580b2523cef82fc2bec00a0415e6e68162"
- integrity sha1-bCSCWAslI874L8K+wAoEFebmgWI=
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/concaveman/-/concaveman-1.2.0.tgz#4340f27c08a11bdc1d5fac13476862a2ab09b703"
+ integrity sha512-OcqechF2/kubbffomKqjGEkb0ndlYhEbmyg/fxIGqdfYp5AZjD2Kl5hc97Hh3ngEuHU2314Z4KDbxL7qXGWrQQ==
dependencies:
- monotone-convex-hull-2d "^1.0.1"
point-in-polygon "^1.0.1"
- rbush "^2.0.1"
- robust-orientation "^1.1.3"
- tinyqueue "^1.1.0"
+ rbush "^3.0.0"
+ robust-predicates "^2.0.4"
+ tinyqueue "^2.0.3"
config-chain@^1.1.12:
version "1.1.12"
@@ -20241,13 +20240,6 @@ monocle-ts@^1.0.0:
resolved "https://registry.yarnpkg.com/monocle-ts/-/monocle-ts-1.7.1.tgz#03a615938aa90983a4fa29749969d30f72d80ba1"
integrity sha512-X9OzpOyd/R83sYex8NYpJjUzi/MLQMvGNVfxDYiIvs+QMXMEUDwR61MQoARFN10Cqz5h/mbFSPnIQNUIGhYd2Q==
-monotone-convex-hull-2d@^1.0.1:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/monotone-convex-hull-2d/-/monotone-convex-hull-2d-1.0.1.tgz#47f5daeadf3c4afd37764baa1aa8787a40eee08c"
- integrity sha1-R/Xa6t88Sv03dkuqGqh4ekDu4Iw=
- dependencies:
- robust-orientation "^1.1.3"
-
moo@^0.4.3:
version "0.4.3"
resolved "https://registry.yarnpkg.com/moo/-/moo-0.4.3.tgz#3f847a26f31cf625a956a87f2b10fbc013bfd10e"
@@ -23143,11 +23135,6 @@ quick-lru@^4.0.1:
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f"
integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==
-quickselect@^1.0.1:
- version "1.1.1"
- resolved "https://registry.yarnpkg.com/quickselect/-/quickselect-1.1.1.tgz#852e412ce418f237ad5b660d70cffac647ae94c2"
- integrity sha512-qN0Gqdw4c4KGPsBOQafj6yj/PA6c/L63f6CaZ/DCF/xF4Esu3jVmKLUDYxghFx8Kb/O7y9tI7x2RjTSXwdK1iQ==
-
quickselect@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/quickselect/-/quickselect-2.0.0.tgz#f19680a486a5eefb581303e023e98faaf25dd018"
@@ -23258,14 +23245,7 @@ raw-loader@^4.0.1:
loader-utils "^2.0.0"
schema-utils "^2.6.5"
-rbush@^2.0.1:
- version "2.0.2"
- resolved "https://registry.yarnpkg.com/rbush/-/rbush-2.0.2.tgz#bb6005c2731b7ba1d5a9a035772927d16a614605"
- integrity sha512-XBOuALcTm+O/H8G90b6pzu6nX6v2zCKiFG4BJho8a+bY6AER6t8uQUZdi5bomQc0AprCWhEGa7ncAbbRap0bRA==
- dependencies:
- quickselect "^1.0.1"
-
-rbush@^3.0.1:
+rbush@^3.0.0, rbush@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/rbush/-/rbush-3.0.1.tgz#5fafa8a79b3b9afdfe5008403a720cc1de882ecf"
integrity sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==
@@ -25131,33 +25111,10 @@ rison-node@1.0.2:
resolved "https://registry.yarnpkg.com/rison-node/-/rison-node-1.0.2.tgz#b7b5f37f39f5ae2a51a973a33c9aa17239a33e4b"
integrity sha1-t7Xzfzn1ripRqXOjPJqhcjmjPks=
-robust-orientation@^1.1.3:
- version "1.1.3"
- resolved "https://registry.yarnpkg.com/robust-orientation/-/robust-orientation-1.1.3.tgz#daff5b00d3be4e60722f0e9c0156ef967f1c2049"
- integrity sha1-2v9bANO+TmByLw6cAVbvln8cIEk=
- dependencies:
- robust-scale "^1.0.2"
- robust-subtract "^1.0.0"
- robust-sum "^1.0.0"
- two-product "^1.0.2"
-
-robust-scale@^1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/robust-scale/-/robust-scale-1.0.2.tgz#775132ed09542d028e58b2cc79c06290bcf78c32"
- integrity sha1-d1Ey7QlULQKOWLLMecBikLz3jDI=
- dependencies:
- two-product "^1.0.2"
- two-sum "^1.0.0"
-
-robust-subtract@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/robust-subtract/-/robust-subtract-1.0.0.tgz#e0b164e1ed8ba4e3a5dda45a12038348dbed3e9a"
- integrity sha1-4LFk4e2LpOOl3aRaEgODSNvtPpo=
-
-robust-sum@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/robust-sum/-/robust-sum-1.0.0.tgz#16646e525292b4d25d82757a286955e0bbfa53d9"
- integrity sha1-FmRuUlKStNJdgnV6KGlV4Lv6U9k=
+robust-predicates@^2.0.4:
+ version "2.0.4"
+ resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-2.0.4.tgz#0a2367a93abd99676d075981707f29cfb402248b"
+ integrity sha512-l4NwboJM74Ilm4VKfbAtFeGq7aEjWL+5kVFcmgFA2MrdnQWx9iE/tUGvxY5HyMI7o/WpSIUFLbC5fbeaHgSCYg==
rollup@^0.25.8:
version "0.25.8"
@@ -27512,11 +27469,6 @@ tinygradient@0.4.3:
"@types/tinycolor2" "^1.4.0"
tinycolor2 "^1.0.0"
-tinyqueue@^1.1.0:
- version "1.2.3"
- resolved "https://registry.yarnpkg.com/tinyqueue/-/tinyqueue-1.2.3.tgz#b6a61de23060584da29f82362e45df1ec7353f3d"
- integrity sha512-Qz9RgWuO9l8lT+Y9xvbzhPT2efIUIFd69N7eF7tJ9lnQl0iLj1M7peK7IoUGZL9DJHw9XftqLreccfxcQgYLxA==
-
tinyqueue@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/tinyqueue/-/tinyqueue-2.0.3.tgz#64d8492ebf39e7801d7bd34062e29b45b2035f08"
@@ -27936,16 +27888,6 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
-two-product@^1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/two-product/-/two-product-1.0.2.tgz#67d95d4b257a921e2cb4bd7af9511f9088522eaa"
- integrity sha1-Z9ldSyV6kh4stL16+VEfkIhSLqo=
-
-two-sum@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/two-sum/-/two-sum-1.0.0.tgz#31d3f32239e4f731eca9df9155e2b297f008ab64"
- integrity sha1-MdPzIjnk9zHsqd+RVeKyl/AIq2Q=
-
type-check@~0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72"