From 0ee253e9e016b776e45387e3e30c0cec0721d372 Mon Sep 17 00:00:00 2001
From: Spencer
Date: Thu, 1 Oct 2020 16:43:13 -0700
Subject: [PATCH 01/56] [optimizer] strip proptypes from plugin bundles in
production (#79221)
Co-authored-by: spalger
---
packages/kbn-babel-preset/package.json | 1 +
packages/kbn-babel-preset/webpack_preset.js | 13 +++++++++++++
packages/kbn-optimizer/src/worker/webpack.config.ts | 1 +
yarn.lock | 5 +++++
4 files changed, 20 insertions(+)
diff --git a/packages/kbn-babel-preset/package.json b/packages/kbn-babel-preset/package.json
index d6d1a78dd4a23..bc4e0ec338f94 100644
--- a/packages/kbn-babel-preset/package.json
+++ b/packages/kbn-babel-preset/package.json
@@ -15,6 +15,7 @@
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-styled-components": "^1.10.7",
"babel-plugin-transform-define": "^1.3.1",
+ "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"react-is": "^16.8.0",
"styled-components": "^5.1.0"
}
diff --git a/packages/kbn-babel-preset/webpack_preset.js b/packages/kbn-babel-preset/webpack_preset.js
index a43d607edb17c..503b99d3c3e8a 100644
--- a/packages/kbn-babel-preset/webpack_preset.js
+++ b/packages/kbn-babel-preset/webpack_preset.js
@@ -40,5 +40,18 @@ module.exports = () => {
},
],
],
+ env: {
+ production: {
+ plugins: [
+ [
+ require.resolve('babel-plugin-transform-react-remove-prop-types'),
+ {
+ mode: 'remove',
+ removeImport: true,
+ },
+ ],
+ ],
+ },
+ },
};
};
diff --git a/packages/kbn-optimizer/src/worker/webpack.config.ts b/packages/kbn-optimizer/src/worker/webpack.config.ts
index 2edf1c999888e..9678dd5de868b 100644
--- a/packages/kbn-optimizer/src/worker/webpack.config.ts
+++ b/packages/kbn-optimizer/src/worker/webpack.config.ts
@@ -200,6 +200,7 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker:
loader: 'babel-loader',
options: {
babelrc: false,
+ envName: worker.dist ? 'production' : 'development',
presets: IS_CODE_COVERAGE
? [ISTANBUL_PRESET_PATH, BABEL_PRESET_PATH]
: [BABEL_PRESET_PATH],
diff --git a/yarn.lock b/yarn.lock
index 77e3a399c4313..d795a174cfaa0 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7612,6 +7612,11 @@ babel-plugin-transform-property-literals@^6.9.4:
dependencies:
esutils "^2.0.2"
+babel-plugin-transform-react-remove-prop-types@^0.4.24:
+ version "0.4.24"
+ resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz#f2edaf9b4c6a5fbe5c1d678bfb531078c1555f3a"
+ integrity sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA==
+
babel-plugin-transform-regexp-constructors@^0.4.3:
version "0.4.3"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.4.3.tgz#58b7775b63afcf33328fae9a5f88fbd4fb0b4965"
From e5d8d49164a8d993bdd314dd6c800f9186092148 Mon Sep 17 00:00:00 2001
From: Tiago Costa
Date: Fri, 2 Oct 2020 00:46:00 +0100
Subject: [PATCH 02/56] chore(NA): assures a single version for the same
dependency across the entire project (#78825)
* chore(NA): script to check for multiple version of same dependency
* chore(NA): remove multiple versions for the same dependency
* chore(NA): hook single_version_dependencies script into the CI
* chore(NA): remove grunt from the CI hook integration
* chore(NA): update kbn pm dist
* chore(NA): fix typechecking
* chore(NA): update code to run under last extract-zip version
* fix(NA): multiple versions of the same type dependency
* move validation to bootstrap (#13)
Co-authored-by: spalger
* chore(NA): todo to remove logic to validate single version deps once we move into a single package.json
* chore(NA): remove verify dependency versions jenkins task
* chore(NA): update kbn pm dist file
* chore(NA): remove last mention to verify_dependency_versions.sh fom tasks.groovy
Co-authored-by: Spencer
Co-authored-by: spalger
Co-authored-by: Elastic Machine
---
package.json | 10 +-
packages/kbn-apm-config-loader/package.json | 2 +-
packages/kbn-es/package.json | 2 +-
packages/kbn-plugin-helpers/package.json | 2 +-
packages/kbn-pm/dist/index.js | 4764 +++++++++--------
packages/kbn-pm/package.json | 6 +-
.../kbn-pm/src/utils/validate_yarn_lock.ts | 62 +
packages/kbn-release-notes/package.json | 2 +-
packages/kbn-storybook/package.json | 4 +-
packages/kbn-storybook/webpack.config.ts | 4 -
packages/kbn-test/package.json | 2 +-
packages/kbn-ui-framework/package.json | 6 +-
tasks/config/run.js | 4 -
tasks/jenkins.js | 1 -
tasks/verify_dependency_versions.js | 53 -
.../checks/verify_dependency_versions.sh | 5 -
vars/tasks.groovy | 1 -
x-pack/package.json | 12 +-
x-pack/plugins/apm/e2e/package.json | 2 +-
x-pack/plugins/apm/scripts/package.json | 2 +-
.../server/browsers/extract/unzip.js | 16 +-
.../public/common/mock/timeline_results.ts | 2 +-
.../scripts/beat_docs/build.js | 38 +-
yarn.lock | 363 +-
24 files changed, 2667 insertions(+), 2698 deletions(-)
delete mode 100644 tasks/verify_dependency_versions.js
delete mode 100755 test/scripts/checks/verify_dependency_versions.sh
diff --git a/package.json b/package.json
index 0eda8dd9f4114..ff98d7f85dcef 100644
--- a/package.json
+++ b/package.json
@@ -151,7 +151,7 @@
"angular-sanitize": "^1.8.0",
"bluebird": "3.5.5",
"boom": "^7.2.0",
- "chalk": "^2.4.2",
+ "chalk": "^4.1.0",
"check-disk-space": "^2.1.0",
"chokidar": "^3.4.2",
"color": "1.0.3",
@@ -331,7 +331,7 @@
"@types/selenium-webdriver": "^4.0.9",
"@types/semver": "^5.5.0",
"@types/sinon": "^7.0.13",
- "@types/strip-ansi": "^3.0.0",
+ "@types/strip-ansi": "^5.2.1",
"@types/styled-components": "^5.1.0",
"@types/supertest": "^2.0.5",
"@types/supertest-as-promised": "^2.0.38",
@@ -343,7 +343,7 @@
"@types/uuid": "^3.4.4",
"@types/vinyl": "^2.0.4",
"@types/vinyl-fs": "^2.4.11",
- "@types/webpack": "^4.41.21",
+ "@types/webpack": "^4.41.3",
"@types/webpack-env": "^1.15.2",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^3.10.0",
@@ -470,10 +470,10 @@
"selenium-webdriver": "^4.0.0-alpha.7",
"simple-git": "1.116.0",
"sinon": "^7.4.2",
- "strip-ansi": "^3.0.1",
+ "strip-ansi": "^6.0.0",
"supertest": "^3.1.0",
"supertest-as-promised": "^4.0.2",
- "tape": "^4.13.0",
+ "tape": "^5.0.1",
"topojson-client": "3.0.0",
"tree-kill": "^1.2.2",
"typescript": "4.0.2",
diff --git a/packages/kbn-apm-config-loader/package.json b/packages/kbn-apm-config-loader/package.json
index 1982ccdeda0ff..c570fdc0218b9 100644
--- a/packages/kbn-apm-config-loader/package.json
+++ b/packages/kbn-apm-config-loader/package.json
@@ -18,6 +18,6 @@
},
"devDependencies": {
"typescript": "4.0.2",
- "tsd": "^0.7.4"
+ "tsd": "^0.13.1"
}
}
diff --git a/packages/kbn-es/package.json b/packages/kbn-es/package.json
index 40d34c5d710bb..c3733094350be 100644
--- a/packages/kbn-es/package.json
+++ b/packages/kbn-es/package.json
@@ -9,7 +9,7 @@
"kbn:watch": "node scripts/build --watch"
},
"dependencies": {
- "@elastic/elasticsearch": "7.9.0-rc.1",
+ "@elastic/elasticsearch": "7.9.1",
"@kbn/dev-utils": "1.0.0",
"abort-controller": "^3.0.0",
"chalk": "^4.1.0",
diff --git a/packages/kbn-plugin-helpers/package.json b/packages/kbn-plugin-helpers/package.json
index 65b44b6965048..a2c4e1e2134e7 100644
--- a/packages/kbn-plugin-helpers/package.json
+++ b/packages/kbn-plugin-helpers/package.json
@@ -18,7 +18,7 @@
"del": "^5.1.0",
"execa": "^4.0.2",
"gulp-zip": "^5.0.2",
- "inquirer": "^1.2.2",
+ "inquirer": "^7.3.3",
"load-json-file": "^6.2.0",
"vinyl-fs": "^3.0.3"
},
diff --git a/packages/kbn-pm/dist/index.js b/packages/kbn-pm/dist/index.js
index 7dcfc1d778ea8..2882a72b3ac9d 100644
--- a/packages/kbn-pm/dist/index.js
+++ b/packages/kbn-pm/dist/index.js
@@ -94,7 +94,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _cli__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "run", function() { return _cli__WEBPACK_IMPORTED_MODULE_0__["run"]; });
-/* harmony import */ var _production__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(496);
+/* harmony import */ var _production__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(500);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return _production__WEBPACK_IMPORTED_MODULE_1__["buildProductionProjects"]; });
/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(145);
@@ -103,10 +103,10 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _utils_project__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(163);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Project", function() { return _utils_project__WEBPACK_IMPORTED_MODULE_3__["Project"]; });
-/* harmony import */ var _utils_workspaces__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(275);
+/* harmony import */ var _utils_workspaces__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(270);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "copyWorkspacePackages", function() { return _utils_workspaces__WEBPACK_IMPORTED_MODULE_4__["copyWorkspacePackages"]; });
-/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(276);
+/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(271);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getProjectPaths", function() { return _config__WEBPACK_IMPORTED_MODULE_5__["getProjectPaths"]; });
/*
@@ -150,7 +150,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _kbn_dev_utils_tooling_log__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5);
/* harmony import */ var _kbn_dev_utils_tooling_log__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_kbn_dev_utils_tooling_log__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(127);
-/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(489);
+/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(493);
/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(143);
/*
* Licensed to Elasticsearch B.V. under one or more contributor
@@ -8763,9 +8763,9 @@ exports.ToolingLogCollectingWriter = ToolingLogCollectingWriter;
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "commands", function() { return commands; });
/* harmony import */ var _bootstrap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(128);
-/* harmony import */ var _clean__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(284);
-/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(388);
-/* harmony import */ var _watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(389);
+/* harmony import */ var _clean__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(279);
+/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(392);
+/* harmony import */ var _watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(393);
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
@@ -8806,10 +8806,10 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(143);
/* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(144);
/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(145);
-/* harmony import */ var _utils_project_checksums__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(277);
-/* harmony import */ var _utils_bootstrap_cache_file__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(282);
-/* harmony import */ var _utils_yarn_lock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(279);
-/* harmony import */ var _utils_validate_yarn_lock__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(283);
+/* harmony import */ var _utils_project_checksums__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(272);
+/* harmony import */ var _utils_bootstrap_cache_file__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(277);
+/* harmony import */ var _utils_yarn_lock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(274);
+/* harmony import */ var _utils_validate_yarn_lock__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(278);
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
@@ -10831,7 +10831,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(162);
/* harmony import */ var _project__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(163);
-/* harmony import */ var _workspaces__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(275);
+/* harmony import */ var _workspaces__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(270);
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
@@ -23648,11 +23648,11 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spawnStreaming", function() { return spawnStreaming; });
/* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(137);
/* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(stream__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(227);
+/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(112);
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(232);
+/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(227);
/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(execa__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var strong_log_transformer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(267);
+/* harmony import */ var strong_log_transformer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(262);
/* harmony import */ var strong_log_transformer__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(strong_log_transformer__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(143);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
@@ -23743,602 +23743,18 @@ function spawnStreaming(command, args, opts, {
"use strict";
-const ansiStyles = __webpack_require__(113);
-const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(228);
-const {
- stringReplaceAll,
- stringEncaseCRLFWithFirstIndex
-} = __webpack_require__(230);
-
-const {isArray} = Array;
-
-// `supportsColor.level` → `ansiStyles.color[name]` mapping
-const levelMapping = [
- 'ansi',
- 'ansi',
- 'ansi256',
- 'ansi16m'
-];
-
-const styles = Object.create(null);
-
-const applyOptions = (object, options = {}) => {
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
- throw new Error('The `level` option should be an integer from 0 to 3');
- }
-
- // Detect level if not set manually
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
- object.level = options.level === undefined ? colorLevel : options.level;
-};
-
-class ChalkClass {
- constructor(options) {
- // eslint-disable-next-line no-constructor-return
- return chalkFactory(options);
- }
-}
-
-const chalkFactory = options => {
- const chalk = {};
- applyOptions(chalk, options);
-
- chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
-
- Object.setPrototypeOf(chalk, Chalk.prototype);
- Object.setPrototypeOf(chalk.template, chalk);
-
- chalk.template.constructor = () => {
- throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
- };
-
- chalk.template.Instance = ChalkClass;
-
- return chalk.template;
-};
-
-function Chalk(options) {
- return chalkFactory(options);
-}
-
-for (const [styleName, style] of Object.entries(ansiStyles)) {
- styles[styleName] = {
- get() {
- const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
- Object.defineProperty(this, styleName, {value: builder});
- return builder;
- }
- };
-}
-
-styles.visible = {
- get() {
- const builder = createBuilder(this, this._styler, true);
- Object.defineProperty(this, 'visible', {value: builder});
- return builder;
- }
-};
-
-const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
-
-for (const model of usedModels) {
- styles[model] = {
- get() {
- const {level} = this;
- return function (...arguments_) {
- const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
- return createBuilder(this, styler, this._isEmpty);
- };
- }
- };
-}
-
-for (const model of usedModels) {
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
- styles[bgModel] = {
- get() {
- const {level} = this;
- return function (...arguments_) {
- const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
- return createBuilder(this, styler, this._isEmpty);
- };
- }
- };
-}
-
-const proto = Object.defineProperties(() => {}, {
- ...styles,
- level: {
- enumerable: true,
- get() {
- return this._generator.level;
- },
- set(level) {
- this._generator.level = level;
- }
- }
-});
-
-const createStyler = (open, close, parent) => {
- let openAll;
- let closeAll;
- if (parent === undefined) {
- openAll = open;
- closeAll = close;
- } else {
- openAll = parent.openAll + open;
- closeAll = close + parent.closeAll;
- }
-
- return {
- open,
- close,
- openAll,
- closeAll,
- parent
- };
-};
-
-const createBuilder = (self, _styler, _isEmpty) => {
- const builder = (...arguments_) => {
- if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
- // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
- return applyStyle(builder, chalkTag(builder, ...arguments_));
- }
-
- // Single argument is hot path, implicit coercion is faster than anything
- // eslint-disable-next-line no-implicit-coercion
- return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
- };
-
- // We alter the prototype because we must return a function, but there is
- // no way to create a function with a different prototype
- Object.setPrototypeOf(builder, proto);
-
- builder._generator = self;
- builder._styler = _styler;
- builder._isEmpty = _isEmpty;
-
- return builder;
-};
-
-const applyStyle = (self, string) => {
- if (self.level <= 0 || !string) {
- return self._isEmpty ? '' : string;
- }
-
- let styler = self._styler;
-
- if (styler === undefined) {
- return string;
- }
-
- const {openAll, closeAll} = styler;
- if (string.indexOf('\u001B') !== -1) {
- while (styler !== undefined) {
- // Replace any instances already present with a re-opening code
- // otherwise only the part of the string until said closing code
- // will be colored, and the rest will simply be 'plain'.
- string = stringReplaceAll(string, styler.close, styler.open);
-
- styler = styler.parent;
- }
- }
-
- // We can move both next actions out of loop, because remaining actions in loop won't have
- // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
- // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
- const lfIndex = string.indexOf('\n');
- if (lfIndex !== -1) {
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
- }
-
- return openAll + string + closeAll;
-};
-
-let template;
-const chalkTag = (chalk, ...strings) => {
- const [firstString] = strings;
-
- if (!isArray(firstString) || !isArray(firstString.raw)) {
- // If chalk() was called by itself or with a string,
- // return the string itself as a string.
- return strings.join(' ');
- }
-
- const arguments_ = strings.slice(1);
- const parts = [firstString.raw[0]];
-
- for (let i = 1; i < firstString.length; i++) {
- parts.push(
- String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
- String(firstString.raw[i])
- );
- }
-
- if (template === undefined) {
- template = __webpack_require__(231);
- }
-
- return template(chalk, parts.join(''));
-};
-
-Object.defineProperties(Chalk.prototype, styles);
-
-const chalk = Chalk(); // eslint-disable-line new-cap
-chalk.supportsColor = stdoutColor;
-chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
-chalk.stderr.supportsColor = stderrColor;
-
-module.exports = chalk;
-
-
-/***/ }),
-/* 228 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-const os = __webpack_require__(120);
-const tty = __webpack_require__(121);
-const hasFlag = __webpack_require__(229);
-
-const {env} = process;
-
-let forceColor;
-if (hasFlag('no-color') ||
- hasFlag('no-colors') ||
- hasFlag('color=false') ||
- hasFlag('color=never')) {
- forceColor = 0;
-} else if (hasFlag('color') ||
- hasFlag('colors') ||
- hasFlag('color=true') ||
- hasFlag('color=always')) {
- forceColor = 1;
-}
-
-if ('FORCE_COLOR' in env) {
- if (env.FORCE_COLOR === 'true') {
- forceColor = 1;
- } else if (env.FORCE_COLOR === 'false') {
- forceColor = 0;
- } else {
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
- }
-}
-
-function translateLevel(level) {
- if (level === 0) {
- return false;
- }
-
- return {
- level,
- hasBasic: true,
- has256: level >= 2,
- has16m: level >= 3
- };
-}
-
-function supportsColor(haveStream, streamIsTTY) {
- if (forceColor === 0) {
- return 0;
- }
-
- if (hasFlag('color=16m') ||
- hasFlag('color=full') ||
- hasFlag('color=truecolor')) {
- return 3;
- }
-
- if (hasFlag('color=256')) {
- return 2;
- }
-
- if (haveStream && !streamIsTTY && forceColor === undefined) {
- return 0;
- }
-
- const min = forceColor || 0;
-
- if (env.TERM === 'dumb') {
- return min;
- }
-
- if (process.platform === 'win32') {
- // Windows 10 build 10586 is the first Windows release that supports 256 colors.
- // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
- const osRelease = os.release().split('.');
- if (
- Number(osRelease[0]) >= 10 &&
- Number(osRelease[2]) >= 10586
- ) {
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
- }
-
- return 1;
- }
-
- if ('CI' in env) {
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
- return 1;
- }
-
- return min;
- }
-
- if ('TEAMCITY_VERSION' in env) {
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
- }
-
- if ('GITHUB_ACTIONS' in env) {
- return 1;
- }
-
- if (env.COLORTERM === 'truecolor') {
- return 3;
- }
-
- if ('TERM_PROGRAM' in env) {
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
-
- switch (env.TERM_PROGRAM) {
- case 'iTerm.app':
- return version >= 3 ? 3 : 2;
- case 'Apple_Terminal':
- return 2;
- // No default
- }
- }
-
- if (/-256(color)?$/i.test(env.TERM)) {
- return 2;
- }
-
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
- return 1;
- }
-
- if ('COLORTERM' in env) {
- return 1;
- }
-
- return min;
-}
-
-function getSupportLevel(stream) {
- const level = supportsColor(stream, stream && stream.isTTY);
- return translateLevel(level);
-}
-
-module.exports = {
- supportsColor: getSupportLevel,
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
-};
-
-
-/***/ }),
-/* 229 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-module.exports = (flag, argv = process.argv) => {
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
- const position = argv.indexOf(prefix + flag);
- const terminatorPosition = argv.indexOf('--');
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
-};
-
-
-/***/ }),
-/* 230 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-const stringReplaceAll = (string, substring, replacer) => {
- let index = string.indexOf(substring);
- if (index === -1) {
- return string;
- }
-
- const substringLength = substring.length;
- let endIndex = 0;
- let returnValue = '';
- do {
- returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
- endIndex = index + substringLength;
- index = string.indexOf(substring, endIndex);
- } while (index !== -1);
-
- returnValue += string.substr(endIndex);
- return returnValue;
-};
-
-const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
- let endIndex = 0;
- let returnValue = '';
- do {
- const gotCR = string[index - 1] === '\r';
- returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
- endIndex = index + 1;
- index = string.indexOf('\n', endIndex);
- } while (index !== -1);
-
- returnValue += string.substr(endIndex);
- return returnValue;
-};
-
-module.exports = {
- stringReplaceAll,
- stringEncaseCRLFWithFirstIndex
-};
-
-
-/***/ }),
-/* 231 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
-const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
-const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
-const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
-
-const ESCAPES = new Map([
- ['n', '\n'],
- ['r', '\r'],
- ['t', '\t'],
- ['b', '\b'],
- ['f', '\f'],
- ['v', '\v'],
- ['0', '\0'],
- ['\\', '\\'],
- ['e', '\u001B'],
- ['a', '\u0007']
-]);
-
-function unescape(c) {
- const u = c[0] === 'u';
- const bracket = c[1] === '{';
-
- if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
- return String.fromCharCode(parseInt(c.slice(1), 16));
- }
-
- if (u && bracket) {
- return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
- }
-
- return ESCAPES.get(c) || c;
-}
-
-function parseArguments(name, arguments_) {
- const results = [];
- const chunks = arguments_.trim().split(/\s*,\s*/g);
- let matches;
-
- for (const chunk of chunks) {
- const number = Number(chunk);
- if (!Number.isNaN(number)) {
- results.push(number);
- } else if ((matches = chunk.match(STRING_REGEX))) {
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
- } else {
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
- }
- }
-
- return results;
-}
-
-function parseStyle(style) {
- STYLE_REGEX.lastIndex = 0;
-
- const results = [];
- let matches;
-
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
- const name = matches[1];
-
- if (matches[2]) {
- const args = parseArguments(name, matches[2]);
- results.push([name].concat(args));
- } else {
- results.push([name]);
- }
- }
-
- return results;
-}
-
-function buildStyle(chalk, styles) {
- const enabled = {};
-
- for (const layer of styles) {
- for (const style of layer.styles) {
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
- }
- }
-
- let current = chalk;
- for (const [styleName, styles] of Object.entries(enabled)) {
- if (!Array.isArray(styles)) {
- continue;
- }
-
- if (!(styleName in current)) {
- throw new Error(`Unknown Chalk style: ${styleName}`);
- }
-
- current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
- }
-
- return current;
-}
-
-module.exports = (chalk, temporary) => {
- const styles = [];
- const chunks = [];
- let chunk = [];
-
- // eslint-disable-next-line max-params
- temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
- if (escapeCharacter) {
- chunk.push(unescape(escapeCharacter));
- } else if (style) {
- const string = chunk.join('');
- chunk = [];
- chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
- styles.push({inverse, styles: parseStyle(style)});
- } else if (close) {
- if (styles.length === 0) {
- throw new Error('Found extraneous } in Chalk template literal');
- }
-
- chunks.push(buildStyle(chalk, styles)(chunk.join('')));
- chunk = [];
- styles.pop();
- } else {
- chunk.push(character);
- }
- });
-
- chunks.push(chunk.join(''));
-
- if (styles.length > 0) {
- const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
- throw new Error(errMessage);
- }
-
- return chunks.join('');
-};
-
-
-/***/ }),
-/* 232 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
const path = __webpack_require__(4);
-const childProcess = __webpack_require__(233);
-const crossSpawn = __webpack_require__(234);
-const stripFinalNewline = __webpack_require__(247);
-const npmRunPath = __webpack_require__(248);
-const onetime = __webpack_require__(249);
-const makeError = __webpack_require__(251);
-const normalizeStdio = __webpack_require__(256);
-const {spawnedKill, spawnedCancel, setupTimeout, setExitHandler} = __webpack_require__(257);
-const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = __webpack_require__(258);
-const {mergePromise, getSpawnedPromise} = __webpack_require__(265);
-const {joinCommand, parseCommand} = __webpack_require__(266);
+const childProcess = __webpack_require__(228);
+const crossSpawn = __webpack_require__(229);
+const stripFinalNewline = __webpack_require__(242);
+const npmRunPath = __webpack_require__(243);
+const onetime = __webpack_require__(244);
+const makeError = __webpack_require__(246);
+const normalizeStdio = __webpack_require__(251);
+const {spawnedKill, spawnedCancel, setupTimeout, setExitHandler} = __webpack_require__(252);
+const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = __webpack_require__(253);
+const {mergePromise, getSpawnedPromise} = __webpack_require__(260);
+const {joinCommand, parseCommand} = __webpack_require__(261);
const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;
@@ -24585,21 +24001,21 @@ module.exports.node = (scriptPath, args, options = {}) => {
/***/ }),
-/* 233 */
+/* 228 */
/***/ (function(module, exports) {
module.exports = require("child_process");
/***/ }),
-/* 234 */
+/* 229 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const cp = __webpack_require__(233);
-const parse = __webpack_require__(235);
-const enoent = __webpack_require__(246);
+const cp = __webpack_require__(228);
+const parse = __webpack_require__(230);
+const enoent = __webpack_require__(241);
function spawn(command, args, options) {
// Parse the arguments
@@ -24637,16 +24053,16 @@ module.exports._enoent = enoent;
/***/ }),
-/* 235 */
+/* 230 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const path = __webpack_require__(4);
-const resolveCommand = __webpack_require__(236);
-const escape = __webpack_require__(242);
-const readShebang = __webpack_require__(243);
+const resolveCommand = __webpack_require__(231);
+const escape = __webpack_require__(237);
+const readShebang = __webpack_require__(238);
const isWin = process.platform === 'win32';
const isExecutableRegExp = /\.(?:com|exe)$/i;
@@ -24735,15 +24151,15 @@ module.exports = parse;
/***/ }),
-/* 236 */
+/* 231 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const path = __webpack_require__(4);
-const which = __webpack_require__(237);
-const pathKey = __webpack_require__(241)();
+const which = __webpack_require__(232);
+const pathKey = __webpack_require__(236)();
function resolveCommandAttempt(parsed, withoutPathExt) {
const cwd = process.cwd();
@@ -24793,7 +24209,7 @@ module.exports = resolveCommand;
/***/ }),
-/* 237 */
+/* 232 */
/***/ (function(module, exports, __webpack_require__) {
const isWindows = process.platform === 'win32' ||
@@ -24802,7 +24218,7 @@ const isWindows = process.platform === 'win32' ||
const path = __webpack_require__(4)
const COLON = isWindows ? ';' : ':'
-const isexe = __webpack_require__(238)
+const isexe = __webpack_require__(233)
const getNotFoundError = (cmd) =>
Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
@@ -24924,15 +24340,15 @@ which.sync = whichSync
/***/ }),
-/* 238 */
+/* 233 */
/***/ (function(module, exports, __webpack_require__) {
var fs = __webpack_require__(133)
var core
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
- core = __webpack_require__(239)
+ core = __webpack_require__(234)
} else {
- core = __webpack_require__(240)
+ core = __webpack_require__(235)
}
module.exports = isexe
@@ -24987,7 +24403,7 @@ function sync (path, options) {
/***/ }),
-/* 239 */
+/* 234 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = isexe
@@ -25035,7 +24451,7 @@ function sync (path, options) {
/***/ }),
-/* 240 */
+/* 235 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = isexe
@@ -25082,7 +24498,7 @@ function checkMode (stat, options) {
/***/ }),
-/* 241 */
+/* 236 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -25105,7 +24521,7 @@ module.exports.default = pathKey;
/***/ }),
-/* 242 */
+/* 237 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -25157,14 +24573,14 @@ module.exports.argument = escapeArgument;
/***/ }),
-/* 243 */
+/* 238 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const fs = __webpack_require__(133);
-const shebangCommand = __webpack_require__(244);
+const shebangCommand = __webpack_require__(239);
function readShebang(command) {
// Read the first 150 bytes from the file
@@ -25187,12 +24603,12 @@ module.exports = readShebang;
/***/ }),
-/* 244 */
+/* 239 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const shebangRegex = __webpack_require__(245);
+const shebangRegex = __webpack_require__(240);
module.exports = (string = '') => {
const match = string.match(shebangRegex);
@@ -25213,7 +24629,7 @@ module.exports = (string = '') => {
/***/ }),
-/* 245 */
+/* 240 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -25222,7 +24638,7 @@ module.exports = /^#!(.*)/;
/***/ }),
-/* 246 */
+/* 241 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -25288,7 +24704,7 @@ module.exports = {
/***/ }),
-/* 247 */
+/* 242 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -25311,13 +24727,13 @@ module.exports = input => {
/***/ }),
-/* 248 */
+/* 243 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const path = __webpack_require__(4);
-const pathKey = __webpack_require__(241);
+const pathKey = __webpack_require__(236);
const npmRunPath = options => {
options = {
@@ -25365,12 +24781,12 @@ module.exports.env = options => {
/***/ }),
-/* 249 */
+/* 244 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const mimicFn = __webpack_require__(250);
+const mimicFn = __webpack_require__(245);
const calledFunctions = new WeakMap();
@@ -25422,7 +24838,7 @@ module.exports.callCount = fn => {
/***/ }),
-/* 250 */
+/* 245 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -25442,12 +24858,12 @@ module.exports.default = mimicFn;
/***/ }),
-/* 251 */
+/* 246 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const {signalsByName} = __webpack_require__(252);
+const {signalsByName} = __webpack_require__(247);
const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => {
if (timedOut) {
@@ -25535,14 +24951,14 @@ module.exports = makeError;
/***/ }),
-/* 252 */
+/* 247 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports,"__esModule",{value:true});exports.signalsByNumber=exports.signalsByName=void 0;var _os=__webpack_require__(120);
-var _signals=__webpack_require__(253);
-var _realtime=__webpack_require__(255);
+var _signals=__webpack_require__(248);
+var _realtime=__webpack_require__(250);
@@ -25612,14 +25028,14 @@ const signalsByNumber=getSignalsByNumber();exports.signalsByNumber=signalsByNumb
//# sourceMappingURL=main.js.map
/***/ }),
-/* 253 */
+/* 248 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports,"__esModule",{value:true});exports.getSignals=void 0;var _os=__webpack_require__(120);
-var _core=__webpack_require__(254);
-var _realtime=__webpack_require__(255);
+var _core=__webpack_require__(249);
+var _realtime=__webpack_require__(250);
@@ -25653,7 +25069,7 @@ return{name,number,description,supported,action,forced,standard};
//# sourceMappingURL=signals.js.map
/***/ }),
-/* 254 */
+/* 249 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -25932,7 +25348,7 @@ standard:"other"}];exports.SIGNALS=SIGNALS;
//# sourceMappingURL=core.js.map
/***/ }),
-/* 255 */
+/* 250 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -25957,7 +25373,7 @@ const SIGRTMAX=64;exports.SIGRTMAX=SIGRTMAX;
//# sourceMappingURL=realtime.js.map
/***/ }),
-/* 256 */
+/* 251 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -26016,7 +25432,7 @@ module.exports.node = opts => {
/***/ }),
-/* 257 */
+/* 252 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -26135,14 +25551,14 @@ module.exports = {
/***/ }),
-/* 258 */
+/* 253 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const isStream = __webpack_require__(259);
-const getStream = __webpack_require__(260);
-const mergeStream = __webpack_require__(264);
+const isStream = __webpack_require__(254);
+const getStream = __webpack_require__(255);
+const mergeStream = __webpack_require__(259);
// `input` option
const handleInput = (spawned, input) => {
@@ -26239,7 +25655,7 @@ module.exports = {
/***/ }),
-/* 259 */
+/* 254 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -26275,13 +25691,13 @@ module.exports = isStream;
/***/ }),
-/* 260 */
+/* 255 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const pump = __webpack_require__(261);
-const bufferStream = __webpack_require__(263);
+const pump = __webpack_require__(256);
+const bufferStream = __webpack_require__(258);
class MaxBufferError extends Error {
constructor() {
@@ -26340,11 +25756,11 @@ module.exports.MaxBufferError = MaxBufferError;
/***/ }),
-/* 261 */
+/* 256 */
/***/ (function(module, exports, __webpack_require__) {
var once = __webpack_require__(161)
-var eos = __webpack_require__(262)
+var eos = __webpack_require__(257)
var fs = __webpack_require__(133) // we only need fs to get the ReadStream and WriteStream prototypes
var noop = function () {}
@@ -26428,7 +25844,7 @@ module.exports = pump
/***/ }),
-/* 262 */
+/* 257 */
/***/ (function(module, exports, __webpack_require__) {
var once = __webpack_require__(161);
@@ -26528,7 +25944,7 @@ module.exports = eos;
/***/ }),
-/* 263 */
+/* 258 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -26587,7 +26003,7 @@ module.exports = options => {
/***/ }),
-/* 264 */
+/* 259 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -26635,7 +26051,7 @@ module.exports = function (/*streams...*/) {
/***/ }),
-/* 265 */
+/* 260 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -26688,7 +26104,7 @@ module.exports = {
/***/ }),
-/* 266 */
+/* 261 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -26733,7 +26149,7 @@ module.exports = {
/***/ }),
-/* 267 */
+/* 262 */
/***/ (function(module, exports, __webpack_require__) {
// Copyright IBM Corp. 2014,2018. All Rights Reserved.
@@ -26741,12 +26157,12 @@ module.exports = {
// This file is licensed under the Apache License 2.0.
// License text available at https://opensource.org/licenses/Apache-2.0
-module.exports = __webpack_require__(268);
-module.exports.cli = __webpack_require__(272);
+module.exports = __webpack_require__(263);
+module.exports.cli = __webpack_require__(267);
/***/ }),
-/* 268 */
+/* 263 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -26761,9 +26177,9 @@ var stream = __webpack_require__(137);
var util = __webpack_require__(111);
var fs = __webpack_require__(133);
-var through = __webpack_require__(269);
-var duplexer = __webpack_require__(270);
-var StringDecoder = __webpack_require__(271).StringDecoder;
+var through = __webpack_require__(264);
+var duplexer = __webpack_require__(265);
+var StringDecoder = __webpack_require__(266).StringDecoder;
module.exports = Logger;
@@ -26952,7 +26368,7 @@ function lineMerger(host) {
/***/ }),
-/* 269 */
+/* 264 */
/***/ (function(module, exports, __webpack_require__) {
var Stream = __webpack_require__(137)
@@ -27066,7 +26482,7 @@ function through (write, end, opts) {
/***/ }),
-/* 270 */
+/* 265 */
/***/ (function(module, exports, __webpack_require__) {
var Stream = __webpack_require__(137)
@@ -27159,13 +26575,13 @@ function duplex(writer, reader) {
/***/ }),
-/* 271 */
+/* 266 */
/***/ (function(module, exports) {
module.exports = require("string_decoder");
/***/ }),
-/* 272 */
+/* 267 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -27176,11 +26592,11 @@ module.exports = require("string_decoder");
-var minimist = __webpack_require__(273);
+var minimist = __webpack_require__(268);
var path = __webpack_require__(4);
-var Logger = __webpack_require__(268);
-var pkg = __webpack_require__(274);
+var Logger = __webpack_require__(263);
+var pkg = __webpack_require__(269);
module.exports = cli;
@@ -27234,7 +26650,7 @@ function usage($0, p) {
/***/ }),
-/* 273 */
+/* 268 */
/***/ (function(module, exports) {
module.exports = function (args, opts) {
@@ -27485,13 +26901,13 @@ function isNumber (x) {
/***/ }),
-/* 274 */
+/* 269 */
/***/ (function(module) {
module.exports = JSON.parse("{\"name\":\"strong-log-transformer\",\"version\":\"2.1.0\",\"description\":\"Stream transformer that prefixes lines with timestamps and other things.\",\"author\":\"Ryan Graham \",\"license\":\"Apache-2.0\",\"repository\":{\"type\":\"git\",\"url\":\"git://github.com/strongloop/strong-log-transformer\"},\"keywords\":[\"logging\",\"streams\"],\"bugs\":{\"url\":\"https://github.com/strongloop/strong-log-transformer/issues\"},\"homepage\":\"https://github.com/strongloop/strong-log-transformer\",\"directories\":{\"test\":\"test\"},\"bin\":{\"sl-log-transformer\":\"bin/sl-log-transformer.js\"},\"main\":\"index.js\",\"scripts\":{\"test\":\"tap --100 test/test-*\"},\"dependencies\":{\"duplexer\":\"^0.1.1\",\"minimist\":\"^1.2.0\",\"through\":\"^2.3.4\"},\"devDependencies\":{\"tap\":\"^12.0.1\"},\"engines\":{\"node\":\">=4\"}}");
/***/ }),
-/* 275 */
+/* 270 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -27504,7 +26920,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(111);
/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(276);
+/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(271);
/* harmony import */ var _fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(130);
/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(164);
/* harmony import */ var _projects__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(145);
@@ -27599,7 +27015,7 @@ function packagesFromGlobPattern({
}
/***/ }),
-/* 276 */
+/* 271 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -27669,7 +27085,7 @@ function getProjectPaths({
}
/***/ }),
-/* 277 */
+/* 272 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -27677,13 +27093,13 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAllChecksums", function() { return getAllChecksums; });
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(133);
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(278);
+/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(273);
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(111);
/* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(232);
+/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(227);
/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(execa__WEBPACK_IMPORTED_MODULE_3__);
-/* harmony import */ var _yarn_lock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(279);
+/* harmony import */ var _yarn_lock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(274);
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
@@ -27882,20 +27298,20 @@ async function getAllChecksums(kbn, log, yarnLock) {
}
/***/ }),
-/* 278 */
+/* 273 */
/***/ (function(module, exports) {
module.exports = require("crypto");
/***/ }),
-/* 279 */
+/* 274 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readYarnLock", function() { return readYarnLock; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resolveDepsForProject", function() { return resolveDepsForProject; });
-/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(280);
+/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(275);
/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(130);
/*
@@ -28008,7 +27424,7 @@ function resolveDepsForProject({
}
/***/ }),
-/* 280 */
+/* 275 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
@@ -29567,7 +28983,7 @@ module.exports = invariant;
/* 9 */
/***/ (function(module, exports) {
-module.exports = __webpack_require__(278);
+module.exports = __webpack_require__(273);
/***/ }),
/* 10 */,
@@ -31891,7 +31307,7 @@ function onceStrict (fn) {
/* 63 */
/***/ (function(module, exports) {
-module.exports = __webpack_require__(281);
+module.exports = __webpack_require__(276);
/***/ }),
/* 64 */,
@@ -38286,13 +37702,13 @@ module.exports = process && support(supportLevel);
/******/ ]);
/***/ }),
-/* 281 */
+/* 276 */
/***/ (function(module, exports) {
module.exports = require("buffer");
/***/ }),
-/* 282 */
+/* 277 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -38389,13 +37805,13 @@ class BootstrapCacheFile {
}
/***/ }),
-/* 283 */
+/* 278 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validateYarnLock", function() { return validateYarnLock; });
-/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(280);
+/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(275);
/* harmony import */ var _yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_yarnpkg_lockfile__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var dedent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
/* harmony import */ var dedent__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dedent__WEBPACK_IMPORTED_MODULE_1__);
@@ -38490,21 +37906,73 @@ async function validateYarnLock(kbn, yarnLock) {
`);
process.exit(1);
+ } // TODO: remove this once we move into a single package.json
+ // look through all the package.json files to find packages which have mismatched version ranges
+
+
+ const depRanges = new Map();
+
+ for (const project of kbn.getAllProjects().values()) {
+ for (const [dep, range] of Object.entries(project.allDependencies)) {
+ const existingDep = depRanges.get(dep);
+
+ if (!existingDep) {
+ depRanges.set(dep, [{
+ range,
+ projects: [project]
+ }]);
+ continue;
+ }
+
+ const existingRange = existingDep.find(existing => existing.range === range);
+
+ if (!existingRange) {
+ existingDep.push({
+ range,
+ projects: [project]
+ });
+ continue;
+ }
+
+ existingRange.projects.push(project);
+ }
+ }
+
+ const duplicateRanges = Array.from(depRanges.entries()).filter(([, ranges]) => ranges.length > 1).reduce((acc, [dep, ranges]) => [...acc, dep, ...ranges.map(({
+ range,
+ projects
+ }) => ` ${range} => ${projects.map(p => p.name).join(', ')}`)], []).join('\n ');
+
+ if (duplicateRanges) {
+ _log__WEBPACK_IMPORTED_MODULE_3__["log"].error(dedent__WEBPACK_IMPORTED_MODULE_1___default.a`
+
+ [single_version_dependencies] Multiple version ranges for the same dependency
+ were found declared across different package.json files. Please consolidate
+ those to match across all package.json files. Different versions for the
+ same dependency is not supported.
+
+ If you have questions about this please reach out to the operations team.
+
+ The conflicting dependencies are:
+
+ ${duplicateRanges}
+ `);
+ process.exit(1);
}
_log__WEBPACK_IMPORTED_MODULE_3__["log"].success('yarn.lock analysis completed without any issues');
}
/***/ }),
-/* 284 */
+/* 279 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CleanCommand", function() { return CleanCommand; });
-/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(285);
+/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(280);
/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(372);
+/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(367);
/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(ora__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
@@ -38604,21 +38072,21 @@ const CleanCommand = {
};
/***/ }),
-/* 285 */
+/* 280 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const {promisify} = __webpack_require__(111);
const path = __webpack_require__(4);
-const globby = __webpack_require__(286);
-const isGlob = __webpack_require__(364);
-const slash = __webpack_require__(362);
+const globby = __webpack_require__(281);
+const isGlob = __webpack_require__(359);
+const slash = __webpack_require__(357);
const gracefulFs = __webpack_require__(132);
-const isPathCwd = __webpack_require__(365);
-const isPathInside = __webpack_require__(366);
-const rimraf = __webpack_require__(367);
-const pMap = __webpack_require__(368);
+const isPathCwd = __webpack_require__(360);
+const isPathInside = __webpack_require__(361);
+const rimraf = __webpack_require__(362);
+const pMap = __webpack_require__(363);
const rimrafP = promisify(rimraf);
@@ -38732,19 +38200,19 @@ module.exports.sync = (patterns, {force, dryRun, cwd = process.cwd(), ...options
/***/ }),
-/* 286 */
+/* 281 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const fs = __webpack_require__(133);
-const arrayUnion = __webpack_require__(287);
-const merge2 = __webpack_require__(288);
+const arrayUnion = __webpack_require__(282);
+const merge2 = __webpack_require__(283);
const glob = __webpack_require__(146);
-const fastGlob = __webpack_require__(289);
-const dirGlob = __webpack_require__(358);
-const gitignore = __webpack_require__(360);
-const {FilterStream, UniqueStream} = __webpack_require__(363);
+const fastGlob = __webpack_require__(284);
+const dirGlob = __webpack_require__(353);
+const gitignore = __webpack_require__(355);
+const {FilterStream, UniqueStream} = __webpack_require__(358);
const DEFAULT_FILTER = () => false;
@@ -38917,7 +38385,7 @@ module.exports.gitignore = gitignore;
/***/ }),
-/* 287 */
+/* 282 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -38929,7 +38397,7 @@ module.exports = (...arguments_) => {
/***/ }),
-/* 288 */
+/* 283 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -39080,17 +38548,17 @@ function pauseStreams (streams, options) {
/***/ }),
-/* 289 */
+/* 284 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const taskManager = __webpack_require__(290);
-const async_1 = __webpack_require__(319);
-const stream_1 = __webpack_require__(354);
-const sync_1 = __webpack_require__(355);
-const settings_1 = __webpack_require__(357);
-const utils = __webpack_require__(291);
+const taskManager = __webpack_require__(285);
+const async_1 = __webpack_require__(314);
+const stream_1 = __webpack_require__(349);
+const sync_1 = __webpack_require__(350);
+const settings_1 = __webpack_require__(352);
+const utils = __webpack_require__(286);
async function FastGlob(source, options) {
assertPatternsInput(source);
const works = getWorks(source, async_1.default, options);
@@ -39154,13 +38622,13 @@ module.exports = FastGlob;
/***/ }),
-/* 290 */
+/* 285 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const utils = __webpack_require__(291);
+const utils = __webpack_require__(286);
function generate(patterns, settings) {
const positivePatterns = getPositivePatterns(patterns);
const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
@@ -39225,30 +38693,30 @@ exports.convertPatternGroupToTask = convertPatternGroupToTask;
/***/ }),
-/* 291 */
+/* 286 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const array = __webpack_require__(292);
+const array = __webpack_require__(287);
exports.array = array;
-const errno = __webpack_require__(293);
+const errno = __webpack_require__(288);
exports.errno = errno;
-const fs = __webpack_require__(294);
+const fs = __webpack_require__(289);
exports.fs = fs;
-const path = __webpack_require__(295);
+const path = __webpack_require__(290);
exports.path = path;
-const pattern = __webpack_require__(296);
+const pattern = __webpack_require__(291);
exports.pattern = pattern;
-const stream = __webpack_require__(317);
+const stream = __webpack_require__(312);
exports.stream = stream;
-const string = __webpack_require__(318);
+const string = __webpack_require__(313);
exports.string = string;
/***/ }),
-/* 292 */
+/* 287 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -39276,7 +38744,7 @@ exports.splitWhen = splitWhen;
/***/ }),
-/* 293 */
+/* 288 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -39289,7 +38757,7 @@ exports.isEnoentCodeError = isEnoentCodeError;
/***/ }),
-/* 294 */
+/* 289 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -39314,7 +38782,7 @@ exports.createDirentFromStats = createDirentFromStats;
/***/ }),
-/* 295 */
+/* 290 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -39353,16 +38821,16 @@ exports.removeLeadingDotSegment = removeLeadingDotSegment;
/***/ }),
-/* 296 */
+/* 291 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = __webpack_require__(4);
-const globParent = __webpack_require__(297);
-const micromatch = __webpack_require__(300);
-const picomatch = __webpack_require__(311);
+const globParent = __webpack_require__(292);
+const micromatch = __webpack_require__(295);
+const picomatch = __webpack_require__(306);
const GLOBSTAR = '**';
const ESCAPE_SYMBOL = '\\';
const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
@@ -39472,13 +38940,13 @@ exports.matchAny = matchAny;
/***/ }),
-/* 297 */
+/* 292 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var isGlob = __webpack_require__(298);
+var isGlob = __webpack_require__(293);
var pathPosixDirname = __webpack_require__(4).posix.dirname;
var isWin32 = __webpack_require__(120).platform() === 'win32';
@@ -39520,7 +38988,7 @@ module.exports = function globParent(str, opts) {
/***/ }),
-/* 298 */
+/* 293 */
/***/ (function(module, exports, __webpack_require__) {
/*!
@@ -39530,7 +38998,7 @@ module.exports = function globParent(str, opts) {
* Released under the MIT License.
*/
-var isExtglob = __webpack_require__(299);
+var isExtglob = __webpack_require__(294);
var chars = { '{': '}', '(': ')', '[': ']'};
var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/;
@@ -39574,7 +39042,7 @@ module.exports = function isGlob(str, options) {
/***/ }),
-/* 299 */
+/* 294 */
/***/ (function(module, exports) {
/*!
@@ -39600,16 +39068,16 @@ module.exports = function isExtglob(str) {
/***/ }),
-/* 300 */
+/* 295 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const util = __webpack_require__(111);
-const braces = __webpack_require__(301);
-const picomatch = __webpack_require__(311);
-const utils = __webpack_require__(314);
+const braces = __webpack_require__(296);
+const picomatch = __webpack_require__(306);
+const utils = __webpack_require__(309);
const isEmptyString = val => typeof val === 'string' && (val === '' || val === './');
/**
@@ -40074,16 +39542,16 @@ module.exports = micromatch;
/***/ }),
-/* 301 */
+/* 296 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const stringify = __webpack_require__(302);
-const compile = __webpack_require__(304);
-const expand = __webpack_require__(308);
-const parse = __webpack_require__(309);
+const stringify = __webpack_require__(297);
+const compile = __webpack_require__(299);
+const expand = __webpack_require__(303);
+const parse = __webpack_require__(304);
/**
* Expand the given pattern or create a regex-compatible string.
@@ -40251,13 +39719,13 @@ module.exports = braces;
/***/ }),
-/* 302 */
+/* 297 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const utils = __webpack_require__(303);
+const utils = __webpack_require__(298);
module.exports = (ast, options = {}) => {
let stringify = (node, parent = {}) => {
@@ -40290,7 +39758,7 @@ module.exports = (ast, options = {}) => {
/***/ }),
-/* 303 */
+/* 298 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -40409,14 +39877,14 @@ exports.flatten = (...args) => {
/***/ }),
-/* 304 */
+/* 299 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const fill = __webpack_require__(305);
-const utils = __webpack_require__(303);
+const fill = __webpack_require__(300);
+const utils = __webpack_require__(298);
const compile = (ast, options = {}) => {
let walk = (node, parent = {}) => {
@@ -40473,7 +39941,7 @@ module.exports = compile;
/***/ }),
-/* 305 */
+/* 300 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -40487,7 +39955,7 @@ module.exports = compile;
const util = __webpack_require__(111);
-const toRegexRange = __webpack_require__(306);
+const toRegexRange = __webpack_require__(301);
const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
@@ -40729,7 +40197,7 @@ module.exports = fill;
/***/ }),
-/* 306 */
+/* 301 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -40742,7 +40210,7 @@ module.exports = fill;
-const isNumber = __webpack_require__(307);
+const isNumber = __webpack_require__(302);
const toRegexRange = (min, max, options) => {
if (isNumber(min) === false) {
@@ -41024,7 +40492,7 @@ module.exports = toRegexRange;
/***/ }),
-/* 307 */
+/* 302 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -41049,15 +40517,15 @@ module.exports = function(num) {
/***/ }),
-/* 308 */
+/* 303 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const fill = __webpack_require__(305);
-const stringify = __webpack_require__(302);
-const utils = __webpack_require__(303);
+const fill = __webpack_require__(300);
+const stringify = __webpack_require__(297);
+const utils = __webpack_require__(298);
const append = (queue = '', stash = '', enclose = false) => {
let result = [];
@@ -41169,13 +40637,13 @@ module.exports = expand;
/***/ }),
-/* 309 */
+/* 304 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const stringify = __webpack_require__(302);
+const stringify = __webpack_require__(297);
/**
* Constants
@@ -41197,7 +40665,7 @@ const {
CHAR_SINGLE_QUOTE, /* ' */
CHAR_NO_BREAK_SPACE,
CHAR_ZERO_WIDTH_NOBREAK_SPACE
-} = __webpack_require__(310);
+} = __webpack_require__(305);
/**
* parse
@@ -41509,7 +40977,7 @@ module.exports = parse;
/***/ }),
-/* 310 */
+/* 305 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -41573,27 +41041,27 @@ module.exports = {
/***/ }),
-/* 311 */
+/* 306 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-module.exports = __webpack_require__(312);
+module.exports = __webpack_require__(307);
/***/ }),
-/* 312 */
+/* 307 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const path = __webpack_require__(4);
-const scan = __webpack_require__(313);
-const parse = __webpack_require__(316);
-const utils = __webpack_require__(314);
-const constants = __webpack_require__(315);
+const scan = __webpack_require__(308);
+const parse = __webpack_require__(311);
+const utils = __webpack_require__(309);
+const constants = __webpack_require__(310);
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
/**
@@ -41929,13 +41397,13 @@ module.exports = picomatch;
/***/ }),
-/* 313 */
+/* 308 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const utils = __webpack_require__(314);
+const utils = __webpack_require__(309);
const {
CHAR_ASTERISK, /* * */
CHAR_AT, /* @ */
@@ -41952,7 +41420,7 @@ const {
CHAR_RIGHT_CURLY_BRACE, /* } */
CHAR_RIGHT_PARENTHESES, /* ) */
CHAR_RIGHT_SQUARE_BRACKET /* ] */
-} = __webpack_require__(315);
+} = __webpack_require__(310);
const isPathSeparator = code => {
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
@@ -42319,7 +41787,7 @@ module.exports = scan;
/***/ }),
-/* 314 */
+/* 309 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -42332,7 +41800,7 @@ const {
REGEX_REMOVE_BACKSLASH,
REGEX_SPECIAL_CHARS,
REGEX_SPECIAL_CHARS_GLOBAL
-} = __webpack_require__(315);
+} = __webpack_require__(310);
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
@@ -42390,7 +41858,7 @@ exports.wrapOutput = (input, state = {}, options = {}) => {
/***/ }),
-/* 315 */
+/* 310 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -42576,14 +42044,14 @@ module.exports = {
/***/ }),
-/* 316 */
+/* 311 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const constants = __webpack_require__(315);
-const utils = __webpack_require__(314);
+const constants = __webpack_require__(310);
+const utils = __webpack_require__(309);
/**
* Constants
@@ -43661,13 +43129,13 @@ module.exports = parse;
/***/ }),
-/* 317 */
+/* 312 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const merge2 = __webpack_require__(288);
+const merge2 = __webpack_require__(283);
function merge(streams) {
const mergedStream = merge2(streams);
streams.forEach((stream) => {
@@ -43684,7 +43152,7 @@ function propagateCloseEventToSources(streams) {
/***/ }),
-/* 318 */
+/* 313 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -43701,14 +43169,14 @@ exports.isEmpty = isEmpty;
/***/ }),
-/* 319 */
+/* 314 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const stream_1 = __webpack_require__(320);
-const provider_1 = __webpack_require__(347);
+const stream_1 = __webpack_require__(315);
+const provider_1 = __webpack_require__(342);
class ProviderAsync extends provider_1.default {
constructor() {
super(...arguments);
@@ -43736,16 +43204,16 @@ exports.default = ProviderAsync;
/***/ }),
-/* 320 */
+/* 315 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const stream_1 = __webpack_require__(137);
-const fsStat = __webpack_require__(321);
-const fsWalk = __webpack_require__(326);
-const reader_1 = __webpack_require__(346);
+const fsStat = __webpack_require__(316);
+const fsWalk = __webpack_require__(321);
+const reader_1 = __webpack_require__(341);
class ReaderStream extends reader_1.default {
constructor() {
super(...arguments);
@@ -43798,15 +43266,15 @@ exports.default = ReaderStream;
/***/ }),
-/* 321 */
+/* 316 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const async = __webpack_require__(322);
-const sync = __webpack_require__(323);
-const settings_1 = __webpack_require__(324);
+const async = __webpack_require__(317);
+const sync = __webpack_require__(318);
+const settings_1 = __webpack_require__(319);
exports.Settings = settings_1.default;
function stat(path, optionsOrSettingsOrCallback, callback) {
if (typeof optionsOrSettingsOrCallback === 'function') {
@@ -43829,7 +43297,7 @@ function getSettings(settingsOrOptions = {}) {
/***/ }),
-/* 322 */
+/* 317 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -43867,7 +43335,7 @@ function callSuccessCallback(callback, result) {
/***/ }),
-/* 323 */
+/* 318 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -43896,13 +43364,13 @@ exports.read = read;
/***/ }),
-/* 324 */
+/* 319 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const fs = __webpack_require__(325);
+const fs = __webpack_require__(320);
class Settings {
constructor(_options = {}) {
this._options = _options;
@@ -43919,7 +43387,7 @@ exports.default = Settings;
/***/ }),
-/* 325 */
+/* 320 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -43942,16 +43410,16 @@ exports.createFileSystemAdapter = createFileSystemAdapter;
/***/ }),
-/* 326 */
+/* 321 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const async_1 = __webpack_require__(327);
-const stream_1 = __webpack_require__(342);
-const sync_1 = __webpack_require__(343);
-const settings_1 = __webpack_require__(345);
+const async_1 = __webpack_require__(322);
+const stream_1 = __webpack_require__(337);
+const sync_1 = __webpack_require__(338);
+const settings_1 = __webpack_require__(340);
exports.Settings = settings_1.default;
function walk(directory, optionsOrSettingsOrCallback, callback) {
if (typeof optionsOrSettingsOrCallback === 'function') {
@@ -43981,13 +43449,13 @@ function getSettings(settingsOrOptions = {}) {
/***/ }),
-/* 327 */
+/* 322 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const async_1 = __webpack_require__(328);
+const async_1 = __webpack_require__(323);
class AsyncProvider {
constructor(_root, _settings) {
this._root = _root;
@@ -44018,17 +43486,17 @@ function callSuccessCallback(callback, entries) {
/***/ }),
-/* 328 */
+/* 323 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const events_1 = __webpack_require__(155);
-const fsScandir = __webpack_require__(329);
-const fastq = __webpack_require__(338);
-const common = __webpack_require__(340);
-const reader_1 = __webpack_require__(341);
+const fsScandir = __webpack_require__(324);
+const fastq = __webpack_require__(333);
+const common = __webpack_require__(335);
+const reader_1 = __webpack_require__(336);
class AsyncReader extends reader_1.default {
constructor(_root, _settings) {
super(_root, _settings);
@@ -44118,15 +43586,15 @@ exports.default = AsyncReader;
/***/ }),
-/* 329 */
+/* 324 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const async = __webpack_require__(330);
-const sync = __webpack_require__(335);
-const settings_1 = __webpack_require__(336);
+const async = __webpack_require__(325);
+const sync = __webpack_require__(330);
+const settings_1 = __webpack_require__(331);
exports.Settings = settings_1.default;
function scandir(path, optionsOrSettingsOrCallback, callback) {
if (typeof optionsOrSettingsOrCallback === 'function') {
@@ -44149,16 +43617,16 @@ function getSettings(settingsOrOptions = {}) {
/***/ }),
-/* 330 */
+/* 325 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const fsStat = __webpack_require__(321);
-const rpl = __webpack_require__(331);
-const constants_1 = __webpack_require__(332);
-const utils = __webpack_require__(333);
+const fsStat = __webpack_require__(316);
+const rpl = __webpack_require__(326);
+const constants_1 = __webpack_require__(327);
+const utils = __webpack_require__(328);
function read(directory, settings, callback) {
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
return readdirWithFileTypes(directory, settings, callback);
@@ -44246,7 +43714,7 @@ function callSuccessCallback(callback, result) {
/***/ }),
-/* 331 */
+/* 326 */
/***/ (function(module, exports) {
module.exports = runParallel
@@ -44300,7 +43768,7 @@ function runParallel (tasks, cb) {
/***/ }),
-/* 332 */
+/* 327 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -44320,18 +43788,18 @@ exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_B
/***/ }),
-/* 333 */
+/* 328 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const fs = __webpack_require__(334);
+const fs = __webpack_require__(329);
exports.fs = fs;
/***/ }),
-/* 334 */
+/* 329 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -44356,15 +43824,15 @@ exports.createDirentFromStats = createDirentFromStats;
/***/ }),
-/* 335 */
+/* 330 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const fsStat = __webpack_require__(321);
-const constants_1 = __webpack_require__(332);
-const utils = __webpack_require__(333);
+const fsStat = __webpack_require__(316);
+const constants_1 = __webpack_require__(327);
+const utils = __webpack_require__(328);
function read(directory, settings) {
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
return readdirWithFileTypes(directory, settings);
@@ -44415,15 +43883,15 @@ exports.readdir = readdir;
/***/ }),
-/* 336 */
+/* 331 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = __webpack_require__(4);
-const fsStat = __webpack_require__(321);
-const fs = __webpack_require__(337);
+const fsStat = __webpack_require__(316);
+const fs = __webpack_require__(332);
class Settings {
constructor(_options = {}) {
this._options = _options;
@@ -44446,7 +43914,7 @@ exports.default = Settings;
/***/ }),
-/* 337 */
+/* 332 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -44471,13 +43939,13 @@ exports.createFileSystemAdapter = createFileSystemAdapter;
/***/ }),
-/* 338 */
+/* 333 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var reusify = __webpack_require__(339)
+var reusify = __webpack_require__(334)
function fastqueue (context, worker, concurrency) {
if (typeof context === 'function') {
@@ -44651,7 +44119,7 @@ module.exports = fastqueue
/***/ }),
-/* 339 */
+/* 334 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -44691,7 +44159,7 @@ module.exports = reusify
/***/ }),
-/* 340 */
+/* 335 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -44722,13 +44190,13 @@ exports.joinPathSegments = joinPathSegments;
/***/ }),
-/* 341 */
+/* 336 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const common = __webpack_require__(340);
+const common = __webpack_require__(335);
class Reader {
constructor(_root, _settings) {
this._root = _root;
@@ -44740,14 +44208,14 @@ exports.default = Reader;
/***/ }),
-/* 342 */
+/* 337 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const stream_1 = __webpack_require__(137);
-const async_1 = __webpack_require__(328);
+const async_1 = __webpack_require__(323);
class StreamProvider {
constructor(_root, _settings) {
this._root = _root;
@@ -44777,13 +44245,13 @@ exports.default = StreamProvider;
/***/ }),
-/* 343 */
+/* 338 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const sync_1 = __webpack_require__(344);
+const sync_1 = __webpack_require__(339);
class SyncProvider {
constructor(_root, _settings) {
this._root = _root;
@@ -44798,15 +44266,15 @@ exports.default = SyncProvider;
/***/ }),
-/* 344 */
+/* 339 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const fsScandir = __webpack_require__(329);
-const common = __webpack_require__(340);
-const reader_1 = __webpack_require__(341);
+const fsScandir = __webpack_require__(324);
+const common = __webpack_require__(335);
+const reader_1 = __webpack_require__(336);
class SyncReader extends reader_1.default {
constructor() {
super(...arguments);
@@ -44864,14 +44332,14 @@ exports.default = SyncReader;
/***/ }),
-/* 345 */
+/* 340 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = __webpack_require__(4);
-const fsScandir = __webpack_require__(329);
+const fsScandir = __webpack_require__(324);
class Settings {
constructor(_options = {}) {
this._options = _options;
@@ -44897,15 +44365,15 @@ exports.default = Settings;
/***/ }),
-/* 346 */
+/* 341 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = __webpack_require__(4);
-const fsStat = __webpack_require__(321);
-const utils = __webpack_require__(291);
+const fsStat = __webpack_require__(316);
+const utils = __webpack_require__(286);
class Reader {
constructor(_settings) {
this._settings = _settings;
@@ -44937,17 +44405,17 @@ exports.default = Reader;
/***/ }),
-/* 347 */
+/* 342 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = __webpack_require__(4);
-const deep_1 = __webpack_require__(348);
-const entry_1 = __webpack_require__(351);
-const error_1 = __webpack_require__(352);
-const entry_2 = __webpack_require__(353);
+const deep_1 = __webpack_require__(343);
+const entry_1 = __webpack_require__(346);
+const error_1 = __webpack_require__(347);
+const entry_2 = __webpack_require__(348);
class Provider {
constructor(_settings) {
this._settings = _settings;
@@ -44992,14 +44460,14 @@ exports.default = Provider;
/***/ }),
-/* 348 */
+/* 343 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const utils = __webpack_require__(291);
-const partial_1 = __webpack_require__(349);
+const utils = __webpack_require__(286);
+const partial_1 = __webpack_require__(344);
class DeepFilter {
constructor(_settings, _micromatchOptions) {
this._settings = _settings;
@@ -45053,13 +44521,13 @@ exports.default = DeepFilter;
/***/ }),
-/* 349 */
+/* 344 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const matcher_1 = __webpack_require__(350);
+const matcher_1 = __webpack_require__(345);
class PartialMatcher extends matcher_1.default {
match(filepath) {
const parts = filepath.split('/');
@@ -45098,13 +44566,13 @@ exports.default = PartialMatcher;
/***/ }),
-/* 350 */
+/* 345 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const utils = __webpack_require__(291);
+const utils = __webpack_require__(286);
class Matcher {
constructor(_patterns, _settings, _micromatchOptions) {
this._patterns = _patterns;
@@ -45155,13 +44623,13 @@ exports.default = Matcher;
/***/ }),
-/* 351 */
+/* 346 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const utils = __webpack_require__(291);
+const utils = __webpack_require__(286);
class EntryFilter {
constructor(_settings, _micromatchOptions) {
this._settings = _settings;
@@ -45217,13 +44685,13 @@ exports.default = EntryFilter;
/***/ }),
-/* 352 */
+/* 347 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const utils = __webpack_require__(291);
+const utils = __webpack_require__(286);
class ErrorFilter {
constructor(_settings) {
this._settings = _settings;
@@ -45239,13 +44707,13 @@ exports.default = ErrorFilter;
/***/ }),
-/* 353 */
+/* 348 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const utils = __webpack_require__(291);
+const utils = __webpack_require__(286);
class EntryTransformer {
constructor(_settings) {
this._settings = _settings;
@@ -45272,15 +44740,15 @@ exports.default = EntryTransformer;
/***/ }),
-/* 354 */
+/* 349 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const stream_1 = __webpack_require__(137);
-const stream_2 = __webpack_require__(320);
-const provider_1 = __webpack_require__(347);
+const stream_2 = __webpack_require__(315);
+const provider_1 = __webpack_require__(342);
class ProviderStream extends provider_1.default {
constructor() {
super(...arguments);
@@ -45310,14 +44778,14 @@ exports.default = ProviderStream;
/***/ }),
-/* 355 */
+/* 350 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const sync_1 = __webpack_require__(356);
-const provider_1 = __webpack_require__(347);
+const sync_1 = __webpack_require__(351);
+const provider_1 = __webpack_require__(342);
class ProviderSync extends provider_1.default {
constructor() {
super(...arguments);
@@ -45340,15 +44808,15 @@ exports.default = ProviderSync;
/***/ }),
-/* 356 */
+/* 351 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const fsStat = __webpack_require__(321);
-const fsWalk = __webpack_require__(326);
-const reader_1 = __webpack_require__(346);
+const fsStat = __webpack_require__(316);
+const fsWalk = __webpack_require__(321);
+const reader_1 = __webpack_require__(341);
class ReaderSync extends reader_1.default {
constructor() {
super(...arguments);
@@ -45390,7 +44858,7 @@ exports.default = ReaderSync;
/***/ }),
-/* 357 */
+/* 352 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -45449,13 +44917,13 @@ exports.default = Settings;
/***/ }),
-/* 358 */
+/* 353 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const path = __webpack_require__(4);
-const pathType = __webpack_require__(359);
+const pathType = __webpack_require__(354);
const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0];
@@ -45531,7 +44999,7 @@ module.exports.sync = (input, options) => {
/***/ }),
-/* 359 */
+/* 354 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -45581,7 +45049,7 @@ exports.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
/***/ }),
-/* 360 */
+/* 355 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -45589,9 +45057,9 @@ exports.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
const {promisify} = __webpack_require__(111);
const fs = __webpack_require__(133);
const path = __webpack_require__(4);
-const fastGlob = __webpack_require__(289);
-const gitIgnore = __webpack_require__(361);
-const slash = __webpack_require__(362);
+const fastGlob = __webpack_require__(284);
+const gitIgnore = __webpack_require__(356);
+const slash = __webpack_require__(357);
const DEFAULT_IGNORE = [
'**/node_modules/**',
@@ -45705,7 +45173,7 @@ module.exports.sync = options => {
/***/ }),
-/* 361 */
+/* 356 */
/***/ (function(module, exports) {
// A simple implementation of make-array
@@ -46308,7 +45776,7 @@ if (
/***/ }),
-/* 362 */
+/* 357 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -46326,7 +45794,7 @@ module.exports = path => {
/***/ }),
-/* 363 */
+/* 358 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -46379,7 +45847,7 @@ module.exports = {
/***/ }),
-/* 364 */
+/* 359 */
/***/ (function(module, exports, __webpack_require__) {
/*!
@@ -46389,7 +45857,7 @@ module.exports = {
* Released under the MIT License.
*/
-var isExtglob = __webpack_require__(299);
+var isExtglob = __webpack_require__(294);
var chars = { '{': '}', '(': ')', '[': ']'};
var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/;
@@ -46433,7 +45901,7 @@ module.exports = function isGlob(str, options) {
/***/ }),
-/* 365 */
+/* 360 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -46455,7 +45923,7 @@ module.exports = path_ => {
/***/ }),
-/* 366 */
+/* 361 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -46483,7 +45951,7 @@ module.exports = (childPath, parentPath) => {
/***/ }),
-/* 367 */
+/* 362 */
/***/ (function(module, exports, __webpack_require__) {
const assert = __webpack_require__(139)
@@ -46849,12 +46317,12 @@ rimraf.sync = rimrafSync
/***/ }),
-/* 368 */
+/* 363 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const AggregateError = __webpack_require__(369);
+const AggregateError = __webpack_require__(364);
module.exports = async (
iterable,
@@ -46937,13 +46405,13 @@ module.exports = async (
/***/ }),
-/* 369 */
+/* 364 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const indentString = __webpack_require__(370);
-const cleanStack = __webpack_require__(371);
+const indentString = __webpack_require__(365);
+const cleanStack = __webpack_require__(366);
const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, '');
@@ -46991,7 +46459,7 @@ module.exports = AggregateError;
/***/ }),
-/* 370 */
+/* 365 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -47033,7 +46501,7 @@ module.exports = (string, count = 1, options) => {
/***/ }),
-/* 371 */
+/* 366 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -47080,47 +46548,221 @@ module.exports = (stack, options) => {
/***/ }),
-/* 372 */
+/* 367 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const chalk = __webpack_require__(373);
-const cliCursor = __webpack_require__(378);
-const cliSpinners = __webpack_require__(382);
-const logSymbols = __webpack_require__(384);
+const readline = __webpack_require__(368);
+const chalk = __webpack_require__(369);
+const cliCursor = __webpack_require__(374);
+const cliSpinners = __webpack_require__(376);
+const logSymbols = __webpack_require__(378);
+const stripAnsi = __webpack_require__(384);
+const wcwidth = __webpack_require__(386);
+const isInteractive = __webpack_require__(390);
+const MuteStream = __webpack_require__(391);
+
+const TEXT = Symbol('text');
+const PREFIX_TEXT = Symbol('prefixText');
+
+const ASCII_ETX_CODE = 0x03; // Ctrl+C emits this code
+
+class StdinDiscarder {
+ constructor() {
+ this.requests = 0;
+
+ this.mutedStream = new MuteStream();
+ this.mutedStream.pipe(process.stdout);
+ this.mutedStream.mute();
+
+ const self = this;
+ this.ourEmit = function (event, data, ...args) {
+ const {stdin} = process;
+ if (self.requests > 0 || stdin.emit === self.ourEmit) {
+ if (event === 'keypress') { // Fixes readline behavior
+ return;
+ }
+
+ if (event === 'data' && data.includes(ASCII_ETX_CODE)) {
+ process.emit('SIGINT');
+ }
+
+ Reflect.apply(self.oldEmit, this, [event, data, ...args]);
+ } else {
+ Reflect.apply(process.stdin.emit, this, [event, data, ...args]);
+ }
+ };
+ }
+
+ start() {
+ this.requests++;
+
+ if (this.requests === 1) {
+ this.realStart();
+ }
+ }
+
+ stop() {
+ if (this.requests <= 0) {
+ throw new Error('`stop` called more times than `start`');
+ }
+
+ this.requests--;
+
+ if (this.requests === 0) {
+ this.realStop();
+ }
+ }
+
+ realStart() {
+ // No known way to make it work reliably on Windows
+ if (process.platform === 'win32') {
+ return;
+ }
+
+ this.rl = readline.createInterface({
+ input: process.stdin,
+ output: this.mutedStream
+ });
+
+ this.rl.on('SIGINT', () => {
+ if (process.listenerCount('SIGINT') === 0) {
+ process.emit('SIGINT');
+ } else {
+ this.rl.close();
+ process.kill(process.pid, 'SIGINT');
+ }
+ });
+ }
+
+ realStop() {
+ if (process.platform === 'win32') {
+ return;
+ }
+
+ this.rl.close();
+ this.rl = undefined;
+ }
+}
+
+let stdinDiscarder;
class Ora {
constructor(options) {
+ if (!stdinDiscarder) {
+ stdinDiscarder = new StdinDiscarder();
+ }
+
if (typeof options === 'string') {
options = {
text: options
};
}
- this.options = Object.assign({
+ this.options = {
text: '',
color: 'cyan',
- stream: process.stderr
- }, options);
-
- const sp = this.options.spinner;
- this.spinner = typeof sp === 'object' ? sp : (process.platform === 'win32' ? cliSpinners.line : (cliSpinners[sp] || cliSpinners.dots)); // eslint-disable-line no-nested-ternary
+ stream: process.stderr,
+ discardStdin: true,
+ ...options
+ };
- if (this.spinner.frames === undefined) {
- throw new Error('Spinner must define `frames`');
- }
+ this.spinner = this.options.spinner;
- this.text = this.options.text;
this.color = this.options.color;
+ this.hideCursor = this.options.hideCursor !== false;
this.interval = this.options.interval || this.spinner.interval || 100;
this.stream = this.options.stream;
- this.id = null;
+ this.id = undefined;
+ this.isEnabled = typeof this.options.isEnabled === 'boolean' ? this.options.isEnabled : isInteractive({stream: this.stream});
+
+ // Set *after* `this.stream`
+ this.text = this.options.text;
+ this.prefixText = this.options.prefixText;
+ this.linesToClear = 0;
+ this.indent = this.options.indent;
+ this.discardStdin = this.options.discardStdin;
+ this.isDiscardingStdin = false;
+ }
+
+ get indent() {
+ return this._indent;
+ }
+
+ set indent(indent = 0) {
+ if (!(indent >= 0 && Number.isInteger(indent))) {
+ throw new Error('The `indent` option must be an integer from 0 and up');
+ }
+
+ this._indent = indent;
+ }
+
+ _updateInterval(interval) {
+ if (interval !== undefined) {
+ this.interval = interval;
+ }
+ }
+
+ get spinner() {
+ return this._spinner;
+ }
+
+ set spinner(spinner) {
this.frameIndex = 0;
- this.enabled = typeof this.options.enabled === 'boolean' ? this.options.enabled : ((this.stream && this.stream.isTTY) && !process.env.CI);
+
+ if (typeof spinner === 'object') {
+ if (spinner.frames === undefined) {
+ throw new Error('The given spinner must have a `frames` property');
+ }
+
+ this._spinner = spinner;
+ } else if (process.platform === 'win32') {
+ this._spinner = cliSpinners.line;
+ } else if (spinner === undefined) {
+ // Set default spinner
+ this._spinner = cliSpinners.dots;
+ } else if (cliSpinners[spinner]) {
+ this._spinner = cliSpinners[spinner];
+ } else {
+ throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json for a full list.`);
+ }
+
+ this._updateInterval(this._spinner.interval);
+ }
+
+ get text() {
+ return this[TEXT];
+ }
+
+ get prefixText() {
+ return this[PREFIX_TEXT];
+ }
+
+ get isSpinning() {
+ return this.id !== undefined;
}
+
+ updateLineCount() {
+ const columns = this.stream.columns || 80;
+ const fullPrefixText = (typeof this[PREFIX_TEXT] === 'string') ? this[PREFIX_TEXT] + '-' : '';
+ this.lineCount = stripAnsi(fullPrefixText + '--' + this[TEXT]).split('\n').reduce((count, line) => {
+ return count + Math.max(1, Math.ceil(wcwidth(line) / columns));
+ }, 0);
+ }
+
+ set text(value) {
+ this[TEXT] = value;
+ this.updateLineCount();
+ }
+
+ set prefixText(value) {
+ this[PREFIX_TEXT] = value;
+ this.updateLineCount();
+ }
+
frame() {
- const frames = this.spinner.frames;
+ const {frames} = this.spinner;
let frame = frames[this.frameIndex];
if (this.color) {
@@ -47128,92 +46770,129 @@ class Ora {
}
this.frameIndex = ++this.frameIndex % frames.length;
+ const fullPrefixText = (typeof this.prefixText === 'string' && this.prefixText !== '') ? this.prefixText + ' ' : '';
+ const fullText = typeof this.text === 'string' ? ' ' + this.text : '';
- return frame + ' ' + this.text;
+ return fullPrefixText + frame + fullText;
}
+
clear() {
- if (!this.enabled) {
+ if (!this.isEnabled || !this.stream.isTTY) {
return this;
}
- this.stream.clearLine();
- this.stream.cursorTo(0);
+ for (let i = 0; i < this.linesToClear; i++) {
+ if (i > 0) {
+ this.stream.moveCursor(0, -1);
+ }
+
+ this.stream.clearLine();
+ this.stream.cursorTo(this.indent);
+ }
+
+ this.linesToClear = 0;
return this;
}
+
render() {
this.clear();
this.stream.write(this.frame());
+ this.linesToClear = this.lineCount;
return this;
}
+
start(text) {
if (text) {
this.text = text;
}
- if (!this.enabled || this.id) {
+ if (!this.isEnabled) {
+ if (this.text) {
+ this.stream.write(`- ${this.text}\n`);
+ }
+
+ return this;
+ }
+
+ if (this.isSpinning) {
return this;
}
- cliCursor.hide(this.stream);
+ if (this.hideCursor) {
+ cliCursor.hide(this.stream);
+ }
+
+ if (this.discardStdin && process.stdin.isTTY) {
+ this.isDiscardingStdin = true;
+ stdinDiscarder.start();
+ }
+
this.render();
this.id = setInterval(this.render.bind(this), this.interval);
return this;
}
+
stop() {
- if (!this.enabled) {
+ if (!this.isEnabled) {
return this;
}
clearInterval(this.id);
- this.id = null;
+ this.id = undefined;
this.frameIndex = 0;
this.clear();
- cliCursor.show(this.stream);
+ if (this.hideCursor) {
+ cliCursor.show(this.stream);
+ }
+
+ if (this.discardStdin && process.stdin.isTTY && this.isDiscardingStdin) {
+ stdinDiscarder.stop();
+ this.isDiscardingStdin = false;
+ }
return this;
}
+
succeed(text) {
return this.stopAndPersist({symbol: logSymbols.success, text});
}
+
fail(text) {
return this.stopAndPersist({symbol: logSymbols.error, text});
}
+
warn(text) {
return this.stopAndPersist({symbol: logSymbols.warning, text});
}
- info(text) {
- return this.stopAndPersist({symbol: logSymbols.info, text});
- }
- stopAndPersist(options) {
- if (!this.enabled) {
- return this;
- }
- // Legacy argument
- // TODO: Deprecate sometime in the future
- if (typeof options === 'string') {
- options = {
- symbol: options
- };
- }
+ info(text) {
+ return this.stopAndPersist({symbol: logSymbols.info, text});
+ }
- options = options || {};
+ stopAndPersist(options = {}) {
+ const prefixText = options.prefixText || this.prefixText;
+ const fullPrefixText = (typeof prefixText === 'string' && prefixText !== '') ? prefixText + ' ' : '';
+ const text = options.text || this.text;
+ const fullText = (typeof text === 'string') ? ' ' + text : '';
this.stop();
- this.stream.write(`${options.symbol || ' '} ${options.text || this.text}\n`);
+ this.stream.write(`${fullPrefixText}${options.symbol || ' '}${fullText}\n`);
return this;
}
}
-module.exports = function (opts) {
- return new Ora(opts);
+const oraFactory = function (options) {
+ return new Ora(options);
};
+module.exports = oraFactory;
+
module.exports.promise = (action, options) => {
+ // eslint-disable-next-line promise/prefer-await-to-then
if (typeof action.then !== 'function') {
throw new TypeError('Parameter `action` must be a Promise');
}
@@ -47221,451 +46900,298 @@ module.exports.promise = (action, options) => {
const spinner = new Ora(options);
spinner.start();
- action.then(
- () => {
+ (async () => {
+ try {
+ await action;
spinner.succeed();
- },
- () => {
+ } catch (_) {
spinner.fail();
}
- );
+ })();
return spinner;
};
/***/ }),
-/* 373 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 368 */
+/***/ (function(module, exports) {
-"use strict";
+module.exports = require("readline");
-const escapeStringRegexp = __webpack_require__(178);
-const ansiStyles = __webpack_require__(374);
-const stdoutColor = __webpack_require__(375).stdout;
+/***/ }),
+/* 369 */
+/***/ (function(module, exports, __webpack_require__) {
-const template = __webpack_require__(377);
+"use strict";
-const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');
+const ansiStyles = __webpack_require__(113);
+const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(370);
+const {
+ stringReplaceAll,
+ stringEncaseCRLFWithFirstIndex
+} = __webpack_require__(372);
// `supportsColor.level` → `ansiStyles.color[name]` mapping
-const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
-
-// `color-convert` models to exclude from the Chalk API due to conflicts and such
-const skipModels = new Set(['gray']);
+const levelMapping = [
+ 'ansi',
+ 'ansi',
+ 'ansi256',
+ 'ansi16m'
+];
const styles = Object.create(null);
-function applyOptions(obj, options) {
- options = options || {};
+const applyOptions = (object, options = {}) => {
+ if (options.level > 3 || options.level < 0) {
+ throw new Error('The `level` option should be an integer from 0 to 3');
+ }
// Detect level if not set manually
- const scLevel = stdoutColor ? stdoutColor.level : 0;
- obj.level = options.level === undefined ? scLevel : options.level;
- obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
+ object.level = options.level === undefined ? colorLevel : options.level;
+};
+
+class ChalkClass {
+ constructor(options) {
+ return chalkFactory(options);
+ }
}
-function Chalk(options) {
- // We check for this.template here since calling `chalk.constructor()`
- // by itself will have a `this` of a previously constructed chalk object
- if (!this || !(this instanceof Chalk) || this.template) {
- const chalk = {};
- applyOptions(chalk, options);
+const chalkFactory = options => {
+ const chalk = {};
+ applyOptions(chalk, options);
- chalk.template = function () {
- const args = [].slice.call(arguments);
- return chalkTag.apply(null, [chalk.template].concat(args));
- };
+ chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
- Object.setPrototypeOf(chalk, Chalk.prototype);
- Object.setPrototypeOf(chalk.template, chalk);
+ Object.setPrototypeOf(chalk, Chalk.prototype);
+ Object.setPrototypeOf(chalk.template, chalk);
- chalk.template.constructor = Chalk;
+ chalk.template.constructor = () => {
+ throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
+ };
- return chalk.template;
- }
+ chalk.template.Instance = ChalkClass;
- applyOptions(this, options);
-}
+ return chalk.template;
+};
-// Use bright blue on Windows as the normal blue color is illegible
-if (isSimpleWindowsTerm) {
- ansiStyles.blue.open = '\u001B[94m';
+function Chalk(options) {
+ return chalkFactory(options);
}
-for (const key of Object.keys(ansiStyles)) {
- ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
-
- styles[key] = {
+for (const [styleName, style] of Object.entries(ansiStyles)) {
+ styles[styleName] = {
get() {
- const codes = ansiStyles[key];
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
+ const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
+ Object.defineProperty(this, styleName, {value: builder});
+ return builder;
}
};
}
styles.visible = {
get() {
- return build.call(this, this._styles || [], true, 'visible');
+ const builder = createBuilder(this, this._styler, true);
+ Object.defineProperty(this, 'visible', {value: builder});
+ return builder;
}
};
-ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
-for (const model of Object.keys(ansiStyles.color.ansi)) {
- if (skipModels.has(model)) {
- continue;
- }
+const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
+for (const model of usedModels) {
styles[model] = {
get() {
- const level = this.level;
- return function () {
- const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
- const codes = {
- open,
- close: ansiStyles.color.close,
- closeRe: ansiStyles.color.closeRe
- };
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
+ const {level} = this;
+ return function (...arguments_) {
+ const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
+ return createBuilder(this, styler, this._isEmpty);
};
}
};
}
-ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
-for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
- if (skipModels.has(model)) {
- continue;
- }
-
+for (const model of usedModels) {
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
styles[bgModel] = {
get() {
- const level = this.level;
- return function () {
- const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
- const codes = {
- open,
- close: ansiStyles.bgColor.close,
- closeRe: ansiStyles.bgColor.closeRe
- };
- return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
+ const {level} = this;
+ return function (...arguments_) {
+ const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
+ return createBuilder(this, styler, this._isEmpty);
};
}
};
}
-const proto = Object.defineProperties(() => {}, styles);
-
-function build(_styles, _empty, key) {
- const builder = function () {
- return applyStyle.apply(builder, arguments);
- };
-
- builder._styles = _styles;
- builder._empty = _empty;
-
- const self = this;
-
- Object.defineProperty(builder, 'level', {
+const proto = Object.defineProperties(() => {}, {
+ ...styles,
+ level: {
enumerable: true,
get() {
- return self.level;
+ return this._generator.level;
},
set(level) {
- self.level = level;
+ this._generator.level = level;
}
- });
+ }
+});
- Object.defineProperty(builder, 'enabled', {
- enumerable: true,
- get() {
- return self.enabled;
- },
- set(enabled) {
- self.enabled = enabled;
- }
- });
+const createStyler = (open, close, parent) => {
+ let openAll;
+ let closeAll;
+ if (parent === undefined) {
+ openAll = open;
+ closeAll = close;
+ } else {
+ openAll = parent.openAll + open;
+ closeAll = close + parent.closeAll;
+ }
- // See below for fix regarding invisible grey/dim combination on Windows
- builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey';
+ return {
+ open,
+ close,
+ openAll,
+ closeAll,
+ parent
+ };
+};
+
+const createBuilder = (self, _styler, _isEmpty) => {
+ const builder = (...arguments_) => {
+ // Single argument is hot path, implicit coercion is faster than anything
+ // eslint-disable-next-line no-implicit-coercion
+ return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
+ };
// `__proto__` is used because we must return a function, but there is
// no way to create a function with a different prototype
builder.__proto__ = proto; // eslint-disable-line no-proto
- return builder;
-}
+ builder._generator = self;
+ builder._styler = _styler;
+ builder._isEmpty = _isEmpty;
-function applyStyle() {
- // Support varags, but simply cast to string in case there's only one arg
- const args = arguments;
- const argsLen = args.length;
- let str = String(arguments[0]);
+ return builder;
+};
- if (argsLen === 0) {
- return '';
+const applyStyle = (self, string) => {
+ if (self.level <= 0 || !string) {
+ return self._isEmpty ? '' : string;
}
- if (argsLen > 1) {
- // Don't slice `arguments`, it prevents V8 optimizations
- for (let a = 1; a < argsLen; a++) {
- str += ' ' + args[a];
- }
- }
+ let styler = self._styler;
- if (!this.enabled || this.level <= 0 || !str) {
- return this._empty ? '' : str;
+ if (styler === undefined) {
+ return string;
}
- // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
- // see https://github.com/chalk/chalk/issues/58
- // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
- const originalDim = ansiStyles.dim.open;
- if (isSimpleWindowsTerm && this.hasGrey) {
- ansiStyles.dim.open = '';
- }
+ const {openAll, closeAll} = styler;
+ if (string.indexOf('\u001B') !== -1) {
+ while (styler !== undefined) {
+ // Replace any instances already present with a re-opening code
+ // otherwise only the part of the string until said closing code
+ // will be colored, and the rest will simply be 'plain'.
+ string = stringReplaceAll(string, styler.close, styler.open);
- for (const code of this._styles.slice().reverse()) {
- // Replace any instances already present with a re-opening code
- // otherwise only the part of the string until said closing code
- // will be colored, and the rest will simply be 'plain'.
- str = code.open + str.replace(code.closeRe, code.open) + code.close;
+ styler = styler.parent;
+ }
+ }
- // Close the styling before a linebreak and reopen
- // after next line to fix a bleed issue on macOS
- // https://github.com/chalk/chalk/pull/92
- str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
+ // We can move both next actions out of loop, because remaining actions in loop won't have
+ // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
+ // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
+ const lfIndex = string.indexOf('\n');
+ if (lfIndex !== -1) {
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
}
- // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
- ansiStyles.dim.open = originalDim;
+ return openAll + string + closeAll;
+};
- return str;
-}
+let template;
+const chalkTag = (chalk, ...strings) => {
+ const [firstString] = strings;
-function chalkTag(chalk, strings) {
- if (!Array.isArray(strings)) {
+ if (!Array.isArray(firstString)) {
// If chalk() was called by itself or with a string,
// return the string itself as a string.
- return [].slice.call(arguments, 1).join(' ');
+ return strings.join(' ');
}
- const args = [].slice.call(arguments, 2);
- const parts = [strings.raw[0]];
+ const arguments_ = strings.slice(1);
+ const parts = [firstString.raw[0]];
- for (let i = 1; i < strings.length; i++) {
- parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
- parts.push(String(strings.raw[i]));
+ for (let i = 1; i < firstString.length; i++) {
+ parts.push(
+ String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
+ String(firstString.raw[i])
+ );
+ }
+
+ if (template === undefined) {
+ template = __webpack_require__(373);
}
return template(chalk, parts.join(''));
-}
+};
Object.defineProperties(Chalk.prototype, styles);
-module.exports = Chalk(); // eslint-disable-line new-cap
-module.exports.supportsColor = stdoutColor;
-module.exports.default = module.exports; // For TypeScript
-
-
-/***/ }),
-/* 374 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(module) {
-const colorConvert = __webpack_require__(180);
-
-const wrapAnsi16 = (fn, offset) => function () {
- const code = fn.apply(colorConvert, arguments);
- return `\u001B[${code + offset}m`;
-};
-
-const wrapAnsi256 = (fn, offset) => function () {
- const code = fn.apply(colorConvert, arguments);
- return `\u001B[${38 + offset};5;${code}m`;
-};
+const chalk = Chalk(); // eslint-disable-line new-cap
+chalk.supportsColor = stdoutColor;
+chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
+chalk.stderr.supportsColor = stderrColor;
-const wrapAnsi16m = (fn, offset) => function () {
- const rgb = fn.apply(colorConvert, arguments);
- return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
+// For TypeScript
+chalk.Level = {
+ None: 0,
+ Basic: 1,
+ Ansi256: 2,
+ TrueColor: 3,
+ 0: 'None',
+ 1: 'Basic',
+ 2: 'Ansi256',
+ 3: 'TrueColor'
};
-function assembleStyles() {
- const codes = new Map();
- const styles = {
- modifier: {
- reset: [0, 0],
- // 21 isn't widely supported and 22 does the same thing
- bold: [1, 22],
- dim: [2, 22],
- italic: [3, 23],
- underline: [4, 24],
- inverse: [7, 27],
- hidden: [8, 28],
- strikethrough: [9, 29]
- },
- color: {
- black: [30, 39],
- red: [31, 39],
- green: [32, 39],
- yellow: [33, 39],
- blue: [34, 39],
- magenta: [35, 39],
- cyan: [36, 39],
- white: [37, 39],
- gray: [90, 39],
-
- // Bright color
- redBright: [91, 39],
- greenBright: [92, 39],
- yellowBright: [93, 39],
- blueBright: [94, 39],
- magentaBright: [95, 39],
- cyanBright: [96, 39],
- whiteBright: [97, 39]
- },
- bgColor: {
- bgBlack: [40, 49],
- bgRed: [41, 49],
- bgGreen: [42, 49],
- bgYellow: [43, 49],
- bgBlue: [44, 49],
- bgMagenta: [45, 49],
- bgCyan: [46, 49],
- bgWhite: [47, 49],
-
- // Bright color
- bgBlackBright: [100, 49],
- bgRedBright: [101, 49],
- bgGreenBright: [102, 49],
- bgYellowBright: [103, 49],
- bgBlueBright: [104, 49],
- bgMagentaBright: [105, 49],
- bgCyanBright: [106, 49],
- bgWhiteBright: [107, 49]
- }
- };
-
- // Fix humans
- styles.color.grey = styles.color.gray;
-
- for (const groupName of Object.keys(styles)) {
- const group = styles[groupName];
-
- for (const styleName of Object.keys(group)) {
- const style = group[styleName];
-
- styles[styleName] = {
- open: `\u001B[${style[0]}m`,
- close: `\u001B[${style[1]}m`
- };
-
- group[styleName] = styles[styleName];
-
- codes.set(style[0], style[1]);
- }
-
- Object.defineProperty(styles, groupName, {
- value: group,
- enumerable: false
- });
-
- Object.defineProperty(styles, 'codes', {
- value: codes,
- enumerable: false
- });
- }
-
- const ansi2ansi = n => n;
- const rgb2rgb = (r, g, b) => [r, g, b];
-
- styles.color.close = '\u001B[39m';
- styles.bgColor.close = '\u001B[49m';
-
- styles.color.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 0)
- };
- styles.color.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 0)
- };
- styles.color.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 0)
- };
-
- styles.bgColor.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 10)
- };
- styles.bgColor.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 10)
- };
- styles.bgColor.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 10)
- };
-
- for (let key of Object.keys(colorConvert)) {
- if (typeof colorConvert[key] !== 'object') {
- continue;
- }
-
- const suite = colorConvert[key];
-
- if (key === 'ansi16') {
- key = 'ansi';
- }
-
- if ('ansi16' in suite) {
- styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
- styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
- }
-
- if ('ansi256' in suite) {
- styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
- styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
- }
-
- if ('rgb' in suite) {
- styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
- styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
- }
- }
-
- return styles;
-}
-
-// Make the export immutable
-Object.defineProperty(module, 'exports', {
- enumerable: true,
- get: assembleStyles
-});
+module.exports = chalk;
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(114)(module)))
/***/ }),
-/* 375 */
+/* 370 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const os = __webpack_require__(120);
-const hasFlag = __webpack_require__(376);
+const tty = __webpack_require__(121);
+const hasFlag = __webpack_require__(371);
-const env = process.env;
+const {env} = process;
let forceColor;
if (hasFlag('no-color') ||
hasFlag('no-colors') ||
- hasFlag('color=false')) {
- forceColor = false;
+ hasFlag('color=false') ||
+ hasFlag('color=never')) {
+ forceColor = 0;
} else if (hasFlag('color') ||
hasFlag('colors') ||
hasFlag('color=true') ||
hasFlag('color=always')) {
- forceColor = true;
+ forceColor = 1;
}
+
if ('FORCE_COLOR' in env) {
- forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
+ if (env.FORCE_COLOR === 'true') {
+ forceColor = 1;
+ } else if (env.FORCE_COLOR === 'false') {
+ forceColor = 0;
+ } else {
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
+ }
}
function translateLevel(level) {
@@ -47681,8 +47207,8 @@ function translateLevel(level) {
};
}
-function supportsColor(stream) {
- if (forceColor === false) {
+function supportsColor(haveStream, streamIsTTY) {
+ if (forceColor === 0) {
return 0;
}
@@ -47696,22 +47222,21 @@ function supportsColor(stream) {
return 2;
}
- if (stream && !stream.isTTY && forceColor !== true) {
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
return 0;
}
- const min = forceColor ? 1 : 0;
+ const min = forceColor || 0;
+
+ if (env.TERM === 'dumb') {
+ return min;
+ }
if (process.platform === 'win32') {
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
- // libuv that enables 256 color output on Windows. Anything earlier and it
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
- // release that supports 256 colors. Windows 10 build 14931 is the first release
- // that supports 16m/TrueColor.
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
const osRelease = os.release().split('.');
if (
- Number(process.versions.node.split('.')[0]) >= 8 &&
Number(osRelease[0]) >= 10 &&
Number(osRelease[2]) >= 10586
) {
@@ -47733,6 +47258,10 @@ function supportsColor(stream) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
}
+ if ('GITHUB_ACTIONS' in env) {
+ return 1;
+ }
+
if (env.COLORTERM === 'truecolor') {
return 3;
}
@@ -47761,50 +47290,92 @@ function supportsColor(stream) {
return 1;
}
- if (env.TERM === 'dumb') {
- return min;
- }
-
return min;
}
function getSupportLevel(stream) {
- const level = supportsColor(stream);
+ const level = supportsColor(stream, stream && stream.isTTY);
return translateLevel(level);
}
module.exports = {
supportsColor: getSupportLevel,
- stdout: getSupportLevel(process.stdout),
- stderr: getSupportLevel(process.stderr)
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
};
/***/ }),
-/* 376 */
+/* 371 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-module.exports = (flag, argv) => {
- argv = argv || process.argv;
+
+module.exports = (flag, argv = process.argv) => {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
- const pos = argv.indexOf(prefix + flag);
- const terminatorPos = argv.indexOf('--');
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
+ const position = argv.indexOf(prefix + flag);
+ const terminatorPosition = argv.indexOf('--');
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
};
/***/ }),
-/* 377 */
+/* 372 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
+
+const stringReplaceAll = (string, substring, replacer) => {
+ let index = string.indexOf(substring);
+ if (index === -1) {
+ return string;
+ }
+
+ const substringLength = substring.length;
+ let endIndex = 0;
+ let returnValue = '';
+ do {
+ returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
+ endIndex = index + substringLength;
+ index = string.indexOf(substring, endIndex);
+ } while (index !== -1);
+
+ returnValue += string.substr(endIndex);
+ return returnValue;
+};
+
+const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
+ let endIndex = 0;
+ let returnValue = '';
+ do {
+ const gotCR = string[index - 1] === '\r';
+ returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
+ endIndex = index + 1;
+ index = string.indexOf('\n', endIndex);
+ } while (index !== -1);
+
+ returnValue += string.substr(endIndex);
+ return returnValue;
+};
+
+module.exports = {
+ stringReplaceAll,
+ stringEncaseCRLFWithFirstIndex
+};
+
+
+/***/ }),
+/* 373 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
-const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
+const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi;
const ESCAPES = new Map([
['n', '\n'],
@@ -47820,23 +47391,31 @@ const ESCAPES = new Map([
]);
function unescape(c) {
- if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
+ const u = c[0] === 'u';
+ const bracket = c[1] === '{';
+
+ if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
return String.fromCharCode(parseInt(c.slice(1), 16));
}
+ if (u && bracket) {
+ return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
+ }
+
return ESCAPES.get(c) || c;
}
-function parseArguments(name, args) {
+function parseArguments(name, arguments_) {
const results = [];
- const chunks = args.trim().split(/\s*,\s*/g);
+ const chunks = arguments_.trim().split(/\s*,\s*/g);
let matches;
for (const chunk of chunks) {
- if (!isNaN(chunk)) {
- results.push(Number(chunk));
+ const number = Number(chunk);
+ if (!Number.isNaN(number)) {
+ results.push(number);
} else if ((matches = chunk.match(STRING_REGEX))) {
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
+ results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
} else {
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
}
@@ -47875,36 +47454,34 @@ function buildStyle(chalk, styles) {
}
let current = chalk;
- for (const styleName of Object.keys(enabled)) {
- if (Array.isArray(enabled[styleName])) {
- if (!(styleName in current)) {
- throw new Error(`Unknown Chalk style: ${styleName}`);
- }
+ for (const [styleName, styles] of Object.entries(enabled)) {
+ if (!Array.isArray(styles)) {
+ continue;
+ }
- if (enabled[styleName].length > 0) {
- current = current[styleName].apply(current, enabled[styleName]);
- } else {
- current = current[styleName];
- }
+ if (!(styleName in current)) {
+ throw new Error(`Unknown Chalk style: ${styleName}`);
}
+
+ current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
}
return current;
}
-module.exports = (chalk, tmp) => {
+module.exports = (chalk, temporary) => {
const styles = [];
const chunks = [];
let chunk = [];
// eslint-disable-next-line max-params
- tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
- if (escapeChar) {
- chunk.push(unescape(escapeChar));
+ temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
+ if (escapeCharacter) {
+ chunk.push(unescape(escapeCharacter));
} else if (style) {
- const str = chunk.join('');
+ const string = chunk.join('');
chunk = [];
- chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
+ chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
styles.push({inverse, styles: parseStyle(style)});
} else if (close) {
if (styles.length === 0) {
@@ -47915,7 +47492,7 @@ module.exports = (chalk, tmp) => {
chunk = [];
styles.pop();
} else {
- chunk.push(chr);
+ chunk.push(character);
}
});
@@ -47931,151 +47508,100 @@ module.exports = (chalk, tmp) => {
/***/ }),
-/* 378 */
+/* 374 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const restoreCursor = __webpack_require__(379);
-
-let hidden = false;
+const restoreCursor = __webpack_require__(375);
-exports.show = stream => {
- const s = stream || process.stderr;
+let isHidden = false;
- if (!s.isTTY) {
+exports.show = (writableStream = process.stderr) => {
+ if (!writableStream.isTTY) {
return;
}
- hidden = false;
- s.write('\u001b[?25h');
+ isHidden = false;
+ writableStream.write('\u001B[?25h');
};
-exports.hide = stream => {
- const s = stream || process.stderr;
-
- if (!s.isTTY) {
+exports.hide = (writableStream = process.stderr) => {
+ if (!writableStream.isTTY) {
return;
}
restoreCursor();
- hidden = true;
- s.write('\u001b[?25l');
+ isHidden = true;
+ writableStream.write('\u001B[?25l');
};
-exports.toggle = (force, stream) => {
+exports.toggle = (force, writableStream) => {
if (force !== undefined) {
- hidden = force;
+ isHidden = force;
}
- if (hidden) {
- exports.show(stream);
+ if (isHidden) {
+ exports.show(writableStream);
} else {
- exports.hide(stream);
+ exports.hide(writableStream);
}
};
/***/ }),
-/* 379 */
+/* 375 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const onetime = __webpack_require__(380);
+const onetime = __webpack_require__(244);
const signalExit = __webpack_require__(217);
module.exports = onetime(() => {
signalExit(() => {
- process.stderr.write('\u001b[?25h');
+ process.stderr.write('\u001B[?25h');
}, {alwaysLast: true});
});
/***/ }),
-/* 380 */
+/* 376 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const mimicFn = __webpack_require__(381);
-
-module.exports = (fn, opts) => {
- // TODO: Remove this in v3
- if (opts === true) {
- throw new TypeError('The second argument is now an options object');
- }
-
- if (typeof fn !== 'function') {
- throw new TypeError('Expected a function');
- }
-
- opts = opts || {};
-
- let ret;
- let called = false;
- const fnName = fn.displayName || fn.name || '';
-
- const onetime = function () {
- if (called) {
- if (opts.throw === true) {
- throw new Error(`Function \`${fnName}\` can only be called once`);
- }
-
- return ret;
- }
-
- called = true;
- ret = fn.apply(this, arguments);
- fn = null;
- return ret;
- };
+const spinners = Object.assign({}, __webpack_require__(377));
- mimicFn(onetime, fn);
+const spinnersList = Object.keys(spinners);
- return onetime;
-};
-
-
-/***/ }),
-/* 381 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-module.exports = (to, from) => {
- // TODO: use `Reflect.ownKeys()` when targeting Node.js 6
- for (const prop of Object.getOwnPropertyNames(from).concat(Object.getOwnPropertySymbols(from))) {
- Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
+Object.defineProperty(spinners, 'random', {
+ get() {
+ const randomIndex = Math.floor(Math.random() * spinnersList.length);
+ const spinnerName = spinnersList[randomIndex];
+ return spinners[spinnerName];
}
+});
- return to;
-};
-
-
-/***/ }),
-/* 382 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-module.exports = __webpack_require__(383);
+module.exports = spinners;
+// TODO: Remove this for the next major release
+module.exports.default = spinners;
/***/ }),
-/* 383 */
+/* 377 */
/***/ (function(module) {
-module.exports = JSON.parse("{\"dots\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠹\",\"⠸\",\"⠼\",\"⠴\",\"⠦\",\"⠧\",\"⠇\",\"⠏\"]},\"dots2\":{\"interval\":80,\"frames\":[\"⣾\",\"⣽\",\"⣻\",\"⢿\",\"⡿\",\"⣟\",\"⣯\",\"⣷\"]},\"dots3\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠚\",\"⠞\",\"⠖\",\"⠦\",\"⠴\",\"⠲\",\"⠳\",\"⠓\"]},\"dots4\":{\"interval\":80,\"frames\":[\"⠄\",\"⠆\",\"⠇\",\"⠋\",\"⠙\",\"⠸\",\"⠰\",\"⠠\",\"⠰\",\"⠸\",\"⠙\",\"⠋\",\"⠇\",\"⠆\"]},\"dots5\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\"]},\"dots6\":{\"interval\":80,\"frames\":[\"⠁\",\"⠉\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠤\",\"⠄\",\"⠄\",\"⠤\",\"⠴\",\"⠲\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠚\",\"⠙\",\"⠉\",\"⠁\"]},\"dots7\":{\"interval\":80,\"frames\":[\"⠈\",\"⠉\",\"⠋\",\"⠓\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠖\",\"⠦\",\"⠤\",\"⠠\",\"⠠\",\"⠤\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\",\"⠉\",\"⠈\"]},\"dots8\":{\"interval\":80,\"frames\":[\"⠁\",\"⠁\",\"⠉\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠤\",\"⠄\",\"⠄\",\"⠤\",\"⠠\",\"⠠\",\"⠤\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\",\"⠉\",\"⠈\",\"⠈\"]},\"dots9\":{\"interval\":80,\"frames\":[\"⢹\",\"⢺\",\"⢼\",\"⣸\",\"⣇\",\"⡧\",\"⡗\",\"⡏\"]},\"dots10\":{\"interval\":80,\"frames\":[\"⢄\",\"⢂\",\"⢁\",\"⡁\",\"⡈\",\"⡐\",\"⡠\"]},\"dots11\":{\"interval\":100,\"frames\":[\"⠁\",\"⠂\",\"⠄\",\"⡀\",\"⢀\",\"⠠\",\"⠐\",\"⠈\"]},\"dots12\":{\"interval\":80,\"frames\":[\"⢀⠀\",\"⡀⠀\",\"⠄⠀\",\"⢂⠀\",\"⡂⠀\",\"⠅⠀\",\"⢃⠀\",\"⡃⠀\",\"⠍⠀\",\"⢋⠀\",\"⡋⠀\",\"⠍⠁\",\"⢋⠁\",\"⡋⠁\",\"⠍⠉\",\"⠋⠉\",\"⠋⠉\",\"⠉⠙\",\"⠉⠙\",\"⠉⠩\",\"⠈⢙\",\"⠈⡙\",\"⢈⠩\",\"⡀⢙\",\"⠄⡙\",\"⢂⠩\",\"⡂⢘\",\"⠅⡘\",\"⢃⠨\",\"⡃⢐\",\"⠍⡐\",\"⢋⠠\",\"⡋⢀\",\"⠍⡁\",\"⢋⠁\",\"⡋⠁\",\"⠍⠉\",\"⠋⠉\",\"⠋⠉\",\"⠉⠙\",\"⠉⠙\",\"⠉⠩\",\"⠈⢙\",\"⠈⡙\",\"⠈⠩\",\"⠀⢙\",\"⠀⡙\",\"⠀⠩\",\"⠀⢘\",\"⠀⡘\",\"⠀⠨\",\"⠀⢐\",\"⠀⡐\",\"⠀⠠\",\"⠀⢀\",\"⠀⡀\"]},\"line\":{\"interval\":130,\"frames\":[\"-\",\"\\\\\",\"|\",\"/\"]},\"line2\":{\"interval\":100,\"frames\":[\"⠂\",\"-\",\"–\",\"—\",\"–\",\"-\"]},\"pipe\":{\"interval\":100,\"frames\":[\"┤\",\"┘\",\"┴\",\"└\",\"├\",\"┌\",\"┬\",\"┐\"]},\"simpleDots\":{\"interval\":400,\"frames\":[\". \",\".. \",\"...\",\" \"]},\"simpleDotsScrolling\":{\"interval\":200,\"frames\":[\". \",\".. \",\"...\",\" ..\",\" .\",\" \"]},\"star\":{\"interval\":70,\"frames\":[\"✶\",\"✸\",\"✹\",\"✺\",\"✹\",\"✷\"]},\"star2\":{\"interval\":80,\"frames\":[\"+\",\"x\",\"*\"]},\"flip\":{\"interval\":70,\"frames\":[\"_\",\"_\",\"_\",\"-\",\"`\",\"`\",\"'\",\"´\",\"-\",\"_\",\"_\",\"_\"]},\"hamburger\":{\"interval\":100,\"frames\":[\"☱\",\"☲\",\"☴\"]},\"growVertical\":{\"interval\":120,\"frames\":[\"▁\",\"▃\",\"▄\",\"▅\",\"▆\",\"▇\",\"▆\",\"▅\",\"▄\",\"▃\"]},\"growHorizontal\":{\"interval\":120,\"frames\":[\"▏\",\"▎\",\"▍\",\"▌\",\"▋\",\"▊\",\"▉\",\"▊\",\"▋\",\"▌\",\"▍\",\"▎\"]},\"balloon\":{\"interval\":140,\"frames\":[\" \",\".\",\"o\",\"O\",\"@\",\"*\",\" \"]},\"balloon2\":{\"interval\":120,\"frames\":[\".\",\"o\",\"O\",\"°\",\"O\",\"o\",\".\"]},\"noise\":{\"interval\":100,\"frames\":[\"▓\",\"▒\",\"░\"]},\"bounce\":{\"interval\":120,\"frames\":[\"⠁\",\"⠂\",\"⠄\",\"⠂\"]},\"boxBounce\":{\"interval\":120,\"frames\":[\"▖\",\"▘\",\"▝\",\"▗\"]},\"boxBounce2\":{\"interval\":100,\"frames\":[\"▌\",\"▀\",\"▐\",\"▄\"]},\"triangle\":{\"interval\":50,\"frames\":[\"◢\",\"◣\",\"◤\",\"◥\"]},\"arc\":{\"interval\":100,\"frames\":[\"◜\",\"◠\",\"◝\",\"◞\",\"◡\",\"◟\"]},\"circle\":{\"interval\":120,\"frames\":[\"◡\",\"⊙\",\"◠\"]},\"squareCorners\":{\"interval\":180,\"frames\":[\"◰\",\"◳\",\"◲\",\"◱\"]},\"circleQuarters\":{\"interval\":120,\"frames\":[\"◴\",\"◷\",\"◶\",\"◵\"]},\"circleHalves\":{\"interval\":50,\"frames\":[\"◐\",\"◓\",\"◑\",\"◒\"]},\"squish\":{\"interval\":100,\"frames\":[\"╫\",\"╪\"]},\"toggle\":{\"interval\":250,\"frames\":[\"⊶\",\"⊷\"]},\"toggle2\":{\"interval\":80,\"frames\":[\"▫\",\"▪\"]},\"toggle3\":{\"interval\":120,\"frames\":[\"□\",\"■\"]},\"toggle4\":{\"interval\":100,\"frames\":[\"■\",\"□\",\"▪\",\"▫\"]},\"toggle5\":{\"interval\":100,\"frames\":[\"▮\",\"▯\"]},\"toggle6\":{\"interval\":300,\"frames\":[\"ဝ\",\"၀\"]},\"toggle7\":{\"interval\":80,\"frames\":[\"⦾\",\"⦿\"]},\"toggle8\":{\"interval\":100,\"frames\":[\"◍\",\"◌\"]},\"toggle9\":{\"interval\":100,\"frames\":[\"◉\",\"◎\"]},\"toggle10\":{\"interval\":100,\"frames\":[\"㊂\",\"㊀\",\"㊁\"]},\"toggle11\":{\"interval\":50,\"frames\":[\"⧇\",\"⧆\"]},\"toggle12\":{\"interval\":120,\"frames\":[\"☗\",\"☖\"]},\"toggle13\":{\"interval\":80,\"frames\":[\"=\",\"*\",\"-\"]},\"arrow\":{\"interval\":100,\"frames\":[\"←\",\"↖\",\"↑\",\"↗\",\"→\",\"↘\",\"↓\",\"↙\"]},\"arrow2\":{\"interval\":80,\"frames\":[\"⬆️ \",\"↗️ \",\"➡️ \",\"↘️ \",\"⬇️ \",\"↙️ \",\"⬅️ \",\"↖️ \"]},\"arrow3\":{\"interval\":120,\"frames\":[\"▹▹▹▹▹\",\"▸▹▹▹▹\",\"▹▸▹▹▹\",\"▹▹▸▹▹\",\"▹▹▹▸▹\",\"▹▹▹▹▸\"]},\"bouncingBar\":{\"interval\":80,\"frames\":[\"[ ]\",\"[= ]\",\"[== ]\",\"[=== ]\",\"[ ===]\",\"[ ==]\",\"[ =]\",\"[ ]\",\"[ =]\",\"[ ==]\",\"[ ===]\",\"[====]\",\"[=== ]\",\"[== ]\",\"[= ]\"]},\"bouncingBall\":{\"interval\":80,\"frames\":[\"( ● )\",\"( ● )\",\"( ● )\",\"( ● )\",\"( ●)\",\"( ● )\",\"( ● )\",\"( ● )\",\"( ● )\",\"(● )\"]},\"smiley\":{\"interval\":200,\"frames\":[\"😄 \",\"😝 \"]},\"monkey\":{\"interval\":300,\"frames\":[\"🙈 \",\"🙈 \",\"🙉 \",\"🙊 \"]},\"hearts\":{\"interval\":100,\"frames\":[\"💛 \",\"💙 \",\"💜 \",\"💚 \",\"❤️ \"]},\"clock\":{\"interval\":100,\"frames\":[\"🕐 \",\"🕑 \",\"🕒 \",\"🕓 \",\"🕔 \",\"🕕 \",\"🕖 \",\"🕗 \",\"🕘 \",\"🕙 \",\"🕚 \"]},\"earth\":{\"interval\":180,\"frames\":[\"🌍 \",\"🌎 \",\"🌏 \"]},\"moon\":{\"interval\":80,\"frames\":[\"🌑 \",\"🌒 \",\"🌓 \",\"🌔 \",\"🌕 \",\"🌖 \",\"🌗 \",\"🌘 \"]},\"runner\":{\"interval\":140,\"frames\":[\"🚶 \",\"🏃 \"]},\"pong\":{\"interval\":80,\"frames\":[\"▐⠂ ▌\",\"▐⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂▌\",\"▐ ⠠▌\",\"▐ ⡀▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐⠠ ▌\"]},\"shark\":{\"interval\":120,\"frames\":[\"▐|\\\\____________▌\",\"▐_|\\\\___________▌\",\"▐__|\\\\__________▌\",\"▐___|\\\\_________▌\",\"▐____|\\\\________▌\",\"▐_____|\\\\_______▌\",\"▐______|\\\\______▌\",\"▐_______|\\\\_____▌\",\"▐________|\\\\____▌\",\"▐_________|\\\\___▌\",\"▐__________|\\\\__▌\",\"▐___________|\\\\_▌\",\"▐____________|\\\\▌\",\"▐____________/|▌\",\"▐___________/|_▌\",\"▐__________/|__▌\",\"▐_________/|___▌\",\"▐________/|____▌\",\"▐_______/|_____▌\",\"▐______/|______▌\",\"▐_____/|_______▌\",\"▐____/|________▌\",\"▐___/|_________▌\",\"▐__/|__________▌\",\"▐_/|___________▌\",\"▐/|____________▌\"]},\"dqpb\":{\"interval\":100,\"frames\":[\"d\",\"q\",\"p\",\"b\"]},\"weather\":{\"interval\":100,\"frames\":[\"☀️ \",\"☀️ \",\"☀️ \",\"🌤 \",\"⛅️ \",\"🌥 \",\"☁️ \",\"🌧 \",\"🌨 \",\"🌧 \",\"🌨 \",\"🌧 \",\"🌨 \",\"⛈ \",\"🌨 \",\"🌧 \",\"🌨 \",\"☁️ \",\"🌥 \",\"⛅️ \",\"🌤 \",\"☀️ \",\"☀️ \"]},\"christmas\":{\"interval\":400,\"frames\":[\"🌲\",\"🎄\"]}}");
+module.exports = JSON.parse("{\"dots\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠹\",\"⠸\",\"⠼\",\"⠴\",\"⠦\",\"⠧\",\"⠇\",\"⠏\"]},\"dots2\":{\"interval\":80,\"frames\":[\"⣾\",\"⣽\",\"⣻\",\"⢿\",\"⡿\",\"⣟\",\"⣯\",\"⣷\"]},\"dots3\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠚\",\"⠞\",\"⠖\",\"⠦\",\"⠴\",\"⠲\",\"⠳\",\"⠓\"]},\"dots4\":{\"interval\":80,\"frames\":[\"⠄\",\"⠆\",\"⠇\",\"⠋\",\"⠙\",\"⠸\",\"⠰\",\"⠠\",\"⠰\",\"⠸\",\"⠙\",\"⠋\",\"⠇\",\"⠆\"]},\"dots5\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\"]},\"dots6\":{\"interval\":80,\"frames\":[\"⠁\",\"⠉\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠤\",\"⠄\",\"⠄\",\"⠤\",\"⠴\",\"⠲\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠚\",\"⠙\",\"⠉\",\"⠁\"]},\"dots7\":{\"interval\":80,\"frames\":[\"⠈\",\"⠉\",\"⠋\",\"⠓\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠖\",\"⠦\",\"⠤\",\"⠠\",\"⠠\",\"⠤\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\",\"⠉\",\"⠈\"]},\"dots8\":{\"interval\":80,\"frames\":[\"⠁\",\"⠁\",\"⠉\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠤\",\"⠄\",\"⠄\",\"⠤\",\"⠠\",\"⠠\",\"⠤\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\",\"⠉\",\"⠈\",\"⠈\"]},\"dots9\":{\"interval\":80,\"frames\":[\"⢹\",\"⢺\",\"⢼\",\"⣸\",\"⣇\",\"⡧\",\"⡗\",\"⡏\"]},\"dots10\":{\"interval\":80,\"frames\":[\"⢄\",\"⢂\",\"⢁\",\"⡁\",\"⡈\",\"⡐\",\"⡠\"]},\"dots11\":{\"interval\":100,\"frames\":[\"⠁\",\"⠂\",\"⠄\",\"⡀\",\"⢀\",\"⠠\",\"⠐\",\"⠈\"]},\"dots12\":{\"interval\":80,\"frames\":[\"⢀⠀\",\"⡀⠀\",\"⠄⠀\",\"⢂⠀\",\"⡂⠀\",\"⠅⠀\",\"⢃⠀\",\"⡃⠀\",\"⠍⠀\",\"⢋⠀\",\"⡋⠀\",\"⠍⠁\",\"⢋⠁\",\"⡋⠁\",\"⠍⠉\",\"⠋⠉\",\"⠋⠉\",\"⠉⠙\",\"⠉⠙\",\"⠉⠩\",\"⠈⢙\",\"⠈⡙\",\"⢈⠩\",\"⡀⢙\",\"⠄⡙\",\"⢂⠩\",\"⡂⢘\",\"⠅⡘\",\"⢃⠨\",\"⡃⢐\",\"⠍⡐\",\"⢋⠠\",\"⡋⢀\",\"⠍⡁\",\"⢋⠁\",\"⡋⠁\",\"⠍⠉\",\"⠋⠉\",\"⠋⠉\",\"⠉⠙\",\"⠉⠙\",\"⠉⠩\",\"⠈⢙\",\"⠈⡙\",\"⠈⠩\",\"⠀⢙\",\"⠀⡙\",\"⠀⠩\",\"⠀⢘\",\"⠀⡘\",\"⠀⠨\",\"⠀⢐\",\"⠀⡐\",\"⠀⠠\",\"⠀⢀\",\"⠀⡀\"]},\"dots8Bit\":{\"interval\":80,\"frames\":[\"⠀\",\"⠁\",\"⠂\",\"⠃\",\"⠄\",\"⠅\",\"⠆\",\"⠇\",\"⡀\",\"⡁\",\"⡂\",\"⡃\",\"⡄\",\"⡅\",\"⡆\",\"⡇\",\"⠈\",\"⠉\",\"⠊\",\"⠋\",\"⠌\",\"⠍\",\"⠎\",\"⠏\",\"⡈\",\"⡉\",\"⡊\",\"⡋\",\"⡌\",\"⡍\",\"⡎\",\"⡏\",\"⠐\",\"⠑\",\"⠒\",\"⠓\",\"⠔\",\"⠕\",\"⠖\",\"⠗\",\"⡐\",\"⡑\",\"⡒\",\"⡓\",\"⡔\",\"⡕\",\"⡖\",\"⡗\",\"⠘\",\"⠙\",\"⠚\",\"⠛\",\"⠜\",\"⠝\",\"⠞\",\"⠟\",\"⡘\",\"⡙\",\"⡚\",\"⡛\",\"⡜\",\"⡝\",\"⡞\",\"⡟\",\"⠠\",\"⠡\",\"⠢\",\"⠣\",\"⠤\",\"⠥\",\"⠦\",\"⠧\",\"⡠\",\"⡡\",\"⡢\",\"⡣\",\"⡤\",\"⡥\",\"⡦\",\"⡧\",\"⠨\",\"⠩\",\"⠪\",\"⠫\",\"⠬\",\"⠭\",\"⠮\",\"⠯\",\"⡨\",\"⡩\",\"⡪\",\"⡫\",\"⡬\",\"⡭\",\"⡮\",\"⡯\",\"⠰\",\"⠱\",\"⠲\",\"⠳\",\"⠴\",\"⠵\",\"⠶\",\"⠷\",\"⡰\",\"⡱\",\"⡲\",\"⡳\",\"⡴\",\"⡵\",\"⡶\",\"⡷\",\"⠸\",\"⠹\",\"⠺\",\"⠻\",\"⠼\",\"⠽\",\"⠾\",\"⠿\",\"⡸\",\"⡹\",\"⡺\",\"⡻\",\"⡼\",\"⡽\",\"⡾\",\"⡿\",\"⢀\",\"⢁\",\"⢂\",\"⢃\",\"⢄\",\"⢅\",\"⢆\",\"⢇\",\"⣀\",\"⣁\",\"⣂\",\"⣃\",\"⣄\",\"⣅\",\"⣆\",\"⣇\",\"⢈\",\"⢉\",\"⢊\",\"⢋\",\"⢌\",\"⢍\",\"⢎\",\"⢏\",\"⣈\",\"⣉\",\"⣊\",\"⣋\",\"⣌\",\"⣍\",\"⣎\",\"⣏\",\"⢐\",\"⢑\",\"⢒\",\"⢓\",\"⢔\",\"⢕\",\"⢖\",\"⢗\",\"⣐\",\"⣑\",\"⣒\",\"⣓\",\"⣔\",\"⣕\",\"⣖\",\"⣗\",\"⢘\",\"⢙\",\"⢚\",\"⢛\",\"⢜\",\"⢝\",\"⢞\",\"⢟\",\"⣘\",\"⣙\",\"⣚\",\"⣛\",\"⣜\",\"⣝\",\"⣞\",\"⣟\",\"⢠\",\"⢡\",\"⢢\",\"⢣\",\"⢤\",\"⢥\",\"⢦\",\"⢧\",\"⣠\",\"⣡\",\"⣢\",\"⣣\",\"⣤\",\"⣥\",\"⣦\",\"⣧\",\"⢨\",\"⢩\",\"⢪\",\"⢫\",\"⢬\",\"⢭\",\"⢮\",\"⢯\",\"⣨\",\"⣩\",\"⣪\",\"⣫\",\"⣬\",\"⣭\",\"⣮\",\"⣯\",\"⢰\",\"⢱\",\"⢲\",\"⢳\",\"⢴\",\"⢵\",\"⢶\",\"⢷\",\"⣰\",\"⣱\",\"⣲\",\"⣳\",\"⣴\",\"⣵\",\"⣶\",\"⣷\",\"⢸\",\"⢹\",\"⢺\",\"⢻\",\"⢼\",\"⢽\",\"⢾\",\"⢿\",\"⣸\",\"⣹\",\"⣺\",\"⣻\",\"⣼\",\"⣽\",\"⣾\",\"⣿\"]},\"line\":{\"interval\":130,\"frames\":[\"-\",\"\\\\\",\"|\",\"/\"]},\"line2\":{\"interval\":100,\"frames\":[\"⠂\",\"-\",\"–\",\"—\",\"–\",\"-\"]},\"pipe\":{\"interval\":100,\"frames\":[\"┤\",\"┘\",\"┴\",\"└\",\"├\",\"┌\",\"┬\",\"┐\"]},\"simpleDots\":{\"interval\":400,\"frames\":[\". \",\".. \",\"...\",\" \"]},\"simpleDotsScrolling\":{\"interval\":200,\"frames\":[\". \",\".. \",\"...\",\" ..\",\" .\",\" \"]},\"star\":{\"interval\":70,\"frames\":[\"✶\",\"✸\",\"✹\",\"✺\",\"✹\",\"✷\"]},\"star2\":{\"interval\":80,\"frames\":[\"+\",\"x\",\"*\"]},\"flip\":{\"interval\":70,\"frames\":[\"_\",\"_\",\"_\",\"-\",\"`\",\"`\",\"'\",\"´\",\"-\",\"_\",\"_\",\"_\"]},\"hamburger\":{\"interval\":100,\"frames\":[\"☱\",\"☲\",\"☴\"]},\"growVertical\":{\"interval\":120,\"frames\":[\"▁\",\"▃\",\"▄\",\"▅\",\"▆\",\"▇\",\"▆\",\"▅\",\"▄\",\"▃\"]},\"growHorizontal\":{\"interval\":120,\"frames\":[\"▏\",\"▎\",\"▍\",\"▌\",\"▋\",\"▊\",\"▉\",\"▊\",\"▋\",\"▌\",\"▍\",\"▎\"]},\"balloon\":{\"interval\":140,\"frames\":[\" \",\".\",\"o\",\"O\",\"@\",\"*\",\" \"]},\"balloon2\":{\"interval\":120,\"frames\":[\".\",\"o\",\"O\",\"°\",\"O\",\"o\",\".\"]},\"noise\":{\"interval\":100,\"frames\":[\"▓\",\"▒\",\"░\"]},\"bounce\":{\"interval\":120,\"frames\":[\"⠁\",\"⠂\",\"⠄\",\"⠂\"]},\"boxBounce\":{\"interval\":120,\"frames\":[\"▖\",\"▘\",\"▝\",\"▗\"]},\"boxBounce2\":{\"interval\":100,\"frames\":[\"▌\",\"▀\",\"▐\",\"▄\"]},\"triangle\":{\"interval\":50,\"frames\":[\"◢\",\"◣\",\"◤\",\"◥\"]},\"arc\":{\"interval\":100,\"frames\":[\"◜\",\"◠\",\"◝\",\"◞\",\"◡\",\"◟\"]},\"circle\":{\"interval\":120,\"frames\":[\"◡\",\"⊙\",\"◠\"]},\"squareCorners\":{\"interval\":180,\"frames\":[\"◰\",\"◳\",\"◲\",\"◱\"]},\"circleQuarters\":{\"interval\":120,\"frames\":[\"◴\",\"◷\",\"◶\",\"◵\"]},\"circleHalves\":{\"interval\":50,\"frames\":[\"◐\",\"◓\",\"◑\",\"◒\"]},\"squish\":{\"interval\":100,\"frames\":[\"╫\",\"╪\"]},\"toggle\":{\"interval\":250,\"frames\":[\"⊶\",\"⊷\"]},\"toggle2\":{\"interval\":80,\"frames\":[\"▫\",\"▪\"]},\"toggle3\":{\"interval\":120,\"frames\":[\"□\",\"■\"]},\"toggle4\":{\"interval\":100,\"frames\":[\"■\",\"□\",\"▪\",\"▫\"]},\"toggle5\":{\"interval\":100,\"frames\":[\"▮\",\"▯\"]},\"toggle6\":{\"interval\":300,\"frames\":[\"ဝ\",\"၀\"]},\"toggle7\":{\"interval\":80,\"frames\":[\"⦾\",\"⦿\"]},\"toggle8\":{\"interval\":100,\"frames\":[\"◍\",\"◌\"]},\"toggle9\":{\"interval\":100,\"frames\":[\"◉\",\"◎\"]},\"toggle10\":{\"interval\":100,\"frames\":[\"㊂\",\"㊀\",\"㊁\"]},\"toggle11\":{\"interval\":50,\"frames\":[\"⧇\",\"⧆\"]},\"toggle12\":{\"interval\":120,\"frames\":[\"☗\",\"☖\"]},\"toggle13\":{\"interval\":80,\"frames\":[\"=\",\"*\",\"-\"]},\"arrow\":{\"interval\":100,\"frames\":[\"←\",\"↖\",\"↑\",\"↗\",\"→\",\"↘\",\"↓\",\"↙\"]},\"arrow2\":{\"interval\":80,\"frames\":[\"⬆️ \",\"↗️ \",\"➡️ \",\"↘️ \",\"⬇️ \",\"↙️ \",\"⬅️ \",\"↖️ \"]},\"arrow3\":{\"interval\":120,\"frames\":[\"▹▹▹▹▹\",\"▸▹▹▹▹\",\"▹▸▹▹▹\",\"▹▹▸▹▹\",\"▹▹▹▸▹\",\"▹▹▹▹▸\"]},\"bouncingBar\":{\"interval\":80,\"frames\":[\"[ ]\",\"[= ]\",\"[== ]\",\"[=== ]\",\"[ ===]\",\"[ ==]\",\"[ =]\",\"[ ]\",\"[ =]\",\"[ ==]\",\"[ ===]\",\"[====]\",\"[=== ]\",\"[== ]\",\"[= ]\"]},\"bouncingBall\":{\"interval\":80,\"frames\":[\"( ● )\",\"( ● )\",\"( ● )\",\"( ● )\",\"( ●)\",\"( ● )\",\"( ● )\",\"( ● )\",\"( ● )\",\"(● )\"]},\"smiley\":{\"interval\":200,\"frames\":[\"😄 \",\"😝 \"]},\"monkey\":{\"interval\":300,\"frames\":[\"🙈 \",\"🙈 \",\"🙉 \",\"🙊 \"]},\"hearts\":{\"interval\":100,\"frames\":[\"💛 \",\"💙 \",\"💜 \",\"💚 \",\"❤️ \"]},\"clock\":{\"interval\":100,\"frames\":[\"🕛 \",\"🕐 \",\"🕑 \",\"🕒 \",\"🕓 \",\"🕔 \",\"🕕 \",\"🕖 \",\"🕗 \",\"🕘 \",\"🕙 \",\"🕚 \"]},\"earth\":{\"interval\":180,\"frames\":[\"🌍 \",\"🌎 \",\"🌏 \"]},\"material\":{\"interval\":17,\"frames\":[\"█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"███████▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"████████▁▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"██████████▁▁▁▁▁▁▁▁▁▁\",\"███████████▁▁▁▁▁▁▁▁▁\",\"█████████████▁▁▁▁▁▁▁\",\"██████████████▁▁▁▁▁▁\",\"██████████████▁▁▁▁▁▁\",\"▁██████████████▁▁▁▁▁\",\"▁██████████████▁▁▁▁▁\",\"▁██████████████▁▁▁▁▁\",\"▁▁██████████████▁▁▁▁\",\"▁▁▁██████████████▁▁▁\",\"▁▁▁▁█████████████▁▁▁\",\"▁▁▁▁██████████████▁▁\",\"▁▁▁▁██████████████▁▁\",\"▁▁▁▁▁██████████████▁\",\"▁▁▁▁▁██████████████▁\",\"▁▁▁▁▁██████████████▁\",\"▁▁▁▁▁▁██████████████\",\"▁▁▁▁▁▁██████████████\",\"▁▁▁▁▁▁▁█████████████\",\"▁▁▁▁▁▁▁█████████████\",\"▁▁▁▁▁▁▁▁████████████\",\"▁▁▁▁▁▁▁▁████████████\",\"▁▁▁▁▁▁▁▁▁███████████\",\"▁▁▁▁▁▁▁▁▁███████████\",\"▁▁▁▁▁▁▁▁▁▁██████████\",\"▁▁▁▁▁▁▁▁▁▁██████████\",\"▁▁▁▁▁▁▁▁▁▁▁▁████████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁███████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████\",\"█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████\",\"██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███\",\"██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███\",\"███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███\",\"████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██\",\"█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"██████▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"████████▁▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"█████████▁▁▁▁▁▁▁▁▁▁▁\",\"███████████▁▁▁▁▁▁▁▁▁\",\"████████████▁▁▁▁▁▁▁▁\",\"████████████▁▁▁▁▁▁▁▁\",\"██████████████▁▁▁▁▁▁\",\"██████████████▁▁▁▁▁▁\",\"▁██████████████▁▁▁▁▁\",\"▁██████████████▁▁▁▁▁\",\"▁▁▁█████████████▁▁▁▁\",\"▁▁▁▁▁████████████▁▁▁\",\"▁▁▁▁▁████████████▁▁▁\",\"▁▁▁▁▁▁███████████▁▁▁\",\"▁▁▁▁▁▁▁▁█████████▁▁▁\",\"▁▁▁▁▁▁▁▁█████████▁▁▁\",\"▁▁▁▁▁▁▁▁▁█████████▁▁\",\"▁▁▁▁▁▁▁▁▁█████████▁▁\",\"▁▁▁▁▁▁▁▁▁▁█████████▁\",\"▁▁▁▁▁▁▁▁▁▁▁████████▁\",\"▁▁▁▁▁▁▁▁▁▁▁████████▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁███████▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁███████▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁███████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁███████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\",\"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\"]},\"moon\":{\"interval\":80,\"frames\":[\"🌑 \",\"🌒 \",\"🌓 \",\"🌔 \",\"🌕 \",\"🌖 \",\"🌗 \",\"🌘 \"]},\"runner\":{\"interval\":140,\"frames\":[\"🚶 \",\"🏃 \"]},\"pong\":{\"interval\":80,\"frames\":[\"▐⠂ ▌\",\"▐⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂▌\",\"▐ ⠠▌\",\"▐ ⡀▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐⠠ ▌\"]},\"shark\":{\"interval\":120,\"frames\":[\"▐|\\\\____________▌\",\"▐_|\\\\___________▌\",\"▐__|\\\\__________▌\",\"▐___|\\\\_________▌\",\"▐____|\\\\________▌\",\"▐_____|\\\\_______▌\",\"▐______|\\\\______▌\",\"▐_______|\\\\_____▌\",\"▐________|\\\\____▌\",\"▐_________|\\\\___▌\",\"▐__________|\\\\__▌\",\"▐___________|\\\\_▌\",\"▐____________|\\\\▌\",\"▐____________/|▌\",\"▐___________/|_▌\",\"▐__________/|__▌\",\"▐_________/|___▌\",\"▐________/|____▌\",\"▐_______/|_____▌\",\"▐______/|______▌\",\"▐_____/|_______▌\",\"▐____/|________▌\",\"▐___/|_________▌\",\"▐__/|__________▌\",\"▐_/|___________▌\",\"▐/|____________▌\"]},\"dqpb\":{\"interval\":100,\"frames\":[\"d\",\"q\",\"p\",\"b\"]},\"weather\":{\"interval\":100,\"frames\":[\"☀️ \",\"☀️ \",\"☀️ \",\"🌤 \",\"⛅️ \",\"🌥 \",\"☁️ \",\"🌧 \",\"🌨 \",\"🌧 \",\"🌨 \",\"🌧 \",\"🌨 \",\"⛈ \",\"🌨 \",\"🌧 \",\"🌨 \",\"☁️ \",\"🌥 \",\"⛅️ \",\"🌤 \",\"☀️ \",\"☀️ \"]},\"christmas\":{\"interval\":400,\"frames\":[\"🌲\",\"🎄\"]},\"grenade\":{\"interval\":80,\"frames\":[\"، \",\"′ \",\" ´ \",\" ‾ \",\" ⸌\",\" ⸊\",\" |\",\" ⁎\",\" ⁕\",\" ෴ \",\" ⁓\",\" \",\" \",\" \"]},\"point\":{\"interval\":125,\"frames\":[\"∙∙∙\",\"●∙∙\",\"∙●∙\",\"∙∙●\",\"∙∙∙\"]},\"layer\":{\"interval\":150,\"frames\":[\"-\",\"=\",\"≡\"]},\"betaWave\":{\"interval\":80,\"frames\":[\"ρββββββ\",\"βρβββββ\",\"ββρββββ\",\"βββρβββ\",\"ββββρββ\",\"βββββρβ\",\"ββββββρ\"]}}");
/***/ }),
-/* 384 */
+/* 378 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const chalk = __webpack_require__(385);
+const chalk = __webpack_require__(379);
const isSupported = process.platform !== 'win32' || process.env.CI || process.env.TERM === 'xterm-256color';
@@ -48097,16 +47623,16 @@ module.exports = isSupported ? main : fallbacks;
/***/ }),
-/* 385 */
+/* 379 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const escapeStringRegexp = __webpack_require__(178);
-const ansiStyles = __webpack_require__(386);
-const stdoutColor = __webpack_require__(184).stdout;
+const ansiStyles = __webpack_require__(380);
+const stdoutColor = __webpack_require__(381).stdout;
-const template = __webpack_require__(387);
+const template = __webpack_require__(383);
const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');
@@ -48332,7 +47858,7 @@ module.exports.default = module.exports; // For TypeScript
/***/ }),
-/* 386 */
+/* 380 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -48505,7 +48031,160 @@ Object.defineProperty(module, 'exports', {
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(114)(module)))
/***/ }),
-/* 387 */
+/* 381 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+const os = __webpack_require__(120);
+const hasFlag = __webpack_require__(382);
+
+const env = process.env;
+
+let forceColor;
+if (hasFlag('no-color') ||
+ hasFlag('no-colors') ||
+ hasFlag('color=false')) {
+ forceColor = false;
+} else if (hasFlag('color') ||
+ hasFlag('colors') ||
+ hasFlag('color=true') ||
+ hasFlag('color=always')) {
+ forceColor = true;
+}
+if ('FORCE_COLOR' in env) {
+ forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
+}
+
+function translateLevel(level) {
+ if (level === 0) {
+ return false;
+ }
+
+ return {
+ level,
+ hasBasic: true,
+ has256: level >= 2,
+ has16m: level >= 3
+ };
+}
+
+function supportsColor(stream) {
+ if (forceColor === false) {
+ return 0;
+ }
+
+ if (hasFlag('color=16m') ||
+ hasFlag('color=full') ||
+ hasFlag('color=truecolor')) {
+ return 3;
+ }
+
+ if (hasFlag('color=256')) {
+ return 2;
+ }
+
+ if (stream && !stream.isTTY && forceColor !== true) {
+ return 0;
+ }
+
+ const min = forceColor ? 1 : 0;
+
+ if (process.platform === 'win32') {
+ // Node.js 7.5.0 is the first version of Node.js to include a patch to
+ // libuv that enables 256 color output on Windows. Anything earlier and it
+ // won't work. However, here we target Node.js 8 at minimum as it is an LTS
+ // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
+ // release that supports 256 colors. Windows 10 build 14931 is the first release
+ // that supports 16m/TrueColor.
+ const osRelease = os.release().split('.');
+ if (
+ Number(process.versions.node.split('.')[0]) >= 8 &&
+ Number(osRelease[0]) >= 10 &&
+ Number(osRelease[2]) >= 10586
+ ) {
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
+ }
+
+ return 1;
+ }
+
+ if ('CI' in env) {
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
+ return 1;
+ }
+
+ return min;
+ }
+
+ if ('TEAMCITY_VERSION' in env) {
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
+ }
+
+ if (env.COLORTERM === 'truecolor') {
+ return 3;
+ }
+
+ if ('TERM_PROGRAM' in env) {
+ const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
+
+ switch (env.TERM_PROGRAM) {
+ case 'iTerm.app':
+ return version >= 3 ? 3 : 2;
+ case 'Apple_Terminal':
+ return 2;
+ // No default
+ }
+ }
+
+ if (/-256(color)?$/i.test(env.TERM)) {
+ return 2;
+ }
+
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
+ return 1;
+ }
+
+ if ('COLORTERM' in env) {
+ return 1;
+ }
+
+ if (env.TERM === 'dumb') {
+ return min;
+ }
+
+ return min;
+}
+
+function getSupportLevel(stream) {
+ const level = supportsColor(stream);
+ return translateLevel(level);
+}
+
+module.exports = {
+ supportsColor: getSupportLevel,
+ stdout: getSupportLevel(process.stdout),
+ stderr: getSupportLevel(process.stderr)
+};
+
+
+/***/ }),
+/* 382 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+module.exports = (flag, argv) => {
+ argv = argv || process.argv;
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
+ const pos = argv.indexOf(prefix + flag);
+ const terminatorPos = argv.indexOf('--');
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
+};
+
+
+/***/ }),
+/* 383 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -48639,8 +48318,555 @@ module.exports = (chalk, tmp) => {
};
+/***/ }),
+/* 384 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+const ansiRegex = __webpack_require__(385);
+
+module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
+
+
+/***/ }),
+/* 385 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+module.exports = ({onlyFirst = false} = {}) => {
+ const pattern = [
+ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
+ ].join('|');
+
+ return new RegExp(pattern, onlyFirst ? undefined : 'g');
+};
+
+
+/***/ }),
+/* 386 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var defaults = __webpack_require__(387)
+var combining = __webpack_require__(389)
+
+var DEFAULTS = {
+ nul: 0,
+ control: 0
+}
+
+module.exports = function wcwidth(str) {
+ return wcswidth(str, DEFAULTS)
+}
+
+module.exports.config = function(opts) {
+ opts = defaults(opts || {}, DEFAULTS)
+ return function wcwidth(str) {
+ return wcswidth(str, opts)
+ }
+}
+
+/*
+ * The following functions define the column width of an ISO 10646
+ * character as follows:
+ * - The null character (U+0000) has a column width of 0.
+ * - Other C0/C1 control characters and DEL will lead to a return value
+ * of -1.
+ * - Non-spacing and enclosing combining characters (general category
+ * code Mn or Me in the
+ * Unicode database) have a column width of 0.
+ * - SOFT HYPHEN (U+00AD) has a column width of 1.
+ * - Other format characters (general category code Cf in the Unicode
+ * database) and ZERO WIDTH
+ * SPACE (U+200B) have a column width of 0.
+ * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF)
+ * have a column width of 0.
+ * - Spacing characters in the East Asian Wide (W) or East Asian
+ * Full-width (F) category as
+ * defined in Unicode Technical Report #11 have a column width of 2.
+ * - All remaining characters (including all printable ISO 8859-1 and
+ * WGL4 characters, Unicode control characters, etc.) have a column
+ * width of 1.
+ * This implementation assumes that characters are encoded in ISO 10646.
+*/
+
+function wcswidth(str, opts) {
+ if (typeof str !== 'string') return wcwidth(str, opts)
+
+ var s = 0
+ for (var i = 0; i < str.length; i++) {
+ var n = wcwidth(str.charCodeAt(i), opts)
+ if (n < 0) return -1
+ s += n
+ }
+
+ return s
+}
+
+function wcwidth(ucs, opts) {
+ // test for 8-bit control characters
+ if (ucs === 0) return opts.nul
+ if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) return opts.control
+
+ // binary search in table of non-spacing characters
+ if (bisearch(ucs)) return 0
+
+ // if we arrive here, ucs is not a combining or C0/C1 control character
+ return 1 +
+ (ucs >= 0x1100 &&
+ (ucs <= 0x115f || // Hangul Jamo init. consonants
+ ucs == 0x2329 || ucs == 0x232a ||
+ (ucs >= 0x2e80 && ucs <= 0xa4cf &&
+ ucs != 0x303f) || // CJK ... Yi
+ (ucs >= 0xac00 && ucs <= 0xd7a3) || // Hangul Syllables
+ (ucs >= 0xf900 && ucs <= 0xfaff) || // CJK Compatibility Ideographs
+ (ucs >= 0xfe10 && ucs <= 0xfe19) || // Vertical forms
+ (ucs >= 0xfe30 && ucs <= 0xfe6f) || // CJK Compatibility Forms
+ (ucs >= 0xff00 && ucs <= 0xff60) || // Fullwidth Forms
+ (ucs >= 0xffe0 && ucs <= 0xffe6) ||
+ (ucs >= 0x20000 && ucs <= 0x2fffd) ||
+ (ucs >= 0x30000 && ucs <= 0x3fffd)));
+}
+
+function bisearch(ucs) {
+ var min = 0
+ var max = combining.length - 1
+ var mid
+
+ if (ucs < combining[0][0] || ucs > combining[max][1]) return false
+
+ while (max >= min) {
+ mid = Math.floor((min + max) / 2)
+ if (ucs > combining[mid][1]) min = mid + 1
+ else if (ucs < combining[mid][0]) max = mid - 1
+ else return true
+ }
+
+ return false
+}
+
+
+/***/ }),
+/* 387 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var clone = __webpack_require__(388);
+
+module.exports = function(options, defaults) {
+ options = options || {};
+
+ Object.keys(defaults).forEach(function(key) {
+ if (typeof options[key] === 'undefined') {
+ options[key] = clone(defaults[key]);
+ }
+ });
+
+ return options;
+};
+
/***/ }),
/* 388 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var clone = (function() {
+'use strict';
+
+/**
+ * Clones (copies) an Object using deep copying.
+ *
+ * This function supports circular references by default, but if you are certain
+ * there are no circular references in your object, you can save some CPU time
+ * by calling clone(obj, false).
+ *
+ * Caution: if `circular` is false and `parent` contains circular references,
+ * your program may enter an infinite loop and crash.
+ *
+ * @param `parent` - the object to be cloned
+ * @param `circular` - set to true if the object to be cloned may contain
+ * circular references. (optional - true by default)
+ * @param `depth` - set to a number if the object is only to be cloned to
+ * a particular depth. (optional - defaults to Infinity)
+ * @param `prototype` - sets the prototype to be used when cloning an object.
+ * (optional - defaults to parent prototype).
+*/
+function clone(parent, circular, depth, prototype) {
+ var filter;
+ if (typeof circular === 'object') {
+ depth = circular.depth;
+ prototype = circular.prototype;
+ filter = circular.filter;
+ circular = circular.circular
+ }
+ // maintain two arrays for circular references, where corresponding parents
+ // and children have the same index
+ var allParents = [];
+ var allChildren = [];
+
+ var useBuffer = typeof Buffer != 'undefined';
+
+ if (typeof circular == 'undefined')
+ circular = true;
+
+ if (typeof depth == 'undefined')
+ depth = Infinity;
+
+ // recurse this function so we don't reset allParents and allChildren
+ function _clone(parent, depth) {
+ // cloning null always returns null
+ if (parent === null)
+ return null;
+
+ if (depth == 0)
+ return parent;
+
+ var child;
+ var proto;
+ if (typeof parent != 'object') {
+ return parent;
+ }
+
+ if (clone.__isArray(parent)) {
+ child = [];
+ } else if (clone.__isRegExp(parent)) {
+ child = new RegExp(parent.source, __getRegExpFlags(parent));
+ if (parent.lastIndex) child.lastIndex = parent.lastIndex;
+ } else if (clone.__isDate(parent)) {
+ child = new Date(parent.getTime());
+ } else if (useBuffer && Buffer.isBuffer(parent)) {
+ if (Buffer.allocUnsafe) {
+ // Node.js >= 4.5.0
+ child = Buffer.allocUnsafe(parent.length);
+ } else {
+ // Older Node.js versions
+ child = new Buffer(parent.length);
+ }
+ parent.copy(child);
+ return child;
+ } else {
+ if (typeof prototype == 'undefined') {
+ proto = Object.getPrototypeOf(parent);
+ child = Object.create(proto);
+ }
+ else {
+ child = Object.create(prototype);
+ proto = prototype;
+ }
+ }
+
+ if (circular) {
+ var index = allParents.indexOf(parent);
+
+ if (index != -1) {
+ return allChildren[index];
+ }
+ allParents.push(parent);
+ allChildren.push(child);
+ }
+
+ for (var i in parent) {
+ var attrs;
+ if (proto) {
+ attrs = Object.getOwnPropertyDescriptor(proto, i);
+ }
+
+ if (attrs && attrs.set == null) {
+ continue;
+ }
+ child[i] = _clone(parent[i], depth - 1);
+ }
+
+ return child;
+ }
+
+ return _clone(parent, depth);
+}
+
+/**
+ * Simple flat clone using prototype, accepts only objects, usefull for property
+ * override on FLAT configuration object (no nested props).
+ *
+ * USE WITH CAUTION! This may not behave as you wish if you do not know how this
+ * works.
+ */
+clone.clonePrototype = function clonePrototype(parent) {
+ if (parent === null)
+ return null;
+
+ var c = function () {};
+ c.prototype = parent;
+ return new c();
+};
+
+// private utility functions
+
+function __objToStr(o) {
+ return Object.prototype.toString.call(o);
+};
+clone.__objToStr = __objToStr;
+
+function __isDate(o) {
+ return typeof o === 'object' && __objToStr(o) === '[object Date]';
+};
+clone.__isDate = __isDate;
+
+function __isArray(o) {
+ return typeof o === 'object' && __objToStr(o) === '[object Array]';
+};
+clone.__isArray = __isArray;
+
+function __isRegExp(o) {
+ return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
+};
+clone.__isRegExp = __isRegExp;
+
+function __getRegExpFlags(re) {
+ var flags = '';
+ if (re.global) flags += 'g';
+ if (re.ignoreCase) flags += 'i';
+ if (re.multiline) flags += 'm';
+ return flags;
+};
+clone.__getRegExpFlags = __getRegExpFlags;
+
+return clone;
+})();
+
+if ( true && module.exports) {
+ module.exports = clone;
+}
+
+
+/***/ }),
+/* 389 */
+/***/ (function(module, exports) {
+
+module.exports = [
+ [ 0x0300, 0x036F ], [ 0x0483, 0x0486 ], [ 0x0488, 0x0489 ],
+ [ 0x0591, 0x05BD ], [ 0x05BF, 0x05BF ], [ 0x05C1, 0x05C2 ],
+ [ 0x05C4, 0x05C5 ], [ 0x05C7, 0x05C7 ], [ 0x0600, 0x0603 ],
+ [ 0x0610, 0x0615 ], [ 0x064B, 0x065E ], [ 0x0670, 0x0670 ],
+ [ 0x06D6, 0x06E4 ], [ 0x06E7, 0x06E8 ], [ 0x06EA, 0x06ED ],
+ [ 0x070F, 0x070F ], [ 0x0711, 0x0711 ], [ 0x0730, 0x074A ],
+ [ 0x07A6, 0x07B0 ], [ 0x07EB, 0x07F3 ], [ 0x0901, 0x0902 ],
+ [ 0x093C, 0x093C ], [ 0x0941, 0x0948 ], [ 0x094D, 0x094D ],
+ [ 0x0951, 0x0954 ], [ 0x0962, 0x0963 ], [ 0x0981, 0x0981 ],
+ [ 0x09BC, 0x09BC ], [ 0x09C1, 0x09C4 ], [ 0x09CD, 0x09CD ],
+ [ 0x09E2, 0x09E3 ], [ 0x0A01, 0x0A02 ], [ 0x0A3C, 0x0A3C ],
+ [ 0x0A41, 0x0A42 ], [ 0x0A47, 0x0A48 ], [ 0x0A4B, 0x0A4D ],
+ [ 0x0A70, 0x0A71 ], [ 0x0A81, 0x0A82 ], [ 0x0ABC, 0x0ABC ],
+ [ 0x0AC1, 0x0AC5 ], [ 0x0AC7, 0x0AC8 ], [ 0x0ACD, 0x0ACD ],
+ [ 0x0AE2, 0x0AE3 ], [ 0x0B01, 0x0B01 ], [ 0x0B3C, 0x0B3C ],
+ [ 0x0B3F, 0x0B3F ], [ 0x0B41, 0x0B43 ], [ 0x0B4D, 0x0B4D ],
+ [ 0x0B56, 0x0B56 ], [ 0x0B82, 0x0B82 ], [ 0x0BC0, 0x0BC0 ],
+ [ 0x0BCD, 0x0BCD ], [ 0x0C3E, 0x0C40 ], [ 0x0C46, 0x0C48 ],
+ [ 0x0C4A, 0x0C4D ], [ 0x0C55, 0x0C56 ], [ 0x0CBC, 0x0CBC ],
+ [ 0x0CBF, 0x0CBF ], [ 0x0CC6, 0x0CC6 ], [ 0x0CCC, 0x0CCD ],
+ [ 0x0CE2, 0x0CE3 ], [ 0x0D41, 0x0D43 ], [ 0x0D4D, 0x0D4D ],
+ [ 0x0DCA, 0x0DCA ], [ 0x0DD2, 0x0DD4 ], [ 0x0DD6, 0x0DD6 ],
+ [ 0x0E31, 0x0E31 ], [ 0x0E34, 0x0E3A ], [ 0x0E47, 0x0E4E ],
+ [ 0x0EB1, 0x0EB1 ], [ 0x0EB4, 0x0EB9 ], [ 0x0EBB, 0x0EBC ],
+ [ 0x0EC8, 0x0ECD ], [ 0x0F18, 0x0F19 ], [ 0x0F35, 0x0F35 ],
+ [ 0x0F37, 0x0F37 ], [ 0x0F39, 0x0F39 ], [ 0x0F71, 0x0F7E ],
+ [ 0x0F80, 0x0F84 ], [ 0x0F86, 0x0F87 ], [ 0x0F90, 0x0F97 ],
+ [ 0x0F99, 0x0FBC ], [ 0x0FC6, 0x0FC6 ], [ 0x102D, 0x1030 ],
+ [ 0x1032, 0x1032 ], [ 0x1036, 0x1037 ], [ 0x1039, 0x1039 ],
+ [ 0x1058, 0x1059 ], [ 0x1160, 0x11FF ], [ 0x135F, 0x135F ],
+ [ 0x1712, 0x1714 ], [ 0x1732, 0x1734 ], [ 0x1752, 0x1753 ],
+ [ 0x1772, 0x1773 ], [ 0x17B4, 0x17B5 ], [ 0x17B7, 0x17BD ],
+ [ 0x17C6, 0x17C6 ], [ 0x17C9, 0x17D3 ], [ 0x17DD, 0x17DD ],
+ [ 0x180B, 0x180D ], [ 0x18A9, 0x18A9 ], [ 0x1920, 0x1922 ],
+ [ 0x1927, 0x1928 ], [ 0x1932, 0x1932 ], [ 0x1939, 0x193B ],
+ [ 0x1A17, 0x1A18 ], [ 0x1B00, 0x1B03 ], [ 0x1B34, 0x1B34 ],
+ [ 0x1B36, 0x1B3A ], [ 0x1B3C, 0x1B3C ], [ 0x1B42, 0x1B42 ],
+ [ 0x1B6B, 0x1B73 ], [ 0x1DC0, 0x1DCA ], [ 0x1DFE, 0x1DFF ],
+ [ 0x200B, 0x200F ], [ 0x202A, 0x202E ], [ 0x2060, 0x2063 ],
+ [ 0x206A, 0x206F ], [ 0x20D0, 0x20EF ], [ 0x302A, 0x302F ],
+ [ 0x3099, 0x309A ], [ 0xA806, 0xA806 ], [ 0xA80B, 0xA80B ],
+ [ 0xA825, 0xA826 ], [ 0xFB1E, 0xFB1E ], [ 0xFE00, 0xFE0F ],
+ [ 0xFE20, 0xFE23 ], [ 0xFEFF, 0xFEFF ], [ 0xFFF9, 0xFFFB ],
+ [ 0x10A01, 0x10A03 ], [ 0x10A05, 0x10A06 ], [ 0x10A0C, 0x10A0F ],
+ [ 0x10A38, 0x10A3A ], [ 0x10A3F, 0x10A3F ], [ 0x1D167, 0x1D169 ],
+ [ 0x1D173, 0x1D182 ], [ 0x1D185, 0x1D18B ], [ 0x1D1AA, 0x1D1AD ],
+ [ 0x1D242, 0x1D244 ], [ 0xE0001, 0xE0001 ], [ 0xE0020, 0xE007F ],
+ [ 0xE0100, 0xE01EF ]
+]
+
+
+/***/ }),
+/* 390 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+module.exports = ({stream = process.stdout} = {}) => {
+ return Boolean(
+ stream && stream.isTTY &&
+ process.env.TERM !== 'dumb' &&
+ !('CI' in process.env)
+ );
+};
+
+
+/***/ }),
+/* 391 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var Stream = __webpack_require__(137)
+
+module.exports = MuteStream
+
+// var out = new MuteStream(process.stdout)
+// argument auto-pipes
+function MuteStream (opts) {
+ Stream.apply(this)
+ opts = opts || {}
+ this.writable = this.readable = true
+ this.muted = false
+ this.on('pipe', this._onpipe)
+ this.replace = opts.replace
+
+ // For readline-type situations
+ // This much at the start of a line being redrawn after a ctrl char
+ // is seen (such as backspace) won't be redrawn as the replacement
+ this._prompt = opts.prompt || null
+ this._hadControl = false
+}
+
+MuteStream.prototype = Object.create(Stream.prototype)
+
+Object.defineProperty(MuteStream.prototype, 'constructor', {
+ value: MuteStream,
+ enumerable: false
+})
+
+MuteStream.prototype.mute = function () {
+ this.muted = true
+}
+
+MuteStream.prototype.unmute = function () {
+ this.muted = false
+}
+
+Object.defineProperty(MuteStream.prototype, '_onpipe', {
+ value: onPipe,
+ enumerable: false,
+ writable: true,
+ configurable: true
+})
+
+function onPipe (src) {
+ this._src = src
+}
+
+Object.defineProperty(MuteStream.prototype, 'isTTY', {
+ get: getIsTTY,
+ set: setIsTTY,
+ enumerable: true,
+ configurable: true
+})
+
+function getIsTTY () {
+ return( (this._dest) ? this._dest.isTTY
+ : (this._src) ? this._src.isTTY
+ : false
+ )
+}
+
+// basically just get replace the getter/setter with a regular value
+function setIsTTY (isTTY) {
+ Object.defineProperty(this, 'isTTY', {
+ value: isTTY,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ })
+}
+
+Object.defineProperty(MuteStream.prototype, 'rows', {
+ get: function () {
+ return( this._dest ? this._dest.rows
+ : this._src ? this._src.rows
+ : undefined )
+ }, enumerable: true, configurable: true })
+
+Object.defineProperty(MuteStream.prototype, 'columns', {
+ get: function () {
+ return( this._dest ? this._dest.columns
+ : this._src ? this._src.columns
+ : undefined )
+ }, enumerable: true, configurable: true })
+
+
+MuteStream.prototype.pipe = function (dest, options) {
+ this._dest = dest
+ return Stream.prototype.pipe.call(this, dest, options)
+}
+
+MuteStream.prototype.pause = function () {
+ if (this._src) return this._src.pause()
+}
+
+MuteStream.prototype.resume = function () {
+ if (this._src) return this._src.resume()
+}
+
+MuteStream.prototype.write = function (c) {
+ if (this.muted) {
+ if (!this.replace) return true
+ if (c.match(/^\u001b/)) {
+ if(c.indexOf(this._prompt) === 0) {
+ c = c.substr(this._prompt.length);
+ c = c.replace(/./g, this.replace);
+ c = this._prompt + c;
+ }
+ this._hadControl = true
+ return this.emit('data', c)
+ } else {
+ if (this._prompt && this._hadControl &&
+ c.indexOf(this._prompt) === 0) {
+ this._hadControl = false
+ this.emit('data', this._prompt)
+ c = c.substr(this._prompt.length)
+ }
+ c = c.toString().replace(/./g, this.replace)
+ }
+ }
+ this.emit('data', c)
+}
+
+MuteStream.prototype.end = function (c) {
+ if (this.muted) {
+ if (c && this.replace) {
+ c = c.toString().replace(/./g, this.replace)
+ } else {
+ c = null
+ }
+ }
+ if (c) this.emit('data', c)
+ this.emit('end')
+}
+
+function proxy (fn) { return function () {
+ var d = this._dest
+ var s = this._src
+ if (d && d[fn]) d[fn].apply(d, arguments)
+ if (s && s[fn]) s[fn].apply(s, arguments)
+}}
+
+MuteStream.prototype.destroy = proxy('destroy')
+MuteStream.prototype.destroySoon = proxy('destroySoon')
+MuteStream.prototype.close = proxy('close')
+
+
+/***/ }),
+/* 392 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -48701,7 +48927,7 @@ const RunCommand = {
};
/***/ }),
-/* 389 */
+/* 393 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -48711,7 +48937,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(143);
/* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(144);
/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(145);
-/* harmony import */ var _utils_watch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(390);
+/* harmony import */ var _utils_watch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(394);
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
@@ -48796,14 +49022,14 @@ const WatchCommand = {
};
/***/ }),
-/* 390 */
+/* 394 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "waitUntilWatchIsReady", function() { return waitUntilWatchIsReady; });
/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
-/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(391);
+/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(395);
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
@@ -48870,141 +49096,141 @@ function waitUntilWatchIsReady(stream, opts = {}) {
}
/***/ }),
-/* 391 */
+/* 395 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(392);
+/* harmony import */ var _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(396);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "audit", function() { return _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__["audit"]; });
-/* harmony import */ var _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(393);
+/* harmony import */ var _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(397);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "auditTime", function() { return _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__["auditTime"]; });
-/* harmony import */ var _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(394);
+/* harmony import */ var _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(398);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buffer", function() { return _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__["buffer"]; });
-/* harmony import */ var _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(395);
+/* harmony import */ var _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(399);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferCount", function() { return _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__["bufferCount"]; });
-/* harmony import */ var _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(396);
+/* harmony import */ var _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(400);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferTime", function() { return _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__["bufferTime"]; });
-/* harmony import */ var _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(397);
+/* harmony import */ var _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(401);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferToggle", function() { return _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__["bufferToggle"]; });
-/* harmony import */ var _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(398);
+/* harmony import */ var _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(402);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferWhen", function() { return _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__["bufferWhen"]; });
-/* harmony import */ var _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(399);
+/* harmony import */ var _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(403);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "catchError", function() { return _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__["catchError"]; });
-/* harmony import */ var _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(400);
+/* harmony import */ var _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(404);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineAll", function() { return _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__["combineAll"]; });
-/* harmony import */ var _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(401);
+/* harmony import */ var _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(405);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function() { return _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__["combineLatest"]; });
-/* harmony import */ var _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(402);
+/* harmony import */ var _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(406);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__["concat"]; });
/* harmony import */ var _internal_operators_concatAll__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(80);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatAll", function() { return _internal_operators_concatAll__WEBPACK_IMPORTED_MODULE_11__["concatAll"]; });
-/* harmony import */ var _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(403);
+/* harmony import */ var _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(407);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatMap", function() { return _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__["concatMap"]; });
-/* harmony import */ var _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(404);
+/* harmony import */ var _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(408);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatMapTo", function() { return _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__["concatMapTo"]; });
-/* harmony import */ var _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(405);
+/* harmony import */ var _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(409);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "count", function() { return _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__["count"]; });
-/* harmony import */ var _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(406);
+/* harmony import */ var _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(410);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__["debounce"]; });
-/* harmony import */ var _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(407);
+/* harmony import */ var _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(411);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounceTime", function() { return _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__["debounceTime"]; });
-/* harmony import */ var _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(408);
+/* harmony import */ var _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(412);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultIfEmpty", function() { return _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__["defaultIfEmpty"]; });
-/* harmony import */ var _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(409);
+/* harmony import */ var _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(413);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__["delay"]; });
-/* harmony import */ var _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(411);
+/* harmony import */ var _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(415);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delayWhen", function() { return _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__["delayWhen"]; });
-/* harmony import */ var _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(412);
+/* harmony import */ var _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(416);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "dematerialize", function() { return _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__["dematerialize"]; });
-/* harmony import */ var _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(413);
+/* harmony import */ var _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(417);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinct", function() { return _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__["distinct"]; });
-/* harmony import */ var _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(414);
+/* harmony import */ var _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(418);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinctUntilChanged", function() { return _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__["distinctUntilChanged"]; });
-/* harmony import */ var _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(415);
+/* harmony import */ var _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(419);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinctUntilKeyChanged", function() { return _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__["distinctUntilKeyChanged"]; });
-/* harmony import */ var _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(416);
+/* harmony import */ var _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(420);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "elementAt", function() { return _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__["elementAt"]; });
-/* harmony import */ var _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(419);
+/* harmony import */ var _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(423);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endWith", function() { return _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__["endWith"]; });
-/* harmony import */ var _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(420);
+/* harmony import */ var _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(424);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "every", function() { return _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__["every"]; });
-/* harmony import */ var _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(421);
+/* harmony import */ var _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(425);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "exhaust", function() { return _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__["exhaust"]; });
-/* harmony import */ var _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(422);
+/* harmony import */ var _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(426);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "exhaustMap", function() { return _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__["exhaustMap"]; });
-/* harmony import */ var _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(423);
+/* harmony import */ var _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(427);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "expand", function() { return _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__["expand"]; });
/* harmony import */ var _internal_operators_filter__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(104);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return _internal_operators_filter__WEBPACK_IMPORTED_MODULE_30__["filter"]; });
-/* harmony import */ var _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(424);
+/* harmony import */ var _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(428);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "finalize", function() { return _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__["finalize"]; });
-/* harmony import */ var _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(425);
+/* harmony import */ var _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(429);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "find", function() { return _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__["find"]; });
-/* harmony import */ var _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(426);
+/* harmony import */ var _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(430);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__["findIndex"]; });
-/* harmony import */ var _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(427);
+/* harmony import */ var _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(431);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "first", function() { return _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__["first"]; });
/* harmony import */ var _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(31);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_35__["groupBy"]; });
-/* harmony import */ var _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(428);
+/* harmony import */ var _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(432);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ignoreElements", function() { return _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__["ignoreElements"]; });
-/* harmony import */ var _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(429);
+/* harmony import */ var _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(433);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__["isEmpty"]; });
-/* harmony import */ var _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(430);
+/* harmony import */ var _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(434);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "last", function() { return _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__["last"]; });
/* harmony import */ var _internal_operators_map__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(66);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "map", function() { return _internal_operators_map__WEBPACK_IMPORTED_MODULE_39__["map"]; });
-/* harmony import */ var _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(432);
+/* harmony import */ var _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(436);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mapTo", function() { return _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__["mapTo"]; });
-/* harmony import */ var _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(433);
+/* harmony import */ var _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(437);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "materialize", function() { return _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__["materialize"]; });
-/* harmony import */ var _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(434);
+/* harmony import */ var _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(438);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "max", function() { return _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__["max"]; });
-/* harmony import */ var _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(437);
+/* harmony import */ var _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(441);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__["merge"]; });
/* harmony import */ var _internal_operators_mergeAll__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(81);
@@ -49015,175 +49241,175 @@ __webpack_require__.r(__webpack_exports__);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flatMap", function() { return _internal_operators_mergeMap__WEBPACK_IMPORTED_MODULE_45__["mergeMap"]; });
-/* harmony import */ var _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(438);
+/* harmony import */ var _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(442);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeMapTo", function() { return _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__["mergeMapTo"]; });
-/* harmony import */ var _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(439);
+/* harmony import */ var _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(443);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeScan", function() { return _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__["mergeScan"]; });
-/* harmony import */ var _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(440);
+/* harmony import */ var _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(444);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "min", function() { return _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__["min"]; });
-/* harmony import */ var _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(441);
+/* harmony import */ var _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(445);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "multicast", function() { return _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__["multicast"]; });
/* harmony import */ var _internal_operators_observeOn__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(41);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "observeOn", function() { return _internal_operators_observeOn__WEBPACK_IMPORTED_MODULE_50__["observeOn"]; });
-/* harmony import */ var _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(442);
+/* harmony import */ var _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(446);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function() { return _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__["onErrorResumeNext"]; });
-/* harmony import */ var _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(443);
+/* harmony import */ var _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(447);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pairwise", function() { return _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__["pairwise"]; });
-/* harmony import */ var _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(444);
+/* harmony import */ var _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(448);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__["partition"]; });
-/* harmony import */ var _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(445);
+/* harmony import */ var _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(449);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__["pluck"]; });
-/* harmony import */ var _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(446);
+/* harmony import */ var _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(450);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publish", function() { return _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__["publish"]; });
-/* harmony import */ var _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(447);
+/* harmony import */ var _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(451);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishBehavior", function() { return _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__["publishBehavior"]; });
-/* harmony import */ var _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(448);
+/* harmony import */ var _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(452);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishLast", function() { return _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__["publishLast"]; });
-/* harmony import */ var _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(449);
+/* harmony import */ var _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(453);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishReplay", function() { return _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__["publishReplay"]; });
-/* harmony import */ var _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(450);
+/* harmony import */ var _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(454);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "race", function() { return _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__["race"]; });
-/* harmony import */ var _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(435);
+/* harmony import */ var _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(439);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__["reduce"]; });
-/* harmony import */ var _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(451);
+/* harmony import */ var _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(455);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeat", function() { return _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__["repeat"]; });
-/* harmony import */ var _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(452);
+/* harmony import */ var _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(456);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeatWhen", function() { return _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__["repeatWhen"]; });
-/* harmony import */ var _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(453);
+/* harmony import */ var _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(457);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retry", function() { return _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__["retry"]; });
-/* harmony import */ var _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(454);
+/* harmony import */ var _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(458);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retryWhen", function() { return _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__["retryWhen"]; });
/* harmony import */ var _internal_operators_refCount__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(30);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "refCount", function() { return _internal_operators_refCount__WEBPACK_IMPORTED_MODULE_65__["refCount"]; });
-/* harmony import */ var _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(455);
+/* harmony import */ var _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(459);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__["sample"]; });
-/* harmony import */ var _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(456);
+/* harmony import */ var _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(460);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sampleTime", function() { return _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__["sampleTime"]; });
-/* harmony import */ var _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(436);
+/* harmony import */ var _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(440);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "scan", function() { return _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__["scan"]; });
-/* harmony import */ var _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(457);
+/* harmony import */ var _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(461);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sequenceEqual", function() { return _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__["sequenceEqual"]; });
-/* harmony import */ var _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(458);
+/* harmony import */ var _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(462);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "share", function() { return _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__["share"]; });
-/* harmony import */ var _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(459);
+/* harmony import */ var _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(463);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "shareReplay", function() { return _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__["shareReplay"]; });
-/* harmony import */ var _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(460);
+/* harmony import */ var _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(464);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "single", function() { return _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__["single"]; });
-/* harmony import */ var _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(461);
+/* harmony import */ var _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(465);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skip", function() { return _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__["skip"]; });
-/* harmony import */ var _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(462);
+/* harmony import */ var _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(466);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipLast", function() { return _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__["skipLast"]; });
-/* harmony import */ var _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(463);
+/* harmony import */ var _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(467);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipUntil", function() { return _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__["skipUntil"]; });
-/* harmony import */ var _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(464);
+/* harmony import */ var _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(468);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipWhile", function() { return _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__["skipWhile"]; });
-/* harmony import */ var _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(465);
+/* harmony import */ var _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(469);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startWith", function() { return _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__["startWith"]; });
-/* harmony import */ var _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(466);
+/* harmony import */ var _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(470);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subscribeOn", function() { return _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__["subscribeOn"]; });
-/* harmony import */ var _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(468);
+/* harmony import */ var _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(472);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchAll", function() { return _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__["switchAll"]; });
-/* harmony import */ var _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(469);
+/* harmony import */ var _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(473);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchMap", function() { return _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__["switchMap"]; });
-/* harmony import */ var _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(470);
+/* harmony import */ var _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(474);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchMapTo", function() { return _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__["switchMapTo"]; });
-/* harmony import */ var _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(418);
+/* harmony import */ var _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(422);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "take", function() { return _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__["take"]; });
-/* harmony import */ var _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(431);
+/* harmony import */ var _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(435);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeLast", function() { return _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__["takeLast"]; });
-/* harmony import */ var _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(471);
+/* harmony import */ var _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(475);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeUntil", function() { return _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__["takeUntil"]; });
-/* harmony import */ var _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(472);
+/* harmony import */ var _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(476);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeWhile", function() { return _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__["takeWhile"]; });
-/* harmony import */ var _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(473);
+/* harmony import */ var _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(477);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__["tap"]; });
-/* harmony import */ var _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(474);
+/* harmony import */ var _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(478);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__["throttle"]; });
-/* harmony import */ var _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(475);
+/* harmony import */ var _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(479);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttleTime", function() { return _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__["throttleTime"]; });
-/* harmony import */ var _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(417);
+/* harmony import */ var _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(421);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throwIfEmpty", function() { return _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__["throwIfEmpty"]; });
-/* harmony import */ var _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(476);
+/* harmony import */ var _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(480);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeInterval", function() { return _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__["timeInterval"]; });
-/* harmony import */ var _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(477);
+/* harmony import */ var _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(481);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeout", function() { return _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__["timeout"]; });
-/* harmony import */ var _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(478);
+/* harmony import */ var _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(482);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeoutWith", function() { return _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__["timeoutWith"]; });
-/* harmony import */ var _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(479);
+/* harmony import */ var _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(483);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timestamp", function() { return _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__["timestamp"]; });
-/* harmony import */ var _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(480);
+/* harmony import */ var _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(484);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__["toArray"]; });
-/* harmony import */ var _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(481);
+/* harmony import */ var _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(485);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "window", function() { return _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__["window"]; });
-/* harmony import */ var _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(482);
+/* harmony import */ var _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(486);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowCount", function() { return _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__["windowCount"]; });
-/* harmony import */ var _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(483);
+/* harmony import */ var _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(487);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowTime", function() { return _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__["windowTime"]; });
-/* harmony import */ var _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(484);
+/* harmony import */ var _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(488);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowToggle", function() { return _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__["windowToggle"]; });
-/* harmony import */ var _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(485);
+/* harmony import */ var _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(489);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowWhen", function() { return _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__["windowWhen"]; });
-/* harmony import */ var _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(486);
+/* harmony import */ var _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(490);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withLatestFrom", function() { return _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__["withLatestFrom"]; });
-/* harmony import */ var _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(487);
+/* harmony import */ var _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(491);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__["zip"]; });
-/* harmony import */ var _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(488);
+/* harmony import */ var _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(492);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zipAll", function() { return _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__["zipAll"]; });
/** PURE_IMPORTS_START PURE_IMPORTS_END */
@@ -49295,7 +49521,7 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
-/* 392 */
+/* 396 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -49376,14 +49602,14 @@ var AuditSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 393 */
+/* 397 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "auditTime", function() { return auditTime; });
/* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55);
-/* harmony import */ var _audit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(392);
+/* harmony import */ var _audit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(396);
/* harmony import */ var _observable_timer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(107);
/** PURE_IMPORTS_START _scheduler_async,_audit,_observable_timer PURE_IMPORTS_END */
@@ -49399,7 +49625,7 @@ function auditTime(duration, scheduler) {
/***/ }),
-/* 394 */
+/* 398 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -49448,7 +49674,7 @@ var BufferSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 395 */
+/* 399 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -49549,7 +49775,7 @@ var BufferSkipCountSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 396 */
+/* 400 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -49710,7 +49936,7 @@ function dispatchBufferClose(arg) {
/***/ }),
-/* 397 */
+/* 401 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -49830,7 +50056,7 @@ var BufferToggleSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 398 */
+/* 402 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -49925,7 +50151,7 @@ var BufferWhenSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 399 */
+/* 403 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -49989,7 +50215,7 @@ var CatchSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 400 */
+/* 404 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50005,7 +50231,7 @@ function combineAll(project) {
/***/ }),
-/* 401 */
+/* 405 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50037,7 +50263,7 @@ function combineLatest() {
/***/ }),
-/* 402 */
+/* 406 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50057,7 +50283,7 @@ function concat() {
/***/ }),
-/* 403 */
+/* 407 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50073,13 +50299,13 @@ function concatMap(project, resultSelector) {
/***/ }),
-/* 404 */
+/* 408 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatMapTo", function() { return concatMapTo; });
-/* harmony import */ var _concatMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(403);
+/* harmony import */ var _concatMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(407);
/** PURE_IMPORTS_START _concatMap PURE_IMPORTS_END */
function concatMapTo(innerObservable, resultSelector) {
@@ -50089,7 +50315,7 @@ function concatMapTo(innerObservable, resultSelector) {
/***/ }),
-/* 405 */
+/* 409 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50154,7 +50380,7 @@ var CountSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 406 */
+/* 410 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50242,7 +50468,7 @@ var DebounceSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 407 */
+/* 411 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50318,7 +50544,7 @@ function dispatchNext(subscriber) {
/***/ }),
-/* 408 */
+/* 412 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50368,7 +50594,7 @@ var DefaultIfEmptySubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 409 */
+/* 413 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50376,7 +50602,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return delay; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
/* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55);
-/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(410);
+/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(414);
/* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11);
/* harmony import */ var _Notification__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(42);
/** PURE_IMPORTS_START tslib,_scheduler_async,_util_isDate,_Subscriber,_Notification PURE_IMPORTS_END */
@@ -50475,7 +50701,7 @@ var DelayMessage = /*@__PURE__*/ (function () {
/***/ }),
-/* 410 */
+/* 414 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50489,7 +50715,7 @@ function isDate(value) {
/***/ }),
-/* 411 */
+/* 415 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50635,7 +50861,7 @@ var SubscriptionDelaySubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 412 */
+/* 416 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50673,7 +50899,7 @@ var DeMaterializeSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 413 */
+/* 417 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50751,7 +50977,7 @@ var DistinctSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 414 */
+/* 418 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50822,13 +51048,13 @@ var DistinctUntilChangedSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 415 */
+/* 419 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distinctUntilKeyChanged", function() { return distinctUntilKeyChanged; });
-/* harmony import */ var _distinctUntilChanged__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(414);
+/* harmony import */ var _distinctUntilChanged__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(418);
/** PURE_IMPORTS_START _distinctUntilChanged PURE_IMPORTS_END */
function distinctUntilKeyChanged(key, compare) {
@@ -50838,7 +51064,7 @@ function distinctUntilKeyChanged(key, compare) {
/***/ }),
-/* 416 */
+/* 420 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50846,9 +51072,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "elementAt", function() { return elementAt; });
/* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62);
/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(104);
-/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(417);
-/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(408);
-/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(418);
+/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(421);
+/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(412);
+/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(422);
/** PURE_IMPORTS_START _util_ArgumentOutOfRangeError,_filter,_throwIfEmpty,_defaultIfEmpty,_take PURE_IMPORTS_END */
@@ -50870,7 +51096,7 @@ function elementAt(index, defaultValue) {
/***/ }),
-/* 417 */
+/* 421 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50936,7 +51162,7 @@ function defaultErrorFactory() {
/***/ }),
-/* 418 */
+/* 422 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -50998,7 +51224,7 @@ var TakeSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 419 */
+/* 423 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51020,7 +51246,7 @@ function endWith() {
/***/ }),
-/* 420 */
+/* 424 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51082,7 +51308,7 @@ var EverySubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 421 */
+/* 425 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51139,7 +51365,7 @@ var SwitchFirstSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 422 */
+/* 426 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51239,7 +51465,7 @@ var ExhaustMapSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 423 */
+/* 427 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51358,7 +51584,7 @@ var ExpandSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 424 */
+/* 428 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51396,7 +51622,7 @@ var FinallySubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 425 */
+/* 429 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51468,13 +51694,13 @@ var FindValueSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 426 */
+/* 430 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return findIndex; });
-/* harmony import */ var _operators_find__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(425);
+/* harmony import */ var _operators_find__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(429);
/** PURE_IMPORTS_START _operators_find PURE_IMPORTS_END */
function findIndex(predicate, thisArg) {
@@ -51484,7 +51710,7 @@ function findIndex(predicate, thisArg) {
/***/ }),
-/* 427 */
+/* 431 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51492,9 +51718,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return first; });
/* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(63);
/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(104);
-/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(418);
-/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(408);
-/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(417);
+/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(422);
+/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(412);
+/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(421);
/* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(25);
/** PURE_IMPORTS_START _util_EmptyError,_filter,_take,_defaultIfEmpty,_throwIfEmpty,_util_identity PURE_IMPORTS_END */
@@ -51511,7 +51737,7 @@ function first(predicate, defaultValue) {
/***/ }),
-/* 428 */
+/* 432 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51548,7 +51774,7 @@ var IgnoreElementsSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 429 */
+/* 433 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51592,7 +51818,7 @@ var IsEmptySubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 430 */
+/* 434 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51600,9 +51826,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return last; });
/* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(63);
/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(104);
-/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(431);
-/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(417);
-/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(408);
+/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(435);
+/* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(421);
+/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(412);
/* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(25);
/** PURE_IMPORTS_START _util_EmptyError,_filter,_takeLast,_throwIfEmpty,_defaultIfEmpty,_util_identity PURE_IMPORTS_END */
@@ -51619,7 +51845,7 @@ function last(predicate, defaultValue) {
/***/ }),
-/* 431 */
+/* 435 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51696,7 +51922,7 @@ var TakeLastSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 432 */
+/* 436 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51735,7 +51961,7 @@ var MapToSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 433 */
+/* 437 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51785,13 +52011,13 @@ var MaterializeSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 434 */
+/* 438 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return max; });
-/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(435);
+/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(439);
/** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */
function max(comparer) {
@@ -51804,15 +52030,15 @@ function max(comparer) {
/***/ }),
-/* 435 */
+/* 439 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return reduce; });
-/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(436);
-/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(431);
-/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(408);
+/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(440);
+/* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(435);
+/* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(412);
/* harmony import */ var _util_pipe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(24);
/** PURE_IMPORTS_START _scan,_takeLast,_defaultIfEmpty,_util_pipe PURE_IMPORTS_END */
@@ -51833,7 +52059,7 @@ function reduce(accumulator, seed) {
/***/ }),
-/* 436 */
+/* 440 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51915,7 +52141,7 @@ var ScanSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 437 */
+/* 441 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51935,7 +52161,7 @@ function merge() {
/***/ }),
-/* 438 */
+/* 442 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -51960,7 +52186,7 @@ function mergeMapTo(innerObservable, resultSelector, concurrent) {
/***/ }),
-/* 439 */
+/* 443 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52075,13 +52301,13 @@ var MergeScanSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 440 */
+/* 444 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return min; });
-/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(435);
+/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(439);
/** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */
function min(comparer) {
@@ -52094,7 +52320,7 @@ function min(comparer) {
/***/ }),
-/* 441 */
+/* 445 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52143,7 +52369,7 @@ var MulticastOperator = /*@__PURE__*/ (function () {
/***/ }),
-/* 442 */
+/* 446 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52237,7 +52463,7 @@ var OnErrorResumeNextSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 443 */
+/* 447 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52285,7 +52511,7 @@ var PairwiseSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 444 */
+/* 448 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52308,7 +52534,7 @@ function partition(predicate, thisArg) {
/***/ }),
-/* 445 */
+/* 449 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52348,14 +52574,14 @@ function plucker(props, length) {
/***/ }),
-/* 446 */
+/* 450 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publish", function() { return publish; });
/* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27);
-/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(441);
+/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(445);
/** PURE_IMPORTS_START _Subject,_multicast PURE_IMPORTS_END */
@@ -52368,14 +52594,14 @@ function publish(selector) {
/***/ }),
-/* 447 */
+/* 451 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishBehavior", function() { return publishBehavior; });
/* harmony import */ var _BehaviorSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32);
-/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(441);
+/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(445);
/** PURE_IMPORTS_START _BehaviorSubject,_multicast PURE_IMPORTS_END */
@@ -52386,14 +52612,14 @@ function publishBehavior(value) {
/***/ }),
-/* 448 */
+/* 452 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishLast", function() { return publishLast; });
/* harmony import */ var _AsyncSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(50);
-/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(441);
+/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(445);
/** PURE_IMPORTS_START _AsyncSubject,_multicast PURE_IMPORTS_END */
@@ -52404,14 +52630,14 @@ function publishLast() {
/***/ }),
-/* 449 */
+/* 453 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishReplay", function() { return publishReplay; });
/* harmony import */ var _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
-/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(441);
+/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(445);
/** PURE_IMPORTS_START _ReplaySubject,_multicast PURE_IMPORTS_END */
@@ -52427,7 +52653,7 @@ function publishReplay(bufferSize, windowTime, selectorOrScheduler, scheduler) {
/***/ }),
-/* 450 */
+/* 454 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52454,7 +52680,7 @@ function race() {
/***/ }),
-/* 451 */
+/* 455 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52519,7 +52745,7 @@ var RepeatSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 452 */
+/* 456 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52615,7 +52841,7 @@ var RepeatWhenSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 453 */
+/* 457 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52668,7 +52894,7 @@ var RetrySubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 454 */
+/* 458 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52756,7 +52982,7 @@ var RetryWhenSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 455 */
+/* 459 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52813,7 +53039,7 @@ var SampleSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 456 */
+/* 460 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52873,7 +53099,7 @@ function dispatchNotification(state) {
/***/ }),
-/* 457 */
+/* 461 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -52996,13 +53222,13 @@ var SequenceEqualCompareToSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 458 */
+/* 462 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "share", function() { return share; });
-/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(441);
+/* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(445);
/* harmony import */ var _refCount__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(30);
/* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27);
/** PURE_IMPORTS_START _multicast,_refCount,_Subject PURE_IMPORTS_END */
@@ -53019,7 +53245,7 @@ function share() {
/***/ }),
-/* 459 */
+/* 463 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53084,7 +53310,7 @@ function shareReplayOperator(_a) {
/***/ }),
-/* 460 */
+/* 464 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53164,7 +53390,7 @@ var SingleSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 461 */
+/* 465 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53206,7 +53432,7 @@ var SkipSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 462 */
+/* 466 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53268,7 +53494,7 @@ var SkipLastSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 463 */
+/* 467 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53329,7 +53555,7 @@ var SkipUntilSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 464 */
+/* 468 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53385,7 +53611,7 @@ var SkipWhileSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 465 */
+/* 469 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53414,13 +53640,13 @@ function startWith() {
/***/ }),
-/* 466 */
+/* 470 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeOn", function() { return subscribeOn; });
-/* harmony import */ var _observable_SubscribeOnObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(467);
+/* harmony import */ var _observable_SubscribeOnObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(471);
/** PURE_IMPORTS_START _observable_SubscribeOnObservable PURE_IMPORTS_END */
function subscribeOn(scheduler, delay) {
@@ -53445,7 +53671,7 @@ var SubscribeOnOperator = /*@__PURE__*/ (function () {
/***/ }),
-/* 467 */
+/* 471 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53509,13 +53735,13 @@ var SubscribeOnObservable = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 468 */
+/* 472 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchAll", function() { return switchAll; });
-/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(469);
+/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(473);
/* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(25);
/** PURE_IMPORTS_START _switchMap,_util_identity PURE_IMPORTS_END */
@@ -53527,7 +53753,7 @@ function switchAll() {
/***/ }),
-/* 469 */
+/* 473 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53621,13 +53847,13 @@ var SwitchMapSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 470 */
+/* 474 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchMapTo", function() { return switchMapTo; });
-/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(469);
+/* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(473);
/** PURE_IMPORTS_START _switchMap PURE_IMPORTS_END */
function switchMapTo(innerObservable, resultSelector) {
@@ -53637,7 +53863,7 @@ function switchMapTo(innerObservable, resultSelector) {
/***/ }),
-/* 471 */
+/* 475 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53687,7 +53913,7 @@ var TakeUntilSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 472 */
+/* 476 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53755,7 +53981,7 @@ var TakeWhileSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 473 */
+/* 477 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53843,7 +54069,7 @@ var TapSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 474 */
+/* 478 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53947,7 +54173,7 @@ var ThrottleSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 475 */
+/* 479 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -53956,7 +54182,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
/* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11);
/* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55);
-/* harmony import */ var _throttle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(474);
+/* harmony import */ var _throttle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(478);
/** PURE_IMPORTS_START tslib,_Subscriber,_scheduler_async,_throttle PURE_IMPORTS_END */
@@ -54045,7 +54271,7 @@ function dispatchNext(arg) {
/***/ }),
-/* 476 */
+/* 480 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54053,7 +54279,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeInterval", function() { return timeInterval; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeInterval", function() { return TimeInterval; });
/* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55);
-/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(436);
+/* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(440);
/* harmony import */ var _observable_defer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(90);
/* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(66);
/** PURE_IMPORTS_START _scheduler_async,_scan,_observable_defer,_map PURE_IMPORTS_END */
@@ -54089,7 +54315,7 @@ var TimeInterval = /*@__PURE__*/ (function () {
/***/ }),
-/* 477 */
+/* 481 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54097,7 +54323,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeout", function() { return timeout; });
/* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55);
/* harmony import */ var _util_TimeoutError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(64);
-/* harmony import */ var _timeoutWith__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(478);
+/* harmony import */ var _timeoutWith__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(482);
/* harmony import */ var _observable_throwError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49);
/** PURE_IMPORTS_START _scheduler_async,_util_TimeoutError,_timeoutWith,_observable_throwError PURE_IMPORTS_END */
@@ -54114,7 +54340,7 @@ function timeout(due, scheduler) {
/***/ }),
-/* 478 */
+/* 482 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54122,7 +54348,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeoutWith", function() { return timeoutWith; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
/* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55);
-/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(410);
+/* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(414);
/* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69);
/* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(70);
/** PURE_IMPORTS_START tslib,_scheduler_async,_util_isDate,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
@@ -54196,7 +54422,7 @@ var TimeoutWithSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 479 */
+/* 483 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54226,13 +54452,13 @@ var Timestamp = /*@__PURE__*/ (function () {
/***/ }),
-/* 480 */
+/* 484 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return toArray; });
-/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(435);
+/* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(439);
/** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */
function toArrayReducer(arr, item, index) {
@@ -54249,7 +54475,7 @@ function toArray() {
/***/ }),
-/* 481 */
+/* 485 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54329,7 +54555,7 @@ var WindowSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 482 */
+/* 486 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54419,7 +54645,7 @@ var WindowCountSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 483 */
+/* 487 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54589,7 +54815,7 @@ function dispatchWindowClose(state) {
/***/ }),
-/* 484 */
+/* 488 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54732,7 +54958,7 @@ var WindowToggleSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 485 */
+/* 489 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54829,7 +55055,7 @@ var WindowSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 486 */
+/* 490 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54924,7 +55150,7 @@ var WithLatestFromSubscriber = /*@__PURE__*/ (function (_super) {
/***/ }),
-/* 487 */
+/* 491 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54946,7 +55172,7 @@ function zip() {
/***/ }),
-/* 488 */
+/* 492 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54962,7 +55188,7 @@ function zipAll(project) {
/***/ }),
-/* 489 */
+/* 493 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -54971,8 +55197,8 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(162);
/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(143);
/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(145);
-/* harmony import */ var _utils_projects_tree__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(490);
-/* harmony import */ var _utils_kibana__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(491);
+/* harmony import */ var _utils_projects_tree__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(494);
+/* harmony import */ var _utils_kibana__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(495);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -55054,13 +55280,13 @@ function toArray(value) {
}
/***/ }),
-/* 490 */
+/* 494 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderProjectsTree", function() { return renderProjectsTree; });
-/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(227);
+/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(112);
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
@@ -55207,7 +55433,7 @@ function addProjectToTree(tree, pathParts, project) {
}
/***/ }),
-/* 491 */
+/* 495 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -55215,13 +55441,13 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Kibana", function() { return Kibana; });
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(492);
+/* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(496);
/* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(multimatch__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var is_path_inside__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(366);
+/* harmony import */ var is_path_inside__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(361);
/* harmony import */ var is_path_inside__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(is_path_inside__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var _yarn_lock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(279);
+/* harmony import */ var _yarn_lock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(274);
/* harmony import */ var _projects__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(145);
-/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(276);
+/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(271);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -55383,15 +55609,15 @@ class Kibana {
}
/***/ }),
-/* 492 */
+/* 496 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const minimatch = __webpack_require__(149);
-const arrayUnion = __webpack_require__(493);
-const arrayDiffer = __webpack_require__(494);
-const arrify = __webpack_require__(495);
+const arrayUnion = __webpack_require__(497);
+const arrayDiffer = __webpack_require__(498);
+const arrify = __webpack_require__(499);
module.exports = (list, patterns, options = {}) => {
list = arrify(list);
@@ -55415,7 +55641,7 @@ module.exports = (list, patterns, options = {}) => {
/***/ }),
-/* 493 */
+/* 497 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -55427,7 +55653,7 @@ module.exports = (...arguments_) => {
/***/ }),
-/* 494 */
+/* 498 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -55442,7 +55668,7 @@ module.exports = arrayDiffer;
/***/ }),
-/* 495 */
+/* 499 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -55472,12 +55698,12 @@ module.exports = arrify;
/***/ }),
-/* 496 */
+/* 500 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _build_production_projects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(497);
+/* harmony import */ var _build_production_projects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(501);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return _build_production_projects__WEBPACK_IMPORTED_MODULE_0__["buildProductionProjects"]; });
/*
@@ -55501,19 +55727,19 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
-/* 497 */
+/* 501 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return buildProductionProjects; });
-/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(498);
+/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(502);
/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cpy__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(285);
+/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(280);
/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(276);
+/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(271);
/* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(130);
/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(143);
/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(164);
@@ -55649,7 +55875,7 @@ async function copyToBuild(project, kibanaRoot, buildRoot) {
}
/***/ }),
-/* 498 */
+/* 502 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -55657,13 +55883,13 @@ async function copyToBuild(project, kibanaRoot, buildRoot) {
const EventEmitter = __webpack_require__(155);
const path = __webpack_require__(4);
const os = __webpack_require__(120);
-const pAll = __webpack_require__(499);
-const arrify = __webpack_require__(501);
-const globby = __webpack_require__(502);
-const isGlob = __webpack_require__(700);
-const cpFile = __webpack_require__(701);
-const junk = __webpack_require__(713);
-const CpyError = __webpack_require__(714);
+const pAll = __webpack_require__(503);
+const arrify = __webpack_require__(505);
+const globby = __webpack_require__(506);
+const isGlob = __webpack_require__(704);
+const cpFile = __webpack_require__(705);
+const junk = __webpack_require__(717);
+const CpyError = __webpack_require__(718);
const defaultOptions = {
ignoreJunk: true
@@ -55782,12 +56008,12 @@ module.exports = (source, destination, {
/***/ }),
-/* 499 */
+/* 503 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const pMap = __webpack_require__(500);
+const pMap = __webpack_require__(504);
module.exports = (iterable, options) => pMap(iterable, element => element(), options);
// TODO: Remove this for the next major release
@@ -55795,7 +56021,7 @@ module.exports.default = module.exports;
/***/ }),
-/* 500 */
+/* 504 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -55874,7 +56100,7 @@ module.exports.default = pMap;
/***/ }),
-/* 501 */
+/* 505 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -55904,17 +56130,17 @@ module.exports = arrify;
/***/ }),
-/* 502 */
+/* 506 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const fs = __webpack_require__(133);
-const arrayUnion = __webpack_require__(503);
+const arrayUnion = __webpack_require__(507);
const glob = __webpack_require__(146);
-const fastGlob = __webpack_require__(505);
-const dirGlob = __webpack_require__(693);
-const gitignore = __webpack_require__(696);
+const fastGlob = __webpack_require__(509);
+const dirGlob = __webpack_require__(697);
+const gitignore = __webpack_require__(700);
const DEFAULT_FILTER = () => false;
@@ -56059,12 +56285,12 @@ module.exports.gitignore = gitignore;
/***/ }),
-/* 503 */
+/* 507 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var arrayUniq = __webpack_require__(504);
+var arrayUniq = __webpack_require__(508);
module.exports = function () {
return arrayUniq([].concat.apply([], arguments));
@@ -56072,7 +56298,7 @@ module.exports = function () {
/***/ }),
-/* 504 */
+/* 508 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -56141,10 +56367,10 @@ if ('Set' in global) {
/***/ }),
-/* 505 */
+/* 509 */
/***/ (function(module, exports, __webpack_require__) {
-const pkg = __webpack_require__(506);
+const pkg = __webpack_require__(510);
module.exports = pkg.async;
module.exports.default = pkg.async;
@@ -56157,19 +56383,19 @@ module.exports.generateTasks = pkg.generateTasks;
/***/ }),
-/* 506 */
+/* 510 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-var optionsManager = __webpack_require__(507);
-var taskManager = __webpack_require__(508);
-var reader_async_1 = __webpack_require__(664);
-var reader_stream_1 = __webpack_require__(688);
-var reader_sync_1 = __webpack_require__(689);
-var arrayUtils = __webpack_require__(691);
-var streamUtils = __webpack_require__(692);
+var optionsManager = __webpack_require__(511);
+var taskManager = __webpack_require__(512);
+var reader_async_1 = __webpack_require__(668);
+var reader_stream_1 = __webpack_require__(692);
+var reader_sync_1 = __webpack_require__(693);
+var arrayUtils = __webpack_require__(695);
+var streamUtils = __webpack_require__(696);
/**
* Synchronous API.
*/
@@ -56235,7 +56461,7 @@ function isString(source) {
/***/ }),
-/* 507 */
+/* 511 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -56273,13 +56499,13 @@ exports.prepare = prepare;
/***/ }),
-/* 508 */
+/* 512 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-var patternUtils = __webpack_require__(509);
+var patternUtils = __webpack_require__(513);
/**
* Generate tasks based on parent directory of each pattern.
*/
@@ -56370,16 +56596,16 @@ exports.convertPatternGroupToTask = convertPatternGroupToTask;
/***/ }),
-/* 509 */
+/* 513 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path = __webpack_require__(4);
-var globParent = __webpack_require__(510);
-var isGlob = __webpack_require__(513);
-var micromatch = __webpack_require__(514);
+var globParent = __webpack_require__(514);
+var isGlob = __webpack_require__(517);
+var micromatch = __webpack_require__(518);
var GLOBSTAR = '**';
/**
* Return true for static pattern.
@@ -56525,15 +56751,15 @@ exports.matchAny = matchAny;
/***/ }),
-/* 510 */
+/* 514 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var path = __webpack_require__(4);
-var isglob = __webpack_require__(511);
-var pathDirname = __webpack_require__(512);
+var isglob = __webpack_require__(515);
+var pathDirname = __webpack_require__(516);
var isWin32 = __webpack_require__(120).platform() === 'win32';
module.exports = function globParent(str) {
@@ -56556,7 +56782,7 @@ module.exports = function globParent(str) {
/***/ }),
-/* 511 */
+/* 515 */
/***/ (function(module, exports, __webpack_require__) {
/*!
@@ -56566,7 +56792,7 @@ module.exports = function globParent(str) {
* Licensed under the MIT License.
*/
-var isExtglob = __webpack_require__(299);
+var isExtglob = __webpack_require__(294);
module.exports = function isGlob(str) {
if (typeof str !== 'string' || str === '') {
@@ -56587,7 +56813,7 @@ module.exports = function isGlob(str) {
/***/ }),
-/* 512 */
+/* 516 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -56737,7 +56963,7 @@ module.exports.win32 = win32;
/***/ }),
-/* 513 */
+/* 517 */
/***/ (function(module, exports, __webpack_require__) {
/*!
@@ -56747,7 +56973,7 @@ module.exports.win32 = win32;
* Released under the MIT License.
*/
-var isExtglob = __webpack_require__(299);
+var isExtglob = __webpack_require__(294);
var chars = { '{': '}', '(': ')', '[': ']'};
module.exports = function isGlob(str, options) {
@@ -56789,7 +57015,7 @@ module.exports = function isGlob(str, options) {
/***/ }),
-/* 514 */
+/* 518 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -56800,18 +57026,18 @@ module.exports = function isGlob(str, options) {
*/
var util = __webpack_require__(111);
-var braces = __webpack_require__(515);
-var toRegex = __webpack_require__(617);
-var extend = __webpack_require__(625);
+var braces = __webpack_require__(519);
+var toRegex = __webpack_require__(621);
+var extend = __webpack_require__(629);
/**
* Local dependencies
*/
-var compilers = __webpack_require__(628);
-var parsers = __webpack_require__(660);
-var cache = __webpack_require__(661);
-var utils = __webpack_require__(662);
+var compilers = __webpack_require__(632);
+var parsers = __webpack_require__(664);
+var cache = __webpack_require__(665);
+var utils = __webpack_require__(666);
var MAX_LENGTH = 1024 * 64;
/**
@@ -57673,7 +57899,7 @@ module.exports = micromatch;
/***/ }),
-/* 515 */
+/* 519 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -57683,18 +57909,18 @@ module.exports = micromatch;
* Module dependencies
*/
-var toRegex = __webpack_require__(516);
-var unique = __webpack_require__(528);
-var extend = __webpack_require__(525);
+var toRegex = __webpack_require__(520);
+var unique = __webpack_require__(532);
+var extend = __webpack_require__(529);
/**
* Local dependencies
*/
-var compilers = __webpack_require__(529);
-var parsers = __webpack_require__(544);
-var Braces = __webpack_require__(554);
-var utils = __webpack_require__(530);
+var compilers = __webpack_require__(533);
+var parsers = __webpack_require__(548);
+var Braces = __webpack_require__(558);
+var utils = __webpack_require__(534);
var MAX_LENGTH = 1024 * 64;
var cache = {};
@@ -57998,15 +58224,15 @@ module.exports = braces;
/***/ }),
-/* 516 */
+/* 520 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var define = __webpack_require__(517);
-var extend = __webpack_require__(525);
-var not = __webpack_require__(527);
+var define = __webpack_require__(521);
+var extend = __webpack_require__(529);
+var not = __webpack_require__(531);
var MAX_LENGTH = 1024 * 64;
/**
@@ -58153,7 +58379,7 @@ module.exports.makeRe = makeRe;
/***/ }),
-/* 517 */
+/* 521 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -58166,7 +58392,7 @@ module.exports.makeRe = makeRe;
-var isDescriptor = __webpack_require__(518);
+var isDescriptor = __webpack_require__(522);
module.exports = function defineProperty(obj, prop, val) {
if (typeof obj !== 'object' && typeof obj !== 'function') {
@@ -58191,7 +58417,7 @@ module.exports = function defineProperty(obj, prop, val) {
/***/ }),
-/* 518 */
+/* 522 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -58204,9 +58430,9 @@ module.exports = function defineProperty(obj, prop, val) {
-var typeOf = __webpack_require__(519);
-var isAccessor = __webpack_require__(520);
-var isData = __webpack_require__(523);
+var typeOf = __webpack_require__(523);
+var isAccessor = __webpack_require__(524);
+var isData = __webpack_require__(527);
module.exports = function isDescriptor(obj, key) {
if (typeOf(obj) !== 'object') {
@@ -58220,7 +58446,7 @@ module.exports = function isDescriptor(obj, key) {
/***/ }),
-/* 519 */
+/* 523 */
/***/ (function(module, exports) {
var toString = Object.prototype.toString;
@@ -58373,7 +58599,7 @@ function isBuffer(val) {
/***/ }),
-/* 520 */
+/* 524 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -58386,7 +58612,7 @@ function isBuffer(val) {
-var typeOf = __webpack_require__(521);
+var typeOf = __webpack_require__(525);
// accessor descriptor properties
var accessor = {
@@ -58449,10 +58675,10 @@ module.exports = isAccessorDescriptor;
/***/ }),
-/* 521 */
+/* 525 */
/***/ (function(module, exports, __webpack_require__) {
-var isBuffer = __webpack_require__(522);
+var isBuffer = __webpack_require__(526);
var toString = Object.prototype.toString;
/**
@@ -58571,7 +58797,7 @@ module.exports = function kindOf(val) {
/***/ }),
-/* 522 */
+/* 526 */
/***/ (function(module, exports) {
/*!
@@ -58598,7 +58824,7 @@ function isSlowBuffer (obj) {
/***/ }),
-/* 523 */
+/* 527 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -58611,7 +58837,7 @@ function isSlowBuffer (obj) {
-var typeOf = __webpack_require__(524);
+var typeOf = __webpack_require__(528);
// data descriptor properties
var data = {
@@ -58660,10 +58886,10 @@ module.exports = isDataDescriptor;
/***/ }),
-/* 524 */
+/* 528 */
/***/ (function(module, exports, __webpack_require__) {
-var isBuffer = __webpack_require__(522);
+var isBuffer = __webpack_require__(526);
var toString = Object.prototype.toString;
/**
@@ -58782,13 +59008,13 @@ module.exports = function kindOf(val) {
/***/ }),
-/* 525 */
+/* 529 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var isObject = __webpack_require__(526);
+var isObject = __webpack_require__(530);
module.exports = function extend(o/*, objects*/) {
if (!isObject(o)) { o = {}; }
@@ -58822,7 +59048,7 @@ function hasOwn(obj, key) {
/***/ }),
-/* 526 */
+/* 530 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -58842,13 +59068,13 @@ module.exports = function isExtendable(val) {
/***/ }),
-/* 527 */
+/* 531 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var extend = __webpack_require__(525);
+var extend = __webpack_require__(529);
/**
* The main export is a function that takes a `pattern` string and an `options` object.
@@ -58915,7 +59141,7 @@ module.exports = toRegex;
/***/ }),
-/* 528 */
+/* 532 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -58965,13 +59191,13 @@ module.exports.immutable = function uniqueImmutable(arr) {
/***/ }),
-/* 529 */
+/* 533 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var utils = __webpack_require__(530);
+var utils = __webpack_require__(534);
module.exports = function(braces, options) {
braces.compiler
@@ -59254,25 +59480,25 @@ function hasQueue(node) {
/***/ }),
-/* 530 */
+/* 534 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var splitString = __webpack_require__(531);
+var splitString = __webpack_require__(535);
var utils = module.exports;
/**
* Module dependencies
*/
-utils.extend = __webpack_require__(525);
-utils.flatten = __webpack_require__(537);
-utils.isObject = __webpack_require__(535);
-utils.fillRange = __webpack_require__(538);
-utils.repeat = __webpack_require__(543);
-utils.unique = __webpack_require__(528);
+utils.extend = __webpack_require__(529);
+utils.flatten = __webpack_require__(541);
+utils.isObject = __webpack_require__(539);
+utils.fillRange = __webpack_require__(542);
+utils.repeat = __webpack_require__(547);
+utils.unique = __webpack_require__(532);
utils.define = function(obj, key, val) {
Object.defineProperty(obj, key, {
@@ -59604,7 +59830,7 @@ utils.escapeRegex = function(str) {
/***/ }),
-/* 531 */
+/* 535 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -59617,7 +59843,7 @@ utils.escapeRegex = function(str) {
-var extend = __webpack_require__(532);
+var extend = __webpack_require__(536);
module.exports = function(str, options, fn) {
if (typeof str !== 'string') {
@@ -59782,14 +60008,14 @@ function keepEscaping(opts, str, idx) {
/***/ }),
-/* 532 */
+/* 536 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var isExtendable = __webpack_require__(533);
-var assignSymbols = __webpack_require__(536);
+var isExtendable = __webpack_require__(537);
+var assignSymbols = __webpack_require__(540);
module.exports = Object.assign || function(obj/*, objects*/) {
if (obj === null || typeof obj === 'undefined') {
@@ -59849,7 +60075,7 @@ function isEnum(obj, key) {
/***/ }),
-/* 533 */
+/* 537 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -59862,7 +60088,7 @@ function isEnum(obj, key) {
-var isPlainObject = __webpack_require__(534);
+var isPlainObject = __webpack_require__(538);
module.exports = function isExtendable(val) {
return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
@@ -59870,7 +60096,7 @@ module.exports = function isExtendable(val) {
/***/ }),
-/* 534 */
+/* 538 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -59883,7 +60109,7 @@ module.exports = function isExtendable(val) {
-var isObject = __webpack_require__(535);
+var isObject = __webpack_require__(539);
function isObjectObject(o) {
return isObject(o) === true
@@ -59914,7 +60140,7 @@ module.exports = function isPlainObject(o) {
/***/ }),
-/* 535 */
+/* 539 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -59933,7 +60159,7 @@ module.exports = function isObject(val) {
/***/ }),
-/* 536 */
+/* 540 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -59980,7 +60206,7 @@ module.exports = function(receiver, objects) {
/***/ }),
-/* 537 */
+/* 541 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -60009,7 +60235,7 @@ function flat(arr, res) {
/***/ }),
-/* 538 */
+/* 542 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -60023,10 +60249,10 @@ function flat(arr, res) {
var util = __webpack_require__(111);
-var isNumber = __webpack_require__(539);
-var extend = __webpack_require__(525);
-var repeat = __webpack_require__(541);
-var toRegex = __webpack_require__(542);
+var isNumber = __webpack_require__(543);
+var extend = __webpack_require__(529);
+var repeat = __webpack_require__(545);
+var toRegex = __webpack_require__(546);
/**
* Return a range of numbers or letters.
@@ -60224,7 +60450,7 @@ module.exports = fillRange;
/***/ }),
-/* 539 */
+/* 543 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -60237,7 +60463,7 @@ module.exports = fillRange;
-var typeOf = __webpack_require__(540);
+var typeOf = __webpack_require__(544);
module.exports = function isNumber(num) {
var type = typeOf(num);
@@ -60253,10 +60479,10 @@ module.exports = function isNumber(num) {
/***/ }),
-/* 540 */
+/* 544 */
/***/ (function(module, exports, __webpack_require__) {
-var isBuffer = __webpack_require__(522);
+var isBuffer = __webpack_require__(526);
var toString = Object.prototype.toString;
/**
@@ -60375,7 +60601,7 @@ module.exports = function kindOf(val) {
/***/ }),
-/* 541 */
+/* 545 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -60452,7 +60678,7 @@ function repeat(str, num) {
/***/ }),
-/* 542 */
+/* 546 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -60465,8 +60691,8 @@ function repeat(str, num) {
-var repeat = __webpack_require__(541);
-var isNumber = __webpack_require__(539);
+var repeat = __webpack_require__(545);
+var isNumber = __webpack_require__(543);
var cache = {};
function toRegexRange(min, max, options) {
@@ -60753,7 +60979,7 @@ module.exports = toRegexRange;
/***/ }),
-/* 543 */
+/* 547 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -60778,14 +61004,14 @@ module.exports = function repeat(ele, num) {
/***/ }),
-/* 544 */
+/* 548 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var Node = __webpack_require__(545);
-var utils = __webpack_require__(530);
+var Node = __webpack_require__(549);
+var utils = __webpack_require__(534);
/**
* Braces parsers
@@ -61145,15 +61371,15 @@ function concatNodes(pos, node, parent, options) {
/***/ }),
-/* 545 */
+/* 549 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var isObject = __webpack_require__(535);
-var define = __webpack_require__(546);
-var utils = __webpack_require__(553);
+var isObject = __webpack_require__(539);
+var define = __webpack_require__(550);
+var utils = __webpack_require__(557);
var ownNames;
/**
@@ -61644,7 +61870,7 @@ exports = module.exports = Node;
/***/ }),
-/* 546 */
+/* 550 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -61657,7 +61883,7 @@ exports = module.exports = Node;
-var isDescriptor = __webpack_require__(547);
+var isDescriptor = __webpack_require__(551);
module.exports = function defineProperty(obj, prop, val) {
if (typeof obj !== 'object' && typeof obj !== 'function') {
@@ -61682,7 +61908,7 @@ module.exports = function defineProperty(obj, prop, val) {
/***/ }),
-/* 547 */
+/* 551 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -61695,9 +61921,9 @@ module.exports = function defineProperty(obj, prop, val) {
-var typeOf = __webpack_require__(548);
-var isAccessor = __webpack_require__(549);
-var isData = __webpack_require__(551);
+var typeOf = __webpack_require__(552);
+var isAccessor = __webpack_require__(553);
+var isData = __webpack_require__(555);
module.exports = function isDescriptor(obj, key) {
if (typeOf(obj) !== 'object') {
@@ -61711,7 +61937,7 @@ module.exports = function isDescriptor(obj, key) {
/***/ }),
-/* 548 */
+/* 552 */
/***/ (function(module, exports) {
var toString = Object.prototype.toString;
@@ -61846,7 +62072,7 @@ function isBuffer(val) {
/***/ }),
-/* 549 */
+/* 553 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -61859,7 +62085,7 @@ function isBuffer(val) {
-var typeOf = __webpack_require__(550);
+var typeOf = __webpack_require__(554);
// accessor descriptor properties
var accessor = {
@@ -61922,7 +62148,7 @@ module.exports = isAccessorDescriptor;
/***/ }),
-/* 550 */
+/* 554 */
/***/ (function(module, exports) {
var toString = Object.prototype.toString;
@@ -62057,7 +62283,7 @@ function isBuffer(val) {
/***/ }),
-/* 551 */
+/* 555 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -62070,7 +62296,7 @@ function isBuffer(val) {
-var typeOf = __webpack_require__(552);
+var typeOf = __webpack_require__(556);
module.exports = function isDataDescriptor(obj, prop) {
// data descriptor properties
@@ -62113,7 +62339,7 @@ module.exports = function isDataDescriptor(obj, prop) {
/***/ }),
-/* 552 */
+/* 556 */
/***/ (function(module, exports) {
var toString = Object.prototype.toString;
@@ -62248,13 +62474,13 @@ function isBuffer(val) {
/***/ }),
-/* 553 */
+/* 557 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var typeOf = __webpack_require__(540);
+var typeOf = __webpack_require__(544);
var utils = module.exports;
/**
@@ -63274,17 +63500,17 @@ function assert(val, message) {
/***/ }),
-/* 554 */
+/* 558 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var extend = __webpack_require__(525);
-var Snapdragon = __webpack_require__(555);
-var compilers = __webpack_require__(529);
-var parsers = __webpack_require__(544);
-var utils = __webpack_require__(530);
+var extend = __webpack_require__(529);
+var Snapdragon = __webpack_require__(559);
+var compilers = __webpack_require__(533);
+var parsers = __webpack_require__(548);
+var utils = __webpack_require__(534);
/**
* Customize Snapdragon parser and renderer
@@ -63385,17 +63611,17 @@ module.exports = Braces;
/***/ }),
-/* 555 */
+/* 559 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var Base = __webpack_require__(556);
-var define = __webpack_require__(517);
-var Compiler = __webpack_require__(585);
-var Parser = __webpack_require__(614);
-var utils = __webpack_require__(594);
+var Base = __webpack_require__(560);
+var define = __webpack_require__(521);
+var Compiler = __webpack_require__(589);
+var Parser = __webpack_require__(618);
+var utils = __webpack_require__(598);
var regexCache = {};
var cache = {};
@@ -63566,20 +63792,20 @@ module.exports.Parser = Parser;
/***/ }),
-/* 556 */
+/* 560 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var util = __webpack_require__(111);
-var define = __webpack_require__(557);
-var CacheBase = __webpack_require__(558);
-var Emitter = __webpack_require__(559);
-var isObject = __webpack_require__(535);
-var merge = __webpack_require__(576);
-var pascal = __webpack_require__(579);
-var cu = __webpack_require__(580);
+var define = __webpack_require__(561);
+var CacheBase = __webpack_require__(562);
+var Emitter = __webpack_require__(563);
+var isObject = __webpack_require__(539);
+var merge = __webpack_require__(580);
+var pascal = __webpack_require__(583);
+var cu = __webpack_require__(584);
/**
* Optionally define a custom `cache` namespace to use.
@@ -64008,7 +64234,7 @@ module.exports.namespace = namespace;
/***/ }),
-/* 557 */
+/* 561 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64021,7 +64247,7 @@ module.exports.namespace = namespace;
-var isDescriptor = __webpack_require__(547);
+var isDescriptor = __webpack_require__(551);
module.exports = function defineProperty(obj, prop, val) {
if (typeof obj !== 'object' && typeof obj !== 'function') {
@@ -64046,21 +64272,21 @@ module.exports = function defineProperty(obj, prop, val) {
/***/ }),
-/* 558 */
+/* 562 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var isObject = __webpack_require__(535);
-var Emitter = __webpack_require__(559);
-var visit = __webpack_require__(560);
-var toPath = __webpack_require__(563);
-var union = __webpack_require__(564);
-var del = __webpack_require__(568);
-var get = __webpack_require__(566);
-var has = __webpack_require__(573);
-var set = __webpack_require__(567);
+var isObject = __webpack_require__(539);
+var Emitter = __webpack_require__(563);
+var visit = __webpack_require__(564);
+var toPath = __webpack_require__(567);
+var union = __webpack_require__(568);
+var del = __webpack_require__(572);
+var get = __webpack_require__(570);
+var has = __webpack_require__(577);
+var set = __webpack_require__(571);
/**
* Create a `Cache` constructor that when instantiated will
@@ -64314,7 +64540,7 @@ module.exports.namespace = namespace;
/***/ }),
-/* 559 */
+/* 563 */
/***/ (function(module, exports, __webpack_require__) {
@@ -64483,7 +64709,7 @@ Emitter.prototype.hasListeners = function(event){
/***/ }),
-/* 560 */
+/* 564 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64496,8 +64722,8 @@ Emitter.prototype.hasListeners = function(event){
-var visit = __webpack_require__(561);
-var mapVisit = __webpack_require__(562);
+var visit = __webpack_require__(565);
+var mapVisit = __webpack_require__(566);
module.exports = function(collection, method, val) {
var result;
@@ -64520,7 +64746,7 @@ module.exports = function(collection, method, val) {
/***/ }),
-/* 561 */
+/* 565 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64533,7 +64759,7 @@ module.exports = function(collection, method, val) {
-var isObject = __webpack_require__(535);
+var isObject = __webpack_require__(539);
module.exports = function visit(thisArg, method, target, val) {
if (!isObject(thisArg) && typeof thisArg !== 'function') {
@@ -64560,14 +64786,14 @@ module.exports = function visit(thisArg, method, target, val) {
/***/ }),
-/* 562 */
+/* 566 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var util = __webpack_require__(111);
-var visit = __webpack_require__(561);
+var visit = __webpack_require__(565);
/**
* Map `visit` over an array of objects.
@@ -64604,7 +64830,7 @@ function isObject(val) {
/***/ }),
-/* 563 */
+/* 567 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64617,7 +64843,7 @@ function isObject(val) {
-var typeOf = __webpack_require__(540);
+var typeOf = __webpack_require__(544);
module.exports = function toPath(args) {
if (typeOf(args) !== 'arguments') {
@@ -64644,16 +64870,16 @@ function filter(arr) {
/***/ }),
-/* 564 */
+/* 568 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var isObject = __webpack_require__(526);
-var union = __webpack_require__(565);
-var get = __webpack_require__(566);
-var set = __webpack_require__(567);
+var isObject = __webpack_require__(530);
+var union = __webpack_require__(569);
+var get = __webpack_require__(570);
+var set = __webpack_require__(571);
module.exports = function unionValue(obj, prop, value) {
if (!isObject(obj)) {
@@ -64681,7 +64907,7 @@ function arrayify(val) {
/***/ }),
-/* 565 */
+/* 569 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64717,7 +64943,7 @@ module.exports = function union(init) {
/***/ }),
-/* 566 */
+/* 570 */
/***/ (function(module, exports) {
/*!
@@ -64773,7 +64999,7 @@ function toString(val) {
/***/ }),
-/* 567 */
+/* 571 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64786,10 +65012,10 @@ function toString(val) {
-var split = __webpack_require__(531);
-var extend = __webpack_require__(525);
-var isPlainObject = __webpack_require__(534);
-var isObject = __webpack_require__(526);
+var split = __webpack_require__(535);
+var extend = __webpack_require__(529);
+var isPlainObject = __webpack_require__(538);
+var isObject = __webpack_require__(530);
module.exports = function(obj, prop, val) {
if (!isObject(obj)) {
@@ -64835,7 +65061,7 @@ function isValidKey(key) {
/***/ }),
-/* 568 */
+/* 572 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64848,8 +65074,8 @@ function isValidKey(key) {
-var isObject = __webpack_require__(535);
-var has = __webpack_require__(569);
+var isObject = __webpack_require__(539);
+var has = __webpack_require__(573);
module.exports = function unset(obj, prop) {
if (!isObject(obj)) {
@@ -64874,7 +65100,7 @@ module.exports = function unset(obj, prop) {
/***/ }),
-/* 569 */
+/* 573 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64887,9 +65113,9 @@ module.exports = function unset(obj, prop) {
-var isObject = __webpack_require__(570);
-var hasValues = __webpack_require__(572);
-var get = __webpack_require__(566);
+var isObject = __webpack_require__(574);
+var hasValues = __webpack_require__(576);
+var get = __webpack_require__(570);
module.exports = function(obj, prop, noZero) {
if (isObject(obj)) {
@@ -64900,7 +65126,7 @@ module.exports = function(obj, prop, noZero) {
/***/ }),
-/* 570 */
+/* 574 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64913,7 +65139,7 @@ module.exports = function(obj, prop, noZero) {
-var isArray = __webpack_require__(571);
+var isArray = __webpack_require__(575);
module.exports = function isObject(val) {
return val != null && typeof val === 'object' && isArray(val) === false;
@@ -64921,7 +65147,7 @@ module.exports = function isObject(val) {
/***/ }),
-/* 571 */
+/* 575 */
/***/ (function(module, exports) {
var toString = {}.toString;
@@ -64932,7 +65158,7 @@ module.exports = Array.isArray || function (arr) {
/***/ }),
-/* 572 */
+/* 576 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64975,7 +65201,7 @@ module.exports = function hasValue(o, noZero) {
/***/ }),
-/* 573 */
+/* 577 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -64988,9 +65214,9 @@ module.exports = function hasValue(o, noZero) {
-var isObject = __webpack_require__(535);
-var hasValues = __webpack_require__(574);
-var get = __webpack_require__(566);
+var isObject = __webpack_require__(539);
+var hasValues = __webpack_require__(578);
+var get = __webpack_require__(570);
module.exports = function(val, prop) {
return hasValues(isObject(val) && prop ? get(val, prop) : val);
@@ -64998,7 +65224,7 @@ module.exports = function(val, prop) {
/***/ }),
-/* 574 */
+/* 578 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -65011,8 +65237,8 @@ module.exports = function(val, prop) {
-var typeOf = __webpack_require__(575);
-var isNumber = __webpack_require__(539);
+var typeOf = __webpack_require__(579);
+var isNumber = __webpack_require__(543);
module.exports = function hasValue(val) {
// is-number checks for NaN and other edge cases
@@ -65065,10 +65291,10 @@ module.exports = function hasValue(val) {
/***/ }),
-/* 575 */
+/* 579 */
/***/ (function(module, exports, __webpack_require__) {
-var isBuffer = __webpack_require__(522);
+var isBuffer = __webpack_require__(526);
var toString = Object.prototype.toString;
/**
@@ -65190,14 +65416,14 @@ module.exports = function kindOf(val) {
/***/ }),
-/* 576 */
+/* 580 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var isExtendable = __webpack_require__(577);
-var forIn = __webpack_require__(578);
+var isExtendable = __webpack_require__(581);
+var forIn = __webpack_require__(582);
function mixinDeep(target, objects) {
var len = arguments.length, i = 0;
@@ -65261,7 +65487,7 @@ module.exports = mixinDeep;
/***/ }),
-/* 577 */
+/* 581 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -65274,7 +65500,7 @@ module.exports = mixinDeep;
-var isPlainObject = __webpack_require__(534);
+var isPlainObject = __webpack_require__(538);
module.exports = function isExtendable(val) {
return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
@@ -65282,7 +65508,7 @@ module.exports = function isExtendable(val) {
/***/ }),
-/* 578 */
+/* 582 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -65305,7 +65531,7 @@ module.exports = function forIn(obj, fn, thisArg) {
/***/ }),
-/* 579 */
+/* 583 */
/***/ (function(module, exports) {
/*!
@@ -65332,14 +65558,14 @@ module.exports = pascalcase;
/***/ }),
-/* 580 */
+/* 584 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var util = __webpack_require__(111);
-var utils = __webpack_require__(581);
+var utils = __webpack_require__(585);
/**
* Expose class utils
@@ -65704,7 +65930,7 @@ cu.bubble = function(Parent, events) {
/***/ }),
-/* 581 */
+/* 585 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -65718,10 +65944,10 @@ var utils = {};
* Lazily required module dependencies
*/
-utils.union = __webpack_require__(565);
-utils.define = __webpack_require__(517);
-utils.isObj = __webpack_require__(535);
-utils.staticExtend = __webpack_require__(582);
+utils.union = __webpack_require__(569);
+utils.define = __webpack_require__(521);
+utils.isObj = __webpack_require__(539);
+utils.staticExtend = __webpack_require__(586);
/**
@@ -65732,7 +65958,7 @@ module.exports = utils;
/***/ }),
-/* 582 */
+/* 586 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -65745,8 +65971,8 @@ module.exports = utils;
-var copy = __webpack_require__(583);
-var define = __webpack_require__(517);
+var copy = __webpack_require__(587);
+var define = __webpack_require__(521);
var util = __webpack_require__(111);
/**
@@ -65829,15 +66055,15 @@ module.exports = extend;
/***/ }),
-/* 583 */
+/* 587 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var typeOf = __webpack_require__(540);
-var copyDescriptor = __webpack_require__(584);
-var define = __webpack_require__(517);
+var typeOf = __webpack_require__(544);
+var copyDescriptor = __webpack_require__(588);
+var define = __webpack_require__(521);
/**
* Copy static properties, prototype properties, and descriptors from one object to another.
@@ -66010,7 +66236,7 @@ module.exports.has = has;
/***/ }),
-/* 584 */
+/* 588 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -66098,16 +66324,16 @@ function isObject(val) {
/***/ }),
-/* 585 */
+/* 589 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var use = __webpack_require__(586);
-var define = __webpack_require__(517);
-var debug = __webpack_require__(588)('snapdragon:compiler');
-var utils = __webpack_require__(594);
+var use = __webpack_require__(590);
+var define = __webpack_require__(521);
+var debug = __webpack_require__(592)('snapdragon:compiler');
+var utils = __webpack_require__(598);
/**
* Create a new `Compiler` with the given `options`.
@@ -66261,7 +66487,7 @@ Compiler.prototype = {
// source map support
if (opts.sourcemap) {
- var sourcemaps = __webpack_require__(613);
+ var sourcemaps = __webpack_require__(617);
sourcemaps(this);
this.mapVisit(this.ast.nodes);
this.applySourceMaps();
@@ -66282,7 +66508,7 @@ module.exports = Compiler;
/***/ }),
-/* 586 */
+/* 590 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -66295,7 +66521,7 @@ module.exports = Compiler;
-var utils = __webpack_require__(587);
+var utils = __webpack_require__(591);
module.exports = function base(app, opts) {
if (!utils.isObject(app) && typeof app !== 'function') {
@@ -66410,7 +66636,7 @@ module.exports = function base(app, opts) {
/***/ }),
-/* 587 */
+/* 591 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -66424,8 +66650,8 @@ var utils = {};
* Lazily required module dependencies
*/
-utils.define = __webpack_require__(517);
-utils.isObject = __webpack_require__(535);
+utils.define = __webpack_require__(521);
+utils.isObject = __webpack_require__(539);
utils.isString = function(val) {
@@ -66440,7 +66666,7 @@ module.exports = utils;
/***/ }),
-/* 588 */
+/* 592 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -66449,14 +66675,14 @@ module.exports = utils;
*/
if (typeof process !== 'undefined' && process.type === 'renderer') {
- module.exports = __webpack_require__(589);
+ module.exports = __webpack_require__(593);
} else {
- module.exports = __webpack_require__(592);
+ module.exports = __webpack_require__(596);
}
/***/ }),
-/* 589 */
+/* 593 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -66465,7 +66691,7 @@ if (typeof process !== 'undefined' && process.type === 'renderer') {
* Expose `debug()` as the module.
*/
-exports = module.exports = __webpack_require__(590);
+exports = module.exports = __webpack_require__(594);
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
@@ -66647,7 +66873,7 @@ function localstorage() {
/***/ }),
-/* 590 */
+/* 594 */
/***/ (function(module, exports, __webpack_require__) {
@@ -66663,7 +66889,7 @@ exports.coerce = coerce;
exports.disable = disable;
exports.enable = enable;
exports.enabled = enabled;
-exports.humanize = __webpack_require__(591);
+exports.humanize = __webpack_require__(595);
/**
* The currently active debug mode names, and names to skip.
@@ -66855,7 +67081,7 @@ function coerce(val) {
/***/ }),
-/* 591 */
+/* 595 */
/***/ (function(module, exports) {
/**
@@ -67013,7 +67239,7 @@ function plural(ms, n, name) {
/***/ }),
-/* 592 */
+/* 596 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -67029,7 +67255,7 @@ var util = __webpack_require__(111);
* Expose `debug()` as the module.
*/
-exports = module.exports = __webpack_require__(590);
+exports = module.exports = __webpack_require__(594);
exports.init = init;
exports.log = log;
exports.formatArgs = formatArgs;
@@ -67208,7 +67434,7 @@ function createWritableStdioStream (fd) {
case 'PIPE':
case 'TCP':
- var net = __webpack_require__(593);
+ var net = __webpack_require__(597);
stream = new net.Socket({
fd: fd,
readable: false,
@@ -67267,13 +67493,13 @@ exports.enable(load());
/***/ }),
-/* 593 */
+/* 597 */
/***/ (function(module, exports) {
module.exports = require("net");
/***/ }),
-/* 594 */
+/* 598 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -67283,9 +67509,9 @@ module.exports = require("net");
* Module dependencies
*/
-exports.extend = __webpack_require__(525);
-exports.SourceMap = __webpack_require__(595);
-exports.sourceMapResolve = __webpack_require__(606);
+exports.extend = __webpack_require__(529);
+exports.SourceMap = __webpack_require__(599);
+exports.sourceMapResolve = __webpack_require__(610);
/**
* Convert backslash in the given string to forward slashes
@@ -67328,7 +67554,7 @@ exports.last = function(arr, n) {
/***/ }),
-/* 595 */
+/* 599 */
/***/ (function(module, exports, __webpack_require__) {
/*
@@ -67336,13 +67562,13 @@ exports.last = function(arr, n) {
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
-exports.SourceMapGenerator = __webpack_require__(596).SourceMapGenerator;
-exports.SourceMapConsumer = __webpack_require__(602).SourceMapConsumer;
-exports.SourceNode = __webpack_require__(605).SourceNode;
+exports.SourceMapGenerator = __webpack_require__(600).SourceMapGenerator;
+exports.SourceMapConsumer = __webpack_require__(606).SourceMapConsumer;
+exports.SourceNode = __webpack_require__(609).SourceNode;
/***/ }),
-/* 596 */
+/* 600 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
@@ -67352,10 +67578,10 @@ exports.SourceNode = __webpack_require__(605).SourceNode;
* http://opensource.org/licenses/BSD-3-Clause
*/
-var base64VLQ = __webpack_require__(597);
-var util = __webpack_require__(599);
-var ArraySet = __webpack_require__(600).ArraySet;
-var MappingList = __webpack_require__(601).MappingList;
+var base64VLQ = __webpack_require__(601);
+var util = __webpack_require__(603);
+var ArraySet = __webpack_require__(604).ArraySet;
+var MappingList = __webpack_require__(605).MappingList;
/**
* An instance of the SourceMapGenerator represents a source map which is
@@ -67764,7 +67990,7 @@ exports.SourceMapGenerator = SourceMapGenerator;
/***/ }),
-/* 597 */
+/* 601 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
@@ -67804,7 +68030,7 @@ exports.SourceMapGenerator = SourceMapGenerator;
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-var base64 = __webpack_require__(598);
+var base64 = __webpack_require__(602);
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
// length quantities we use in the source map spec, the first bit is the sign,
@@ -67910,7 +68136,7 @@ exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
/***/ }),
-/* 598 */
+/* 602 */
/***/ (function(module, exports) {
/* -*- Mode: js; js-indent-level: 2; -*- */
@@ -67983,7 +68209,7 @@ exports.decode = function (charCode) {
/***/ }),
-/* 599 */
+/* 603 */
/***/ (function(module, exports) {
/* -*- Mode: js; js-indent-level: 2; -*- */
@@ -68406,7 +68632,7 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate
/***/ }),
-/* 600 */
+/* 604 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
@@ -68416,7 +68642,7 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate
* http://opensource.org/licenses/BSD-3-Clause
*/
-var util = __webpack_require__(599);
+var util = __webpack_require__(603);
var has = Object.prototype.hasOwnProperty;
var hasNativeMap = typeof Map !== "undefined";
@@ -68533,7 +68759,7 @@ exports.ArraySet = ArraySet;
/***/ }),
-/* 601 */
+/* 605 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
@@ -68543,7 +68769,7 @@ exports.ArraySet = ArraySet;
* http://opensource.org/licenses/BSD-3-Clause
*/
-var util = __webpack_require__(599);
+var util = __webpack_require__(603);
/**
* Determine whether mappingB is after mappingA with respect to generated
@@ -68618,7 +68844,7 @@ exports.MappingList = MappingList;
/***/ }),
-/* 602 */
+/* 606 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
@@ -68628,11 +68854,11 @@ exports.MappingList = MappingList;
* http://opensource.org/licenses/BSD-3-Clause
*/
-var util = __webpack_require__(599);
-var binarySearch = __webpack_require__(603);
-var ArraySet = __webpack_require__(600).ArraySet;
-var base64VLQ = __webpack_require__(597);
-var quickSort = __webpack_require__(604).quickSort;
+var util = __webpack_require__(603);
+var binarySearch = __webpack_require__(607);
+var ArraySet = __webpack_require__(604).ArraySet;
+var base64VLQ = __webpack_require__(601);
+var quickSort = __webpack_require__(608).quickSort;
function SourceMapConsumer(aSourceMap) {
var sourceMap = aSourceMap;
@@ -69706,7 +69932,7 @@ exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
/***/ }),
-/* 603 */
+/* 607 */
/***/ (function(module, exports) {
/* -*- Mode: js; js-indent-level: 2; -*- */
@@ -69823,7 +70049,7 @@ exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
/***/ }),
-/* 604 */
+/* 608 */
/***/ (function(module, exports) {
/* -*- Mode: js; js-indent-level: 2; -*- */
@@ -69943,7 +70169,7 @@ exports.quickSort = function (ary, comparator) {
/***/ }),
-/* 605 */
+/* 609 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
@@ -69953,8 +70179,8 @@ exports.quickSort = function (ary, comparator) {
* http://opensource.org/licenses/BSD-3-Clause
*/
-var SourceMapGenerator = __webpack_require__(596).SourceMapGenerator;
-var util = __webpack_require__(599);
+var SourceMapGenerator = __webpack_require__(600).SourceMapGenerator;
+var util = __webpack_require__(603);
// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
// operating systems these days (capturing the result).
@@ -70362,17 +70588,17 @@ exports.SourceNode = SourceNode;
/***/ }),
-/* 606 */
+/* 610 */
/***/ (function(module, exports, __webpack_require__) {
// Copyright 2014, 2015, 2016, 2017 Simon Lydell
// X11 (“MIT”) Licensed. (See LICENSE.)
-var sourceMappingURL = __webpack_require__(607)
-var resolveUrl = __webpack_require__(608)
-var decodeUriComponent = __webpack_require__(609)
-var urix = __webpack_require__(611)
-var atob = __webpack_require__(612)
+var sourceMappingURL = __webpack_require__(611)
+var resolveUrl = __webpack_require__(612)
+var decodeUriComponent = __webpack_require__(613)
+var urix = __webpack_require__(615)
+var atob = __webpack_require__(616)
@@ -70670,7 +70896,7 @@ module.exports = {
/***/ }),
-/* 607 */
+/* 611 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright 2014 Simon Lydell
@@ -70733,7 +70959,7 @@ void (function(root, factory) {
/***/ }),
-/* 608 */
+/* 612 */
/***/ (function(module, exports, __webpack_require__) {
// Copyright 2014 Simon Lydell
@@ -70751,13 +70977,13 @@ module.exports = resolveUrl
/***/ }),
-/* 609 */
+/* 613 */
/***/ (function(module, exports, __webpack_require__) {
// Copyright 2017 Simon Lydell
// X11 (“MIT”) Licensed. (See LICENSE.)
-var decodeUriComponent = __webpack_require__(610)
+var decodeUriComponent = __webpack_require__(614)
function customDecodeUriComponent(string) {
// `decodeUriComponent` turns `+` into ` `, but that's not wanted.
@@ -70768,7 +70994,7 @@ module.exports = customDecodeUriComponent
/***/ }),
-/* 610 */
+/* 614 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -70869,7 +71095,7 @@ module.exports = function (encodedURI) {
/***/ }),
-/* 611 */
+/* 615 */
/***/ (function(module, exports, __webpack_require__) {
// Copyright 2014 Simon Lydell
@@ -70892,7 +71118,7 @@ module.exports = urix
/***/ }),
-/* 612 */
+/* 616 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -70906,7 +71132,7 @@ module.exports = atob.atob = atob;
/***/ }),
-/* 613 */
+/* 617 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -70914,8 +71140,8 @@ module.exports = atob.atob = atob;
var fs = __webpack_require__(133);
var path = __webpack_require__(4);
-var define = __webpack_require__(517);
-var utils = __webpack_require__(594);
+var define = __webpack_require__(521);
+var utils = __webpack_require__(598);
/**
* Expose `mixin()`.
@@ -71058,19 +71284,19 @@ exports.comment = function(node) {
/***/ }),
-/* 614 */
+/* 618 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var use = __webpack_require__(586);
+var use = __webpack_require__(590);
var util = __webpack_require__(111);
-var Cache = __webpack_require__(615);
-var define = __webpack_require__(517);
-var debug = __webpack_require__(588)('snapdragon:parser');
-var Position = __webpack_require__(616);
-var utils = __webpack_require__(594);
+var Cache = __webpack_require__(619);
+var define = __webpack_require__(521);
+var debug = __webpack_require__(592)('snapdragon:parser');
+var Position = __webpack_require__(620);
+var utils = __webpack_require__(598);
/**
* Create a new `Parser` with the given `input` and `options`.
@@ -71598,7 +71824,7 @@ module.exports = Parser;
/***/ }),
-/* 615 */
+/* 619 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -71705,13 +71931,13 @@ MapCache.prototype.del = function mapDelete(key) {
/***/ }),
-/* 616 */
+/* 620 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var define = __webpack_require__(517);
+var define = __webpack_require__(521);
/**
* Store position for a node
@@ -71726,16 +71952,16 @@ module.exports = function Position(start, parser) {
/***/ }),
-/* 617 */
+/* 621 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var safe = __webpack_require__(618);
-var define = __webpack_require__(624);
-var extend = __webpack_require__(625);
-var not = __webpack_require__(627);
+var safe = __webpack_require__(622);
+var define = __webpack_require__(628);
+var extend = __webpack_require__(629);
+var not = __webpack_require__(631);
var MAX_LENGTH = 1024 * 64;
/**
@@ -71888,10 +72114,10 @@ module.exports.makeRe = makeRe;
/***/ }),
-/* 618 */
+/* 622 */
/***/ (function(module, exports, __webpack_require__) {
-var parse = __webpack_require__(619);
+var parse = __webpack_require__(623);
var types = parse.types;
module.exports = function (re, opts) {
@@ -71937,13 +72163,13 @@ function isRegExp (x) {
/***/ }),
-/* 619 */
+/* 623 */
/***/ (function(module, exports, __webpack_require__) {
-var util = __webpack_require__(620);
-var types = __webpack_require__(621);
-var sets = __webpack_require__(622);
-var positions = __webpack_require__(623);
+var util = __webpack_require__(624);
+var types = __webpack_require__(625);
+var sets = __webpack_require__(626);
+var positions = __webpack_require__(627);
module.exports = function(regexpStr) {
@@ -72225,11 +72451,11 @@ module.exports.types = types;
/***/ }),
-/* 620 */
+/* 624 */
/***/ (function(module, exports, __webpack_require__) {
-var types = __webpack_require__(621);
-var sets = __webpack_require__(622);
+var types = __webpack_require__(625);
+var sets = __webpack_require__(626);
// All of these are private and only used by randexp.
@@ -72342,7 +72568,7 @@ exports.error = function(regexp, msg) {
/***/ }),
-/* 621 */
+/* 625 */
/***/ (function(module, exports) {
module.exports = {
@@ -72358,10 +72584,10 @@ module.exports = {
/***/ }),
-/* 622 */
+/* 626 */
/***/ (function(module, exports, __webpack_require__) {
-var types = __webpack_require__(621);
+var types = __webpack_require__(625);
var INTS = function() {
return [{ type: types.RANGE , from: 48, to: 57 }];
@@ -72446,10 +72672,10 @@ exports.anyChar = function() {
/***/ }),
-/* 623 */
+/* 627 */
/***/ (function(module, exports, __webpack_require__) {
-var types = __webpack_require__(621);
+var types = __webpack_require__(625);
exports.wordBoundary = function() {
return { type: types.POSITION, value: 'b' };
@@ -72469,7 +72695,7 @@ exports.end = function() {
/***/ }),
-/* 624 */
+/* 628 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -72482,8 +72708,8 @@ exports.end = function() {
-var isobject = __webpack_require__(535);
-var isDescriptor = __webpack_require__(547);
+var isobject = __webpack_require__(539);
+var isDescriptor = __webpack_require__(551);
var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty)
? Reflect.defineProperty
: Object.defineProperty;
@@ -72514,14 +72740,14 @@ module.exports = function defineProperty(obj, key, val) {
/***/ }),
-/* 625 */
+/* 629 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var isExtendable = __webpack_require__(626);
-var assignSymbols = __webpack_require__(536);
+var isExtendable = __webpack_require__(630);
+var assignSymbols = __webpack_require__(540);
module.exports = Object.assign || function(obj/*, objects*/) {
if (obj === null || typeof obj === 'undefined') {
@@ -72581,7 +72807,7 @@ function isEnum(obj, key) {
/***/ }),
-/* 626 */
+/* 630 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -72594,7 +72820,7 @@ function isEnum(obj, key) {
-var isPlainObject = __webpack_require__(534);
+var isPlainObject = __webpack_require__(538);
module.exports = function isExtendable(val) {
return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
@@ -72602,14 +72828,14 @@ module.exports = function isExtendable(val) {
/***/ }),
-/* 627 */
+/* 631 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var extend = __webpack_require__(625);
-var safe = __webpack_require__(618);
+var extend = __webpack_require__(629);
+var safe = __webpack_require__(622);
/**
* The main export is a function that takes a `pattern` string and an `options` object.
@@ -72681,14 +72907,14 @@ module.exports = toRegex;
/***/ }),
-/* 628 */
+/* 632 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var nanomatch = __webpack_require__(629);
-var extglob = __webpack_require__(644);
+var nanomatch = __webpack_require__(633);
+var extglob = __webpack_require__(648);
module.exports = function(snapdragon) {
var compilers = snapdragon.compiler.compilers;
@@ -72765,7 +72991,7 @@ function escapeExtglobs(compiler) {
/***/ }),
-/* 629 */
+/* 633 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -72776,17 +73002,17 @@ function escapeExtglobs(compiler) {
*/
var util = __webpack_require__(111);
-var toRegex = __webpack_require__(516);
-var extend = __webpack_require__(630);
+var toRegex = __webpack_require__(520);
+var extend = __webpack_require__(634);
/**
* Local dependencies
*/
-var compilers = __webpack_require__(632);
-var parsers = __webpack_require__(633);
-var cache = __webpack_require__(636);
-var utils = __webpack_require__(638);
+var compilers = __webpack_require__(636);
+var parsers = __webpack_require__(637);
+var cache = __webpack_require__(640);
+var utils = __webpack_require__(642);
var MAX_LENGTH = 1024 * 64;
/**
@@ -73610,14 +73836,14 @@ module.exports = nanomatch;
/***/ }),
-/* 630 */
+/* 634 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var isExtendable = __webpack_require__(631);
-var assignSymbols = __webpack_require__(536);
+var isExtendable = __webpack_require__(635);
+var assignSymbols = __webpack_require__(540);
module.exports = Object.assign || function(obj/*, objects*/) {
if (obj === null || typeof obj === 'undefined') {
@@ -73677,7 +73903,7 @@ function isEnum(obj, key) {
/***/ }),
-/* 631 */
+/* 635 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -73690,7 +73916,7 @@ function isEnum(obj, key) {
-var isPlainObject = __webpack_require__(534);
+var isPlainObject = __webpack_require__(538);
module.exports = function isExtendable(val) {
return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
@@ -73698,7 +73924,7 @@ module.exports = function isExtendable(val) {
/***/ }),
-/* 632 */
+/* 636 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -74044,15 +74270,15 @@ module.exports = function(nanomatch, options) {
/***/ }),
-/* 633 */
+/* 637 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var regexNot = __webpack_require__(527);
-var toRegex = __webpack_require__(516);
-var isOdd = __webpack_require__(634);
+var regexNot = __webpack_require__(531);
+var toRegex = __webpack_require__(520);
+var isOdd = __webpack_require__(638);
/**
* Characters to use in negation regex (we want to "not" match
@@ -74438,7 +74664,7 @@ module.exports.not = NOT_REGEX;
/***/ }),
-/* 634 */
+/* 638 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -74451,7 +74677,7 @@ module.exports.not = NOT_REGEX;
-var isNumber = __webpack_require__(635);
+var isNumber = __webpack_require__(639);
module.exports = function isOdd(i) {
if (!isNumber(i)) {
@@ -74465,7 +74691,7 @@ module.exports = function isOdd(i) {
/***/ }),
-/* 635 */
+/* 639 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -74493,14 +74719,14 @@ module.exports = function isNumber(num) {
/***/ }),
-/* 636 */
+/* 640 */
/***/ (function(module, exports, __webpack_require__) {
-module.exports = new (__webpack_require__(637))();
+module.exports = new (__webpack_require__(641))();
/***/ }),
-/* 637 */
+/* 641 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -74513,7 +74739,7 @@ module.exports = new (__webpack_require__(637))();
-var MapCache = __webpack_require__(615);
+var MapCache = __webpack_require__(619);
/**
* Create a new `FragmentCache` with an optional object to use for `caches`.
@@ -74635,7 +74861,7 @@ exports = module.exports = FragmentCache;
/***/ }),
-/* 638 */
+/* 642 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -74648,14 +74874,14 @@ var path = __webpack_require__(4);
* Module dependencies
*/
-var isWindows = __webpack_require__(639)();
-var Snapdragon = __webpack_require__(555);
-utils.define = __webpack_require__(640);
-utils.diff = __webpack_require__(641);
-utils.extend = __webpack_require__(630);
-utils.pick = __webpack_require__(642);
-utils.typeOf = __webpack_require__(643);
-utils.unique = __webpack_require__(528);
+var isWindows = __webpack_require__(643)();
+var Snapdragon = __webpack_require__(559);
+utils.define = __webpack_require__(644);
+utils.diff = __webpack_require__(645);
+utils.extend = __webpack_require__(634);
+utils.pick = __webpack_require__(646);
+utils.typeOf = __webpack_require__(647);
+utils.unique = __webpack_require__(532);
/**
* Returns true if the given value is effectively an empty string
@@ -75021,7 +75247,7 @@ utils.unixify = function(options) {
/***/ }),
-/* 639 */
+/* 643 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
@@ -75049,7 +75275,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
/***/ }),
-/* 640 */
+/* 644 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -75062,8 +75288,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
-var isobject = __webpack_require__(535);
-var isDescriptor = __webpack_require__(547);
+var isobject = __webpack_require__(539);
+var isDescriptor = __webpack_require__(551);
var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty)
? Reflect.defineProperty
: Object.defineProperty;
@@ -75094,7 +75320,7 @@ module.exports = function defineProperty(obj, key, val) {
/***/ }),
-/* 641 */
+/* 645 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -75148,7 +75374,7 @@ function diffArray(one, two) {
/***/ }),
-/* 642 */
+/* 646 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -75161,7 +75387,7 @@ function diffArray(one, two) {
-var isObject = __webpack_require__(535);
+var isObject = __webpack_require__(539);
module.exports = function pick(obj, keys) {
if (!isObject(obj) && typeof obj !== 'function') {
@@ -75190,7 +75416,7 @@ module.exports = function pick(obj, keys) {
/***/ }),
-/* 643 */
+/* 647 */
/***/ (function(module, exports) {
var toString = Object.prototype.toString;
@@ -75325,7 +75551,7 @@ function isBuffer(val) {
/***/ }),
-/* 644 */
+/* 648 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -75335,18 +75561,18 @@ function isBuffer(val) {
* Module dependencies
*/
-var extend = __webpack_require__(525);
-var unique = __webpack_require__(528);
-var toRegex = __webpack_require__(516);
+var extend = __webpack_require__(529);
+var unique = __webpack_require__(532);
+var toRegex = __webpack_require__(520);
/**
* Local dependencies
*/
-var compilers = __webpack_require__(645);
-var parsers = __webpack_require__(656);
-var Extglob = __webpack_require__(659);
-var utils = __webpack_require__(658);
+var compilers = __webpack_require__(649);
+var parsers = __webpack_require__(660);
+var Extglob = __webpack_require__(663);
+var utils = __webpack_require__(662);
var MAX_LENGTH = 1024 * 64;
/**
@@ -75663,13 +75889,13 @@ module.exports = extglob;
/***/ }),
-/* 645 */
+/* 649 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var brackets = __webpack_require__(646);
+var brackets = __webpack_require__(650);
/**
* Extglob compilers
@@ -75839,7 +76065,7 @@ module.exports = function(extglob) {
/***/ }),
-/* 646 */
+/* 650 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -75849,17 +76075,17 @@ module.exports = function(extglob) {
* Local dependencies
*/
-var compilers = __webpack_require__(647);
-var parsers = __webpack_require__(649);
+var compilers = __webpack_require__(651);
+var parsers = __webpack_require__(653);
/**
* Module dependencies
*/
-var debug = __webpack_require__(651)('expand-brackets');
-var extend = __webpack_require__(525);
-var Snapdragon = __webpack_require__(555);
-var toRegex = __webpack_require__(516);
+var debug = __webpack_require__(655)('expand-brackets');
+var extend = __webpack_require__(529);
+var Snapdragon = __webpack_require__(559);
+var toRegex = __webpack_require__(520);
/**
* Parses the given POSIX character class `pattern` and returns a
@@ -76057,13 +76283,13 @@ module.exports = brackets;
/***/ }),
-/* 647 */
+/* 651 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var posix = __webpack_require__(648);
+var posix = __webpack_require__(652);
module.exports = function(brackets) {
brackets.compiler
@@ -76151,7 +76377,7 @@ module.exports = function(brackets) {
/***/ }),
-/* 648 */
+/* 652 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -76180,14 +76406,14 @@ module.exports = {
/***/ }),
-/* 649 */
+/* 653 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var utils = __webpack_require__(650);
-var define = __webpack_require__(517);
+var utils = __webpack_require__(654);
+var define = __webpack_require__(521);
/**
* Text regex
@@ -76406,14 +76632,14 @@ module.exports.TEXT_REGEX = TEXT_REGEX;
/***/ }),
-/* 650 */
+/* 654 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var toRegex = __webpack_require__(516);
-var regexNot = __webpack_require__(527);
+var toRegex = __webpack_require__(520);
+var regexNot = __webpack_require__(531);
var cached;
/**
@@ -76447,7 +76673,7 @@ exports.createRegex = function(pattern, include) {
/***/ }),
-/* 651 */
+/* 655 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -76456,14 +76682,14 @@ exports.createRegex = function(pattern, include) {
*/
if (typeof process !== 'undefined' && process.type === 'renderer') {
- module.exports = __webpack_require__(652);
+ module.exports = __webpack_require__(656);
} else {
- module.exports = __webpack_require__(655);
+ module.exports = __webpack_require__(659);
}
/***/ }),
-/* 652 */
+/* 656 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -76472,7 +76698,7 @@ if (typeof process !== 'undefined' && process.type === 'renderer') {
* Expose `debug()` as the module.
*/
-exports = module.exports = __webpack_require__(653);
+exports = module.exports = __webpack_require__(657);
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
@@ -76654,7 +76880,7 @@ function localstorage() {
/***/ }),
-/* 653 */
+/* 657 */
/***/ (function(module, exports, __webpack_require__) {
@@ -76670,7 +76896,7 @@ exports.coerce = coerce;
exports.disable = disable;
exports.enable = enable;
exports.enabled = enabled;
-exports.humanize = __webpack_require__(654);
+exports.humanize = __webpack_require__(658);
/**
* The currently active debug mode names, and names to skip.
@@ -76862,7 +77088,7 @@ function coerce(val) {
/***/ }),
-/* 654 */
+/* 658 */
/***/ (function(module, exports) {
/**
@@ -77020,7 +77246,7 @@ function plural(ms, n, name) {
/***/ }),
-/* 655 */
+/* 659 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -77036,7 +77262,7 @@ var util = __webpack_require__(111);
* Expose `debug()` as the module.
*/
-exports = module.exports = __webpack_require__(653);
+exports = module.exports = __webpack_require__(657);
exports.init = init;
exports.log = log;
exports.formatArgs = formatArgs;
@@ -77215,7 +77441,7 @@ function createWritableStdioStream (fd) {
case 'PIPE':
case 'TCP':
- var net = __webpack_require__(593);
+ var net = __webpack_require__(597);
stream = new net.Socket({
fd: fd,
readable: false,
@@ -77274,15 +77500,15 @@ exports.enable(load());
/***/ }),
-/* 656 */
+/* 660 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var brackets = __webpack_require__(646);
-var define = __webpack_require__(657);
-var utils = __webpack_require__(658);
+var brackets = __webpack_require__(650);
+var define = __webpack_require__(661);
+var utils = __webpack_require__(662);
/**
* Characters to use in text regex (we want to "not" match
@@ -77437,7 +77663,7 @@ module.exports = parsers;
/***/ }),
-/* 657 */
+/* 661 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -77450,7 +77676,7 @@ module.exports = parsers;
-var isDescriptor = __webpack_require__(547);
+var isDescriptor = __webpack_require__(551);
module.exports = function defineProperty(obj, prop, val) {
if (typeof obj !== 'object' && typeof obj !== 'function') {
@@ -77475,14 +77701,14 @@ module.exports = function defineProperty(obj, prop, val) {
/***/ }),
-/* 658 */
+/* 662 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var regex = __webpack_require__(527);
-var Cache = __webpack_require__(637);
+var regex = __webpack_require__(531);
+var Cache = __webpack_require__(641);
/**
* Utils
@@ -77551,7 +77777,7 @@ utils.createRegex = function(str) {
/***/ }),
-/* 659 */
+/* 663 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -77561,16 +77787,16 @@ utils.createRegex = function(str) {
* Module dependencies
*/
-var Snapdragon = __webpack_require__(555);
-var define = __webpack_require__(657);
-var extend = __webpack_require__(525);
+var Snapdragon = __webpack_require__(559);
+var define = __webpack_require__(661);
+var extend = __webpack_require__(529);
/**
* Local dependencies
*/
-var compilers = __webpack_require__(645);
-var parsers = __webpack_require__(656);
+var compilers = __webpack_require__(649);
+var parsers = __webpack_require__(660);
/**
* Customize Snapdragon parser and renderer
@@ -77636,16 +77862,16 @@ module.exports = Extglob;
/***/ }),
-/* 660 */
+/* 664 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var extglob = __webpack_require__(644);
-var nanomatch = __webpack_require__(629);
-var regexNot = __webpack_require__(527);
-var toRegex = __webpack_require__(617);
+var extglob = __webpack_require__(648);
+var nanomatch = __webpack_require__(633);
+var regexNot = __webpack_require__(531);
+var toRegex = __webpack_require__(621);
var not;
/**
@@ -77726,14 +77952,14 @@ function textRegex(pattern) {
/***/ }),
-/* 661 */
+/* 665 */
/***/ (function(module, exports, __webpack_require__) {
-module.exports = new (__webpack_require__(637))();
+module.exports = new (__webpack_require__(641))();
/***/ }),
-/* 662 */
+/* 666 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -77746,13 +77972,13 @@ var path = __webpack_require__(4);
* Module dependencies
*/
-var Snapdragon = __webpack_require__(555);
-utils.define = __webpack_require__(624);
-utils.diff = __webpack_require__(641);
-utils.extend = __webpack_require__(625);
-utils.pick = __webpack_require__(642);
-utils.typeOf = __webpack_require__(663);
-utils.unique = __webpack_require__(528);
+var Snapdragon = __webpack_require__(559);
+utils.define = __webpack_require__(628);
+utils.diff = __webpack_require__(645);
+utils.extend = __webpack_require__(629);
+utils.pick = __webpack_require__(646);
+utils.typeOf = __webpack_require__(667);
+utils.unique = __webpack_require__(532);
/**
* Returns true if the platform is windows, or `path.sep` is `\\`.
@@ -78049,7 +78275,7 @@ utils.unixify = function(options) {
/***/ }),
-/* 663 */
+/* 667 */
/***/ (function(module, exports) {
var toString = Object.prototype.toString;
@@ -78184,7 +78410,7 @@ function isBuffer(val) {
/***/ }),
-/* 664 */
+/* 668 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -78203,9 +78429,9 @@ var __extends = (this && this.__extends) || (function () {
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
-var readdir = __webpack_require__(665);
-var reader_1 = __webpack_require__(678);
-var fs_stream_1 = __webpack_require__(682);
+var readdir = __webpack_require__(669);
+var reader_1 = __webpack_require__(682);
+var fs_stream_1 = __webpack_require__(686);
var ReaderAsync = /** @class */ (function (_super) {
__extends(ReaderAsync, _super);
function ReaderAsync() {
@@ -78266,15 +78492,15 @@ exports.default = ReaderAsync;
/***/ }),
-/* 665 */
+/* 669 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const readdirSync = __webpack_require__(666);
-const readdirAsync = __webpack_require__(674);
-const readdirStream = __webpack_require__(677);
+const readdirSync = __webpack_require__(670);
+const readdirAsync = __webpack_require__(678);
+const readdirStream = __webpack_require__(681);
module.exports = exports = readdirAsyncPath;
exports.readdir = exports.readdirAsync = exports.async = readdirAsyncPath;
@@ -78358,7 +78584,7 @@ function readdirStreamStat (dir, options) {
/***/ }),
-/* 666 */
+/* 670 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -78366,11 +78592,11 @@ function readdirStreamStat (dir, options) {
module.exports = readdirSync;
-const DirectoryReader = __webpack_require__(667);
+const DirectoryReader = __webpack_require__(671);
let syncFacade = {
- fs: __webpack_require__(672),
- forEach: __webpack_require__(673),
+ fs: __webpack_require__(676),
+ forEach: __webpack_require__(677),
sync: true
};
@@ -78399,7 +78625,7 @@ function readdirSync (dir, options, internalOptions) {
/***/ }),
-/* 667 */
+/* 671 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -78408,9 +78634,9 @@ function readdirSync (dir, options, internalOptions) {
const Readable = __webpack_require__(137).Readable;
const EventEmitter = __webpack_require__(155).EventEmitter;
const path = __webpack_require__(4);
-const normalizeOptions = __webpack_require__(668);
-const stat = __webpack_require__(670);
-const call = __webpack_require__(671);
+const normalizeOptions = __webpack_require__(672);
+const stat = __webpack_require__(674);
+const call = __webpack_require__(675);
/**
* Asynchronously reads the contents of a directory and streams the results
@@ -78786,14 +79012,14 @@ module.exports = DirectoryReader;
/***/ }),
-/* 668 */
+/* 672 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const path = __webpack_require__(4);
-const globToRegExp = __webpack_require__(669);
+const globToRegExp = __webpack_require__(673);
module.exports = normalizeOptions;
@@ -78970,7 +79196,7 @@ function normalizeOptions (options, internalOptions) {
/***/ }),
-/* 669 */
+/* 673 */
/***/ (function(module, exports) {
module.exports = function (glob, opts) {
@@ -79107,13 +79333,13 @@ module.exports = function (glob, opts) {
/***/ }),
-/* 670 */
+/* 674 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const call = __webpack_require__(671);
+const call = __webpack_require__(675);
module.exports = stat;
@@ -79188,7 +79414,7 @@ function symlinkStat (fs, path, lstats, callback) {
/***/ }),
-/* 671 */
+/* 675 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -79249,14 +79475,14 @@ function callOnce (fn) {
/***/ }),
-/* 672 */
+/* 676 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const fs = __webpack_require__(133);
-const call = __webpack_require__(671);
+const call = __webpack_require__(675);
/**
* A facade around {@link fs.readdirSync} that allows it to be called
@@ -79320,7 +79546,7 @@ exports.lstat = function (path, callback) {
/***/ }),
-/* 673 */
+/* 677 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -79349,7 +79575,7 @@ function syncForEach (array, iterator, done) {
/***/ }),
-/* 674 */
+/* 678 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -79357,12 +79583,12 @@ function syncForEach (array, iterator, done) {
module.exports = readdirAsync;
-const maybe = __webpack_require__(675);
-const DirectoryReader = __webpack_require__(667);
+const maybe = __webpack_require__(679);
+const DirectoryReader = __webpack_require__(671);
let asyncFacade = {
fs: __webpack_require__(133),
- forEach: __webpack_require__(676),
+ forEach: __webpack_require__(680),
async: true
};
@@ -79404,7 +79630,7 @@ function readdirAsync (dir, options, callback, internalOptions) {
/***/ }),
-/* 675 */
+/* 679 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -79431,7 +79657,7 @@ module.exports = function maybe (cb, promise) {
/***/ }),
-/* 676 */
+/* 680 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -79467,7 +79693,7 @@ function asyncForEach (array, iterator, done) {
/***/ }),
-/* 677 */
+/* 681 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -79475,11 +79701,11 @@ function asyncForEach (array, iterator, done) {
module.exports = readdirStream;
-const DirectoryReader = __webpack_require__(667);
+const DirectoryReader = __webpack_require__(671);
let streamFacade = {
fs: __webpack_require__(133),
- forEach: __webpack_require__(676),
+ forEach: __webpack_require__(680),
async: true
};
@@ -79499,16 +79725,16 @@ function readdirStream (dir, options, internalOptions) {
/***/ }),
-/* 678 */
+/* 682 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path = __webpack_require__(4);
-var deep_1 = __webpack_require__(679);
-var entry_1 = __webpack_require__(681);
-var pathUtil = __webpack_require__(680);
+var deep_1 = __webpack_require__(683);
+var entry_1 = __webpack_require__(685);
+var pathUtil = __webpack_require__(684);
var Reader = /** @class */ (function () {
function Reader(options) {
this.options = options;
@@ -79574,14 +79800,14 @@ exports.default = Reader;
/***/ }),
-/* 679 */
+/* 683 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-var pathUtils = __webpack_require__(680);
-var patternUtils = __webpack_require__(509);
+var pathUtils = __webpack_require__(684);
+var patternUtils = __webpack_require__(513);
var DeepFilter = /** @class */ (function () {
function DeepFilter(options, micromatchOptions) {
this.options = options;
@@ -79664,7 +79890,7 @@ exports.default = DeepFilter;
/***/ }),
-/* 680 */
+/* 684 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -79695,14 +79921,14 @@ exports.makeAbsolute = makeAbsolute;
/***/ }),
-/* 681 */
+/* 685 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-var pathUtils = __webpack_require__(680);
-var patternUtils = __webpack_require__(509);
+var pathUtils = __webpack_require__(684);
+var patternUtils = __webpack_require__(513);
var EntryFilter = /** @class */ (function () {
function EntryFilter(options, micromatchOptions) {
this.options = options;
@@ -79787,7 +80013,7 @@ exports.default = EntryFilter;
/***/ }),
-/* 682 */
+/* 686 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -79807,8 +80033,8 @@ var __extends = (this && this.__extends) || (function () {
})();
Object.defineProperty(exports, "__esModule", { value: true });
var stream = __webpack_require__(137);
-var fsStat = __webpack_require__(683);
-var fs_1 = __webpack_require__(687);
+var fsStat = __webpack_require__(687);
+var fs_1 = __webpack_require__(691);
var FileSystemStream = /** @class */ (function (_super) {
__extends(FileSystemStream, _super);
function FileSystemStream() {
@@ -79858,14 +80084,14 @@ exports.default = FileSystemStream;
/***/ }),
-/* 683 */
+/* 687 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const optionsManager = __webpack_require__(684);
-const statProvider = __webpack_require__(686);
+const optionsManager = __webpack_require__(688);
+const statProvider = __webpack_require__(690);
/**
* Asynchronous API.
*/
@@ -79896,13 +80122,13 @@ exports.statSync = statSync;
/***/ }),
-/* 684 */
+/* 688 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const fsAdapter = __webpack_require__(685);
+const fsAdapter = __webpack_require__(689);
function prepare(opts) {
const options = Object.assign({
fs: fsAdapter.getFileSystemAdapter(opts ? opts.fs : undefined),
@@ -79915,7 +80141,7 @@ exports.prepare = prepare;
/***/ }),
-/* 685 */
+/* 689 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -79938,7 +80164,7 @@ exports.getFileSystemAdapter = getFileSystemAdapter;
/***/ }),
-/* 686 */
+/* 690 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -79990,7 +80216,7 @@ exports.isFollowedSymlink = isFollowedSymlink;
/***/ }),
-/* 687 */
+/* 691 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -80021,7 +80247,7 @@ exports.default = FileSystem;
/***/ }),
-/* 688 */
+/* 692 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -80041,9 +80267,9 @@ var __extends = (this && this.__extends) || (function () {
})();
Object.defineProperty(exports, "__esModule", { value: true });
var stream = __webpack_require__(137);
-var readdir = __webpack_require__(665);
-var reader_1 = __webpack_require__(678);
-var fs_stream_1 = __webpack_require__(682);
+var readdir = __webpack_require__(669);
+var reader_1 = __webpack_require__(682);
+var fs_stream_1 = __webpack_require__(686);
var TransformStream = /** @class */ (function (_super) {
__extends(TransformStream, _super);
function TransformStream(reader) {
@@ -80111,7 +80337,7 @@ exports.default = ReaderStream;
/***/ }),
-/* 689 */
+/* 693 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -80130,9 +80356,9 @@ var __extends = (this && this.__extends) || (function () {
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
-var readdir = __webpack_require__(665);
-var reader_1 = __webpack_require__(678);
-var fs_sync_1 = __webpack_require__(690);
+var readdir = __webpack_require__(669);
+var reader_1 = __webpack_require__(682);
+var fs_sync_1 = __webpack_require__(694);
var ReaderSync = /** @class */ (function (_super) {
__extends(ReaderSync, _super);
function ReaderSync() {
@@ -80192,7 +80418,7 @@ exports.default = ReaderSync;
/***/ }),
-/* 690 */
+/* 694 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -80211,8 +80437,8 @@ var __extends = (this && this.__extends) || (function () {
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
-var fsStat = __webpack_require__(683);
-var fs_1 = __webpack_require__(687);
+var fsStat = __webpack_require__(687);
+var fs_1 = __webpack_require__(691);
var FileSystemSync = /** @class */ (function (_super) {
__extends(FileSystemSync, _super);
function FileSystemSync() {
@@ -80258,7 +80484,7 @@ exports.default = FileSystemSync;
/***/ }),
-/* 691 */
+/* 695 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -80274,13 +80500,13 @@ exports.flatten = flatten;
/***/ }),
-/* 692 */
+/* 696 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-var merge2 = __webpack_require__(288);
+var merge2 = __webpack_require__(283);
/**
* Merge multiple streams and propagate their errors into one stream in parallel.
*/
@@ -80295,13 +80521,13 @@ exports.merge = merge;
/***/ }),
-/* 693 */
+/* 697 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const path = __webpack_require__(4);
-const pathType = __webpack_require__(694);
+const pathType = __webpack_require__(698);
const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0];
@@ -80367,13 +80593,13 @@ module.exports.sync = (input, opts) => {
/***/ }),
-/* 694 */
+/* 698 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const fs = __webpack_require__(133);
-const pify = __webpack_require__(695);
+const pify = __webpack_require__(699);
function type(fn, fn2, fp) {
if (typeof fp !== 'string') {
@@ -80416,7 +80642,7 @@ exports.symlinkSync = typeSync.bind(null, 'lstatSync', 'isSymbolicLink');
/***/ }),
-/* 695 */
+/* 699 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -80507,17 +80733,17 @@ module.exports = (obj, opts) => {
/***/ }),
-/* 696 */
+/* 700 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const fs = __webpack_require__(133);
const path = __webpack_require__(4);
-const fastGlob = __webpack_require__(505);
-const gitIgnore = __webpack_require__(697);
-const pify = __webpack_require__(698);
-const slash = __webpack_require__(699);
+const fastGlob = __webpack_require__(509);
+const gitIgnore = __webpack_require__(701);
+const pify = __webpack_require__(702);
+const slash = __webpack_require__(703);
const DEFAULT_IGNORE = [
'**/node_modules/**',
@@ -80615,7 +80841,7 @@ module.exports.sync = options => {
/***/ }),
-/* 697 */
+/* 701 */
/***/ (function(module, exports) {
// A simple implementation of make-array
@@ -81084,7 +81310,7 @@ module.exports = options => new IgnoreBase(options)
/***/ }),
-/* 698 */
+/* 702 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -81159,7 +81385,7 @@ module.exports = (input, options) => {
/***/ }),
-/* 699 */
+/* 703 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -81177,7 +81403,7 @@ module.exports = input => {
/***/ }),
-/* 700 */
+/* 704 */
/***/ (function(module, exports, __webpack_require__) {
/*!
@@ -81187,7 +81413,7 @@ module.exports = input => {
* Released under the MIT License.
*/
-var isExtglob = __webpack_require__(299);
+var isExtglob = __webpack_require__(294);
var chars = { '{': '}', '(': ')', '[': ']'};
var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/;
@@ -81231,17 +81457,17 @@ module.exports = function isGlob(str, options) {
/***/ }),
-/* 701 */
+/* 705 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const path = __webpack_require__(4);
const {constants: fsConstants} = __webpack_require__(133);
-const pEvent = __webpack_require__(702);
-const CpFileError = __webpack_require__(705);
-const fs = __webpack_require__(709);
-const ProgressEmitter = __webpack_require__(712);
+const pEvent = __webpack_require__(706);
+const CpFileError = __webpack_require__(709);
+const fs = __webpack_require__(713);
+const ProgressEmitter = __webpack_require__(716);
const cpFileAsync = async (source, destination, options, progressEmitter) => {
let readError;
@@ -81355,12 +81581,12 @@ module.exports.sync = (source, destination, options) => {
/***/ }),
-/* 702 */
+/* 706 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const pTimeout = __webpack_require__(703);
+const pTimeout = __webpack_require__(707);
const symbolAsyncIterator = Symbol.asyncIterator || '@@asyncIterator';
@@ -81651,12 +81877,12 @@ module.exports.iterator = (emitter, event, options) => {
/***/ }),
-/* 703 */
+/* 707 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const pFinally = __webpack_require__(704);
+const pFinally = __webpack_require__(708);
class TimeoutError extends Error {
constructor(message) {
@@ -81702,7 +81928,7 @@ module.exports.TimeoutError = TimeoutError;
/***/ }),
-/* 704 */
+/* 708 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -81724,12 +81950,12 @@ module.exports = (promise, onFinally) => {
/***/ }),
-/* 705 */
+/* 709 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const NestedError = __webpack_require__(706);
+const NestedError = __webpack_require__(710);
class CpFileError extends NestedError {
constructor(message, nested) {
@@ -81743,10 +81969,10 @@ module.exports = CpFileError;
/***/ }),
-/* 706 */
+/* 710 */
/***/ (function(module, exports, __webpack_require__) {
-var inherits = __webpack_require__(707);
+var inherits = __webpack_require__(711);
var NestedError = function (message, nested) {
this.nested = nested;
@@ -81797,7 +82023,7 @@ module.exports = NestedError;
/***/ }),
-/* 707 */
+/* 711 */
/***/ (function(module, exports, __webpack_require__) {
try {
@@ -81805,12 +82031,12 @@ try {
if (typeof util.inherits !== 'function') throw '';
module.exports = util.inherits;
} catch (e) {
- module.exports = __webpack_require__(708);
+ module.exports = __webpack_require__(712);
}
/***/ }),
-/* 708 */
+/* 712 */
/***/ (function(module, exports) {
if (typeof Object.create === 'function') {
@@ -81839,16 +82065,16 @@ if (typeof Object.create === 'function') {
/***/ }),
-/* 709 */
+/* 713 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const {promisify} = __webpack_require__(111);
const fs = __webpack_require__(132);
-const makeDir = __webpack_require__(710);
-const pEvent = __webpack_require__(702);
-const CpFileError = __webpack_require__(705);
+const makeDir = __webpack_require__(714);
+const pEvent = __webpack_require__(706);
+const CpFileError = __webpack_require__(709);
const stat = promisify(fs.stat);
const lstat = promisify(fs.lstat);
@@ -81945,7 +82171,7 @@ exports.copyFileSync = (source, destination, flags) => {
/***/ }),
-/* 710 */
+/* 714 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -81953,7 +82179,7 @@ exports.copyFileSync = (source, destination, flags) => {
const fs = __webpack_require__(133);
const path = __webpack_require__(4);
const {promisify} = __webpack_require__(111);
-const semver = __webpack_require__(711);
+const semver = __webpack_require__(715);
const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0');
@@ -82108,7 +82334,7 @@ module.exports.sync = (input, options) => {
/***/ }),
-/* 711 */
+/* 715 */
/***/ (function(module, exports) {
exports = module.exports = SemVer
@@ -83710,7 +83936,7 @@ function coerce (version, options) {
/***/ }),
-/* 712 */
+/* 716 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -83751,7 +83977,7 @@ module.exports = ProgressEmitter;
/***/ }),
-/* 713 */
+/* 717 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -83797,12 +84023,12 @@ exports.default = module.exports;
/***/ }),
-/* 714 */
+/* 718 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-const NestedError = __webpack_require__(715);
+const NestedError = __webpack_require__(719);
class CpyError extends NestedError {
constructor(message, nested) {
@@ -83816,7 +84042,7 @@ module.exports = CpyError;
/***/ }),
-/* 715 */
+/* 719 */
/***/ (function(module, exports, __webpack_require__) {
var inherits = __webpack_require__(111).inherits;
diff --git a/packages/kbn-pm/package.json b/packages/kbn-pm/package.json
index c2f9236d9e798..f4e9ee8249900 100644
--- a/packages/kbn-pm/package.json
+++ b/packages/kbn-pm/package.json
@@ -28,7 +28,7 @@
"@types/node": ">=10.17.17 <10.20.0",
"@types/ora": "^1.3.5",
"@types/read-pkg": "^4.0.0",
- "@types/strip-ansi": "^3.0.0",
+ "@types/strip-ansi": "^5.2.1",
"@types/strong-log-transformer": "^1.0.0",
"@types/tempy": "^0.2.0",
"@types/write-pkg": "^3.1.0",
@@ -50,13 +50,13 @@
"log-symbols": "^2.2.0",
"multimatch": "^4.0.0",
"ncp": "^2.0.0",
- "ora": "^1.4.0",
+ "ora": "^4.0.4",
"prettier": "^2.1.1",
"read-pkg": "^5.2.0",
"rxjs": "^6.5.5",
"spawn-sync": "^1.0.15",
"string-replace-loader": "^2.2.0",
- "strip-ansi": "^4.0.0",
+ "strip-ansi": "^6.0.0",
"strong-log-transformer": "^2.1.0",
"tempy": "^0.3.0",
"typescript": "4.0.2",
diff --git a/packages/kbn-pm/src/utils/validate_yarn_lock.ts b/packages/kbn-pm/src/utils/validate_yarn_lock.ts
index e110dc4d921cf..ec853a3a958fb 100644
--- a/packages/kbn-pm/src/utils/validate_yarn_lock.ts
+++ b/packages/kbn-pm/src/utils/validate_yarn_lock.ts
@@ -25,6 +25,7 @@ import { writeFile } from './fs';
import { Kibana } from './kibana';
import { YarnLock } from './yarn_lock';
import { log } from './log';
+import { Project } from './project';
export async function validateYarnLock(kbn: Kibana, yarnLock: YarnLock) {
// look through all of the packages in the yarn.lock file to see if
@@ -95,5 +96,66 @@ export async function validateYarnLock(kbn: Kibana, yarnLock: YarnLock) {
process.exit(1);
}
+ // TODO: remove this once we move into a single package.json
+ // look through all the package.json files to find packages which have mismatched version ranges
+ const depRanges = new Map>();
+ for (const project of kbn.getAllProjects().values()) {
+ for (const [dep, range] of Object.entries(project.allDependencies)) {
+ const existingDep = depRanges.get(dep);
+ if (!existingDep) {
+ depRanges.set(dep, [
+ {
+ range,
+ projects: [project],
+ },
+ ]);
+ continue;
+ }
+
+ const existingRange = existingDep.find((existing) => existing.range === range);
+ if (!existingRange) {
+ existingDep.push({
+ range,
+ projects: [project],
+ });
+ continue;
+ }
+
+ existingRange.projects.push(project);
+ }
+ }
+
+ const duplicateRanges = Array.from(depRanges.entries())
+ .filter(([, ranges]) => ranges.length > 1)
+ .reduce(
+ (acc: string[], [dep, ranges]) => [
+ ...acc,
+ dep,
+ ...ranges.map(
+ ({ range, projects }) => ` ${range} => ${projects.map((p) => p.name).join(', ')}`
+ ),
+ ],
+ []
+ )
+ .join('\n ');
+
+ if (duplicateRanges) {
+ log.error(dedent`
+
+ [single_version_dependencies] Multiple version ranges for the same dependency
+ were found declared across different package.json files. Please consolidate
+ those to match across all package.json files. Different versions for the
+ same dependency is not supported.
+
+ If you have questions about this please reach out to the operations team.
+
+ The conflicting dependencies are:
+
+ ${duplicateRanges}
+ `);
+
+ process.exit(1);
+ }
+
log.success('yarn.lock analysis completed without any issues');
}
diff --git a/packages/kbn-release-notes/package.json b/packages/kbn-release-notes/package.json
index f8971fa02aa87..268530c22399a 100644
--- a/packages/kbn-release-notes/package.json
+++ b/packages/kbn-release-notes/package.json
@@ -13,7 +13,7 @@
"axios": "^0.19.2",
"cheerio": "0.22.0",
"dedent": "^0.7.0",
- "graphql": "^14.0.0",
+ "graphql": "^0.13.2",
"graphql-tag": "^2.10.3",
"terminal-link": "^2.1.1"
},
diff --git a/packages/kbn-storybook/package.json b/packages/kbn-storybook/package.json
index 05fdb8489a1c3..58359159e950d 100644
--- a/packages/kbn-storybook/package.json
+++ b/packages/kbn-storybook/package.json
@@ -13,8 +13,8 @@
"@storybook/core": "^6.0.16",
"@storybook/react": "^6.0.16",
"@storybook/theming": "^6.0.16",
- "@types/loader-utils": "^2.0.1",
- "@types/webpack": "^4.41.5",
+ "@types/loader-utils": "^1.1.3",
+ "@types/webpack": "^4.41.3",
"@types/webpack-env": "^1.15.2",
"@types/webpack-merge": "^4.1.5",
"@kbn/utils": "1.0.0",
diff --git a/packages/kbn-storybook/webpack.config.ts b/packages/kbn-storybook/webpack.config.ts
index 98fca597ffd78..84f8cfaefd669 100644
--- a/packages/kbn-storybook/webpack.config.ts
+++ b/packages/kbn-storybook/webpack.config.ts
@@ -100,9 +100,5 @@ export default function ({ config: storybookConfig }: { config: Configuration })
if (htmlWebpackPlugin) {
htmlWebpackPlugin.options.template = require.resolve('../lib/templates/index.ejs');
}
-
- // @ts-expect-error There's a long error here about the types of the
- // incompatibility of Configuration, but it looks like it just may be Webpack
- // type definition related.
return webpackMerge(storybookConfig, config);
}
diff --git a/packages/kbn-test/package.json b/packages/kbn-test/package.json
index c616c836d5ff4..4e86ec4bd72e0 100644
--- a/packages/kbn-test/package.json
+++ b/packages/kbn-test/package.json
@@ -32,7 +32,7 @@
"lodash": "^4.17.20",
"parse-link-header": "^1.0.1",
"rxjs": "^6.5.5",
- "strip-ansi": "^5.2.0",
+ "strip-ansi": "^6.0.0",
"tar-fs": "^2.1.0",
"xml2js": "^0.4.22",
"zlib": "^1.0.5"
diff --git a/packages/kbn-ui-framework/package.json b/packages/kbn-ui-framework/package.json
index be18b7cfc0d01..676985fa24740 100644
--- a/packages/kbn-ui-framework/package.json
+++ b/packages/kbn-ui-framework/package.json
@@ -58,10 +58,10 @@
"postcss-loader": "^3.0.0",
"raw-loader": "^3.1.0",
"react-dom": "^16.12.0",
- "react-redux": "^5.1.2",
- "react-router": "^3.2.0",
+ "react-redux": "^7.2.0",
+ "react-router": "^5.2.0",
"react-router-redux": "^4.0.8",
- "redux": "3.7.2",
+ "redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"regenerator-runtime": "^0.13.3",
"sass-loader": "^8.0.2",
diff --git a/tasks/config/run.js b/tasks/config/run.js
index 148be6ea8afaa..eddcb0bdd59d0 100644
--- a/tasks/config/run.js
+++ b/tasks/config/run.js
@@ -240,10 +240,6 @@ module.exports = function () {
args: ['scripts/check_licenses', '--dev'],
}),
- verifyDependencyVersions: gruntTaskWithGithubChecks(
- 'Verify dependency versions',
- 'verifyDependencyVersions'
- ),
test_jest: gruntTaskWithGithubChecks('Jest tests', 'test:jest'),
test_jest_integration: gruntTaskWithGithubChecks(
'Jest integration tests',
diff --git a/tasks/jenkins.js b/tasks/jenkins.js
index 90efadf41c435..4e3358ce81bbd 100644
--- a/tasks/jenkins.js
+++ b/tasks/jenkins.js
@@ -31,7 +31,6 @@ module.exports = function (grunt) {
'run:checkFileCasing',
'run:checkLockfileSymlinks',
'run:licenses',
- 'run:verifyDependencyVersions',
'run:verifyNotice',
'run:mocha',
'run:test_jest',
diff --git a/tasks/verify_dependency_versions.js b/tasks/verify_dependency_versions.js
deleted file mode 100644
index 14ecbb9ba8603..0000000000000
--- a/tasks/verify_dependency_versions.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { size } from 'lodash';
-import kibana from '../package.json';
-import xpack from '../x-pack/package.json';
-
-function getMismatches(depType) {
- return Object.keys(kibana[depType])
- .map((key) => {
- const xpackValue = xpack[depType][key];
- const kibanaValue = kibana[depType][key];
- if (xpackValue && kibanaValue && xpackValue !== kibanaValue && !key.includes('@kbn/')) {
- return {
- key,
- xpack: xpackValue,
- kibana: kibanaValue,
- };
- }
- })
- .filter((key) => !!key);
-}
-
-export default function verifyDependencyVersions(grunt) {
- grunt.registerTask('verifyDependencyVersions', 'Checks dependency versions', () => {
- const devDependenciesMismatches = getMismatches('devDependencies');
- if (size(devDependenciesMismatches) > 0) {
- grunt.log.error(
- 'The following devDependencies do not match:',
- JSON.stringify(devDependenciesMismatches, null, 4)
- );
- return false;
- } else {
- grunt.log.writeln('devDependencies match!');
- }
- });
-}
diff --git a/test/scripts/checks/verify_dependency_versions.sh b/test/scripts/checks/verify_dependency_versions.sh
deleted file mode 100755
index b73a71e7ff7fd..0000000000000
--- a/test/scripts/checks/verify_dependency_versions.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env bash
-
-source src/dev/ci_setup/setup_env.sh
-
-yarn run grunt run:verifyDependencyVersions
diff --git a/vars/tasks.groovy b/vars/tasks.groovy
index edd2c0aa47401..09ff1b0a7d95b 100644
--- a/vars/tasks.groovy
+++ b/vars/tasks.groovy
@@ -12,7 +12,6 @@ def check() {
kibanaPipeline.scriptTask('Check File Casing', 'test/scripts/checks/file_casing.sh'),
kibanaPipeline.scriptTask('Check Lockfile Symlinks', 'test/scripts/checks/lock_file_symlinks.sh'),
kibanaPipeline.scriptTask('Check Licenses', 'test/scripts/checks/licenses.sh'),
- kibanaPipeline.scriptTask('Verify Dependency Versions', 'test/scripts/checks/verify_dependency_versions.sh'),
kibanaPipeline.scriptTask('Verify NOTICE', 'test/scripts/checks/verify_notice.sh'),
kibanaPipeline.scriptTask('Test Projects', 'test/scripts/checks/test_projects.sh'),
kibanaPipeline.scriptTask('Test Hardening', 'test/scripts/checks/test_hardening.sh'),
diff --git a/x-pack/package.json b/x-pack/package.json
index f9b193bb4da06..5742200b55d9f 100644
--- a/x-pack/package.json
+++ b/x-pack/package.json
@@ -29,7 +29,7 @@
"**/@types/node": ">=10.17.17 <10.20.0"
},
"devDependencies": {
- "@cypress/webpack-preprocessor": "^4.1.0",
+ "@cypress/webpack-preprocessor": "^5.4.1",
"@elastic/apm-rum-react": "^1.2.5",
"@elastic/maki": "6.3.0",
"@kbn/dev-utils": "1.0.0",
@@ -159,7 +159,7 @@
"copy-to-clipboard": "^3.0.8",
"copy-webpack-plugin": "^6.0.2",
"cronstrue": "^1.51.0",
- "cypress": "5.0.0",
+ "cypress": "^5.0.0",
"cypress-multi-reporters": "^1.2.3",
"cypress-promise": "^1.1.0",
"d3": "3.5.17",
@@ -257,7 +257,7 @@
"tinycolor2": "1.4.1",
"topojson-client": "3.0.0",
"tree-kill": "^1.2.2",
- "ts-loader": "^6.0.4",
+ "ts-loader": "^7.0.5",
"typescript": "4.0.2",
"typescript-fsa": "^3.0.0",
"typescript-fsa-reducers": "^1.2.1",
@@ -309,7 +309,7 @@
"dedent": "^0.7.0",
"del": "^5.1.0",
"elasticsearch": "^16.7.0",
- "extract-zip": "^1.7.0",
+ "extract-zip": "^2.0.1",
"file-type": "^10.9.0",
"font-awesome": "4.7.0",
"fp-ts": "^2.3.1",
@@ -321,7 +321,7 @@
"glob": "^7.1.2",
"graphql": "^0.13.2",
"graphql-fields": "^1.0.2",
- "graphql-tag": "^2.9.2",
+ "graphql-tag": "^2.10.3",
"graphql-tools": "^3.0.2",
"h2o2": "^8.1.2",
"handlebars": "4.7.6",
@@ -372,7 +372,7 @@
"redux-observable": "^1.2.0",
"redux-thunk": "^2.3.0",
"request": "^2.88.0",
- "rison-node": "0.3.1",
+ "rison-node": "1.0.2",
"rxjs": "^6.5.5",
"semver": "^5.7.0",
"set-value": "^3.0.2",
diff --git a/x-pack/plugins/apm/e2e/package.json b/x-pack/plugins/apm/e2e/package.json
index 649198b7eae11..041f9ea7f21c0 100644
--- a/x-pack/plugins/apm/e2e/package.json
+++ b/x-pack/plugins/apm/e2e/package.json
@@ -14,7 +14,7 @@
"@types/node": ">=10.17.17 <10.20.0",
"axios": "^0.19.2",
"cypress-cucumber-preprocessor": "^2.5.2",
- "cypress": "^4.9.0",
+ "cypress": "^5.0.0",
"ora": "^4.0.4",
"p-limit": "^3.0.1",
"p-retry": "^4.2.0",
diff --git a/x-pack/plugins/apm/scripts/package.json b/x-pack/plugins/apm/scripts/package.json
index d3e2d42f972a9..c68dc49cd9370 100644
--- a/x-pack/plugins/apm/scripts/package.json
+++ b/x-pack/plugins/apm/scripts/package.json
@@ -4,7 +4,7 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
- "@elastic/elasticsearch": "7.9.0-rc.1",
+ "@elastic/elasticsearch": "7.9.1",
"@octokit/rest": "^16.35.0",
"console-stamp": "^0.2.9",
"hdr-histogram-js": "^1.2.0"
diff --git a/x-pack/plugins/reporting/server/browsers/extract/unzip.js b/x-pack/plugins/reporting/server/browsers/extract/unzip.js
index d57d04a52f46e..d5166f149372a 100644
--- a/x-pack/plugins/reporting/server/browsers/extract/unzip.js
+++ b/x-pack/plugins/reporting/server/browsers/extract/unzip.js
@@ -7,14 +7,10 @@
import extractZip from 'extract-zip';
import { ExtractError } from './extract_error';
-export function unzip(filepath, target) {
- return new Promise(function (resolve, reject) {
- extractZip(filepath, { dir: target }, (err) => {
- if (err) {
- return reject(new ExtractError(err));
- }
-
- resolve();
- });
- });
+export async function unzip(filepath, target) {
+ try {
+ await extractZip(filepath, { dir: target });
+ } catch (err) {
+ throw new ExtractError(err);
+ }
}
diff --git a/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts
index 9f26fc22ede53..ed226fb0c984f 100644
--- a/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts
+++ b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts
@@ -32,7 +32,7 @@ export interface MockedProvidedQuery {
export const mockOpenTimelineQueryResults: MockedProvidedQuery[] = [
{
request: {
- query: allTimelinesQuery,
+ query: (allTimelinesQuery as unknown) as GetAllTimeline.Query,
variables: {
onlyUserFavorite: false,
pageInfo: {
diff --git a/x-pack/plugins/security_solution/scripts/beat_docs/build.js b/x-pack/plugins/security_solution/scripts/beat_docs/build.js
index 9b3607593a5db..3dbfb75fbe32e 100644
--- a/x-pack/plugins/security_solution/scripts/beat_docs/build.js
+++ b/x-pack/plugins/security_solution/scripts/beat_docs/build.js
@@ -135,25 +135,25 @@ const convertSchemaToHash = (schema, beatFields) => {
}, beatFields);
};
-const manageZipFields = async (beat, filePath, beatFields) =>
- new Promise((resolve, reject) => {
- extract(filePath, { dir: beat.outputDir }, (err) => {
- if (err) {
- return reject(new Error(err));
- }
- console.log('building fields', beat.index);
- const obj = yaml.load(
- fs.readFileSync(`${beat.outputDir}/winlogbeat-7.9.0-windows-x86_64/fields.yml`, {
- encoding: 'utf-8',
- })
- );
- const eBeatFields = convertSchemaToHash(obj, beatFields);
- console.log('deleting files', beat.index);
- rimraf.sync(`${beat.outputDir}/winlogbeat-7.9.0-windows-x86_64`);
- rimraf.sync(beat.filePath);
- resolve(eBeatFields);
- });
- });
+const manageZipFields = async (beat, filePath, beatFields) => {
+ try {
+ await extract(filePath, { dir: beat.outputDir });
+ console.log('building fields', beat.index);
+ const obj = yaml.load(
+ fs.readFileSync(`${beat.outputDir}/winlogbeat-7.9.0-windows-x86_64/fields.yml`, {
+ encoding: 'utf-8',
+ })
+ );
+ const eBeatFields = convertSchemaToHash(obj, beatFields);
+ console.log('deleting files', beat.index);
+ rimraf.sync(`${beat.outputDir}/winlogbeat-7.9.0-windows-x86_64`);
+ rimraf.sync(beat.filePath);
+
+ return eBeatFields;
+ } catch (err) {
+ throw new Error(err);
+ }
+};
const manageTarFields = async (beat, filePath, beatFields) =>
new Promise((resolve, reject) => {
diff --git a/yarn.lock b/yarn.lock
index d795a174cfaa0..2d72b6d6c3bb6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -63,7 +63,7 @@
semver "^5.4.1"
source-map "^0.5.0"
-"@babel/core@^7.0.1", "@babel/core@^7.1.0", "@babel/core@^7.11.1", "@babel/core@^7.7.5", "@babel/core@^7.9.0":
+"@babel/core@^7.1.0", "@babel/core@^7.11.1", "@babel/core@^7.7.5", "@babel/core@^7.9.0":
version "7.11.1"
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.11.1.tgz#2c55b604e73a40dc21b0e52650b11c65cf276643"
integrity sha512-XqF7F6FWQdKGGWAzGELL+aCO1p+lRY5Tj5/tbT3St1G8NaH70jhhDIKknIZaDans0OQBG5wRAldROLHSt44BgQ==
@@ -926,7 +926,7 @@
"@babel/helper-create-regexp-features-plugin" "^7.10.4"
"@babel/helper-plugin-utils" "^7.10.4"
-"@babel/preset-env@^7.0.0", "@babel/preset-env@^7.11.0", "@babel/preset-env@^7.9.5", "@babel/preset-env@^7.9.6":
+"@babel/preset-env@^7.11.0", "@babel/preset-env@^7.9.5", "@babel/preset-env@^7.9.6":
version "7.11.0"
resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.11.0.tgz#860ee38f2ce17ad60480c2021ba9689393efb796"
integrity sha512-2u1/k7rG/gTh02dylX2kL3S0IJNF+J6bfDSp4DI2Ma8QN6Y9x9pmAax59fsCk6QUQG0yqH47yJWA+u1I1LccAg==
@@ -1168,17 +1168,14 @@
tunnel-agent "^0.6.0"
uuid "^3.3.2"
-"@cypress/webpack-preprocessor@^4.1.0":
- version "4.1.0"
- resolved "https://registry.yarnpkg.com/@cypress/webpack-preprocessor/-/webpack-preprocessor-4.1.0.tgz#8c4debc0b1abf045b62524d1996dd9aeaf7e86a8"
- integrity sha512-LbxsdYVpHGoC2fMOdW0aQvuvVRD7aZx8p8DrP53HISpl7bD1PqLGWKzhHn7cGG24UHycBJrbaEeKEosW29W1dg==
+"@cypress/webpack-preprocessor@^5.4.1":
+ version "5.4.6"
+ resolved "https://registry.yarnpkg.com/@cypress/webpack-preprocessor/-/webpack-preprocessor-5.4.6.tgz#667f8007cbe6ee219ce7e45a7f1400d3e2401032"
+ integrity sha512-78hWoTUUEncv647badwVbyszvmwI1r9GaY/xy7V0sz0VVC90ByuDkLpvN+J0VP6enthob4dIPXcm0f9Tb1UKQQ==
dependencies:
- bluebird "3.5.0"
- debug "3.1.0"
- optionalDependencies:
- "@babel/core" "^7.0.1"
- "@babel/preset-env" "^7.0.0"
- babel-loader "^8.0.2"
+ bluebird "^3.7.1"
+ debug "^4.1.1"
+ lodash "^4.17.20"
"@cypress/xvfb@^1.2.4":
version "1.2.4"
@@ -1246,17 +1243,6 @@
utility-types "^3.10.0"
uuid "^3.3.2"
-"@elastic/elasticsearch@7.9.0-rc.1":
- version "7.9.0-rc.1"
- resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-7.9.0-rc.1.tgz#50205507ec84ccb95cb7a6d36e5570808749fee9"
- integrity sha512-rVjiVj7VPLCusJPfywpb3gvcaA99uylYSum1Frcq4vi2Iqg118KXgYW6GOis2Y70oDZ6w6XRlT0ze5NA6SBa+g==
- dependencies:
- debug "^4.1.1"
- decompress-response "^4.2.0"
- ms "^2.1.1"
- pump "^3.0.0"
- secure-json-parse "^2.1.0"
-
"@elastic/elasticsearch@7.9.1":
version "7.9.1"
resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-7.9.1.tgz#40f1c38e8f70d783851c13be78a7cb346891c15e"
@@ -4487,14 +4473,6 @@
"@types/node" "*"
"@types/webpack" "*"
-"@types/loader-utils@^2.0.1":
- version "2.0.1"
- resolved "https://registry.yarnpkg.com/@types/loader-utils/-/loader-utils-2.0.1.tgz#4073425aca25762099823f7b922e86599c2b85ec"
- integrity sha512-X3jTNi/I2AEd2WrHdSqRppPkYzWkRMNGxJzeMwS0o3hVi8ZB6JCnf/XyQmqpUuCidld5lC/1VxVgTktEweRK+w==
- dependencies:
- "@types/node" "*"
- "@types/webpack" "*"
-
"@types/lodash.difference@^4.5.6":
version "4.5.6"
resolved "https://registry.yarnpkg.com/@types/lodash.difference/-/lodash.difference-4.5.6.tgz#41ec5c4e684eeacf543848a9a1b2a4856ccf9853"
@@ -5085,11 +5063,6 @@
resolved "https://registry.yarnpkg.com/@types/stats-lite/-/stats-lite-2.2.0.tgz#bc8190bf9dfa1e16b89eaa2b433c99dff0804de9"
integrity sha512-YV6SS4QC+pbzqjMIV8qVSTDOOazgKBLTVaN+7PfuxELjz/eyzc20KwDVGPrbHt2OcYMA7K2ezLB45Cp6DpNOSQ==
-"@types/strip-ansi@^3.0.0":
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/@types/strip-ansi/-/strip-ansi-3.0.0.tgz#9b63d453a6b54aa849182207711a08be8eea48ae"
- integrity sha1-m2PUU6a1SqhJGCIHcRoIvo7qSK4=
-
"@types/strip-ansi@^5.2.1":
version "5.2.1"
resolved "https://registry.yarnpkg.com/@types/strip-ansi/-/strip-ansi-5.2.1.tgz#acd97f1f091e332bb7ce697c4609eb2370fa2a92"
@@ -5339,7 +5312,7 @@
"@types/webpack-sources" "*"
source-map "^0.6.0"
-"@types/webpack@^4.41.21", "@types/webpack@^4.41.5", "@types/webpack@^4.41.8":
+"@types/webpack@^4.41.8":
version "4.41.21"
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.41.21.tgz#cc685b332c33f153bb2f5fc1fa3ac8adeb592dee"
integrity sha512-2j9WVnNrr/8PLAB5csW44xzQSJwS26aOnICsP3pSGCEdsu6KYtfQ6QJsVUKHWRnm1bL7HziJsfh5fHqth87yKA==
@@ -6283,11 +6256,6 @@ ansi-escapes@^1.0.0, ansi-escapes@^1.1.0:
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e"
integrity sha1-06ioOzGapneTZisT52HHkRQiMG4=
-ansi-escapes@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-2.0.0.tgz#5bae52be424878dd9783e8910e3fc2922e83c81b"
- integrity sha1-W65SvkJIeN2Xg+iRDj/Cki6DyBs=
-
ansi-escapes@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92"
@@ -7348,7 +7316,7 @@ babel-jest@^26.3.0:
graceful-fs "^4.2.4"
slash "^3.0.0"
-babel-loader@^8.0.2, babel-loader@^8.0.6:
+babel-loader@^8.0.6:
version "8.0.6"
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.6.tgz#e33bdb6f362b03f4bb141a0c21ab87c501b70dfb"
integrity sha512-4BmWKtBOBm13uoUwd08UwjZlaw3O9GWf456R9j+5YykFZ6LUIjIKLc0zEZf+hauxPOJs96C8k6FvYD09vWzhYw==
@@ -7985,17 +7953,12 @@ bluebird-retry@^0.11.0:
resolved "https://registry.yarnpkg.com/bluebird-retry/-/bluebird-retry-0.11.0.tgz#1289ab22cbbc3a02587baad35595351dd0c1c047"
integrity sha1-EomrIsu8OgJYe6rTVZU1HdDBwEc=
-bluebird@3.5.0:
- version "3.5.0"
- resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c"
- integrity sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=
-
bluebird@3.5.5, bluebird@^3.5.0, bluebird@^3.5.1, bluebird@^3.5.5:
version "3.5.5"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f"
integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==
-bluebird@3.7.2, bluebird@^3.7.2:
+bluebird@3.7.2, bluebird@^3.7.1, bluebird@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
@@ -8672,15 +8635,6 @@ camelcase-keys@^2.0.0:
camelcase "^2.0.0"
map-obj "^1.0.0"
-camelcase-keys@^4.0.0:
- version "4.2.0"
- resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-4.2.0.tgz#a2aa5fb1af688758259c32c141426d78923b9b77"
- integrity sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=
- dependencies:
- camelcase "^4.1.0"
- map-obj "^2.0.0"
- quick-lru "^1.0.0"
-
camelcase-keys@^6.2.2:
version "6.2.2"
resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0"
@@ -8705,7 +8659,7 @@ camelcase@^3.0.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a"
integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo=
-camelcase@^4.0.0, camelcase@^4.1.0:
+camelcase@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd"
integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=
@@ -9245,17 +9199,12 @@ cli-spinners@^0.1.2:
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c"
integrity sha1-u3ZNiOGF+54eaiofGXcjGPYF4xw=
-cli-spinners@^1.0.1:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.1.0.tgz#f1847b168844d917a671eb9d147e3df497c90d06"
- integrity sha1-8YR7FohE2RemceudFH499JfJDQY=
-
cli-spinners@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.1.0.tgz#22c34b4d51f573240885b201efda4e4ec9fff3c7"
integrity sha512-8B00fJOEh1HPrx4fo5eW16XmE1PcL1tGpGrxy63CXGP9nHdPBN63X75hA1zhvQuhVztJWLqV58Roj2qlNM7cAA==
-cli-spinners@^2.4.0:
+cli-spinners@^2.2.0, cli-spinners@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.4.0.tgz#c6256db216b878cfba4720e719cec7cf72685d7f"
integrity sha512-sJAofoarcm76ZGpuooaO0eDy8saEy+YoZBLjC4h8srt4jeBnkYeOgqxgsJQTpyt2LjI5PTfLJHSL+41Yu4fEJA==
@@ -10219,7 +10168,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
safe-buffer "^5.0.1"
sha.js "^2.4.8"
-create-react-class@^15.5.1, create-react-class@^15.5.2:
+create-react-class@^15.5.2:
version "15.6.3"
resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036"
integrity sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg==
@@ -10586,10 +10535,10 @@ cypress-promise@^1.1.0:
resolved "https://registry.yarnpkg.com/cypress-promise/-/cypress-promise-1.1.0.tgz#f2d66965945fe198431aaf692d5157cea9d47b25"
integrity sha512-DhIf5PJ/a0iY+Yii6n7Rbwq+9TJxU4pupXYzf9mZd8nPG0AzQrj9i+pqINv4xbI2EV1p+PKW3maCkR7oPG4GrA==
-cypress@5.0.0:
- version "5.0.0"
- resolved "https://registry.yarnpkg.com/cypress/-/cypress-5.0.0.tgz#6957e299b790af8b1cd7bea68261b8935646f72e"
- integrity sha512-jhPd0PMO1dPSBNpx6pHVLkmnnaTfMy3wCoacHAKJ9LJG06y16zqUNSFri64N4BjuGe8y6mNMt8TdgKnmy9muCg==
+cypress@^5.0.0:
+ version "5.2.0"
+ resolved "https://registry.yarnpkg.com/cypress/-/cypress-5.2.0.tgz#6902efd90703242a2539f0623c6e1118aff01f95"
+ integrity sha512-9S2spcrpIXrQ+CQIKHsjRoLQyRc2ehB06clJXPXXp1zyOL/uZMM3Qc20ipNki4CcNwY0nBTQZffPbRpODeGYQg==
dependencies:
"@cypress/listr-verbose-renderer" "^0.4.1"
"@cypress/request" "^2.88.5"
@@ -11042,7 +10991,7 @@ debuglog@^1.0.1:
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
-decamelize-keys@^1.0.0, decamelize-keys@^1.1.0:
+decamelize-keys@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9"
integrity sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=
@@ -11098,7 +11047,7 @@ deep-eql@^0.1.3:
dependencies:
type-detect "0.1.1"
-deep-equal@^1.0.0, deep-equal@^1.1.1, deep-equal@~1.1.1:
+deep-equal@^1.0.0, deep-equal@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.1.tgz#b5c98c942ceffaf7cb051e24e1434a25a2e6076a"
integrity sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==
@@ -11843,7 +11792,7 @@ dotenv@^8.1.0:
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==
-dotignore@^0.1.2, dotignore@~0.1.2:
+dotignore@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/dotignore/-/dotignore-0.1.2.tgz#f942f2200d28c3a76fbdd6f0ee9f3257c8a2e905"
integrity sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==
@@ -12640,17 +12589,6 @@ eslint-config-prettier@^6.11.0:
dependencies:
get-stdin "^6.0.0"
-eslint-formatter-pretty@^1.3.0:
- version "1.3.0"
- resolved "https://registry.yarnpkg.com/eslint-formatter-pretty/-/eslint-formatter-pretty-1.3.0.tgz#985d9e41c1f8475f4a090c5dbd2dfcf2821d607e"
- integrity sha512-5DY64Y1rYCm7cfFDHEGUn54bvCnK+wSUVF07N8oXeqUJFSd+gnYOTXbzelQ1HurESluY6gnEQPmXOIkB4Wa+gA==
- dependencies:
- ansi-escapes "^2.0.0"
- chalk "^2.1.0"
- log-symbols "^2.0.0"
- plur "^2.1.2"
- string-width "^2.0.0"
-
eslint-formatter-pretty@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/eslint-formatter-pretty/-/eslint-formatter-pretty-4.0.0.tgz#dc15f3bf4fb51b7ba5fbedb77f57ba8841140ce2"
@@ -14801,7 +14739,7 @@ glob@^6.0.1, glob@^6.0.4:
once "^1.3.0"
path-is-absolute "^1.0.0"
-glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.1, glob@~7.1.4, glob@~7.1.6:
+glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.1, glob@~7.1.4:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
@@ -15015,7 +14953,7 @@ globby@^6.1.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"
-globby@^9.1.0, globby@^9.2.0:
+globby@^9.2.0:
version "9.2.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d"
integrity sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==
@@ -15383,7 +15321,7 @@ graphql-tag-pluck@0.6.0:
source-map-support "^0.5.9"
typescript "^3.2.2"
-graphql-tag@2.10.1, graphql-tag@^2.9.2:
+graphql-tag@2.10.1:
version "2.10.1"
resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.1.tgz#10aa41f1cd8fae5373eaf11f1f67260a3cad5e02"
integrity sha512-jApXqWBzNXQ8jYa/HLkZJaVw9jgwNqZkywa2zfFn16Iv1Zb7ELNHkJaXHR7Quvd5SIGsy6Ny7SUKATgnu05uEg==
@@ -15439,13 +15377,6 @@ graphql@^0.13.2:
dependencies:
iterall "^1.2.1"
-graphql@^14.0.0:
- version "14.6.0"
- resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.6.0.tgz#57822297111e874ea12f5cd4419616930cd83e49"
- integrity sha512-VKzfvHEKybTKjQVpTFrA5yUq2S9ihcZvfJAtsDBBCuV6wauPu1xl/f9ehgVf0FcEJJs4vz6ysb/ZMkGigQZseg==
- dependencies:
- iterall "^1.2.2"
-
graphviz@^0.0.8:
version "0.0.8"
resolved "https://registry.yarnpkg.com/graphviz/-/graphviz-0.0.8.tgz#e599e40733ef80e1653bfe89a5f031ecf2aa4aaa"
@@ -16102,16 +16033,6 @@ history-extra@^5.0.1:
resolved "https://registry.yarnpkg.com/history-extra/-/history-extra-5.0.1.tgz#95a2e59dda526c4241d0ae1b124a77a5e4675ce8"
integrity sha512-6XV1L1lHgporVWgppa/Kq+Fnz4lhBew7iMxYCTfzVmoEywsAKJnTjdw1zOd+EGLHGYp0/V8jSVMEgqx4QbHLTw==
-history@^3.0.0:
- version "3.3.0"
- resolved "https://registry.yarnpkg.com/history/-/history-3.3.0.tgz#fcedcce8f12975371545d735461033579a6dae9c"
- integrity sha1-/O3M6PEpdTcVRdc1RhAzV5ptrpw=
- dependencies:
- invariant "^2.2.1"
- loose-envify "^1.2.0"
- query-string "^4.2.2"
- warning "^3.0.0"
-
history@^4.9.0:
version "4.9.0"
resolved "https://registry.yarnpkg.com/history/-/history-4.9.0.tgz#84587c2068039ead8af769e9d6a6860a14fa1bca"
@@ -16773,7 +16694,7 @@ inflight@^1.0.4:
once "^1.3.0"
wrappy "1"
-inherits@2, inherits@2.0.4, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4:
+inherits@2, inherits@2.0.4, inherits@^2.0.4, inherits@~2.0.3:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
@@ -16870,7 +16791,7 @@ inquirer@^0.12.0:
strip-ansi "^3.0.0"
through "^2.3.6"
-inquirer@^1.0.2, inquirer@^1.2.2:
+inquirer@^1.0.2:
version "1.2.3"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-1.2.3.tgz#4dec6f32f37ef7bb0b2ed3f1d1a5c3f545074918"
integrity sha1-TexvMvN+97sLLtPx0aXD9UUHSRg=
@@ -17038,7 +16959,7 @@ invariant@2.2.4, invariant@^2.1.0, invariant@^2.1.1, invariant@^2.2.3, invariant
dependencies:
loose-envify "^1.0.0"
-invariant@^2.2.1, invariant@^2.2.2:
+invariant@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360"
integrity sha1-nh9WrArNtr8wMwbzOL47IErmA2A=
@@ -17089,11 +17010,6 @@ iron@5.x.x:
cryptiles "4.x.x"
hoek "5.x.x"
-irregular-plurals@^1.0.0:
- version "1.4.0"
- resolved "https://registry.yarnpkg.com/irregular-plurals/-/irregular-plurals-1.4.0.tgz#2ca9b033651111855412f16be5d77c62a458a766"
- integrity sha1-LKmwM2UREYVUEvFr5dd8YqRYp2Y=
-
irregular-plurals@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/irregular-plurals/-/irregular-plurals-3.2.0.tgz#b19c490a0723798db51b235d7e39add44dab0822"
@@ -17637,7 +17553,7 @@ is-redirect@^1.0.0:
resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24"
integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=
-is-regex@^1.0.4, is-regex@^1.0.5, is-regex@~1.0.5:
+is-regex@^1.0.4, is-regex@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.5.tgz#39d589a358bf18967f726967120b8fc1aed74eae"
integrity sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==
@@ -18066,11 +17982,6 @@ iterall@^1.1.3, iterall@^1.2.1:
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7"
integrity sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA==
-iterall@^1.2.2:
- version "1.3.0"
- resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea"
- integrity sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==
-
iterate-iterator@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/iterate-iterator/-/iterate-iterator-1.0.1.tgz#1693a768c1ddd79c969051459453f082fe82e9f6"
@@ -19737,7 +19648,7 @@ locutus@^2.0.5:
resolved "https://registry.yarnpkg.com/locutus/-/locutus-2.0.10.tgz#f903619466a98a4ab76e8b87a5854b55a743b917"
integrity sha512-AZg2kCqrquMJ5FehDsBidV0qHl98NrsYtseUClzjAQ3HFnsDBJTCwGVplSQ82t9/QfgahqvTjaKcZqZkHmS0wQ==
-lodash-es@^4.17.11, lodash-es@^4.2.1:
+lodash-es@^4.17.11:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78"
integrity sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ==
@@ -19997,7 +19908,7 @@ lodash.uniq@4.5.0, lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
-lodash@4.17.11, lodash@4.17.15, lodash@>4.17.4, lodash@^4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10.0, lodash@^4.11.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.2, lodash@^4.17.20, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@~4.17.10, lodash@~4.17.15, lodash@~4.17.5:
+lodash@4.17.11, lodash@4.17.15, lodash@>4.17.4, lodash@^4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10.0, lodash@^4.11.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.2, lodash@^4.17.20, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0, lodash@~4.17.10, lodash@~4.17.15, lodash@~4.17.5:
version "4.17.20"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
@@ -20010,14 +19921,14 @@ log-ok@^0.1.1:
ansi-green "^0.1.1"
success-symbol "^0.1.0"
-log-symbols@2.2.0, log-symbols@^2.0.0, log-symbols@^2.1.0, log-symbols@^2.2.0:
+log-symbols@2.2.0, log-symbols@^2.1.0, log-symbols@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a"
integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==
dependencies:
chalk "^2.0.1"
-log-symbols@3.0.0:
+log-symbols@3.0.0, log-symbols@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4"
integrity sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==
@@ -20326,11 +20237,6 @@ map-obj@^1.0.0, map-obj@^1.0.1:
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d"
integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=
-map-obj@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-2.0.0.tgz#a65cd29087a92598b8791257a523e021222ac1f9"
- integrity sha1-plzSkIepJZi4eRJXpSPgISIqwfk=
-
map-obj@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.1.0.tgz#b91221b542734b9f14256c0132c897c5d7256fd5"
@@ -20647,21 +20553,6 @@ meow@^3.0.0, meow@^3.3.0, meow@^3.7.0:
redent "^1.0.0"
trim-newlines "^1.0.0"
-meow@^5.0.0:
- version "5.0.0"
- resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4"
- integrity sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==
- dependencies:
- camelcase-keys "^4.0.0"
- decamelize-keys "^1.0.0"
- loud-rejection "^1.0.0"
- minimist-options "^3.0.1"
- normalize-package-data "^2.3.4"
- read-pkg-up "^3.0.0"
- redent "^2.0.0"
- trim-newlines "^2.0.0"
- yargs-parser "^10.0.0"
-
meow@^6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/meow/-/meow-6.1.1.tgz#1ad64c4b76b2a24dfb2f635fddcadf320d251467"
@@ -20927,14 +20818,6 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
dependencies:
brace-expansion "^1.1.7"
-minimist-options@^3.0.1:
- version "3.0.2"
- resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-3.0.2.tgz#fba4c8191339e13ecf4d61beb03f070103f3d954"
- integrity sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==
- dependencies:
- arrify "^1.0.1"
- is-plain-obj "^1.1.0"
-
minimist-options@^4.0.2:
version "4.1.0"
resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619"
@@ -22161,7 +22044,7 @@ object-identity-map@^1.0.2:
dependencies:
object.entries "^1.1.0"
-object-inspect@^1.6.0, object-inspect@^1.7.0, object-inspect@~1.7.0:
+object-inspect@^1.6.0, object-inspect@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67"
integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==
@@ -22485,16 +22368,6 @@ ora@^0.2.3:
cli-spinners "^0.1.2"
object-assign "^4.0.1"
-ora@^1.4.0:
- version "1.4.0"
- resolved "https://registry.yarnpkg.com/ora/-/ora-1.4.0.tgz#884458215b3a5d4097592285f93321bb7a79e2e5"
- integrity sha512-iMK1DOQxzzh2MBlVsU42G80mnrvUhqsMh74phHtDlrcTZPK0pH6o7l7DRshK+0YsxDyEuaOkziVdvM3T0QTzpw==
- dependencies:
- chalk "^2.1.0"
- cli-cursor "^2.1.0"
- cli-spinners "^1.0.1"
- log-symbols "^2.1.0"
-
ora@^3.0.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-3.4.0.tgz#bf0752491059a3ef3ed4c85097531de9fdbcd318"
@@ -22507,6 +22380,20 @@ ora@^3.0.0:
strip-ansi "^5.2.0"
wcwidth "^1.0.1"
+ora@^4.0.4:
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/ora/-/ora-4.1.1.tgz#566cc0348a15c36f5f0e979612842e02ba9dddbc"
+ integrity sha512-sjYP8QyVWBpBZWD6Vr1M/KwknSw6kJOz41tvGMlwWeClHBtYKTbHMki1PsLZnxKpXMPbTKv9b3pjQu3REib96A==
+ dependencies:
+ chalk "^3.0.0"
+ cli-cursor "^3.1.0"
+ cli-spinners "^2.2.0"
+ is-interactive "^1.0.0"
+ log-symbols "^3.0.0"
+ mute-stream "0.0.8"
+ strip-ansi "^6.0.0"
+ wcwidth "^1.0.1"
+
ora@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-5.1.0.tgz#b188cf8cd2d4d9b13fd25383bc3e5cba352c94f8"
@@ -23450,13 +23337,6 @@ plugin-error@^1.0.1:
arr-union "^3.1.0"
extend-shallow "^3.0.2"
-plur@^2.1.2:
- version "2.1.2"
- resolved "https://registry.yarnpkg.com/plur/-/plur-2.1.2.tgz#7482452c1a0f508e3e344eaec312c91c29dc655a"
- integrity sha1-dIJFLBoPUI4+NE6uwxLJHCncZVo=
- dependencies:
- irregular-plurals "^1.0.0"
-
plur@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/plur/-/plur-4.0.0.tgz#729aedb08f452645fe8c58ef115bf16b0a73ef84"
@@ -23911,7 +23791,7 @@ prop-types-exact@^1.2.0:
object.assign "^4.1.0"
reflect.ownkeys "^0.2.0"
-prop-types@15.7.2, prop-types@15.x, prop-types@^15.5.10, prop-types@^15.5.6, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
+prop-types@15.7.2, prop-types@15.x, prop-types@^15.5.10, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
@@ -24149,7 +24029,7 @@ qs@^6.6.0:
resolved "https://registry.yarnpkg.com/qs/-/qs-6.8.0.tgz#87b763f0d37ca54200334cd57bb2ef8f68a1d081"
integrity sha512-tPSkj8y92PfZVbinY1n84i1Qdx75lZjMQYx9WZhnkofyxzw2r7Ho39G3/aEvSUdebxpnnM4LZJCtvE/Aq3+s9w==
-query-string@^4.1.0, query-string@^4.2.2:
+query-string@^4.1.0:
version "4.3.4"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb"
integrity sha1-u7aTucqRXCMlFbIosaArYJBD2+s=
@@ -24197,11 +24077,6 @@ queue@6.0.1:
dependencies:
inherits "~2.0.3"
-quick-lru@^1.0.0:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8"
- integrity sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=
-
quick-lru@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f"
@@ -24706,7 +24581,7 @@ react-lib-adler32@^1.0.3:
resolved "https://registry.yarnpkg.com/react-lib-adler32/-/react-lib-adler32-1.0.3.tgz#63df1aed274eabcc1c5067077ea281ec30888ba7"
integrity sha512-AqFqdt4cP0RPffHNjVHZ7tyIgnoSzNxgFhG8XKMXCtA1dZ72gTPO4iYFwWDKHqvE8sHS14rhltQTdbXU5G4BFA==
-react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4:
+react-lifecycles-compat@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
@@ -24783,19 +24658,6 @@ react-portal@^3.2.0:
dependencies:
prop-types "^15.5.8"
-react-redux@^5.1.2:
- version "5.1.2"
- resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.1.2.tgz#b19cf9e21d694422727bf798e934a916c4080f57"
- integrity sha512-Ns1G0XXc8hDyH/OcBHOxNgQx9ayH3SPxBnFCOidGKSle8pKihysQw2rG/PmciUQRoclhVBO8HMhiRmGXnDja9Q==
- dependencies:
- "@babel/runtime" "^7.1.2"
- hoist-non-react-statics "^3.3.0"
- invariant "^2.2.4"
- loose-envify "^1.1.0"
- prop-types "^15.6.1"
- react-is "^16.6.0"
- react-lifecycles-compat "^3.0.0"
-
react-redux@^7.1.0, react-redux@^7.1.1, react-redux@^7.2.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.0.tgz#f970f62192b3981642fec46fd0db18a074fe879d"
@@ -24884,19 +24746,6 @@ react-router@5.2.0, react-router@^5.2.0:
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
-react-router@^3.2.0:
- version "3.2.1"
- resolved "https://registry.yarnpkg.com/react-router/-/react-router-3.2.1.tgz#b9a3279962bdfbe684c8bd0482b81ef288f0f244"
- integrity sha512-SXkhC0nr3G0ltzVU07IN8jYl0bB6FsrDIqlLC9dK3SITXqyTJyM7yhXlUqs89w3Nqi5OkXsfRUeHX+P874HQrg==
- dependencies:
- create-react-class "^15.5.1"
- history "^3.0.0"
- hoist-non-react-statics "^2.3.1"
- invariant "^2.2.1"
- loose-envify "^1.2.0"
- prop-types "^15.5.6"
- warning "^3.0.0"
-
react-select@^3.0.8:
version "3.1.0"
resolved "https://registry.yarnpkg.com/react-select/-/react-select-3.1.0.tgz#ab098720b2e9fe275047c993f0d0caf5ded17c27"
@@ -25174,14 +25023,6 @@ read-pkg-up@^2.0.0:
find-up "^2.0.0"
read-pkg "^2.0.0"
-read-pkg-up@^3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07"
- integrity sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=
- dependencies:
- find-up "^2.0.0"
- read-pkg "^3.0.0"
-
read-pkg-up@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978"
@@ -25389,14 +25230,6 @@ redent@^1.0.0:
indent-string "^2.1.0"
strip-indent "^1.0.1"
-redent@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/redent/-/redent-2.0.0.tgz#c1b2007b42d57eb1389079b3c8333639d5e1ccaa"
- integrity sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=
- dependencies:
- indent-string "^3.0.0"
- strip-indent "^2.0.0"
-
redent@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f"
@@ -25460,16 +25293,6 @@ redux-thunks@^1.0.0:
resolved "https://registry.yarnpkg.com/redux-thunks/-/redux-thunks-1.0.0.tgz#56e03b86d281a2664c884ab05c543d9ab1673658"
integrity sha1-VuA7htKBomZMiEqwXFQ9mrFnNlg=
-redux@3.7.2:
- version "3.7.2"
- resolved "https://registry.yarnpkg.com/redux/-/redux-3.7.2.tgz#06b73123215901d25d065be342eb026bc1c8537b"
- integrity sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A==
- dependencies:
- lodash "^4.2.1"
- lodash-es "^4.2.1"
- loose-envify "^1.1.0"
- symbol-observable "^1.0.3"
-
redux@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.0.tgz#aa698a92b729315d22b34a0553d7e6533555cc03"
@@ -26216,13 +26039,6 @@ resolve@~1.10.1:
dependencies:
path-parse "^1.0.6"
-resolve@~1.14.2:
- version "1.14.2"
- resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.14.2.tgz#dbf31d0fa98b1f29aa5169783b9c290cb865fea2"
- integrity sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ==
- dependencies:
- path-parse "^1.0.6"
-
responselike@1.0.2, responselike@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7"
@@ -26352,11 +26168,6 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
hash-base "^2.0.0"
inherits "^2.0.1"
-rison-node@0.3.1:
- version "0.3.1"
- resolved "https://registry.yarnpkg.com/rison-node/-/rison-node-0.3.1.tgz#fc540015500fc146f3b27d8d25dd5742122552a6"
- integrity sha1-/FQAFVAPwUbzsn2NJd1XQhIlUqY=
-
rison-node@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/rison-node/-/rison-node-1.0.2.tgz#b7b5f37f39f5ae2a51a973a33c9aa17239a33e4b"
@@ -27877,7 +27688,7 @@ string.prototype.padstart@^3.0.0:
es-abstract "^1.4.3"
function-bind "^1.0.2"
-string.prototype.trim@^1.2.1, string.prototype.trim@~1.2.1:
+string.prototype.trim@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.1.tgz#141233dff32c82bfad80684d7e5f0869ee0fb782"
integrity sha512-MjGFEeqixw47dAMFMtgUro/I0+wNqZB5GKXGt1fFr24u3TzDXCPu7J9Buppzoe3r/LqkSDLDDJzE15RGWDGAVw==
@@ -28053,11 +27864,6 @@ strip-indent@^1.0.1:
dependencies:
get-stdin "^4.0.1"
-strip-indent@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68"
- integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=
-
strip-indent@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001"
@@ -28358,7 +28164,7 @@ symbol-observable@1.0.1:
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4"
integrity sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=
-symbol-observable@^1.0.2, symbol-observable@^1.0.3, symbol-observable@^1.0.4, symbol-observable@^1.1.0, symbol-observable@^1.2.0:
+symbol-observable@^1.0.2, symbol-observable@^1.0.4, symbol-observable@^1.1.0, symbol-observable@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"
integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==
@@ -28452,27 +28258,6 @@ tapable@^1.1.3:
resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==
-tape@^4.13.0:
- version "4.13.0"
- resolved "https://registry.yarnpkg.com/tape/-/tape-4.13.0.tgz#e2f581ff5f12a7cbd787e9f83c76c2851782fce2"
- integrity sha512-J/hvA+GJnuWJ0Sj8Z0dmu3JgMNU+MmusvkCT7+SN4/2TklW18FNCp/UuHIEhPZwHfy4sXfKYgC7kypKg4umbOw==
- dependencies:
- deep-equal "~1.1.1"
- defined "~1.0.0"
- dotignore "~0.1.2"
- for-each "~0.3.3"
- function-bind "~1.1.1"
- glob "~7.1.6"
- has "~1.0.3"
- inherits "~2.0.4"
- is-regex "~1.0.5"
- minimist "~1.2.0"
- object-inspect "~1.7.0"
- resolve "~1.14.2"
- resumer "~0.0.0"
- string.prototype.trim "~1.2.1"
- through "~2.3.8"
-
tape@^4.5.1:
version "4.10.2"
resolved "https://registry.yarnpkg.com/tape/-/tape-4.10.2.tgz#129fcf62f86df92687036a52cce7b8ddcaffd7a6"
@@ -29176,11 +28961,6 @@ trim-newlines@^1.0.0:
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
integrity sha1-WIeWa7WCpFA6QetST301ARgVphM=
-trim-newlines@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-2.0.0.tgz#b403d0b91be50c331dfc4b82eeceb22c3de16d20"
- integrity sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=
-
trim-newlines@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.0.tgz#79726304a6a898aa8373427298d54c2ee8b1cb30"
@@ -29259,10 +29039,10 @@ ts-invariant@^0.4.0:
dependencies:
tslib "^1.9.3"
-ts-loader@^6.0.4:
- version "6.0.4"
- resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.0.4.tgz#bc331ad91a887a60632d94c9f79448666f2c4b63"
- integrity sha512-p2zJYe7OtwR+49kv4gs7v4dMrfYD1IPpOtqiSPCbe8oR+4zEBtdHwzM7A7M91F+suReqgzZrlClk4LRSSp882g==
+ts-loader@^7.0.5:
+ version "7.0.5"
+ resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-7.0.5.tgz#789338fb01cb5dc0a33c54e50558b34a73c9c4c5"
+ integrity sha512-zXypEIT6k3oTc+OZNx/cqElrsbBtYqDknf48OZos0NQ3RTt045fBIU8RRSu+suObBzYB355aIPGOe/3kj9h7Ig==
dependencies:
chalk "^2.3.0"
enhanced-resolve "^4.0.0"
@@ -29292,19 +29072,6 @@ tsd@^0.13.1:
read-pkg-up "^7.0.0"
update-notifier "^4.1.0"
-tsd@^0.7.4:
- version "0.7.4"
- resolved "https://registry.yarnpkg.com/tsd/-/tsd-0.7.4.tgz#d9aba567f1394641821a6800dcee60746c87bd03"
- integrity sha512-cqr1s2GHtVkU3L/4BXDaeJOjFEuZ7iOVC+hwmyx4G7Eo26mSXCFNnwFm4EasK/MW2HdY3AQWux+AjYzDYLzZow==
- dependencies:
- eslint-formatter-pretty "^1.3.0"
- globby "^9.1.0"
- meow "^5.0.0"
- path-exists "^3.0.0"
- read-pkg-up "^4.0.0"
- typescript "^3.0.1"
- update-notifier "^2.5.0"
-
tslib@^1, tslib@^1.0.0, tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
version "1.13.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
@@ -29476,7 +29243,7 @@ typescript-tuple@^2.2.1:
dependencies:
typescript-compare "^0.0.2"
-typescript@4.0.2, typescript@^3.0.1, typescript@^3.0.3, typescript@^3.2.2, typescript@^3.3.3333, typescript@^3.4.5, typescript@~3.7.2:
+typescript@4.0.2, typescript@^3.0.3, typescript@^3.2.2, typescript@^3.3.3333, typescript@^3.4.5, typescript@~3.7.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2"
integrity sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==
@@ -30982,13 +30749,6 @@ walker@^1.0.7, walker@~1.0.5:
dependencies:
makeerror "1.0.x"
-warning@^3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/warning/-/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c"
- integrity sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=
- dependencies:
- loose-envify "^1.0.0"
-
warning@^4.0.2, warning@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"
@@ -31868,13 +31628,6 @@ yargs-parser@5.0.0-security.0:
camelcase "^3.0.0"
object.assign "^4.1.0"
-yargs-parser@^10.0.0:
- version "10.1.0"
- resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8"
- integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==
- dependencies:
- camelcase "^4.1.0"
-
yargs-parser@^18.1.2, yargs-parser@^18.1.3:
version "18.1.3"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
From 1841495322d4abe63c3985e9c7456bda01652292 Mon Sep 17 00:00:00 2001
From: Phillip Burch
Date: Thu, 1 Oct 2020 18:54:46 -0500
Subject: [PATCH 03/56] [Metrics UI] Override anomaly detection partition field
(#79214)
* Add ability to override datafeeds and job config for partition field
* Remove debug
* UX cleanup
* Fix types, delete dead code
* Fix types
---
.../containers/ml/infra_ml_module_types.ts | 4 +-
.../containers/ml/infra_ml_setup_state.ts | 289 ------------------
.../metrics_hosts/module_descriptor.ts | 135 +++++---
.../modules/metrics_k8s/module_descriptor.ts | 143 ++++++---
.../anomoly_detection_flyout.tsx | 4 +-
.../ml/anomaly_detection/flyout_home.tsx | 113 +++----
.../ml/anomaly_detection/job_setup_screen.tsx | 3 +-
7 files changed, 247 insertions(+), 444 deletions(-)
delete mode 100644 x-pack/plugins/infra/public/containers/ml/infra_ml_setup_state.ts
diff --git a/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts b/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts
index a9f2671de8259..e36f38add641a 100644
--- a/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts
+++ b/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts
@@ -33,11 +33,11 @@ export interface ModuleDescriptor {
partitionField?: string
) => Promise;
cleanUpModule: (spaceId: string, sourceId: string) => Promise;
- validateSetupIndices: (
+ validateSetupIndices?: (
indices: string[],
timestampField: string
) => Promise;
- validateSetupDatasets: (
+ validateSetupDatasets?: (
indices: string[],
timestampField: string,
startTime: number,
diff --git a/x-pack/plugins/infra/public/containers/ml/infra_ml_setup_state.ts b/x-pack/plugins/infra/public/containers/ml/infra_ml_setup_state.ts
deleted file mode 100644
index 0dfe3b301f240..0000000000000
--- a/x-pack/plugins/infra/public/containers/ml/infra_ml_setup_state.ts
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { isEqual } from 'lodash';
-import { useCallback, useEffect, useMemo, useState } from 'react';
-import { usePrevious } from 'react-use';
-import {
- combineDatasetFilters,
- DatasetFilter,
- filterDatasetFilter,
- isExampleDataIndex,
-} from '../../../common/infra_ml';
-import {
- AvailableIndex,
- ValidationIndicesError,
- ValidationUIError,
-} from '../../components/logging/log_analysis_setup/initial_configuration_step';
-import { useTrackedPromise } from '../../utils/use_tracked_promise';
-import { ModuleDescriptor, ModuleSourceConfiguration } from './infra_ml_module_types';
-
-type SetupHandler = (
- indices: string[],
- startTime: number | undefined,
- endTime: number | undefined,
- datasetFilter: DatasetFilter
-) => void;
-
-interface AnalysisSetupStateArguments {
- cleanUpAndSetUpModule: SetupHandler;
- moduleDescriptor: ModuleDescriptor;
- setUpModule: SetupHandler;
- sourceConfiguration: ModuleSourceConfiguration;
-}
-
-const fourWeeksInMs = 86400000 * 7 * 4;
-
-export const useAnalysisSetupState = ({
- cleanUpAndSetUpModule,
- moduleDescriptor: { validateSetupDatasets, validateSetupIndices },
- setUpModule,
- sourceConfiguration,
-}: AnalysisSetupStateArguments) => {
- const [startTime, setStartTime] = useState(Date.now() - fourWeeksInMs);
- const [endTime, setEndTime] = useState(undefined);
-
- const isTimeRangeValid = useMemo(
- () => (startTime != null && endTime != null ? startTime < endTime : true),
- [endTime, startTime]
- );
-
- const [validatedIndices, setValidatedIndices] = useState(
- sourceConfiguration.indices.map((indexName) => ({
- name: indexName,
- validity: 'unknown' as const,
- }))
- );
-
- const updateIndicesWithValidationErrors = useCallback(
- (validationErrors: ValidationIndicesError[]) =>
- setValidatedIndices((availableIndices) =>
- availableIndices.map((previousAvailableIndex) => {
- const indexValiationErrors = validationErrors.filter(
- ({ index }) => index === previousAvailableIndex.name
- );
-
- if (indexValiationErrors.length > 0) {
- return {
- validity: 'invalid',
- name: previousAvailableIndex.name,
- errors: indexValiationErrors,
- };
- } else if (previousAvailableIndex.validity === 'valid') {
- return {
- ...previousAvailableIndex,
- validity: 'valid',
- errors: [],
- };
- } else {
- return {
- validity: 'valid',
- name: previousAvailableIndex.name,
- isSelected: !isExampleDataIndex(previousAvailableIndex.name),
- availableDatasets: [],
- datasetFilter: {
- type: 'includeAll' as const,
- },
- };
- }
- })
- ),
- []
- );
-
- const updateIndicesWithAvailableDatasets = useCallback(
- (availableDatasets: Array<{ indexName: string; datasets: string[] }>) =>
- setValidatedIndices((availableIndices) =>
- availableIndices.map((previousAvailableIndex) => {
- if (previousAvailableIndex.validity !== 'valid') {
- return previousAvailableIndex;
- }
-
- const availableDatasetsForIndex = availableDatasets.filter(
- ({ indexName }) => indexName === previousAvailableIndex.name
- );
- const newAvailableDatasets = availableDatasetsForIndex.flatMap(
- ({ datasets }) => datasets
- );
-
- // filter out datasets that have disappeared if this index' datasets were updated
- const newDatasetFilter: DatasetFilter =
- availableDatasetsForIndex.length > 0
- ? filterDatasetFilter(previousAvailableIndex.datasetFilter, (dataset) =>
- newAvailableDatasets.includes(dataset)
- )
- : previousAvailableIndex.datasetFilter;
-
- return {
- ...previousAvailableIndex,
- availableDatasets: newAvailableDatasets,
- datasetFilter: newDatasetFilter,
- };
- })
- ),
- []
- );
-
- const validIndexNames = useMemo(
- () => validatedIndices.filter((index) => index.validity === 'valid').map((index) => index.name),
- [validatedIndices]
- );
-
- const selectedIndexNames = useMemo(
- () =>
- validatedIndices
- .filter((index) => index.validity === 'valid' && index.isSelected)
- .map((i) => i.name),
- [validatedIndices]
- );
-
- const datasetFilter = useMemo(
- () =>
- validatedIndices
- .flatMap((validatedIndex) =>
- validatedIndex.validity === 'valid'
- ? validatedIndex.datasetFilter
- : { type: 'includeAll' as const }
- )
- .reduce(combineDatasetFilters, { type: 'includeAll' as const }),
- [validatedIndices]
- );
-
- const [validateIndicesRequest, validateIndices] = useTrackedPromise(
- {
- cancelPreviousOn: 'resolution',
- createPromise: async () => {
- return await validateSetupIndices(
- sourceConfiguration.indices,
- sourceConfiguration.timestampField
- );
- },
- onResolve: ({ data: { errors } }) => {
- updateIndicesWithValidationErrors(errors);
- },
- onReject: () => {
- setValidatedIndices([]);
- },
- },
- [sourceConfiguration.indices, sourceConfiguration.timestampField]
- );
-
- const [validateDatasetsRequest, validateDatasets] = useTrackedPromise(
- {
- cancelPreviousOn: 'resolution',
- createPromise: async () => {
- if (validIndexNames.length === 0) {
- return { data: { datasets: [] } };
- }
-
- return await validateSetupDatasets(
- validIndexNames,
- sourceConfiguration.timestampField,
- startTime ?? 0,
- endTime ?? Date.now()
- );
- },
- onResolve: ({ data: { datasets } }) => {
- updateIndicesWithAvailableDatasets(datasets);
- },
- },
- [validIndexNames, sourceConfiguration.timestampField, startTime, endTime]
- );
-
- const setUp = useCallback(() => {
- return setUpModule(selectedIndexNames, startTime, endTime, datasetFilter);
- }, [setUpModule, selectedIndexNames, startTime, endTime, datasetFilter]);
-
- const cleanUpAndSetUp = useCallback(() => {
- return cleanUpAndSetUpModule(selectedIndexNames, startTime, endTime, datasetFilter);
- }, [cleanUpAndSetUpModule, selectedIndexNames, startTime, endTime, datasetFilter]);
-
- const isValidating = useMemo(
- () => validateIndicesRequest.state === 'pending' || validateDatasetsRequest.state === 'pending',
- [validateDatasetsRequest.state, validateIndicesRequest.state]
- );
-
- const validationErrors = useMemo(() => {
- if (isValidating) {
- return [];
- }
-
- return [
- // validate request status
- ...(validateIndicesRequest.state === 'rejected' ||
- validateDatasetsRequest.state === 'rejected'
- ? [{ error: 'NETWORK_ERROR' as const }]
- : []),
- // validation request results
- ...validatedIndices.reduce((errors, index) => {
- return index.validity === 'invalid' && selectedIndexNames.includes(index.name)
- ? [...errors, ...index.errors]
- : errors;
- }, []),
- // index count
- ...(selectedIndexNames.length === 0 ? [{ error: 'TOO_FEW_SELECTED_INDICES' as const }] : []),
- // time range
- ...(!isTimeRangeValid ? [{ error: 'INVALID_TIME_RANGE' as const }] : []),
- ];
- }, [
- isValidating,
- validateIndicesRequest.state,
- validateDatasetsRequest.state,
- validatedIndices,
- selectedIndexNames,
- isTimeRangeValid,
- ]);
-
- const prevStartTime = usePrevious(startTime);
- const prevEndTime = usePrevious(endTime);
- const prevValidIndexNames = usePrevious(validIndexNames);
-
- useEffect(() => {
- if (!isTimeRangeValid) {
- return;
- }
-
- validateIndices();
- }, [isTimeRangeValid, validateIndices]);
-
- useEffect(() => {
- if (!isTimeRangeValid) {
- return;
- }
-
- if (
- startTime !== prevStartTime ||
- endTime !== prevEndTime ||
- !isEqual(validIndexNames, prevValidIndexNames)
- ) {
- validateDatasets();
- }
- }, [
- endTime,
- isTimeRangeValid,
- prevEndTime,
- prevStartTime,
- prevValidIndexNames,
- startTime,
- validIndexNames,
- validateDatasets,
- ]);
-
- return {
- cleanUpAndSetUp,
- datasetFilter,
- endTime,
- isValidating,
- selectedIndexNames,
- setEndTime,
- setStartTime,
- setUp,
- startTime,
- validatedIndices,
- setValidatedIndices,
- validationErrors,
- };
-};
diff --git a/x-pack/plugins/infra/public/containers/ml/modules/metrics_hosts/module_descriptor.ts b/x-pack/plugins/infra/public/containers/ml/modules/metrics_hosts/module_descriptor.ts
index cec87fb1144e3..7ea87c3d21322 100644
--- a/x-pack/plugins/infra/public/containers/ml/modules/metrics_hosts/module_descriptor.ts
+++ b/x-pack/plugins/infra/public/containers/ml/modules/metrics_hosts/module_descriptor.ts
@@ -10,17 +10,27 @@ import { cleanUpJobsAndDatafeeds } from '../../infra_ml_cleanup';
import { callJobsSummaryAPI } from '../../api/ml_get_jobs_summary_api';
import { callGetMlModuleAPI } from '../../api/ml_get_module';
import { callSetupMlModuleAPI } from '../../api/ml_setup_module_api';
-import { callValidateIndicesAPI } from '../../../logs/log_analysis/api/validate_indices';
-import { callValidateDatasetsAPI } from '../../../logs/log_analysis/api/validate_datasets';
import {
metricsHostsJobTypes,
getJobId,
MetricsHostsJobType,
DatasetFilter,
bucketSpan,
- partitionField,
} from '../../../../../common/infra_ml';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import MemoryJob from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_hosts/ml/hosts_memory_usage.json';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import MemoryDatafeed from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_hosts/ml/datafeed_hosts_memory_usage.json';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import NetworkInJob from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_hosts/ml/hosts_network_in.json';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import NetworkInDatafeed from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_hosts/ml/datafeed_hosts_network_in.json';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import NetworkOutJob from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_hosts/ml/hosts_network_out.json';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import NetworkOutDatafeed from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_hosts/ml/datafeed_hosts_network_out.json';
+type JobType = 'hosts_memory_usage' | 'hosts_network_in' | 'hosts_network_out';
const moduleId = 'metrics_ui_hosts';
const moduleName = i18n.translate('xpack.infra.ml.metricsModuleName', {
defaultMessage: 'Metrics anomanly detection',
@@ -54,23 +64,68 @@ const setUpModule = async (
end: number | undefined,
datasetFilter: DatasetFilter,
{ spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration,
- pField?: string
+ partitionField?: string
) => {
const indexNamePattern = indices.join(',');
- const jobIds = ['hosts_memory_usage', 'hosts_network_in', 'hosts_network_out'];
- const jobOverrides = jobIds.map((id) => ({
- job_id: id,
- data_description: {
- time_field: timestampField,
- },
- custom_settings: {
- metrics_source_config: {
- indexPattern: indexNamePattern,
- timestampField,
- bucketSpan,
+ const jobIds: JobType[] = ['hosts_memory_usage', 'hosts_network_in', 'hosts_network_out'];
+
+ const jobOverrides = jobIds.map((id) => {
+ const { job: defaultJobConfig } = getDefaultJobConfigs(id);
+
+ // eslint-disable-next-line @typescript-eslint/naming-convention
+ const analysis_config: any = {
+ ...defaultJobConfig.analysis_config,
+ };
+
+ if (partitionField) {
+ analysis_config.detectors[0].partition_field_name = partitionField;
+ if (analysis_config.influencers.indexOf(partitionField) === -1) {
+ analysis_config.influencers.push(partitionField);
+ }
+ }
+
+ return {
+ job_id: id,
+ data_description: {
+ time_field: timestampField,
+ },
+ analysis_config,
+ custom_settings: {
+ metrics_source_config: {
+ indexPattern: indexNamePattern,
+ timestampField,
+ bucketSpan,
+ },
+ },
+ };
+ });
+
+ const datafeedOverrides = jobIds.map((id) => {
+ const { datafeed: defaultDatafeedConfig } = getDefaultJobConfigs(id);
+
+ if (!partitionField || id === 'hosts_memory_usage') {
+ // Since the host memory usage doesn't have custom aggs, we don't need to do anything to add a partition field
+ return defaultDatafeedConfig;
+ }
+
+ // If we have a partition field, we need to change the aggregation to do a terms agg at the top level
+ const aggregations = {
+ [partitionField]: {
+ terms: {
+ field: partitionField,
+ },
+ aggregations: {
+ ...defaultDatafeedConfig.aggregations,
+ },
},
- },
- }));
+ };
+
+ return {
+ ...defaultDatafeedConfig,
+ job_id: id,
+ aggregations,
+ };
+ });
return callSetupMlModuleAPI(
moduleId,
@@ -80,34 +135,32 @@ const setUpModule = async (
sourceId,
indexNamePattern,
jobOverrides,
- []
+ datafeedOverrides
);
};
-const cleanUpModule = async (spaceId: string, sourceId: string) => {
- return await cleanUpJobsAndDatafeeds(spaceId, sourceId, metricsHostsJobTypes);
-};
-
-const validateSetupIndices = async (indices: string[], timestampField: string) => {
- return await callValidateIndicesAPI(indices, [
- {
- name: timestampField,
- validTypes: ['date'],
- },
- {
- name: partitionField,
- validTypes: ['keyword'],
- },
- ]);
+const getDefaultJobConfigs = (jobId: JobType): { datafeed: any; job: any } => {
+ switch (jobId) {
+ case 'hosts_memory_usage':
+ return {
+ datafeed: MemoryDatafeed,
+ job: MemoryJob,
+ };
+ case 'hosts_network_in':
+ return {
+ datafeed: NetworkInDatafeed,
+ job: NetworkInJob,
+ };
+ case 'hosts_network_out':
+ return {
+ datafeed: NetworkOutDatafeed,
+ job: NetworkOutJob,
+ };
+ }
};
-const validateSetupDatasets = async (
- indices: string[],
- timestampField: string,
- startTime: number,
- endTime: number
-) => {
- return await callValidateDatasetsAPI(indices, timestampField, startTime, endTime);
+const cleanUpModule = async (spaceId: string, sourceId: string) => {
+ return await cleanUpJobsAndDatafeeds(spaceId, sourceId, metricsHostsJobTypes);
};
export const metricHostsModule: ModuleDescriptor = {
@@ -121,6 +174,4 @@ export const metricHostsModule: ModuleDescriptor = {
getModuleDefinition,
setUpModule,
cleanUpModule,
- validateSetupDatasets,
- validateSetupIndices,
};
diff --git a/x-pack/plugins/infra/public/containers/ml/modules/metrics_k8s/module_descriptor.ts b/x-pack/plugins/infra/public/containers/ml/modules/metrics_k8s/module_descriptor.ts
index cbcff1c307af6..eaf7489c84eb4 100644
--- a/x-pack/plugins/infra/public/containers/ml/modules/metrics_k8s/module_descriptor.ts
+++ b/x-pack/plugins/infra/public/containers/ml/modules/metrics_k8s/module_descriptor.ts
@@ -10,17 +10,28 @@ import { cleanUpJobsAndDatafeeds } from '../../infra_ml_cleanup';
import { callJobsSummaryAPI } from '../../api/ml_get_jobs_summary_api';
import { callGetMlModuleAPI } from '../../api/ml_get_module';
import { callSetupMlModuleAPI } from '../../api/ml_setup_module_api';
-import { callValidateIndicesAPI } from '../../../logs/log_analysis/api/validate_indices';
-import { callValidateDatasetsAPI } from '../../../logs/log_analysis/api/validate_datasets';
import {
metricsK8SJobTypes,
getJobId,
MetricK8sJobType,
DatasetFilter,
bucketSpan,
- partitionField,
} from '../../../../../common/infra_ml';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import MemoryJob from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_k8s/ml/k8s_memory_usage.json';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import MemoryDatafeed from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_k8s/ml/datafeed_k8s_memory_usage.json';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import NetworkInJob from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_k8s/ml/k8s_network_in.json';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import NetworkInDatafeed from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_k8s/ml/datafeed_k8s_network_in.json';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import NetworkOutJob from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_k8s/ml/k8s_network_out.json';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import NetworkOutDatafeed from '../../../../../../ml/server/models/data_recognizer/modules/metrics_ui_k8s/ml/datafeed_k8s_network_out.json';
+type JobType = 'k8s_memory_usage' | 'k8s_network_in' | 'k8s_network_out';
+export const DEFAULT_K8S_PARTITION_FIELD = 'kubernetes.namespace';
const moduleId = 'metrics_ui_k8s';
const moduleName = i18n.translate('xpack.infra.ml.metricsModuleName', {
defaultMessage: 'Metrics anomanly detection',
@@ -54,26 +65,72 @@ const setUpModule = async (
end: number | undefined,
datasetFilter: DatasetFilter,
{ spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration,
- pField?: string
+ partitionField?: string
) => {
const indexNamePattern = indices.join(',');
- const jobIds = ['k8s_memory_usage', 'k8s_network_in', 'k8s_network_out'];
- const jobOverrides = jobIds.map((id) => ({
- job_id: id,
- analysis_config: {
- bucket_span: `${bucketSpan}ms`,
- },
- data_description: {
- time_field: timestampField,
- },
- custom_settings: {
- metrics_source_config: {
- indexPattern: indexNamePattern,
- timestampField,
- bucketSpan,
+ const jobIds: JobType[] = ['k8s_memory_usage', 'k8s_network_in', 'k8s_network_out'];
+ const jobOverrides = jobIds.map((id) => {
+ const { job: defaultJobConfig } = getDefaultJobConfigs(id);
+
+ // eslint-disable-next-line @typescript-eslint/naming-convention
+ const analysis_config: any = {
+ ...defaultJobConfig.analysis_config,
+ };
+
+ if (partitionField) {
+ analysis_config.detectors[0].partition_field_name = partitionField;
+ if (analysis_config.influencers.indexOf(partitionField) === -1) {
+ analysis_config.influencers.push(partitionField);
+ }
+ }
+
+ return {
+ job_id: id,
+ data_description: {
+ time_field: timestampField,
+ },
+ analysis_config,
+ custom_settings: {
+ metrics_source_config: {
+ indexPattern: indexNamePattern,
+ timestampField,
+ bucketSpan,
+ },
+ },
+ };
+ });
+
+ const datafeedOverrides = jobIds.map((id) => {
+ const { datafeed: defaultDatafeedConfig } = getDefaultJobConfigs(id);
+
+ if (!partitionField || id === 'k8s_memory_usage') {
+ // Since the host memory usage doesn't have custom aggs, we don't need to do anything to add a partition field
+ return defaultDatafeedConfig;
+ }
+
+ // Because the ML K8s jobs ship with a default partition field of {kubernetes.namespace}, ignore that agg and wrap it in our own agg.
+ const innerAggregation =
+ defaultDatafeedConfig.aggregations[DEFAULT_K8S_PARTITION_FIELD].aggregations;
+
+ // If we have a partition field, we need to change the aggregation to do a terms agg to partition the data at the top level
+ const aggregations = {
+ [partitionField]: {
+ terms: {
+ field: partitionField,
+ size: 25, // 25 is arbitratry and only used to keep the number of buckets to a managable level in the event that the user choose a high cardinality partition field.
+ },
+ aggregations: {
+ ...innerAggregation,
+ },
},
- },
- }));
+ };
+
+ return {
+ ...defaultDatafeedConfig,
+ job_id: id,
+ aggregations,
+ };
+ });
return callSetupMlModuleAPI(
moduleId,
@@ -83,34 +140,32 @@ const setUpModule = async (
sourceId,
indexNamePattern,
jobOverrides,
- []
+ datafeedOverrides
);
};
-const cleanUpModule = async (spaceId: string, sourceId: string) => {
- return await cleanUpJobsAndDatafeeds(spaceId, sourceId, metricsK8SJobTypes);
-};
-
-const validateSetupIndices = async (indices: string[], timestampField: string) => {
- return await callValidateIndicesAPI(indices, [
- {
- name: timestampField,
- validTypes: ['date'],
- },
- {
- name: partitionField,
- validTypes: ['keyword'],
- },
- ]);
+const getDefaultJobConfigs = (jobId: JobType): { datafeed: any; job: any } => {
+ switch (jobId) {
+ case 'k8s_memory_usage':
+ return {
+ datafeed: MemoryDatafeed,
+ job: MemoryJob,
+ };
+ case 'k8s_network_in':
+ return {
+ datafeed: NetworkInDatafeed,
+ job: NetworkInJob,
+ };
+ case 'k8s_network_out':
+ return {
+ datafeed: NetworkOutDatafeed,
+ job: NetworkOutJob,
+ };
+ }
};
-const validateSetupDatasets = async (
- indices: string[],
- timestampField: string,
- startTime: number,
- endTime: number
-) => {
- return await callValidateDatasetsAPI(indices, timestampField, startTime, endTime);
+const cleanUpModule = async (spaceId: string, sourceId: string) => {
+ return await cleanUpJobsAndDatafeeds(spaceId, sourceId, metricsK8SJobTypes);
};
export const metricHostsModule: ModuleDescriptor = {
@@ -124,6 +179,4 @@ export const metricHostsModule: ModuleDescriptor = {
getModuleDefinition,
setUpModule,
cleanUpModule,
- validateSetupDatasets,
- validateSetupIndices,
};
diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/anomoly_detection_flyout.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/anomoly_detection_flyout.tsx
index b063713fa2c97..b5d224910e819 100644
--- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/anomoly_detection_flyout.tsx
+++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/anomoly_detection_flyout.tsx
@@ -50,10 +50,10 @@ export const AnomalyDetectionFlyout = () => {
return (
<>
-
+
{showFlyout && (
diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/flyout_home.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/flyout_home.tsx
index 801dff9c4a17a..5b520084ebb74 100644
--- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/flyout_home.tsx
+++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/flyout_home.tsx
@@ -5,7 +5,7 @@
*/
import React, { useState, useCallback, useEffect } from 'react';
-import { EuiFlyoutHeader, EuiTitle, EuiFlyoutBody, EuiTabs, EuiTab, EuiSpacer } from '@elastic/eui';
+import { EuiFlyoutHeader, EuiTitle, EuiFlyoutBody, EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiText, EuiFlexGroup, EuiFlexItem, EuiCard, EuiIcon } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
@@ -30,7 +30,7 @@ interface Props {
}
export const FlyoutHome = (props: Props) => {
- const [tab, setTab] = useState<'jobs' | 'anomalies'>('jobs');
+ const [tab] = useState<'jobs' | 'anomalies'>('jobs');
const { goToSetup } = props;
const {
fetchJobStatus: fetchHostJobStatus,
@@ -56,18 +56,10 @@ export const FlyoutHome = (props: Props) => {
goToSetup('kubernetes');
}, [goToSetup]);
- const goToJobs = useCallback(() => {
- setTab('jobs');
- }, []);
-
const jobIds = [
...(k8sJobSummaries || []).map((k) => k.id),
...(hostJobSummaries || []).map((h) => h.id),
];
- const anomaliesUrl = useLinkProps({
- app: 'ml',
- pathname: `/explorer?_g=${createResultsUrl(jobIds)}`,
- });
useEffect(() => {
if (hasInfraMLReadCapabilities) {
@@ -105,30 +97,24 @@ export const FlyoutHome = (props: Props) => {
-
-
-
-
-
-
-
-
+
+
{hostJobSummaries.length > 0 && (
<>
0}
hasK8sJobs={k8sJobSummaries.length > 0}
+ jobIds={jobIds}
/>
>
@@ -151,6 +137,7 @@ export const FlyoutHome = (props: Props) => {
interface CalloutProps {
hasHostJobs: boolean;
hasK8sJobs: boolean;
+ jobIds: string[];
}
const JobsEnabledCallout = (props: CalloutProps) => {
let target = '';
@@ -175,8 +162,34 @@ const JobsEnabledCallout = (props: CalloutProps) => {
pathname: '/jobs',
});
+ const anomaliesUrl = useLinkProps({
+ app: 'ml',
+ pathname: `/explorer?_g=${createResultsUrl(props.jobIds)}`,
+ });
+
return (
<>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{
}
iconType="check"
/>
-
-
-
-
>
);
};
@@ -211,30 +217,11 @@ interface CreateJobTab {
const CreateJobTab = (props: CreateJobTab) => {
return (
<>
-
-
-
+ {/* */}
}
// title="Hosts"
title={
@@ -245,7 +232,7 @@ const CreateJobTab = (props: CreateJobTab) => {
}
description={
}
@@ -254,7 +241,7 @@ const CreateJobTab = (props: CreateJobTab) => {
{props.hasHostJobs && (
@@ -262,7 +249,7 @@ const CreateJobTab = (props: CreateJobTab) => {
{!props.hasHostJobs && (
@@ -273,7 +260,7 @@ const CreateJobTab = (props: CreateJobTab) => {
}
title={
{
}
description={
}
@@ -292,7 +279,7 @@ const CreateJobTab = (props: CreateJobTab) => {
{props.hasK8sJobs && (
@@ -300,7 +287,7 @@ const CreateJobTab = (props: CreateJobTab) => {
{!props.hasK8sJobs && (
diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/job_setup_screen.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/job_setup_screen.tsx
index 428c002da6383..c327d187f6bc2 100644
--- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/job_setup_screen.tsx
+++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/ml/anomaly_detection/job_setup_screen.tsx
@@ -20,6 +20,7 @@ import { useSourceViaHttp } from '../../../../../../containers/source/use_source
import { useMetricK8sModuleContext } from '../../../../../../containers/ml/modules/metrics_k8s/module';
import { useMetricHostsModuleContext } from '../../../../../../containers/ml/modules/metrics_hosts/module';
import { FixedDatePicker } from '../../../../../../components/fixed_datepicker';
+import { DEFAULT_K8S_PARTITION_FIELD } from '../../../../../../containers/ml/modules/metrics_k8s/module_descriptor';
interface Props {
jobType: 'hosts' | 'kubernetes';
@@ -107,7 +108,7 @@ export const JobSetupScreen = (props: Props) => {
useEffect(() => {
if (props.jobType === 'kubernetes') {
- setPartitionField(['kubernetes.namespace']);
+ setPartitionField([DEFAULT_K8S_PARTITION_FIELD]);
}
}, [props.jobType]);
From 6c015cfbef12189eb5aec8fa42f5ea2743be2971 Mon Sep 17 00:00:00 2001
From: Nathan Reese
Date: Thu, 1 Oct 2020 19:04:26 -0600
Subject: [PATCH 04/56] Convert VectorLayer to typescript (#78490)
* [maps] convert VectorLayer to TS
* more tslint fixes
* clean up
* more tslint fixes
* more tslint fixes
* remove unneeded casts
* remove unneeded VectorStyle casts
* revert changes to layer.getQuery
* fix
* update tile layer constructor
* review feedback
Co-authored-by: Elastic Machine
---
.../data_request_descriptor_types.ts | 19 +-
.../common/descriptor_types/map_descriptor.ts | 2 +-
.../common/elasticsearch_util/es_agg_utils.ts | 4 +-
.../public/actions/data_request_actions.ts | 2 +-
.../maps/public/classes/joins/inner_join.d.ts | 23 +-
.../plugins/maps/public/classes/joins/join.ts | 32 +-
.../blended_vector_layer.ts | 11 +-
.../layers/heatmap_layer/heatmap_layer.js | 12 +
.../maps/public/classes/layers/layer.test.ts | 6 -
.../maps/public/classes/layers/layer.tsx | 19 +-
.../classes/layers/tile_layer/tile_layer.js | 15 +-
.../tiled_vector_layer/tiled_vector_layer.tsx | 43 +--
.../layers/vector_layer/vector_layer.d.ts | 85 -----
.../{vector_layer.js => vector_layer.tsx} | 291 ++++++++++++------
.../sources/es_agg_source/es_agg_source.ts | 2 +-
.../es_geo_grid_source.d.ts | 9 +-
.../es_geo_grid_source.test.ts | 3 +-
.../classes/sources/es_source/es_source.d.ts | 48 ++-
.../classes/sources/es_source/es_source.js | 15 +-
.../es_term_source/es_term_source.d.ts | 13 +-
.../sources/es_term_source/es_term_source.js | 4 +-
.../kibana_regionmap_source.js | 1 +
.../mvt_single_layer_vector_source.tsx | 14 +-
.../sources/vector_source/vector_source.d.ts | 28 +-
.../classes/styles/vector/vector_style.tsx | 55 +++-
.../toc_entry_actions_popover.test.tsx | 14 +-
26 files changed, 478 insertions(+), 292 deletions(-)
delete mode 100644 x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.d.ts
rename x-pack/plugins/maps/public/classes/layers/vector_layer/{vector_layer.js => vector_layer.tsx} (78%)
diff --git a/x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.ts b/x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.ts
index f3521cca2e456..16b60492c9b78 100644
--- a/x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.ts
+++ b/x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.ts
@@ -38,15 +38,21 @@ export type VectorSourceRequestMeta = MapFilters & {
applyGlobalQuery: boolean;
fieldNames: string[];
geogridPrecision?: number;
- sourceQuery: MapQuery;
+ sourceQuery?: MapQuery;
sourceMeta: VectorSourceSyncMeta;
};
+export type VectorJoinSourceRequestMeta = MapFilters & {
+ applyGlobalQuery: boolean;
+ fieldNames: string[];
+ sourceQuery: MapQuery;
+};
+
export type VectorStyleRequestMeta = MapFilters & {
dynamicStyleFields: string[];
isTimeAware: boolean;
sourceQuery: MapQuery;
- timeFilters: unknown;
+ timeFilters: TimeRange;
};
export type ESSearchSourceResponseMeta = {
@@ -59,9 +65,12 @@ export type ESSearchSourceResponseMeta = {
};
// Partial because objects are justified downstream in constructors
-export type DataMeta = Partial &
- Partial &
- Partial;
+export type DataMeta = Partial<
+ VectorSourceRequestMeta &
+ VectorJoinSourceRequestMeta &
+ VectorStyleRequestMeta &
+ ESSearchSourceResponseMeta
+>;
type NumericalStyleFieldData = {
avg: number;
diff --git a/x-pack/plugins/maps/common/descriptor_types/map_descriptor.ts b/x-pack/plugins/maps/common/descriptor_types/map_descriptor.ts
index d064dfb1c4a37..b769b125cf0f8 100644
--- a/x-pack/plugins/maps/common/descriptor_types/map_descriptor.ts
+++ b/x-pack/plugins/maps/common/descriptor_types/map_descriptor.ts
@@ -17,7 +17,7 @@ export type MapExtent = {
};
export type MapQuery = Query & {
- queryLastTriggeredAt: string;
+ queryLastTriggeredAt?: string;
};
export type MapRefreshConfig = {
diff --git a/x-pack/plugins/maps/common/elasticsearch_util/es_agg_utils.ts b/x-pack/plugins/maps/common/elasticsearch_util/es_agg_utils.ts
index 7828c3cc6410b..f157ffe9f1c80 100644
--- a/x-pack/plugins/maps/common/elasticsearch_util/es_agg_utils.ts
+++ b/x-pack/plugins/maps/common/elasticsearch_util/es_agg_utils.ts
@@ -33,8 +33,10 @@ export function addFieldToDSL(dsl: object, field: IFieldType) {
};
}
+export type BucketProperties = Record;
+
export function extractPropertiesFromBucket(bucket: any, ignoreKeys: string[] = []) {
- const properties: Record = {};
+ const properties: BucketProperties = {};
for (const key in bucket) {
if (ignoreKeys.includes(key) || !bucket.hasOwnProperty(key)) {
continue;
diff --git a/x-pack/plugins/maps/public/actions/data_request_actions.ts b/x-pack/plugins/maps/public/actions/data_request_actions.ts
index 14d8196900506..d7d9259e1539e 100644
--- a/x-pack/plugins/maps/public/actions/data_request_actions.ts
+++ b/x-pack/plugins/maps/public/actions/data_request_actions.ts
@@ -47,7 +47,7 @@ const FIT_TO_BOUNDS_SCALE_FACTOR = 0.1;
export type DataRequestContext = {
startLoading(dataId: string, requestToken: symbol, meta: DataMeta): void;
- stopLoading(dataId: string, requestToken: symbol, data: object, meta: DataMeta): void;
+ stopLoading(dataId: string, requestToken: symbol, data: object, meta?: DataMeta): void;
onLoadError(dataId: string, requestToken: symbol, errorMessage: string): void;
updateSourceData(newData: unknown): void;
isRequestStillActive(dataId: string, requestToken: symbol): boolean;
diff --git a/x-pack/plugins/maps/public/classes/joins/inner_join.d.ts b/x-pack/plugins/maps/public/classes/joins/inner_join.d.ts
index befff0965fb70..3e2ceac4971c4 100644
--- a/x-pack/plugins/maps/public/classes/joins/inner_join.d.ts
+++ b/x-pack/plugins/maps/public/classes/joins/inner_join.d.ts
@@ -4,19 +4,40 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import { Feature, GeoJsonProperties } from 'geojson';
import { IESTermSource } from '../sources/es_term_source';
-import { IJoin } from './join';
+import { IJoin, PropertiesMap } from './join';
import { JoinDescriptor } from '../../../common/descriptor_types';
import { ISource } from '../sources/source';
+import { ITooltipProperty } from '../tooltips/tooltip_property';
+import { IField } from '../fields/field';
export class InnerJoin implements IJoin {
constructor(joinDescriptor: JoinDescriptor, leftSource: ISource);
+ destroy: () => void;
+
getRightJoinSource(): IESTermSource;
toDescriptor(): JoinDescriptor;
+ getJoinFields: () => IField[];
+
+ getLeftField: () => IField;
+
+ getIndexPatternIds: () => string[];
+
+ getQueryableIndexPatternIds: () => string[];
+
+ getSourceDataRequestId: () => string;
+
getSourceMetaDataRequestId(): string;
getSourceFormattersDataRequestId(): string;
+
+ getTooltipProperties(properties: GeoJsonProperties): Promise;
+
+ hasCompleteConfig: () => boolean;
+
+ joinPropertiesToFeature: (feature: Feature, propertiesMap?: PropertiesMap) => boolean;
}
diff --git a/x-pack/plugins/maps/public/classes/joins/join.ts b/x-pack/plugins/maps/public/classes/joins/join.ts
index 5bcc4bfdec87e..df6f6f684f4d2 100644
--- a/x-pack/plugins/maps/public/classes/joins/join.ts
+++ b/x-pack/plugins/maps/public/classes/joins/join.ts
@@ -4,15 +4,39 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import { Feature, GeoJsonProperties } from 'geojson';
import { IESTermSource } from '../sources/es_term_source';
import { JoinDescriptor } from '../../../common/descriptor_types';
+import { ITooltipProperty } from '../tooltips/tooltip_property';
+import { IField } from '../fields/field';
+import { BucketProperties } from '../../../common/elasticsearch_util';
+
+export type PropertiesMap = Map;
export interface IJoin {
- getRightJoinSource(): IESTermSource;
+ destroy: () => void;
+
+ getRightJoinSource: () => IESTermSource;
+
+ toDescriptor: () => JoinDescriptor;
+
+ getJoinFields: () => IField[];
+
+ getLeftField: () => IField;
+
+ getIndexPatternIds: () => string[];
+
+ getQueryableIndexPatternIds: () => string[];
+
+ getSourceDataRequestId: () => string;
+
+ getSourceMetaDataRequestId: () => string;
+
+ getSourceFormattersDataRequestId: () => string;
- toDescriptor(): JoinDescriptor;
+ getTooltipProperties: (properties: GeoJsonProperties) => Promise;
- getSourceMetaDataRequestId(): string;
+ hasCompleteConfig: () => boolean;
- getSourceFormattersDataRequestId(): string;
+ joinPropertiesToFeature: (feature: Feature, propertiesMap?: PropertiesMap) => boolean;
}
diff --git a/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts b/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts
index 90e8d25a77958..9b6a67ac28ad0 100644
--- a/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts
+++ b/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts
@@ -37,7 +37,6 @@ import {
LayerDescriptor,
VectorLayerDescriptor,
} from '../../../../common/descriptor_types';
-import { IStyle } from '../../styles/style';
import { IVectorSource } from '../../sources/vector_source';
const ACTIVE_COUNT_DATA_ID = 'ACTIVE_COUNT_DATA_ID';
@@ -257,7 +256,7 @@ export class BlendedVectorLayer extends VectorLayer implements IVectorLayer {
return clonedDescriptor;
}
- getSource() {
+ getSource(): IVectorSource {
return this._isClustered ? this._clusterSource : this._documentSource;
}
@@ -268,11 +267,11 @@ export class BlendedVectorLayer extends VectorLayer implements IVectorLayer {
return this._documentSource;
}
- getCurrentStyle(): IStyle {
+ getCurrentStyle(): IVectorStyle {
return this._isClustered ? this._clusterStyle : this._documentStyle;
}
- getStyleForEditing(): IStyle {
+ getStyleForEditing(): IVectorStyle {
return this._documentStyle;
}
@@ -281,8 +280,8 @@ export class BlendedVectorLayer extends VectorLayer implements IVectorLayer {
const requestToken = Symbol(`layer-active-count:${this.getId()}`);
const searchFilters = this._getSearchFilters(
syncContext.dataFilters,
- this.getSource() as IVectorSource,
- this.getCurrentStyle() as IVectorStyle
+ this.getSource(),
+ this.getCurrentStyle()
);
const canSkipFetch = await canSkipSourceUpdate({
source: this.getSource(),
diff --git a/x-pack/plugins/maps/public/classes/layers/heatmap_layer/heatmap_layer.js b/x-pack/plugins/maps/public/classes/layers/heatmap_layer/heatmap_layer.js
index adcc86b9d1546..33e82db79f3cf 100644
--- a/x-pack/plugins/maps/public/classes/layers/heatmap_layer/heatmap_layer.js
+++ b/x-pack/plugins/maps/public/classes/layers/heatmap_layer/heatmap_layer.js
@@ -31,6 +31,18 @@ export class HeatmapLayer extends VectorLayer {
}
}
+ getStyleForEditing() {
+ return this._style;
+ }
+
+ getStyle() {
+ return this._style;
+ }
+
+ getCurrentStyle() {
+ return this._style;
+ }
+
_getPropKeyOfSelectedMetric() {
const metricfields = this.getSource().getMetricFields();
return metricfields[0].getName();
diff --git a/x-pack/plugins/maps/public/classes/layers/layer.test.ts b/x-pack/plugins/maps/public/classes/layers/layer.test.ts
index 7bc91d71f83e2..76df7c2af840a 100644
--- a/x-pack/plugins/maps/public/classes/layers/layer.test.ts
+++ b/x-pack/plugins/maps/public/classes/layers/layer.test.ts
@@ -7,7 +7,6 @@
import { AbstractLayer } from './layer';
import { ISource } from '../sources/source';
-import { IStyle } from '../styles/style';
import { AGG_TYPE, FIELD_ORIGIN, LAYER_STYLE_TYPE, VECTOR_STYLES } from '../../../common/constants';
import { ESTermSourceDescriptor, VectorStyleDescriptor } from '../../../common/descriptor_types';
import { getDefaultDynamicProperties } from '../styles/vector/vector_style_defaults';
@@ -38,8 +37,6 @@ class MockSource {
}
}
-class MockStyle {}
-
describe('cloneDescriptor', () => {
describe('with joins', () => {
const styleDescriptor = {
@@ -84,7 +81,6 @@ describe('cloneDescriptor', () => {
const layer = new MockLayer({
layerDescriptor,
source: (new MockSource() as unknown) as ISource,
- style: (new MockStyle() as unknown) as IStyle,
});
const clonedDescriptor = await layer.cloneDescriptor();
const clonedStyleProps = (clonedDescriptor.style as VectorStyleDescriptor).properties;
@@ -122,7 +118,6 @@ describe('cloneDescriptor', () => {
const layer = new MockLayer({
layerDescriptor,
source: (new MockSource() as unknown) as ISource,
- style: (new MockStyle() as unknown) as IStyle,
});
const clonedDescriptor = await layer.cloneDescriptor();
const clonedStyleProps = (clonedDescriptor.style as VectorStyleDescriptor).properties;
@@ -165,7 +160,6 @@ describe('isFittable', () => {
const layer = new MockLayer({
layerDescriptor,
source: (new MockSource({ fitToBounds: test.fitToBounds }) as unknown) as ISource,
- style: (new MockStyle() as unknown) as IStyle,
});
expect(await layer.isFittable()).toBe(test.canFit);
});
diff --git a/x-pack/plugins/maps/public/classes/layers/layer.tsx b/x-pack/plugins/maps/public/classes/layers/layer.tsx
index cd720063c6703..d6bd5180375ce 100644
--- a/x-pack/plugins/maps/public/classes/layers/layer.tsx
+++ b/x-pack/plugins/maps/public/classes/layers/layer.tsx
@@ -110,13 +110,11 @@ export type CustomIconAndTooltipContent = {
export interface ILayerArguments {
layerDescriptor: LayerDescriptor;
source: ISource;
- style: IStyle;
}
export class AbstractLayer implements ILayer {
protected readonly _descriptor: LayerDescriptor;
protected readonly _source: ISource;
- protected readonly _style: IStyle;
protected readonly _dataRequests: DataRequest[];
static createDescriptor(options: Partial): LayerDescriptor {
@@ -140,10 +138,9 @@ export class AbstractLayer implements ILayer {
}
}
- constructor({ layerDescriptor, source, style }: ILayerArguments) {
+ constructor({ layerDescriptor, source }: ILayerArguments) {
this._descriptor = AbstractLayer.createDescriptor(layerDescriptor);
this._source = source;
- this._style = style;
if (this._descriptor.__dataRequests) {
this._dataRequests = this._descriptor.__dataRequests.map(
(dataRequest) => new DataRequest(dataRequest)
@@ -257,11 +254,15 @@ export class AbstractLayer implements ILayer {
}
getStyleForEditing(): IStyle {
- return this._style;
+ throw new Error('Should implement AbstractLayer#getStyleForEditing');
}
- getStyle() {
- return this._style;
+ getStyle(): IStyle {
+ throw new Error('Should implement AbstractLayer#getStyle');
+ }
+
+ getCurrentStyle(): IStyle {
+ throw new Error('Should implement AbstractLayer#getCurrentStyle');
}
getLabel(): string {
@@ -412,10 +413,6 @@ export class AbstractLayer implements ILayer {
return this._descriptor.query ? this._descriptor.query : null;
}
- getCurrentStyle(): IStyle {
- return this._style;
- }
-
async getImmutableSourceProperties() {
const source = this.getSource();
return await source.getImmutableProperties();
diff --git a/x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.js b/x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.js
index 3e2009c24a2e4..fa60017f0eaf7 100644
--- a/x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.js
+++ b/x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.js
@@ -21,7 +21,20 @@ export class TileLayer extends AbstractLayer {
}
constructor({ source, layerDescriptor }) {
- super({ source, layerDescriptor, style: new TileStyle() });
+ super({ source, layerDescriptor });
+ this._style = new TileStyle();
+ }
+
+ getStyleForEditing() {
+ return this._style;
+ }
+
+ getStyle() {
+ return this._style;
+ }
+
+ getCurrentStyle() {
+ return this._style;
}
async syncData({ startLoading, stopLoading, onLoadError, dataFilters }) {
diff --git a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx
index 70bf8ea3883b7..68b9f2931f398 100644
--- a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx
+++ b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx
@@ -5,9 +5,14 @@
*/
import React from 'react';
+import {
+ Map as MbMap,
+ GeoJSONSource as MbGeoJSONSource,
+ VectorSource as MbVectorSource,
+} from 'mapbox-gl';
import { EuiIcon } from '@elastic/eui';
import { Feature } from 'geojson';
-import { VectorStyle } from '../../styles/vector/vector_style';
+import { IVectorStyle, VectorStyle } from '../../styles/vector/vector_style';
import { SOURCE_DATA_REQUEST_ID, LAYER_TYPE } from '../../../../common/constants';
import { VectorLayer, VectorLayerArguments } from '../vector_layer/vector_layer';
import { ITiledSingleLayerVectorSource } from '../../sources/vector_source';
@@ -59,7 +64,7 @@ export class TiledVectorLayer extends VectorLayer {
const searchFilters: VectorSourceRequestMeta = this._getSearchFilters(
dataFilters,
this.getSource(),
- this._style
+ this._style as IVectorStyle
);
const prevDataRequest = this.getSourceDataRequest();
@@ -88,13 +93,12 @@ export class TiledVectorLayer extends VectorLayer {
}
async syncData(syncContext: DataRequestContext) {
- await this._syncSourceStyleMeta(syncContext, this._source, this._style);
- await this._syncSourceFormatters(syncContext, this._source, this._style);
+ await this._syncSourceStyleMeta(syncContext, this._source, this._style as IVectorStyle);
+ await this._syncSourceFormatters(syncContext, this._source, this._style as IVectorStyle);
await this._syncMVTUrlTemplate(syncContext);
}
- _syncSourceBindingWithMb(mbMap: unknown) {
- // @ts-expect-error
+ _syncSourceBindingWithMb(mbMap: MbMap) {
const mbSource = mbMap.getSource(this._getMbSourceId());
if (mbSource) {
return;
@@ -113,7 +117,6 @@ export class TiledVectorLayer extends VectorLayer {
}
const mbSourceId = this._getMbSourceId();
- // @ts-expect-error
mbMap.addSource(mbSourceId, {
type: 'vector',
tiles: [sourceMeta.urlTemplate],
@@ -126,7 +129,7 @@ export class TiledVectorLayer extends VectorLayer {
return this._getMbSourceId() === mbSourceId;
}
- _syncStylePropertiesWithMb(mbMap: unknown) {
+ _syncStylePropertiesWithMb(mbMap: MbMap) {
// @ts-ignore
const mbSource = mbMap.getSource(this._getMbSourceId());
if (!mbSource) {
@@ -146,12 +149,16 @@ export class TiledVectorLayer extends VectorLayer {
this._setMbLinePolygonProperties(mbMap, sourceMeta.layerName);
}
- _requiresPrevSourceCleanup(mbMap: unknown): boolean {
- // @ts-expect-error
- const mbTileSource = mbMap.getSource(this._getMbSourceId());
- if (!mbTileSource) {
+ _requiresPrevSourceCleanup(mbMap: MbMap): boolean {
+ const mbSource = mbMap.getSource(this._getMbSourceId()) as MbVectorSource | MbGeoJSONSource;
+ if (!mbSource) {
return false;
}
+ if (!('tiles' in mbSource)) {
+ // Expected source is not compatible, so remove.
+ return true;
+ }
+ const mbTileSource = mbSource as MbVectorSource;
const dataRequest = this.getSourceDataRequest();
if (!dataRequest) {
@@ -163,13 +170,8 @@ export class TiledVectorLayer extends VectorLayer {
return false;
}
- if (!mbTileSource.tiles) {
- // Expected source is not compatible, so remove.
- return true;
- }
-
const isSourceDifferent =
- mbTileSource.tiles[0] !== tiledSourceMeta.urlTemplate ||
+ mbTileSource.tiles?.[0] !== tiledSourceMeta.urlTemplate ||
mbTileSource.minzoom !== tiledSourceMeta.minSourceZoom ||
mbTileSource.maxzoom !== tiledSourceMeta.maxSourceZoom;
@@ -179,9 +181,8 @@ export class TiledVectorLayer extends VectorLayer {
const layerIds = this.getMbLayerIds();
for (let i = 0; i < layerIds.length; i++) {
- // @ts-expect-error
const mbLayer = mbMap.getLayer(layerIds[i]);
- if (mbLayer && mbLayer.sourceLayer !== tiledSourceMeta.layerName) {
+ if (mbLayer && mbLayer['source-layer'] !== tiledSourceMeta.layerName) {
// If the source-pointer of one of the layers is stale, they will all be stale.
// In this case, all the mb-layers need to be removed and re-added.
return true;
@@ -191,7 +192,7 @@ export class TiledVectorLayer extends VectorLayer {
return false;
}
- syncLayerWithMB(mbMap: unknown) {
+ syncLayerWithMB(mbMap: MbMap) {
this._removeStaleMbSourcesAndLayers(mbMap);
this._syncSourceBindingWithMb(mbMap);
this._syncStylePropertiesWithMb(mbMap);
diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.d.ts b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.d.ts
deleted file mode 100644
index fa614ae87b290..0000000000000
--- a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.d.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-/* eslint-disable @typescript-eslint/consistent-type-definitions */
-
-import { Feature, GeoJsonProperties } from 'geojson';
-import { AbstractLayer } from '../layer';
-import { IVectorSource } from '../../sources/vector_source';
-import {
- MapFilters,
- VectorLayerDescriptor,
- VectorSourceRequestMeta,
-} from '../../../../common/descriptor_types';
-import { ILayer } from '../layer';
-import { IJoin } from '../../joins/join';
-import { IVectorStyle } from '../../styles/vector/vector_style';
-import { IField } from '../../fields/field';
-import { DataRequestContext } from '../../../actions';
-import { ITooltipProperty } from '../../tooltips/tooltip_property';
-
-export type VectorLayerArguments = {
- source: IVectorSource;
- joins?: IJoin[];
- layerDescriptor: VectorLayerDescriptor;
-};
-
-export interface IVectorLayer extends ILayer {
- getFields(): Promise;
- getStyleEditorFields(): Promise;
- getJoins(): IJoin[];
- getValidJoins(): IJoin[];
- getSource(): IVectorSource;
- getFeatureById(id: string | number): Feature | null;
- getPropertiesForTooltip(properties: GeoJsonProperties): Promise;
- hasJoins(): boolean;
-}
-
-export class VectorLayer extends AbstractLayer implements IVectorLayer {
- static type: string;
-
- protected readonly _style: IVectorStyle;
- static createDescriptor(
- options: Partial,
- mapColors?: string[]
- ): VectorLayerDescriptor;
-
- constructor(options: VectorLayerArguments);
- getLayerTypeIconName(): string;
- getFields(): Promise;
- getStyleEditorFields(): Promise;
- getJoins(): IJoin[];
- getValidJoins(): IJoin[];
- _syncSourceStyleMeta(
- syncContext: DataRequestContext,
- source: IVectorSource,
- style: IVectorStyle
- ): Promise;
- _syncSourceFormatters(
- syncContext: DataRequestContext,
- source: IVectorSource,
- style: IVectorStyle
- ): Promise;
- syncLayerWithMB(mbMap: unknown): void;
- _getSearchFilters(
- dataFilters: MapFilters,
- source: IVectorSource,
- style: IVectorStyle
- ): VectorSourceRequestMeta;
- _syncData(
- syncContext: DataRequestContext,
- source: IVectorSource,
- style: IVectorStyle
- ): Promise;
- ownsMbSourceId(sourceId: string): boolean;
- ownsMbLayerId(sourceId: string): boolean;
- _setMbPointsProperties(mbMap: unknown, mvtSourceLayer?: string): void;
- _setMbLinePolygonProperties(mbMap: unknown, mvtSourceLayer?: string): void;
- getSource(): IVectorSource;
- getFeatureById(id: string | number): Feature | null;
- getPropertiesForTooltip(properties: GeoJsonProperties): Promise;
- hasJoins(): boolean;
- isFittable(): Promise;
-}
diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.js b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx
similarity index 78%
rename from x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.js
rename to x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx
index 27c344b713a60..a2532d4e7b10e 100644
--- a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.js
+++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx
@@ -5,8 +5,13 @@
*/
import React from 'react';
+import { Map as MbMap, Layer as MbLayer, GeoJSONSource as MbGeoJSONSource } from 'mapbox-gl';
+import { Feature, FeatureCollection, GeoJsonProperties } from 'geojson';
+import _ from 'lodash';
+import { EuiIcon } from '@elastic/eui';
+import { i18n } from '@kbn/i18n';
import { AbstractLayer } from '../layer';
-import { VectorStyle } from '../../styles/vector/vector_style';
+import { IVectorStyle, VectorStyle } from '../../styles/vector/vector_style';
import {
FEATURE_ID_PROPERTY_NAME,
SOURCE_DATA_REQUEST_ID,
@@ -20,11 +25,9 @@ import {
FIELD_ORIGIN,
LAYER_STYLE_TYPE,
KBN_TOO_MANY_FEATURES_IMAGE_ID,
+ FieldFormatter,
} from '../../../../common/constants';
-import _ from 'lodash';
import { JoinTooltipProperty } from '../../tooltips/join_tooltip_property';
-import { EuiIcon } from '@elastic/eui';
-import { i18n } from '@kbn/i18n';
import { DataRequestAbortError } from '../../util/data_request';
import {
canSkipSourceUpdate,
@@ -39,15 +42,66 @@ import {
getPointFilterExpression,
} from '../../util/mb_filter_expressions';
+import {
+ DynamicStylePropertyOptions,
+ MapFilters,
+ MapQuery,
+ VectorLayerDescriptor,
+ VectorSourceRequestMeta,
+ VectorStyleRequestMeta,
+} from '../../../../common/descriptor_types';
+import { IVectorSource } from '../../sources/vector_source';
+import { CustomIconAndTooltipContent, ILayer } from '../layer';
+import { IJoin, PropertiesMap } from '../../joins/join';
+import { IField } from '../../fields/field';
+import { DataRequestContext } from '../../../actions';
+import { ITooltipProperty } from '../../tooltips/tooltip_property';
+import { IDynamicStyleProperty } from '../../styles/vector/properties/dynamic_style_property';
+import { IESSource } from '../../sources/es_source';
+
+interface SourceResult {
+ refreshed: boolean;
+ featureCollection?: FeatureCollection;
+}
+
+interface JoinState {
+ dataHasChanged: boolean;
+ join: IJoin;
+ propertiesMap?: PropertiesMap;
+}
+
+export interface VectorLayerArguments {
+ source: IVectorSource;
+ joins?: IJoin[];
+ layerDescriptor: VectorLayerDescriptor;
+}
+
+export interface IVectorLayer extends ILayer {
+ getFields(): Promise;
+ getStyleEditorFields(): Promise;
+ getJoins(): IJoin[];
+ getValidJoins(): IJoin[];
+ getSource(): IVectorSource;
+ getFeatureById(id: string | number): Feature | null;
+ getPropertiesForTooltip(properties: GeoJsonProperties): Promise;
+ hasJoins(): boolean;
+}
+
export class VectorLayer extends AbstractLayer {
static type = LAYER_TYPE.VECTOR;
- static createDescriptor(options, mapColors) {
+ protected readonly _style: IVectorStyle;
+ private readonly _joins: IJoin[];
+
+ static createDescriptor(
+ options: Partial,
+ mapColors?: string[]
+ ): VectorLayerDescriptor {
const layerDescriptor = super.createDescriptor(options);
layerDescriptor.type = VectorLayer.type;
if (!options.style) {
- const styleProperties = VectorStyle.createDefaultStyleProperties(mapColors);
+ const styleProperties = VectorStyle.createDefaultStyleProperties(mapColors ? mapColors : []);
layerDescriptor.style = VectorStyle.createDescriptor(styleProperties);
}
@@ -55,16 +109,31 @@ export class VectorLayer extends AbstractLayer {
layerDescriptor.joins = [];
}
- return layerDescriptor;
+ return layerDescriptor as VectorLayerDescriptor;
}
- constructor({ layerDescriptor, source, joins = [] }) {
- super({ layerDescriptor, source });
+ constructor({ layerDescriptor, source, joins = [] }: VectorLayerArguments) {
+ super({
+ layerDescriptor,
+ source,
+ });
this._joins = joins;
- this._style = new VectorStyle(this._descriptor.style, source, this);
+ this._style = new VectorStyle(layerDescriptor.style, source, this);
+ }
+
+ getSource(): IVectorSource {
+ return super.getSource() as IVectorSource;
+ }
+
+ getStyleForEditing(): IVectorStyle {
+ return this._style;
+ }
+
+ getStyle(): IVectorStyle {
+ return this._style;
}
- getStyle() {
+ getCurrentStyle(): IVectorStyle {
return this._style;
}
@@ -108,7 +177,7 @@ export class VectorLayer extends AbstractLayer {
return true;
}
- getCustomIconAndTooltipContent() {
+ getCustomIconAndTooltipContent(): CustomIconAndTooltipContent {
const featureCollection = this._getSourceFeatureCollection();
const noResultsIcon = ;
@@ -124,7 +193,7 @@ export class VectorLayer extends AbstractLayer {
if (
this.getJoins().length &&
!featureCollection.features.some(
- (feature) => feature.properties[FEATURE_VISIBLE_PROPERTY_NAME]
+ (feature) => feature.properties?.[FEATURE_VISIBLE_PROPERTY_NAME]
)
) {
return {
@@ -141,8 +210,8 @@ export class VectorLayer extends AbstractLayer {
);
return {
icon: this.getCurrentStyle().getIcon(),
- tooltipContent: tooltipContent,
- areResultsTrimmed: areResultsTrimmed,
+ tooltipContent,
+ areResultsTrimmed,
};
}
@@ -158,7 +227,12 @@ export class VectorLayer extends AbstractLayer {
return this.getCurrentStyle().renderLegendDetails();
}
- async getBounds({ startLoading, stopLoading, registerCancelCallback, dataFilters }) {
+ async getBounds({
+ startLoading,
+ stopLoading,
+ registerCancelCallback,
+ dataFilters,
+ }: DataRequestContext) {
const isStaticLayer = !this.getSource().isBoundsAware();
if (isStaticLayer || this.hasJoins()) {
return getFeatureCollectionBounds(this._getSourceFeatureCollection(), this.hasJoins());
@@ -190,7 +264,7 @@ export class VectorLayer extends AbstractLayer {
} finally {
// Use stopLoading callback instead of onLoadError callback.
// Function is loading bounds and not feature data.
- stopLoading(SOURCE_BOUNDS_DATA_REQUEST_ID, requestToken, bounds, boundsFilters);
+ stopLoading(SOURCE_BOUNDS_DATA_REQUEST_ID, requestToken, bounds ? bounds : {}, boundsFilters);
}
return bounds;
}
@@ -205,7 +279,7 @@ export class VectorLayer extends AbstractLayer {
}
_getJoinFields() {
- const joinFields = [];
+ const joinFields: IField[] = [];
this.getValidJoins().forEach((join) => {
const fields = join.getJoinFields();
joinFields.push(...fields);
@@ -219,7 +293,7 @@ export class VectorLayer extends AbstractLayer {
}
async getStyleEditorFields() {
- const sourceFields = await this.getSourceForEditing().getFields();
+ const sourceFields = await (this.getSourceForEditing() as IVectorSource).getFields();
return [...sourceFields, ...this._getJoinFields()];
}
@@ -246,7 +320,7 @@ export class VectorLayer extends AbstractLayer {
onLoadError,
registerCancelCallback,
dataFilters,
- }) {
+ }: { join: IJoin } & DataRequestContext): Promise {
const joinSource = join.getRightJoinSource();
const sourceDataId = join.getSourceDataRequestId();
const requestToken = Symbol(`layer-join-refresh:${this.getId()} - ${sourceDataId}`);
@@ -266,15 +340,15 @@ export class VectorLayer extends AbstractLayer {
if (canSkipFetch) {
return {
dataHasChanged: false,
- join: join,
- propertiesMap: prevDataRequest.getData(),
+ join,
+ propertiesMap: prevDataRequest?.getData() as PropertiesMap,
};
}
try {
startLoading(sourceDataId, requestToken, searchFilters);
const leftSourceName = await this._source.getDisplayName();
- const { propertiesMap } = await joinSource.getPropertiesMap(
+ const propertiesMap = await joinSource.getPropertiesMap(
searchFilters,
leftSourceName,
join.getLeftField().getName(),
@@ -283,8 +357,8 @@ export class VectorLayer extends AbstractLayer {
stopLoading(sourceDataId, requestToken, propertiesMap);
return {
dataHasChanged: true,
- join: join,
- propertiesMap: propertiesMap,
+ join,
+ propertiesMap,
};
} catch (e) {
if (!(e instanceof DataRequestAbortError)) {
@@ -292,13 +366,12 @@ export class VectorLayer extends AbstractLayer {
}
return {
dataHasChanged: true,
- join: join,
- propertiesMap: null,
+ join,
};
}
}
- async _syncJoins(syncContext, style) {
+ async _syncJoins(syncContext: DataRequestContext, style: IVectorStyle) {
const joinSyncs = this.getValidJoins().map(async (join) => {
await this._syncJoinStyleMeta(syncContext, join, style);
await this._syncJoinFormatters(syncContext, join, style);
@@ -308,28 +381,37 @@ export class VectorLayer extends AbstractLayer {
return await Promise.all(joinSyncs);
}
- _getSearchFilters(dataFilters, source, style) {
+ _getSearchFilters(
+ dataFilters: MapFilters,
+ source: IVectorSource,
+ style: IVectorStyle
+ ): VectorSourceRequestMeta {
const fieldNames = [
...source.getFieldNames(),
...(style.getType() === LAYER_STYLE_TYPE.VECTOR ? style.getSourceFieldNames() : []),
...this.getValidJoins().map((join) => join.getLeftField().getName()),
];
+ const sourceQuery = this.getQuery() as MapQuery;
return {
...dataFilters,
fieldNames: _.uniq(fieldNames).sort(),
geogridPrecision: source.getGeoGridPrecision(dataFilters.zoom),
- sourceQuery: this.getQuery(),
+ sourceQuery: sourceQuery ? sourceQuery : undefined,
applyGlobalQuery: source.getApplyGlobalQuery(),
sourceMeta: source.getSyncMeta(),
};
}
- async _performInnerJoins(sourceResult, joinStates, updateSourceData) {
- //should update the store if
- //-- source result was refreshed
- //-- any of the join configurations changed (joinState changed)
- //-- visibility of any of the features has changed
+ async _performInnerJoins(
+ sourceResult: SourceResult,
+ joinStates: JoinState[],
+ updateSourceData: DataRequestContext['updateSourceData']
+ ) {
+ // should update the store if
+ // -- source result was refreshed
+ // -- any of the join configurations changed (joinState changed)
+ // -- visibility of any of the features has changed
let shouldUpdateStore =
sourceResult.refreshed || joinStates.some((joinState) => joinState.dataHasChanged);
@@ -338,8 +420,11 @@ export class VectorLayer extends AbstractLayer {
return;
}
- for (let i = 0; i < sourceResult.featureCollection.features.length; i++) {
- const feature = sourceResult.featureCollection.features[i];
+ for (let i = 0; i < sourceResult.featureCollection!.features.length; i++) {
+ const feature = sourceResult.featureCollection!.features[i];
+ if (!feature.properties) {
+ feature.properties = {};
+ }
const oldVisbility = feature.properties[FEATURE_VISIBLE_PROPERTY_NAME];
let isFeatureVisible = true;
for (let j = 0; j < joinStates.length; j++) {
@@ -364,7 +449,11 @@ export class VectorLayer extends AbstractLayer {
}
}
- async _syncSource(syncContext, source, style) {
+ async _syncSource(
+ syncContext: DataRequestContext,
+ source: IVectorSource,
+ style: IVectorStyle
+ ): Promise {
const {
startLoading,
stopLoading,
@@ -385,7 +474,9 @@ export class VectorLayer extends AbstractLayer {
if (canSkipFetch) {
return {
refreshed: false,
- featureCollection: prevDataRequest.getData(),
+ featureCollection: prevDataRequest
+ ? (prevDataRequest.getData() as FeatureCollection)
+ : EMPTY_FEATURE_COLLECTION,
};
}
@@ -416,15 +507,20 @@ export class VectorLayer extends AbstractLayer {
}
}
- async _syncSourceStyleMeta(syncContext, source, style) {
+ async _syncSourceStyleMeta(
+ syncContext: DataRequestContext,
+ source: IVectorSource,
+ style: IVectorStyle
+ ) {
if (this.getCurrentStyle().getType() !== LAYER_STYLE_TYPE.VECTOR) {
return;
}
+ const sourceQuery = this.getQuery() as MapQuery;
return this._syncStyleMeta({
source,
style,
- sourceQuery: this.getQuery(),
+ sourceQuery: sourceQuery ? sourceQuery : undefined,
dataRequestId: SOURCE_META_DATA_REQUEST_ID,
dynamicStyleProps: style.getDynamicPropertiesArray().filter((dynamicStyleProp) => {
return (
@@ -436,7 +532,7 @@ export class VectorLayer extends AbstractLayer {
});
}
- async _syncJoinStyleMeta(syncContext, join, style) {
+ async _syncJoinStyleMeta(syncContext: DataRequestContext, join: IJoin, style: IVectorStyle) {
const joinSource = join.getRightJoinSource();
return this._syncStyleMeta({
source: joinSource,
@@ -446,9 +542,7 @@ export class VectorLayer extends AbstractLayer {
dynamicStyleProps: this.getCurrentStyle()
.getDynamicPropertiesArray()
.filter((dynamicStyleProp) => {
- const matchingField = joinSource.getMetricFieldForName(
- dynamicStyleProp.getField().getName()
- );
+ const matchingField = joinSource.getMetricFieldForName(dynamicStyleProp.getFieldName());
return (
dynamicStyleProp.getFieldOrigin() === FIELD_ORIGIN.JOIN &&
!!matchingField &&
@@ -470,13 +564,19 @@ export class VectorLayer extends AbstractLayer {
stopLoading,
onLoadError,
registerCancelCallback,
- }) {
+ }: {
+ dataRequestId: string;
+ dynamicStyleProps: Array>;
+ source: IVectorSource;
+ sourceQuery?: MapQuery;
+ style: IVectorStyle;
+ } & DataRequestContext) {
if (!source.isESSource() || dynamicStyleProps.length === 0) {
return;
}
const dynamicStyleFields = dynamicStyleProps.map((dynamicStyleProp) => {
- return `${dynamicStyleProp.getField().getName()}${dynamicStyleProp.getNumberOfCategories()}`;
+ return `${dynamicStyleProp.getFieldName()}${dynamicStyleProp.getNumberOfCategories()}`;
});
const nextMeta = {
@@ -484,7 +584,7 @@ export class VectorLayer extends AbstractLayer {
sourceQuery,
isTimeAware: this.getCurrentStyle().isTimeAware() && (await source.isTimeAware()),
timeFilters: dataFilters.timeFilters,
- };
+ } as VectorStyleRequestMeta;
const prevDataRequest = this.getDataRequest(dataRequestId);
const canSkipFetch = canSkipStyleMetaUpdate({ prevDataRequest, nextMeta });
if (canSkipFetch) {
@@ -496,14 +596,14 @@ export class VectorLayer extends AbstractLayer {
startLoading(dataRequestId, requestToken, nextMeta);
const layerName = await this.getDisplayName(source);
- //todo: cast source to ESSource when migrating to TS
- const styleMeta = await source.loadStylePropsMeta(
+ const styleMeta = await (source as IESSource).loadStylePropsMeta({
layerName,
style,
dynamicStyleProps,
- registerCancelCallback.bind(null, requestToken),
- nextMeta
- );
+ registerCancelCallback: registerCancelCallback.bind(null, requestToken),
+ sourceQuery: nextMeta.sourceQuery,
+ timeFilters: nextMeta.timeFilters,
+ });
stopLoading(dataRequestId, requestToken, styleMeta, nextMeta);
} catch (error) {
if (!(error instanceof DataRequestAbortError)) {
@@ -512,7 +612,11 @@ export class VectorLayer extends AbstractLayer {
}
}
- async _syncSourceFormatters(syncContext, source, style) {
+ async _syncSourceFormatters(
+ syncContext: DataRequestContext,
+ source: IVectorSource,
+ style: IVectorStyle
+ ) {
if (style.getType() !== LAYER_STYLE_TYPE.VECTOR) {
return;
}
@@ -526,13 +630,13 @@ export class VectorLayer extends AbstractLayer {
return dynamicStyleProp.getFieldOrigin() === FIELD_ORIGIN.SOURCE;
})
.map((dynamicStyleProp) => {
- return dynamicStyleProp.getField();
+ return dynamicStyleProp.getField()!;
}),
...syncContext,
});
}
- async _syncJoinFormatters(syncContext, join, style) {
+ async _syncJoinFormatters(syncContext: DataRequestContext, join: IJoin, style: IVectorStyle) {
const joinSource = join.getRightJoinSource();
return this._syncFormatters({
source: joinSource,
@@ -540,19 +644,28 @@ export class VectorLayer extends AbstractLayer {
fields: style
.getDynamicPropertiesArray()
.filter((dynamicStyleProp) => {
- const matchingField = joinSource.getMetricFieldForName(
- dynamicStyleProp.getField().getName()
- );
+ const matchingField = joinSource.getMetricFieldForName(dynamicStyleProp.getFieldName());
return dynamicStyleProp.getFieldOrigin() === FIELD_ORIGIN.JOIN && !!matchingField;
})
.map((dynamicStyleProp) => {
- return dynamicStyleProp.getField();
+ return dynamicStyleProp.getField()!;
}),
...syncContext,
});
}
- async _syncFormatters({ source, dataRequestId, fields, startLoading, stopLoading, onLoadError }) {
+ async _syncFormatters({
+ source,
+ dataRequestId,
+ fields,
+ startLoading,
+ stopLoading,
+ onLoadError,
+ }: {
+ dataRequestId: string;
+ fields: IField[];
+ source: IVectorSource;
+ } & DataRequestContext) {
if (fields.length === 0) {
return;
}
@@ -573,7 +686,7 @@ export class VectorLayer extends AbstractLayer {
try {
startLoading(dataRequestId, requestToken, nextMeta);
- const formatters = {};
+ const formatters: { [key: string]: FieldFormatter | null } = {};
const promises = fields
.filter((field) => {
return field.canValueBeFormatted();
@@ -589,7 +702,7 @@ export class VectorLayer extends AbstractLayer {
}
}
- async syncData(syncContext) {
+ async syncData(syncContext: DataRequestContext) {
await this._syncData(syncContext, this.getSource(), this.getCurrentStyle());
}
@@ -603,7 +716,7 @@ export class VectorLayer extends AbstractLayer {
// Given 1 above, which source/style to use can not be stored in Layer instance state.
// Given 2 above, which source/style to use can not be pulled from data request state.
// Therefore, source and style are provided as arugments and must be used instead of calling getSource or getCurrentStyle.
- async _syncData(syncContext, source, style) {
+ async _syncData(syncContext: DataRequestContext, source: IVectorSource, style: IVectorStyle) {
if (this.isLoadingBounds()) {
return;
}
@@ -624,11 +737,11 @@ export class VectorLayer extends AbstractLayer {
_getSourceFeatureCollection() {
const sourceDataRequest = this.getSourceDataRequest();
- return sourceDataRequest ? sourceDataRequest.getData() : null;
+ return sourceDataRequest ? (sourceDataRequest.getData() as FeatureCollection) : null;
}
- _syncFeatureCollectionWithMb(mbMap) {
- const mbGeoJSONSource = mbMap.getSource(this.getId());
+ _syncFeatureCollectionWithMb(mbMap: MbMap) {
+ const mbGeoJSONSource = mbMap.getSource(this.getId()) as MbGeoJSONSource;
const featureCollection = this._getSourceFeatureCollection();
const featureCollectionOnMap = AbstractLayer.getBoundDataForSource(mbMap, this.getId());
@@ -653,7 +766,7 @@ export class VectorLayer extends AbstractLayer {
}
}
- _setMbPointsProperties(mbMap, mvtSourceLayer) {
+ _setMbPointsProperties(mbMap: MbMap, mvtSourceLayer?: string) {
const pointLayerId = this._getMbPointLayerId();
const symbolLayerId = this._getMbSymbolLayerId();
const pointLayer = mbMap.getLayer(pointLayerId);
@@ -689,12 +802,12 @@ export class VectorLayer extends AbstractLayer {
}
}
- _setMbCircleProperties(mbMap, mvtSourceLayer) {
+ _setMbCircleProperties(mbMap: MbMap, mvtSourceLayer?: string) {
const sourceId = this.getId();
const pointLayerId = this._getMbPointLayerId();
const pointLayer = mbMap.getLayer(pointLayerId);
if (!pointLayer) {
- const mbLayer = {
+ const mbLayer: MbLayer = {
id: pointLayerId,
type: 'circle',
source: sourceId,
@@ -710,7 +823,7 @@ export class VectorLayer extends AbstractLayer {
const textLayerId = this._getMbTextLayerId();
const textLayer = mbMap.getLayer(textLayerId);
if (!textLayer) {
- const mbLayer = {
+ const mbLayer: MbLayer = {
id: textLayerId,
type: 'symbol',
source: sourceId,
@@ -740,13 +853,13 @@ export class VectorLayer extends AbstractLayer {
});
}
- _setMbSymbolProperties(mbMap, mvtSourceLayer) {
+ _setMbSymbolProperties(mbMap: MbMap, mvtSourceLayer?: string) {
const sourceId = this.getId();
const symbolLayerId = this._getMbSymbolLayerId();
const symbolLayer = mbMap.getLayer(symbolLayerId);
if (!symbolLayer) {
- const mbLayer = {
+ const mbLayer: MbLayer = {
id: symbolLayerId,
type: 'symbol',
source: sourceId,
@@ -775,7 +888,7 @@ export class VectorLayer extends AbstractLayer {
});
}
- _setMbLinePolygonProperties(mbMap, mvtSourceLayer) {
+ _setMbLinePolygonProperties(mbMap: MbMap, mvtSourceLayer?: string) {
const sourceId = this.getId();
const fillLayerId = this._getMbPolygonLayerId();
const lineLayerId = this._getMbLineLayerId();
@@ -783,7 +896,7 @@ export class VectorLayer extends AbstractLayer {
const hasJoins = this.hasJoins();
if (!mbMap.getLayer(fillLayerId)) {
- const mbLayer = {
+ const mbLayer: MbLayer = {
id: fillLayerId,
type: 'fill',
source: sourceId,
@@ -795,7 +908,7 @@ export class VectorLayer extends AbstractLayer {
mbMap.addLayer(mbLayer);
}
if (!mbMap.getLayer(lineLayerId)) {
- const mbLayer = {
+ const mbLayer: MbLayer = {
id: lineLayerId,
type: 'line',
source: sourceId,
@@ -807,7 +920,7 @@ export class VectorLayer extends AbstractLayer {
mbMap.addLayer(mbLayer);
}
if (!mbMap.getLayer(tooManyFeaturesLayerId)) {
- const mbLayer = {
+ const mbLayer: MbLayer = {
id: tooManyFeaturesLayerId,
type: 'fill',
source: sourceId,
@@ -855,12 +968,12 @@ export class VectorLayer extends AbstractLayer {
mbMap.setLayerZoomRange(tooManyFeaturesLayerId, this.getMinZoom(), this.getMaxZoom());
}
- _syncStylePropertiesWithMb(mbMap) {
+ _syncStylePropertiesWithMb(mbMap: MbMap) {
this._setMbPointsProperties(mbMap);
this._setMbLinePolygonProperties(mbMap);
}
- _syncSourceBindingWithMb(mbMap) {
+ _syncSourceBindingWithMb(mbMap: MbMap) {
const mbSource = mbMap.getSource(this._getMbSourceId());
if (!mbSource) {
mbMap.addSource(this._getMbSourceId(), {
@@ -883,7 +996,7 @@ export class VectorLayer extends AbstractLayer {
}
}
- syncLayerWithMB(mbMap) {
+ syncLayerWithMB(mbMap: MbMap) {
this._syncSourceBindingWithMb(mbMap);
this._syncFeatureCollectionWithMb(mbMap);
this._syncStylePropertiesWithMb(mbMap);
@@ -924,15 +1037,15 @@ export class VectorLayer extends AbstractLayer {
];
}
- ownsMbLayerId(mbLayerId) {
+ ownsMbLayerId(mbLayerId: string) {
return this.getMbLayerIds().includes(mbLayerId);
}
- ownsMbSourceId(mbSourceId) {
+ ownsMbSourceId(mbSourceId: string) {
return this.getId() === mbSourceId;
}
- _addJoinsToSourceTooltips(tooltipsFromSource) {
+ _addJoinsToSourceTooltips(tooltipsFromSource: ITooltipProperty[]) {
for (let i = 0; i < tooltipsFromSource.length; i++) {
const tooltipProperty = tooltipsFromSource[i];
const matchingJoins = [];
@@ -947,7 +1060,7 @@ export class VectorLayer extends AbstractLayer {
}
}
- async getPropertiesForTooltip(properties) {
+ async getPropertiesForTooltip(properties: GeoJsonProperties) {
const vectorSource = this.getSource();
let allProperties = await vectorSource.getTooltipProperties(properties);
this._addJoinsToSourceTooltips(allProperties);
@@ -961,18 +1074,20 @@ export class VectorLayer extends AbstractLayer {
canShowTooltip() {
return (
- this.isVisible() && (this.getSource().canFormatFeatureProperties() || this.getJoins().length)
+ this.isVisible() &&
+ (this.getSource().canFormatFeatureProperties() || this.getJoins().length > 0)
);
}
- getFeatureById(id) {
+ getFeatureById(id: string | number) {
const featureCollection = this._getSourceFeatureCollection();
if (!featureCollection) {
return null;
}
- return featureCollection.features.find((feature) => {
- return feature.properties[FEATURE_ID_PROPERTY_NAME] === id;
+ const targetFeature = featureCollection.features.find((feature) => {
+ return feature.properties?.[FEATURE_ID_PROPERTY_NAME] === id;
});
+ return targetFeature ? targetFeature : null;
}
}
diff --git a/x-pack/plugins/maps/public/classes/sources/es_agg_source/es_agg_source.ts b/x-pack/plugins/maps/public/classes/sources/es_agg_source/es_agg_source.ts
index be947d79f4e39..5c062f3419e28 100644
--- a/x-pack/plugins/maps/public/classes/sources/es_agg_source/es_agg_source.ts
+++ b/x-pack/plugins/maps/public/classes/sources/es_agg_source/es_agg_source.ts
@@ -29,7 +29,7 @@ export interface IESAggSource extends IESSource {
getValueAggsDsl(indexPattern: IndexPattern): { [key: string]: unknown };
}
-export class AbstractESAggSource extends AbstractESSource {
+export abstract class AbstractESAggSource extends AbstractESSource {
private readonly _metricFields: IESAggField[];
private readonly _canReadFromGeoJson: boolean;
diff --git a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.d.ts b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.d.ts
index ada76b8e4e674..b221d13bb0f8a 100644
--- a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.d.ts
+++ b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.d.ts
@@ -10,6 +10,7 @@ import {
MapFilters,
MapQuery,
VectorSourceSyncMeta,
+ VectorSourceRequestMeta,
} from '../../../../common/descriptor_types';
import { GRID_RESOLUTION } from '../../../../common/constants';
import { IField } from '../../fields/field';
@@ -35,13 +36,7 @@ export class ESGeoGridSource extends AbstractESAggSource implements ITiledSingle
getLayerName(): string;
getUrlTemplateWithMeta(
- searchFilters: MapFilters & {
- applyGlobalQuery: boolean;
- fieldNames: string[];
- geogridPrecision?: number;
- sourceQuery: MapQuery;
- sourceMeta: VectorSourceSyncMeta;
- }
+ searchFilters: VectorSourceRequestMeta
): Promise<{
layerName: string;
urlTemplate: string;
diff --git a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts
index 189e7dea1b0c1..06df68283c434 100644
--- a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts
+++ b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts
@@ -160,7 +160,8 @@ describe('ESGeoGridSource', () => {
const { data, meta } = await geogridSource.getGeoJsonWithMeta(
'foobarLayer',
vectorSourceRequestMeta,
- () => {}
+ () => {},
+ () => true
);
expect(meta && meta.areResultsTrimmed).toEqual(false);
diff --git a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.d.ts b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.d.ts
index 01fde589dcb84..c11b6f0853cc7 100644
--- a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.d.ts
+++ b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.d.ts
@@ -6,12 +6,14 @@
import { AbstractVectorSource } from '../vector_source';
import { IVectorSource } from '../vector_source';
+import { TimeRange } from '../../../../../../../src/plugins/data/common';
import { IndexPattern, ISearchSource } from '../../../../../../../src/plugins/data/public';
import {
DynamicStylePropertyOptions,
+ MapQuery,
VectorSourceRequestMeta,
} from '../../../../common/descriptor_types';
-import { VectorStyle } from '../../styles/vector/vector_style';
+import { IVectorStyle } from '../../styles/vector/vector_style';
import { IDynamicStyleProperty } from '../../styles/vector/properties/dynamic_style_property';
export interface IESSource extends IVectorSource {
@@ -25,13 +27,21 @@ export interface IESSource extends IVectorSource {
limit: number,
initialSearchContext?: object
): Promise;
- loadStylePropsMeta(
- layerName: string,
- style: VectorStyle,
- dynamicStyleProps: Array>,
- registerCancelCallback: (requestToken: symbol, callback: () => void) => void,
- searchFilters: VectorSourceRequestMeta
- ): Promise;
+ loadStylePropsMeta({
+ layerName,
+ style,
+ dynamicStyleProps,
+ registerCancelCallback,
+ sourceQuery,
+ timeFilters,
+ }: {
+ layerName: string;
+ style: IVectorStyle;
+ dynamicStyleProps: Array>;
+ registerCancelCallback: (callback: () => void) => void;
+ sourceQuery?: MapQuery;
+ timeFilters: TimeRange;
+ }): Promise;
}
export class AbstractESSource extends AbstractVectorSource implements IESSource {
@@ -45,13 +55,21 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource
limit: number,
initialSearchContext?: object
): Promise;
- loadStylePropsMeta(
- layerName: string,
- style: VectorStyle,
- dynamicStyleProps: Array>,
- registerCancelCallback: (requestToken: symbol, callback: () => void) => void,
- searchFilters: VectorSourceRequestMeta
- ): Promise;
+ loadStylePropsMeta({
+ layerName,
+ style,
+ dynamicStyleProps,
+ registerCancelCallback,
+ sourceQuery,
+ timeFilters,
+ }: {
+ layerName: string;
+ style: IVectorStyle;
+ dynamicStyleProps: Array>;
+ registerCancelCallback: (callback: () => void) => void;
+ sourceQuery?: MapQuery;
+ timeFilters: TimeRange;
+ }): Promise;
_runEsQuery: ({
requestId,
requestName,
diff --git a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.js b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.js
index ab56ceeab4e77..0c8cb5f514247 100644
--- a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.js
+++ b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.js
@@ -284,13 +284,14 @@ export class AbstractESSource extends AbstractVectorSource {
return indexPattern.getFormatterForField(fieldFromIndexPattern).getConverterFor('text');
}
- async loadStylePropsMeta(
+ async loadStylePropsMeta({
layerName,
style,
dynamicStyleProps,
registerCancelCallback,
- searchFilters
- ) {
+ sourceQuery,
+ timeFilters,
+ }) {
const promises = dynamicStyleProps.map((dynamicStyleProp) => {
return dynamicStyleProp.getFieldMetaRequest();
});
@@ -307,13 +308,11 @@ export class AbstractESSource extends AbstractVectorSource {
searchSource.setField('index', indexPattern);
searchSource.setField('size', 0);
searchSource.setField('aggs', aggs);
- if (searchFilters.sourceQuery) {
- searchSource.setField('query', searchFilters.sourceQuery);
+ if (sourceQuery) {
+ searchSource.setField('query', sourceQuery);
}
if (style.isTimeAware() && (await this.isTimeAware())) {
- searchSource.setField('filter', [
- getTimeFilter().createFilter(indexPattern, searchFilters.timeFilters),
- ]);
+ searchSource.setField('filter', [getTimeFilter().createFilter(indexPattern, timeFilters)]);
}
const resp = await this._runEsQuery({
diff --git a/x-pack/plugins/maps/public/classes/sources/es_term_source/es_term_source.d.ts b/x-pack/plugins/maps/public/classes/sources/es_term_source/es_term_source.d.ts
index 248ca2b9212b4..ef1ada8da8289 100644
--- a/x-pack/plugins/maps/public/classes/sources/es_term_source/es_term_source.d.ts
+++ b/x-pack/plugins/maps/public/classes/sources/es_term_source/es_term_source.d.ts
@@ -4,10 +4,19 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import { MapQuery, VectorJoinSourceRequestMeta } from '../../../../common/descriptor_types';
import { IField } from '../../fields/field';
import { IESAggSource } from '../es_agg_source';
+import { PropertiesMap } from '../../joins/join';
export interface IESTermSource extends IESAggSource {
- getTermField(): IField;
- hasCompleteConfig(): boolean;
+ getTermField: () => IField;
+ hasCompleteConfig: () => boolean;
+ getWhereQuery: () => MapQuery;
+ getPropertiesMap: (
+ searchFilters: VectorJoinSourceRequestMeta,
+ leftSourceName: string,
+ leftFieldName: string,
+ registerCancelCallback: (callback: () => void) => void
+ ) => PropertiesMap;
}
diff --git a/x-pack/plugins/maps/public/classes/sources/es_term_source/es_term_source.js b/x-pack/plugins/maps/public/classes/sources/es_term_source/es_term_source.js
index 359d22d2c44ce..ff52dccdd2ef4 100644
--- a/x-pack/plugins/maps/public/classes/sources/es_term_source/es_term_source.js
+++ b/x-pack/plugins/maps/public/classes/sources/es_term_source/es_term_source.js
@@ -119,9 +119,7 @@ export class ESTermSource extends AbstractESAggSource {
});
const countPropertyName = this.getAggKey(AGG_TYPE.COUNT);
- return {
- propertiesMap: extractPropertiesMap(rawEsData, countPropertyName),
- };
+ return extractPropertiesMap(rawEsData, countPropertyName);
}
isFilterByMapBounds() {
diff --git a/x-pack/plugins/maps/public/classes/sources/kibana_regionmap_source/kibana_regionmap_source.js b/x-pack/plugins/maps/public/classes/sources/kibana_regionmap_source/kibana_regionmap_source.js
index eeb34ed672221..d937edb4ed362 100644
--- a/x-pack/plugins/maps/public/classes/sources/kibana_regionmap_source/kibana_regionmap_source.js
+++ b/x-pack/plugins/maps/public/classes/sources/kibana_regionmap_source/kibana_regionmap_source.js
@@ -74,6 +74,7 @@ export class KibanaRegionmapSource extends AbstractVectorSource {
});
return {
data: featureCollection,
+ meta: {},
};
}
diff --git a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx
index 3e515613b3fd0..440f0cb4457e8 100644
--- a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx
+++ b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx
@@ -179,7 +179,7 @@ export class MVTSingleLayerVectorSource
getBoundsForFilters(
boundsFilters: BoundsFilters,
- registerCancelCallback: (requestToken: symbol, callback: () => void) => void
+ registerCancelCallback: (callback: () => void) => void
): MapExtent | null {
return null;
}
@@ -192,6 +192,18 @@ export class MVTSingleLayerVectorSource
return false;
}
+ isBoundsAware() {
+ return false;
+ }
+
+ getSourceTooltipContent() {
+ return { tooltipContent: null, areResultsTrimmed: false };
+ }
+
+ async getLeftJoinFields() {
+ return [];
+ }
+
async getTooltipProperties(
properties: GeoJsonProperties,
featureId?: string | number
diff --git a/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.d.ts b/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.d.ts
index a481e273bc33e..7bf1db43c2871 100644
--- a/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.d.ts
+++ b/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.d.ts
@@ -19,6 +19,12 @@ import {
} from '../../../../common/descriptor_types';
import { VECTOR_SHAPE_TYPE } from '../../../../common/constants';
import { ITooltipProperty } from '../../tooltips/tooltip_property';
+import { DataRequest } from '../../util/data_request';
+
+export interface SourceTooltipConfig {
+ tooltipContent: string | null;
+ areResultsTrimmed: boolean;
+}
export type GeoJsonFetchMeta = ESSearchSourceResponseMeta;
@@ -30,8 +36,8 @@ export type GeoJsonWithMeta = {
export type BoundsFilters = {
applyGlobalQuery: boolean;
filters: Filter[];
- query: MapQuery;
- sourceQuery: MapQuery;
+ query?: MapQuery;
+ sourceQuery?: MapQuery;
timeFilters: TimeRange;
};
@@ -39,44 +45,52 @@ export interface IVectorSource extends ISource {
getTooltipProperties(properties: GeoJsonProperties): Promise;
getBoundsForFilters(
boundsFilters: BoundsFilters,
- registerCancelCallback: (requestToken: symbol, callback: () => void) => void
+ registerCancelCallback: (callback: () => void) => void
): MapExtent | null;
getGeoJsonWithMeta(
- layerName: 'string',
+ layerName: string,
searchFilters: MapFilters,
- registerCancelCallback: (callback: () => void) => void
+ registerCancelCallback: (callback: () => void) => void,
+ isRequestStillActive: () => boolean
): Promise;
getFields(): Promise;
getFieldByName(fieldName: string): IField | null;
+ getLeftJoinFields(): Promise;
getSyncMeta(): VectorSourceSyncMeta;
getFieldNames(): string[];
getApplyGlobalQuery(): boolean;
createField({ fieldName }: { fieldName: string }): IField;
canFormatFeatureProperties(): boolean;
getSupportedShapeTypes(): Promise;
+ isBoundsAware(): boolean;
+ getSourceTooltipContent(sourceDataRequest?: DataRequest): SourceTooltipConfig;
}
export class AbstractVectorSource extends AbstractSource implements IVectorSource {
getTooltipProperties(properties: GeoJsonProperties): Promise;
getBoundsForFilters(
boundsFilters: BoundsFilters,
- registerCancelCallback: (requestToken: symbol, callback: () => void) => void
+ registerCancelCallback: (callback: () => void) => void
): MapExtent | null;
getGeoJsonWithMeta(
layerName: string,
searchFilters: VectorSourceRequestMeta,
- registerCancelCallback: (callback: () => void) => void
+ registerCancelCallback: (callback: () => void) => void,
+ isRequestStillActive: () => boolean
): Promise;
getFields(): Promise;
getFieldByName(fieldName: string): IField | null;
+ getLeftJoinFields(): Promise;
getSyncMeta(): VectorSourceSyncMeta;
getSupportedShapeTypes(): Promise;
canFormatFeatureProperties(): boolean;
getApplyGlobalQuery(): boolean;
getFieldNames(): string[];
createField({ fieldName }: { fieldName: string }): IField;
+ isBoundsAware(): boolean;
+ getSourceTooltipContent(sourceDataRequest?: DataRequest): SourceTooltipConfig;
}
export interface ITiledSingleLayerVectorSource extends IVectorSource {
diff --git a/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx b/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx
index 1244c53afe9a6..5d0d9712ef988 100644
--- a/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx
+++ b/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx
@@ -5,7 +5,7 @@
*/
import _ from 'lodash';
-import React from 'react';
+import React, { ReactElement } from 'react';
import { Map as MbMap, FeatureIdentifier } from 'mapbox-gl';
import { FeatureCollection } from 'geojson';
// @ts-expect-error
@@ -92,6 +92,55 @@ export interface IVectorStyle extends IStyle {
mapColors: string[]
): { hasChanges: boolean; nextStyleDescriptor?: VectorStyleDescriptor };
pluckStyleMetaFromSourceDataRequest(sourceDataRequest: DataRequest): Promise;
+ isTimeAware: () => boolean;
+ getIcon: () => ReactElement;
+ hasLegendDetails: () => Promise;
+ renderLegendDetails: () => ReactElement;
+ clearFeatureState: (featureCollection: FeatureCollection, mbMap: MbMap, sourceId: string) => void;
+ setFeatureStateAndStyleProps: (
+ featureCollection: FeatureCollection,
+ mbMap: MbMap,
+ mbSourceId: string
+ ) => boolean;
+ arePointsSymbolizedAsCircles: () => boolean;
+ setMBPaintProperties: ({
+ alpha,
+ mbMap,
+ fillLayerId,
+ lineLayerId,
+ }: {
+ alpha: number;
+ mbMap: MbMap;
+ fillLayerId: string;
+ lineLayerId: string;
+ }) => void;
+ setMBPaintPropertiesForPoints: ({
+ alpha,
+ mbMap,
+ pointLayerId,
+ }: {
+ alpha: number;
+ mbMap: MbMap;
+ pointLayerId: string;
+ }) => void;
+ setMBPropertiesForLabelText: ({
+ alpha,
+ mbMap,
+ textLayerId,
+ }: {
+ alpha: number;
+ mbMap: MbMap;
+ textLayerId: string;
+ }) => void;
+ setMBSymbolPropertiesForPoints: ({
+ mbMap,
+ symbolLayerId,
+ alpha,
+ }: {
+ alpha: number;
+ mbMap: MbMap;
+ symbolLayerId: string;
+ }) => void;
}
export class VectorStyle implements IVectorStyle {
@@ -594,12 +643,12 @@ export class VectorStyle implements IVectorStyle {
mbSourceId: string
) {
if (!featureCollection) {
- return;
+ return false;
}
const dynamicStyleProps = this.getDynamicPropertiesArray();
if (dynamicStyleProps.length === 0) {
- return;
+ return false;
}
const tmpFeatureIdentifier: FeatureIdentifier = {
diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.test.tsx b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.test.tsx
index 6c6cb6ba143cd..24728465de3bd 100644
--- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.test.tsx
+++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.test.tsx
@@ -9,7 +9,6 @@ import React from 'react';
import { shallow } from 'enzyme';
import { AbstractLayer, ILayer } from '../../../../../../classes/layers/layer';
import { AbstractSource, ISource } from '../../../../../../classes/sources/source';
-import { IStyle } from '../../../../../../classes/styles/style';
import { TOCEntryActionsPopover } from './toc_entry_actions_popover';
@@ -17,28 +16,17 @@ let supportsFitToBounds: boolean;
class MockSource extends AbstractSource implements ISource {}
-class MockStyle implements IStyle {
- renderEditor() {
- return null;
- }
-
- getType() {
- return 'mockStyle';
- }
-}
-
class LayerMock extends AbstractLayer implements ILayer {
constructor() {
const sourceDescriptor = {
type: 'mySourceType',
};
const source = new MockSource(sourceDescriptor);
- const style = new MockStyle();
const layerDescriptor = {
id: 'testLayer',
sourceDescriptor,
};
- super({ layerDescriptor, source, style });
+ super({ layerDescriptor, source });
}
async supportsFitToBounds(): Promise {
From e92a4ab4bf5ec175fc572f4d14b5da173de266a7 Mon Sep 17 00:00:00 2001
From: Ashik Meerankutty
Date: Fri, 2 Oct 2020 07:34:22 +0530
Subject: [PATCH 05/56] [APM] Service Inventory Updated the `EuiBadge` to use
the `behind_text` vars instead of the base colors for the health status
badges (#77844)
* Use behind_text colors in health status
* Separated badge color usage from getSeverityColor
---
.../plugins/apm/common/service_health_status.ts | 16 ++++++++++++++++
.../ServiceOverview/ServiceList/HealthBadge.tsx | 4 ++--
.../__snapshots__/ServiceOverview.test.tsx.snap | 2 +-
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/x-pack/plugins/apm/common/service_health_status.ts b/x-pack/plugins/apm/common/service_health_status.ts
index 1d4bcfb3b0e07..f66e03a9733a3 100644
--- a/x-pack/plugins/apm/common/service_health_status.ts
+++ b/x-pack/plugins/apm/common/service_health_status.ts
@@ -54,6 +54,22 @@ export function getServiceHealthStatusColor(
}
}
+export function getServiceHealthStatusBadgeColor(
+ theme: EuiTheme,
+ status: ServiceHealthStatus
+) {
+ switch (status) {
+ case ServiceHealthStatus.healthy:
+ return theme.eui.euiColorVis0_behindText;
+ case ServiceHealthStatus.warning:
+ return theme.eui.euiColorVis5_behindText;
+ case ServiceHealthStatus.critical:
+ return theme.eui.euiColorVis9_behindText;
+ case ServiceHealthStatus.unknown:
+ return theme.eui.euiColorMediumShade;
+ }
+}
+
export function getServiceHealthStatusLabel(status: ServiceHealthStatus) {
switch (status) {
case ServiceHealthStatus.critical:
diff --git a/x-pack/plugins/apm/public/components/app/ServiceOverview/ServiceList/HealthBadge.tsx b/x-pack/plugins/apm/public/components/app/ServiceOverview/ServiceList/HealthBadge.tsx
index c6be0a352ef66..e8ad3e65b1a47 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceOverview/ServiceList/HealthBadge.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceOverview/ServiceList/HealthBadge.tsx
@@ -6,7 +6,7 @@
import React from 'react';
import { EuiBadge } from '@elastic/eui';
import {
- getServiceHealthStatusColor,
+ getServiceHealthStatusBadgeColor,
getServiceHealthStatusLabel,
ServiceHealthStatus,
} from '../../../../../common/service_health_status';
@@ -20,7 +20,7 @@ export function HealthBadge({
const theme = useTheme();
return (
-
+
{getServiceHealthStatusLabel(healthStatus)}
);
diff --git a/x-pack/plugins/apm/public/components/app/ServiceOverview/__test__/__snapshots__/ServiceOverview.test.tsx.snap b/x-pack/plugins/apm/public/components/app/ServiceOverview/__test__/__snapshots__/ServiceOverview.test.tsx.snap
index 40a2b6a5fa81b..ee3a4fce0dbaa 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceOverview/__test__/__snapshots__/ServiceOverview.test.tsx.snap
+++ b/x-pack/plugins/apm/public/components/app/ServiceOverview/__test__/__snapshots__/ServiceOverview.test.tsx.snap
@@ -153,7 +153,7 @@ NodeList [
>
Date: Fri, 2 Oct 2020 09:03:08 +0300
Subject: [PATCH 06/56] [Functional] Add retry on custom formatter test
(#78729)
Co-authored-by: Elastic Machine
---
test/functional/apps/visualize/_tsvb_time_series.ts | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/functional/apps/visualize/_tsvb_time_series.ts b/test/functional/apps/visualize/_tsvb_time_series.ts
index 0b2a52b367a20..d4a079a38c814 100644
--- a/test/functional/apps/visualize/_tsvb_time_series.ts
+++ b/test/functional/apps/visualize/_tsvb_time_series.ts
@@ -84,8 +84,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visualBuilder.clickSeriesOption();
await visualBuilder.enterSeriesTemplate('$ {{value}}');
- const actualCount = await visualBuilder.getRhythmChartLegendValue();
- expect(actualCount).to.be(expectedLegendValue);
+ await retry.try(async () => {
+ const actualCount = await visualBuilder.getRhythmChartLegendValue();
+ expect(actualCount).to.be(expectedLegendValue);
+ });
});
it('should show the correct count in the legend with percent formatter', async () => {
From 4ddcd1d2a6bf3ffbec37844468c4e4af827f739f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B8ren=20Louv-Jansen?=
Date: Fri, 2 Oct 2020 09:45:50 +0200
Subject: [PATCH 07/56] [APM] Fix anomalies not showing up on transaction
charts (#76930)
* [APM] Fix anomalies not showing up on transaction charts
* Added API tests to check transaction groups charts for anomaly data
* Improve test names and assertions from PR feedback
* Updated the transaction groups chart API to make `environment` a
required param while making `uiFilters` optional
* updates the basic API tests for transaction_groups/charts with the
required `environment` param
* makes uiFIltersES default to [] on core setup and removes SetupUIFilters type
* fixes vertical shade
* - replaces uiFiltersES with esFilter & uiFilters and cleans up related code around these
- deduplicates the required environment in the transaction_groups/charts API
* updates basic apm_api_integration tests
* pr feedback
* updates api test snapshots with correct anomaly data
* removed environment query param from useTransactionCharts and ensures
it's included in uiFilters returned from useUrlParams
Co-authored-by: Oliver Gupte
---
.../example_response_opbeans_beats.json | 42 ++---
.../public/context/UrlParamsContext/index.tsx | 7 +-
.../plugins/apm/public/utils/testHelpers.tsx | 7 +-
.../errors/__snapshots__/queries.test.ts.snap | 6 +-
.../__snapshots__/queries.test.ts.snap | 4 +-
.../__tests__/get_buckets.test.ts | 5 +-
.../lib/errors/distribution/get_buckets.ts | 12 +-
.../errors/distribution/get_distribution.ts | 8 +-
.../apm/server/lib/errors/get_error_group.ts | 12 +-
.../apm/server/lib/errors/get_error_groups.ts | 8 +-
...{get_ui_filters_es.ts => get_es_filter.ts} | 2 +-
.../get_parsed_ui_filters.ts | 23 ---
.../apm/server/lib/helpers/setup_request.ts | 41 ++---
.../__snapshots__/queries.test.ts.snap | 54 +++---
.../server/lib/metrics/by_agent/default.ts | 8 +-
.../java/gc/fetch_and_transform_gc_metrics.ts | 8 +-
.../by_agent/java/gc/get_gc_rate_chart.ts | 8 +-
.../by_agent/java/gc/get_gc_time_chart.ts | 8 +-
.../by_agent/java/heap_memory/index.ts | 8 +-
.../server/lib/metrics/by_agent/java/index.ts | 8 +-
.../by_agent/java/non_heap_memory/index.ts | 8 +-
.../by_agent/java/thread_count/index.ts | 8 +-
.../lib/metrics/by_agent/shared/cpu/index.ts | 8 +-
.../metrics/by_agent/shared/memory/index.ts | 10 +-
.../metrics/fetch_and_transform_metrics.ts | 8 +-
.../get_metrics_chart_data_by_agent.ts | 8 +-
.../__snapshots__/queries.test.ts.snap | 14 +-
.../lib/rum_client/get_client_metrics.ts | 8 +-
.../server/lib/rum_client/get_js_errors.ts | 8 +-
.../lib/rum_client/get_long_task_metrics.ts | 8 +-
.../rum_client/get_page_load_distribution.ts | 10 +-
.../lib/rum_client/get_page_view_trends.ts | 8 +-
.../lib/rum_client/get_pl_dist_breakdown.ts | 8 +-
.../server/lib/rum_client/get_rum_services.ts | 8 +-
.../server/lib/rum_client/get_url_search.ts | 8 +-
.../lib/rum_client/get_visitor_breakdown.ts | 8 +-
.../lib/rum_client/get_web_core_vitals.ts | 8 +-
.../server/lib/service_map/get_service_map.ts | 2 +-
.../get_service_map_service_node_info.test.ts | 6 +-
.../get_service_map_service_node_info.ts | 9 +-
.../group_resource_nodes_grouped.json | 4 +-
.../group_resource_nodes_pregrouped.json | 4 +-
.../__snapshots__/queries.test.ts.snap | 6 +-
.../apm/server/lib/service_nodes/index.ts | 8 +-
.../__snapshots__/queries.test.ts.snap | 10 +-
.../lib/services/get_service_node_metadata.ts | 8 +-
.../get_services/get_services_items.ts | 12 +-
.../server/lib/services/get_services/index.ts | 11 +-
.../__snapshots__/queries.test.ts.snap | 14 +-
.../server/lib/transaction_groups/fetcher.ts | 8 +-
.../lib/transaction_groups/get_error_rate.ts | 12 +-
.../get_transaction_sample_for_group.ts | 12 +-
.../server/lib/transaction_groups/index.ts | 8 +-
.../__snapshots__/queries.test.ts.snap | 12 +-
.../lib/transactions/breakdown/index.test.ts | 3 +-
.../lib/transactions/breakdown/index.ts | 12 +-
.../charts/get_anomaly_data/fetcher.ts | 11 +-
.../charts/get_anomaly_data/index.ts | 40 ++---
.../get_timeseries_data/fetcher.test.ts | 5 +-
.../charts/get_timeseries_data/fetcher.ts | 12 +-
.../charts/get_timeseries_data/index.ts | 8 +-
.../server/lib/transactions/charts/index.ts | 10 +-
.../distribution/get_buckets/index.ts | 12 +-
.../distribution/get_distribution_max.ts | 12 +-
.../lib/transactions/distribution/index.ts | 8 +-
.../lib/transactions/get_transaction/index.ts | 8 +-
.../server/lib/transactions/queries.test.ts | 3 -
.../__snapshots__/queries.test.ts.snap | 2 +-
.../get_local_filter_query.ts | 4 +-
.../local_ui_filters/queries.test.ts | 2 +-
.../plugins/apm/server/projections/errors.ts | 12 +-
.../plugins/apm/server/projections/metrics.ts | 12 +-
.../projections/rum_page_load_transactions.ts | 18 +-
.../apm/server/projections/service_nodes.ts | 8 +-
.../apm/server/projections/services.ts | 12 +-
.../server/projections/transaction_groups.ts | 8 +-
.../apm/server/projections/transactions.ts | 12 +-
.../plugins/apm/server/routes/service_map.ts | 5 -
x-pack/plugins/apm/server/routes/services.ts | 12 +-
.../apm/server/routes/transaction_groups.ts | 21 +--
.../plugins/apm/server/routes/ui_filters.ts | 13 +-
.../plugins/apm/server/utils/test_helpers.tsx | 7 +-
.../basic/tests/feature_controls.ts | 6 +-
.../transaction_groups/transaction_charts.ts | 2 +-
.../apm_api_integration/trial/tests/index.ts | 1 +
.../transaction_groups_charts.snap | 43 +++++
.../services/transaction_groups_charts.ts | 161 ++++++++++++++++++
87 files changed, 528 insertions(+), 548 deletions(-)
rename x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/{get_ui_filters_es.ts => get_es_filter.ts} (96%)
delete mode 100644 x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_parsed_ui_filters.ts
create mode 100644 x-pack/test/apm_api_integration/trial/tests/services/__snapshots__/transaction_groups_charts.snap
create mode 100644 x-pack/test/apm_api_integration/trial/tests/services/transaction_groups_charts.ts
diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/__stories__/example_response_opbeans_beats.json b/x-pack/plugins/apm/public/components/app/ServiceMap/__stories__/example_response_opbeans_beats.json
index 153fa57bb05e7..cfd905f145fe2 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceMap/__stories__/example_response_opbeans_beats.json
+++ b/x-pack/plugins/apm/public/components/app/ServiceMap/__stories__/example_response_opbeans_beats.json
@@ -83,7 +83,7 @@
"id": "opbeans-go~>postgresql",
"sourceData": {
"id": "opbeans-go",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-go",
"agent.name": "go"
},
@@ -103,7 +103,7 @@
"id": "opbeans-go~opbeans-java",
"sourceData": {
"id": "opbeans-go",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-go",
"agent.name": "go"
},
@@ -123,13 +123,13 @@
"id": "opbeans-go~opbeans-node",
"sourceData": {
"id": "opbeans-go",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-go",
"agent.name": "go"
},
"targetData": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
},
@@ -143,7 +143,7 @@
"id": "opbeans-go~opbeans-ruby",
"sourceData": {
"id": "opbeans-go",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-go",
"agent.name": "go"
},
@@ -189,7 +189,7 @@
},
"targetData": {
"id": "opbeans-go",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-go",
"agent.name": "go"
},
@@ -209,7 +209,7 @@
},
"targetData": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
}
@@ -242,7 +242,7 @@
"id": "opbeans-node~>postgresql",
"sourceData": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
},
@@ -262,7 +262,7 @@
"id": "opbeans-node~>redis",
"sourceData": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
},
@@ -282,13 +282,13 @@
"id": "opbeans-node~opbeans-go",
"sourceData": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
},
"targetData": {
"id": "opbeans-go",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-go",
"agent.name": "go"
},
@@ -302,7 +302,7 @@
"id": "opbeans-node~opbeans-python",
"sourceData": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
},
@@ -322,7 +322,7 @@
"id": "opbeans-node~opbeans-ruby",
"sourceData": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
},
@@ -408,7 +408,7 @@
},
"targetData": {
"id": "opbeans-go",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-go",
"agent.name": "go"
}
@@ -427,7 +427,7 @@
},
"targetData": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
},
@@ -487,7 +487,7 @@
},
"targetData": {
"id": "opbeans-go",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-go",
"agent.name": "go"
},
@@ -527,7 +527,7 @@
},
"targetData": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
},
@@ -566,7 +566,7 @@
},
"targetData": {
"id": "opbeans-go",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-go",
"agent.name": "go"
}
@@ -602,7 +602,7 @@
},
"targetData": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
}
@@ -673,7 +673,7 @@
{
"data": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs",
"anomaly_score": 41.31593099784474,
@@ -733,7 +733,7 @@
{
"data": {
"id": "opbeans-go",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-go",
"agent.name": "go",
"anomaly_score": 0.2633884161762746,
diff --git a/x-pack/plugins/apm/public/context/UrlParamsContext/index.tsx b/x-pack/plugins/apm/public/context/UrlParamsContext/index.tsx
index 9eb4704a2ca29..5682009019d7f 100644
--- a/x-pack/plugins/apm/public/context/UrlParamsContext/index.tsx
+++ b/x-pack/plugins/apm/public/context/UrlParamsContext/index.tsx
@@ -25,6 +25,7 @@ import {
import { pickKeys } from '../../../common/utils/pick_keys';
import { useDeepObjectIdentity } from '../../hooks/useDeepObjectIdentity';
import { LocalUIFilterName } from '../../../common/ui_filter';
+import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values';
interface TimeRange {
rangeFrom: string;
@@ -38,7 +39,11 @@ function useUiFilters(params: IUrlParams): UIFilters {
(val) => (val ? val.split(',') : [])
) as Partial>;
- return useDeepObjectIdentity({ kuery, environment, ...localUiFilters });
+ return useDeepObjectIdentity({
+ kuery,
+ environment: environment || ENVIRONMENT_ALL.value,
+ ...localUiFilters,
+ });
}
const defaultRefresh = (_time: TimeRange) => {};
diff --git a/x-pack/plugins/apm/public/utils/testHelpers.tsx b/x-pack/plugins/apm/public/utils/testHelpers.tsx
index 971455fde3946..7826e9672a3bb 100644
--- a/x-pack/plugins/apm/public/utils/testHelpers.tsx
+++ b/x-pack/plugins/apm/public/utils/testHelpers.tsx
@@ -25,6 +25,7 @@ import {
} from '../../typings/elasticsearch';
import { MockApmPluginContextWrapper } from '../context/ApmPluginContext/MockApmPluginContext';
import { UrlParamsProvider } from '../context/UrlParamsContext';
+import { UIFilters } from '../../typings/ui_filters';
const originalConsoleWarn = console.warn; // eslint-disable-line no-console
/**
@@ -118,7 +119,8 @@ interface MockSetup {
apmEventClient: any;
internalClient: any;
config: APMConfig;
- uiFiltersES: ESFilter[];
+ uiFilters: UIFilters;
+ esFilter: ESFilter[];
indices: {
/* eslint-disable @typescript-eslint/naming-convention */
'apm_oss.sourcemapIndices': string;
@@ -179,7 +181,8 @@ export async function inspectSearchParams(
},
}
) as APMConfig,
- uiFiltersES: [{ term: { 'my.custom.ui.filter': 'foo-bar' } }],
+ uiFilters: { environment: 'test' },
+ esFilter: [{ term: { 'service.environment': 'test' } }],
indices: {
/* eslint-disable @typescript-eslint/naming-convention */
'apm_oss.sourcemapIndices': 'myIndex',
diff --git a/x-pack/plugins/apm/server/lib/errors/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/errors/__snapshots__/queries.test.ts.snap
index 63b6c9cde4d0d..632232ffb075d 100644
--- a/x-pack/plugins/apm/server/lib/errors/__snapshots__/queries.test.ts.snap
+++ b/x-pack/plugins/apm/server/lib/errors/__snapshots__/queries.test.ts.snap
@@ -32,7 +32,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -119,7 +119,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -194,7 +194,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/errors/distribution/__snapshots__/queries.test.ts.snap
index ea142ca2acc00..b329499c8b045 100644
--- a/x-pack/plugins/apm/server/lib/errors/distribution/__snapshots__/queries.test.ts.snap
+++ b/x-pack/plugins/apm/server/lib/errors/distribution/__snapshots__/queries.test.ts.snap
@@ -40,7 +40,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -91,7 +91,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/__tests__/get_buckets.test.ts b/x-pack/plugins/apm/server/lib/errors/distribution/__tests__/get_buckets.test.ts
index 1a83113de35f2..50da1f9c20d16 100644
--- a/x-pack/plugins/apm/server/lib/errors/distribution/__tests__/get_buckets.test.ts
+++ b/x-pack/plugins/apm/server/lib/errors/distribution/__tests__/get_buckets.test.ts
@@ -41,7 +41,10 @@ describe('timeseriesFetcher', () => {
get: () => 'myIndex',
}
) as APMConfig,
- uiFiltersES: [
+ uiFilters: {
+ environment: 'prod',
+ },
+ esFilter: [
{
term: { 'service.environment': 'prod' },
},
diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts
index de6df15354e79..a42710947a792 100644
--- a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts
+++ b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.ts
@@ -11,11 +11,7 @@ import {
SERVICE_NAME,
} from '../../../../common/elasticsearch_fieldnames';
import { rangeFilter } from '../../../../common/utils/range_filter';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../helpers/setup_request';
export async function getBuckets({
serviceName,
@@ -26,13 +22,13 @@ export async function getBuckets({
serviceName: string;
groupId?: string;
bucketSize: number;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
}) {
- const { start, end, uiFiltersES, apmEventClient } = setup;
+ const { start, end, esFilter, apmEventClient } = setup;
const filter: ESFilter[] = [
{ term: { [SERVICE_NAME]: serviceName } },
{ range: rangeFilter(start, end) },
- ...uiFiltersES,
+ ...esFilter,
];
if (groupId) {
diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts
index 3b48b6c5be594..dea518cad8e40 100644
--- a/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts
+++ b/x-pack/plugins/apm/server/lib/errors/distribution/get_distribution.ts
@@ -5,11 +5,7 @@
*/
import { PromiseReturnType } from '../../../../typings/common';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../helpers/setup_request';
import { getBuckets } from './get_buckets';
import { BUCKET_TARGET_COUNT } from '../../transactions/constants';
@@ -28,7 +24,7 @@ export async function getErrorDistribution({
}: {
serviceName: string;
groupId?: string;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
}) {
const bucketSize = getBucketSize({ start: setup.start, end: setup.end });
const { buckets, noHits } = await getBuckets({
diff --git a/x-pack/plugins/apm/server/lib/errors/get_error_group.ts b/x-pack/plugins/apm/server/lib/errors/get_error_group.ts
index b23c955b57183..0fbc7720f7111 100644
--- a/x-pack/plugins/apm/server/lib/errors/get_error_group.ts
+++ b/x-pack/plugins/apm/server/lib/errors/get_error_group.ts
@@ -12,11 +12,7 @@ import {
} from '../../../common/elasticsearch_fieldnames';
import { PromiseReturnType } from '../../../typings/common';
import { rangeFilter } from '../../../common/utils/range_filter';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { getTransaction } from '../transactions/get_transaction';
export type ErrorGroupAPIResponse = PromiseReturnType;
@@ -29,9 +25,9 @@ export async function getErrorGroup({
}: {
serviceName: string;
groupId: string;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
}) {
- const { start, end, uiFiltersES, apmEventClient } = setup;
+ const { start, end, esFilter, apmEventClient } = setup;
const params = {
apm: {
@@ -45,7 +41,7 @@ export async function getErrorGroup({
{ term: { [SERVICE_NAME]: serviceName } },
{ term: { [ERROR_GROUP_ID]: groupId } },
{ range: rangeFilter(start, end) },
- ...uiFiltersES,
+ ...esFilter,
],
should: [{ term: { [TRANSACTION_SAMPLED]: true } }],
},
diff --git a/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts b/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts
index ab1c2149be343..006d2fae3d4fb 100644
--- a/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts
+++ b/x-pack/plugins/apm/server/lib/errors/get_error_groups.ts
@@ -13,11 +13,7 @@ import {
ERROR_LOG_MESSAGE,
} from '../../../common/elasticsearch_fieldnames';
import { PromiseReturnType } from '../../../typings/common';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { getErrorGroupsProjection } from '../../projections/errors';
import { mergeProjection } from '../../projections/util/merge_projection';
import { SortOptions } from '../../../typings/elasticsearch/aggregations';
@@ -35,7 +31,7 @@ export async function getErrorGroups({
serviceName: string;
sortField?: string;
sortDirection?: 'asc' | 'desc';
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
}) {
const { apmEventClient } = setup;
diff --git a/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_ui_filters_es.ts b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_es_filter.ts
similarity index 96%
rename from x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_ui_filters_es.ts
rename to x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_es_filter.ts
index c1405b44f2a8a..1b8f32d4de8b9 100644
--- a/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_ui_filters_es.ts
+++ b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_es_filter.ts
@@ -13,7 +13,7 @@ import {
} from '../../ui_filters/local_ui_filters/config';
import { esKuery } from '../../../../../../../src/plugins/data/server';
-export function getUiFiltersES(uiFilters: UIFilters) {
+export function getEsFilter(uiFilters: UIFilters) {
const { kuery, environment, ...localFilterValues } = uiFilters;
const mappedFilters = localUIFilterNames
.filter((name) => name in localFilterValues)
diff --git a/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_parsed_ui_filters.ts b/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_parsed_ui_filters.ts
deleted file mode 100644
index 324da199807c7..0000000000000
--- a/x-pack/plugins/apm/server/lib/helpers/convert_ui_filters/get_parsed_ui_filters.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { Logger } from 'src/core/server';
-import { UIFilters } from '../../../../typings/ui_filters';
-
-export function getParsedUiFilters({
- uiFilters,
- logger,
-}: {
- uiFilters: string;
- logger: Logger;
-}): UIFilters {
- try {
- return JSON.parse(uiFilters);
- } catch (error) {
- logger.error(error);
- }
- return {};
-}
diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts
index eba75433a5148..26896a050dd88 100644
--- a/x-pack/plugins/apm/server/lib/helpers/setup_request.ts
+++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts
@@ -5,6 +5,7 @@
*/
import moment from 'moment';
+import { Logger } from 'kibana/server';
import { isActivePlatinumLicense } from '../../../common/service_map';
import { UI_SETTINGS } from '../../../../../../src/plugins/data/common';
import { KibanaRequest } from '../../../../../../src/core/server';
@@ -14,7 +15,7 @@ import {
ApmIndicesConfig,
} from '../settings/apm_indices/get_apm_indices';
import { ESFilter } from '../../../typings/elasticsearch';
-import { getUiFiltersES } from './convert_ui_filters/get_ui_filters_es';
+import { getEsFilter } from './convert_ui_filters/get_es_filter';
import { APMRequestHandlerContext } from '../../routes/typings';
import { ProcessorEvent } from '../../../common/processor_event';
import {
@@ -25,14 +26,8 @@ import {
APMInternalClient,
createInternalESClient,
} from './create_es_client/create_internal_es_client';
+import { UIFilters } from '../../../typings/ui_filters';
-function decodeUiFilters(uiFiltersEncoded?: string) {
- if (!uiFiltersEncoded) {
- return [];
- }
- const uiFilters = JSON.parse(uiFiltersEncoded);
- return getUiFiltersES(uiFilters);
-}
// Explicitly type Setup to prevent TS initialization errors
// https://github.com/microsoft/TypeScript/issues/34933
@@ -42,6 +37,8 @@ export interface Setup {
ml?: ReturnType;
config: APMConfig;
indices: ApmIndicesConfig;
+ uiFilters: UIFilters;
+ esFilter: ESFilter[];
}
export interface SetupTimeRange {
@@ -49,10 +46,6 @@ export interface SetupTimeRange {
end: number;
}
-export interface SetupUIFilters {
- uiFiltersES: ESFilter[];
-}
-
interface SetupRequestParams {
query?: {
_debug?: boolean;
@@ -65,16 +58,13 @@ interface SetupRequestParams {
type InferSetup = Setup &
(TParams extends { query: { start: string } } ? { start: number } : {}) &
- (TParams extends { query: { end: string } } ? { end: number } : {}) &
- (TParams extends { query: { uiFilters: string } }
- ? { uiFiltersES: ESFilter[] }
- : {});
+ (TParams extends { query: { end: string } } ? { end: number } : {});
export async function setupRequest(
context: APMRequestHandlerContext,
request: KibanaRequest
): Promise> {
- const { config } = context;
+ const { config, logger } = context;
const { query } = context.params;
const [indices, includeFrozen] = await Promise.all([
@@ -85,7 +75,7 @@ export async function setupRequest(
context.core.uiSettings.client.get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN),
]);
- const uiFiltersES = decodeUiFilters(query.uiFilters);
+ const uiFilters = decodeUiFilters(logger, query.uiFilters);
const coreSetupRequest = {
indices,
@@ -108,12 +98,13 @@ export async function setupRequest(
)
: undefined,
config,
+ uiFilters,
+ esFilter: getEsFilter(uiFilters),
};
return {
...('start' in query ? { start: moment.utc(query.start).valueOf() } : {}),
...('end' in query ? { end: moment.utc(query.end).valueOf() } : {}),
- ...('uiFilters' in query ? { uiFiltersES } : {}),
...coreSetupRequest,
} as InferSetup;
}
@@ -129,3 +120,15 @@ function getMlSetup(
modules: ml.modulesProvider(request, savedObjectsClient),
};
}
+
+function decodeUiFilters(logger: Logger, uiFiltersEncoded?: string): UIFilters {
+ if (!uiFiltersEncoded) {
+ return {};
+ }
+ try {
+ return JSON.parse(uiFiltersEncoded);
+ } catch (error) {
+ logger.error(error);
+ return {};
+ }
+}
diff --git a/x-pack/plugins/apm/server/lib/metrics/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/metrics/__snapshots__/queries.test.ts.snap
index 2868dcfda97b6..961a1eee61d1d 100644
--- a/x-pack/plugins/apm/server/lib/metrics/__snapshots__/queries.test.ts.snap
+++ b/x-pack/plugins/apm/server/lib/metrics/__snapshots__/queries.test.ts.snap
@@ -87,7 +87,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -175,7 +175,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -206,7 +206,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -231,7 +231,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -258,7 +258,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -283,7 +283,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -338,7 +338,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -431,7 +431,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -514,7 +514,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -623,7 +623,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -717,7 +717,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -748,7 +748,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -773,7 +773,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -800,7 +800,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -825,7 +825,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -886,7 +886,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -985,7 +985,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -1074,7 +1074,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -1172,7 +1172,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -1255,7 +1255,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -1286,7 +1286,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -1311,7 +1311,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -1338,7 +1338,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -1363,7 +1363,7 @@ Object {
"lang": "painless",
"source": "
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -1413,7 +1413,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -1501,7 +1501,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -1579,7 +1579,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/default.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/default.ts
index 6ee507d7b9bb1..fbcbc9f12791f 100644
--- a/x-pack/plugins/apm/server/lib/metrics/by_agent/default.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/default.ts
@@ -4,16 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../helpers/setup_request';
import { getCPUChartData } from './shared/cpu';
import { getMemoryChartData } from './shared/memory';
export async function getDefaultMetricsCharts(
- setup: Setup & SetupTimeRange & SetupUIFilters,
+ setup: Setup & SetupTimeRange,
serviceName: string
) {
const charts = await Promise.all([
diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts
index d7e64bdcacd12..2ed11480a7585 100644
--- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts
@@ -11,11 +11,7 @@
import { sum, round } from 'lodash';
import theme from '@elastic/eui/dist/eui_theme_light.json';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../../helpers/setup_request';
import { getMetricsDateHistogramParams } from '../../../../helpers/metrics';
import { ChartBase } from '../../../types';
import { getMetricsProjection } from '../../../../../projections/metrics';
@@ -36,7 +32,7 @@ export async function fetchAndTransformGcMetrics({
chartBase,
fieldName,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
serviceName: string;
serviceNodeName?: string;
chartBase: ChartBase;
diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_rate_chart.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_rate_chart.ts
index 6e562b9a8ee87..7cedeb828e3b7 100644
--- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_rate_chart.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_rate_chart.ts
@@ -7,11 +7,7 @@
import theme from '@elastic/eui/dist/eui_theme_light.json';
import { i18n } from '@kbn/i18n';
import { METRIC_JAVA_GC_COUNT } from '../../../../../../common/elasticsearch_fieldnames';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../../helpers/setup_request';
import { fetchAndTransformGcMetrics } from './fetch_and_transform_gc_metrics';
import { ChartBase } from '../../../types';
@@ -35,7 +31,7 @@ const chartBase: ChartBase = {
};
const getGcRateChart = (
- setup: Setup & SetupTimeRange & SetupUIFilters,
+ setup: Setup & SetupTimeRange,
serviceName: string,
serviceNodeName?: string
) => {
diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_time_chart.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_time_chart.ts
index 0b9d6240fc1c9..f21d3d8e7c056 100644
--- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_time_chart.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/get_gc_time_chart.ts
@@ -7,11 +7,7 @@
import theme from '@elastic/eui/dist/eui_theme_light.json';
import { i18n } from '@kbn/i18n';
import { METRIC_JAVA_GC_TIME } from '../../../../../../common/elasticsearch_fieldnames';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../../helpers/setup_request';
import { fetchAndTransformGcMetrics } from './fetch_and_transform_gc_metrics';
import { ChartBase } from '../../../types';
@@ -35,7 +31,7 @@ const chartBase: ChartBase = {
};
const getGcTimeChart = (
- setup: Setup & SetupTimeRange & SetupUIFilters,
+ setup: Setup & SetupTimeRange,
serviceName: string,
serviceNodeName?: string
) => {
diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts
index ba3183c0fa7d7..eb79897f9f055 100644
--- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/heap_memory/index.ts
@@ -12,11 +12,7 @@ import {
METRIC_JAVA_HEAP_MEMORY_USED,
AGENT_NAME,
} from '../../../../../../common/elasticsearch_fieldnames';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../../helpers/setup_request';
import { fetchAndTransformMetrics } from '../../../fetch_and_transform_metrics';
import { ChartBase } from '../../../types';
@@ -55,7 +51,7 @@ const chartBase: ChartBase = {
};
export async function getHeapMemoryChart(
- setup: Setup & SetupTimeRange & SetupUIFilters,
+ setup: Setup & SetupTimeRange,
serviceName: string,
serviceNodeName?: string
) {
diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/index.ts
index 21caab6590fc4..d4084701f0f49 100644
--- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/index.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/index.ts
@@ -5,11 +5,7 @@
*/
import { getHeapMemoryChart } from './heap_memory';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../helpers/setup_request';
import { getNonHeapMemoryChart } from './non_heap_memory';
import { getThreadCountChart } from './thread_count';
import { getCPUChartData } from '../shared/cpu';
@@ -18,7 +14,7 @@ import { getGcRateChart } from './gc/get_gc_rate_chart';
import { getGcTimeChart } from './gc/get_gc_time_chart';
export async function getJavaMetricsCharts(
- setup: Setup & SetupTimeRange & SetupUIFilters,
+ setup: Setup & SetupTimeRange,
serviceName: string,
serviceNodeName?: string
) {
diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts
index 1a2d5bd0b0e68..50cc449da3c15 100644
--- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/non_heap_memory/index.ts
@@ -12,11 +12,7 @@ import {
METRIC_JAVA_NON_HEAP_MEMORY_USED,
AGENT_NAME,
} from '../../../../../../common/elasticsearch_fieldnames';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../../helpers/setup_request';
import { ChartBase } from '../../../types';
import { fetchAndTransformMetrics } from '../../../fetch_and_transform_metrics';
@@ -52,7 +48,7 @@ const chartBase: ChartBase = {
};
export async function getNonHeapMemoryChart(
- setup: Setup & SetupUIFilters & SetupTimeRange,
+ setup: Setup & SetupTimeRange,
serviceName: string,
serviceNodeName?: string
) {
diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts
index 01cc6d8495244..0062f0a423970 100644
--- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/thread_count/index.ts
@@ -10,11 +10,7 @@ import {
METRIC_JAVA_THREAD_COUNT,
AGENT_NAME,
} from '../../../../../../common/elasticsearch_fieldnames';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../../helpers/setup_request';
import { ChartBase } from '../../../types';
import { fetchAndTransformMetrics } from '../../../fetch_and_transform_metrics';
@@ -44,7 +40,7 @@ const chartBase: ChartBase = {
};
export async function getThreadCountChart(
- setup: Setup & SetupTimeRange & SetupUIFilters,
+ setup: Setup & SetupTimeRange,
serviceName: string,
serviceNodeName?: string
) {
diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts
index 066ef40b4ab6c..ca642aa12fff1 100644
--- a/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/cpu/index.ts
@@ -10,11 +10,7 @@ import {
METRIC_SYSTEM_CPU_PERCENT,
METRIC_PROCESS_CPU_PERCENT,
} from '../../../../../../common/elasticsearch_fieldnames';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../../helpers/setup_request';
import { ChartBase } from '../../../types';
import { fetchAndTransformMetrics } from '../../../fetch_and_transform_metrics';
@@ -56,7 +52,7 @@ const chartBase: ChartBase = {
};
export async function getCPUChartData(
- setup: Setup & SetupTimeRange & SetupUIFilters,
+ setup: Setup & SetupTimeRange,
serviceName: string,
serviceNodeName?: string
) {
diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts
index a60576ca0c175..e6ee47cc815ef 100644
--- a/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/shared/memory/index.ts
@@ -11,11 +11,7 @@ import {
METRIC_SYSTEM_FREE_MEMORY,
METRIC_SYSTEM_TOTAL_MEMORY,
} from '../../../../../../common/elasticsearch_fieldnames';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../../helpers/setup_request';
import { fetchAndTransformMetrics } from '../../../fetch_and_transform_metrics';
import { ChartBase } from '../../../types';
@@ -54,7 +50,7 @@ export const percentCgroupMemoryUsedScript = {
lang: 'painless',
source: `
/*
- When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
+ When no limit is specified in the container, docker allows the app as much memory / swap memory as it wants.
This number represents the max possible value for the limit field.
*/
double CGROUP_LIMIT_MAX_VALUE = 9223372036854771712L;
@@ -73,7 +69,7 @@ export const percentCgroupMemoryUsedScript = {
};
export async function getMemoryChartData(
- setup: Setup & SetupTimeRange & SetupUIFilters,
+ setup: Setup & SetupTimeRange,
serviceName: string,
serviceNodeName?: string
) {
diff --git a/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts b/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts
index a42a10d6518a0..3ccba8c7586dc 100644
--- a/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts
@@ -5,11 +5,7 @@
*/
import { Unionize, Overwrite } from 'utility-types';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { getMetricsDateHistogramParams } from '../helpers/metrics';
import { ChartBase } from './types';
import { transformDataToMetricsChart } from './transform_metrics_chart';
@@ -58,7 +54,7 @@ export async function fetchAndTransformMetrics({
aggs,
additionalFilters = [],
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
serviceName: string;
serviceNodeName?: string;
chartBase: ChartBase;
diff --git a/x-pack/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts b/x-pack/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts
index 059e1ce48c83d..72cd65deebff6 100644
--- a/x-pack/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts
+++ b/x-pack/plugins/apm/server/lib/metrics/get_metrics_chart_data_by_agent.ts
@@ -3,11 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { getJavaMetricsCharts } from './by_agent/java';
import { getDefaultMetricsCharts } from './by_agent/default';
import { GenericMetricsChart } from './transform_metrics_chart';
@@ -22,7 +18,7 @@ export async function getMetricsChartDataByAgent({
serviceNodeName,
agentName,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
serviceName: string;
serviceNodeName?: string;
agentName: string;
diff --git a/x-pack/plugins/apm/server/lib/rum_client/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/rum_client/__snapshots__/queries.test.ts.snap
index dcafe09221164..1fafa08082443 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/__snapshots__/queries.test.ts.snap
+++ b/x-pack/plugins/apm/server/lib/rum_client/__snapshots__/queries.test.ts.snap
@@ -61,7 +61,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -151,7 +151,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -230,7 +230,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -500,7 +500,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -552,7 +552,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -667,7 +667,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -723,7 +723,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_client_metrics.ts b/x-pack/plugins/apm/server/lib/rum_client/get_client_metrics.ts
index 6566ea4f5e29b..6d596246d6af9 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/get_client_metrics.ts
+++ b/x-pack/plugins/apm/server/lib/rum_client/get_client_metrics.ts
@@ -7,11 +7,7 @@
import { TRANSACTION_DURATION } from '../../../common/elasticsearch_fieldnames';
import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions';
import { mergeProjection } from '../../projections/util/merge_projection';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import {
TRANSACTION_DOM_INTERACTIVE,
TRANSACTION_TIME_TO_FIRST_BYTE,
@@ -22,7 +18,7 @@ export async function getClientMetrics({
urlQuery,
percentile = 50,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
urlQuery?: string;
percentile?: number;
}) {
diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_js_errors.ts b/x-pack/plugins/apm/server/lib/rum_client/get_js_errors.ts
index 0540ea4bf09dd..a8a4e2714c86e 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/get_js_errors.ts
+++ b/x-pack/plugins/apm/server/lib/rum_client/get_js_errors.ts
@@ -5,11 +5,7 @@
*/
import { mergeProjection } from '../../projections/util/merge_projection';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { getRumErrorsProjection } from '../../projections/rum_page_load_transactions';
import {
ERROR_EXC_MESSAGE,
@@ -23,7 +19,7 @@ export async function getJSErrors({
pageSize,
pageIndex,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
pageSize: number;
pageIndex: number;
}) {
diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_long_task_metrics.ts b/x-pack/plugins/apm/server/lib/rum_client/get_long_task_metrics.ts
index c2c86ae05d57c..dfb31de8f10f7 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/get_long_task_metrics.ts
+++ b/x-pack/plugins/apm/server/lib/rum_client/get_long_task_metrics.ts
@@ -6,11 +6,7 @@
import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions';
import { mergeProjection } from '../../projections/util/merge_projection';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
const LONG_TASK_SUM_FIELD = 'transaction.experience.longtask.sum';
const LONG_TASK_COUNT_FIELD = 'transaction.experience.longtask.count';
@@ -21,7 +17,7 @@ export async function getLongTaskMetrics({
urlQuery,
percentile = 50,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
urlQuery?: string;
percentile?: number;
}) {
diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_page_load_distribution.ts b/x-pack/plugins/apm/server/lib/rum_client/get_page_load_distribution.ts
index 5f666feb8a18f..225afff2818ab 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/get_page_load_distribution.ts
+++ b/x-pack/plugins/apm/server/lib/rum_client/get_page_load_distribution.ts
@@ -7,11 +7,7 @@
import { TRANSACTION_DURATION } from '../../../common/elasticsearch_fieldnames';
import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions';
import { mergeProjection } from '../../projections/util/merge_projection';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
export const MICRO_TO_SEC = 1000000;
@@ -56,7 +52,7 @@ export async function getPageLoadDistribution({
maxPercentile,
urlQuery,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
minPercentile?: string;
maxPercentile?: string;
urlQuery?: string;
@@ -168,7 +164,7 @@ const getPercentilesDistribution = async ({
minDuration,
maxDuration,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
minDuration: number;
maxDuration: number;
}) => {
diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_page_view_trends.ts b/x-pack/plugins/apm/server/lib/rum_client/get_page_view_trends.ts
index 40f8a8bc58a54..c1a602c33feae 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/get_page_view_trends.ts
+++ b/x-pack/plugins/apm/server/lib/rum_client/get_page_view_trends.ts
@@ -5,11 +5,7 @@
*/
import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions';
import { mergeProjection } from '../../projections/util/merge_projection';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { BreakdownItem } from '../../../typings/ui_filters';
export async function getPageViewTrends({
@@ -17,7 +13,7 @@ export async function getPageViewTrends({
breakdowns,
urlQuery,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
breakdowns?: string;
urlQuery?: string;
}) {
diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_pl_dist_breakdown.ts b/x-pack/plugins/apm/server/lib/rum_client/get_pl_dist_breakdown.ts
index bebf9c0bc99c9..e2ec59d232b21 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/get_pl_dist_breakdown.ts
+++ b/x-pack/plugins/apm/server/lib/rum_client/get_pl_dist_breakdown.ts
@@ -7,11 +7,7 @@
import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions';
import { ProcessorEvent } from '../../../common/processor_event';
import { mergeProjection } from '../../projections/util/merge_projection';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import {
CLIENT_GEO_COUNTRY_ISO_CODE,
USER_AGENT_DEVICE,
@@ -46,7 +42,7 @@ export const getPageLoadDistBreakdown = async ({
breakdown,
urlQuery,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
minPercentile: number;
maxPercentile: number;
breakdown: string;
diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_rum_services.ts b/x-pack/plugins/apm/server/lib/rum_client/get_rum_services.ts
index 3adad0868ed4b..e9bd203e354cb 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/get_rum_services.ts
+++ b/x-pack/plugins/apm/server/lib/rum_client/get_rum_services.ts
@@ -5,18 +5,14 @@
*/
import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions';
import { mergeProjection } from '../../projections/util/merge_projection';
export async function getRumServices({
setup,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
}) {
const projection = getRumPageLoadTransactionsProjection({
setup,
diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_url_search.ts b/x-pack/plugins/apm/server/lib/rum_client/get_url_search.ts
index 6aa39c7ef961f..febfd66897e18 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/get_url_search.ts
+++ b/x-pack/plugins/apm/server/lib/rum_client/get_url_search.ts
@@ -5,11 +5,7 @@
*/
import { mergeProjection } from '../../projections/util/merge_projection';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions';
import {
TRANSACTION_DURATION,
@@ -21,7 +17,7 @@ export async function getUrlSearch({
urlQuery,
percentile,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
urlQuery?: string;
percentile: number;
}) {
diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_visitor_breakdown.ts b/x-pack/plugins/apm/server/lib/rum_client/get_visitor_breakdown.ts
index 52d089e4e29c9..6350bc2c07016 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/get_visitor_breakdown.ts
+++ b/x-pack/plugins/apm/server/lib/rum_client/get_visitor_breakdown.ts
@@ -6,11 +6,7 @@
import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions';
import { mergeProjection } from '../../projections/util/merge_projection';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import {
USER_AGENT_NAME,
USER_AGENT_OS,
@@ -20,7 +16,7 @@ export async function getVisitorBreakdown({
setup,
urlQuery,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
urlQuery?: string;
}) {
const projection = getRumPageLoadTransactionsProjection({
diff --git a/x-pack/plugins/apm/server/lib/rum_client/get_web_core_vitals.ts b/x-pack/plugins/apm/server/lib/rum_client/get_web_core_vitals.ts
index 676b3506397a7..c5baf0b529eb4 100644
--- a/x-pack/plugins/apm/server/lib/rum_client/get_web_core_vitals.ts
+++ b/x-pack/plugins/apm/server/lib/rum_client/get_web_core_vitals.ts
@@ -6,11 +6,7 @@
import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions';
import { mergeProjection } from '../../projections/util/merge_projection';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import {
CLS_FIELD,
FCP_FIELD,
@@ -25,7 +21,7 @@ export async function getWebCoreVitals({
urlQuery,
percentile = 50,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
urlQuery?: string;
percentile?: number;
}) {
diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts
index 75acebe7ed56c..330bb936c9e88 100644
--- a/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts
+++ b/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts
@@ -82,7 +82,7 @@ async function getServicesData(options: IEnvOptions) {
const { setup, searchAggregatedTransactions } = options;
const projection = getServicesProjection({
- setup: { ...setup, uiFiltersES: [] },
+ setup: { ...setup, esFilter: [] },
searchAggregatedTransactions,
});
diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts
index 7af1607697ef3..eb2ddbf38b274 100644
--- a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts
+++ b/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts
@@ -19,11 +19,10 @@ describe('getServiceMapServiceNodeInfo', () => {
}),
},
indices: {},
+ uiFilters: { environment: 'test environment' },
} as unknown) as Setup & SetupTimeRange;
- const environment = 'test environment';
const serviceName = 'test service name';
const result = await getServiceMapServiceNodeInfo({
- uiFilters: { environment },
setup,
serviceName,
searchAggregatedTransactions: false,
@@ -67,11 +66,10 @@ describe('getServiceMapServiceNodeInfo', () => {
config: {
'xpack.apm.metricsInterval': 30,
},
+ uiFilters: { environment: 'test environment' },
} as unknown) as Setup & SetupTimeRange;
- const environment = 'test environment';
const serviceName = 'test service name';
const result = await getServiceMapServiceNodeInfo({
- uiFilters: { environment },
setup,
serviceName,
searchAggregatedTransactions: false,
diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts
index 7c2137ce65d83..37b34641435fb 100644
--- a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts
+++ b/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.ts
@@ -8,7 +8,6 @@ import {
TRANSACTION_REQUEST,
TRANSACTION_PAGE_LOAD,
} from '../../../common/transaction_types';
-import { UIFilters } from '../../../typings/ui_filters';
import {
SERVICE_NAME,
METRIC_SYSTEM_CPU_PERCENT,
@@ -53,9 +52,8 @@ export async function getServiceMapServiceNodeInfo({
serviceName,
setup,
searchAggregatedTransactions,
- uiFilters,
-}: Options & { serviceName: string; uiFilters: UIFilters }) {
- const { start, end } = setup;
+}: Options & { serviceName: string }) {
+ const { start, end, uiFilters } = setup;
const filter: ESFilter[] = [
{ range: rangeFilter(start, end) },
@@ -105,7 +103,8 @@ async function getErrorStats({
}) {
const setupWithBlankUiFilters = {
...setup,
- uiFiltersES: getEnvironmentUiFilterES(environment),
+ uiFilters: { environment },
+ esFilter: getEnvironmentUiFilterES(environment),
};
const { noHits, average } = await getErrorRate({
setup: setupWithBlankUiFilters,
diff --git a/x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_grouped.json b/x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_grouped.json
index e7bba585de180..94c508fe90230 100644
--- a/x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_grouped.json
+++ b/x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_grouped.json
@@ -3,7 +3,7 @@
{
"data": {
"id": "opbeans-rum",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-rum",
"agent.name": "rum-js"
}
@@ -18,7 +18,7 @@
{
"data": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
}
diff --git a/x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_pregrouped.json b/x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_pregrouped.json
index 22c5c50de7472..58469f607ac13 100644
--- a/x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_pregrouped.json
+++ b/x-pack/plugins/apm/server/lib/service_map/mock_responses/group_resource_nodes_pregrouped.json
@@ -3,7 +3,7 @@
{
"data": {
"id": "opbeans-rum",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-rum",
"agent.name": "rum-js"
}
@@ -18,7 +18,7 @@
{
"data": {
"id": "opbeans-node",
- "service.environment": "testing",
+ "service.environment": "test",
"service.name": "opbeans-node",
"agent.name": "nodejs"
}
diff --git a/x-pack/plugins/apm/server/lib/service_nodes/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/service_nodes/__snapshots__/queries.test.ts.snap
index 87aca0d056909..d83e558775be4 100644
--- a/x-pack/plugins/apm/server/lib/service_nodes/__snapshots__/queries.test.ts.snap
+++ b/x-pack/plugins/apm/server/lib/service_nodes/__snapshots__/queries.test.ts.snap
@@ -51,7 +51,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -119,7 +119,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -188,7 +188,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
diff --git a/x-pack/plugins/apm/server/lib/service_nodes/index.ts b/x-pack/plugins/apm/server/lib/service_nodes/index.ts
index a83aba192dba9..d5e29532e3d7b 100644
--- a/x-pack/plugins/apm/server/lib/service_nodes/index.ts
+++ b/x-pack/plugins/apm/server/lib/service_nodes/index.ts
@@ -4,11 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { getServiceNodesProjection } from '../../projections/service_nodes';
import { mergeProjection } from '../../projections/util/merge_projection';
import { SERVICE_NODE_NAME_MISSING } from '../../../common/service_nodes';
@@ -23,7 +19,7 @@ const getServiceNodes = async ({
setup,
serviceName,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
serviceName: string;
}) => {
const { apmEventClient } = setup;
diff --git a/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap
index 431f11066aaff..3a38f80c87b35 100644
--- a/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap
+++ b/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap
@@ -144,7 +144,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -194,7 +194,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -257,7 +257,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -334,7 +334,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -389,7 +389,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
diff --git a/x-pack/plugins/apm/server/lib/services/get_service_node_metadata.ts b/x-pack/plugins/apm/server/lib/services/get_service_node_metadata.ts
index fca472b0ce8c2..d6ba9f5447ba5 100644
--- a/x-pack/plugins/apm/server/lib/services/get_service_node_metadata.ts
+++ b/x-pack/plugins/apm/server/lib/services/get_service_node_metadata.ts
@@ -4,11 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import {
HOST_NAME,
CONTAINER_ID,
@@ -24,7 +20,7 @@ export async function getServiceNodeMetadata({
}: {
serviceName: string;
serviceNodeName: string;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
}) {
const { apmEventClient } = setup;
diff --git a/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts b/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts
index c09be7aacc784..092485c46fb08 100644
--- a/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts
+++ b/x-pack/plugins/apm/server/lib/services/get_services/get_services_items.ts
@@ -5,11 +5,7 @@
*/
import { joinByKey } from '../../../../common/utils/join_by_key';
import { PromiseReturnType } from '../../../../typings/common';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../helpers/setup_request';
import { getServicesProjection } from '../../../projections/services';
import {
getTransactionDurationAverages,
@@ -21,17 +17,15 @@ import {
} from './get_services_items_stats';
export type ServiceListAPIResponse = PromiseReturnType;
-export type ServicesItemsSetup = Setup & SetupTimeRange & SetupUIFilters;
+export type ServicesItemsSetup = Setup & SetupTimeRange;
export type ServicesItemsProjection = ReturnType;
export async function getServicesItems({
setup,
searchAggregatedTransactions,
- mlAnomaliesEnvironment,
}: {
setup: ServicesItemsSetup;
searchAggregatedTransactions: boolean;
- mlAnomaliesEnvironment?: string;
}) {
const params = {
projection: getServicesProjection({
@@ -55,7 +49,7 @@ export async function getServicesItems({
getTransactionRates(params),
getTransactionErrorRates(params),
getEnvironments(params),
- getHealthStatuses(params, mlAnomaliesEnvironment),
+ getHealthStatuses(params, setup.uiFilters.environment),
]);
const allMetrics = [
diff --git a/x-pack/plugins/apm/server/lib/services/get_services/index.ts b/x-pack/plugins/apm/server/lib/services/get_services/index.ts
index 351457b2a815e..04744a9c791bb 100644
--- a/x-pack/plugins/apm/server/lib/services/get_services/index.ts
+++ b/x-pack/plugins/apm/server/lib/services/get_services/index.ts
@@ -6,11 +6,7 @@
import { isEmpty } from 'lodash';
import { PromiseReturnType } from '../../../../typings/common';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../helpers/setup_request';
import { hasHistoricalAgentData } from './has_historical_agent_data';
import { getLegacyDataStatus } from './get_legacy_data_status';
import { getServicesItems } from './get_services_items';
@@ -20,17 +16,14 @@ export type ServiceListAPIResponse = PromiseReturnType;
export async function getServices({
setup,
searchAggregatedTransactions,
- mlAnomaliesEnvironment,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
searchAggregatedTransactions: boolean;
- mlAnomaliesEnvironment?: string;
}) {
const [items, hasLegacyData] = await Promise.all([
getServicesItems({
setup,
searchAggregatedTransactions,
- mlAnomaliesEnvironment,
}),
getLegacyDataStatus(setup),
]);
diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap
index bd6cefa793467..c678e7db711b6 100644
--- a/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap
+++ b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap
@@ -61,7 +61,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -128,7 +128,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -195,7 +195,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -270,7 +270,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -325,7 +325,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -380,7 +380,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -441,7 +441,7 @@ Array [
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts
index 5d581149db667..0a4d9748f2597 100644
--- a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts
+++ b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts
@@ -15,11 +15,7 @@ import { getTransactionGroupsProjection } from '../../projections/transaction_gr
import { mergeProjection } from '../../projections/util/merge_projection';
import { PromiseReturnType } from '../../../../observability/typings/common';
import { AggregationOptionsByType } from '../../../typings/elasticsearch/aggregations';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import {
getAverages,
getSums,
@@ -57,7 +53,7 @@ export type TransactionGroupRequestBase = ReturnType<
};
};
-export type TransactionGroupSetup = Setup & SetupTimeRange & SetupUIFilters;
+export type TransactionGroupSetup = Setup & SetupTimeRange;
function getItemsWithRelativeImpact(
setup: TransactionGroupSetup,
diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts b/x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts
index 3dc126c45d328..d5289430b2698 100644
--- a/x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts
+++ b/x-pack/plugins/apm/server/lib/transaction_groups/get_error_rate.ts
@@ -12,11 +12,7 @@ import {
EVENT_OUTCOME,
} from '../../../common/elasticsearch_fieldnames';
import { rangeFilter } from '../../../common/utils/range_filter';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { getBucketSize } from '../helpers/get_bucket_size';
import {
getProcessorEventForAggregatedTransactions,
@@ -33,10 +29,10 @@ export async function getErrorRate({
serviceName: string;
transactionType?: string;
transactionName?: string;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
searchAggregatedTransactions: boolean;
}) {
- const { start, end, uiFiltersES, apmEventClient } = setup;
+ const { start, end, esFilter, apmEventClient } = setup;
const transactionNamefilter = transactionName
? [{ term: { [TRANSACTION_NAME]: transactionName } }]
@@ -53,7 +49,7 @@ export async function getErrorRate({
},
...transactionNamefilter,
...transactionTypefilter,
- ...uiFiltersES,
+ ...esFilter,
];
const params = {
diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_sample_for_group.ts b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_sample_for_group.ts
index 6c9b23b3dc079..7e1aad075fb16 100644
--- a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_sample_for_group.ts
+++ b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_sample_for_group.ts
@@ -12,11 +12,7 @@ import {
} from '../../../common/elasticsearch_fieldnames';
import { ProcessorEvent } from '../../../common/processor_event';
import { rangeFilter } from '../../../common/utils/range_filter';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
export async function getTransactionSampleForGroup({
serviceName,
@@ -25,9 +21,9 @@ export async function getTransactionSampleForGroup({
}: {
serviceName: string;
transactionName: string;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
}) {
- const { apmEventClient, start, end, uiFiltersES } = setup;
+ const { apmEventClient, start, end, esFilter } = setup;
const filter = [
{
@@ -43,7 +39,7 @@ export async function getTransactionSampleForGroup({
[TRANSACTION_NAME]: transactionName,
},
},
- ...uiFiltersES,
+ ...esFilter,
];
const getSampledTransaction = async () => {
diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/index.ts b/x-pack/plugins/apm/server/lib/transaction_groups/index.ts
index 6e0d619268d44..3796511029243 100644
--- a/x-pack/plugins/apm/server/lib/transaction_groups/index.ts
+++ b/x-pack/plugins/apm/server/lib/transaction_groups/index.ts
@@ -4,16 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { transactionGroupsFetcher, Options } from './fetcher';
export async function getTransactionGroupList(
options: Options,
- setup: Setup & SetupTimeRange & SetupUIFilters
+ setup: Setup & SetupTimeRange
) {
const bucketSize = setup.config['xpack.apm.ui.transactionGroupBucketSize'];
return await transactionGroupsFetcher(options, setup, bucketSize);
diff --git a/x-pack/plugins/apm/server/lib/transactions/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/__snapshots__/queries.test.ts.snap
index c63dfcc0c0ec7..3e0a7317afd70 100644
--- a/x-pack/plugins/apm/server/lib/transactions/__snapshots__/queries.test.ts.snap
+++ b/x-pack/plugins/apm/server/lib/transactions/__snapshots__/queries.test.ts.snap
@@ -161,7 +161,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -295,7 +295,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -401,7 +401,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
@@ -502,7 +502,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -608,7 +608,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
Object {
@@ -673,7 +673,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts
index 34863c64f9804..8bbcaebe06513 100644
--- a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts
@@ -36,7 +36,8 @@ function getMockSetup(esResponse: any) {
get: () => 'myIndex',
}
) as APMConfig,
- uiFiltersES: [],
+ uiFilters: {},
+ esFilter: [],
indices: mockIndices,
dynamicIndexPattern: null as any,
};
diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts
index 9730ddbbf38d7..8febdc898ab97 100644
--- a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts
@@ -16,11 +16,7 @@ import {
TRANSACTION_NAME,
TRANSACTION_BREAKDOWN_COUNT,
} from '../../../../common/elasticsearch_fieldnames';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../helpers/setup_request';
import { rangeFilter } from '../../../../common/utils/range_filter';
import { getMetricsDateHistogramParams } from '../../helpers/metrics';
import { MAX_KPIS } from './constants';
@@ -32,12 +28,12 @@ export async function getTransactionBreakdown({
transactionName,
transactionType,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
serviceName: string;
transactionName?: string;
transactionType: string;
}) {
- const { uiFiltersES, apmEventClient, start, end, config } = setup;
+ const { esFilter, apmEventClient, start, end, config } = setup;
const subAggs = {
sum_all_self_times: {
@@ -84,7 +80,7 @@ export async function getTransactionBreakdown({
{ term: { [SERVICE_NAME]: serviceName } },
{ term: { [TRANSACTION_TYPE]: transactionType } },
{ range: rangeFilter(start, end) },
- ...uiFiltersES,
+ ...esFilter,
];
if (transactionName) {
diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts
index 3cf9a54e3fe9b..287c7bc2c47f9 100644
--- a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts
@@ -5,6 +5,7 @@
*/
import { Logger } from 'kibana/server';
+import { ESSearchResponse } from '../../../../../typings/elasticsearch';
import { PromiseReturnType } from '../../../../../../observability/typings/common';
import { Setup, SetupTimeRange } from '../../../helpers/setup_request';
@@ -47,7 +48,7 @@ export async function anomalySeriesFetcher({
filter: [
{ term: { job_id: jobId } },
{ exists: { field: 'bucket_span' } },
- { term: { result_type: 'model_plot' } },
+ { terms: { result_type: ['model_plot', 'record'] } },
{ term: { partition_field_value: serviceName } },
{ term: { by_field_value: transactionType } },
{
@@ -67,7 +68,7 @@ export async function anomalySeriesFetcher({
extended_bounds: { min: newStart, max: end },
},
aggs: {
- anomaly_score: { max: { field: 'anomaly_score' } },
+ anomaly_score: { max: { field: 'record_score' } },
lower: { min: { field: 'model_lower' } },
upper: { max: { field: 'model_upper' } },
},
@@ -77,7 +78,11 @@ export async function anomalySeriesFetcher({
};
try {
- const response = await ml.mlSystem.mlAnomalySearch(params);
+ const response: ESSearchResponse<
+ unknown,
+ typeof params
+ > = (await ml.mlSystem.mlAnomalySearch(params)) as any;
+
return response;
} catch (err) {
const isHttpError = 'statusCode' in err;
diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.ts
index d8865f0049d35..f11623eaa2dae 100644
--- a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.ts
@@ -5,17 +5,13 @@
*/
import { Logger } from 'kibana/server';
import { isNumber } from 'lodash';
+import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
import { getBucketSize } from '../../../helpers/get_bucket_size';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../helpers/setup_request';
import { anomalySeriesFetcher } from './fetcher';
import { getMlBucketSize } from './get_ml_bucket_size';
import { anomalySeriesTransform } from './transform';
import { getMLJobIds } from '../../../service_map/get_service_anomalies';
-import { UIFilters } from '../../../../../typings/ui_filters';
export async function getAnomalySeries({
serviceName,
@@ -24,15 +20,13 @@ export async function getAnomalySeries({
timeSeriesDates,
setup,
logger,
- uiFilters,
}: {
serviceName: string;
transactionType: string | undefined;
transactionName: string | undefined;
timeSeriesDates: number[];
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
logger: Logger;
- uiFilters: UIFilters;
}) {
// don't fetch anomalies for transaction details page
if (transactionName) {
@@ -44,12 +38,22 @@ export async function getAnomalySeries({
return;
}
+ const { uiFilters, start, end } = setup;
+ const { environment } = uiFilters;
+
+ // don't fetch anomalies when no specific environment is selected
+ if (environment === ENVIRONMENT_ALL.value) {
+ return;
+ }
+
// don't fetch anomalies if unknown uiFilters are applied
const knownFilters = ['environment', 'serviceName'];
- const uiFilterNames = Object.keys(uiFilters);
- if (
- uiFilterNames.some((uiFilterName) => !knownFilters.includes(uiFilterName))
- ) {
+ const hasUnknownFiltersApplied = Object.entries(setup.uiFilters)
+ .filter(([key, value]) => !!value)
+ .map(([key]) => key)
+ .some((uiFilterName) => !knownFilters.includes(uiFilterName));
+
+ if (hasUnknownFiltersApplied) {
return;
}
@@ -64,15 +68,8 @@ export async function getAnomalySeries({
return;
}
- const mlJobIds = await getMLJobIds(
- setup.ml.anomalyDetectors,
- uiFilters.environment
- );
+ const mlJobIds = await getMLJobIds(setup.ml.anomalyDetectors, environment);
- // don't fetch anomalies if there are isn't exaclty 1 ML job match for the given environment
- if (mlJobIds.length !== 1) {
- return;
- }
const jobId = mlJobIds[0];
const mlBucketSize = await getMlBucketSize({ setup, jobId, logger });
@@ -80,7 +77,6 @@ export async function getAnomalySeries({
return;
}
- const { start, end } = setup;
const { intervalString, bucketSize } = getBucketSize(start, end);
const esResponse = await anomalySeriesFetcher({
diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.test.ts
index fdbd99bf274d6..75dfae3e7375f 100644
--- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.test.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.test.ts
@@ -29,7 +29,10 @@ describe('timeseriesFetcher', () => {
get: () => 'myIndex',
}
) as APMConfig,
- uiFiltersES: [
+ uiFilters: {
+ environment: 'test',
+ },
+ esFilter: [
{
term: { 'service.environment': 'test' },
},
diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts
index 5a3948f577430..e2edbbec63d47 100644
--- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts
@@ -14,11 +14,7 @@ import {
import { PromiseReturnType } from '../../../../../../observability/typings/common';
import { getBucketSize } from '../../../helpers/get_bucket_size';
import { rangeFilter } from '../../../../../common/utils/range_filter';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../helpers/setup_request';
import {
getProcessorEventForAggregatedTransactions,
getTransactionDurationFieldForAggregatedTransactions,
@@ -36,10 +32,10 @@ export function timeseriesFetcher({
serviceName: string;
transactionType: string | undefined;
transactionName: string | undefined;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
searchAggregatedTransactions: boolean;
}) {
- const { start, end, uiFiltersES, apmEventClient } = setup;
+ const { start, end, apmEventClient } = setup;
const { intervalString } = getBucketSize(start, end);
const filter: ESFilter[] = [
@@ -48,7 +44,7 @@ export function timeseriesFetcher({
...getDocumentTypeFilterForAggregatedTransactions(
searchAggregatedTransactions
),
- ...uiFiltersES,
+ ...setup.esFilter,
];
if (transactionName) {
diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts
index 81dca447f16ca..c0421005dd06e 100644
--- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts
@@ -5,11 +5,7 @@
*/
import { getBucketSize } from '../../../helpers/get_bucket_size';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../helpers/setup_request';
import { timeseriesFetcher } from './fetcher';
import { timeseriesTransformer } from './transform';
@@ -17,7 +13,7 @@ export async function getApmTimeseriesData(options: {
serviceName: string;
transactionType: string | undefined;
transactionName: string | undefined;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
searchAggregatedTransactions: boolean;
}) {
const { start, end } = options.setup;
diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/index.ts b/x-pack/plugins/apm/server/lib/transactions/charts/index.ts
index 43abf0b1a1d33..d8593612c0582 100644
--- a/x-pack/plugins/apm/server/lib/transactions/charts/index.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/charts/index.ts
@@ -6,15 +6,10 @@
import { Logger } from 'kibana/server';
import { PromiseReturnType } from '../../../../../observability/typings/common';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../helpers/setup_request';
import { getAnomalySeries } from './get_anomaly_data';
import { getApmTimeseriesData } from './get_timeseries_data';
import { ApmTimeSeriesResponse } from './get_timeseries_data/transform';
-import { UIFilters } from '../../../../typings/ui_filters';
function getDates(apmTimeseries: ApmTimeSeriesResponse) {
return apmTimeseries.responseTimes.avg.map((p) => p.x);
@@ -27,10 +22,9 @@ export async function getTransactionCharts(options: {
serviceName: string;
transactionType: string | undefined;
transactionName: string | undefined;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
searchAggregatedTransactions: boolean;
logger: Logger;
- uiFilters: UIFilters;
}) {
const apmTimeseries = await getApmTimeseriesData(options);
const anomalyTimeseries = await getAnomalySeries({
diff --git a/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts b/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts
index 6e2fe34a5f5ef..34d01627a2869 100644
--- a/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/distribution/get_buckets/index.ts
@@ -17,11 +17,7 @@ import {
TRANSACTION_TYPE,
} from '../../../../../common/elasticsearch_fieldnames';
import { rangeFilter } from '../../../../../common/utils/range_filter';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../../helpers/setup_request';
import {
getDocumentTypeFilterForAggregatedTransactions,
getProcessorEventForAggregatedTransactions,
@@ -66,17 +62,17 @@ export async function getBuckets({
traceId: string;
distributionMax: number;
bucketSize: number;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
searchAggregatedTransactions: boolean;
}) {
- const { start, end, uiFiltersES, apmEventClient } = setup;
+ const { start, end, esFilter, apmEventClient } = setup;
const commonFilters = [
{ term: { [SERVICE_NAME]: serviceName } },
{ term: { [TRANSACTION_TYPE]: transactionType } },
{ term: { [TRANSACTION_NAME]: transactionName } },
{ range: rangeFilter(start, end) },
- ...uiFiltersES,
+ ...esFilter,
];
async function getSamplesForDistributionBuckets() {
diff --git a/x-pack/plugins/apm/server/lib/transactions/distribution/get_distribution_max.ts b/x-pack/plugins/apm/server/lib/transactions/distribution/get_distribution_max.ts
index 24ca2a4a07b68..249b1c4fbb20a 100644
--- a/x-pack/plugins/apm/server/lib/transactions/distribution/get_distribution_max.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/distribution/get_distribution_max.ts
@@ -9,11 +9,7 @@ import {
TRANSACTION_NAME,
TRANSACTION_TYPE,
} from '../../../../common/elasticsearch_fieldnames';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../helpers/setup_request';
import {
getProcessorEventForAggregatedTransactions,
getTransactionDurationFieldForAggregatedTransactions,
@@ -29,10 +25,10 @@ export async function getDistributionMax({
serviceName: string;
transactionName: string;
transactionType: string;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
searchAggregatedTransactions: boolean;
}) {
- const { start, end, uiFiltersES, apmEventClient } = setup;
+ const { start, end, esFilter, apmEventClient } = setup;
const params = {
apm: {
@@ -59,7 +55,7 @@ export async function getDistributionMax({
},
},
},
- ...uiFiltersES,
+ ...esFilter,
],
},
},
diff --git a/x-pack/plugins/apm/server/lib/transactions/distribution/index.ts b/x-pack/plugins/apm/server/lib/transactions/distribution/index.ts
index b9ab36fb08d42..deafc37ee42e2 100644
--- a/x-pack/plugins/apm/server/lib/transactions/distribution/index.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/distribution/index.ts
@@ -5,11 +5,7 @@
*/
import { PromiseReturnType } from '../../../../../observability/typings/common';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../helpers/setup_request';
import { getBuckets } from './get_buckets';
import { getDistributionMax } from './get_distribution_max';
import { roundToNearestFiveOrTen } from '../../helpers/round_to_nearest_five_or_ten';
@@ -39,7 +35,7 @@ export async function getTransactionDistribution({
transactionType: string;
transactionId: string;
traceId: string;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
searchAggregatedTransactions: boolean;
}) {
const distributionMax = await getDistributionMax({
diff --git a/x-pack/plugins/apm/server/lib/transactions/get_transaction/index.ts b/x-pack/plugins/apm/server/lib/transactions/get_transaction/index.ts
index 9aa1a8f4de87f..8958be0819613 100644
--- a/x-pack/plugins/apm/server/lib/transactions/get_transaction/index.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/get_transaction/index.ts
@@ -9,11 +9,7 @@ import {
TRANSACTION_ID,
} from '../../../../common/elasticsearch_fieldnames';
import { rangeFilter } from '../../../../common/utils/range_filter';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../helpers/setup_request';
import { ProcessorEvent } from '../../../../common/processor_event';
export async function getTransaction({
@@ -23,7 +19,7 @@ export async function getTransaction({
}: {
transactionId: string;
traceId: string;
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
}) {
const { start, end, apmEventClient } = setup;
diff --git a/x-pack/plugins/apm/server/lib/transactions/queries.test.ts b/x-pack/plugins/apm/server/lib/transactions/queries.test.ts
index 87b8bc7c4ae90..eff9451c9e1cd 100644
--- a/x-pack/plugins/apm/server/lib/transactions/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/transactions/queries.test.ts
@@ -56,7 +56,6 @@ describe('transaction queries', () => {
setup,
searchAggregatedTransactions: false,
logger: loggerMock.create(),
- uiFilters: {},
})
);
expect(mock.params).toMatchSnapshot();
@@ -71,7 +70,6 @@ describe('transaction queries', () => {
setup,
searchAggregatedTransactions: false,
logger: loggerMock.create(),
- uiFilters: {},
})
);
expect(mock.params).toMatchSnapshot();
@@ -86,7 +84,6 @@ describe('transaction queries', () => {
setup,
searchAggregatedTransactions: false,
logger: loggerMock.create(),
- uiFilters: {},
})
);
diff --git a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/__snapshots__/queries.test.ts.snap
index 5f38432719280..e7ca65eb740b6 100644
--- a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/__snapshots__/queries.test.ts.snap
+++ b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/__snapshots__/queries.test.ts.snap
@@ -46,7 +46,7 @@ Object {
},
Object {
"term": Object {
- "my.custom.ui.filter": "foo-bar",
+ "service.environment": "test",
},
},
],
diff --git a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts
index 10f6e93c1cfc1..9fbdba679b667 100644
--- a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts
+++ b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts
@@ -8,7 +8,7 @@ import { omit } from 'lodash';
import { mergeProjection } from '../../../projections/util/merge_projection';
import { Projection } from '../../../projections/typings';
import { UIFilters } from '../../../../typings/ui_filters';
-import { getUiFiltersES } from '../../helpers/convert_ui_filters/get_ui_filters_es';
+import { getEsFilter } from '../../helpers/convert_ui_filters/get_es_filter';
import { localUIFilters } from './config';
import { LocalUIFilterName } from '../../../../common/ui_filter';
@@ -22,7 +22,7 @@ export const getLocalFilterQuery = ({
localUIFilterName: LocalUIFilterName;
}) => {
const field = localUIFilters[localUIFilterName];
- const filter = getUiFiltersES(omit(uiFilters, field.name));
+ const filter = getEsFilter(omit(uiFilters, field.name));
const bucketCountAggregation = projection.body.aggs
? {
diff --git a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts
index 22fa20e255f6e..f4e8aafc1bcf5 100644
--- a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts
+++ b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/queries.test.ts
@@ -15,7 +15,7 @@ describe('local ui filter queries', () => {
let mock: SearchParamsMock;
beforeEach(() => {
- jest.mock('../../helpers/convert_ui_filters/get_ui_filters_es', () => {
+ jest.mock('../../helpers/convert_ui_filters/get_es_filter', () => {
return [];
});
});
diff --git a/x-pack/plugins/apm/server/projections/errors.ts b/x-pack/plugins/apm/server/projections/errors.ts
index 49a0e9f479d26..173dc94a0840c 100644
--- a/x-pack/plugins/apm/server/projections/errors.ts
+++ b/x-pack/plugins/apm/server/projections/errors.ts
@@ -4,11 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../server/lib/helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../server/lib/helpers/setup_request';
import {
SERVICE_NAME,
ERROR_GROUP_ID,
@@ -20,10 +16,10 @@ export function getErrorGroupsProjection({
setup,
serviceName,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
serviceName: string;
}) {
- const { start, end, uiFiltersES } = setup;
+ const { start, end, esFilter } = setup;
return {
apm: {
@@ -35,7 +31,7 @@ export function getErrorGroupsProjection({
filter: [
{ term: { [SERVICE_NAME]: serviceName } },
{ range: rangeFilter(start, end) },
- ...uiFiltersES,
+ ...esFilter,
],
},
},
diff --git a/x-pack/plugins/apm/server/projections/metrics.ts b/x-pack/plugins/apm/server/projections/metrics.ts
index eb80a6bc73248..c3b5db5be6af8 100644
--- a/x-pack/plugins/apm/server/projections/metrics.ts
+++ b/x-pack/plugins/apm/server/projections/metrics.ts
@@ -4,11 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../server/lib/helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../server/lib/helpers/setup_request';
import {
SERVICE_NAME,
SERVICE_NODE_NAME,
@@ -34,17 +30,17 @@ export function getMetricsProjection({
serviceName,
serviceNodeName,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
serviceName: string;
serviceNodeName?: string;
}) {
- const { start, end, uiFiltersES } = setup;
+ const { start, end, esFilter } = setup;
const filter = [
{ term: { [SERVICE_NAME]: serviceName } },
{ range: rangeFilter(start, end) },
...getServiceNodeNameFilters(serviceNodeName),
- ...uiFiltersES,
+ ...esFilter,
];
return {
diff --git a/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts b/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts
index c27314923f6bd..96ee26c6e65f5 100644
--- a/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts
+++ b/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts
@@ -4,11 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../server/lib/helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../server/lib/helpers/setup_request';
import {
AGENT_NAME,
TRANSACTION_TYPE,
@@ -22,10 +18,10 @@ export function getRumPageLoadTransactionsProjection({
setup,
urlQuery,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
urlQuery?: string;
}) {
- const { start, end, uiFiltersES } = setup;
+ const { start, end, esFilter } = setup;
const bool = {
filter: [
@@ -49,7 +45,7 @@ export function getRumPageLoadTransactionsProjection({
},
]
: []),
- ...uiFiltersES,
+ ...esFilter,
],
};
@@ -68,9 +64,9 @@ export function getRumPageLoadTransactionsProjection({
export function getRumErrorsProjection({
setup,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
}) {
- const { start, end, uiFiltersES } = setup;
+ const { start, end, esFilter: esFilter } = setup;
const bool = {
filter: [
@@ -82,7 +78,7 @@ export function getRumErrorsProjection({
[SERVICE_LANGUAGE_NAME]: 'javascript',
},
},
- ...uiFiltersES,
+ ...esFilter,
],
};
diff --git a/x-pack/plugins/apm/server/projections/service_nodes.ts b/x-pack/plugins/apm/server/projections/service_nodes.ts
index 87fe815a12d0d..ed8d4c7409eda 100644
--- a/x-pack/plugins/apm/server/projections/service_nodes.ts
+++ b/x-pack/plugins/apm/server/projections/service_nodes.ts
@@ -4,11 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../server/lib/helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../server/lib/helpers/setup_request';
import { SERVICE_NODE_NAME } from '../../common/elasticsearch_fieldnames';
import { mergeProjection } from './util/merge_projection';
import { getMetricsProjection } from './metrics';
@@ -18,7 +14,7 @@ export function getServiceNodesProjection({
serviceName,
serviceNodeName,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
serviceName: string;
serviceNodeName?: string;
}) {
diff --git a/x-pack/plugins/apm/server/projections/services.ts b/x-pack/plugins/apm/server/projections/services.ts
index ba61f72519a23..d912a95546515 100644
--- a/x-pack/plugins/apm/server/projections/services.ts
+++ b/x-pack/plugins/apm/server/projections/services.ts
@@ -4,11 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupUIFilters,
- SetupTimeRange,
-} from '../../server/lib/helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../server/lib/helpers/setup_request';
import { SERVICE_NAME } from '../../common/elasticsearch_fieldnames';
import { rangeFilter } from '../../common/utils/range_filter';
import { ProcessorEvent } from '../../common/processor_event';
@@ -18,10 +14,10 @@ export function getServicesProjection({
setup,
searchAggregatedTransactions,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
searchAggregatedTransactions: boolean;
}) {
- const { start, end, uiFiltersES } = setup;
+ const { start, end, esFilter } = setup;
return {
apm: {
@@ -37,7 +33,7 @@ export function getServicesProjection({
size: 0,
query: {
bool: {
- filter: [{ range: rangeFilter(start, end) }, ...uiFiltersES],
+ filter: [{ range: rangeFilter(start, end) }, ...esFilter],
},
},
aggs: {
diff --git a/x-pack/plugins/apm/server/projections/transaction_groups.ts b/x-pack/plugins/apm/server/projections/transaction_groups.ts
index 0cc3a7a35d214..2ce720eb12167 100644
--- a/x-pack/plugins/apm/server/projections/transaction_groups.ts
+++ b/x-pack/plugins/apm/server/projections/transaction_groups.ts
@@ -4,11 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { omit } from 'lodash';
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../server/lib/helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../server/lib/helpers/setup_request';
import {
TRANSACTION_NAME,
PARENT_ID,
@@ -22,7 +18,7 @@ export function getTransactionGroupsProjection({
setup,
options,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
options: Options;
}) {
const transactionsProjection = getTransactionsProjection({
diff --git a/x-pack/plugins/apm/server/projections/transactions.ts b/x-pack/plugins/apm/server/projections/transactions.ts
index 8e9bb3bf321f6..548e77b5d2cd9 100644
--- a/x-pack/plugins/apm/server/projections/transactions.ts
+++ b/x-pack/plugins/apm/server/projections/transactions.ts
@@ -4,11 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- Setup,
- SetupTimeRange,
- SetupUIFilters,
-} from '../../server/lib/helpers/setup_request';
+import { Setup, SetupTimeRange } from '../../server/lib/helpers/setup_request';
import {
SERVICE_NAME,
TRANSACTION_TYPE,
@@ -27,13 +23,13 @@ export function getTransactionsProjection({
transactionType,
searchAggregatedTransactions,
}: {
- setup: Setup & SetupTimeRange & SetupUIFilters;
+ setup: Setup & SetupTimeRange;
serviceName?: string;
transactionName?: string;
transactionType?: string;
searchAggregatedTransactions: boolean;
}) {
- const { start, end, uiFiltersES } = setup;
+ const { start, end, esFilter } = setup;
const transactionNameFilter = transactionName
? [{ term: { [TRANSACTION_NAME]: transactionName } }]
@@ -51,7 +47,7 @@ export function getTransactionsProjection({
...transactionNameFilter,
...transactionTypeFilter,
...serviceNameFilter,
- ...uiFiltersES,
+ ...esFilter,
...getDocumentTypeFilterForAggregatedTransactions(
searchAggregatedTransactions
),
diff --git a/x-pack/plugins/apm/server/routes/service_map.ts b/x-pack/plugins/apm/server/routes/service_map.ts
index 1996d4d4a262d..6e86ececd1bfe 100644
--- a/x-pack/plugins/apm/server/routes/service_map.ts
+++ b/x-pack/plugins/apm/server/routes/service_map.ts
@@ -17,7 +17,6 @@ import { createRoute } from './create_route';
import { rangeRt, uiFiltersRt } from './default_api_types';
import { notifyFeatureUsage } from '../feature';
import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions';
-import { getParsedUiFilters } from '../lib/helpers/convert_ui_filters/get_parsed_ui_filters';
export const serviceMapRoute = createRoute(() => ({
path: '/api/apm/service-map',
@@ -77,24 +76,20 @@ export const serviceMapServiceNodeRoute = createRoute(() => ({
if (!isActivePlatinumLicense(context.licensing.license)) {
throw Boom.forbidden(invalidLicenseMessage);
}
- const logger = context.logger;
const setup = await setupRequest(context, request);
const {
- query: { uiFilters: uiFiltersJson },
path: { serviceName },
} = context.params;
const searchAggregatedTransactions = await getSearchAggregatedTransactions(
setup
);
- const uiFilters = getParsedUiFilters({ uiFilters: uiFiltersJson, logger });
return getServiceMapServiceNodeInfo({
setup,
serviceName,
searchAggregatedTransactions,
- uiFilters,
});
},
}));
diff --git a/x-pack/plugins/apm/server/routes/services.ts b/x-pack/plugins/apm/server/routes/services.ts
index 4bb10f31ba6a1..538ba3926c792 100644
--- a/x-pack/plugins/apm/server/routes/services.ts
+++ b/x-pack/plugins/apm/server/routes/services.ts
@@ -17,7 +17,6 @@ import { uiFiltersRt, rangeRt } from './default_api_types';
import { getServiceAnnotations } from '../lib/services/annotations';
import { dateAsStringRt } from '../../common/runtime_types/date_as_string_rt';
import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions';
-import { getParsedUiFilters } from '../lib/helpers/convert_ui_filters/get_parsed_ui_filters';
export const servicesRoute = createRoute(() => ({
path: '/api/apm/services',
@@ -25,22 +24,13 @@ export const servicesRoute = createRoute(() => ({
query: t.intersection([uiFiltersRt, rangeRt]),
},
handler: async ({ context, request }) => {
- const { environment } = getParsedUiFilters({
- uiFilters: context.params.query.uiFilters,
- logger: context.logger,
- });
-
const setup = await setupRequest(context, request);
const searchAggregatedTransactions = await getSearchAggregatedTransactions(
setup
);
- const services = await getServices({
- setup,
- searchAggregatedTransactions,
- mlAnomaliesEnvironment: environment,
- });
+ const services = await getServices({ setup, searchAggregatedTransactions });
return services;
},
diff --git a/x-pack/plugins/apm/server/routes/transaction_groups.ts b/x-pack/plugins/apm/server/routes/transaction_groups.ts
index dd1335fb2c2a1..18fc73b468cd4 100644
--- a/x-pack/plugins/apm/server/routes/transaction_groups.ts
+++ b/x-pack/plugins/apm/server/routes/transaction_groups.ts
@@ -5,6 +5,7 @@
*/
import * as t from 'io-ts';
+import Boom from 'boom';
import { setupRequest } from '../lib/helpers/setup_request';
import { getTransactionCharts } from '../lib/transactions/charts';
import { getTransactionDistribution } from '../lib/transactions/distribution';
@@ -15,7 +16,6 @@ import { uiFiltersRt, rangeRt } from './default_api_types';
import { getTransactionSampleForGroup } from '../lib/transaction_groups/get_transaction_sample_for_group';
import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions';
import { getErrorRate } from '../lib/transaction_groups/get_error_rate';
-import { getParsedUiFilters } from '../lib/helpers/convert_ui_filters/get_parsed_ui_filters';
export const transactionGroupsRoute = createRoute(() => ({
path: '/api/apm/services/{serviceName}/transaction_groups',
@@ -71,27 +71,28 @@ export const transactionGroupsChartsRoute = createRoute(() => ({
const setup = await setupRequest(context, request);
const logger = context.logger;
const { serviceName } = context.params.path;
- const {
- transactionType,
- transactionName,
- uiFilters: uiFiltersJson,
- } = context.params.query;
+ const { transactionType, transactionName } = context.params.query;
- const uiFilters = getParsedUiFilters({ uiFilters: uiFiltersJson, logger });
+ if (!setup.uiFilters.environment) {
+ throw Boom.badRequest(
+ `environment is a required property of the ?uiFilters JSON for transaction_groups/charts.`
+ );
+ }
const searchAggregatedTransactions = await getSearchAggregatedTransactions(
setup
);
- return getTransactionCharts({
+ const options = {
serviceName,
transactionType,
transactionName,
setup,
searchAggregatedTransactions,
logger,
- uiFilters,
- });
+ };
+
+ return getTransactionCharts(options);
},
}));
diff --git a/x-pack/plugins/apm/server/routes/ui_filters.ts b/x-pack/plugins/apm/server/routes/ui_filters.ts
index 936d460102dce..26fe0118c02ed 100644
--- a/x-pack/plugins/apm/server/routes/ui_filters.ts
+++ b/x-pack/plugins/apm/server/routes/ui_filters.ts
@@ -9,13 +9,12 @@ import { omit } from 'lodash';
import {
setupRequest,
Setup,
- SetupUIFilters,
SetupTimeRange,
} from '../lib/helpers/setup_request';
import { getEnvironments } from '../lib/ui_filters/get_environments';
import { Projection } from '../projections/typings';
import { localUIFilterNames } from '../lib/ui_filters/local_ui_filters/config';
-import { getUiFiltersES } from '../lib/helpers/convert_ui_filters/get_ui_filters_es';
+import { getEsFilter } from '../lib/helpers/convert_ui_filters/get_es_filter';
import { getLocalUIFilters } from '../lib/ui_filters/local_ui_filters';
import { getServicesProjection } from '../projections/services';
import { getTransactionGroupsProjection } from '../projections/transaction_groups';
@@ -97,23 +96,23 @@ function createLocalFiltersRoute<
},
handler: async ({ context, request }) => {
const setup = await setupRequest(context, request);
+ const { uiFilters } = setup;
const { query } = context.params;
- const { uiFilters, filterNames } = query;
- const parsedUiFilters = JSON.parse(uiFilters);
+ const { filterNames } = query;
const projection = await getProjection({
query,
context,
setup: {
...setup,
- uiFiltersES: getUiFiltersES(omit(parsedUiFilters, filterNames)),
+ esFilter: getEsFilter(omit(uiFilters, filterNames)),
},
});
return getLocalUIFilters({
projection,
setup,
- uiFilters: parsedUiFilters,
+ uiFilters,
localFilterNames: filterNames,
});
},
@@ -271,6 +270,6 @@ type GetProjection<
context,
}: {
query: t.TypeOf;
- setup: Setup & SetupUIFilters & SetupTimeRange;
+ setup: Setup & SetupTimeRange;
context: APMRequestHandlerContext;
}) => Promise | TProjection;
diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx
index 98c1436b2b9b8..18b990b35b5a5 100644
--- a/x-pack/plugins/apm/server/utils/test_helpers.tsx
+++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx
@@ -9,6 +9,7 @@ import {
ESSearchRequest,
} from '../../typings/elasticsearch';
import { PromiseReturnType } from '../../typings/common';
+import { UIFilters } from '../../typings/ui_filters';
import { APMConfig } from '..';
interface Options {
@@ -23,7 +24,8 @@ interface MockSetup {
apmEventClient: any;
internalClient: any;
config: APMConfig;
- uiFiltersES: ESFilter[];
+ uiFilters: UIFilters;
+ esFilter: ESFilter[];
indices: {
/* eslint-disable @typescript-eslint/naming-convention */
'apm_oss.sourcemapIndices': string;
@@ -78,7 +80,8 @@ export async function inspectSearchParams(
},
}
) as APMConfig,
- uiFiltersES: [{ term: { 'my.custom.ui.filter': 'foo-bar' } }],
+ uiFilters: { environment: 'test' },
+ esFilter: [{ term: { 'service.environment': 'test' } }],
indices: {
/* eslint-disable @typescript-eslint/naming-convention */
'apm_oss.sourcemapIndices': 'myIndex',
diff --git a/x-pack/test/apm_api_integration/basic/tests/feature_controls.ts b/x-pack/test/apm_api_integration/basic/tests/feature_controls.ts
index e0e13b7b7fb98..a2223e5560288 100644
--- a/x-pack/test/apm_api_integration/basic/tests/feature_controls.ts
+++ b/x-pack/test/apm_api_integration/basic/tests/feature_controls.ts
@@ -107,21 +107,21 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
},
{
req: {
- url: `/api/apm/services/foo/transaction_groups/charts?start=${start}&end=${end}&transactionType=bar&uiFilters=%7B%7D`,
+ url: `/api/apm/services/foo/transaction_groups/charts?start=${start}&end=${end}&transactionType=bar&uiFilters=%7B%22environment%22%3A%22testing%22%7D`,
},
expectForbidden: expect404,
expectResponse: expect200,
},
{
req: {
- url: `/api/apm/services/foo/transaction_groups/charts?start=${start}&end=${end}&uiFilters=%7B%7D`,
+ url: `/api/apm/services/foo/transaction_groups/charts?start=${start}&end=${end}&uiFilters=%7B%22environment%22%3A%22testing%22%7D`,
},
expectForbidden: expect404,
expectResponse: expect200,
},
{
req: {
- url: `/api/apm/services/foo/transaction_groups/charts?start=${start}&end=${end}&transactionType=bar&transactionName=baz&uiFilters=%7B%7D`,
+ url: `/api/apm/services/foo/transaction_groups/charts?start=${start}&end=${end}&transactionType=bar&transactionName=baz&uiFilters=%7B%22environment%22%3A%22testing%22%7D`,
},
expectForbidden: expect404,
expectResponse: expect200,
diff --git a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/transaction_charts.ts b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/transaction_charts.ts
index c9581079b9952..d7d6d613281ef 100644
--- a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/transaction_charts.ts
+++ b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/transaction_charts.ts
@@ -19,7 +19,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
// url parameters
const start = encodeURIComponent(metadata.start);
const end = encodeURIComponent(metadata.end);
- const uiFilters = encodeURIComponent(JSON.stringify({}));
+ const uiFilters = encodeURIComponent(JSON.stringify({ environment: 'testing' }));
describe('Transaction charts', () => {
describe('when data is not loaded ', () => {
diff --git a/x-pack/test/apm_api_integration/trial/tests/index.ts b/x-pack/test/apm_api_integration/trial/tests/index.ts
index a6a031def34ea..e609279366390 100644
--- a/x-pack/test/apm_api_integration/trial/tests/index.ts
+++ b/x-pack/test/apm_api_integration/trial/tests/index.ts
@@ -16,6 +16,7 @@ export default function observabilityApiIntegrationTests({ loadTestFile }: FtrPr
describe('Services', function () {
loadTestFile(require.resolve('./services/annotations'));
loadTestFile(require.resolve('./services/top_services.ts'));
+ loadTestFile(require.resolve('./services/transaction_groups_charts'));
});
describe('Settings', function () {
diff --git a/x-pack/test/apm_api_integration/trial/tests/services/__snapshots__/transaction_groups_charts.snap b/x-pack/test/apm_api_integration/trial/tests/services/__snapshots__/transaction_groups_charts.snap
new file mode 100644
index 0000000000000..8169e73202fbc
--- /dev/null
+++ b/x-pack/test/apm_api_integration/trial/tests/services/__snapshots__/transaction_groups_charts.snap
@@ -0,0 +1,43 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`APM Transaction Overview when data is loaded and fetching transaction groups charts with uiFilters when not defined environments selected should return the correct anomaly boundaries 1`] = `Array []`;
+
+exports[`APM Transaction Overview when data is loaded and fetching transaction groups charts with uiFilters with environment selected and empty kuery filter should return a non-empty anomaly series 1`] = `
+Array [
+ Object {
+ "x": 1601389800000,
+ "y": 1206111.33487531,
+ "y0": 10555.1290143587,
+ },
+ Object {
+ "x": 1601390700000,
+ "y": 1223987.49321778,
+ "y0": 10177.4677901726,
+ },
+ Object {
+ "x": 1601391600000,
+ "y": 1223987.49321778,
+ "y0": 10177.4677901726,
+ },
+]
+`;
+
+exports[`APM Transaction Overview when data is loaded and fetching transaction groups charts with uiFilters with environment selected in uiFilters should return a non-empty anomaly series 1`] = `
+Array [
+ Object {
+ "x": 1601389800000,
+ "y": 1206111.33487531,
+ "y0": 10555.1290143587,
+ },
+ Object {
+ "x": 1601390700000,
+ "y": 1223987.49321778,
+ "y0": 10177.4677901726,
+ },
+ Object {
+ "x": 1601391600000,
+ "y": 1223987.49321778,
+ "y0": 10177.4677901726,
+ },
+]
+`;
diff --git a/x-pack/test/apm_api_integration/trial/tests/services/transaction_groups_charts.ts b/x-pack/test/apm_api_integration/trial/tests/services/transaction_groups_charts.ts
new file mode 100644
index 0000000000000..c35dfcc3817a4
--- /dev/null
+++ b/x-pack/test/apm_api_integration/trial/tests/services/transaction_groups_charts.ts
@@ -0,0 +1,161 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import expect from '@kbn/expect';
+import { expectSnapshot } from '../../../common/match_snapshot';
+import { PromiseReturnType } from '../../../../../plugins/apm/typings/common';
+import { FtrProviderContext } from '../../../common/ftr_provider_context';
+import archives_metadata from '../../../common/archives_metadata';
+
+export default function ApiTest({ getService }: FtrProviderContext) {
+ const supertest = getService('supertest');
+ const esArchiver = getService('esArchiver');
+
+ const archiveName = 'apm_8.0.0';
+
+ const range = archives_metadata[archiveName];
+
+ // url parameters
+ const start = encodeURIComponent(range.start);
+ const end = encodeURIComponent(range.end);
+ const transactionType = 'request';
+
+ describe('APM Transaction Overview', () => {
+ describe('when data is loaded', () => {
+ before(() => esArchiver.load(archiveName));
+ after(() => esArchiver.unload(archiveName));
+
+ describe('and fetching transaction groups charts with uiFilters', () => {
+ const serviceName = 'opbeans-java';
+ let response: PromiseReturnType;
+
+ describe('without environment', () => {
+ const uiFilters = encodeURIComponent(JSON.stringify({}));
+ before(async () => {
+ response = await supertest.get(
+ `/api/apm/services/${serviceName}/transaction_groups/charts?start=${start}&end=${end}&transactionType=${transactionType}&uiFilters=${uiFilters}`
+ );
+ });
+ it('should return an error response', () => {
+ expect(response.status).to.eql(400);
+ });
+ });
+
+ describe('without uiFilters', () => {
+ before(async () => {
+ response = await supertest.get(
+ `/api/apm/services/${serviceName}/transaction_groups/charts?start=${start}&end=${end}&transactionType=${transactionType}`
+ );
+ });
+ it('should return an error response', () => {
+ expect(response.status).to.eql(400);
+ });
+ });
+
+ describe('with environment selected in uiFilters', () => {
+ const uiFilters = encodeURIComponent(JSON.stringify({ environment: 'production' }));
+ before(async () => {
+ response = await supertest.get(
+ `/api/apm/services/${serviceName}/transaction_groups/charts?start=${start}&end=${end}&transactionType=${transactionType}&uiFilters=${uiFilters}`
+ );
+ });
+
+ it('should have a successful response', () => {
+ expect(response.status).to.eql(200);
+ });
+
+ it('should return the ML job id for anomalies of the selected environment', () => {
+ expect(response.body).to.have.property('anomalyTimeseries');
+ expect(response.body.anomalyTimeseries).to.have.property('jobId');
+ expectSnapshot(response.body.anomalyTimeseries.jobId).toMatchInline(
+ `"apm-production-229a-high_mean_transaction_duration"`
+ );
+ });
+
+ it('should return a non-empty anomaly series', () => {
+ expect(response.body).to.have.property('anomalyTimeseries');
+ expect(response.body.anomalyTimeseries.anomalyBoundaries?.length).to.be.greaterThan(0);
+ expectSnapshot(response.body.anomalyTimeseries.anomalyBoundaries).toMatch();
+ });
+ });
+
+ describe('when not defined environments selected', () => {
+ const uiFilters = encodeURIComponent(
+ JSON.stringify({ environment: 'ENVIRONMENT_NOT_DEFINED' })
+ );
+ before(async () => {
+ response = await supertest.get(
+ `/api/apm/services/${serviceName}/transaction_groups/charts?start=${start}&end=${end}&transactionType=${transactionType}&uiFilters=${uiFilters}`
+ );
+ });
+
+ it('should have a successful response', () => {
+ expect(response.status).to.eql(200);
+ });
+
+ it('should return the ML job id for anomalies with no defined environment', () => {
+ expect(response.body).to.have.property('anomalyTimeseries');
+ expect(response.body.anomalyTimeseries).to.have.property('jobId');
+ expectSnapshot(response.body.anomalyTimeseries.jobId).toMatchInline(
+ `"apm-environment_not_defined-7ed6-high_mean_transaction_duration"`
+ );
+ });
+
+ it('should return the correct anomaly boundaries', () => {
+ expect(response.body).to.have.property('anomalyTimeseries');
+ expectSnapshot(response.body.anomalyTimeseries.anomalyBoundaries).toMatch();
+ });
+ });
+
+ describe('with all environments selected', () => {
+ const uiFilters = encodeURIComponent(JSON.stringify({ environment: 'ENVIRONMENT_ALL' }));
+ before(async () => {
+ response = await supertest.get(
+ `/api/apm/services/${serviceName}/transaction_groups/charts?start=${start}&end=${end}&transactionType=${transactionType}&uiFilters=${uiFilters}`
+ );
+ });
+
+ it('should have a successful response', () => {
+ expect(response.status).to.eql(200);
+ });
+
+ it('should not return anomaly timeseries data', () => {
+ expect(response.body).to.not.have.property('anomalyTimeseries');
+ });
+ });
+
+ describe('with environment selected and empty kuery filter', () => {
+ const uiFilters = encodeURIComponent(
+ JSON.stringify({ kuery: '', environment: 'production' })
+ );
+ before(async () => {
+ response = await supertest.get(
+ `/api/apm/services/${serviceName}/transaction_groups/charts?start=${start}&end=${end}&transactionType=${transactionType}&uiFilters=${uiFilters}`
+ );
+ });
+
+ it('should have a successful response', () => {
+ expect(response.status).to.eql(200);
+ });
+
+ it('should return the ML job id for anomalies of the selected environment', () => {
+ expect(response.body).to.have.property('anomalyTimeseries');
+ expect(response.body.anomalyTimeseries).to.have.property('jobId');
+ expectSnapshot(response.body.anomalyTimeseries.jobId).toMatchInline(
+ `"apm-production-229a-high_mean_transaction_duration"`
+ );
+ });
+
+ it('should return a non-empty anomaly series', () => {
+ expect(response.body).to.have.property('anomalyTimeseries');
+ expect(response.body.anomalyTimeseries.anomalyBoundaries?.length).to.be.greaterThan(0);
+ expectSnapshot(response.body.anomalyTimeseries.anomalyBoundaries).toMatch();
+ });
+ });
+ });
+ });
+ });
+}
From bd9a9a7a2bf65c465dd805815a2b1a6eea03bc9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Patryk=20Kopyci=C5=84ski?=
Date: Fri, 2 Oct 2020 10:45:53 +0200
Subject: [PATCH 08/56] [Security Solution] Refactor react-beautiful-dnd render
props (#78128)
---
.../timeline/events/all/index.ts | 7 +-
.../common/search_strategy/timeline/index.ts | 18 +-
.../add_filter_to_global_search_bar/index.tsx | 56 +-
.../drag_drop_context_wrapper.tsx | 13 +-
.../drag_and_drop/draggable_wrapper.tsx | 131 +-
.../drag_and_drop/droppable_wrapper.tsx | 33 +-
.../common/components/draggables/index.tsx | 2 +-
.../events_viewer/events_viewer.tsx | 28 +-
.../common/components/events_viewer/mock.ts | 2 +-
.../common/components/ml/entity_draggable.tsx | 67 +-
.../components/ml/score/draggable_score.tsx | 76 +-
.../recent_timelines/recent_timelines.tsx | 160 +-
.../components/flyout/button/index.tsx | 34 +-
.../components/formatted_ip/index.tsx | 157 +-
.../__snapshots__/timeline.test.tsx.snap | 34 +-
.../timeline/auto_save_warning/index.tsx | 121 +-
.../body/column_headers/actions/index.tsx | 29 +-
.../body/column_headers/column_header.tsx | 43 +-
.../timeline/body/column_headers/index.tsx | 29 +-
.../body/events/event_column_view.tsx | 18 +-
.../timeline/body/events/stateful_event.tsx | 228 +-
.../renderers/suricata/suricata_signature.tsx | 82 +-
.../body/renderers/zeek/zeek_signature.tsx | 76 +-
.../data_providers.test.tsx.snap | 5 -
.../__snapshots__/providers.test.tsx.snap | 2243 +++++++++++++----
.../data_providers/data_providers.test.tsx | 27 +-
.../timeline/data_providers/index.tsx | 80 +-
.../data_providers/provider_badge.tsx | 4 +-
.../data_providers/provider_item_badge.tsx | 47 +-
.../data_providers/providers.test.tsx | 264 +-
.../timeline/data_providers/providers.tsx | 460 ++--
.../timelines/components/timeline/events.ts | 32 +-
.../footer/__snapshots__/index.test.tsx.snap | 2 +-
.../components/timeline/footer/index.test.tsx | 39 +-
.../components/timeline/footer/index.tsx | 90 +-
.../header/__snapshots__/index.test.tsx.snap | 5 -
.../components/timeline/header/index.tsx | 27 -
.../timelines/components/timeline/index.tsx | 78 +-
.../timeline/properties/helpers.tsx | 42 +-
.../components/timeline/timeline.test.tsx | 210 --
.../components/timeline/timeline.tsx | 26 +-
.../public/timelines/containers/index.tsx | 20 +-
.../timeline/epic_local_storage.test.tsx | 5 -
.../timelines/store/timeline/helpers.ts | 15 +-
.../timeline/factory/events/all/index.ts | 9 +-
45 files changed, 3039 insertions(+), 2135 deletions(-)
diff --git a/x-pack/plugins/security_solution/common/search_strategy/timeline/events/all/index.ts b/x-pack/plugins/security_solution/common/search_strategy/timeline/events/all/index.ts
index 0503a9c327467..f673fca290a29 100644
--- a/x-pack/plugins/security_solution/common/search_strategy/timeline/events/all/index.ts
+++ b/x-pack/plugins/security_solution/common/search_strategy/timeline/events/all/index.ts
@@ -6,7 +6,7 @@
import { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common';
import { Ecs } from '../../../../ecs';
-import { CursorType, Inspect, Maybe } from '../../../common';
+import { CursorType, Inspect, Maybe, PageInfoPaginated } from '../../../common';
import { TimelineRequestOptionsPaginated } from '../..';
export interface TimelineEdges {
@@ -29,10 +29,7 @@ export interface TimelineNonEcsData {
export interface TimelineEventsAllStrategyResponse extends IEsSearchResponse {
edges: TimelineEdges[];
totalCount: number;
- pageInfo: {
- activePage: number;
- totalPages: number;
- };
+ pageInfo: PageInfoPaginated;
inspect?: Maybe;
}
diff --git a/x-pack/plugins/security_solution/common/search_strategy/timeline/index.ts b/x-pack/plugins/security_solution/common/search_strategy/timeline/index.ts
index 773ee60855886..6b96783adc25a 100644
--- a/x-pack/plugins/security_solution/common/search_strategy/timeline/index.ts
+++ b/x-pack/plugins/security_solution/common/search_strategy/timeline/index.ts
@@ -14,7 +14,13 @@ import {
TimelineEventsLastEventTimeRequestOptions,
TimelineEventsLastEventTimeStrategyResponse,
} from './events';
-import { DocValueFields, TimerangeInput, SortField } from '../common';
+import {
+ DocValueFields,
+ PaginationInput,
+ PaginationInputPaginated,
+ TimerangeInput,
+ SortField,
+} from '../common';
export * from './events';
@@ -29,19 +35,13 @@ export interface TimelineRequestBasicOptions extends IEsSearchRequest {
}
export interface TimelineRequestOptions extends TimelineRequestBasicOptions {
- pagination: {
- activePage: number;
- querySize: number;
- };
+ pagination: PaginationInput;
sort: SortField;
}
export interface TimelineRequestOptionsPaginated
extends TimelineRequestBasicOptions {
- pagination: {
- activePage: number;
- querySize: number;
- };
+ pagination: PaginationInputPaginated;
sort: SortField;
}
diff --git a/x-pack/plugins/security_solution/public/common/components/add_filter_to_global_search_bar/index.tsx b/x-pack/plugins/security_solution/public/common/components/add_filter_to_global_search_bar/index.tsx
index 8a294ec1b71fd..9f273b4f293ba 100644
--- a/x-pack/plugins/security_solution/public/common/components/add_filter_to_global_search_bar/index.tsx
+++ b/x-pack/plugins/security_solution/public/common/components/add_filter_to_global_search_bar/index.tsx
@@ -5,7 +5,7 @@
*/
import { EuiButtonIcon, EuiToolTip } from '@elastic/eui';
-import React, { useCallback } from 'react';
+import React, { useCallback, useMemo } from 'react';
import { Filter } from '../../../../../../../src/plugins/data/public';
import { WithHoverActions } from '../with_hover_actions';
@@ -47,34 +47,36 @@ export const AddFilterToGlobalSearchBar = React.memo(
}
}, [filterManager, filter, onFilterAdded]);
- return (
-
-
-
-
+ const HoverContent = useMemo(
+ () => (
+
+
+
+
-
-
-
-
- }
- render={() => children}
- />
+
+
+
+
+ ),
+ [filterForValue, filterOutValue]
);
+
+ const render = useCallback(() => children, [children]);
+
+ return ;
}
);
diff --git a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/drag_drop_context_wrapper.tsx b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/drag_drop_context_wrapper.tsx
index 74efe2d34fcca..4efb662a4aab6 100644
--- a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/drag_drop_context_wrapper.tsx
+++ b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/drag_drop_context_wrapper.tsx
@@ -9,6 +9,7 @@ import React, { useCallback } from 'react';
import { DropResult, DragDropContext } from 'react-beautiful-dnd';
import { connect, ConnectedProps } from 'react-redux';
import { Dispatch } from 'redux';
+import deepEqual from 'fast-deep-equal';
import { BeforeCapture } from './drag_drop_context';
import { BrowserFields } from '../../containers/source';
@@ -134,13 +135,11 @@ export const DragDropContextWrapperComponent = React.memo
);
},
- (prevProps, nextProps) => {
- return (
- prevProps.children === nextProps.children &&
- prevProps.dataProviders === nextProps.dataProviders &&
- prevProps.activeTimelineDataProviders === nextProps.activeTimelineDataProviders
- ); // prevent re-renders when data providers are added or removed, but all other props are the same
- }
+ // prevent re-renders when data providers are added or removed, but all other props are the same
+ (prevProps, nextProps) =>
+ prevProps.children === nextProps.children &&
+ deepEqual(prevProps.dataProviders, nextProps.dataProviders) &&
+ prevProps.activeTimelineDataProviders === nextProps.activeTimelineDataProviders
);
DragDropContextWrapperComponent.displayName = 'DragDropContextWrapperComponent';
diff --git a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/draggable_wrapper.tsx b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/draggable_wrapper.tsx
index 64f6699d21dac..bd22811612a67 100644
--- a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/draggable_wrapper.tsx
+++ b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/draggable_wrapper.tsx
@@ -196,76 +196,93 @@ const DraggableWrapperComponent: React.FC = ({
]
);
- const renderContent = useCallback(
+ const RenderClone = useCallback(
+ (provided, snapshot) => (
+
+
+
+ {render(dataProvider, provided, snapshot)}
+
+
+
+ ),
+ [dataProvider, registerProvider, render]
+ );
+
+ const DraggableContent = useCallback(
+ (provided, snapshot) => (
+ {
+ provided.innerRef(e);
+ draggableRef.current = e;
+ }}
+ data-test-subj="providerContainer"
+ isDragging={snapshot.isDragging}
+ registerProvider={registerProvider}
+ >
+ {truncate && !snapshot.isDragging ? (
+
+ {render(dataProvider, provided, snapshot)}
+
+ ) : (
+
+ {render(dataProvider, provided, snapshot)}
+
+ )}
+
+ ),
+ [dataProvider, registerProvider, render, truncate]
+ );
+
+ const DroppableContent = useCallback(
+ (droppableProvided) => (
+
+
+ {DraggableContent}
+
+ {droppableProvided.placeholder}
+
+ ),
+ [DraggableContent, dataProvider.id, isDisabled]
+ );
+
+ const content = useMemo(
() => (
(
-
-
-
- {render(dataProvider, provided, snapshot)}
-
-
-
- )}
+ renderClone={RenderClone}
>
- {(droppableProvided) => (
-
-
- {(provided, snapshot) => (
- {
- provided.innerRef(e);
- draggableRef.current = e;
- }}
- data-test-subj="providerContainer"
- isDragging={snapshot.isDragging}
- registerProvider={registerProvider}
- >
- {truncate && !snapshot.isDragging ? (
-
- {render(dataProvider, provided, snapshot)}
-
- ) : (
-
- {render(dataProvider, provided, snapshot)}
-
- )}
-
- )}
-
- {droppableProvided.placeholder}
-
- )}
+ {DroppableContent}
),
- [dataProvider, registerProvider, render, isDisabled, truncate]
+ [DroppableContent, RenderClone, dataProvider.id, isDisabled]
);
- if (isDisabled) return <>{renderContent()}>;
+ const renderContent = useCallback(() => content, [content]);
+
+ if (isDisabled) return <>{content}>;
return (
(
type,
render = null,
renderClone,
- }) => (
-
- {(provided, snapshot) => (
+ }) => {
+ const DroppableContent = useCallback(
+ (provided, snapshot) => (
(
{render == null ? children : render({ isDraggingOver: snapshot.isDraggingOver })}
{provided.placeholder}
- )}
-
- )
+ ),
+ [children, height, render]
+ );
+
+ return (
+
+ {DroppableContent}
+
+ );
+ }
);
DroppableWrapper.displayName = 'DroppableWrapper';
diff --git a/x-pack/plugins/security_solution/public/common/components/draggables/index.tsx b/x-pack/plugins/security_solution/public/common/components/draggables/index.tsx
index 4dc3c6fcbe440..d37de2cd3ec3d 100644
--- a/x-pack/plugins/security_solution/public/common/components/draggables/index.tsx
+++ b/x-pack/plugins/security_solution/public/common/components/draggables/index.tsx
@@ -135,7 +135,7 @@ DefaultDraggable.displayName = 'DefaultDraggable';
export const Badge = styled(EuiBadge)`
vertical-align: top;
-` as any; // eslint-disable-line @typescript-eslint/no-explicit-any
+`;
Badge.displayName = 'Badge';
diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx
index 2c8c8136a4733..7859f5584b0e5 100644
--- a/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx
+++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx
@@ -5,7 +5,7 @@
*/
import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui';
-import { getOr, isEmpty, union } from 'lodash/fp';
+import { isEmpty, union } from 'lodash/fp';
import React, { useEffect, useMemo, useState } from 'react';
import styled from 'styled-components';
import deepEqual from 'fast-deep-equal';
@@ -239,6 +239,19 @@ const EventsViewerComponent: React.FC = ({
events,
]);
+ const HeaderSectionContent = useMemo(
+ () =>
+ headerFilterGroup && (
+
+ {headerFilterGroup}
+
+ ),
+ [graphEventId, headerFilterGroup]
+ );
+
useEffect(() => {
setIsQueryLoading(loading);
}, [loading]);
@@ -257,14 +270,7 @@ const EventsViewerComponent: React.FC = ({
subtitle={utilityBar ? undefined : subtitle}
title={inspect ? justTitle : titleWithExitFullScreen}
>
- {headerFilterGroup && (
-
- {headerFilterGroup}
-
- )}
+ {HeaderSectionContent}
{utilityBar && !resolverIsShowing(graphEventId) && (
{utilityBar?.(refetch, totalCountMinusDeleted)}
@@ -293,7 +299,7 @@ const EventsViewerComponent: React.FC = ({
/** Hide the footer if Resolver is showing. */
!graphEventId && (
= ({
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadPage}
serverSideEventCount={totalCountMinusDeleted}
- totalPages={getOr(0, 'totalPages', pageInfo)}
+ totalCount={pageInfo.fakeTotalCount}
/>
)
}
diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/mock.ts b/x-pack/plugins/security_solution/public/common/components/events_viewer/mock.ts
index f6fb01be4371f..d2bd940dcc266 100644
--- a/x-pack/plugins/security_solution/public/common/components/events_viewer/mock.ts
+++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/mock.ts
@@ -8,7 +8,7 @@ export const mockEventViewerResponse = {
totalCount: 12,
pageInfo: {
activePage: 0,
- totalPages: 10,
+ fakeTotalCount: 100,
},
events: [],
};
diff --git a/x-pack/plugins/security_solution/public/common/components/ml/entity_draggable.tsx b/x-pack/plugins/security_solution/public/common/components/ml/entity_draggable.tsx
index 9024aec17400c..1c5b13acb0c22 100644
--- a/x-pack/plugins/security_solution/public/common/components/ml/entity_draggable.tsx
+++ b/x-pack/plugins/security_solution/public/common/components/ml/entity_draggable.tsx
@@ -4,9 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import React from 'react';
+import React, { useCallback, useMemo } from 'react';
import { DraggableWrapper, DragEffects } from '../drag_and_drop/draggable_wrapper';
-import { IS_OPERATOR } from '../../../timelines/components/timeline/data_providers/data_provider';
+import {
+ IS_OPERATOR,
+ QueryOperator,
+} from '../../../timelines/components/timeline/data_providers/data_provider';
import { Provider } from '../../../timelines/components/timeline/data_providers/provider';
import { escapeDataProviderId } from '../drag_and_drop/helpers';
@@ -16,39 +19,43 @@ interface Props {
entityValue: string;
}
-export const EntityDraggableComponent = ({
+export const EntityDraggableComponent: React.FC = ({
idPrefix,
entityName,
entityValue,
-}: Props): JSX.Element => {
+}) => {
const id = escapeDataProviderId(`entity-draggable-${idPrefix}-${entityName}-${entityValue}`);
- return (
-
- snapshot.isDragging ? (
-
-
-
- ) : (
- <>{`${entityName}: "${entityValue}"`}>
- )
- }
- />
+
+ const dataProviderProp = useMemo(
+ () => ({
+ and: [],
+ enabled: true,
+ id,
+ name: entityValue,
+ excluded: false,
+ kqlQuery: '',
+ queryMatch: {
+ field: entityName,
+ value: entityValue,
+ operator: IS_OPERATOR as QueryOperator,
+ },
+ }),
+ [entityName, entityValue, id]
+ );
+
+ const render = useCallback(
+ (dataProvider, _, snapshot) =>
+ snapshot.isDragging ? (
+
+
+
+ ) : (
+ <>{`${entityName}: "${entityValue}"`}>
+ ),
+ [entityName, entityValue]
);
+
+ return ;
};
EntityDraggableComponent.displayName = 'EntityDraggableComponent';
diff --git a/x-pack/plugins/security_solution/public/common/components/ml/score/draggable_score.tsx b/x-pack/plugins/security_solution/public/common/components/ml/score/draggable_score.tsx
index c849476f0c3db..668a374e57f0d 100644
--- a/x-pack/plugins/security_solution/public/common/components/ml/score/draggable_score.tsx
+++ b/x-pack/plugins/security_solution/public/common/components/ml/score/draggable_score.tsx
@@ -4,10 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import React from 'react';
+import React, { useCallback, useMemo } from 'react';
import { DraggableWrapper, DragEffects } from '../../drag_and_drop/draggable_wrapper';
import { Anomaly } from '../types';
-import { IS_OPERATOR } from '../../../../timelines/components/timeline/data_providers/data_provider';
+import {
+ IS_OPERATOR,
+ QueryOperator,
+} from '../../../../timelines/components/timeline/data_providers/data_provider';
import { Provider } from '../../../../timelines/components/timeline/data_providers/provider';
import { Spacer } from '../../page';
import { getScoreString } from './score_health';
@@ -23,39 +26,48 @@ export const DraggableScoreComponent = ({
}): JSX.Element => {
const scoreString = getScoreString(score.severity);
+ const dataProviderProp = useMemo(
+ () => ({
+ and: [],
+ enabled: true,
+ id,
+ name: score.entityName,
+ excluded: false,
+ kqlQuery: '',
+ queryMatch: {
+ field: score.entityName,
+ value: score.entityValue,
+ operator: IS_OPERATOR as QueryOperator,
+ },
+ }),
+ [id, score.entityName, score.entityValue]
+ );
+
+ const render = useCallback(
+ (dataProvider, _, snapshot) =>
+ snapshot.isDragging ? (
+
+
+
+ ) : (
+ <>
+ {index !== 0 && (
+ <>
+ {','}
+
+ >
+ )}
+ {scoreString}
+ >
+ ),
+ [index, scoreString]
+ );
+
return (
- snapshot.isDragging ? (
-
-
-
- ) : (
- <>
- {index !== 0 && (
- <>
- {','}
-
- >
- )}
- {scoreString}
- >
- )
- }
+ dataProvider={dataProviderProp}
+ render={render}
/>
);
};
diff --git a/x-pack/plugins/security_solution/public/overview/components/recent_timelines/recent_timelines.tsx b/x-pack/plugins/security_solution/public/overview/components/recent_timelines/recent_timelines.tsx
index ddad72081645b..598849c917d33 100644
--- a/x-pack/plugins/security_solution/public/overview/components/recent_timelines/recent_timelines.tsx
+++ b/x-pack/plugins/security_solution/public/overview/components/recent_timelines/recent_timelines.tsx
@@ -12,7 +12,7 @@ import {
EuiToolTip,
EuiButtonIcon,
} from '@elastic/eui';
-import React from 'react';
+import React, { useCallback, useMemo } from 'react';
import { RecentTimelineHeader } from './header';
import {
@@ -25,76 +25,110 @@ import { TimelineType } from '../../../../common/types/timeline';
import { RecentTimelineCounts } from './counts';
import * as i18n from './translations';
-export const RecentTimelines = React.memo<{
- noTimelinesMessage: string;
+interface RecentTimelinesItemProps {
+ timeline: OpenTimelineResult;
onOpenTimeline: OnOpenTimeline;
- timelines: OpenTimelineResult[];
-}>(({ noTimelinesMessage, onOpenTimeline, timelines }) => {
- if (timelines.length === 0) {
+ isLastItem: boolean;
+}
+
+const RecentTimelinesItem = React.memo(
+ ({ timeline, onOpenTimeline, isLastItem }) => {
+ const handleClick = useCallback(
+ () =>
+ onOpenTimeline({
+ duplicate: true,
+ timelineId: `${timeline.savedObjectId}`,
+ }),
+ [onOpenTimeline, timeline.savedObjectId]
+ );
+
+ const render = useCallback(
+ (showHoverContent) => (
+
+
+
+
+ {timeline.description && timeline.description.length && (
+
+ {timeline.description}
+
+ )}
+
+
+ {showHoverContent && (
+
+
+
+
+
+ )}
+
+ ),
+ [handleClick, onOpenTimeline, timeline]
+ );
+
return (
<>
-
- {noTimelinesMessage}
-
+
+ <>{!isLastItem && }>
>
);
}
+);
- return (
- <>
- {timelines.map((t, i) => (
-
- (
-
-
-
-
- {t.description && t.description.length && (
-
- {t.description}
-
- )}
-
+RecentTimelinesItem.displayName = 'RecentTimelinesItem';
- {showHoverContent && (
-
-
-
- onOpenTimeline({
- duplicate: true,
- timelineId: `${t.savedObjectId}`,
- })
- }
- size="s"
- />
-
-
- )}
-
- )}
+interface RecentTimelinesProps {
+ noTimelinesMessage: string;
+ onOpenTimeline: OnOpenTimeline;
+ timelines: OpenTimelineResult[];
+}
+
+export const RecentTimelines = React.memo(
+ ({ noTimelinesMessage, onOpenTimeline, timelines }) => {
+ const content = useMemo(
+ () =>
+ timelines.map((timeline, index) => (
+
- <>{i !== timelines.length - 1 && }>
-
- ))}
- >
- );
-});
+ )),
+ [onOpenTimeline, timelines]
+ );
+
+ if (timelines.length === 0) {
+ return (
+ <>
+
+ {noTimelinesMessage}
+
+ >
+ );
+ }
+
+ return <>{content}>;
+ }
+);
RecentTimelines.displayName = 'RecentTimelines';
diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/button/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/flyout/button/index.tsx
index 954ae0b6a0d40..72fa20c9f152d 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/flyout/button/index.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/button/index.tsx
@@ -4,11 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { noop } from 'lodash/fp';
import { EuiButton, EuiNotificationBadge, EuiPanel } from '@elastic/eui';
import { rgba } from 'polished';
import React, { useMemo } from 'react';
import styled from 'styled-components';
+import deepEqual from 'fast-deep-equal';
import { IS_DRAGGING_CLASS_NAME } from '../../../../common/components/drag_and_drop/helpers';
import { DataProvider } from '../../timeline/data_providers/data_provider';
@@ -88,6 +88,18 @@ export const FlyoutButton = React.memo(
const badgeCount = useMemo(() => getBadgeCount(dataProviders), [dataProviders]);
const { browserFields } = useSourcererScope(SourcererScopeName.timeline);
+ const badgeStyles: React.CSSProperties = useMemo(
+ () => ({
+ left: '-9px',
+ position: 'relative',
+ top: '-6px',
+ transform: 'rotate(90deg)',
+ visibility: dataProviders.length !== 0 ? 'inherit' : 'hidden',
+ zIndex: 10,
+ }),
+ [dataProviders.length]
+ );
+
if (!show) {
return null;
}
@@ -108,18 +120,7 @@ export const FlyoutButton = React.memo(
>
{i18n.FLYOUT_BUTTON}
-
+
{badgeCount}
@@ -128,11 +129,6 @@ export const FlyoutButton = React.memo(
browserFields={browserFields}
timelineId={timelineId}
dataProviders={dataProviders}
- onDataProviderEdited={noop}
- onDataProviderRemoved={noop}
- onToggleDataProviderEnabled={noop}
- onToggleDataProviderExcluded={noop}
- onToggleDataProviderType={noop}
/>
@@ -140,7 +136,7 @@ export const FlyoutButton = React.memo(
},
(prevProps, nextProps) =>
prevProps.show === nextProps.show &&
- prevProps.dataProviders === nextProps.dataProviders &&
+ deepEqual(prevProps.dataProviders, nextProps.dataProviders) &&
prevProps.timelineId === nextProps.timelineId
);
diff --git a/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.tsx
index e4148b5581435..091bb41bc2080 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.tsx
@@ -5,7 +5,7 @@
*/
import { isArray, isEmpty, isString, uniq } from 'lodash/fp';
-import React from 'react';
+import React, { useCallback, useMemo } from 'react';
import {
DragEffects,
@@ -71,16 +71,25 @@ const NonDecoratedIpComponent: React.FC<{
fieldName: string;
truncate?: boolean;
value: string | object | null | undefined;
-}> = ({ contextId, eventId, fieldName, truncate, value }) => (
-
+}> = ({ contextId, eventId, fieldName, truncate, value }) => {
+ const key = useMemo(
+ () =>
+ `non-decorated-ip-draggable-wrapper-${getUniqueId({
+ contextId,
+ eventId,
+ fieldName,
+ address: value,
+ })}`,
+ [contextId, eventId, fieldName, value]
+ );
+
+ const dataProviderProp = useMemo(
+ () => getDataProvider({ contextId, eventId, fieldName, address: value }),
+ [contextId, eventId, fieldName, value]
+ );
+
+ const render = useCallback(
+ (dataProvider, _, snapshot) =>
snapshot.isDragging ? (
@@ -89,47 +98,107 @@ const NonDecoratedIpComponent: React.FC<{
getOrEmptyTagFromValue(value)
) : (
getOrEmptyTagFromValue(tryStringify(value))
- )
- }
- truncate={truncate}
- />
-);
+ ),
+ [value]
+ );
+
+ return (
+
+ );
+};
const NonDecoratedIp = React.memo(NonDecoratedIpComponent);
-const AddressLinksComponent: React.FC<{
+interface AddressLinksItemProps extends Omit {
+ address: string;
+}
+
+const AddressLinksItemComponent: React.FC = ({
+ address,
+ contextId,
+ eventId,
+ fieldName,
+ truncate,
+}) => {
+ const key = useMemo(
+ () =>
+ `address-links-draggable-wrapper-${getUniqueId({
+ contextId,
+ eventId,
+ fieldName,
+ address,
+ })}`,
+ [address, contextId, eventId, fieldName]
+ );
+
+ const dataProviderProp = useMemo(
+ () => getDataProvider({ contextId, eventId, fieldName, address }),
+ [address, contextId, eventId, fieldName]
+ );
+
+ const render = useCallback(
+ (_props, _provided, snapshot) =>
+ snapshot.isDragging ? (
+
+
+
+ ) : (
+
+ ),
+ [address, dataProviderProp]
+ );
+
+ return (
+
+ );
+};
+
+const AddressLinksItem = React.memo(AddressLinksItemComponent);
+
+interface AddressLinksProps {
addresses: string[];
contextId: string;
eventId: string;
fieldName: string;
truncate?: boolean;
-}> = ({ addresses, contextId, eventId, fieldName, truncate }) => (
- <>
- {uniq(addresses).map((address) => (
-
- snapshot.isDragging ? (
-
-
-
- ) : (
-
- )
- }
- truncate={truncate}
- />
- ))}
- >
-);
+}
+
+const AddressLinksComponent: React.FC = ({
+ addresses,
+ contextId,
+ eventId,
+ fieldName,
+ truncate,
+}) => {
+ const uniqAddresses = useMemo(() => uniq(addresses), [addresses]);
+
+ const content = useMemo(
+ () =>
+ uniqAddresses.map((address) => (
+
+ )),
+ [contextId, eventId, fieldName, truncate, uniqAddresses]
+ );
+
+ return <>{content}>;
+};
const AddressLinks = React.memo(AddressLinksComponent);
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/__snapshots__/timeline.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/__snapshots__/timeline.test.tsx.snap
index 18a648f2abfaa..153128fb41826 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/__snapshots__/timeline.test.tsx.snap
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/__snapshots__/timeline.test.tsx.snap
@@ -646,34 +646,7 @@ In other use cases the message field can be used to concatenate different values
dataProviders={
Array [
Object {
- "and": Array [
- Object {
- "and": Array [],
- "enabled": true,
- "excluded": false,
- "id": "id-Provider 2",
- "kqlQuery": "",
- "name": "Provider 2",
- "queryMatch": Object {
- "field": "name",
- "operator": ":",
- "value": "Provider 2",
- },
- },
- Object {
- "and": Array [],
- "enabled": true,
- "excluded": false,
- "id": "id-Provider 3",
- "kqlQuery": "",
- "name": "Provider 3",
- "queryMatch": Object {
- "field": "name",
- "operator": ":",
- "value": "Provider 3",
- },
- },
- ],
+ "and": Array [],
"enabled": true,
"excluded": false,
"id": "id-Provider 1",
@@ -921,11 +894,6 @@ In other use cases the message field can be used to concatenate different values
loadingSourcerer={false}
onChangeItemsPerPage={[MockFunction]}
onClose={[MockFunction]}
- onDataProviderEdited={[MockFunction]}
- onDataProviderRemoved={[MockFunction]}
- onToggleDataProviderEnabled={[MockFunction]}
- onToggleDataProviderExcluded={[MockFunction]}
- onToggleDataProviderType={[MockFunction]}
show={true}
showCallOutUnauthorizedMsg={false}
sort={
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/auto_save_warning/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/auto_save_warning/index.tsx
index 210af7a571569..98faa84db851e 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/auto_save_warning/index.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/auto_save_warning/index.tsx
@@ -11,84 +11,69 @@ import {
EuiGlobalToastListToast as Toast,
} from '@elastic/eui';
import { getOr } from 'lodash/fp';
-import React from 'react';
-import { connect, ConnectedProps } from 'react-redux';
+import React, { useCallback, useMemo } from 'react';
+import { useDispatch, useSelector, shallowEqual } from 'react-redux';
-import { State } from '../../../../common/store';
-import { setTimelineRangeDatePicker as dispatchSetTimelineRangeDatePicker } from '../../../../common/store/inputs/actions';
+import { setTimelineRangeDatePicker } from '../../../../common/store/inputs/actions';
import { timelineActions, timelineSelectors } from '../../../store/timeline';
-import { AutoSavedWarningMsg } from '../../../store/timeline/types';
import { useStateToaster } from '../../../../common/components/toasters';
import * as i18n from './translations';
-const AutoSaveWarningMsgComponent = React.memo(
- ({
- newTimelineModel,
- setTimelineRangeDatePicker,
- timelineId,
- updateAutoSaveMsg,
- updateTimeline,
- }) => {
- const dispatchToaster = useStateToaster()[1];
+const AutoSaveWarningMsgComponent = () => {
+ const dispatch = useDispatch();
+ const dispatchToaster = useStateToaster()[1];
+ const { timelineId, newTimelineModel } = useSelector(
+ timelineSelectors.autoSaveMsgSelector,
+ shallowEqual
+ );
+
+ const handleClick = useCallback(() => {
if (timelineId != null && newTimelineModel != null) {
- const toast: Toast = {
- id: 'AutoSaveWarningMsg',
- title: i18n.TITLE,
- color: 'warning',
- iconType: 'alert',
- toastLifeTimeMs: 10000,
- text: (
- <>
- {i18n.DESCRIPTION}
-
-
- {
- updateTimeline({ id: timelineId, timeline: newTimelineModel });
- updateAutoSaveMsg({ timelineId: null, newTimelineModel: null });
- setTimelineRangeDatePicker({
- from: getOr(0, 'dateRange.start', newTimelineModel),
- to: getOr(0, 'dateRange.end', newTimelineModel),
- });
- }}
- >
- {i18n.REFRESH_TIMELINE}
-
-
-
- >
- ),
- };
- dispatchToaster({
- type: 'addToaster',
- toast,
- });
+ dispatch(timelineActions.updateTimeline({ id: timelineId, timeline: newTimelineModel }));
+ dispatch(timelineActions.updateAutoSaveMsg({ timelineId: null, newTimelineModel: null }));
+ dispatch(
+ setTimelineRangeDatePicker({
+ from: getOr(0, 'dateRange.start', newTimelineModel),
+ to: getOr(0, 'dateRange.end', newTimelineModel),
+ })
+ );
}
+ }, [dispatch, newTimelineModel, timelineId]);
- return null;
- }
-);
-
-AutoSaveWarningMsgComponent.displayName = 'AutoSaveWarningMsgComponent';
-
-const mapStateToProps = (state: State) => {
- const autoSaveMessage: AutoSavedWarningMsg = timelineSelectors.autoSaveMsgSelector(state);
+ const TextComponent = useMemo(
+ () => (
+ <>
+ {i18n.DESCRIPTION}
+
+
+
+ {i18n.REFRESH_TIMELINE}
+
+
+
+ >
+ ),
+ [handleClick]
+ );
- return {
- timelineId: autoSaveMessage.timelineId,
- newTimelineModel: autoSaveMessage.newTimelineModel,
- };
-};
+ if (timelineId != null && newTimelineModel != null) {
+ const toast: Toast = {
+ id: 'AutoSaveWarningMsg',
+ title: i18n.TITLE,
+ color: 'warning',
+ iconType: 'alert',
+ toastLifeTimeMs: 10000,
+ text: TextComponent,
+ };
+ dispatchToaster({
+ type: 'addToaster',
+ toast,
+ });
+ }
-const mapDispatchToProps = {
- setTimelineRangeDatePicker: dispatchSetTimelineRangeDatePicker,
- updateAutoSaveMsg: timelineActions.updateAutoSaveMsg,
- updateTimeline: timelineActions.updateTimeline,
+ return null;
};
-const connector = connect(mapStateToProps, mapDispatchToProps);
-
-type PropsFromRedux = ConnectedProps;
+AutoSaveWarningMsgComponent.displayName = 'AutoSaveWarningMsgComponent';
-export const AutoSaveWarningMsg = connector(AutoSaveWarningMsgComponent);
+export const AutoSaveWarningMsg = React.memo(AutoSaveWarningMsgComponent);
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/actions/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/actions/index.tsx
index 3352639fa95f8..c4c4e0e0c7065 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/actions/index.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/actions/index.tsx
@@ -5,7 +5,7 @@
*/
import { EuiButtonIcon } from '@elastic/eui';
-import React from 'react';
+import React, { useCallback } from 'react';
import { ColumnHeaderOptions } from '../../../../../../timelines/store/timeline/model';
import { OnColumnRemoved } from '../../../events';
@@ -26,20 +26,27 @@ interface Props {
export const CloseButton = React.memo<{
columnId: string;
onColumnRemoved: OnColumnRemoved;
-}>(({ columnId, onColumnRemoved }) => (
- ) => {
+}>(({ columnId, onColumnRemoved }) => {
+ const handleClick = useCallback(
+ (event: React.MouseEvent) => {
// To avoid a re-sorting when you delete a column
event.preventDefault();
event.stopPropagation();
onColumnRemoved(columnId);
- }}
- />
-));
+ },
+ [columnId, onColumnRemoved]
+ );
+
+ return (
+
+ );
+});
CloseButton.displayName = 'CloseButton';
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx
index 617b2935ee75c..6e21446944573 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx
@@ -78,6 +78,29 @@ const ColumnHeaderComponent: React.FC = ({
[timelineId, header.id]
);
+ const DraggableContent = useCallback(
+ (dragProvided) => (
+
+
+
+
+
+ ),
+ [header, onColumnRemoved, onColumnSorted, onFilterChange, sort, timelineId]
+ );
+
return (
= ({
index={draggableIndex}
key={header.id}
>
- {(dragProvided) => (
-
-
-
-
-
- )}
+ {DraggableContent}
);
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx
index 6e802053ab29f..f4d4cf29ba38b 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx
@@ -200,6 +200,22 @@ export const ColumnHeadersComponent = ({
[globalFullScreen, timelineId, timelineFullScreen]
);
+ const DroppableContent = useCallback(
+ (dropProvided, snapshot) => (
+ <>
+
+ {ColumnHeaderList}
+
+ >
+ ),
+ [ColumnHeaderList]
+ );
+
return (
@@ -275,18 +291,7 @@ export const ColumnHeadersComponent = ({
type={DRAG_TYPE_FIELD}
renderClone={renderClone}
>
- {(dropProvided, snapshot) => (
- <>
-
- {ColumnHeaderList}
-
- >
- )}
+ {DroppableContent}
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/event_column_view.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/event_column_view.tsx
index 3b6585013c8d3..df5c48ad012a6 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/event_column_view.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/event_column_view.tsx
@@ -151,13 +151,17 @@ export const EventColumnView = React.memo(
/>,
]
: []),
- ,
+ ...(eventType !== 'raw'
+ ? [
+ ,
+ ]
+ : []),
],
[
associateNote,
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/stateful_event.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/stateful_event.tsx
index d71af86c80247..ee68c270e9aba 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/stateful_event.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/stateful_event.tsx
@@ -97,6 +97,8 @@ const TOP_OFFSET = 50;
*/
const BOTTOM_OFFSET = -500;
+const VISIBILITY_SENSOR_OFFSET = { top: TOP_OFFSET, bottom: BOTTOM_OFFSET };
+
const emptyNotes: string[] = [];
const EventsTrSupplementContainerWrapper = React.memo(({ children }) => {
@@ -173,105 +175,145 @@ const StatefulEventComponent: React.FC = ({
// Number of current columns plus one for actions.
const columnCount = columnHeaders.length + 1;
+ const VisibilitySensorContent = useCallback(
+ ({ isVisible }) => {
+ if (isVisible || disableSensorVisibility) {
+ return (
+
+
+
+
+
+
+
+
+ {getRowRenderer(event.ecs, rowRenderers).renderRow({
+ browserFields,
+ data: event.ecs,
+ timelineId,
+ })}
+
+
+
+
+
+
+ );
+ } else {
+ // Height place holder for visibility detection as well as re-rendering sections.
+ const height =
+ divElement.current != null && divElement.current!.clientHeight
+ ? `${divElement.current!.clientHeight}px`
+ : DEFAULT_ROW_HEIGHT;
+
+ return ;
+ }
+ },
+ [
+ actionsColumnWidth,
+ associateNote,
+ browserFields,
+ columnCount,
+ columnHeaders,
+ columnRenderers,
+ detailsData,
+ disableSensorVisibility,
+ event._id,
+ event.data,
+ event.ecs,
+ eventIdToNoteIds,
+ expanded,
+ getNotesByIds,
+ isEventPinned,
+ isEventViewer,
+ loading,
+ loadingEventIds,
+ onColumnResized,
+ onPinEvent,
+ onRowSelected,
+ onToggleExpanded,
+ onToggleShowNotes,
+ onUnPinEvent,
+ onUpdateColumns,
+ refetch,
+ rowRenderers,
+ selectedEventIds,
+ showCheckboxes,
+ showNotes,
+ timelineId,
+ timelineStatus,
+ toggleColumn,
+ updateNote,
+ ]
+ );
+
return (
- {({ isVisible }) => {
- if (isVisible || disableSensorVisibility) {
- return (
-
-
-
-
-
-
-
-
- {getRowRenderer(event.ecs, rowRenderers).renderRow({
- browserFields,
- data: event.ecs,
- timelineId,
- })}
-
-
-
-
-
-
- );
- } else {
- // Height place holder for visibility detection as well as re-rendering sections.
- const height =
- divElement.current != null && divElement.current!.clientHeight
- ? `${divElement.current!.clientHeight}px`
- : DEFAULT_ROW_HEIGHT;
-
- return ;
- }
- }}
+ {VisibilitySensorContent}
);
};
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_signature.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_signature.tsx
index 1cd78178d017f..5d4821757d774 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_signature.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_signature.tsx
@@ -5,7 +5,7 @@
*/
import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
-import React from 'react';
+import React, { useCallback, useMemo } from 'react';
import styled from 'styled-components';
import {
@@ -19,7 +19,7 @@ import { Provider } from '../../../data_providers/provider';
import { TokensFlexItem } from '../helpers';
import { getBeginningTokens } from './suricata_links';
import { DefaultDraggable } from '../../../../../../common/components/draggables';
-import { IS_OPERATOR } from '../../../data_providers/data_provider';
+import { IS_OPERATOR, QueryOperator } from '../../../data_providers/data_provider';
export const SURICATA_SIGNATURE_FIELD_NAME = 'suricata.eve.alert.signature';
export const SURICATA_SIGNATURE_ID_FIELD_NAME = 'suricata.eve.alert.signature_id';
@@ -57,41 +57,49 @@ export const Tokens = React.memo<{ tokens: string[] }>(({ tokens }) => (
Tokens.displayName = 'Tokens';
export const DraggableSignatureId = React.memo<{ id: string; signatureId: number }>(
- ({ id, signatureId }) => (
-
-
- snapshot.isDragging ? (
-
-
-
- ) : (
-
-
- {signatureId}
-
-
- )
- }
- />
-
- )
+ ({ id, signatureId }) => {
+ const dataProviderProp = useMemo(
+ () => ({
+ and: [],
+ enabled: true,
+ id: escapeDataProviderId(`suricata-draggable-signature-id-${id}-sig-${signatureId}`),
+ name: String(signatureId),
+ excluded: false,
+ kqlQuery: '',
+ queryMatch: {
+ field: SURICATA_SIGNATURE_ID_FIELD_NAME,
+ value: signatureId,
+ operator: IS_OPERATOR as QueryOperator,
+ },
+ }),
+ [id, signatureId]
+ );
+
+ const render = useCallback(
+ (dataProvider, _, snapshot) =>
+ snapshot.isDragging ? (
+
+
+
+ ) : (
+
+
+ {signatureId}
+
+
+ ),
+ [signatureId]
+ );
+
+ return (
+
+
+
+ );
+ }
);
DraggableSignatureId.displayName = 'DraggableSignatureId';
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_signature.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_signature.tsx
index 07e32a9a4e5d1..9ef579706f118 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_signature.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_signature.tsx
@@ -6,7 +6,7 @@
import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
import { get } from 'lodash/fp';
-import React from 'react';
+import React, { useCallback, useMemo } from 'react';
import styled from 'styled-components';
import { Ecs } from '../../../../../../../common/ecs';
@@ -17,7 +17,7 @@ import {
import { escapeDataProviderId } from '../../../../../../common/components/drag_and_drop/helpers';
import { GoogleLink, ReputationLink } from '../../../../../../common/components/links';
import { Provider } from '../../../data_providers/provider';
-import { IS_OPERATOR } from '../../../data_providers/data_provider';
+import { IS_OPERATOR, QueryOperator } from '../../../data_providers/data_provider';
import * as i18n from './translations';
@@ -68,42 +68,46 @@ export const DraggableZeekElement = React.memo<{
field: string;
value: string | null | undefined;
stringRenderer?: StringRenderer;
-}>(({ id, field, value, stringRenderer = defaultStringRenderer }) =>
- value != null ? (
+}>(({ id, field, value, stringRenderer = defaultStringRenderer }) => {
+ const dataProviderProp = useMemo(
+ () => ({
+ and: [],
+ enabled: true,
+ id: escapeDataProviderId(`draggable-zeek-element-draggable-wrapper-${id}-${field}-${value}`),
+ name: value!,
+ excluded: false,
+ kqlQuery: '',
+ queryMatch: {
+ field,
+ value: value!,
+ operator: IS_OPERATOR as QueryOperator,
+ },
+ }),
+ [field, id, value]
+ );
+
+ const render = useCallback(
+ (dataProvider, _, snapshot) =>
+ snapshot.isDragging ? (
+
+
+
+ ) : (
+
+
+ {stringRenderer(value!)}
+
+
+ ),
+ [field, stringRenderer, value]
+ );
+
+ return value != null ? (
-
- snapshot.isDragging ? (
-
-
-
- ) : (
-
-
- {stringRenderer(value)}
-
-
- )
- }
- />
+
- ) : null
-);
+ ) : null;
+});
DraggableZeekElement.displayName = 'DraggableZeekElement';
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/__snapshots__/data_providers.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/__snapshots__/data_providers.test.tsx.snap
index 14304b99263ac..a8818517fb94b 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/__snapshots__/data_providers.test.tsx.snap
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/__snapshots__/data_providers.test.tsx.snap
@@ -144,11 +144,6 @@ exports[`DataProviders rendering renders correctly against snapshot 1`] = `
},
]
}
- onDataProviderEdited={[MockFunction]}
- onDataProviderRemoved={[MockFunction]}
- onToggleDataProviderEnabled={[MockFunction]}
- onToggleDataProviderExcluded={[MockFunction]}
- onToggleDataProviderType={[MockFunction]}
timelineId="foo"
/>
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/__snapshots__/providers.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/__snapshots__/providers.test.tsx.snap
index a86c99cbc094a..281a26b08df67 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/__snapshots__/providers.test.tsx.snap
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/__snapshots__/providers.test.tsx.snap
@@ -2,556 +2,1717 @@
exports[`Providers rendering renders correctly against snapshot 1`] = `
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
+
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
- )
-
-
-
-
`;
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/data_providers.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/data_providers.test.tsx
index d48be25b08897..a7ae14dea510f 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/data_providers.test.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/data_providers.test.tsx
@@ -41,11 +41,6 @@ describe('DataProviders', () => {
data-test-subj="dataProviders-container"
dataProviders={mockDataProviders}
timelineId="foo"
- onDataProviderEdited={jest.fn()}
- onDataProviderRemoved={jest.fn()}
- onToggleDataProviderEnabled={jest.fn()}
- onToggleDataProviderExcluded={jest.fn()}
- onToggleDataProviderType={jest.fn()}
/>
@@ -58,16 +53,7 @@ describe('DataProviders', () => {
const wrapper = mount(
-
+
);
@@ -77,16 +63,7 @@ describe('DataProviders', () => {
test('it renders the data providers', () => {
const wrapper = mount(
-
+
);
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/index.tsx
index c9e06f89af41c..b892ca089eb4c 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/index.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/index.tsx
@@ -14,13 +14,6 @@ import {
droppableTimelineProvidersPrefix,
IS_DRAGGING_CLASS_NAME,
} from '../../../../common/components/drag_and_drop/helpers';
-import {
- OnDataProviderEdited,
- OnDataProviderRemoved,
- OnToggleDataProviderEnabled,
- OnToggleDataProviderExcluded,
- OnToggleDataProviderType,
-} from '../events';
import { DataProvider } from './data_provider';
import { Empty } from './empty';
@@ -31,11 +24,6 @@ interface Props {
browserFields: BrowserFields;
timelineId: string;
dataProviders: DataProvider[];
- onDataProviderEdited: OnDataProviderEdited;
- onDataProviderRemoved: OnDataProviderRemoved;
- onToggleDataProviderEnabled: OnToggleDataProviderEnabled;
- onToggleDataProviderExcluded: OnToggleDataProviderExcluded;
- onToggleDataProviderType: OnToggleDataProviderType;
}
const DropTargetDataProvidersContainer = styled.div`
@@ -91,48 +79,32 @@ const getDroppableId = (id: string): string => `${droppableTimelineProvidersPref
* the user to drop anything with a facet count into
* the data pro section.
*/
-export const DataProviders = React.memo(
- ({
- browserFields,
- dataProviders,
+export const DataProviders = React.memo(({ browserFields, dataProviders, timelineId }) => {
+ const { getManageTimelineById } = useManageTimeline();
+ const isLoading = useMemo(() => getManageTimelineById(timelineId).isLoading, [
+ getManageTimelineById,
timelineId,
- onDataProviderEdited,
- onDataProviderRemoved,
- onToggleDataProviderEnabled,
- onToggleDataProviderExcluded,
- onToggleDataProviderType,
- }) => {
- const { getManageTimelineById } = useManageTimeline();
- const isLoading = useMemo(() => getManageTimelineById(timelineId).isLoading, [
- getManageTimelineById,
- timelineId,
- ]);
- return (
-
-
- {dataProviders != null && dataProviders.length ? (
-
- ) : (
-
-
-
- )}
-
-
- );
- }
-);
+ ]);
+ return (
+
+
+ {dataProviders != null && dataProviders.length ? (
+
+ ) : (
+
+
+
+ )}
+
+
+ );
+});
DataProviders.displayName = 'DataProviders';
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_badge.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_badge.tsx
index bf2094e7659ee..b66a332fc977d 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_badge.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_badge.tsx
@@ -91,7 +91,7 @@ const ConvertFieldBadge = styled(ProviderFieldBadge)`
}
`;
-const TemplateFieldBadge: React.FC = ({ type, toggleType }) => {
+const TemplateFieldBadgeComponent: React.FC = ({ type, toggleType }) => {
if (type !== DataProviderType.template) {
return (
{i18n.CONVERT_TO_TEMPLATE_FIELD}
@@ -101,6 +101,8 @@ const TemplateFieldBadge: React.FC = ({ type, toggleTyp
return {i18n.TEMPLATE_FIELD_LABEL} ;
};
+const TemplateFieldBadge = React.memo(TemplateFieldBadgeComponent);
+
interface ProviderBadgeProps {
deleteProvider: () => void;
field: string;
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_item_badge.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_item_badge.tsx
index 0093c43a17137..fc06d37b9663f 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_item_badge.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_item_badge.tsx
@@ -117,21 +117,38 @@ export const ProviderItemBadge = React.memo(
[unRegisterProvider]
);
- const button = (
-
+ const button = useMemo(
+ () => (
+
+ ),
+ [
+ deleteProvider,
+ field,
+ isEnabled,
+ isExcluded,
+ isLoading,
+ kqlQuery,
+ onToggleTypeProvider,
+ operator,
+ providerId,
+ timelineType,
+ togglePopover,
+ type,
+ val,
+ ]
);
return (
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.test.tsx
index 3f371349aa750..2df19605f813c 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.test.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.test.tsx
@@ -12,6 +12,7 @@ import { TestProviders } from '../../../../common/mock/test_providers';
import { DroppableWrapper } from '../../../../common/components/drag_and_drop/droppable_wrapper';
import { FilterManager } from '../../../../../../../../src/plugins/data/public';
+import { timelineActions } from '../../../store/timeline';
import { mockDataProviders } from './mock/mock_data_providers';
import { Providers } from './providers';
import { DELETE_CLASS_NAME, ENABLE_CLASS_NAME, EXCLUDE_CLASS_NAME } from './provider_item_actions';
@@ -24,27 +25,24 @@ describe('Providers', () => {
const isLoading: boolean = true;
const mount = useMountAppended();
const filterManager = new FilterManager(mockUiSettingsForFilterManager);
+ const mockOnDataProviderRemoved = jest.spyOn(timelineActions, 'removeProvider');
const manageTimelineForTesting = {
- foo: {
- ...getTimelineDefaults('foo'),
+ test: {
+ ...getTimelineDefaults('test'),
filterManager,
isLoading,
},
};
+
+ beforeEach(() => {
+ jest.clearAllMocks();
+ });
+
describe('rendering', () => {
test('renders correctly against snapshot', () => {
const wrapper = shallow(
-
+
);
expect(wrapper).toMatchSnapshot();
});
@@ -53,16 +51,7 @@ describe('Providers', () => {
const wrapper = mount(
-
+
);
@@ -77,20 +66,10 @@ describe('Providers', () => {
describe('#onDataProviderRemoved', () => {
test('it invokes the onDataProviderRemoved callback when the close button is clicked', () => {
- const mockOnDataProviderRemoved = jest.fn();
const wrapper = mount(
-
+
);
@@ -98,25 +77,15 @@ describe('Providers', () => {
.find('[data-test-subj="providerBadge"] [data-euiicon-type]')
.first()
.simulate('click');
- expect(mockOnDataProviderRemoved.mock.calls[0][0]).toEqual('id-Provider 1');
+ expect(mockOnDataProviderRemoved.mock.calls[0][0].providerId).toEqual('id-Provider 1');
});
test('while loading data, it does NOT invoke the onDataProviderRemoved callback when the close button is clicked', () => {
- const mockOnDataProviderRemoved = jest.fn();
const wrapper = mount(
-
+
@@ -131,20 +100,10 @@ describe('Providers', () => {
});
test('it invokes the onDataProviderRemoved callback when you click on the option "Delete" in the provider menu', () => {
- const mockOnDataProviderRemoved = jest.fn();
const wrapper = mount(
-
+
);
@@ -156,25 +115,15 @@ describe('Providers', () => {
.find(`[data-test-subj="providerActions"] .${DELETE_CLASS_NAME}`)
.first()
.simulate('click');
- expect(mockOnDataProviderRemoved.mock.calls[0][0]).toEqual('id-Provider 1');
+ expect(mockOnDataProviderRemoved.mock.calls[0][0].providerId).toEqual('id-Provider 1');
});
test('while loading data, it does NOT invoke the onDataProviderRemoved callback when you click on the option "Delete" in the provider menu', () => {
- const mockOnDataProviderRemoved = jest.fn();
const wrapper = mount(
-
+
@@ -194,20 +143,14 @@ describe('Providers', () => {
describe('#onToggleDataProviderEnabled', () => {
test('it invokes the onToggleDataProviderEnabled callback when you click on the option "Temporary disable" in the provider menu', () => {
- const mockOnToggleDataProviderEnabled = jest.fn();
+ const mockOnToggleDataProviderEnabled = jest.spyOn(
+ timelineActions,
+ 'updateDataProviderEnabled'
+ );
const wrapper = mount(
-
+
);
@@ -220,27 +163,23 @@ describe('Providers', () => {
.first()
.simulate('click');
expect(mockOnToggleDataProviderEnabled.mock.calls[0][0]).toEqual({
+ andProviderId: undefined,
enabled: false,
+ id: 'test',
providerId: 'id-Provider 1',
});
});
test('while loading data, it does NOT invoke the onToggleDataProviderEnabled callback when you click on the option "Temporary disable" in the provider menu', () => {
- const mockOnToggleDataProviderEnabled = jest.fn();
+ const mockOnToggleDataProviderEnabled = jest.spyOn(
+ timelineActions,
+ 'updateDataProviderEnabled'
+ );
const wrapper = mount(
-
+
@@ -260,21 +199,15 @@ describe('Providers', () => {
describe('#onToggleDataProviderExcluded', () => {
test('it invokes the onToggleDataProviderExcluded callback when you click on the option "Exclude results" in the provider menu', () => {
- const onToggleDataProviderExcluded = jest.fn();
+ const mockOnToggleDataProviderExcluded = jest.spyOn(
+ timelineActions,
+ 'updateDataProviderExcluded'
+ );
const wrapper = mount(
-
+
);
@@ -288,29 +221,25 @@ describe('Providers', () => {
.first()
.simulate('click');
- expect(onToggleDataProviderExcluded.mock.calls[0][0]).toEqual({
+ expect(mockOnToggleDataProviderExcluded.mock.calls[0][0]).toEqual({
+ andProviderId: undefined,
excluded: true,
+ id: 'test',
providerId: 'id-Provider 1',
});
});
test('while loading data, it does NOT invoke the onToggleDataProviderExcluded callback when you click on the option "Exclude results" in the provider menu', () => {
- const onToggleDataProviderExcluded = jest.fn();
+ const mockOnToggleDataProviderExcluded = jest.spyOn(
+ timelineActions,
+ 'updateDataProviderExcluded'
+ );
const wrapper = mount(
-
+
@@ -325,7 +254,7 @@ describe('Providers', () => {
.first()
.simulate('click');
- expect(onToggleDataProviderExcluded).not.toBeCalled();
+ expect(mockOnToggleDataProviderExcluded).not.toBeCalled();
});
});
@@ -337,16 +266,7 @@ describe('Providers', () => {
const wrapper = mount(
-
+
);
@@ -364,21 +284,11 @@ describe('Providers', () => {
test('it invokes the onDataProviderRemoved callback when you click on the close button is clicked', () => {
const dataProviders = mockDataProviders.slice(0, 1);
dataProviders[0].and = mockDataProviders.slice(1, 3);
- const mockOnDataProviderRemoved = jest.fn();
const wrapper = mount(
-
+
);
@@ -392,28 +302,22 @@ describe('Providers', () => {
wrapper.update();
- expect(mockOnDataProviderRemoved.mock.calls[0]).toEqual(['id-Provider 1', 'id-Provider 2']);
+ expect(mockOnDataProviderRemoved.mock.calls[0][0]).toEqual({
+ andProviderId: 'id-Provider 2',
+ id: 'test',
+ providerId: 'id-Provider 1',
+ });
});
test('while loading data, it does NOT invoke the onDataProviderRemoved callback when you click on the close button is clicked', () => {
const dataProviders = mockDataProviders.slice(0, 1);
dataProviders[0].and = mockDataProviders.slice(1, 3);
- const mockOnDataProviderRemoved = jest.fn();
const wrapper = mount(
-
+
@@ -434,21 +338,15 @@ describe('Providers', () => {
test('it invokes the onToggleDataProviderEnabled callback when you click on the option "Temporary disable" in the provider menu', () => {
const dataProviders = mockDataProviders.slice(0, 1);
dataProviders[0].and = mockDataProviders.slice(1, 3);
- const mockOnToggleDataProviderEnabled = jest.fn();
+ const mockOnToggleDataProviderEnabled = jest.spyOn(
+ timelineActions,
+ 'updateDataProviderEnabled'
+ );
const wrapper = mount(
-
+
);
@@ -470,6 +368,7 @@ describe('Providers', () => {
expect(mockOnToggleDataProviderEnabled.mock.calls[0][0]).toEqual({
andProviderId: 'id-Provider 2',
enabled: false,
+ id: 'test',
providerId: 'id-Provider 1',
});
});
@@ -477,22 +376,16 @@ describe('Providers', () => {
test('while loading data, it does NOT invoke the onToggleDataProviderEnabled callback when you click on the option "Temporary disable" in the provider menu', () => {
const dataProviders = mockDataProviders.slice(0, 1);
dataProviders[0].and = mockDataProviders.slice(1, 3);
- const mockOnToggleDataProviderEnabled = jest.fn();
+ const mockOnToggleDataProviderEnabled = jest.spyOn(
+ timelineActions,
+ 'updateDataProviderEnabled'
+ );
const wrapper = mount(
-
+
@@ -518,21 +411,15 @@ describe('Providers', () => {
test('it invokes the onToggleDataProviderExcluded callback when you click on the option "Exclude results" in the provider menu', () => {
const dataProviders = mockDataProviders.slice(0, 1);
dataProviders[0].and = mockDataProviders.slice(1, 3);
- const mockOnToggleDataProviderExcluded = jest.fn();
+ const mockOnToggleDataProviderExcluded = jest.spyOn(
+ timelineActions,
+ 'updateDataProviderExcluded'
+ );
const wrapper = mount(
-
+
);
@@ -554,6 +441,7 @@ describe('Providers', () => {
expect(mockOnToggleDataProviderExcluded.mock.calls[0][0]).toEqual({
andProviderId: 'id-Provider 2',
excluded: true,
+ id: 'test',
providerId: 'id-Provider 1',
});
});
@@ -561,22 +449,16 @@ describe('Providers', () => {
test('while loading data, it does NOT invoke the onToggleDataProviderExcluded callback when you click on the option "Exclude results" in the provider menu', () => {
const dataProviders = mockDataProviders.slice(0, 1);
dataProviders[0].and = mockDataProviders.slice(1, 3);
- const mockOnToggleDataProviderExcluded = jest.fn();
+ const mockOnToggleDataProviderExcluded = jest.spyOn(
+ timelineActions,
+ 'updateDataProviderExcluded'
+ );
const wrapper = mount(
-
+
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.tsx
index 1142bbc214d74..4b6f3c6701794 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.tsx
@@ -6,9 +6,12 @@
import { EuiFlexGroup, EuiFlexItem, EuiFormHelpText, EuiSpacer } from '@elastic/eui';
import { rgba } from 'polished';
-import React, { Fragment, useMemo } from 'react';
+import React, { useCallback, useMemo } from 'react';
import { Draggable, DraggingStyle, Droppable, NotDraggingStyle } from 'react-beautiful-dnd';
-import styled, { css } from 'styled-components';
+import styled from 'styled-components';
+import { useDispatch } from 'react-redux';
+
+import { timelineActions } from '../../../store/timeline';
import { AndOrBadge } from '../../../../common/components/and_or_badge';
import { AddDataProviderPopover } from './add_data_provider_popover';
@@ -18,13 +21,6 @@ import {
IS_DRAGGING_CLASS_NAME,
getTimelineProviderDraggableId,
} from '../../../../common/components/drag_and_drop/helpers';
-import {
- OnDataProviderEdited,
- OnDataProviderRemoved,
- OnToggleDataProviderEnabled,
- OnToggleDataProviderExcluded,
- OnToggleDataProviderType,
-} from '../events';
import { DataProvider, DataProviderType, DataProvidersAnd, IS_OPERATOR } from './data_provider';
import { EMPTY_GROUP, flattenIntoAndGroups } from './helpers';
@@ -36,11 +32,6 @@ interface Props {
browserFields: BrowserFields;
timelineId: string;
dataProviders: DataProvider[];
- onDataProviderEdited: OnDataProviderEdited;
- onDataProviderRemoved: OnDataProviderRemoved;
- onToggleDataProviderEnabled: OnToggleDataProviderEnabled;
- onToggleDataProviderExcluded: OnToggleDataProviderExcluded;
- onToggleDataProviderType: OnToggleDataProviderType;
}
/**
@@ -74,12 +65,10 @@ const DroppableContainer = styled.div`
`;
const Parens = styled.span`
- ${({ theme }) => css`
- color: ${theme.eui.euiColorMediumShade};
- font-size: 32px;
- padding: 2px;
- user-select: none;
- `}
+ color: ${({ theme }) => theme.eui.euiColorMediumShade};
+ font-size: 32px;
+ padding: 2px;
+ user-select: none;
`;
const AndOrBadgeContainer = styled.div<{ hideBadge: boolean }>`
@@ -123,182 +112,269 @@ const getDataProviderValue = (dataProvider: DataProvidersAnd) =>
* 2) temporarily disabling a data provider
* 3) applying boolean negation to the data provider
*/
-export const Providers = React.memo(
- ({
- browserFields,
- timelineId,
- dataProviders,
- onDataProviderEdited,
- onDataProviderRemoved,
- onToggleDataProviderEnabled,
- onToggleDataProviderExcluded,
- onToggleDataProviderType,
- }) => {
- // Transform the dataProviders into flattened groups, and append an empty group
- const dataProviderGroups: DataProvidersAnd[][] = useMemo(
- () => [...flattenIntoAndGroups(dataProviders), ...EMPTY_GROUP],
- [dataProviders]
+export const Providers = React.memo(({ browserFields, timelineId, dataProviders }) => {
+ // Transform the dataProviders into flattened groups, and append an empty group
+ const dataProviderGroups: DataProvidersAnd[][] = useMemo(
+ () => [...flattenIntoAndGroups(dataProviders), ...EMPTY_GROUP],
+ [dataProviders]
+ );
+
+ const content = useMemo(
+ () =>
+ dataProviderGroups.map((group, groupIndex) => (
+
+ )),
+ [browserFields, dataProviderGroups, dataProviders, timelineId]
+ );
+
+ return {content}
;
+});
+
+Providers.displayName = 'Providers';
+
+interface DataProvidersGroupItem extends Omit {
+ index: number;
+ dataProvider: DataProvidersAnd;
+ group: DataProvidersAnd[];
+ groupIndex: number;
+}
+
+export const DataProvidersGroupItem = React.memo(
+ ({ browserFields, group, groupIndex, dataProvider, index, timelineId }) => {
+ const dispatch = useDispatch();
+ const draggableId = useMemo(
+ () =>
+ getTimelineProviderDraggableId({
+ dataProviderId: dataProvider.id,
+ groupIndex,
+ timelineId,
+ }),
+ [dataProvider.id, groupIndex, timelineId]
+ );
+
+ const handleDeleteProvider = useCallback(() => {
+ const payload = {
+ id: timelineId,
+ providerId: index > 0 ? group[0].id : dataProvider.id,
+ andProviderId: index > 0 ? dataProvider.id : undefined,
+ };
+
+ dispatch(timelineActions.removeProvider(payload));
+ }, [dataProvider.id, dispatch, group, index, timelineId]);
+
+ const handleToggleEnabledProvider = useCallback(() => {
+ const payload = {
+ id: timelineId,
+ providerId: index > 0 ? group[0].id : dataProvider.id,
+ enabled: !dataProvider.enabled,
+ andProviderId: index > 0 ? dataProvider.id : undefined,
+ };
+
+ dispatch(timelineActions.updateDataProviderEnabled(payload));
+ }, [dataProvider.enabled, dataProvider.id, dispatch, group, index, timelineId]);
+
+ const handleToggleExcludedProvider = useCallback(() => {
+ const payload = {
+ id: timelineId,
+ providerId: index > 0 ? group[0].id : dataProvider.id,
+ excluded: !dataProvider.excluded,
+ andProviderId: index > 0 ? dataProvider.id : undefined,
+ };
+
+ dispatch(timelineActions.updateDataProviderExcluded(payload));
+ }, [dataProvider.excluded, dataProvider.id, dispatch, group, index, timelineId]);
+
+ const handleToggleTypeProvider = useCallback(() => {
+ const payload = {
+ id: timelineId,
+ providerId: index > 0 ? group[0].id : dataProvider.id,
+ type:
+ dataProvider.type === DataProviderType.template
+ ? DataProviderType.default
+ : DataProviderType.template,
+ andProviderId: index > 0 ? dataProvider.id : undefined,
+ };
+
+ dispatch(timelineActions.updateDataProviderType(payload));
+ }, [dataProvider.id, dataProvider.type, dispatch, group, index, timelineId]);
+
+ const handleDataProviderEdited = useCallback(
+ ({ andProviderId, excluded, field, operator, providerId, value }) =>
+ dispatch(
+ timelineActions.dataProviderEdited({
+ andProviderId,
+ excluded,
+ field,
+ id: timelineId,
+ operator,
+ providerId,
+ value,
+ })
+ ),
+ [dispatch, timelineId]
+ );
+
+ const DraggableContent = useCallback(
+ (provided, snapshot) => (
+
+
+
+ 0 ? dataProvider.id : undefined}
+ browserFields={browserFields}
+ deleteProvider={handleDeleteProvider}
+ field={
+ index > 0
+ ? dataProvider.queryMatch.displayField ?? dataProvider.queryMatch.field
+ : group[0].queryMatch.displayField ?? group[0].queryMatch.field
+ }
+ kqlQuery={index > 0 ? dataProvider.kqlQuery : group[0].kqlQuery}
+ isEnabled={index > 0 ? dataProvider.enabled : group[0].enabled}
+ isExcluded={index > 0 ? dataProvider.excluded : group[0].excluded}
+ onDataProviderEdited={handleDataProviderEdited}
+ operator={
+ index > 0
+ ? dataProvider.queryMatch.operator ?? IS_OPERATOR
+ : group[0].queryMatch.operator ?? IS_OPERATOR
+ }
+ register={dataProvider}
+ providerId={index > 0 ? group[0].id : dataProvider.id}
+ timelineId={timelineId}
+ toggleEnabledProvider={handleToggleEnabledProvider}
+ toggleExcludedProvider={handleToggleExcludedProvider}
+ toggleTypeProvider={handleToggleTypeProvider}
+ val={getDataProviderValue(dataProvider)}
+ type={dataProvider.type}
+ />
+
+
+ {!snapshot.isDragging &&
+ (index < group.length - 1 ? (
+
+ ) : (
+
+
+
+ ))}
+
+
+
+ ),
+ [
+ browserFields,
+ dataProvider,
+ group,
+ handleDataProviderEdited,
+ handleDeleteProvider,
+ handleToggleEnabledProvider,
+ handleToggleExcludedProvider,
+ handleToggleTypeProvider,
+ index,
+ timelineId,
+ ]
);
return (
-
- {dataProviderGroups.map((group, groupIndex) => (
-
- {groupIndex !== 0 && }
-
-
-
-
-
-
-
-
- {'('}
-
-
-
- {(droppableProvided) => (
-
- {group.map((dataProvider, index) => (
-
- {(provided, snapshot) => (
-
-
-
- 0 ? dataProvider.id : undefined}
- browserFields={browserFields}
- deleteProvider={() =>
- index > 0
- ? onDataProviderRemoved(group[0].id, dataProvider.id)
- : onDataProviderRemoved(dataProvider.id)
- }
- field={
- index > 0
- ? dataProvider.queryMatch.displayField ??
- dataProvider.queryMatch.field
- : group[0].queryMatch.displayField ??
- group[0].queryMatch.field
- }
- kqlQuery={index > 0 ? dataProvider.kqlQuery : group[0].kqlQuery}
- isEnabled={index > 0 ? dataProvider.enabled : group[0].enabled}
- isExcluded={
- index > 0 ? dataProvider.excluded : group[0].excluded
- }
- onDataProviderEdited={onDataProviderEdited}
- operator={
- index > 0
- ? dataProvider.queryMatch.operator ?? IS_OPERATOR
- : group[0].queryMatch.operator ?? IS_OPERATOR
- }
- register={dataProvider}
- providerId={index > 0 ? group[0].id : dataProvider.id}
- timelineId={timelineId}
- toggleEnabledProvider={() =>
- index > 0
- ? onToggleDataProviderEnabled({
- providerId: group[0].id,
- enabled: !dataProvider.enabled,
- andProviderId: dataProvider.id,
- })
- : onToggleDataProviderEnabled({
- providerId: dataProvider.id,
- enabled: !dataProvider.enabled,
- })
- }
- toggleExcludedProvider={() =>
- index > 0
- ? onToggleDataProviderExcluded({
- providerId: group[0].id,
- excluded: !dataProvider.excluded,
- andProviderId: dataProvider.id,
- })
- : onToggleDataProviderExcluded({
- providerId: dataProvider.id,
- excluded: !dataProvider.excluded,
- })
- }
- toggleTypeProvider={() =>
- index > 0
- ? onToggleDataProviderType({
- providerId: group[0].id,
- type:
- dataProvider.type === DataProviderType.template
- ? DataProviderType.default
- : DataProviderType.template,
- andProviderId: dataProvider.id,
- })
- : onToggleDataProviderType({
- providerId: dataProvider.id,
- type:
- dataProvider.type === DataProviderType.template
- ? DataProviderType.default
- : DataProviderType.template,
- })
- }
- val={getDataProviderValue(dataProvider)}
- type={dataProvider.type}
- />
-
-
- {!snapshot.isDragging &&
- (index < group.length - 1 ? (
-
- ) : (
-
-
-
- ))}
-
-
-
- )}
-
- ))}
- {droppableProvided.placeholder}
-
- )}
-
-
-
- {')'}
-
- {groupIndex === dataProviderGroups.length - 1 && (
-
- )}
-
-
- ))}
-
+
+ {DraggableContent}
+
);
}
);
-Providers.displayName = 'Providers';
+DataProvidersGroupItem.displayName = 'DataProvidersGroupItem';
+
+interface DataProvidersGroup extends Props {
+ group: DataProvidersAnd[];
+ groupIndex: number;
+ isLastGroup: boolean;
+}
+
+const DataProvidersGroup = React.memo(
+ ({ browserFields, timelineId, group, groupIndex, isLastGroup }) => {
+ const droppableId = useMemo(() => getTimelineProviderDroppableId({ groupIndex, timelineId }), [
+ groupIndex,
+ timelineId,
+ ]);
+
+ const GroupDataProviders = useMemo(
+ () =>
+ group.map((dataProvider, index) => (
+
+ )),
+ [browserFields, group, groupIndex, timelineId]
+ );
+
+ const DroppableContent = useCallback(
+ (droppableProvided) => (
+
+ {GroupDataProviders}
+ {droppableProvided.placeholder}
+
+ ),
+ [GroupDataProviders, isLastGroup]
+ );
+
+ return (
+ <>
+ {groupIndex !== 0 && }
+
+
+
+
+
+
+
+
+ {'('}
+
+
+
+ {DroppableContent}
+
+
+
+ {')'}
+
+ {isLastGroup && (
+
+ )}
+
+ >
+ );
+ }
+);
+
+DataProvidersGroup.displayName = 'DataProvidersGroup';
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts
index f894ac4e73939..8ab3a71604bf1 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts
@@ -7,33 +7,8 @@
import { ColumnHeaderOptions } from '../../../timelines/store/timeline/model';
import { ColumnId } from './body/column_id';
import { SortDirection } from './body/sort';
-import { DataProvider, DataProviderType, QueryOperator } from './data_providers/data_provider';
+import { DataProvider, QueryOperator } from './data_providers/data_provider';
-/** Invoked when a user clicks the close button to remove a data provider */
-export type OnDataProviderRemoved = (providerId: string, andProviderId?: string) => void;
-
-/** Invoked when a user temporarily disables or re-enables a data provider */
-export type OnToggleDataProviderEnabled = (toggled: {
- providerId: string;
- enabled: boolean;
- andProviderId?: string;
-}) => void;
-
-/** Invoked when a user toggles negation ("boolean NOT") of a data provider */
-export type OnToggleDataProviderExcluded = (excluded: {
- providerId: string;
- excluded: boolean;
- andProviderId?: string;
-}) => void;
-
-/** Invoked when a user toggles type (can "default" or "template") of a data provider */
-export type OnToggleDataProviderType = (type: {
- providerId: string;
- type: DataProviderType;
- andProviderId?: string;
-}) => void;
-
-/** Invoked when a user edits the properties of a data provider */
export type OnDataProviderEdited = ({
andProviderId,
excluded,
@@ -54,9 +29,6 @@ export type OnDataProviderEdited = ({
type: DataProvider['type'];
}) => void;
-/** Invoked when a user change the kql query of our data provider */
-export type OnChangeDataProviderKqlQuery = (edit: { providerId: string; kqlQuery: string }) => void;
-
/** Invoked when a user selects a new minimap time range */
export type OnRangeSelected = (range: string) => void;
@@ -76,8 +48,6 @@ export type OnChangeItemsPerPage = (itemsPerPage: number) => void;
/** Invoked when a user clicks to load more item */
export type OnChangePage = (nextPage: number) => void;
-export type OnChangeDroppableAndProvider = (providerId: string) => void;
-
/** Invoked when a user pins an event */
export type OnPinEvent = (eventId: string) => void;
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/__snapshots__/index.test.tsx.snap
index f81934f9a1d91..5b14edf818fdc 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/__snapshots__/index.test.tsx.snap
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/__snapshots__/index.test.tsx.snap
@@ -77,7 +77,7 @@ exports[`Footer Timeline Component rendering it renders the default timeline foo
data-test-subj="paging-control"
isLoading={false}
onPageClick={[Function]}
- totalPages={2}
+ totalPages={5}
/>
{
const loadMore = jest.fn();
const onChangeItemsPerPage = jest.fn();
const updatedAt = 1546878704036;
- const totalCount = 15546;
+ const serverSideEventCount = 15546;
const itemsCount = 2;
+ const totalCount = 10;
describe('rendering', () => {
test('it renders the default timeline footer', () => {
@@ -33,8 +34,8 @@ describe('Footer Timeline Component', () => {
itemsPerPageOptions={[1, 5, 10, 20]}
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadMore}
- serverSideEventCount={totalCount}
- totalPages={2}
+ serverSideEventCount={serverSideEventCount}
+ totalCount={totalCount}
/>
);
@@ -55,8 +56,8 @@ describe('Footer Timeline Component', () => {
itemsPerPageOptions={[1, 5, 10, 20]}
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadMore}
- serverSideEventCount={totalCount}
- totalPages={2}
+ serverSideEventCount={serverSideEventCount}
+ totalCount={totalCount}
/>
);
@@ -78,8 +79,8 @@ describe('Footer Timeline Component', () => {
itemsPerPageOptions={[1, 5, 10, 20]}
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadMore}
- serverSideEventCount={totalCount}
- totalPages={2}
+ serverSideEventCount={serverSideEventCount}
+ totalCount={totalCount}
/>
);
@@ -129,8 +130,8 @@ describe('Footer Timeline Component', () => {
itemsPerPageOptions={[1, 5, 10, 20]}
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadMore}
- serverSideEventCount={totalCount}
- totalPages={2}
+ serverSideEventCount={serverSideEventCount}
+ totalCount={totalCount}
/>
);
@@ -152,8 +153,8 @@ describe('Footer Timeline Component', () => {
itemsPerPageOptions={[1, 5, 10, 20]}
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadMore}
- serverSideEventCount={totalCount}
- totalPages={2}
+ serverSideEventCount={serverSideEventCount}
+ totalCount={totalCount}
/>
);
@@ -179,8 +180,8 @@ describe('Footer Timeline Component', () => {
itemsPerPageOptions={[1, 5, 10, 20]}
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadMore}
- serverSideEventCount={totalCount}
- totalPages={2}
+ serverSideEventCount={serverSideEventCount}
+ totalCount={totalCount}
/>
);
@@ -204,8 +205,8 @@ describe('Footer Timeline Component', () => {
itemsPerPageOptions={[1, 5, 10, 20]}
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadMore}
- serverSideEventCount={totalCount}
- totalPages={2}
+ serverSideEventCount={serverSideEventCount}
+ totalCount={totalCount}
/>
);
@@ -231,8 +232,8 @@ describe('Footer Timeline Component', () => {
itemsPerPageOptions={[1, 5, 10, 20]}
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadMore}
- serverSideEventCount={totalCount}
- totalPages={2}
+ serverSideEventCount={serverSideEventCount}
+ totalCount={totalCount}
/>
);
@@ -256,8 +257,8 @@ describe('Footer Timeline Component', () => {
itemsPerPageOptions={[1, 5, 10, 20]}
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadMore}
- serverSideEventCount={totalCount}
- totalPages={2}
+ serverSideEventCount={serverSideEventCount}
+ totalCount={totalCount}
/>
);
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/index.tsx
index 7174e9b2121e5..7c10168da3c62 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/index.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/index.tsx
@@ -174,30 +174,36 @@ export const EventsCount = React.memo(EventsCountComponent);
EventsCount.displayName = 'EventsCount';
-export const PagingControlComponent = ({
- activePage,
- isLoading,
- onPageClick,
- totalPages,
-}: {
+interface PagingControlProps {
activePage: number;
isLoading: boolean;
onPageClick: OnChangePage;
totalPages: number;
-}) => (
- <>
- {isLoading ? (
- `${i18n.LOADING}...`
- ) : (
-
- )}
- >
-);
+}
+
+export const PagingControlComponent: React.FC = ({
+ activePage,
+ isLoading,
+ onPageClick,
+ totalPages,
+}) => {
+ if (isLoading) {
+ return <>{`${i18n.LOADING}...`}>;
+ }
+
+ if (!totalPages) {
+ return null;
+ }
+
+ return (
+
+ );
+};
PagingControlComponent.displayName = 'PagingControlComponent';
@@ -217,7 +223,7 @@ interface FooterProps {
onChangeItemsPerPage: OnChangeItemsPerPage;
onChangePage: OnChangePage;
serverSideEventCount: number;
- totalPages: number;
+ totalCount: number;
}
/** Renders a loading indicator and paging controls */
@@ -234,7 +240,7 @@ export const FooterComponent = ({
onChangeItemsPerPage,
onChangePage,
serverSideEventCount,
- totalPages,
+ totalCount,
}: FooterProps) => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
const [paginationLoading, setPaginationLoading] = useState(false);
@@ -259,6 +265,30 @@ export const FooterComponent = ({
]);
const closePopover = useCallback(() => setIsPopoverOpen(false), [setIsPopoverOpen]);
+ const rowItems = useMemo(
+ () =>
+ itemsPerPageOptions &&
+ itemsPerPageOptions.map((item) => (
+ {
+ closePopover();
+ onChangeItemsPerPage(item);
+ }}
+ >
+ {`${item} ${i18n.ROWS}`}
+
+ )),
+ [closePopover, itemsPerPage, itemsPerPageOptions, onChangeItemsPerPage]
+ );
+
+ const totalPages = useMemo(() => Math.ceil(totalCount / itemsPerPage), [
+ itemsPerPage,
+ totalCount,
+ ]);
+
useEffect(() => {
if (paginationLoading && !isLoading) {
setPaginationLoading(false);
@@ -279,22 +309,6 @@ export const FooterComponent = ({
);
}
- const rowItems =
- itemsPerPageOptions &&
- itemsPerPageOptions.map((item) => (
- {
- closePopover();
- onChangeItemsPerPage(item);
- }}
- >
- {`${item} ${i18n.ROWS}`}
-
- ));
-
return (
= ({
dataProviders,
filterManager,
graphEventId,
- onDataProviderEdited,
- onDataProviderRemoved,
- onToggleDataProviderEnabled,
- onToggleDataProviderExcluded,
- onToggleDataProviderType,
show,
showCallOutUnauthorizedMsg,
status,
@@ -85,11 +68,6 @@ const TimelineHeaderComponent: React.FC = ({
browserFields={browserFields}
timelineId={timelineId}
dataProviders={dataProviders}
- onDataProviderEdited={onDataProviderEdited}
- onDataProviderRemoved={onDataProviderRemoved}
- onToggleDataProviderEnabled={onToggleDataProviderEnabled}
- onToggleDataProviderExcluded={onToggleDataProviderExcluded}
- onToggleDataProviderType={onToggleDataProviderType}
/>
(
kqlMode,
kqlQueryExpression,
onClose,
- onDataProviderEdited,
removeColumn,
- removeProvider,
show,
showCallOutUnauthorizedMsg,
sort,
start,
status,
timelineType,
- updateDataProviderEnabled,
- updateDataProviderExcluded,
- updateDataProviderType,
updateItemsPerPage,
upsertColumn,
usersViewing,
@@ -75,59 +63,6 @@ const StatefulTimelineComponent = React.memo(
selectedPatterns,
} = useSourcererScope(SourcererScopeName.timeline);
- const onDataProviderRemoved: OnDataProviderRemoved = useCallback(
- (providerId: string, andProviderId?: string) =>
- removeProvider!({ id, providerId, andProviderId }),
- [id, removeProvider]
- );
-
- const onToggleDataProviderEnabled: OnToggleDataProviderEnabled = useCallback(
- ({ providerId, enabled, andProviderId }) =>
- updateDataProviderEnabled!({
- id,
- enabled,
- providerId,
- andProviderId,
- }),
- [id, updateDataProviderEnabled]
- );
-
- const onToggleDataProviderExcluded: OnToggleDataProviderExcluded = useCallback(
- ({ providerId, excluded, andProviderId }) =>
- updateDataProviderExcluded!({
- id,
- excluded,
- providerId,
- andProviderId,
- }),
- [id, updateDataProviderExcluded]
- );
-
- const onToggleDataProviderType: OnToggleDataProviderType = useCallback(
- ({ providerId, type, andProviderId }) =>
- updateDataProviderType!({
- id,
- type,
- providerId,
- andProviderId,
- }),
- [id, updateDataProviderType]
- );
-
- const onDataProviderEditedLocal: OnDataProviderEdited = useCallback(
- ({ andProviderId, excluded, field, operator, providerId, value }) =>
- onDataProviderEdited!({
- andProviderId,
- excluded,
- field,
- id,
- operator,
- providerId,
- value,
- }),
- [id, onDataProviderEdited]
- );
-
const onChangeItemsPerPage: OnChangeItemsPerPage = useCallback(
(itemsChangedPerPage) => updateItemsPerPage!({ id, itemsPerPage: itemsChangedPerPage }),
[id, updateItemsPerPage]
@@ -183,11 +118,6 @@ const StatefulTimelineComponent = React.memo(
loadingSourcerer={loading}
onChangeItemsPerPage={onChangeItemsPerPage}
onClose={onClose}
- onDataProviderEdited={onDataProviderEditedLocal}
- onDataProviderRemoved={onDataProviderRemoved}
- onToggleDataProviderEnabled={onToggleDataProviderEnabled}
- onToggleDataProviderExcluded={onToggleDataProviderExcluded}
- onToggleDataProviderType={onToggleDataProviderType}
show={show!}
showCallOutUnauthorizedMsg={showCallOutUnauthorizedMsg}
sort={sort!}
@@ -287,14 +217,8 @@ const makeMapStateToProps = () => {
const mapDispatchToProps = {
addProvider: timelineActions.addProvider,
createTimeline: timelineActions.createTimeline,
- onDataProviderEdited: timelineActions.dataProviderEdited,
removeColumn: timelineActions.removeColumn,
- removeProvider: timelineActions.removeProvider,
updateColumns: timelineActions.updateColumns,
- updateDataProviderEnabled: timelineActions.updateDataProviderEnabled,
- updateDataProviderExcluded: timelineActions.updateDataProviderExcluded,
- updateDataProviderKqlQuery: timelineActions.updateDataProviderKqlQuery,
- updateDataProviderType: timelineActions.updateDataProviderType,
updateHighlightedDropAndProviderId: timelineActions.updateHighlightedDropAndProviderId,
updateItemsPerPage: timelineActions.updateItemsPerPage,
updateItemsPerPageOptions: timelineActions.updateItemsPerPageOptions,
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx
index 43ab8ab203e11..a28f4240d3a2f 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx
@@ -73,23 +73,31 @@ export const StarIcon = React.memo<{
isFavorite: boolean;
timelineId: string;
updateIsFavorite: UpdateIsFavorite;
-}>(({ isFavorite, timelineId: id, updateIsFavorite }) => (
- // TODO: 1 error is: Visible, non-interactive elements with click handlers must have at least one keyboard listener
- // TODO: 2 error is: Elements with the 'button' interactive role must be focusable
- // TODO: Investigate this error
- // eslint-disable-next-line
- updateIsFavorite({ id, isFavorite: !isFavorite })}>
- {isFavorite ? (
-
-
-
- ) : (
-
-
-
- )}
-
-));
+}>(({ isFavorite, timelineId: id, updateIsFavorite }) => {
+ const handleClick = useCallback(() => updateIsFavorite({ id, isFavorite: !isFavorite }), [
+ id,
+ isFavorite,
+ updateIsFavorite,
+ ]);
+
+ return (
+ // TODO: 1 error is: Visible, non-interactive elements with click handlers must have at least one keyboard listener
+ // TODO: 2 error is: Elements with the 'button' interactive role must be focusable
+ // TODO: Investigate this error
+ // eslint-disable-next-line
+
+ {isFavorite ? (
+
+
+
+ ) : (
+
+
+
+ )}
+
+ );
+});
StarIcon.displayName = 'StarIcon';
interface DescriptionProps {
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.test.tsx
index bde1e7bf5829a..630a71693d182 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.test.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.test.tsx
@@ -19,11 +19,6 @@ import {
import '../../../common/mock/match_media';
import { TestProviders } from '../../../common/mock/test_providers';
-import {
- DELETE_CLASS_NAME,
- ENABLE_CLASS_NAME,
- EXCLUDE_CLASS_NAME,
-} from './data_providers/provider_item_actions';
import { TimelineComponent, Props as TimelineComponentProps } from './timeline';
import { Sort } from './body/sort';
import { mockDataProviders } from './data_providers/mock/mock_data_providers';
@@ -115,11 +110,6 @@ describe('Timeline', () => {
loadingSourcerer: false,
onChangeItemsPerPage: jest.fn(),
onClose: jest.fn(),
- onDataProviderEdited: jest.fn(),
- onDataProviderRemoved: jest.fn(),
- onToggleDataProviderEnabled: jest.fn(),
- onToggleDataProviderExcluded: jest.fn(),
- onToggleDataProviderType: jest.fn(),
show: true,
showCallOutUnauthorizedMsg: false,
sort,
@@ -238,204 +228,4 @@ describe('Timeline', () => {
});
});
});
-
- describe('event wire up', () => {
- describe('onDataProviderRemoved', () => {
- test('it invokes the onDataProviderRemoved callback when the delete button on a provider is clicked', () => {
- const wrapper = mount(
-
-
-
- );
-
- wrapper
- .find('[data-test-subj="providerBadge"] [data-euiicon-type]')
- .first()
- .simulate('click');
-
- expect((props.onDataProviderRemoved as jest.Mock).mock.calls[0][0]).toEqual(
- 'id-Provider 1'
- );
- });
-
- test('it invokes the onDataProviderRemoved callback when you click on the option "Delete" in the provider menu', () => {
- const wrapper = mount(
-
-
-
- );
- wrapper.find('button[data-test-subj="providerBadge"]').first().simulate('click');
-
- wrapper.update();
-
- wrapper
- .find(`[data-test-subj="providerActions"] .${DELETE_CLASS_NAME}`)
- .first()
- .simulate('click');
-
- expect((props.onDataProviderRemoved as jest.Mock).mock.calls[0][0]).toEqual(
- 'id-Provider 1'
- );
- });
- });
-
- describe('onToggleDataProviderEnabled', () => {
- test('it invokes the onToggleDataProviderEnabled callback when you click on the option "Temporary disable" in the provider menu', () => {
- const wrapper = mount(
-
-
-
- );
-
- wrapper.find('button[data-test-subj="providerBadge"]').first().simulate('click');
-
- wrapper.update();
-
- wrapper
- .find(`[data-test-subj="providerActions"] .${ENABLE_CLASS_NAME}`)
- .first()
- .simulate('click');
-
- expect((props.onToggleDataProviderEnabled as jest.Mock).mock.calls[0][0]).toEqual({
- providerId: 'id-Provider 1',
- enabled: false,
- });
- });
- });
-
- describe('onToggleDataProviderExcluded', () => {
- test('it invokes the onToggleDataProviderExcluded callback when you click on the option "Exclude results" in the provider menu', () => {
- const wrapper = mount(
-
-
-
- );
-
- wrapper
- .find('[data-test-subj="providerBadge"]')
- .first()
- .find('button')
- .first()
- .simulate('click');
-
- wrapper.update();
-
- wrapper
- .find(`[data-test-subj="providerActions"] .${EXCLUDE_CLASS_NAME}`)
- .first()
- .simulate('click');
-
- expect((props.onToggleDataProviderExcluded as jest.Mock).mock.calls[0][0]).toEqual({
- providerId: 'id-Provider 1',
- excluded: true,
- });
- });
- });
-
- describe('#ProviderWithAndProvider', () => {
- const dataProviders = mockDataProviders.slice(0, 1);
- dataProviders[0].and = mockDataProviders.slice(1, 3);
-
- test('Rendering And Provider', () => {
- const wrapper = mount(
-
-
-
- );
-
- const andProviderBadges = wrapper.find(
- '[data-test-subj="providerBadge"] .euiBadge__content span.field-value'
- );
-
- const andProviderBadgesText = andProviderBadges.map((node) => node.text()).join(' ');
- expect(andProviderBadges.length).toEqual(3);
- expect(andProviderBadgesText).toEqual(
- 'name: "Provider 1" name: "Provider 2" name: "Provider 3"'
- );
- });
-
- test('it invokes the onDataProviderRemoved callback when you click on the option "Delete" in the accordion menu', () => {
- const wrapper = mount(
-
-
-
- );
-
- wrapper
- .find('[data-test-subj="providerBadge"]')
- .at(3)
- .find('button')
- .first()
- .simulate('click');
-
- wrapper.update();
-
- wrapper
- .find(`[data-test-subj="providerActions"] .${DELETE_CLASS_NAME}`)
- .first()
- .simulate('click');
-
- expect((props.onDataProviderRemoved as jest.Mock).mock.calls[0]).toEqual([
- 'id-Provider 1',
- 'id-Provider 2',
- ]);
- });
-
- test('it invokes the onToggleDataProviderEnabled callback when you click on the option "Temporary disable" in the accordion menu', () => {
- const wrapper = mount(
-
-
-
- );
-
- wrapper
- .find('[data-test-subj="providerBadge"]')
- .at(3)
- .find('button')
- .first()
- .simulate('click');
-
- wrapper.update();
-
- wrapper
- .find(`[data-test-subj="providerActions"] .${ENABLE_CLASS_NAME}`)
- .first()
- .simulate('click');
-
- expect((props.onToggleDataProviderEnabled as jest.Mock).mock.calls[0][0]).toEqual({
- andProviderId: 'id-Provider 2',
- enabled: false,
- providerId: 'id-Provider 1',
- });
- });
-
- test('it invokes the onToggleDataProviderExcluded callback when you click on the option "Exclude results" in the accordion menu', () => {
- const wrapper = mount(
-
-
-
- );
-
- wrapper
- .find('[data-test-subj="providerBadge"]')
- .at(3)
- .find('button')
- .first()
- .simulate('click');
-
- wrapper.update();
-
- wrapper
- .find(`[data-test-subj="providerActions"] .${EXCLUDE_CLASS_NAME}`)
- .first()
- .simulate('click');
-
- expect((props.onToggleDataProviderExcluded as jest.Mock).mock.calls[0][0]).toEqual({
- andProviderId: 'id-Provider 2',
- excluded: true,
- providerId: 'id-Provider 1',
- });
- });
- });
- });
});
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx
index d1a25e6f3e1a4..1097d58b227a8 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx
@@ -19,14 +19,7 @@ import { defaultHeaders } from './body/column_headers/default_headers';
import { Sort } from './body/sort';
import { StatefulBody } from './body/stateful_body';
import { DataProvider } from './data_providers/data_provider';
-import {
- OnChangeItemsPerPage,
- OnDataProviderRemoved,
- OnDataProviderEdited,
- OnToggleDataProviderEnabled,
- OnToggleDataProviderExcluded,
- OnToggleDataProviderType,
-} from './events';
+import { OnChangeItemsPerPage } from './events';
import { TimelineKqlFetch } from './fetch_kql_timeline';
import { Footer, footerHeight } from './footer';
import { TimelineHeader } from './header';
@@ -113,11 +106,6 @@ export interface Props {
loadingSourcerer: boolean;
onChangeItemsPerPage: OnChangeItemsPerPage;
onClose: () => void;
- onDataProviderEdited: OnDataProviderEdited;
- onDataProviderRemoved: OnDataProviderRemoved;
- onToggleDataProviderEnabled: OnToggleDataProviderEnabled;
- onToggleDataProviderExcluded: OnToggleDataProviderExcluded;
- onToggleDataProviderType: OnToggleDataProviderType;
show: boolean;
showCallOutUnauthorizedMsg: boolean;
sort: Sort;
@@ -149,11 +137,6 @@ export const TimelineComponent: React.FC = ({
kqlQueryExpression,
onChangeItemsPerPage,
onClose,
- onDataProviderEdited,
- onDataProviderRemoved,
- onToggleDataProviderEnabled,
- onToggleDataProviderExcluded,
- onToggleDataProviderType,
show,
showCallOutUnauthorizedMsg,
start,
@@ -270,11 +253,6 @@ export const TimelineComponent: React.FC = ({
dataProviders={dataProviders}
filterManager={filterManager}
graphEventId={graphEventId}
- onDataProviderEdited={onDataProviderEdited}
- onDataProviderRemoved={onDataProviderRemoved}
- onToggleDataProviderEnabled={onToggleDataProviderEnabled}
- onToggleDataProviderExcluded={onToggleDataProviderExcluded}
- onToggleDataProviderType={onToggleDataProviderType}
show={show}
showCallOutUnauthorizedMsg={showCallOutUnauthorizedMsg}
timelineId={id}
@@ -324,7 +302,7 @@ export const TimelineComponent: React.FC = ({
onChangeItemsPerPage={onChangeItemsPerPage}
onChangePage={loadPage}
serverSideEventCount={totalCount}
- totalPages={pageInfo.totalPages}
+ totalCount={pageInfo.fakeTotalCount}
/>
)
diff --git a/x-pack/plugins/security_solution/public/timelines/containers/index.tsx b/x-pack/plugins/security_solution/public/timelines/containers/index.tsx
index 54db52b985c31..53944fd29a687 100644
--- a/x-pack/plugins/security_solution/public/timelines/containers/index.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/containers/index.tsx
@@ -15,11 +15,13 @@ import { inputsModel } from '../../common/store';
import { useKibana } from '../../common/lib/kibana';
import { createFilter } from '../../common/containers/helpers';
import { DocValueFields } from '../../common/containers/query_template';
+import { generateTablePaginationOptions } from '../../common/components/paginated_table/helpers';
import { timelineActions } from '../../timelines/store/timeline';
import { detectionsTimelineIds, skipQueryForDetectionsPage } from './helpers';
import { getInspectResponse } from '../../helpers';
import {
Direction,
+ PageInfoPaginated,
TimelineEventsQueries,
TimelineEventsAllStrategyResponse,
TimelineEventsAllRequestOptions,
@@ -35,10 +37,7 @@ export interface TimelineArgs {
id: string;
inspect: InspectResponse;
loadPage: LoadPage;
- pageInfo: {
- activePage: number;
- totalPages: number;
- };
+ pageInfo: PageInfoPaginated;
refetch: inputsModel.Refetch;
totalCount: number;
updatedAt: number;
@@ -97,10 +96,7 @@ export const useTimelineEvents = ({
from: startDate,
to: endDate,
},
- pagination: {
- activePage,
- querySize: limit,
- },
+ pagination: generateTablePaginationOptions(activePage, limit),
sort,
defaultIndex: indexNames,
docValueFields: docValueFields ?? [],
@@ -134,7 +130,8 @@ export const useTimelineEvents = ({
totalCount: -1,
pageInfo: {
activePage: 0,
- totalPages: 0,
+ fakeTotalCount: 0,
+ showMorePagesIndicator: false,
},
events: [],
loadPage: wrappedLoadPage,
@@ -218,10 +215,7 @@ export const useTimelineEvents = ({
defaultIndex: indexNames,
docValueFields: docValueFields ?? [],
filterQuery: createFilter(filterQuery),
- pagination: {
- activePage,
- querySize: limit,
- },
+ pagination: generateTablePaginationOptions(activePage, limit),
timerange: {
interval: '12h',
from: startDate,
diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx
index 1f79b26394a69..1992b1f88f064 100644
--- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx
+++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx
@@ -96,11 +96,6 @@ describe('epicLocalStorage', () => {
loadingSourcerer: false,
onChangeItemsPerPage: jest.fn(),
onClose: jest.fn(),
- onDataProviderEdited: jest.fn(),
- onDataProviderRemoved: jest.fn(),
- onToggleDataProviderEnabled: jest.fn(),
- onToggleDataProviderExcluded: jest.fn(),
- onToggleDataProviderType: jest.fn(),
show: true,
showCallOutUnauthorizedMsg: false,
start: startDate,
diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts
index fc178df86362b..30d0796443ab5 100644
--- a/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts
+++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts
@@ -1209,17 +1209,20 @@ export const updateTimelinePerPageOptions = ({
const removeAndProvider = (andProviderId: string, providerId: string, timeline: TimelineModel) => {
const providerIndex = timeline.dataProviders.findIndex((p) => p.id === providerId);
- const providerAndIndex = timeline.dataProviders[providerIndex].and.findIndex(
+ const providerAndIndex = timeline.dataProviders[providerIndex]?.and.findIndex(
(p) => p.id === andProviderId
);
+
return [
...timeline.dataProviders.slice(0, providerIndex),
{
...timeline.dataProviders[providerIndex],
- and: [
- ...timeline.dataProviders[providerIndex].and.slice(0, providerAndIndex),
- ...timeline.dataProviders[providerIndex].and.slice(providerAndIndex + 1),
- ],
+ and: timeline.dataProviders[providerIndex]?.and
+ ? [
+ ...timeline.dataProviders[providerIndex]?.and.slice(0, providerAndIndex),
+ ...timeline.dataProviders[providerIndex]?.and.slice(providerAndIndex + 1),
+ ]
+ : [],
},
...timeline.dataProviders.slice(providerIndex + 1),
];
@@ -1229,7 +1232,7 @@ const removeProvider = (providerId: string, timeline: TimelineModel) => {
const providerIndex = timeline.dataProviders.findIndex((p) => p.id === providerId);
return [
...timeline.dataProviders.slice(0, providerIndex),
- ...(timeline.dataProviders[providerIndex].and.length
+ ...(timeline.dataProviders[providerIndex]?.and.length
? [
{
...timeline.dataProviders[providerIndex].and.slice(0, 1)[0],
diff --git a/x-pack/plugins/security_solution/server/search_strategy/timeline/factory/events/all/index.ts b/x-pack/plugins/security_solution/server/search_strategy/timeline/factory/events/all/index.ts
index 12729eb88a666..6b28fc2598d41 100644
--- a/x-pack/plugins/security_solution/server/search_strategy/timeline/factory/events/all/index.ts
+++ b/x-pack/plugins/security_solution/server/search_strategy/timeline/factory/events/all/index.ts
@@ -42,17 +42,19 @@ export const timelineEventsAll: SecuritySolutionTimelineFactory
+ const edges: TimelineEdges[] = hits.splice(cursorStart, querySize - cursorStart).map((hit) =>
// @ts-expect-error
formatTimelineData(options.fieldRequested, TIMELINE_EVENTS_FIELDS, hit, eventFieldsMap)
);
const inspect = {
dsl: [inspectStringifyObject(buildTimelineEventsAllQuery(queryOptions))],
};
+ const fakeTotalCount = fakePossibleCount <= totalCount ? fakePossibleCount : totalCount;
+ const showMorePagesIndicator = totalCount > fakeTotalCount;
return {
...response,
@@ -61,7 +63,8 @@ export const timelineEventsAll: SecuritySolutionTimelineFactory
Date: Fri, 2 Oct 2020 11:22:41 +0200
Subject: [PATCH 09/56] [Discover] Change context query to prevent duplicates
(#77014)
---
.../application/angular/context/api/_stubs.js | 2 +-
.../context/api/context.predecessors.test.js | 8 ++++++--
.../context/api/context.successors.test.js | 8 ++++++--
.../angular/context/api/context.ts | 4 +++-
.../api/utils/fetch_hits_in_interval.ts | 20 ++++++++++++++-----
5 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/src/plugins/discover/public/application/angular/context/api/_stubs.js b/src/plugins/discover/public/application/angular/context/api/_stubs.js
index 35ddf396c2dba..d82189db60935 100644
--- a/src/plugins/discover/public/application/angular/context/api/_stubs.js
+++ b/src/plugins/discover/public/application/angular/context/api/_stubs.js
@@ -74,7 +74,7 @@ export function createContextSearchSourceStub(hits, timeField = '@timestamp') {
searchSourceStub.fetch = sinon.spy(() => {
const timeField = searchSourceStub._stubTimeField;
const lastQuery = searchSourceStub.setField.withArgs('query').lastCall.args[1];
- const timeRange = lastQuery.query.constant_score.filter.range[timeField];
+ const timeRange = lastQuery.query.bool.must.constant_score.filter.range[timeField];
const lastSort = searchSourceStub.setField.withArgs('sort').lastCall.args[1];
const sortDirection = lastSort[0][timeField];
const sortFunction =
diff --git a/src/plugins/discover/public/application/angular/context/api/context.predecessors.test.js b/src/plugins/discover/public/application/angular/context/api/context.predecessors.test.js
index 4987c77f4bf25..4c0515906a494 100644
--- a/src/plugins/discover/public/application/angular/context/api/context.predecessors.test.js
+++ b/src/plugins/discover/public/application/angular/context/api/context.predecessors.test.js
@@ -124,7 +124,9 @@ describe('context app', function () {
).then((hits) => {
const intervals = mockSearchSource.setField.args
.filter(([property]) => property === 'query')
- .map(([, { query }]) => get(query, ['constant_score', 'filter', 'range', '@timestamp']));
+ .map(([, { query }]) =>
+ get(query, ['bool', 'must', 'constant_score', 'filter', 'range', '@timestamp'])
+ );
expect(
intervals.every(({ gte, lte }) => (gte && lte ? moment(gte).isBefore(lte) : true))
@@ -160,7 +162,9 @@ describe('context app', function () {
).then((hits) => {
const intervals = mockSearchSource.setField.args
.filter(([property]) => property === 'query')
- .map(([, { query }]) => get(query, ['constant_score', 'filter', 'range', '@timestamp']));
+ .map(([, { query }]) =>
+ get(query, ['bool', 'must', 'constant_score', 'filter', 'range', '@timestamp'])
+ );
// should have started at the given time
expect(intervals[0].gte).toEqual(moment(MS_PER_DAY * 1000).toISOString());
diff --git a/src/plugins/discover/public/application/angular/context/api/context.successors.test.js b/src/plugins/discover/public/application/angular/context/api/context.successors.test.js
index ebf6e78585962..285d39cd4d8a4 100644
--- a/src/plugins/discover/public/application/angular/context/api/context.successors.test.js
+++ b/src/plugins/discover/public/application/angular/context/api/context.successors.test.js
@@ -125,7 +125,9 @@ describe('context app', function () {
).then((hits) => {
const intervals = mockSearchSource.setField.args
.filter(([property]) => property === 'query')
- .map(([, { query }]) => get(query, ['constant_score', 'filter', 'range', '@timestamp']));
+ .map(([, { query }]) =>
+ get(query, ['bool', 'must', 'constant_score', 'filter', 'range', '@timestamp'])
+ );
expect(
intervals.every(({ gte, lte }) => (gte && lte ? moment(gte).isBefore(lte) : true))
@@ -163,7 +165,9 @@ describe('context app', function () {
).then((hits) => {
const intervals = mockSearchSource.setField.args
.filter(([property]) => property === 'query')
- .map(([, { query }]) => get(query, ['constant_score', 'filter', 'range', '@timestamp']));
+ .map(([, { query }]) =>
+ get(query, ['bool', 'must', 'constant_score', 'filter', 'range', '@timestamp'])
+ );
// should have started at the given time
expect(intervals[0].lte).toEqual(moment(MS_PER_DAY * 3000).toISOString());
diff --git a/src/plugins/discover/public/application/angular/context/api/context.ts b/src/plugins/discover/public/application/angular/context/api/context.ts
index e244176914a9b..ba8cffd1d7558 100644
--- a/src/plugins/discover/public/application/angular/context/api/context.ts
+++ b/src/plugins/discover/public/application/angular/context/api/context.ts
@@ -31,6 +31,7 @@ export interface EsHitRecord {
fields: Record;
sort: number[];
_source: Record;
+ _id: string;
}
export type EsHitRecordList = EsHitRecord[];
@@ -100,7 +101,8 @@ function fetchContextProvider(indexPatterns: IndexPatternsContract) {
interval,
searchAfter,
remainingSize,
- nanos
+ nanos,
+ anchor._id
);
documents =
diff --git a/src/plugins/discover/public/application/angular/context/api/utils/fetch_hits_in_interval.ts b/src/plugins/discover/public/application/angular/context/api/utils/fetch_hits_in_interval.ts
index 9a199ea4a62fc..5ac4164191633 100644
--- a/src/plugins/discover/public/application/angular/context/api/utils/fetch_hits_in_interval.ts
+++ b/src/plugins/discover/public/application/angular/context/api/utils/fetch_hits_in_interval.ts
@@ -43,7 +43,8 @@ export async function fetchHitsInInterval(
interval: IntervalValue[],
searchAfter: EsQuerySearchAfter,
maxCount: number,
- nanosValue: string
+ nanosValue: string,
+ anchorId: string
): Promise {
const range: RangeQuery = {
format: 'strict_date_optional_time',
@@ -61,10 +62,19 @@ export async function fetchHitsInInterval(
.setField('size', maxCount)
.setField('query', {
query: {
- constant_score: {
- filter: {
- range: {
- [timeField]: range,
+ bool: {
+ must: {
+ constant_score: {
+ filter: {
+ range: {
+ [timeField]: range,
+ },
+ },
+ },
+ },
+ must_not: {
+ ids: {
+ values: [anchorId],
},
},
},
From e52884cfa285ee0aeae6ba1ad7655efefddb67c3 Mon Sep 17 00:00:00 2001
From: Pete Hampton
Date: Fri, 2 Oct 2020 10:28:37 +0100
Subject: [PATCH 10/56] [7.10][Telemetry] Display collected security event
sample (#78963)
* Add security example to usage data opt in panel.
* Update translations.
* Fix docs.
* Fix broken type.
Co-authored-by: Elastic Machine
---
docs/developer/plugin-list.asciidoc | 2 +-
.../telemetry_management_section/README.md | 2 +-
...t_in_security_example_flyout.test.tsx.snap | 134 ++++++++++
...telemetry_management_section.test.tsx.snap | 35 ++-
.../opt_in_security_example_flyout.test.tsx | 27 ++
.../opt_in_security_example_flyout.tsx | 235 ++++++++++++++++++
.../telemetry_management_section.test.tsx | 38 ++-
.../telemetry_management_section.tsx | 37 ++-
.../translations/translations/ja-JP.json | 1 -
.../translations/translations/zh-CN.json | 1 -
10 files changed, 491 insertions(+), 21 deletions(-)
create mode 100644 src/plugins/telemetry_management_section/public/components/__snapshots__/opt_in_security_example_flyout.test.tsx.snap
create mode 100644 src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx
create mode 100644 src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.tsx
diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc
index ed58e77427d47..bf11f87b96ce9 100644
--- a/docs/developer/plugin-list.asciidoc
+++ b/docs/developer/plugin-list.asciidoc
@@ -168,7 +168,7 @@ It also provides a stateful version of it on the start contract.
|{kib-repo}blob/{branch}/src/plugins/telemetry_management_section/README.md[telemetryManagementSection]
-|This plugin adds the Advanced Settings section for the Usage Data collection (aka Telemetry).
+|This plugin adds the Advanced Settings section for the Usage and Security Data collection (aka Telemetry).
|{kib-repo}blob/{branch}/src/plugins/tile_map[tileMap]
diff --git a/src/plugins/telemetry_management_section/README.md b/src/plugins/telemetry_management_section/README.md
index 0f795786720c9..c23a8591f6794 100644
--- a/src/plugins/telemetry_management_section/README.md
+++ b/src/plugins/telemetry_management_section/README.md
@@ -1,5 +1,5 @@
# Telemetry Management Section
-This plugin adds the Advanced Settings section for the Usage Data collection (aka Telemetry).
+This plugin adds the Advanced Settings section for the Usage and Security Data collection (aka Telemetry).
The reason for having it separated from the `telemetry` plugin is to avoid circular dependencies. The plugin `advancedSettings` depends on the `home` app that depends on the `telemetry` plugin because of the telemetry banner in the welcome screen.
diff --git a/src/plugins/telemetry_management_section/public/components/__snapshots__/opt_in_security_example_flyout.test.tsx.snap b/src/plugins/telemetry_management_section/public/components/__snapshots__/opt_in_security_example_flyout.test.tsx.snap
new file mode 100644
index 0000000000000..0b9d426008ca4
--- /dev/null
+++ b/src/plugins/telemetry_management_section/public/components/__snapshots__/opt_in_security_example_flyout.test.tsx.snap
@@ -0,0 +1,134 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`security flyout renders as expected renders as expected 1`] = `
+
+
+
+
+
+ Endpoint security data
+
+
+
+
+ This is a representative sample of the endpoint security alert event that we collect. Endpoint security data is collected only when the Elastic Endpoint is enabled. It includes information about the endpoint configuration and detection events.
+
+
+
+
+
+ {
+ "@timestamp": "2020-09-22T14:34:56.82202300Z",
+ "agent": {
+ "build": {
+ "original": "version: 7.9.1, compiled: Thu Aug 27 14:50:21 2020, branch: 7.9, commit: b594beb958817dee9b9d908191ed766d483df3ea"
+ },
+ "id": "22dd8544-bcac-46cb-b970-5e681bb99e0b",
+ "type": "endpoint",
+ "version": "7.9.1"
+ },
+ "Endpoint": {
+ "policy": {
+ "applied": {
+ "artifacts": {
+ "global": {
+ "identifiers": [
+ {
+ "sha256": "6a546aade5563d3e8dffc1fe2d93d33edda8f9ca3e17ac3cc9ac707620cb9ecd",
+ "name": "endpointpe-v4-blocklist"
+ },
+ {
+ "sha256": "04f9f87accc5d5aea433427bd1bd4ec6908f8528c78ceed26f70df7875a99385",
+ "name": "endpointpe-v4-exceptionlist"
+ },
+ {
+ "sha256": "1471838597fcd79a54ea4a3ec9a9beee1a86feaedab6c98e61102559ced822a8",
+ "name": "endpointpe-v4-model"
+ },
+ {
+ "sha256": "824859b0c6749cc31951d92a73bbdddfcfe9f38abfe432087934d4dab9766ce8",
+ "name": "global-exceptionlist-windows"
+ }
+ ],
+ "version": "1.0.0"
+ },
+ "user": {
+ "identifiers": [
+ {
+ "sha256": "d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658",
+ "name": "endpoint-exceptionlist-windows-v1"
+ }
+ ],
+ "version": "1.0.0"
+ }
+ }
+ }
+ }
+ },
+ "ecs": {
+ "version": "1.5.0"
+ },
+ "elastic": {
+ "agent": {
+ "id": "b2e88aea-2671-402a-828a-957526bac315"
+ }
+ },
+ "file": {
+ "path": "C:\\\\Windows\\\\Temp\\\\mimikatz.exe",
+ "size": 1263880,
+ "created": "2020-05-19T07:50:06.0Z",
+ "accessed": "2020-09-22T14:29:19.93531400Z",
+ "mtime": "2020-09-22T14:29:03.6040000Z",
+ "directory": "C:\\\\Windows\\\\Temp",
+ "hash": {
+ "sha1": "c9fb7f8a4c6b7b12b493a99a8dc6901d17867388",
+ "sha256": "cb1553a3c88817e4cc774a5a93f9158f6785bd3815447d04b6c3f4c2c4b21ed7",
+ "md5": "465d5d850f54d9cde767bda90743df30"
+ },
+ "Ext": {
+ "code_signature": {
+ "trusted": true,
+ "subject_name": "Open Source Developer, Benjamin Delpy",
+ "exists": true,
+ "status": "trusted"
+ },
+ "malware_classification": {
+ "identifier": "endpointpe-v4-model",
+ "score": 0.99956864118576,
+ "threshold": 0.71,
+ "version": "0.0.0"
+ }
+ }
+ },
+ "host": {
+ "os": {
+ "Ext": {
+ "variant": "Windows 10 Enterprise Evaluation"
+ },
+ "kernel": "2004 (10.0.19041.388)",
+ "name": "Windows",
+ "family": "windows",
+ "version": "2004 (10.0.19041.388)",
+ "platform": "windows",
+ "full": "Windows 10 Enterprise Evaluation 2004 (10.0.19041.388)"
+ }
+ },
+ "event": {
+ "kind": "alert"
+ },
+ "cluster_uuid": "kLbKvSMcRiiFAR0t8LebDA",
+ "cluster_name": "elasticsearch"
+}
+
+
+
+
+`;
diff --git a/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap b/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap
index bed1bbeabb044..7357598c8495f 100644
--- a/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap
+++ b/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap
@@ -80,15 +80,32 @@ exports[`TelemetryManagementSectionComponent renders as expected 1`] = `
/>
-
-
-
+
+
+ ,
+ "endpointSecurityData":
+
+ ,
+ }
+ }
+ />
,
"displayName": "Provide usage statistics",
diff --git a/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx b/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx
new file mode 100644
index 0000000000000..c80d0daf5a695
--- /dev/null
+++ b/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx
@@ -0,0 +1,27 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React from 'react';
+import { shallowWithIntl } from 'test_utils/enzyme_helpers';
+import { OptInSecurityExampleFlyout } from './opt_in_security_example_flyout';
+
+describe('security flyout renders as expected', () => {
+ it('renders as expected', () => {
+ expect(shallowWithIntl( )).toMatchSnapshot();
+ });
+});
diff --git a/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.tsx b/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.tsx
new file mode 100644
index 0000000000000..af0de5b268ddc
--- /dev/null
+++ b/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.tsx
@@ -0,0 +1,235 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from 'react';
+
+import {
+ EuiCallOut,
+ EuiCodeBlock,
+ EuiFlexGroup,
+ EuiFlexItem,
+ EuiFlyout,
+ EuiFlyoutHeader,
+ EuiFlyoutBody,
+ EuiLoadingSpinner,
+ EuiPortal, // EuiPortal is a temporary requirement to use EuiFlyout with "ownFocus"
+ EuiText,
+ EuiTextColor,
+ EuiTitle,
+} from '@elastic/eui';
+
+import { FormattedMessage } from '@kbn/i18n/react';
+
+interface Props {
+ onClose: () => void;
+}
+
+interface State {
+ isLoading: boolean;
+ hasPrivilegeToRead: boolean;
+}
+
+/**
+ * React component for displaying the example data associated with the Telemetry opt-in banner.
+ */
+export class OptInSecurityExampleFlyout extends React.PureComponent {
+ public readonly state: State = {
+ isLoading: true,
+ hasPrivilegeToRead: false,
+ };
+
+ async componentDidMount() {
+ try {
+ this.setState({
+ isLoading: false,
+ hasPrivilegeToRead: true,
+ });
+ } catch (err) {
+ this.setState({
+ isLoading: false,
+ hasPrivilegeToRead: err.status !== 403,
+ });
+ }
+ }
+
+ renderBody({ isLoading, hasPrivilegeToRead }: State) {
+ if (isLoading) {
+ return (
+
+
+
+
+
+ );
+ }
+
+ if (!hasPrivilegeToRead) {
+ return (
+
+ }
+ color="danger"
+ iconType="cross"
+ >
+
+
+ );
+ }
+
+ return (
+
+ {JSON.stringify(this.exampleSecurityPayload, null, 2)}
+
+ );
+ }
+
+ render() {
+ return (
+
+
+
+
+ Endpoint security data
+
+
+
+ This is a representative sample of the endpoint security alert event that we
+ collect. Endpoint security data is collected only when the Elastic Endpoint is
+ enabled. It includes information about the endpoint configuration and detection
+ events.
+
+
+
+ {this.renderBody(this.state)}
+
+
+ );
+ }
+
+ exampleSecurityPayload = {
+ '@timestamp': '2020-09-22T14:34:56.82202300Z',
+ agent: {
+ build: {
+ original:
+ 'version: 7.9.1, compiled: Thu Aug 27 14:50:21 2020, branch: 7.9, commit: b594beb958817dee9b9d908191ed766d483df3ea',
+ },
+ id: '22dd8544-bcac-46cb-b970-5e681bb99e0b',
+ type: 'endpoint',
+ version: '7.9.1',
+ },
+ Endpoint: {
+ policy: {
+ applied: {
+ artifacts: {
+ global: {
+ identifiers: [
+ {
+ sha256: '6a546aade5563d3e8dffc1fe2d93d33edda8f9ca3e17ac3cc9ac707620cb9ecd',
+ name: 'endpointpe-v4-blocklist',
+ },
+ {
+ sha256: '04f9f87accc5d5aea433427bd1bd4ec6908f8528c78ceed26f70df7875a99385',
+ name: 'endpointpe-v4-exceptionlist',
+ },
+ {
+ sha256: '1471838597fcd79a54ea4a3ec9a9beee1a86feaedab6c98e61102559ced822a8',
+ name: 'endpointpe-v4-model',
+ },
+ {
+ sha256: '824859b0c6749cc31951d92a73bbdddfcfe9f38abfe432087934d4dab9766ce8',
+ name: 'global-exceptionlist-windows',
+ },
+ ],
+ version: '1.0.0',
+ },
+ user: {
+ identifiers: [
+ {
+ sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
+ name: 'endpoint-exceptionlist-windows-v1',
+ },
+ ],
+ version: '1.0.0',
+ },
+ },
+ },
+ },
+ },
+ ecs: {
+ version: '1.5.0',
+ },
+ elastic: {
+ agent: {
+ id: 'b2e88aea-2671-402a-828a-957526bac315',
+ },
+ },
+ file: {
+ path: 'C:\\Windows\\Temp\\mimikatz.exe',
+ size: 1263880,
+ created: '2020-05-19T07:50:06.0Z',
+ accessed: '2020-09-22T14:29:19.93531400Z',
+ mtime: '2020-09-22T14:29:03.6040000Z',
+ directory: 'C:\\Windows\\Temp',
+ hash: {
+ sha1: 'c9fb7f8a4c6b7b12b493a99a8dc6901d17867388',
+ sha256: 'cb1553a3c88817e4cc774a5a93f9158f6785bd3815447d04b6c3f4c2c4b21ed7',
+ md5: '465d5d850f54d9cde767bda90743df30',
+ },
+ Ext: {
+ code_signature: {
+ trusted: true,
+ subject_name: 'Open Source Developer, Benjamin Delpy',
+ exists: true,
+ status: 'trusted',
+ },
+ malware_classification: {
+ identifier: 'endpointpe-v4-model',
+ score: 0.99956864118576,
+ threshold: 0.71,
+ version: '0.0.0',
+ },
+ },
+ },
+ host: {
+ os: {
+ Ext: {
+ variant: 'Windows 10 Enterprise Evaluation',
+ },
+ kernel: '2004 (10.0.19041.388)',
+ name: 'Windows',
+ family: 'windows',
+ version: '2004 (10.0.19041.388)',
+ platform: 'windows',
+ full: 'Windows 10 Enterprise Evaluation 2004 (10.0.19041.388)',
+ },
+ },
+ event: {
+ kind: 'alert',
+ },
+ cluster_uuid: 'kLbKvSMcRiiFAR0t8LebDA',
+ cluster_name: 'elasticsearch',
+ };
+}
diff --git a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx
index 0e2855f055540..993295746ea5b 100644
--- a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx
+++ b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx
@@ -212,7 +212,7 @@ describe('TelemetryManagementSectionComponent', () => {
/>
);
try {
- const toggleExampleComponent = component.find('p > EuiLink[onClick]');
+ const toggleExampleComponent = component.find('FormattedMessage > EuiLink[onClick]').at(0);
const updatedView = toggleExampleComponent.simulate('click');
updatedView.find('OptInExampleFlyout');
updatedView.simulate('close');
@@ -221,6 +221,42 @@ describe('TelemetryManagementSectionComponent', () => {
}
});
+ it('shows the OptInSecurityExampleFlyout', () => {
+ const onQueryMatchChange = jest.fn();
+ const telemetryService = new TelemetryService({
+ config: {
+ enabled: true,
+ url: '',
+ banner: true,
+ allowChangingOptInStatus: true,
+ optIn: false,
+ optInStatusUrl: '',
+ sendUsageFrom: 'browser',
+ },
+ reportOptInStatusChange: false,
+ notifications: coreStart.notifications,
+ http: coreSetup.http,
+ });
+
+ const component = mountWithIntl(
+
+ );
+ try {
+ const toggleExampleComponent = component.find('FormattedMessage > EuiLink[onClick]').at(1);
+ const updatedView = toggleExampleComponent.simulate('click');
+ updatedView.find('OptInSecurityExampleFlyout');
+ updatedView.simulate('close');
+ } finally {
+ component.unmount();
+ }
+ });
+
it('toggles the OptIn button', async () => {
const onQueryMatchChange = jest.fn();
const telemetryService = new TelemetryService({
diff --git a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx
index 9ae0a3d12fbb5..822d8b49661c1 100644
--- a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx
+++ b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx
@@ -34,6 +34,7 @@ import { i18n } from '@kbn/i18n';
import { TelemetryPluginSetup } from 'src/plugins/telemetry/public';
import { PRIVACY_STATEMENT_URL } from '../../../telemetry/common/constants';
import { OptInExampleFlyout } from './opt_in_example_flyout';
+import { OptInSecurityExampleFlyout } from './opt_in_security_example_flyout';
import { LazyField } from '../../../advanced_settings/public';
import { ToastsStart } from '../../../../core/public';
@@ -53,6 +54,7 @@ interface Props {
interface State {
processing: boolean;
showExample: boolean;
+ showSecurityExample: boolean;
queryMatches: boolean | null;
enabled: boolean;
}
@@ -61,6 +63,7 @@ export class TelemetryManagementSection extends Component {
state: State = {
processing: false,
showExample: false,
+ showSecurityExample: false,
queryMatches: null,
enabled: this.props.telemetryService.getIsOptedIn() || false,
};
@@ -87,7 +90,7 @@ export class TelemetryManagementSection extends Component {
render() {
const { telemetryService } = this.props;
- const { showExample, queryMatches, enabled, processing } = this.state;
+ const { showExample, showSecurityExample, queryMatches, enabled, processing } = this.state;
if (!telemetryService.getCanChangeOptInStatus()) {
return null;
@@ -105,6 +108,7 @@ export class TelemetryManagementSection extends Component {
onClose={this.toggleExample}
/>
)}
+ {showSecurityExample && }
@@ -197,12 +201,25 @@ export class TelemetryManagementSection extends Component {
/>
-
-
-
+
+
+
+ ),
+ endpointSecurityData: (
+
+
+
+ ),
+ }}
+ />
);
@@ -245,6 +262,12 @@ export class TelemetryManagementSection extends Component {
showExample: !this.state.showExample,
});
};
+
+ toggleSecurityExample = () => {
+ this.setState({
+ showSecurityExample: !this.state.showSecurityExample,
+ });
+ };
}
// required for lazy loading
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index bd9a66b48f633..e344d18213ae5 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -2962,7 +2962,6 @@
"telemetry.provideUsageStatisticsAriaName": "使用統計を提供",
"telemetry.provideUsageStatisticsTitle": "使用統計を提供",
"telemetry.readOurUsageDataPrivacyStatementLinkText": "プライバシーポリシー",
- "telemetry.seeExampleOfWhatWeCollectLinkText": "収集されるデータの例を見る",
"telemetry.telemetryBannerDescription": "Elastic Stackの改善にご協力ください使用状況データの収集は現在無効です。使用状況データの収集を有効にすると、製品とサービスを管理して改善することができます。詳細については、{privacyStatementLink}をご覧ください。",
"telemetry.telemetryConfigAndLinkDescription": "使用状況データの収集を有効にすると、製品とサービスを管理して改善することができます。詳細については、{privacyStatementLink}をご覧ください。",
"telemetry.telemetryConfigDescription": "基本的な機能の利用状況に関する統計情報を提供して、Elastic Stack の改善にご協力ください。このデータは Elastic 社外と共有されません。",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 3ce9278234005..ab7b558afbbf2 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -2963,7 +2963,6 @@
"telemetry.provideUsageStatisticsAriaName": "提供使用情况统计",
"telemetry.provideUsageStatisticsTitle": "提供使用情况统计",
"telemetry.readOurUsageDataPrivacyStatementLinkText": "隐私声明",
- "telemetry.seeExampleOfWhatWeCollectLinkText": "查看我们收集的内容示例",
"telemetry.telemetryBannerDescription": "想帮助我们改进 Elastic Stack?数据使用情况收集当前已禁用。启用数据使用情况收集可帮助我们管理并改善产品和服务。有关详情,请参阅我们的{privacyStatementLink}。",
"telemetry.telemetryConfigAndLinkDescription": "启用使用情况数据收集可帮助我们管理并改善产品和服务。有关更多详情,请参阅我们的{privacyStatementLink}。",
"telemetry.telemetryConfigDescription": "通过提供基本功能的使用情况统计信息,来帮助我们改进 Elastic Stack。我们不会在 Elastic 之外共享此数据。",
From 94ef651d7b03f0d31c1b704a66cdb9191e094d88 Mon Sep 17 00:00:00 2001
From: PavithraCP <31021423+PavithraCP@users.noreply.github.com>
Date: Fri, 2 Oct 2020 07:16:46 -0400
Subject: [PATCH 11/56] [Lens]Do not enable histogram mode for multiple
un-stacked bar series (#78525)
---
.../xy_visualization/expression.test.tsx | 50 ++++++++++++++++++-
.../public/xy_visualization/expression.tsx | 14 +++++-
2 files changed, 61 insertions(+), 3 deletions(-)
diff --git a/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx b/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx
index 3bd6cc73d6320..5fc89d831a961 100644
--- a/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx
+++ b/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx
@@ -896,7 +896,12 @@ describe('xy_expression', () => {
test('it applies histogram mode to the series for single series', () => {
const { data, args } = sampleArgs();
- const firstLayer: LayerArgs = { ...args.layers[0], seriesType: 'bar', isHistogram: true };
+ const firstLayer: LayerArgs = {
+ ...args.layers[0],
+ accessors: ['b'],
+ seriesType: 'bar',
+ isHistogram: true,
+ };
delete firstLayer.splitAccessor;
const component = shallow(
{
/>
);
expect(component.find(BarSeries).at(0).prop('enableHistogramMode')).toEqual(true);
- expect(component.find(BarSeries).at(1).prop('enableHistogramMode')).toEqual(true);
+ });
+
+ test('it does not apply histogram mode to more than one bar series for unstacked bar chart', () => {
+ const { data, args } = sampleArgs();
+ const firstLayer: LayerArgs = { ...args.layers[0], seriesType: 'bar', isHistogram: true };
+ delete firstLayer.splitAccessor;
+ const component = shallow(
+
+ );
+ expect(component.find(BarSeries).at(0).prop('enableHistogramMode')).toEqual(false);
+ expect(component.find(BarSeries).at(1).prop('enableHistogramMode')).toEqual(false);
+ });
+
+ test('it applies histogram mode to more than one the series for unstacked line/area chart', () => {
+ const { data, args } = sampleArgs();
+ const firstLayer: LayerArgs = { ...args.layers[0], seriesType: 'line', isHistogram: true };
+ delete firstLayer.splitAccessor;
+ const secondLayer: LayerArgs = { ...args.layers[0], seriesType: 'line', isHistogram: true };
+ delete secondLayer.splitAccessor;
+ const component = shallow(
+
+ );
+ expect(component.find(LineSeries).at(0).prop('enableHistogramMode')).toEqual(true);
+ expect(component.find(LineSeries).at(1).prop('enableHistogramMode')).toEqual(true);
});
test('it applies histogram mode to the series for stacked series', () => {
diff --git a/x-pack/plugins/lens/public/xy_visualization/expression.tsx b/x-pack/plugins/lens/public/xy_visualization/expression.tsx
index f36525a9a0b14..a59739ec78f7f 100644
--- a/x-pack/plugins/lens/public/xy_visualization/expression.tsx
+++ b/x-pack/plugins/lens/public/xy_visualization/expression.tsx
@@ -299,6 +299,13 @@ export function XYChart({
yRight: true,
};
+ const filteredBarLayers = filteredLayers.filter((layer) => layer.seriesType.includes('bar'));
+
+ const chartHasMoreThanOneBarSeries =
+ filteredBarLayers.length > 1 ||
+ filteredBarLayers.some((layer) => layer.accessors.length > 1) ||
+ filteredBarLayers.some((layer) => layer.splitAccessor);
+
function calculateMinInterval() {
// check all the tables to see if all of the rows have the same timestamp
// that would mean that chart will draw a single bar
@@ -599,7 +606,12 @@ export function XYChart({
groupId: yAxesConfiguration.find((axisConfiguration) =>
axisConfiguration.series.find((currentSeries) => currentSeries.accessor === accessor)
)?.groupId,
- enableHistogramMode: isHistogram && (seriesType.includes('stacked') || !splitAccessor),
+ enableHistogramMode:
+ isHistogram &&
+ (seriesType.includes('stacked') || !splitAccessor) &&
+ (seriesType.includes('stacked') ||
+ !seriesType.includes('bar') ||
+ !chartHasMoreThanOneBarSeries),
stackMode: seriesType.includes('percentage') ? StackMode.Percentage : undefined,
timeZone,
areaSeriesStyle: {
From 70dac72ad311d595b0f9f6bc871f718656296da6 Mon Sep 17 00:00:00 2001
From: Tim Roes
Date: Fri, 2 Oct 2020 13:39:38 +0200
Subject: [PATCH 12/56] Move legacy plugins to appropriate teams (#79078)
* Move legacy plugins to appropriate teams
* More cleanup
---
.github/CODEOWNERS | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index fc9c55e7868f4..d1cf0300b9e17 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -17,6 +17,7 @@
/src/plugins/input_control_vis/ @elastic/kibana-app
/src/plugins/management/ @elastic/kibana-app
/src/plugins/kibana_legacy/ @elastic/kibana-app
+/src/plugins/timelion/ @elastic/kibana-app
/src/plugins/vis_default_editor/ @elastic/kibana-app
/src/plugins/vis_type_markdown/ @elastic/kibana-app
/src/plugins/vis_type_metric/ @elastic/kibana-app
@@ -30,32 +31,23 @@
/src/plugins/visualize/ @elastic/kibana-app
/src/plugins/visualizations/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
-#CC# /src/plugins/vis_type @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/common/utils @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/migrations @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/dashboard/ @elastic/kibana-app
-#CC# /src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/discover/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
-#CC# /src/legacy/core_plugins/console_legacy @elastic/kibana-app
#CC# /src/legacy/core_plugins/input_control_vis @elastic/kibana-app
#CC# /src/legacy/core_plugins/timelion @elastic/kibana-app
#CC# /src/legacy/core_plugins/vis_type_tagcloud @elastic/kibana-app
#CC# /src/legacy/core_plugins/vis_type_vega @elastic/kibana-app
#CC# /src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
-#CC# /src/legacy/server/sample_data/ @elastic/kibana-app
#CC# /src/legacy/server/url_shortening/ @elastic/kibana-app
#CC# /src/legacy/ui/public/state_management @elastic/kibana-app
-#CC# /src/plugins/charts/public/static/color_maps @elastic/kibana-app
#CC# /src/plugins/index_pattern_management/public @elastic/kibana-app
-#CC# /src/plugins/input_control_vis/ @elastic/kibana-app
-#CC# /src/plugins/kibana_legacy/ @elastic/kibana-app
-#CC# /src/plugins/timelion @elastic/kibana-app
#CC# /x-pack/legacy/plugins/dashboard_mode/ @elastic/kibana-app
#CC# /x-pack/plugins/dashboard_mode @elastic/kibana-app
-#CC# /x-pack/plugins/lens/ @elastic/kibana-app
# App Architecture
/examples/bfetch_explorer/ @elastic/kibana-app-arch
@@ -147,6 +139,7 @@
/src/plugins/home/server/services/ @elastic/kibana-core-ui
/x-pack/plugins/global_search_bar/ @elastic/kibana-core-ui
#CC# /src/legacy/core_plugins/newsfeed @elastic/kibana-core-ui
+#CC# /src/legacy/server/sample_data/ @elastic/kibana-core-ui
#CC# /src/plugins/newsfeed @elastic/kibana-core-ui
#CC# /src/plugins/home/public @elastic/kibana-core-ui
#CC# /src/plugins/home/server/services/ @elastic/kibana-core-ui
@@ -351,6 +344,8 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
/x-pack/plugins/ingest_pipelines/ @elastic/es-ui
/packages/kbn-ace/ @elastic/es-ui
/packages/kbn-monaco/ @elastic/es-ui
+#CC# /src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/es-ui
+#CC# /src/legacy/core_plugins/console_legacy @elastic/es-ui
#CC# /x-pack/legacy/plugins/rollup/ @elastic/es-ui
#CC# /x-pack/legacy/server/lib/create_router/ @elastic/es-ui
#CC# /x-pack/legacy/server/lib/check_license/ @elastic/es-ui
From 09b0b6630abd6fe03c0be504a8e7a9ee5fc83e24 Mon Sep 17 00:00:00 2001
From: ymao1
Date: Fri, 2 Oct 2020 07:40:47 -0400
Subject: [PATCH 13/56] Rearranged PagerDuty action params so non-optional
params are at the top (#79026)
---
.../pagerduty/pagerduty_params.tsx | 47 ++++++++++---------
1 file changed, 25 insertions(+), 22 deletions(-)
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.tsx
index 39800865ed761..32f16760dd461 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.tsx
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React, { Fragment } from 'react';
-import { EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiSelect } from '@elastic/eui';
+import { EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiSelect, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { ActionParamsProps } from '../../../../types';
import { PagerDutyActionParams } from '.././types';
@@ -143,6 +143,29 @@ const PagerDutyParamsFields: React.FunctionComponent
+
+
+
+
-
-
+
{this.getFeatureListLabel(this.state.selectedBasePrivilege.length > 0)}
@@ -338,7 +287,7 @@ export class PrivilegeSpaceForm extends Component {
buttonText = (
);
}
diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
index 64b7fe3e2e3a9..6bb9840fd343c 100644
--- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
+++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.tsx
@@ -23,7 +23,6 @@ import { FormattedMessage } from '@kbn/i18n/react';
import React, { Component } from 'react';
import { Space, getSpaceColor } from '../../../../../../../../spaces/public';
import { FeaturesPrivileges, Role, copyRole } from '../../../../../../../common/model';
-import { SpacesPopoverList } from '../../../spaces_popover_list';
import { PrivilegeDisplay } from './privilege_display';
import { isGlobalPrivilegeDefinition } from '../../../privilege_utils';
import { PrivilegeFormCalculator } from '../privilege_form_calculator';
@@ -118,19 +117,7 @@ export class PrivilegeSpaceTable extends Component {
const displayedSpaces = isExpanded ? spaces : spaces.slice(0, SPACES_DISPLAY_COUNT);
let button = null;
- if (record.isGlobal) {
- button = (
- s.id !== '*')}
- buttonText={i18n.translate(
- 'xpack.security.management.editRole.spacePrivilegeTable.showAllSpacesLink',
- {
- defaultMessage: 'show spaces',
- }
- )}
- />
- );
- } else if (spaces.length > displayedSpaces.length) {
+ if (spaces.length > displayedSpaces.length) {
button = (
{
name: i18n.translate(
'xpack.security.management.editRole.spaceAwarePrivilegeForm.globalSpacesName',
{
- defaultMessage: '* Global (all spaces)',
+ defaultMessage: '* All Spaces',
}
),
color: '#D3DAE6',
@@ -198,7 +198,7 @@ export class SpaceAwarePrivilegeSection extends Component {
>
);
diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx
index 911a6b78a4944..95295b8e64732 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx
@@ -58,7 +58,7 @@ export class CustomizeSpace extends Component {
};
return (
-
+
diff --git a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/__snapshots__/enabled_features.test.tsx.snap b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/__snapshots__/enabled_features.test.tsx.snap
index ee1eb7c5e9aba..063a34091c4e7 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/__snapshots__/enabled_features.test.tsx.snap
+++ b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/__snapshots__/enabled_features.test.tsx.snap
@@ -2,10 +2,8 @@
exports[`EnabledFeatures renders as expected 1`] = `
{
return (
-
-
- hide
-
-
diff --git a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx
index 0b8085ff1ad16..576881398a63c 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx
@@ -4,14 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { EuiLink } from '@elastic/eui';
import React from 'react';
import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
import { SectionPanel } from './section_panel';
test('it renders without blowing up', () => {
const wrapper = shallowWithIntl(
-
+
child
);
@@ -19,9 +18,9 @@ test('it renders without blowing up', () => {
expect(wrapper).toMatchSnapshot();
});
-test('it renders children by default', () => {
+test('it renders children', () => {
const wrapper = mountWithIntl(
-
+
child 1
child 2
@@ -30,19 +29,3 @@ test('it renders children by default', () => {
expect(wrapper.find(SectionPanel)).toHaveLength(1);
expect(wrapper.find('.child')).toHaveLength(2);
});
-
-test('it hides children when the "hide" link is clicked', () => {
- const wrapper = mountWithIntl(
-
- child 1
- child 2
-
- );
-
- expect(wrapper.find(SectionPanel)).toHaveLength(1);
- expect(wrapper.find('.child')).toHaveLength(2);
-
- wrapper.find(EuiLink).simulate('click');
-
- expect(wrapper.find('.child')).toHaveLength(0);
-});
diff --git a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx
index a6d25511acba6..492932aa95741 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx
@@ -8,39 +8,20 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiIcon,
- EuiLink,
EuiPanel,
EuiSpacer,
EuiTitle,
IconType,
} from '@elastic/eui';
-import { i18n } from '@kbn/i18n';
import React, { Component, Fragment, ReactNode } from 'react';
interface Props {
iconType?: IconType;
title: string | ReactNode;
description: string;
- collapsible: boolean;
- initiallyCollapsed?: boolean;
}
-interface State {
- collapsed: boolean;
-}
-
-export class SectionPanel extends Component {
- public state = {
- collapsed: false,
- };
-
- constructor(props: Props) {
- super(props);
- this.state = {
- collapsed: props.initiallyCollapsed || false,
- };
- }
-
+export class SectionPanel extends Component {
public render() {
return (
@@ -51,30 +32,6 @@ export class SectionPanel extends Component {
}
public getTitle = () => {
- const showLinkText = i18n.translate('xpack.spaces.management.collapsiblePanel.showLinkText', {
- defaultMessage: 'show',
- });
-
- const hideLinkText = i18n.translate('xpack.spaces.management.collapsiblePanel.hideLinkText', {
- defaultMessage: 'hide',
- });
-
- const showLinkDescription = i18n.translate(
- 'xpack.spaces.management.collapsiblePanel.showLinkDescription',
- {
- defaultMessage: 'show {title}',
- values: { title: this.props.description },
- }
- );
-
- const hideLinkDescription = i18n.translate(
- 'xpack.spaces.management.collapsiblePanel.hideLinkDescription',
- {
- defaultMessage: 'hide {title}',
- values: { title: this.props.description },
- }
- );
-
return (
@@ -93,26 +50,11 @@ export class SectionPanel extends Component {
- {this.props.collapsible && (
-
-
- {this.state.collapsed ? showLinkText : hideLinkText}
-
-
- )}
);
};
public getForm = () => {
- if (this.state.collapsed) {
- return null;
- }
-
return (
@@ -120,10 +62,4 @@ export class SectionPanel extends Component {
);
};
-
- public toggleCollapsed = () => {
- this.setState({
- collapsed: !this.state.collapsed,
- });
- };
}
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index e344d18213ae5..f144cbd3873f7 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -14302,8 +14302,6 @@
"xpack.security.management.editRole.elasticSearchPrivileges.manageRoleActionsDescription": "このロールがクラスターに対して実行できる操作を管理します。 ",
"xpack.security.management.editRole.elasticSearchPrivileges.runAsPrivilegesTitle": "権限として実行",
"xpack.security.management.editRole.featureTable.customizeSubFeaturePrivilegesSwitchLabel": "サブ機能権限をカスタマイズする",
- "xpack.security.management.editRole.featureTable.enabledRoleFeaturesEnabledColumnTitle": "権限",
- "xpack.security.management.editRole.featureTable.enabledRoleFeaturesFeatureColumnTitle": "機能",
"xpack.security.management.editRole.featureTable.privilegeCustomizationTooltip": "機能でサブ機能の権限がカスタマイズされています。この行を展開すると詳細が表示されます。",
"xpack.security.management.editRole.indexPrivilegeForm.deleteSpacePrivilegeAriaLabel": "インデックスの権限を削除",
"xpack.security.management.editRole.indexPrivilegeForm.grantedDocumentsQueryFormRowLabel": "提供されたドキュメントのクエリ",
@@ -14345,35 +14343,24 @@
"xpack.security.management.editRole.spaceAwarePrivilegeForm.howToViewAllAvailableSpacesDescription": "利用可能なすべてのスペースを表示する権限がありません。",
"xpack.security.management.editRole.spaceAwarePrivilegeForm.insufficientPrivilegesDescription": "権限が不十分です",
"xpack.security.management.editRole.spaceAwarePrivilegeForm.kibanaAdminTitle": "kibana_admin",
- "xpack.security.management.editRole.spacePrivilegeForm.allPrivilegeDetails": "選択されたスペースの全機能への完全アクセスを許可します。",
- "xpack.security.management.editRole.spacePrivilegeForm.allPrivilegeDisplay": "すべて",
- "xpack.security.management.editRole.spacePrivilegeForm.allPrivilegeDropdownDisplay": "すべて",
"xpack.security.management.editRole.spacePrivilegeForm.cancelButton": "キャンセル",
"xpack.security.management.editRole.spacePrivilegeForm.customizeFeaturePrivilegeDescription": "機能ごとに権限のレベルを上げます。機能によってはスペースごとに非表示になっているか、グローバルスペース権限による影響を受けているものもあります。",
"xpack.security.management.editRole.spacePrivilegeForm.customizeFeaturePrivileges": "機能ごとにカスタマイズ",
- "xpack.security.management.editRole.spacePrivilegeForm.customPrivilegeDetails": "選択されたスペースの機能ごとにアクセスをカスタマイズします",
- "xpack.security.management.editRole.spacePrivilegeForm.customPrivilegeDisplay": "カスタム",
- "xpack.security.management.editRole.spacePrivilegeForm.customPrivilegeDropdownDisplay": "カスタム",
"xpack.security.management.editRole.spacePrivilegeForm.featurePrivilegeSummaryDescription": "機能によってはスペースごとに非表示になっているか、グローバルスペース権限による影響を受けているものもあります。",
"xpack.security.management.editRole.spacePrivilegeForm.globalPrivilegeNotice": "これらの権限はすべての現在および未来のスペースに適用されます。",
"xpack.security.management.editRole.spacePrivilegeForm.globalPrivilegeWarning": "グローバル権限の作成は他のスペース権限に影響を与える可能性があります。",
"xpack.security.management.editRole.spacePrivilegeForm.modalTitle": "スペース権限",
"xpack.security.management.editRole.spacePrivilegeForm.privilegeSelectorFormLabel": "権限",
- "xpack.security.management.editRole.spacePrivilegeForm.readPrivilegeDetails": "選択されたスペースの全機能への読み込み専用アクセスを許可します。",
- "xpack.security.management.editRole.spacePrivilegeForm.readPrivilegeDisplay": "読み込み",
- "xpack.security.management.editRole.spacePrivilegeForm.readPrivilegeDropdownDisplay": "読み込み",
"xpack.security.management.editRole.spacePrivilegeForm.spaceSelectorFormLabel": "スペース",
"xpack.security.management.editRole.spacePrivilegeForm.summaryOfFeaturePrivileges": "機能権限のサマリー",
"xpack.security.management.editRole.spacePrivilegeForm.supersededWarning": "宣言された権限は、構成済みグローバル権限よりも許容度が低くなります。権限サマリーを表示すると有効な権限がわかります。",
"xpack.security.management.editRole.spacePrivilegeForm.supersededWarningTitle": "グローバル権限に置き換え",
"xpack.security.management.editRole.spacePrivilegeMatrix.globalSpaceName": "グローバル",
- "xpack.security.management.editRole.spacePrivilegeMatrix.showAllSpacesLink": "(すべてのスペース)",
"xpack.security.management.editRole.spacePrivilegeMatrix.showNMoreSpacesLink": "他 {count} 件",
"xpack.security.management.editRole.spacePrivilegeSection.addSpacePrivilegeButton": "スペース権限を追加",
"xpack.security.management.editRole.spacePrivilegeSection.noAccessToKibanaTitle": "このロールは Kibana へのアクセスを許可しません",
"xpack.security.management.editRole.spacePrivilegeTable.deletePrivilegesLabel": "次のスペースの権限を削除: {spaceNames}",
"xpack.security.management.editRole.spacePrivilegeTable.editPrivilegesLabel": "次のスペースの権限を編集: {spaceNames}",
- "xpack.security.management.editRole.spacePrivilegeTable.showAllSpacesLink": "スペースを表示",
"xpack.security.management.editRole.spacePrivilegeTable.showLessSpacesLink": "縮小表示",
"xpack.security.management.editRole.spacePrivilegeTable.showNMoreSpacesLink": "他 {count} 件",
"xpack.security.management.editRole.spacePrivilegeTable.supersededPrivilegeWarning": "権限は、構成されたグローバル権限に置き換わります。権限サマリーを表示すると有効な権限がわかります。",
@@ -17360,10 +17347,6 @@
"xpack.spaces.management.advancedSettingsSubtitle.applyingSettingsOnPageToSpaceDescription": "このページの設定は、別途指定されていない限り {spaceName}’スペースに適用されます。’",
"xpack.spaces.management.advancedSettingsTitle.settingsTitle": "設定",
"xpack.spaces.management.breadcrumb": "スペース",
- "xpack.spaces.management.collapsiblePanel.hideLinkDescription": "{title} を非表示",
- "xpack.spaces.management.collapsiblePanel.hideLinkText": "非表示",
- "xpack.spaces.management.collapsiblePanel.showLinkDescription": "{title} を表示",
- "xpack.spaces.management.collapsiblePanel.showLinkText": "表示",
"xpack.spaces.management.confirmAlterActiveSpaceModal.cancelButton": "キャンセル",
"xpack.spaces.management.confirmAlterActiveSpaceModal.reloadWarningMessage": "このスペースで表示される機能を更新しました。保存後にページが更新されます。",
"xpack.spaces.management.confirmAlterActiveSpaceModal.title": "スペースの更新の確認",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index ab7b558afbbf2..c4a599fa35e7f 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -14311,8 +14311,6 @@
"xpack.security.management.editRole.elasticSearchPrivileges.manageRoleActionsDescription": "管理此角色可以对您的集群执行的操作。 ",
"xpack.security.management.editRole.elasticSearchPrivileges.runAsPrivilegesTitle": "运行身份权限",
"xpack.security.management.editRole.featureTable.customizeSubFeaturePrivilegesSwitchLabel": "定制子功能权限",
- "xpack.security.management.editRole.featureTable.enabledRoleFeaturesEnabledColumnTitle": "权限",
- "xpack.security.management.editRole.featureTable.enabledRoleFeaturesFeatureColumnTitle": "功能",
"xpack.security.management.editRole.featureTable.privilegeCustomizationTooltip": "功能已定制子功能权限。展开此行以了解更多信息。",
"xpack.security.management.editRole.indexPrivilegeForm.deleteSpacePrivilegeAriaLabel": "删除索引权限",
"xpack.security.management.editRole.indexPrivilegeForm.grantedDocumentsQueryFormRowLabel": "已授权文档查询",
@@ -14354,35 +14352,24 @@
"xpack.security.management.editRole.spaceAwarePrivilegeForm.howToViewAllAvailableSpacesDescription": "您无权查看所有可用工作区。",
"xpack.security.management.editRole.spaceAwarePrivilegeForm.insufficientPrivilegesDescription": "权限不足",
"xpack.security.management.editRole.spaceAwarePrivilegeForm.kibanaAdminTitle": "kibana_admin",
- "xpack.security.management.editRole.spacePrivilegeForm.allPrivilegeDetails": "授予对选定工作区所有功能的完全访问权限。",
- "xpack.security.management.editRole.spacePrivilegeForm.allPrivilegeDisplay": "全部",
- "xpack.security.management.editRole.spacePrivilegeForm.allPrivilegeDropdownDisplay": "全部",
"xpack.security.management.editRole.spacePrivilegeForm.cancelButton": "取消",
"xpack.security.management.editRole.spacePrivilegeForm.customizeFeaturePrivilegeDescription": "按功能提高权限级别。某些功能可能被工作区隐藏或受全局工作区权限影响。",
"xpack.security.management.editRole.spacePrivilegeForm.customizeFeaturePrivileges": "按功能定制",
- "xpack.security.management.editRole.spacePrivilegeForm.customPrivilegeDetails": "在选定工作区中按功能定制访问权限。",
- "xpack.security.management.editRole.spacePrivilegeForm.customPrivilegeDisplay": "定制",
- "xpack.security.management.editRole.spacePrivilegeForm.customPrivilegeDropdownDisplay": "定制",
"xpack.security.management.editRole.spacePrivilegeForm.featurePrivilegeSummaryDescription": "某些功能可能被工作区隐藏或受全局工作区权限影响。",
"xpack.security.management.editRole.spacePrivilegeForm.globalPrivilegeNotice": "这些权限将应用到所有当前和未来工作区。",
"xpack.security.management.editRole.spacePrivilegeForm.globalPrivilegeWarning": "创建全局权限可能会影响您的其他工作区权限。",
"xpack.security.management.editRole.spacePrivilegeForm.modalTitle": "工作区权限",
"xpack.security.management.editRole.spacePrivilegeForm.privilegeSelectorFormLabel": "权限",
- "xpack.security.management.editRole.spacePrivilegeForm.readPrivilegeDetails": "授予对选定工作区所有功能的只读访问权限。",
- "xpack.security.management.editRole.spacePrivilegeForm.readPrivilegeDisplay": "读取",
- "xpack.security.management.editRole.spacePrivilegeForm.readPrivilegeDropdownDisplay": "读取",
"xpack.security.management.editRole.spacePrivilegeForm.spaceSelectorFormLabel": "工作区",
"xpack.security.management.editRole.spacePrivilegeForm.summaryOfFeaturePrivileges": "功能权限的摘要",
"xpack.security.management.editRole.spacePrivilegeForm.supersededWarning": "声明的权限相对配置的全局权限有较小的宽容度。查看权限摘要以查看有效的权限。",
"xpack.security.management.editRole.spacePrivilegeForm.supersededWarningTitle": "已由全局权限取代",
"xpack.security.management.editRole.spacePrivilegeMatrix.globalSpaceName": "全局",
- "xpack.security.management.editRole.spacePrivilegeMatrix.showAllSpacesLink": "(所有工作区)",
"xpack.security.management.editRole.spacePrivilegeMatrix.showNMoreSpacesLink": "另外 {count} 个",
"xpack.security.management.editRole.spacePrivilegeSection.addSpacePrivilegeButton": "添加工作区权限",
"xpack.security.management.editRole.spacePrivilegeSection.noAccessToKibanaTitle": "此角色未授予对 Kibana 的访问权限",
"xpack.security.management.editRole.spacePrivilegeTable.deletePrivilegesLabel": "删除以下工作区的权限:{spaceNames}。",
"xpack.security.management.editRole.spacePrivilegeTable.editPrivilegesLabel": "编辑以下工作区的权限:{spaceNames}。",
- "xpack.security.management.editRole.spacePrivilegeTable.showAllSpacesLink": "显示工作区",
"xpack.security.management.editRole.spacePrivilegeTable.showLessSpacesLink": "显示更少",
"xpack.security.management.editRole.spacePrivilegeTable.showNMoreSpacesLink": "另外 {count} 个",
"xpack.security.management.editRole.spacePrivilegeTable.supersededPrivilegeWarning": "权限已由配置的全局权限取代。查看权限摘要以查看有效的权限。",
@@ -17370,10 +17357,6 @@
"xpack.spaces.management.advancedSettingsSubtitle.applyingSettingsOnPageToSpaceDescription": "除非已指定,否则此页面上的设置适用于 {spaceName} 空间。",
"xpack.spaces.management.advancedSettingsTitle.settingsTitle": "设置",
"xpack.spaces.management.breadcrumb": "工作区",
- "xpack.spaces.management.collapsiblePanel.hideLinkDescription": "隐藏 {title}",
- "xpack.spaces.management.collapsiblePanel.hideLinkText": "隐藏",
- "xpack.spaces.management.collapsiblePanel.showLinkDescription": "显示 {title}",
- "xpack.spaces.management.collapsiblePanel.showLinkText": "显示",
"xpack.spaces.management.confirmAlterActiveSpaceModal.cancelButton": "取消",
"xpack.spaces.management.confirmAlterActiveSpaceModal.reloadWarningMessage": "您已更新此工作区中的可见功能。保存后,您的页面将重新加载。",
"xpack.spaces.management.confirmAlterActiveSpaceModal.title": "确认更新工作区",
diff --git a/x-pack/test/functional/page_objects/security_page.ts b/x-pack/test/functional/page_objects/security_page.ts
index 3ce8a0e681d69..77457ad94cf88 100644
--- a/x-pack/test/functional/page_objects/security_page.ts
+++ b/x-pack/test/functional/page_objects/security_page.ts
@@ -429,10 +429,7 @@ export function SecurityPageProvider({ getService, getPageObjects }: FtrProvider
const globalSpaceOption = await find.byCssSelector(`#spaceOption_\\*`);
await globalSpaceOption.click();
- await testSubjects.click('basePrivilegeComboBox');
-
- const privilegeOption = await find.byCssSelector(`#basePrivilege_${privilegeName}`);
- await privilegeOption.click();
+ await testSubjects.click(`basePrivilege_${privilegeName}`);
await testSubjects.click('createSpacePrivilegeButton');
}
From 79eb9b7b7a47c4859020b0b84db911143fbffbb4 Mon Sep 17 00:00:00 2001
From: Paul Tavares <56442535+paul-tavares@users.noreply.github.com>
Date: Fri, 2 Oct 2020 08:53:55 -0400
Subject: [PATCH 17/56] Use `process.executable` instead of `process.path`
(#79216)
---
.../common/endpoint/schema/trusted_apps.test.ts | 4 ++--
.../common/endpoint/schema/trusted_apps.ts | 2 +-
.../common/endpoint/types/trusted_apps.ts | 2 +-
.../components/condition_entry.tsx | 2 +-
.../components/trusted_app_card/index.stories.tsx | 4 ++--
.../routes/trusted_apps/trusted_apps.test.ts | 14 +++++++-------
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.test.ts b/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.test.ts
index 13a3fb96e10f7..ef1d9a99b0aeb 100644
--- a/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.test.ts
+++ b/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.test.ts
@@ -76,7 +76,7 @@ describe('When invoking Trusted Apps Schema', () => {
os: 'windows',
entries: [
{
- field: 'process.path.text',
+ field: 'process.executable.text',
type: 'match',
operator: 'included',
value: 'c:/programs files/Anti-Virus',
@@ -204,7 +204,7 @@ describe('When invoking Trusted Apps Schema', () => {
field: 'process.hash.*',
value: 'A4370C0CF81686C0B696FA6261c9d3e0d810ae704ab8301839dffd5d5112f476',
},
- { field: 'process.path.text', value: '/tmp/dir1' },
+ { field: 'process.executable.text', value: '/tmp/dir1' },
].forEach((partialEntry) => {
const bodyMsg3 = {
...getCreateTrustedAppItem(),
diff --git a/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.ts b/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.ts
index 912468b52adc0..25456115b3713 100644
--- a/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.ts
+++ b/x-pack/plugins/security_solution/common/endpoint/schema/trusted_apps.ts
@@ -35,7 +35,7 @@ export const PostTrustedAppCreateRequestSchema = {
schema.object({
field: schema.oneOf([
schema.literal('process.hash.*'),
- schema.literal('process.path.text'),
+ schema.literal('process.executable.text'),
]),
type: schema.literal('match'),
operator: schema.literal('included'),
diff --git a/x-pack/plugins/security_solution/common/endpoint/types/trusted_apps.ts b/x-pack/plugins/security_solution/common/endpoint/types/trusted_apps.ts
index c0afe3b612d82..75e0347b10078 100644
--- a/x-pack/plugins/security_solution/common/endpoint/types/trusted_apps.ts
+++ b/x-pack/plugins/security_solution/common/endpoint/types/trusted_apps.ts
@@ -33,7 +33,7 @@ export interface PostTrustedAppCreateResponse {
}
export interface MacosLinuxConditionEntry {
- field: 'process.hash.*' | 'process.path.text';
+ field: 'process.hash.*' | 'process.executable.text';
type: 'match';
operator: 'included';
value: string;
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/components/condition_entry.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/components/condition_entry.tsx
index 7f7eae18b0816..7d30e81898cf2 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/components/condition_entry.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/components/condition_entry.tsx
@@ -83,7 +83,7 @@ export const ConditionEntry = memo(
'xpack.securitySolution.trustedapps.logicalConditionBuilder.entry.field.path',
{ defaultMessage: 'Path' }
),
- value: 'process.path.text',
+ value: 'process.executable.text',
},
];
}, []);
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/index.stories.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/index.stories.tsx
index 713e5e7095e12..4b64030a702c5 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/index.stories.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/index.stories.tsx
@@ -30,7 +30,7 @@ storiesOf('TrustedApps|TrustedAppCard', module)
trustedApp.created_at = '2020-09-17T14:52:33.899Z';
trustedApp.entries = [
{
- field: 'process.path.text',
+ field: 'process.executable.text',
operator: 'included',
type: 'match',
value: '/some/path/on/file/system',
@@ -44,7 +44,7 @@ storiesOf('TrustedApps|TrustedAppCard', module)
trustedApp.created_at = '2020-09-17T14:52:33.899Z';
trustedApp.entries = [
{
- field: 'process.path.text',
+ field: 'process.executable.text',
operator: 'included',
type: 'match',
value: '/some/path/on/file/system',
diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/trusted_apps.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/trusted_apps.test.ts
index 98c9b79f32d6b..9e9a35ea35318 100644
--- a/x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/trusted_apps.test.ts
+++ b/x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/trusted_apps.test.ts
@@ -240,7 +240,7 @@ describe('when invoking endpoint trusted apps route handlers', () => {
os: 'windows',
entries: [
{
- field: 'process.path.text',
+ field: 'process.executable.text',
type: 'match',
operator: 'included',
value: 'c:/programs files/Anti-Virus',
@@ -293,7 +293,7 @@ describe('when invoking endpoint trusted apps route handlers', () => {
description: 'this one is ok',
entries: [
{
- field: 'process.path.text',
+ field: 'process.executable.text',
operator: 'included',
type: 'match',
value: 'c:/programs files/Anti-Virus',
@@ -320,7 +320,7 @@ describe('when invoking endpoint trusted apps route handlers', () => {
description: 'this one is ok',
entries: [
{
- field: 'process.path.text',
+ field: 'process.executable.text',
operator: 'included',
type: 'match',
value: 'c:/programs files/Anti-Virus',
@@ -357,7 +357,7 @@ describe('when invoking endpoint trusted apps route handlers', () => {
it('should trim condition entry values', async () => {
const newTrustedApp = createNewTrustedAppBody();
newTrustedApp.entries.push({
- field: 'process.path.text',
+ field: 'process.executable.text',
value: '\n some value \r\n ',
operator: 'included',
type: 'match',
@@ -366,13 +366,13 @@ describe('when invoking endpoint trusted apps route handlers', () => {
await routeHandler(context, request, response);
expect(exceptionsListClient.createExceptionListItem.mock.calls[0][0].entries).toEqual([
{
- field: 'process.path.text',
+ field: 'process.executable.text',
operator: 'included',
type: 'match',
value: 'c:/programs files/Anti-Virus',
},
{
- field: 'process.path.text',
+ field: 'process.executable.text',
value: 'some value',
operator: 'included',
type: 'match',
@@ -392,7 +392,7 @@ describe('when invoking endpoint trusted apps route handlers', () => {
await routeHandler(context, request, response);
expect(exceptionsListClient.createExceptionListItem.mock.calls[0][0].entries).toEqual([
{
- field: 'process.path.text',
+ field: 'process.executable.text',
operator: 'included',
type: 'match',
value: 'c:/programs files/Anti-Virus',
From 0628cfecf4ef2d0bab6525702d5a98404cd37509 Mon Sep 17 00:00:00 2001
From: Tiago Costa
Date: Fri, 2 Oct 2020 14:30:32 +0100
Subject: [PATCH 18/56] skip flaky suite (#79249)
---
.../spaces_only/tests/alerting/execution_status.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/execution_status.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/execution_status.ts
index ac63fe8faadc7..1c2e51637fb41 100644
--- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/execution_status.ts
+++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/execution_status.ts
@@ -19,7 +19,8 @@ import { FtrProviderContext } from '../../../common/ftr_provider_context';
export default function executionStatusAlertTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
- describe('executionStatus', () => {
+ // FLAKY: https://github.com/elastic/kibana/issues/79249
+ describe.skip('executionStatus', () => {
const objectRemover = new ObjectRemover(supertest);
after(async () => await objectRemover.removeAll());
From a7d9e2f481c0d15b8fe6d8cedef881a310c23be7 Mon Sep 17 00:00:00 2001
From: Ryan Keairns
Date: Fri, 2 Oct 2020 08:39:37 -0500
Subject: [PATCH 19/56] Improved empty state for nav search (#79123)
* Improved empty state for nav search
* Updates tests to include required props
* Update empty state text
---
...tration_product_no_search_results_dark.svg | 1 +
...ration_product_no_search_results_light.svg | 1 +
.../public/components/search_bar.test.tsx | 21 +++++++-
.../public/components/search_bar.tsx | 51 ++++++++++++-------
.../global_search_bar/public/plugin.tsx | 20 ++++++--
5 files changed, 72 insertions(+), 22 deletions(-)
create mode 100644 x-pack/plugins/global_search_bar/public/assets/illustration_product_no_search_results_dark.svg
create mode 100644 x-pack/plugins/global_search_bar/public/assets/illustration_product_no_search_results_light.svg
diff --git a/x-pack/plugins/global_search_bar/public/assets/illustration_product_no_search_results_dark.svg b/x-pack/plugins/global_search_bar/public/assets/illustration_product_no_search_results_dark.svg
new file mode 100644
index 0000000000000..3a87f06b7bcc8
--- /dev/null
+++ b/x-pack/plugins/global_search_bar/public/assets/illustration_product_no_search_results_dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/x-pack/plugins/global_search_bar/public/assets/illustration_product_no_search_results_light.svg b/x-pack/plugins/global_search_bar/public/assets/illustration_product_no_search_results_light.svg
new file mode 100644
index 0000000000000..ac5298be17cca
--- /dev/null
+++ b/x-pack/plugins/global_search_bar/public/assets/illustration_product_no_search_results_light.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/x-pack/plugins/global_search_bar/public/components/search_bar.test.tsx b/x-pack/plugins/global_search_bar/public/components/search_bar.test.tsx
index 11fbc7931e620..6fad3335c5efc 100644
--- a/x-pack/plugins/global_search_bar/public/components/search_bar.test.tsx
+++ b/x-pack/plugins/global_search_bar/public/components/search_bar.test.tsx
@@ -8,6 +8,7 @@ import React from 'react';
import { wait } from '@testing-library/react';
import { of } from 'rxjs';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
+import { httpServiceMock, uiSettingsServiceMock } from '../../../../../src/core/public/mocks';
import {
GlobalSearchBatchedResults,
GlobalSearchPluginStart,
@@ -47,6 +48,10 @@ const getSearchProps: any = (component: any) => component.find('EuiFieldSearch')
describe('SearchBar', () => {
let searchService: GlobalSearchPluginStart;
let findSpy: jest.SpyInstance;
+ const http = httpServiceMock.createSetupContract({ basePath: '/test' });
+ const basePathUrl = http.basePath.prepend('/plugins/globalSearchBar/assets/');
+ const uiSettings = uiSettingsServiceMock.createStartContract();
+ const darkMode = uiSettings.get('theme:darkMode');
beforeEach(() => {
searchService = globalSearchPluginMock.createStartContract();
@@ -66,7 +71,12 @@ describe('SearchBar', () => {
.mockReturnValueOnce(of(createBatch('Discover', { id: 'My Dashboard', type: 'test' })));
const component = mountWithIntl(
-
+
);
expect(findSpy).toHaveBeenCalledTimes(0);
@@ -85,7 +95,14 @@ describe('SearchBar', () => {
});
it('supports keyboard shortcuts', () => {
- mountWithIntl( );
+ mountWithIntl(
+
+ );
const searchEvent = new KeyboardEvent('keydown', {
key: '/',
diff --git a/x-pack/plugins/global_search_bar/public/components/search_bar.tsx b/x-pack/plugins/global_search_bar/public/components/search_bar.tsx
index 0dde28db0436d..4ca0f8cf81b7b 100644
--- a/x-pack/plugins/global_search_bar/public/components/search_bar.tsx
+++ b/x-pack/plugins/global_search_bar/public/components/search_bar.tsx
@@ -12,6 +12,7 @@ import {
EuiSelectableTemplateSitewideOption,
EuiText,
EuiIcon,
+ EuiImage,
EuiHeaderSectionItemButton,
EuiSelectableMessage,
} from '@elastic/eui';
@@ -27,6 +28,8 @@ import { GlobalSearchPluginStart, GlobalSearchResult } from '../../../global_sea
interface Props {
globalSearch: GlobalSearchPluginStart['find'];
navigateToUrl: ApplicationStart['navigateToUrl'];
+ basePathUrl: string;
+ darkMode: boolean;
}
const clearField = (field: HTMLInputElement) => {
@@ -42,7 +45,7 @@ const clearField = (field: HTMLInputElement) => {
const cleanMeta = (str: string) => (str.charAt(0).toUpperCase() + str.slice(1)).replace(/-/g, ' ');
const blurEvent = new FocusEvent('blur');
-export function SearchBar({ globalSearch, navigateToUrl }: Props) {
+export function SearchBar({ globalSearch, navigateToUrl, basePathUrl, darkMode }: Props) {
const isMounted = useMountedState();
const [searchValue, setSearchValue] = useState('');
const [searchRef, setSearchRef] = useState(null);
@@ -134,6 +137,34 @@ export function SearchBar({ globalSearch, navigateToUrl }: Props) {
}
};
+ const emptyMessage = (
+
+
+
+
+
+
+
+
+
+
+
+ );
+
useEvent('keydown', onKeyDown);
return (
@@ -164,22 +195,8 @@ export function SearchBar({ globalSearch, navigateToUrl }: Props) {
popoverProps={{
repositionOnScroll: true,
}}
- emptyMessage={
-
-
-
-
-
-
-
-
- }
+ emptyMessage={emptyMessage}
+ noMatchesMessage={emptyMessage}
popoverFooter={
{
public start(core: CoreStart, { globalSearch }: GlobalSearchBarPluginStartDeps) {
core.chrome.navControls.registerCenter({
order: 1000,
- mount: (target) => this.mount(target, globalSearch, core.application.navigateToUrl),
+ mount: (target) =>
+ this.mount(
+ target,
+ globalSearch,
+ core.application.navigateToUrl,
+ core.http.basePath.prepend('/plugins/globalSearchBar/assets/'),
+ core.uiSettings.get('theme:darkMode')
+ ),
});
return {};
}
@@ -32,11 +39,18 @@ export class GlobalSearchBarPlugin implements Plugin<{}, {}> {
private mount(
targetDomElement: HTMLElement,
globalSearch: GlobalSearchPluginStart,
- navigateToUrl: ApplicationStart['navigateToUrl']
+ navigateToUrl: ApplicationStart['navigateToUrl'],
+ basePathUrl: string,
+ darkMode: boolean
) {
ReactDOM.render(
-
+
,
targetDomElement
);
From 95bf8750cda2937afbc022163a1d28c0d1326e3e Mon Sep 17 00:00:00 2001
From: Bohdan Tsymbala
Date: Fri, 2 Oct 2020 16:00:09 +0200
Subject: [PATCH 20/56] Refactored store code to group properties related to
location so that would be easy to introduce a new view type parameter.
(#79083)
---
.../public/management/common/routing.test.ts | 22 +++----
.../public/management/common/routing.ts | 35 ++++++-----
.../state/trusted_apps_list_page_state.ts | 12 ++--
.../trusted_apps/store/middleware.test.ts | 58 ++++++++++++------
.../pages/trusted_apps/store/middleware.ts | 12 ++--
.../pages/trusted_apps/store/reducer.test.ts | 14 ++---
.../pages/trusted_apps/store/reducer.ts | 33 ++++------
.../trusted_apps/store/selectors.test.ts | 58 +++++++-----------
.../pages/trusted_apps/store/selectors.ts | 60 ++++++-------------
.../pages/trusted_apps/test_utils/index.ts | 43 ++-----------
.../trusted_apps/view/trusted_apps_list.tsx | 8 +--
.../trusted_apps/view/trusted_apps_page.tsx | 17 +++---
12 files changed, 159 insertions(+), 213 deletions(-)
diff --git a/x-pack/plugins/security_solution/public/management/common/routing.test.ts b/x-pack/plugins/security_solution/public/management/common/routing.test.ts
index 7a36654dcffc3..7082ab0ce5c4f 100644
--- a/x-pack/plugins/security_solution/public/management/common/routing.test.ts
+++ b/x-pack/plugins/security_solution/public/management/common/routing.test.ts
@@ -4,57 +4,57 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { extractListPaginationParams, getTrustedAppsListPath } from './routing';
+import { extractTrustedAppsListPageLocation, getTrustedAppsListPath } from './routing';
import { MANAGEMENT_DEFAULT_PAGE, MANAGEMENT_DEFAULT_PAGE_SIZE } from './constants';
describe('routing', () => {
describe('extractListPaginationParams()', () => {
it('extracts default page index when not provided', () => {
- expect(extractListPaginationParams({}).page_index).toBe(MANAGEMENT_DEFAULT_PAGE);
+ expect(extractTrustedAppsListPageLocation({}).page_index).toBe(MANAGEMENT_DEFAULT_PAGE);
});
it('extracts default page index when too small value provided', () => {
- expect(extractListPaginationParams({ page_index: '-1' }).page_index).toBe(
+ expect(extractTrustedAppsListPageLocation({ page_index: '-1' }).page_index).toBe(
MANAGEMENT_DEFAULT_PAGE
);
});
it('extracts default page index when not a number provided', () => {
- expect(extractListPaginationParams({ page_index: 'a' }).page_index).toBe(
+ expect(extractTrustedAppsListPageLocation({ page_index: 'a' }).page_index).toBe(
MANAGEMENT_DEFAULT_PAGE
);
});
it('extracts only last page index when multiple values provided', () => {
- expect(extractListPaginationParams({ page_index: ['1', '2'] }).page_index).toBe(2);
+ expect(extractTrustedAppsListPageLocation({ page_index: ['1', '2'] }).page_index).toBe(2);
});
it('extracts proper page index when single valid value provided', () => {
- expect(extractListPaginationParams({ page_index: '2' }).page_index).toBe(2);
+ expect(extractTrustedAppsListPageLocation({ page_index: '2' }).page_index).toBe(2);
});
it('extracts default page size when not provided', () => {
- expect(extractListPaginationParams({}).page_size).toBe(MANAGEMENT_DEFAULT_PAGE_SIZE);
+ expect(extractTrustedAppsListPageLocation({}).page_size).toBe(MANAGEMENT_DEFAULT_PAGE_SIZE);
});
it('extracts default page size when invalid option provided', () => {
- expect(extractListPaginationParams({ page_size: '25' }).page_size).toBe(
+ expect(extractTrustedAppsListPageLocation({ page_size: '25' }).page_size).toBe(
MANAGEMENT_DEFAULT_PAGE_SIZE
);
});
it('extracts default page size when not a number provided', () => {
- expect(extractListPaginationParams({ page_size: 'a' }).page_size).toBe(
+ expect(extractTrustedAppsListPageLocation({ page_size: 'a' }).page_size).toBe(
MANAGEMENT_DEFAULT_PAGE_SIZE
);
});
it('extracts only last page size when multiple values provided', () => {
- expect(extractListPaginationParams({ page_size: ['10', '20'] }).page_size).toBe(20);
+ expect(extractTrustedAppsListPageLocation({ page_size: ['10', '20'] }).page_size).toBe(20);
});
it('extracts proper page size when single valid value provided', () => {
- expect(extractListPaginationParams({ page_size: '20' }).page_size).toBe(20);
+ expect(extractTrustedAppsListPageLocation({ page_size: '20' }).page_size).toBe(20);
});
});
diff --git a/x-pack/plugins/security_solution/public/management/common/routing.ts b/x-pack/plugins/security_solution/public/management/common/routing.ts
index cb4ed9b098fce..9acf4a1613c0b 100644
--- a/x-pack/plugins/security_solution/public/management/common/routing.ts
+++ b/x-pack/plugins/security_solution/public/management/common/routing.ts
@@ -21,7 +21,7 @@ import {
import { AdministrationSubTab } from '../types';
import { appendSearch } from '../../common/components/link_to/helpers';
import { EndpointIndexUIQueryParams } from '../pages/endpoint_hosts/types';
-import { TrustedAppsUrlParams } from '../pages/trusted_apps/types';
+import { TrustedAppsListPageLocation } from '../pages/trusted_apps/state';
// Taken from: https://github.com/microsoft/TypeScript/issues/12936#issuecomment-559034150
type ExactKeys = Exclude extends never ? T1 : never;
@@ -94,18 +94,18 @@ const isDefaultOrMissing = (value: T | undefined, defaultValue: T) => {
return value === undefined || value === defaultValue;
};
-const normalizeListPaginationParams = (
- params?: Partial
-): Partial => {
- if (params) {
+const normalizeTrustedAppsPageLocation = (
+ location?: Partial
+): Partial => {
+ if (location) {
return {
- ...(!isDefaultOrMissing(params.page_index, MANAGEMENT_DEFAULT_PAGE)
- ? { page_index: params.page_index }
+ ...(!isDefaultOrMissing(location.page_index, MANAGEMENT_DEFAULT_PAGE)
+ ? { page_index: location.page_index }
: {}),
- ...(!isDefaultOrMissing(params.page_size, MANAGEMENT_DEFAULT_PAGE_SIZE)
- ? { page_size: params.page_size }
+ ...(!isDefaultOrMissing(location.page_size, MANAGEMENT_DEFAULT_PAGE_SIZE)
+ ? { page_size: location.page_size }
: {}),
- ...(!isDefaultOrMissing(params.show, undefined) ? { show: params.show } : {}),
+ ...(!isDefaultOrMissing(location.show, undefined) ? { show: location.show } : {}),
};
} else {
return {};
@@ -135,17 +135,22 @@ const extractPageSize = (query: querystring.ParsedUrlQuery): number => {
return MANAGEMENT_PAGE_SIZE_OPTIONS.includes(pageSize) ? pageSize : MANAGEMENT_DEFAULT_PAGE_SIZE;
};
-export const extractListPaginationParams = (
- query: querystring.ParsedUrlQuery
-): TrustedAppsUrlParams => ({
+export const extractListPaginationParams = (query: querystring.ParsedUrlQuery) => ({
page_index: extractPageIndex(query),
page_size: extractPageSize(query),
});
-export const getTrustedAppsListPath = (params?: Partial): string => {
+export const extractTrustedAppsListPageLocation = (
+ query: querystring.ParsedUrlQuery
+): TrustedAppsListPageLocation => ({
+ ...extractListPaginationParams(query),
+ show: extractFirstParamValue(query, 'show') === 'create' ? 'create' : undefined,
+});
+
+export const getTrustedAppsListPath = (params?: Partial): string => {
const path = generatePath(MANAGEMENT_ROUTING_TRUSTED_APPS_PATH, {
tabName: AdministrationSubTab.trustedApps,
});
- return `${path}${appendSearch(querystring.stringify(normalizeListPaginationParams(params)))}`;
+ return `${path}${appendSearch(querystring.stringify(normalizeTrustedAppsPageLocation(params)))}`;
};
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/state/trusted_apps_list_page_state.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/state/trusted_apps_list_page_state.ts
index 4c38ac0c4239a..a98ec03a006f5 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/state/trusted_apps_list_page_state.ts
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/state/trusted_apps_list_page_state.ts
@@ -7,7 +7,6 @@
import { ServerApiError } from '../../../../common/types';
import { NewTrustedApp, TrustedApp } from '../../../../../common/endpoint/types/trusted_apps';
import { AsyncResourceState } from '.';
-import { TrustedAppsUrlParams } from '../types';
export interface PaginationInfo {
index: number;
@@ -39,12 +38,16 @@ export interface TrustedAppCreateFailure {
data: ServerApiError;
}
+export interface TrustedAppsListPageLocation {
+ page_index: number;
+ page_size: number;
+ show?: 'create';
+}
+
export interface TrustedAppsListPageState {
listView: {
- currentListResourceState: AsyncResourceState;
- currentPaginationInfo: PaginationInfo;
+ listResourceState: AsyncResourceState;
freshDataTimestamp: number;
- show: TrustedAppsUrlParams['show'] | undefined;
};
deletionDialog: {
entry?: TrustedApp;
@@ -56,5 +59,6 @@ export interface TrustedAppsListPageState {
| TrustedAppCreatePending
| TrustedAppCreateSuccess
| TrustedAppCreateFailure;
+ location: TrustedAppsListPageLocation;
active: boolean;
}
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/middleware.test.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/middleware.test.ts
index 19c2d3a62781f..2143b5135c575 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/middleware.test.ts
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/middleware.test.ts
@@ -9,13 +9,12 @@ import { applyMiddleware, createStore } from 'redux';
import { createSpyMiddleware } from '../../../../common/store/test_utils';
import {
- createFailedListViewWithPagination,
createListLoadedResourceState,
createLoadedListViewWithPagination,
- createLoadingListViewWithPagination,
createSampleTrustedApp,
createSampleTrustedApps,
createServerApiError,
+ createUninitialisedResourceState,
createUserChangedUrlAction,
} from '../test_utils';
@@ -76,6 +75,7 @@ describe('middleware', () => {
describe('refreshing list resource state', () => {
it('refreshes the list when location changes and data gets outdated', async () => {
const pagination = { index: 2, size: 50 };
+ const location = { page_index: 2, page_size: 50, show: undefined };
const service = createTrustedAppsServiceMock();
const { store, spyMiddleware } = createStoreSetup(service);
@@ -87,21 +87,30 @@ describe('middleware', () => {
expect(store.getState()).toStrictEqual({
...initialState,
- listView: createLoadingListViewWithPagination(initialNow, pagination),
+ listView: {
+ listResourceState: {
+ type: 'LoadingResourceState',
+ previousState: createUninitialisedResourceState(),
+ },
+ freshDataTimestamp: initialNow,
+ },
active: true,
+ location,
});
await spyMiddleware.waitForAction('trustedAppsListResourceStateChanged');
expect(store.getState()).toStrictEqual({
...initialState,
- listView: createLoadedListViewWithPagination(initialNow, pagination, pagination, 500),
+ listView: createLoadedListViewWithPagination(initialNow, pagination, 500),
active: true,
+ location,
});
});
it('does not refresh the list when location changes and data does not get outdated', async () => {
const pagination = { index: 2, size: 50 };
+ const location = { page_index: 2, page_size: 50, show: undefined };
const service = createTrustedAppsServiceMock();
const { store, spyMiddleware } = createStoreSetup(service);
@@ -118,14 +127,16 @@ describe('middleware', () => {
expect(service.getTrustedAppsList).toBeCalledTimes(1);
expect(store.getState()).toStrictEqual({
...initialState,
- listView: createLoadedListViewWithPagination(initialNow, pagination, pagination, 500),
+ listView: createLoadedListViewWithPagination(initialNow, pagination, 500),
active: true,
+ location,
});
});
it('refreshes the list when data gets outdated with and outdate action', async () => {
const newNow = 222222;
const pagination = { index: 0, size: 10 };
+ const location = { page_index: 0, page_size: 10, show: undefined };
const service = createTrustedAppsServiceMock();
const { store, spyMiddleware } = createStoreSetup(service);
@@ -143,20 +154,24 @@ describe('middleware', () => {
expect(store.getState()).toStrictEqual({
...initialState,
- listView: createLoadingListViewWithPagination(
- newNow,
- pagination,
- createListLoadedResourceState(pagination, 500, initialNow)
- ),
+ listView: {
+ listResourceState: {
+ type: 'LoadingResourceState',
+ previousState: createListLoadedResourceState(pagination, 500, initialNow),
+ },
+ freshDataTimestamp: newNow,
+ },
active: true,
+ location,
});
await spyMiddleware.waitForAction('trustedAppsListResourceStateChanged');
expect(store.getState()).toStrictEqual({
...initialState,
- listView: createLoadedListViewWithPagination(newNow, pagination, pagination, 500),
+ listView: createLoadedListViewWithPagination(newNow, pagination, 500),
active: true,
+ location,
});
});
@@ -172,12 +187,16 @@ describe('middleware', () => {
expect(store.getState()).toStrictEqual({
...initialState,
- listView: createFailedListViewWithPagination(
- initialNow,
- { index: 2, size: 50 },
- createServerApiError('Internal Server Error')
- ),
+ listView: {
+ listResourceState: {
+ type: 'FailedResourceState',
+ error: createServerApiError('Internal Server Error'),
+ lastLoadedState: undefined,
+ },
+ freshDataTimestamp: initialNow,
+ },
active: true,
+ location: { page_index: 2, page_size: 50, show: undefined },
});
const infiniteLoopTest = async () => {
@@ -193,10 +212,11 @@ describe('middleware', () => {
const entry = createSampleTrustedApp(3);
const notFoundError = createServerApiError('Not Found');
const pagination = { index: 0, size: 10 };
+ const location = { page_index: 0, page_size: 10, show: undefined };
const getTrustedAppsListResponse = createGetTrustedListAppsResponse(pagination, 500);
- const listView = createLoadedListViewWithPagination(initialNow, pagination, pagination, 500);
- const listViewNew = createLoadedListViewWithPagination(newNow, pagination, pagination, 500);
- const testStartState = { ...initialState, listView, active: true };
+ const listView = createLoadedListViewWithPagination(initialNow, pagination, 500);
+ const listViewNew = createLoadedListViewWithPagination(newNow, pagination, 500);
+ const testStartState = { ...initialState, listView, active: true, location };
it('does not submit when entry is undefined', async () => {
const service = createTrustedAppsServiceMock();
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/middleware.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/middleware.ts
index dd96c8d807048..9fa456dc5ffe2 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/middleware.ts
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/middleware.ts
@@ -29,12 +29,12 @@ import {
} from './action';
import {
- getCurrentListResourceState,
+ getListResourceState,
getDeletionDialogEntry,
getDeletionSubmissionResourceState,
getLastLoadedListResourceState,
- getListCurrentPageIndex,
- getListCurrentPageSize,
+ getCurrentLocationPageIndex,
+ getCurrentLocationPageSize,
getTrustedAppCreateData,
isCreatePending,
needsRefreshOfListData,
@@ -56,15 +56,15 @@ const refreshListIfNeeded = async (
createTrustedAppsListResourceStateChangedAction({
type: 'LoadingResourceState',
// need to think on how to avoid the casting
- previousState: getCurrentListResourceState(store.getState()) as Immutable<
+ previousState: getListResourceState(store.getState()) as Immutable<
StaleResourceState
>,
})
);
try {
- const pageIndex = getListCurrentPageIndex(store.getState());
- const pageSize = getListCurrentPageSize(store.getState());
+ const pageIndex = getCurrentLocationPageIndex(store.getState());
+ const pageSize = getCurrentLocationPageSize(store.getState());
const response = await trustedAppsService.getTrustedAppsList({
page: pageIndex + 1,
per_page: pageSize,
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/reducer.test.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/reducer.test.ts
index 228f0932edd28..94fcdb39bb169 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/reducer.test.ts
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/reducer.test.ts
@@ -32,17 +32,14 @@ describe('reducer', () => {
expect(result).toStrictEqual({
...initialState,
- listView: { ...initialState.listView, currentPaginationInfo: { index: 5, size: 50 } },
+ location: { page_index: 5, page_size: 50, show: undefined },
active: true,
});
});
it('extracts default pagination parameters when none provided', () => {
const result = trustedAppsPageReducer(
- {
- ...initialState,
- listView: { ...initialState.listView, currentPaginationInfo: { index: 5, size: 50 } },
- },
+ { ...initialState, location: { page_index: 5, page_size: 50 } },
createUserChangedUrlAction('/trusted_apps', '?page_index=b&page_size=60')
);
@@ -51,10 +48,7 @@ describe('reducer', () => {
it('extracts default pagination parameters when invalid provided', () => {
const result = trustedAppsPageReducer(
- {
- ...initialState,
- listView: { ...initialState.listView, currentPaginationInfo: { index: 5, size: 50 } },
- },
+ { ...initialState, location: { page_index: 5, page_size: 50 } },
createUserChangedUrlAction('/trusted_apps')
);
@@ -85,7 +79,7 @@ describe('reducer', () => {
expect(result).toStrictEqual({
...initialState,
- listView: { ...initialState.listView, currentListResourceState: listResourceState },
+ listView: { ...initialState.listView, listResourceState },
});
});
});
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/reducer.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/reducer.ts
index ec210254bf76f..f4056f02a4140 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/reducer.ts
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/reducer.ts
@@ -11,7 +11,8 @@ import { ImmutableReducer } from '../../../../common/store';
import { AppLocation, Immutable } from '../../../../../common/endpoint/types';
import { UserChangedUrl } from '../../../../common/store/routing/action';
import { AppAction } from '../../../../common/store/actions';
-import { extractFirstParamValue, extractListPaginationParams } from '../../../common/routing';
+import { extractTrustedAppsListPageLocation } from '../../../common/routing';
+
import {
MANAGEMENT_ROUTING_TRUSTED_APPS_PATH,
MANAGEMENT_DEFAULT_PAGE,
@@ -29,6 +30,7 @@ import {
ServerReturnedCreateTrustedAppSuccess,
UserClickedSaveNewTrustedAppButton,
} from './action';
+
import { TrustedAppsListPageState } from '../state';
type StateReducer = ImmutableReducer;
@@ -64,7 +66,7 @@ const trustedAppsListResourceStateChanged: CaseReducer = (state, action) => {
if (isTrustedAppsPageLocation(action.payload)) {
const parsedUrlsParams = parse(action.payload.search.slice(1));
- const paginationParams = extractListPaginationParams(parsedUrlsParams);
- const show =
- extractFirstParamValue(parsedUrlsParams, 'show') === 'create' ? 'create' : undefined;
+ const location = extractTrustedAppsListPageLocation(parsedUrlsParams);
return {
...state,
- listView: {
- ...state.listView,
- currentPaginationInfo: {
- index: paginationParams.page_index,
- size: paginationParams.page_size,
- },
- show,
- },
- createView: show ? state.createView : undefined,
+ createView: location.show ? state.createView : undefined,
active: true,
+ location,
};
} else {
return initialTrustedAppsPageState();
@@ -150,16 +143,16 @@ const initialDeletionDialogState = (): TrustedAppsListPageState['deletionDialog'
export const initialTrustedAppsPageState = (): TrustedAppsListPageState => ({
listView: {
- currentListResourceState: { type: 'UninitialisedResourceState' },
- currentPaginationInfo: {
- index: MANAGEMENT_DEFAULT_PAGE,
- size: MANAGEMENT_DEFAULT_PAGE_SIZE,
- },
+ listResourceState: { type: 'UninitialisedResourceState' },
freshDataTimestamp: Date.now(),
- show: undefined,
},
deletionDialog: initialDeletionDialogState(),
createView: undefined,
+ location: {
+ page_index: MANAGEMENT_DEFAULT_PAGE,
+ page_size: MANAGEMENT_DEFAULT_PAGE_SIZE,
+ show: undefined,
+ },
active: false,
});
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/selectors.test.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/selectors.test.ts
index 0be4d0b05acc4..01fe3e5bf202e 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/selectors.test.ts
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/selectors.test.ts
@@ -7,10 +7,10 @@
import { AsyncResourceState, TrustedAppsListPageState } from '../state';
import { initialTrustedAppsPageState } from './reducer';
import {
- getCurrentListResourceState,
+ getListResourceState,
getLastLoadedListResourceState,
- getListCurrentPageIndex,
- getListCurrentPageSize,
+ getCurrentLocationPageIndex,
+ getCurrentLocationPageSize,
getListErrorMessage,
getListItems,
getListTotalItemsCount,
@@ -25,7 +25,6 @@ import {
} from './selectors';
import {
- createDefaultListView,
createDefaultPaginationInfo,
createListComplexLoadingResourceState,
createListFailedResourceState,
@@ -85,16 +84,17 @@ describe('selectors', () => {
it('returns false when current loaded data is up to date', () => {
const listView = createLoadedListViewWithPagination(initialNow);
+ const location = { page_index: 0, page_size: 10 };
- expect(needsRefreshOfListData({ ...initialState, listView, active: true })).toBe(false);
+ expect(needsRefreshOfListData({ ...initialState, listView, active: true, location })).toBe(
+ false
+ );
});
});
- describe('getCurrentListResourceState()', () => {
+ describe('getListResourceState()', () => {
it('returns current list resource state', () => {
- const state = { ...initialState, listView: createDefaultListView(initialNow) };
-
- expect(getCurrentListResourceState(state)).toStrictEqual(createUninitialisedResourceState());
+ expect(getListResourceState(initialState)).toStrictEqual(createUninitialisedResourceState());
});
});
@@ -103,14 +103,12 @@ describe('selectors', () => {
const state = {
...initialState,
listView: {
- currentListResourceState: createListComplexLoadingResourceState(
+ listResourceState: createListComplexLoadingResourceState(
createDefaultPaginationInfo(),
200,
initialNow
),
- currentPaginationInfo: createDefaultPaginationInfo(),
freshDataTimestamp: initialNow,
- show: undefined,
},
};
@@ -122,23 +120,19 @@ describe('selectors', () => {
describe('getListItems()', () => {
it('returns empty list when no valid data loaded', () => {
- const state = { ...initialState, listView: createDefaultListView(initialNow) };
-
- expect(getListItems(state)).toStrictEqual([]);
+ expect(getListItems(initialState)).toStrictEqual([]);
});
it('returns last loaded list items', () => {
const state = {
...initialState,
listView: {
- currentListResourceState: createListComplexLoadingResourceState(
+ listResourceState: createListComplexLoadingResourceState(
createDefaultPaginationInfo(),
200,
initialNow
),
- currentPaginationInfo: createDefaultPaginationInfo(),
freshDataTimestamp: initialNow,
- show: undefined,
},
};
@@ -150,23 +144,19 @@ describe('selectors', () => {
describe('getListTotalItemsCount()', () => {
it('returns 0 when no valid data loaded', () => {
- const state = { ...initialState, listView: createDefaultListView(initialNow) };
-
- expect(getListTotalItemsCount(state)).toBe(0);
+ expect(getListTotalItemsCount(initialState)).toBe(0);
});
it('returns last loaded total items count', () => {
const state = {
...initialState,
listView: {
- currentListResourceState: createListComplexLoadingResourceState(
+ listResourceState: createListComplexLoadingResourceState(
createDefaultPaginationInfo(),
200,
initialNow
),
- currentPaginationInfo: createDefaultPaginationInfo(),
freshDataTimestamp: initialNow,
- show: undefined,
},
};
@@ -176,17 +166,17 @@ describe('selectors', () => {
describe('getListCurrentPageIndex()', () => {
it('returns page index', () => {
- const state = { ...initialState, listView: createDefaultListView(initialNow) };
+ const state = { ...initialState, location: { page_index: 3, page_size: 10 } };
- expect(getListCurrentPageIndex(state)).toBe(0);
+ expect(getCurrentLocationPageIndex(state)).toBe(3);
});
});
describe('getListCurrentPageSize()', () => {
it('returns page size', () => {
- const state = { ...initialState, listView: createDefaultListView(initialNow) };
+ const state = { ...initialState, location: { page_index: 0, page_size: 20 } };
- expect(getListCurrentPageSize(state)).toBe(20);
+ expect(getCurrentLocationPageSize(state)).toBe(20);
});
});
@@ -195,14 +185,12 @@ describe('selectors', () => {
const state = {
...initialState,
listView: {
- currentListResourceState: createListComplexLoadingResourceState(
+ listResourceState: createListComplexLoadingResourceState(
createDefaultPaginationInfo(),
200,
initialNow
),
- currentPaginationInfo: createDefaultPaginationInfo(),
freshDataTimestamp: initialNow,
- show: undefined,
},
};
@@ -213,10 +201,8 @@ describe('selectors', () => {
const state = {
...initialState,
listView: {
- currentListResourceState: createListFailedResourceState('Internal Server Error'),
- currentPaginationInfo: createDefaultPaginationInfo(),
+ listResourceState: createListFailedResourceState('Internal Server Error'),
freshDataTimestamp: initialNow,
- show: undefined,
},
};
@@ -233,14 +219,12 @@ describe('selectors', () => {
const state = {
...initialState,
listView: {
- currentListResourceState: createListComplexLoadingResourceState(
+ listResourceState: createListComplexLoadingResourceState(
createDefaultPaginationInfo(),
200,
initialNow
),
- currentPaginationInfo: createDefaultPaginationInfo(),
freshDataTimestamp: initialNow,
- show: undefined,
},
};
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/selectors.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/selectors.ts
index 6239b425efe2f..62ffa364e4a6c 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/selectors.ts
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/selectors.ts
@@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { createSelector } from 'reselect';
import { ServerApiError } from '../../../../common/types';
import { Immutable, NewTrustedApp, TrustedApp } from '../../../../../common/endpoint/types';
@@ -17,97 +16,76 @@ import {
isLoadingResourceState,
isOutdatedResourceState,
LoadedResourceState,
- PaginationInfo,
TrustedAppCreateFailure,
TrustedAppsListData,
+ TrustedAppsListPageLocation,
TrustedAppsListPageState,
} from '../state';
-import { TrustedAppsUrlParams } from '../types';
import {
isTrustedAppCreateFailureState,
isTrustedAppCreatePendingState,
isTrustedAppCreateSuccessState,
} from '../state/type_guards';
-const pageInfosEqual = (pageInfo1: PaginationInfo, pageInfo2: PaginationInfo): boolean =>
- pageInfo1.index === pageInfo2.index && pageInfo1.size === pageInfo2.size;
-
export const needsRefreshOfListData = (state: Immutable): boolean => {
- const currentPageInfo = state.listView.currentPaginationInfo;
- const currentPage = state.listView.currentListResourceState;
const freshDataTimestamp = state.listView.freshDataTimestamp;
+ const currentPage = state.listView.listResourceState;
+ const location = state.location;
return (
state.active &&
isOutdatedResourceState(currentPage, (data) => {
return (
- pageInfosEqual(currentPageInfo, data.paginationInfo) && data.timestamp >= freshDataTimestamp
+ data.paginationInfo.index === location.page_index &&
+ data.paginationInfo.size === location.page_size &&
+ data.timestamp >= freshDataTimestamp
);
})
);
};
-export const getCurrentListResourceState = (
+export const getListResourceState = (
state: Immutable
): Immutable> | undefined => {
- return state.listView.currentListResourceState;
+ return state.listView.listResourceState;
};
export const getLastLoadedListResourceState = (
state: Immutable
): Immutable> | undefined => {
- return getLastLoadedResourceState(state.listView.currentListResourceState);
+ return getLastLoadedResourceState(state.listView.listResourceState);
};
export const getListItems = (
state: Immutable
): Immutable => {
- return getLastLoadedResourceState(state.listView.currentListResourceState)?.data.items || [];
+ return getLastLoadedResourceState(state.listView.listResourceState)?.data.items || [];
};
-export const getListCurrentPageIndex = (state: Immutable): number => {
- return state.listView.currentPaginationInfo.index;
+export const getCurrentLocationPageIndex = (state: Immutable): number => {
+ return state.location.page_index;
};
-export const getListCurrentPageSize = (state: Immutable): number => {
- return state.listView.currentPaginationInfo.size;
+export const getCurrentLocationPageSize = (state: Immutable): number => {
+ return state.location.page_size;
};
export const getListTotalItemsCount = (state: Immutable): number => {
- return (
- getLastLoadedResourceState(state.listView.currentListResourceState)?.data.totalItemsCount || 0
- );
-};
-
-export const getListCurrentShowValue: (
- state: Immutable
-) => TrustedAppsListPageState['listView']['show'] = (state) => {
- return state.listView.show;
+ return getLastLoadedResourceState(state.listView.listResourceState)?.data.totalItemsCount || 0;
};
-export const getListUrlSearchParams: (
+export const getCurrentLocation = (
state: Immutable
-) => TrustedAppsUrlParams = createSelector(
- getListCurrentPageIndex,
- getListCurrentPageSize,
- getListCurrentShowValue,
- (pageIndex, pageSize, showValue) => {
- return {
- page_index: pageIndex,
- page_size: pageSize,
- show: showValue,
- };
- }
-);
+): TrustedAppsListPageLocation => state.location;
export const getListErrorMessage = (
state: Immutable
): string | undefined => {
- return getCurrentResourceError(state.listView.currentListResourceState)?.message;
+ return getCurrentResourceError(state.listView.listResourceState)?.message;
};
export const isListLoading = (state: Immutable): boolean => {
- return isLoadingResourceState(state.listView.currentListResourceState);
+ return isLoadingResourceState(state.listView.listResourceState);
};
export const isDeletionDialogOpen = (state: Immutable): boolean => {
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/test_utils/index.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/test_utils/index.ts
index 020a87f526e52..c23b6ceae7b07 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/test_utils/index.ts
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/test_utils/index.ts
@@ -5,11 +5,12 @@
*/
import { combineReducers, createStore } from 'redux';
-import { ServerApiError } from '../../../../common/types';
import { TrustedApp } from '../../../../../common/endpoint/types';
import { RoutingAction } from '../../../../common/store/routing';
import {
+ MANAGEMENT_DEFAULT_PAGE,
+ MANAGEMENT_DEFAULT_PAGE_SIZE,
MANAGEMENT_STORE_GLOBAL_NAMESPACE,
MANAGEMENT_STORE_TRUSTED_APPS_NAMESPACE,
} from '../../../common/constants';
@@ -105,54 +106,22 @@ export const createListComplexLoadingResourceState = (
)
);
-export const createDefaultPaginationInfo = () => ({ index: 0, size: 20 });
-
-export const createDefaultListView = (
- freshDataTimestamp: number
-): TrustedAppsListPageState['listView'] => ({
- currentListResourceState: createUninitialisedResourceState(),
- currentPaginationInfo: createDefaultPaginationInfo(),
- freshDataTimestamp,
- show: undefined,
-});
-
-export const createLoadingListViewWithPagination = (
- freshDataTimestamp: number,
- currentPaginationInfo: PaginationInfo,
- previousState: StaleResourceState = createUninitialisedResourceState()
-): TrustedAppsListPageState['listView'] => ({
- currentListResourceState: { type: 'LoadingResourceState', previousState },
- currentPaginationInfo,
- freshDataTimestamp,
- show: undefined,
+export const createDefaultPaginationInfo = () => ({
+ index: MANAGEMENT_DEFAULT_PAGE,
+ size: MANAGEMENT_DEFAULT_PAGE_SIZE,
});
export const createLoadedListViewWithPagination = (
freshDataTimestamp: number,
paginationInfo: PaginationInfo = createDefaultPaginationInfo(),
- currentPaginationInfo: PaginationInfo = createDefaultPaginationInfo(),
totalItemsCount: number = 200
): TrustedAppsListPageState['listView'] => ({
- currentListResourceState: createListLoadedResourceState(
+ listResourceState: createListLoadedResourceState(
paginationInfo,
totalItemsCount,
freshDataTimestamp
),
- currentPaginationInfo,
- freshDataTimestamp,
- show: undefined,
-});
-
-export const createFailedListViewWithPagination = (
- freshDataTimestamp: number,
- currentPaginationInfo: PaginationInfo,
- error: ServerApiError,
- lastLoadedState?: LoadedResourceState
-): TrustedAppsListPageState['listView'] => ({
- currentListResourceState: { type: 'FailedResourceState', error, lastLoadedState },
- currentPaginationInfo,
freshDataTimestamp,
- show: undefined,
});
export const createUserChangedUrlAction = (path: string, search: string = ''): RoutingAction => {
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_list.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_list.tsx
index d0c1fb477ea46..ae1f314842aab 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_list.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_list.tsx
@@ -23,8 +23,8 @@ import { MANAGEMENT_PAGE_SIZE_OPTIONS } from '../../../common/constants';
import { getTrustedAppsListPath } from '../../../common/routing';
import {
- getListCurrentPageIndex,
- getListCurrentPageSize,
+ getCurrentLocationPageIndex,
+ getCurrentLocationPageSize,
getListErrorMessage,
getListItems,
getListTotalItemsCount,
@@ -149,8 +149,8 @@ const getColumnDefinitions = (context: TrustedAppsListContext): ColumnsList => {
export const TrustedAppsList = memo(() => {
const [detailsMap, setDetailsMap] = useState({});
- const pageIndex = useTrustedAppsSelector(getListCurrentPageIndex);
- const pageSize = useTrustedAppsSelector(getListCurrentPageSize);
+ const pageIndex = useTrustedAppsSelector(getCurrentLocationPageIndex);
+ const pageSize = useTrustedAppsSelector(getCurrentLocationPageSize);
const totalItemCount = useTrustedAppsSelector(getListTotalItemsCount);
const listItems = useTrustedAppsSelector(getListItems);
const dispatch = useDispatch();
diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.tsx
index 878818d9b77fe..d63cda5b513dc 100644
--- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.tsx
@@ -15,27 +15,26 @@ import { TrustedAppsNotifications } from './trusted_apps_notifications';
import { CreateTrustedAppFlyout } from './components/create_trusted_app_flyout';
import { getTrustedAppsListPath } from '../../../common/routing';
import { useTrustedAppsSelector } from './hooks';
-import { getListCurrentShowValue, getListUrlSearchParams } from '../store/selectors';
+import { getCurrentLocation } from '../store/selectors';
import { TrustedAppsListPageRouteState } from '../../../../../common/endpoint/types';
import { useNavigateToAppEventHandler } from '../../../../common/hooks/endpoint/use_navigate_to_app_event_handler';
export const TrustedAppsPage = memo(() => {
const history = useHistory();
const { state: routeState } = useLocation();
- const urlParams = useTrustedAppsSelector(getListUrlSearchParams);
- const showAddFlout = useTrustedAppsSelector(getListCurrentShowValue) === 'create';
+ const location = useTrustedAppsSelector(getCurrentLocation);
const handleAddButtonClick = useCallback(() => {
history.push(
getTrustedAppsListPath({
- ...urlParams,
+ ...location,
show: 'create',
})
);
- }, [history, urlParams]);
+ }, [history, location]);
const handleAddFlyoutClose = useCallback(() => {
- const { show, ...paginationParamsOnly } = urlParams;
+ const { show, ...paginationParamsOnly } = location;
history.push(getTrustedAppsListPath(paginationParamsOnly));
- }, [history, urlParams]);
+ }, [history, location]);
const backButton = useMemo(() => {
if (routeState && routeState.onBackButtonNavigateTo) {
@@ -50,7 +49,7 @@ export const TrustedAppsPage = memo(() => {
@@ -82,7 +81,7 @@ export const TrustedAppsPage = memo(() => {
>
- {showAddFlout && (
+ {location.show === 'create' && (
Date: Fri, 2 Oct 2020 10:10:38 -0400
Subject: [PATCH 21/56] [Security Solution][Detections] Enrich shell signals
with fields common to all building blocks (#79130)
* Enrich shell signals with fields common to all building blocks
* PR comments + additional unit test
---
.../signals/build_bulk_body.test.ts | 448 +++++++++++++++++-
.../signals/build_bulk_body.ts | 53 +++
2 files changed, 498 insertions(+), 3 deletions(-)
diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.test.ts
index 2f7dd22c0c78e..75a7de8cd2c44 100644
--- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.test.ts
+++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_bulk_body.test.ts
@@ -11,8 +11,15 @@ import {
sampleIdGuid,
sampleDocWithAncestors,
sampleRuleSO,
+ sampleDocNoSortIdNoVersion,
} from './__mocks__/es_results';
-import { buildBulkBody, buildSignalFromSequence, buildSignalFromEvent } from './build_bulk_body';
+import {
+ buildBulkBody,
+ buildSignalFromSequence,
+ buildSignalFromEvent,
+ objectPairIntersection,
+ objectArrayIntersection,
+} from './build_bulk_body';
import { SignalHit } from './types';
import { getListArrayMock } from '../../../../common/detection_engine/schemas/types/lists.mock';
@@ -438,13 +445,20 @@ describe('buildBulkBody', () => {
describe('buildSignalFromSequence', () => {
test('builds a basic signal from a sequence of building blocks', () => {
- const blocks = [sampleDocWithAncestors().hits.hits[0], sampleDocWithAncestors().hits.hits[0]];
+ const block1 = sampleDocWithAncestors().hits.hits[0];
+ block1._source.new_key = 'new_key_value';
+ block1._source.new_key2 = 'new_key2_value';
+ const block2 = sampleDocWithAncestors().hits.hits[0];
+ block2._source.new_key = 'new_key_value';
+ const blocks = [block1, block2];
const ruleSO = sampleRuleSO();
const signal = buildSignalFromSequence(blocks, ruleSO);
// Timestamp will potentially always be different so remove it for the test
// @ts-expect-error
delete signal['@timestamp'];
- const expected: Omit = {
+ const expected: Omit & { someKey: string; new_key: string } = {
+ someKey: 'someValue',
+ new_key: 'new_key_value',
event: {
kind: 'signal',
},
@@ -539,6 +553,96 @@ describe('buildSignalFromSequence', () => {
};
expect(signal).toEqual(expected);
});
+
+ test('builds a basic signal if there is no overlap between source events', () => {
+ const block1 = sampleDocNoSortIdNoVersion();
+ const block2 = sampleDocNoSortIdNoVersion();
+ block2._source['@timestamp'] = '2021-05-20T22:28:46+0000';
+ block2._source.someKey = 'someOtherValue';
+ const ruleSO = sampleRuleSO();
+ const signal = buildSignalFromSequence([block1, block2], ruleSO);
+ // Timestamp will potentially always be different so remove it for the test
+ // @ts-expect-error
+ delete signal['@timestamp'];
+ const expected: Omit = {
+ event: {
+ kind: 'signal',
+ },
+ signal: {
+ parents: [
+ {
+ id: sampleIdGuid,
+ type: 'event',
+ index: 'myFakeSignalIndex',
+ depth: 0,
+ },
+ {
+ id: sampleIdGuid,
+ type: 'event',
+ index: 'myFakeSignalIndex',
+ depth: 0,
+ },
+ ],
+ ancestors: [
+ {
+ id: sampleIdGuid,
+ type: 'event',
+ index: 'myFakeSignalIndex',
+ depth: 0,
+ },
+ {
+ id: sampleIdGuid,
+ type: 'event',
+ index: 'myFakeSignalIndex',
+ depth: 0,
+ },
+ ],
+ status: 'open',
+ rule: {
+ actions: [],
+ author: ['Elastic'],
+ building_block_type: 'default',
+ id: '04128c15-0d1b-4716-a4c5-46997ac7f3bd',
+ rule_id: 'rule-1',
+ false_positives: [],
+ max_signals: 10000,
+ risk_score: 50,
+ risk_score_mapping: [],
+ output_index: '.siem-signals',
+ description: 'Detecting root and admin users',
+ from: 'now-6m',
+ immutable: false,
+ index: ['auditbeat-*', 'filebeat-*', 'packetbeat-*', 'winlogbeat-*'],
+ interval: '5m',
+ language: 'kuery',
+ license: 'Elastic License',
+ name: 'rule-name',
+ query: 'user.name: root or user.name: admin',
+ references: ['http://google.com'],
+ severity: 'high',
+ severity_mapping: [],
+ tags: ['some fake tag 1', 'some fake tag 2'],
+ threat: [],
+ type: 'query',
+ to: 'now',
+ note: '',
+ enabled: true,
+ created_by: 'sample user',
+ updated_by: 'sample user',
+ version: 1,
+ updated_at: ruleSO.updated_at ?? '',
+ created_at: ruleSO.attributes.createdAt,
+ throttle: 'no_actions',
+ exceptions_list: getListArrayMock(),
+ },
+ depth: 1,
+ group: {
+ id: '269c1f5754bff92fb8040283b687258e99b03e8b2ab1262cc20c82442e5de5ea',
+ },
+ },
+ };
+ expect(signal).toEqual(expected);
+ });
});
describe('buildSignalFromEvent', () => {
@@ -632,3 +736,341 @@ describe('buildSignalFromEvent', () => {
expect(signal).toEqual(expected);
});
});
+
+describe('recursive intersection between objects', () => {
+ test('should treat numbers and strings as unequal', () => {
+ const a = {
+ field1: 1,
+ field2: 1,
+ };
+ const b = {
+ field1: 1,
+ field2: '1',
+ };
+ const intersection = objectPairIntersection(a, b);
+ const expected = {
+ field1: 1,
+ };
+ expect(intersection).toEqual(expected);
+ });
+
+ test('should strip unequal numbers and strings', () => {
+ const a = {
+ field1: 1,
+ field2: 1,
+ field3: 'abcd',
+ field4: 'abcd',
+ };
+ const b = {
+ field1: 1,
+ field2: 100,
+ field3: 'abcd',
+ field4: 'wxyz',
+ };
+ const intersection = objectPairIntersection(a, b);
+ const expected = {
+ field1: 1,
+ field3: 'abcd',
+ };
+ expect(intersection).toEqual(expected);
+ });
+
+ test('should handle null values', () => {
+ const a = {
+ field1: 1,
+ field2: '1',
+ field3: null,
+ };
+ const b = {
+ field1: null,
+ field2: null,
+ field3: null,
+ };
+ const intersection = objectPairIntersection(a, b);
+ const expected = {
+ field3: null,
+ };
+ expect(intersection).toEqual(expected);
+ });
+
+ test('should handle explicit undefined values and return undefined if left with only undefined fields', () => {
+ const a = {
+ field1: 1,
+ field2: '1',
+ field3: undefined,
+ };
+ const b = {
+ field1: undefined,
+ field2: undefined,
+ field3: undefined,
+ };
+ const intersection = objectPairIntersection(a, b);
+ const expected = undefined;
+ expect(intersection).toEqual(expected);
+ });
+
+ test('should strip arrays out regardless of whether they are equal', () => {
+ const a = {
+ array_field1: [1, 2],
+ array_field2: [1, 2],
+ };
+ const b = {
+ array_field1: [1, 2],
+ array_field2: [3, 4],
+ };
+ const intersection = objectPairIntersection(a, b);
+ const expected = undefined;
+ expect(intersection).toEqual(expected);
+ });
+
+ test('should strip fields that are not in both objects', () => {
+ const a = {
+ field1: 1,
+ };
+ const b = {
+ field2: 1,
+ };
+ const intersection = objectPairIntersection(a, b);
+ const expected = undefined;
+ expect(intersection).toEqual(expected);
+ });
+
+ test('should work on objects within objects', () => {
+ const a = {
+ container_field: {
+ field1: 1,
+ field2: 1,
+ field3: 10,
+ field5: 1,
+ field6: null,
+ array_field: [1, 2],
+ nested_container_field: {
+ field1: 1,
+ field2: 1,
+ },
+ nested_container_field2: {
+ field1: undefined,
+ },
+ },
+ container_field_without_intersection: {
+ sub_field1: 1,
+ },
+ };
+ const b = {
+ container_field: {
+ field1: 1,
+ field2: 2,
+ field4: 10,
+ field5: '1',
+ field6: null,
+ array_field: [1, 2],
+ nested_container_field: {
+ field1: 1,
+ field2: 2,
+ },
+ nested_container_field2: {
+ field1: undefined,
+ },
+ },
+ container_field_without_intersection: {
+ sub_field2: 1,
+ },
+ };
+ const intersection = objectPairIntersection(a, b);
+ const expected = {
+ container_field: {
+ field1: 1,
+ field6: null,
+ nested_container_field: {
+ field1: 1,
+ },
+ },
+ };
+ expect(intersection).toEqual(expected);
+ });
+
+ test('should work on objects with a variety of fields', () => {
+ const a = {
+ field1: 1,
+ field2: 1,
+ field3: 10,
+ field5: 1,
+ field6: null,
+ array_field: [1, 2],
+ container_field: {
+ sub_field1: 1,
+ sub_field2: 1,
+ sub_field3: 10,
+ },
+ container_field_without_intersection: {
+ sub_field1: 1,
+ },
+ };
+ const b = {
+ field1: 1,
+ field2: 2,
+ field4: 10,
+ field5: '1',
+ field6: null,
+ array_field: [1, 2],
+ container_field: {
+ sub_field1: 1,
+ sub_field2: 2,
+ sub_field4: 10,
+ },
+ container_field_without_intersection: {
+ sub_field2: 1,
+ },
+ };
+ const intersection = objectPairIntersection(a, b);
+ const expected = {
+ field1: 1,
+ field6: null,
+ container_field: {
+ sub_field1: 1,
+ },
+ };
+ expect(intersection).toEqual(expected);
+ });
+});
+
+describe('objectArrayIntersection', () => {
+ test('should return undefined if the array is empty', () => {
+ const intersection = objectArrayIntersection([]);
+ const expected = undefined;
+ expect(intersection).toEqual(expected);
+ });
+ test('should return the initial object if there is only 1', () => {
+ const a = {
+ field1: 1,
+ field2: 1,
+ field3: 10,
+ field5: 1,
+ field6: null,
+ array_field: [1, 2],
+ container_field: {
+ sub_field1: 1,
+ sub_field2: 1,
+ sub_field3: 10,
+ },
+ container_field_without_intersection: {
+ sub_field1: 1,
+ },
+ };
+ const intersection = objectArrayIntersection([a]);
+ const expected = {
+ field1: 1,
+ field2: 1,
+ field3: 10,
+ field5: 1,
+ field6: null,
+ array_field: [1, 2],
+ container_field: {
+ sub_field1: 1,
+ sub_field2: 1,
+ sub_field3: 10,
+ },
+ container_field_without_intersection: {
+ sub_field1: 1,
+ },
+ };
+ expect(intersection).toEqual(expected);
+ });
+ test('should work with exactly 2 objects', () => {
+ const a = {
+ field1: 1,
+ field2: 1,
+ field3: 10,
+ field5: 1,
+ field6: null,
+ array_field: [1, 2],
+ container_field: {
+ sub_field1: 1,
+ sub_field2: 1,
+ sub_field3: 10,
+ },
+ container_field_without_intersection: {
+ sub_field1: 1,
+ },
+ };
+ const b = {
+ field1: 1,
+ field2: 2,
+ field4: 10,
+ field5: '1',
+ field6: null,
+ array_field: [1, 2],
+ container_field: {
+ sub_field1: 1,
+ sub_field2: 2,
+ sub_field4: 10,
+ },
+ container_field_without_intersection: {
+ sub_field2: 1,
+ },
+ };
+ const intersection = objectArrayIntersection([a, b]);
+ const expected = {
+ field1: 1,
+ field6: null,
+ container_field: {
+ sub_field1: 1,
+ },
+ };
+ expect(intersection).toEqual(expected);
+ });
+
+ test('should work with 3 or more objects', () => {
+ const a = {
+ field1: 1,
+ field2: 1,
+ field3: 10,
+ field5: 1,
+ field6: null,
+ array_field: [1, 2],
+ container_field: {
+ sub_field1: 1,
+ sub_field2: 1,
+ sub_field3: 10,
+ },
+ container_field_without_intersection: {
+ sub_field1: 1,
+ },
+ };
+ const b = {
+ field1: 1,
+ field2: 2,
+ field4: 10,
+ field5: '1',
+ field6: null,
+ array_field: [1, 2],
+ container_field: {
+ sub_field1: 1,
+ sub_field2: 2,
+ sub_field4: 10,
+ },
+ container_field_without_intersection: {
+ sub_field2: 1,
+ },
+ };
+ const c = {
+ field1: 1,
+ field2: 2,
+ field4: 10,
+ field5: '1',
+ array_field: [1, 2],
+ container_field: {
+ sub_field2: 2,
+ sub_field4: 10,
+ },
+ container_field_without_intersection: {
+ sub_field2: 1,
+ },
+ };
+ const intersection = objectArrayIntersection([a, b, c]);
+ const expected = {
+ field1: 1,
+ };
+ expect(intersection).toEqual(expected);
+ });
+});
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 f8632a85c77e9..8e9571fe8a445 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
@@ -129,7 +129,9 @@ export const buildSignalFromSequence = (
): SignalHit => {
const rule = buildRuleWithoutOverrides(ruleSO);
const signal: Signal = buildSignal(events, rule);
+ const mergedEvents = objectArrayIntersection(events.map((event) => event._source));
return {
+ ...mergedEvents,
'@timestamp': new Date().toISOString(),
event: {
kind: 'signal',
@@ -167,3 +169,54 @@ export const buildSignalFromEvent = (
};
return signalHit;
};
+
+export const objectArrayIntersection = (objects: object[]) => {
+ if (objects.length === 0) {
+ return undefined;
+ } else if (objects.length === 1) {
+ return objects[0];
+ } else {
+ return objects
+ .slice(1)
+ .reduce(
+ (acc: object | undefined, obj): object | undefined => objectPairIntersection(acc, obj),
+ objects[0]
+ );
+ }
+};
+
+export const objectPairIntersection = (a: object | undefined, b: object | undefined) => {
+ if (a === undefined || b === undefined) {
+ return undefined;
+ }
+ const intersection: Record = {};
+ Object.entries(a).forEach(([key, aVal]) => {
+ if (key in b) {
+ const bVal = (b as Record)[key];
+ if (
+ typeof aVal === 'object' &&
+ !(aVal instanceof Array) &&
+ aVal !== null &&
+ typeof bVal === 'object' &&
+ !(bVal instanceof Array) &&
+ bVal !== null
+ ) {
+ intersection[key] = objectPairIntersection(aVal, bVal);
+ } else if (aVal === bVal) {
+ intersection[key] = aVal;
+ }
+ }
+ });
+ // Count up the number of entries that are NOT undefined in the intersection
+ // If there are no keys OR all entries are undefined, return undefined
+ if (
+ Object.values(intersection).reduce(
+ (acc: number, value) => (value !== undefined ? acc + 1 : acc),
+ 0
+ ) === 0
+ ) {
+ return undefined;
+ } else {
+ return intersection;
+ }
+};
From f398b492002dd33c0fc4f764be7a1e6d0d81c6f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?=
Date: Fri, 2 Oct 2020 16:03:42 +0100
Subject: [PATCH 22/56] [Usage Collection] [schema] `actions` (#78832)
---
x-pack/.telemetryrc.json | 1 -
.../server/usage/actions_usage_collector.ts | 23 +++++-
.../schema/xpack_plugins.json | 78 +++++++++++++++++++
3 files changed, 100 insertions(+), 2 deletions(-)
diff --git a/x-pack/.telemetryrc.json b/x-pack/.telemetryrc.json
index c7430666c538f..db50727c599a9 100644
--- a/x-pack/.telemetryrc.json
+++ b/x-pack/.telemetryrc.json
@@ -2,7 +2,6 @@
"output": "plugins/telemetry_collection_xpack/schema/xpack_plugins.json",
"root": "plugins/",
"exclude": [
- "plugins/actions/server/usage/actions_usage_collector.ts",
"plugins/alerts/server/usage/alerts_usage_collector.ts",
"plugins/apm/server/lib/apm_telemetry/index.ts"
]
diff --git a/x-pack/plugins/actions/server/usage/actions_usage_collector.ts b/x-pack/plugins/actions/server/usage/actions_usage_collector.ts
index aa546e08ea1ba..fac57b6282c44 100644
--- a/x-pack/plugins/actions/server/usage/actions_usage_collector.ts
+++ b/x-pack/plugins/actions/server/usage/actions_usage_collector.ts
@@ -4,11 +4,26 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
+import { MakeSchemaFrom, UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { get } from 'lodash';
import { TaskManagerStartContract } from '../../../task_manager/server';
import { ActionsUsage } from './types';
+const byTypeSchema: MakeSchemaFrom['count_by_type'] = {
+ // TODO: Find out an automated way to populate the keys or reformat these into an array (and change the Remote Telemetry indexer accordingly)
+ DYNAMIC_KEY: { type: 'long' },
+ // Known actions:
+ __email: { type: 'long' },
+ __index: { type: 'long' },
+ __pagerduty: { type: 'long' },
+ '__server-log': { type: 'long' },
+ __slack: { type: 'long' },
+ __webhook: { type: 'long' },
+ __servicenow: { type: 'long' },
+ __jira: { type: 'long' },
+ __resilient: { type: 'long' },
+};
+
export function createActionsUsageCollector(
usageCollection: UsageCollectionSetup,
taskManager: TaskManagerStartContract
@@ -16,6 +31,12 @@ export function createActionsUsageCollector(
return usageCollection.makeUsageCollector({
type: 'actions',
isReady: () => true,
+ schema: {
+ count_total: { type: 'long' },
+ count_active_total: { type: 'long' },
+ count_by_type: byTypeSchema,
+ count_active_by_type: byTypeSchema,
+ },
fetch: async () => {
try {
const doc = await getLatestTaskState(await taskManager);
diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json
index b08585066f100..bdafbfd8ec967 100644
--- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json
+++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json
@@ -1,5 +1,83 @@
{
"properties": {
+ "actions": {
+ "properties": {
+ "count_total": {
+ "type": "long"
+ },
+ "count_active_total": {
+ "type": "long"
+ },
+ "count_by_type": {
+ "properties": {
+ "DYNAMIC_KEY": {
+ "type": "long"
+ },
+ "__email": {
+ "type": "long"
+ },
+ "__index": {
+ "type": "long"
+ },
+ "__pagerduty": {
+ "type": "long"
+ },
+ "__server-log": {
+ "type": "long"
+ },
+ "__slack": {
+ "type": "long"
+ },
+ "__webhook": {
+ "type": "long"
+ },
+ "__servicenow": {
+ "type": "long"
+ },
+ "__jira": {
+ "type": "long"
+ },
+ "__resilient": {
+ "type": "long"
+ }
+ }
+ },
+ "count_active_by_type": {
+ "properties": {
+ "DYNAMIC_KEY": {
+ "type": "long"
+ },
+ "__email": {
+ "type": "long"
+ },
+ "__index": {
+ "type": "long"
+ },
+ "__pagerduty": {
+ "type": "long"
+ },
+ "__server-log": {
+ "type": "long"
+ },
+ "__slack": {
+ "type": "long"
+ },
+ "__webhook": {
+ "type": "long"
+ },
+ "__servicenow": {
+ "type": "long"
+ },
+ "__jira": {
+ "type": "long"
+ },
+ "__resilient": {
+ "type": "long"
+ }
+ }
+ }
+ }
+ },
"canvas": {
"properties": {
"workpads": {
From fccfad24cb7856f0a871381524e3e404dedfa839 Mon Sep 17 00:00:00 2001
From: Marta Bondyra
Date: Fri, 2 Oct 2020 17:18:20 +0200
Subject: [PATCH 23/56] [Lens] remove test warnings about improper HTML
structure (#79251)
* [Lens] remove test warnings about improper HTML structure
---
.../workspace_panel/workspace_panel.tsx | 32 ++++++++-----------
1 file changed, 13 insertions(+), 19 deletions(-)
diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx
index 2a5798ac6a70c..3993b4ffc02b0 100644
--- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx
+++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx
@@ -208,27 +208,22 @@ export function InnerWorkspacePanel({
>
- {expression === null ? (
-
- ) : (
-
- )}
+ {expression === null
+ ? i18n.translate('xpack.lens.editorFrame.emptyWorkspace', {
+ defaultMessage: 'Drop some fields here to start',
+ })
+ : i18n.translate('xpack.lens.editorFrame.emptyWorkspaceSimple', {
+ defaultMessage: 'Drop field here',
+ })}
{expression === null && (
<>
-
+ {i18n.translate('xpack.lens.editorFrame.emptyWorkspaceHeading', {
+ defaultMessage: 'Lens is a new tool for creating visualization',
+ })}
@@ -237,10 +232,9 @@ export function InnerWorkspacePanel({
target="_blank"
external
>
-
+ {i18n.translate('xpack.lens.editorFrame.goToForums', {
+ defaultMessage: 'Make requests and give feedback',
+ })}
From 6364c14ffd99fc86cf257beaea81e56e04a41c68 Mon Sep 17 00:00:00 2001
From: Devon Thomson
Date: Fri, 2 Oct 2020 12:31:08 -0400
Subject: [PATCH 24/56] Panel Description Tooltip Design Change (#79213)
* wrapped Embeddable Panel title in EuiTooltip and centered description icon
---
.../public/lib/panel/_embeddable_panel.scss | 5 ++
.../lib/panel/panel_header/panel_header.tsx | 55 ++++++++++---------
2 files changed, 33 insertions(+), 27 deletions(-)
diff --git a/src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss b/src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss
index 36a7fee14cce1..cdc0f9f0e0451 100644
--- a/src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss
+++ b/src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss
@@ -54,9 +54,14 @@
.embPanel__titleInner {
overflow: hidden;
display: flex;
+ align-items: center;
padding-right: $euiSizeS;
}
+ .embPanel__titleTooltipAnchor {
+ max-width: 100%;
+ }
+
.embPanel__titleText {
@include euiTextTruncate;
}
diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx
index c538b98949a43..ea6a6a78c2b67 100644
--- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx
+++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx
@@ -99,16 +99,6 @@ function renderNotifications(
});
}
-function renderTooltip(description: string) {
- return (
- description !== '' && (
-
-
-
- )
- );
-}
-
type EmbeddableWithDescription = IEmbeddable & { getDescription: () => string };
function getViewDescription(embeddable: IEmbeddable | EmbeddableWithDescription) {
@@ -134,9 +124,10 @@ export function PanelHeader({
embeddable,
headerId,
}: PanelHeaderProps) {
- const viewDescription = getViewDescription(embeddable);
- const showTitle = !hidePanelTitle && (!isViewMode || title || viewDescription !== '');
- const showPanelBar = !isViewMode || badges.length > 0 || notifications.length > 0 || showTitle;
+ const description = getViewDescription(embeddable);
+ const showTitle = !hidePanelTitle && (!isViewMode || title);
+ const showPanelBar =
+ !isViewMode || badges.length > 0 || notifications.length > 0 || showTitle || description;
const classes = classNames('embPanel__header', {
// eslint-disable-next-line @typescript-eslint/naming-convention
'embPanel__header--floater': !showPanelBar,
@@ -174,26 +165,36 @@ export function PanelHeader({
);
}
+ const renderTitle = () => {
+ const titleComponent = showTitle ? (
+
+ {title || placeholderTitle}
+
+ ) : undefined;
+ return description ? (
+
+
+ {titleComponent}
+
+
+ ) : (
+ titleComponent
+ );
+ };
+
return (
- {showTitle ? (
-
-
- {title || placeholderTitle}
-
- {getAriaLabel()}
- {renderTooltip(viewDescription)}
-
- ) : (
- {getAriaLabel()}
- )}
+ {getAriaLabel()}
+ {renderTitle()}
{renderBadges(badges, embeddable)}
{renderNotifications(notifications, embeddable)}
From d67962453224404647e4859ba6c4f996e64f2e48 Mon Sep 17 00:00:00 2001
From: Marco Liberati
Date: Fri, 2 Oct 2020 18:41:40 +0200
Subject: [PATCH 25/56] [Lens] Fix open custom ranges saved issue (#78915)
Co-authored-by: Elastic Machine
---
.../definitions/ranges/advanced_editor.tsx | 4 +-
.../definitions/ranges/ranges.test.tsx | 42 ++++++++++++++++++-
.../operations/definitions/ranges/ranges.tsx | 19 ++++++---
3 files changed, 57 insertions(+), 8 deletions(-)
diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx
index a6756df403ba7..16b861ae034fa 100644
--- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx
+++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx
@@ -132,11 +132,11 @@ export const RangePopover = ({
{
const newRange = {
...tempRange,
- to: target.value !== '' ? Number(target.value) : -Infinity,
+ to: target.value !== '' ? Number(target.value) : Infinity,
};
setTempRange(newRange);
saveRangeAndReset(newRange);
diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx
index 2409406afcdbc..fb6cf6df8573f 100644
--- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx
+++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx
@@ -485,7 +485,7 @@ describe('ranges', () => {
/>
);
- // This series of act clojures are made to make it work properly the update flush
+ // This series of act closures are made to make it work properly the update flush
act(() => {
instance.find(RangePopover).find(EuiLink).prop('onClick')!({} as ReactMouseEvent);
});
@@ -550,6 +550,46 @@ describe('ranges', () => {
expect(instance.find(RangePopover)).toHaveLength(1);
});
});
+
+ it('should handle correctly open ranges when saved', () => {
+ const setStateSpy = jest.fn();
+
+ // Add an extra open range:
+ (state.layers.first.columns.col1 as RangeIndexPatternColumn).params.ranges.push({
+ from: null,
+ to: null,
+ label: '',
+ });
+
+ const instance = mount(
+
+ );
+
+ act(() => {
+ instance.find(RangePopover).last().find(EuiLink).prop('onClick')!({} as ReactMouseEvent);
+ });
+
+ act(() => {
+ // need another wrapping for this in order to work
+ instance.update();
+
+ // Check UI values for open ranges
+ expect(
+ instance.find(RangePopover).last().find(EuiFieldNumber).first().prop('value')
+ ).toBe('');
+
+ expect(instance.find(RangePopover).last().find(EuiFieldNumber).last().prop('value')).toBe(
+ ''
+ );
+ });
+ });
});
});
});
diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.tsx
index a59780ef59939..a8304456262eb 100644
--- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.tsx
+++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.tsx
@@ -16,7 +16,13 @@ import { updateColumnParam, changeColumn } from '../../../state_helpers';
import { MODES, AUTO_BARS, DEFAULT_INTERVAL, MIN_HISTOGRAM_BARS, SLICES } from './constants';
type RangeType = Omit;
-export type RangeTypeLens = RangeType & { label: string };
+// Try to cover all possible serialized states for ranges
+export type RangeTypeLens = (RangeType | { from: Range['from'] | null; to: Range['to'] | null }) & {
+ label: string;
+};
+
+// This is a subset of RangeTypeLens which has both from and to defined
+type FullRangeTypeLens = Extract>;
export type MODES_TYPES = typeof MODES[keyof typeof MODES];
@@ -35,10 +41,13 @@ export type UpdateParamsFnType = (
value: RangeColumnParams[K]
) => void;
-export const isValidNumber = (value: number | '') =>
- value !== '' && !isNaN(value) && isFinite(value);
-export const isRangeWithin = (range: RangeTypeLens): boolean => range.from <= range.to;
-const isFullRange = ({ from, to }: RangeType) => isValidNumber(from) && isValidNumber(to);
+// on initialization values can be null (from the Infinity serialization), so handle it correctly
+// or they will be casted to 0 by the editor ( see #78867 )
+export const isValidNumber = (value: number | '' | null): value is number =>
+ value != null && value !== '' && !isNaN(value) && isFinite(value);
+export const isRangeWithin = (range: RangeType): boolean => range.from <= range.to;
+const isFullRange = (range: RangeTypeLens): range is FullRangeTypeLens =>
+ isValidNumber(range.from) && isValidNumber(range.to);
export const isValidRange = (range: RangeTypeLens): boolean => {
if (isFullRange(range)) {
return isRangeWithin(range);
From 7afb8b4d7b2813e6235bcb164bbebc4c30f1d43d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?=
Date: Fri, 2 Oct 2020 17:45:47 +0100
Subject: [PATCH 26/56] [Usage Collection] [schema] `alerts` (#78933)
---
x-pack/.telemetryrc.json | 1 -
.../server/usage/alerts_usage_collector.ts | 57 +++++-
.../schema/xpack_plugins.json | 192 ++++++++++++++++++
3 files changed, 248 insertions(+), 2 deletions(-)
diff --git a/x-pack/.telemetryrc.json b/x-pack/.telemetryrc.json
index db50727c599a9..706decfc93e9c 100644
--- a/x-pack/.telemetryrc.json
+++ b/x-pack/.telemetryrc.json
@@ -2,7 +2,6 @@
"output": "plugins/telemetry_collection_xpack/schema/xpack_plugins.json",
"root": "plugins/",
"exclude": [
- "plugins/alerts/server/usage/alerts_usage_collector.ts",
"plugins/apm/server/lib/apm_telemetry/index.ts"
]
}
diff --git a/x-pack/plugins/alerts/server/usage/alerts_usage_collector.ts b/x-pack/plugins/alerts/server/usage/alerts_usage_collector.ts
index 64d3ad54a2318..de82dd31877af 100644
--- a/x-pack/plugins/alerts/server/usage/alerts_usage_collector.ts
+++ b/x-pack/plugins/alerts/server/usage/alerts_usage_collector.ts
@@ -4,11 +4,44 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
+import { MakeSchemaFrom, UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { get } from 'lodash';
import { TaskManagerStartContract } from '../../../task_manager/server';
import { AlertsUsage } from './types';
+const byTypeSchema: MakeSchemaFrom['count_by_type'] = {
+ // TODO: Find out an automated way to populate the keys or reformat these into an array (and change the Remote Telemetry indexer accordingly)
+ DYNAMIC_KEY: { type: 'long' },
+ // Known alerts (searching the use of the alerts API `registerType`:
+ // Built-in
+ '__index-threshold': { type: 'long' },
+ // APM
+ apm__error_rate: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ apm__transaction_error_rate: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ apm__transaction_duration: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ apm__transaction_duration_anomaly: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ // Infra
+ metrics__alert__threshold: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ metrics__alert__inventory__threshold: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ logs__alert__document__count: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ // Monitoring
+ monitoring_alert_cluster_health: { type: 'long' },
+ monitoring_alert_cpu_usage: { type: 'long' },
+ monitoring_alert_disk_usage: { type: 'long' },
+ monitoring_alert_elasticsearch_version_mismatch: { type: 'long' },
+ monitoring_alert_kibana_version_mismatch: { type: 'long' },
+ monitoring_alert_license_expiration: { type: 'long' },
+ monitoring_alert_logstash_version_mismatch: { type: 'long' },
+ monitoring_alert_nodes_changed: { type: 'long' },
+ // Security Solution
+ siem__signals: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ siem__notifications: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ // Uptime
+ xpack__uptime__alerts__monitorStatus: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ xpack__uptime__alerts__tls: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+ xpack__uptime__alerts__durationAnomaly: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
+};
+
export function createAlertsUsageCollector(
usageCollection: UsageCollectionSetup,
taskManager: TaskManagerStartContract
@@ -50,6 +83,28 @@ export function createAlertsUsageCollector(
};
}
},
+ schema: {
+ count_total: { type: 'long' },
+ count_active_total: { type: 'long' },
+ count_disabled_total: { type: 'long' },
+ throttle_time: {
+ min: { type: 'long' },
+ avg: { type: 'float' },
+ max: { type: 'long' },
+ },
+ schedule_time: {
+ min: { type: 'long' },
+ avg: { type: 'float' },
+ max: { type: 'long' },
+ },
+ connectors_per_alert: {
+ min: { type: 'long' },
+ avg: { type: 'float' },
+ max: { type: 'long' },
+ },
+ count_active_by_type: byTypeSchema,
+ count_by_type: byTypeSchema,
+ },
});
}
diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json
index bdafbfd8ec967..98230f143d3d6 100644
--- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json
+++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json
@@ -78,6 +78,198 @@
}
}
},
+ "alerts": {
+ "properties": {
+ "count_total": {
+ "type": "long"
+ },
+ "count_active_total": {
+ "type": "long"
+ },
+ "count_disabled_total": {
+ "type": "long"
+ },
+ "throttle_time": {
+ "properties": {
+ "min": {
+ "type": "long"
+ },
+ "avg": {
+ "type": "float"
+ },
+ "max": {
+ "type": "long"
+ }
+ }
+ },
+ "schedule_time": {
+ "properties": {
+ "min": {
+ "type": "long"
+ },
+ "avg": {
+ "type": "float"
+ },
+ "max": {
+ "type": "long"
+ }
+ }
+ },
+ "connectors_per_alert": {
+ "properties": {
+ "min": {
+ "type": "long"
+ },
+ "avg": {
+ "type": "float"
+ },
+ "max": {
+ "type": "long"
+ }
+ }
+ },
+ "count_active_by_type": {
+ "properties": {
+ "DYNAMIC_KEY": {
+ "type": "long"
+ },
+ "__index-threshold": {
+ "type": "long"
+ },
+ "apm__error_rate": {
+ "type": "long"
+ },
+ "apm__transaction_error_rate": {
+ "type": "long"
+ },
+ "apm__transaction_duration": {
+ "type": "long"
+ },
+ "apm__transaction_duration_anomaly": {
+ "type": "long"
+ },
+ "metrics__alert__threshold": {
+ "type": "long"
+ },
+ "metrics__alert__inventory__threshold": {
+ "type": "long"
+ },
+ "logs__alert__document__count": {
+ "type": "long"
+ },
+ "monitoring_alert_cluster_health": {
+ "type": "long"
+ },
+ "monitoring_alert_cpu_usage": {
+ "type": "long"
+ },
+ "monitoring_alert_disk_usage": {
+ "type": "long"
+ },
+ "monitoring_alert_elasticsearch_version_mismatch": {
+ "type": "long"
+ },
+ "monitoring_alert_kibana_version_mismatch": {
+ "type": "long"
+ },
+ "monitoring_alert_license_expiration": {
+ "type": "long"
+ },
+ "monitoring_alert_logstash_version_mismatch": {
+ "type": "long"
+ },
+ "monitoring_alert_nodes_changed": {
+ "type": "long"
+ },
+ "siem__signals": {
+ "type": "long"
+ },
+ "siem__notifications": {
+ "type": "long"
+ },
+ "xpack__uptime__alerts__monitorStatus": {
+ "type": "long"
+ },
+ "xpack__uptime__alerts__tls": {
+ "type": "long"
+ },
+ "xpack__uptime__alerts__durationAnomaly": {
+ "type": "long"
+ }
+ }
+ },
+ "count_by_type": {
+ "properties": {
+ "DYNAMIC_KEY": {
+ "type": "long"
+ },
+ "__index-threshold": {
+ "type": "long"
+ },
+ "apm__error_rate": {
+ "type": "long"
+ },
+ "apm__transaction_error_rate": {
+ "type": "long"
+ },
+ "apm__transaction_duration": {
+ "type": "long"
+ },
+ "apm__transaction_duration_anomaly": {
+ "type": "long"
+ },
+ "metrics__alert__threshold": {
+ "type": "long"
+ },
+ "metrics__alert__inventory__threshold": {
+ "type": "long"
+ },
+ "logs__alert__document__count": {
+ "type": "long"
+ },
+ "monitoring_alert_cluster_health": {
+ "type": "long"
+ },
+ "monitoring_alert_cpu_usage": {
+ "type": "long"
+ },
+ "monitoring_alert_disk_usage": {
+ "type": "long"
+ },
+ "monitoring_alert_elasticsearch_version_mismatch": {
+ "type": "long"
+ },
+ "monitoring_alert_kibana_version_mismatch": {
+ "type": "long"
+ },
+ "monitoring_alert_license_expiration": {
+ "type": "long"
+ },
+ "monitoring_alert_logstash_version_mismatch": {
+ "type": "long"
+ },
+ "monitoring_alert_nodes_changed": {
+ "type": "long"
+ },
+ "siem__signals": {
+ "type": "long"
+ },
+ "siem__notifications": {
+ "type": "long"
+ },
+ "xpack__uptime__alerts__monitorStatus": {
+ "type": "long"
+ },
+ "xpack__uptime__alerts__tls": {
+ "type": "long"
+ },
+ "xpack__uptime__alerts__durationAnomaly": {
+ "type": "long"
+ }
+ }
+ }
+ }
+ },
"canvas": {
"properties": {
"workpads": {
From d9915fdee08e179a11c494b852faa72ead77f33b Mon Sep 17 00:00:00 2001
From: Ryan Keairns
Date: Fri, 2 Oct 2020 11:47:20 -0500
Subject: [PATCH 27/56] Re-style and re-order top menu buttons (#79206)
* Re-style and re-order top menu buttons
* Update snapshot due to removed fill prop
* Fix link order for Maps
---
.../application/top_nav/get_top_nav_config.ts | 12 +-
.../top_nav_menu_item.test.tsx.snap | 1 -
.../public/top_nav_menu/_index.scss | 4 +
.../public/top_nav_menu/top_nav_menu_item.tsx | 2 +-
.../application/utils/get_top_nav_config.tsx | 185 +++++++++---------
.../lens/public/app_plugin/lens_top_nav.tsx | 36 ++--
.../routes/maps_app/top_nav_config.tsx | 125 ++++++------
7 files changed, 187 insertions(+), 178 deletions(-)
diff --git a/src/plugins/dashboard/public/application/top_nav/get_top_nav_config.ts b/src/plugins/dashboard/public/application/top_nav/get_top_nav_config.ts
index dbdadeb4e4e7c..77c4a2235d471 100644
--- a/src/plugins/dashboard/public/application/top_nav/get_top_nav_config.ts
+++ b/src/plugins/dashboard/public/application/top_nav/get_top_nav_config.ts
@@ -48,12 +48,12 @@ export function getTopNavConfig(
];
case ViewMode.EDIT:
return [
- getCreateNewConfig(actions[TopNavIds.VISUALIZE]),
- getSaveConfig(actions[TopNavIds.SAVE]),
- getViewConfig(actions[TopNavIds.EXIT_EDIT_MODE]),
- getAddConfig(actions[TopNavIds.ADD_EXISTING]),
getOptionsConfig(actions[TopNavIds.OPTIONS]),
getShareConfig(actions[TopNavIds.SHARE]),
+ getAddConfig(actions[TopNavIds.ADD_EXISTING]),
+ getViewConfig(actions[TopNavIds.EXIT_EDIT_MODE]),
+ getSaveConfig(actions[TopNavIds.SAVE]),
+ getCreateNewConfig(actions[TopNavIds.VISUALIZE]),
];
default:
return [];
@@ -79,7 +79,9 @@ function getFullScreenConfig(action: NavAction) {
*/
function getEditConfig(action: NavAction) {
return {
+ emphasize: true,
id: 'edit',
+ iconType: 'pencil',
label: i18n.translate('dashboard.topNave.editButtonAriaLabel', {
defaultMessage: 'edit',
}),
@@ -168,7 +170,7 @@ function getAddConfig(action: NavAction) {
function getCreateNewConfig(action: NavAction) {
return {
emphasize: true,
- iconType: 'plusInCircle',
+ iconType: 'plusInCircleFilled',
id: 'addNew',
label: i18n.translate('dashboard.topNave.addNewButtonAriaLabel', {
defaultMessage: 'Create new',
diff --git a/src/plugins/navigation/public/top_nav_menu/__snapshots__/top_nav_menu_item.test.tsx.snap b/src/plugins/navigation/public/top_nav_menu/__snapshots__/top_nav_menu_item.test.tsx.snap
index 570699aa0c0e2..155377e5ea335 100644
--- a/src/plugins/navigation/public/top_nav_menu/__snapshots__/top_nav_menu_item.test.tsx.snap
+++ b/src/plugins/navigation/public/top_nav_menu/__snapshots__/top_nav_menu_item.test.tsx.snap
@@ -2,7 +2,6 @@
exports[`TopNavMenu Should render emphasized item which should be clickable 1`] = `
* > * {
// TEMP fix to adjust spacing between EuiHeaderList__list items
margin: 0 $euiSizeXS;
diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.tsx
index 96a205b737273..e503ebb839f48 100644
--- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.tsx
+++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.tsx
@@ -48,7 +48,7 @@ export function TopNavMenuItem(props: TopNavMenuData) {
};
const btn = props.emphasize ? (
-
+
{upperFirst(props.label || props.id!)}
) : (
diff --git a/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx b/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx
index 12720f3f22e7c..cb68a647cb81d 100644
--- a/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx
+++ b/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx
@@ -175,54 +175,61 @@ export const getTopNavConfig = (
};
const topNavMenu: TopNavMenuData[] = [
- ...(originatingApp && ((savedVis && savedVis.id) || embeddableId)
- ? [
- {
- id: 'saveAndReturn',
- label: i18n.translate('visualize.topNavMenu.saveAndReturnVisualizationButtonLabel', {
- defaultMessage: 'Save and return',
- }),
- emphasize: true,
- iconType: 'check',
- description: i18n.translate(
- 'visualize.topNavMenu.saveAndReturnVisualizationButtonAriaLabel',
- {
- defaultMessage: 'Finish editing visualization and return to the last app',
- }
- ),
- testId: 'visualizesaveAndReturnButton',
- disableButton: hasUnappliedChanges,
- tooltip() {
- if (hasUnappliedChanges) {
- return i18n.translate(
- 'visualize.topNavMenu.saveAndReturnVisualizationDisabledButtonTooltip',
- {
- defaultMessage: 'Apply or Discard your changes before finishing',
- }
- );
- }
- },
- run: async () => {
- const saveOptions = {
- confirmOverwrite: false,
- returnToOrigin: true,
- };
- if (
- originatingApp === 'dashboards' &&
- dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables &&
- !savedVis
- ) {
- return createVisReference();
- }
- return doSave(saveOptions);
+ {
+ id: 'inspector',
+ label: i18n.translate('visualize.topNavMenu.openInspectorButtonLabel', {
+ defaultMessage: 'inspect',
+ }),
+ description: i18n.translate('visualize.topNavMenu.openInspectorButtonAriaLabel', {
+ defaultMessage: 'Open Inspector for visualization',
+ }),
+ testId: 'openInspectorButton',
+ disableButton() {
+ return !embeddableHandler.hasInspector || !embeddableHandler.hasInspector();
+ },
+ run: openInspector,
+ tooltip() {
+ if (!embeddableHandler.hasInspector || !embeddableHandler.hasInspector()) {
+ return i18n.translate('visualize.topNavMenu.openInspectorDisabledButtonTooltip', {
+ defaultMessage: `This visualization doesn't support any inspectors.`,
+ });
+ }
+ },
+ },
+ {
+ id: 'share',
+ label: i18n.translate('visualize.topNavMenu.shareVisualizationButtonLabel', {
+ defaultMessage: 'share',
+ }),
+ description: i18n.translate('visualize.topNavMenu.shareVisualizationButtonAriaLabel', {
+ defaultMessage: 'Share Visualization',
+ }),
+ testId: 'shareTopNavButton',
+ run: (anchorElement) => {
+ if (share && !embeddableId) {
+ // TODO: support sharing in by-value mode
+ share.toggleShareContextMenu({
+ anchorElement,
+ allowEmbed: true,
+ allowShortUrl: visualizeCapabilities.createShortUrl,
+ shareableUrl: unhashUrl(window.location.href),
+ objectId: savedVis?.id,
+ objectType: 'visualization',
+ sharingData: {
+ title: savedVis?.title,
},
- },
- ]
- : []),
+ isDirty: hasUnappliedChanges || hasUnsavedChanges,
+ });
+ }
+ },
+ // disable the Share button if no action specified
+ disableButton: !share || !!embeddableId,
+ },
...(visualizeCapabilities.save && !embeddableId
? [
{
id: 'save',
+ iconType: savedVis?.id && originatingApp ? undefined : 'save',
label:
savedVis?.id && originatingApp
? i18n.translate('visualize.topNavMenu.saveVisualizationAsButtonLabel', {
@@ -303,56 +310,50 @@ export const getTopNavConfig = (
},
]
: []),
- {
- id: 'share',
- label: i18n.translate('visualize.topNavMenu.shareVisualizationButtonLabel', {
- defaultMessage: 'share',
- }),
- description: i18n.translate('visualize.topNavMenu.shareVisualizationButtonAriaLabel', {
- defaultMessage: 'Share Visualization',
- }),
- testId: 'shareTopNavButton',
- run: (anchorElement) => {
- if (share && !embeddableId) {
- // TODO: support sharing in by-value mode
- share.toggleShareContextMenu({
- anchorElement,
- allowEmbed: true,
- allowShortUrl: visualizeCapabilities.createShortUrl,
- shareableUrl: unhashUrl(window.location.href),
- objectId: savedVis?.id,
- objectType: 'visualization',
- sharingData: {
- title: savedVis?.title,
+ ...(originatingApp && ((savedVis && savedVis.id) || embeddableId)
+ ? [
+ {
+ id: 'saveAndReturn',
+ label: i18n.translate('visualize.topNavMenu.saveAndReturnVisualizationButtonLabel', {
+ defaultMessage: 'Save and return',
+ }),
+ emphasize: true,
+ iconType: 'checkInCircleFilled',
+ description: i18n.translate(
+ 'visualize.topNavMenu.saveAndReturnVisualizationButtonAriaLabel',
+ {
+ defaultMessage: 'Finish editing visualization and return to the last app',
+ }
+ ),
+ testId: 'visualizesaveAndReturnButton',
+ disableButton: hasUnappliedChanges,
+ tooltip() {
+ if (hasUnappliedChanges) {
+ return i18n.translate(
+ 'visualize.topNavMenu.saveAndReturnVisualizationDisabledButtonTooltip',
+ {
+ defaultMessage: 'Apply or Discard your changes before finishing',
+ }
+ );
+ }
},
- isDirty: hasUnappliedChanges || hasUnsavedChanges,
- });
- }
- },
- // disable the Share button if no action specified
- disableButton: !share || !!embeddableId,
- },
- {
- id: 'inspector',
- label: i18n.translate('visualize.topNavMenu.openInspectorButtonLabel', {
- defaultMessage: 'inspect',
- }),
- description: i18n.translate('visualize.topNavMenu.openInspectorButtonAriaLabel', {
- defaultMessage: 'Open Inspector for visualization',
- }),
- testId: 'openInspectorButton',
- disableButton() {
- return !embeddableHandler.hasInspector || !embeddableHandler.hasInspector();
- },
- run: openInspector,
- tooltip() {
- if (!embeddableHandler.hasInspector || !embeddableHandler.hasInspector()) {
- return i18n.translate('visualize.topNavMenu.openInspectorDisabledButtonTooltip', {
- defaultMessage: `This visualization doesn't support any inspectors.`,
- });
- }
- },
- },
+ run: async () => {
+ const saveOptions = {
+ confirmOverwrite: false,
+ returnToOrigin: true,
+ };
+ if (
+ originatingApp === 'dashboards' &&
+ dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables &&
+ !savedVis
+ ) {
+ return createVisReference();
+ }
+ return doSave(saveOptions);
+ },
+ },
+ ]
+ : []),
];
return topNavMenu;
diff --git a/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx b/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx
index f6234d063d8cd..9162af52052ee 100644
--- a/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx
+++ b/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx
@@ -30,24 +30,22 @@ export function getLensTopNavConfig(options: {
defaultMessage: 'Save',
});
- if (showSaveAndReturn) {
+ if (showCancel) {
topNavMenu.push({
- label: i18n.translate('xpack.lens.app.saveAndReturn', {
- defaultMessage: 'Save and return',
+ label: i18n.translate('xpack.lens.app.cancel', {
+ defaultMessage: 'cancel',
}),
- emphasize: true,
- iconType: 'check',
- run: actions.saveAndReturn,
- testId: 'lnsApp_saveAndReturnButton',
- disableButton: !savingPermitted,
- description: i18n.translate('xpack.lens.app.saveAndReturnButtonAriaLabel', {
- defaultMessage: 'Save the current lens visualization and return to the last app',
+ run: actions.cancel,
+ testId: 'lnsApp_cancelButton',
+ description: i18n.translate('xpack.lens.app.cancelButtonAriaLabel', {
+ defaultMessage: 'Return to the last app without saving changes',
}),
});
}
topNavMenu.push({
label: saveButtonLabel,
+ iconType: !showSaveAndReturn ? 'save' : undefined,
emphasize: !showSaveAndReturn,
run: actions.showSaveModal,
testId: 'lnsApp_saveButton',
@@ -57,17 +55,21 @@ export function getLensTopNavConfig(options: {
disableButton: !savingPermitted,
});
- if (showCancel) {
+ if (showSaveAndReturn) {
topNavMenu.push({
- label: i18n.translate('xpack.lens.app.cancel', {
- defaultMessage: 'cancel',
+ label: i18n.translate('xpack.lens.app.saveAndReturn', {
+ defaultMessage: 'Save and return',
}),
- run: actions.cancel,
- testId: 'lnsApp_cancelButton',
- description: i18n.translate('xpack.lens.app.cancelButtonAriaLabel', {
- defaultMessage: 'Return to the last app without saving changes',
+ emphasize: true,
+ iconType: 'checkInCircleFilled',
+ run: actions.saveAndReturn,
+ testId: 'lnsApp_saveAndReturnButton',
+ disableButton: !savingPermitted,
+ description: i18n.translate('xpack.lens.app.saveAndReturnButtonAriaLabel', {
+ defaultMessage: 'Save the current lens visualization and return to the last app',
}),
});
}
+
return topNavMenu;
}
diff --git a/x-pack/plugins/maps/public/routing/routes/maps_app/top_nav_config.tsx b/x-pack/plugins/maps/public/routing/routes/maps_app/top_nav_config.tsx
index 8a0eb8db4d7aa..917abebfb6b25 100644
--- a/x-pack/plugins/maps/public/routing/routes/maps_app/top_nav_config.tsx
+++ b/x-pack/plugins/maps/public/routing/routes/maps_app/top_nav_config.tsx
@@ -123,31 +123,56 @@ export function getTopNavConfig({
return { id: savedObjectId };
}
- if (hasSaveAndReturnConfig) {
- topNavConfigs.push({
- id: 'saveAndReturn',
- label: i18n.translate('xpack.maps.topNav.saveAndReturnButtonLabel', {
- defaultMessage: 'Save and return',
+ topNavConfigs.push(
+ {
+ id: 'mapSettings',
+ label: i18n.translate('xpack.maps.topNav.openSettingsButtonLabel', {
+ defaultMessage: `Map settings`,
}),
- emphasize: true,
- iconType: 'check',
- run: () => {
- onSave({
- newTitle: savedMap.title ? savedMap.title : '',
- newDescription: savedMap.description ? savedMap.description : '',
- newCopyOnSave: false,
- isTitleDuplicateConfirmed: false,
- returnToOrigin: true,
- onTitleDuplicate: () => {},
- });
+ description: i18n.translate('xpack.maps.topNav.openSettingsDescription', {
+ defaultMessage: `Open map settings`,
+ }),
+ testId: 'openSettingsButton',
+ disableButton() {
+ return isOpenSettingsDisabled;
},
- testId: 'mapSaveAndReturnButton',
- });
- }
+ run() {
+ openMapSettings();
+ },
+ },
+ {
+ id: 'inspect',
+ label: i18n.translate('xpack.maps.topNav.openInspectorButtonLabel', {
+ defaultMessage: `inspect`,
+ }),
+ description: i18n.translate('xpack.maps.topNav.openInspectorDescription', {
+ defaultMessage: `Open Inspector`,
+ }),
+ testId: 'openInspectorButton',
+ run() {
+ getInspector().open(inspectorAdapters, {});
+ },
+ },
+ {
+ id: 'full-screen',
+ label: i18n.translate('xpack.maps.topNav.fullScreenButtonLabel', {
+ defaultMessage: `full screen`,
+ }),
+ description: i18n.translate('xpack.maps.topNav.fullScreenDescription', {
+ defaultMessage: `full screen`,
+ }),
+ testId: 'mapsFullScreenMode',
+ run() {
+ getCoreChrome().setIsVisible(false);
+ enableFullScreen();
+ },
+ }
+ );
if (hasWritePermissions) {
topNavConfigs.push({
id: 'save',
+ iconType: hasSaveAndReturnConfig ? undefined : 'save',
label: hasSaveAndReturnConfig
? i18n.translate('xpack.maps.topNav.saveAsButtonLabel', {
defaultMessage: 'Save as',
@@ -192,51 +217,27 @@ export function getTopNavConfig({
});
}
- topNavConfigs.push(
- {
- id: 'mapSettings',
- label: i18n.translate('xpack.maps.topNav.openSettingsButtonLabel', {
- defaultMessage: `Map settings`,
- }),
- description: i18n.translate('xpack.maps.topNav.openSettingsDescription', {
- defaultMessage: `Open map settings`,
- }),
- testId: 'openSettingsButton',
- disableButton() {
- return isOpenSettingsDisabled;
- },
- run() {
- openMapSettings();
- },
- },
- {
- id: 'inspect',
- label: i18n.translate('xpack.maps.topNav.openInspectorButtonLabel', {
- defaultMessage: `inspect`,
- }),
- description: i18n.translate('xpack.maps.topNav.openInspectorDescription', {
- defaultMessage: `Open Inspector`,
- }),
- testId: 'openInspectorButton',
- run() {
- getInspector().open(inspectorAdapters, {});
- },
- },
- {
- id: 'full-screen',
- label: i18n.translate('xpack.maps.topNav.fullScreenButtonLabel', {
- defaultMessage: `full screen`,
- }),
- description: i18n.translate('xpack.maps.topNav.fullScreenDescription', {
- defaultMessage: `full screen`,
+ if (hasSaveAndReturnConfig) {
+ topNavConfigs.push({
+ id: 'saveAndReturn',
+ label: i18n.translate('xpack.maps.topNav.saveAndReturnButtonLabel', {
+ defaultMessage: 'Save and return',
}),
- testId: 'mapsFullScreenMode',
- run() {
- getCoreChrome().setIsVisible(false);
- enableFullScreen();
+ emphasize: true,
+ iconType: 'checkInCircleFilled',
+ run: () => {
+ onSave({
+ newTitle: savedMap.title ? savedMap.title : '',
+ newDescription: savedMap.description ? savedMap.description : '',
+ newCopyOnSave: false,
+ isTitleDuplicateConfirmed: false,
+ returnToOrigin: true,
+ onTitleDuplicate: () => {},
+ });
},
- }
- );
+ testId: 'mapSaveAndReturnButton',
+ });
+ }
return topNavConfigs;
}
From bb4ad196ea25858234176248030814144a087f0b Mon Sep 17 00:00:00 2001
From: Spencer
Date: Fri, 2 Oct 2020 09:50:49 -0700
Subject: [PATCH 28/56] normalize paths before printing them into the generated
plugin list (#79232)
Co-authored-by: spalger
---
docs/developer/plugin-list.asciidoc | 12 ++++++------
.../src/plugin_list/discover_plugins.ts | 2 +-
.../src/plugin_list/generate_plugin_list.ts | 10 ++++++----
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc
index bf11f87b96ce9..67b7aa8e6a011 100644
--- a/docs/developer/plugin-list.asciidoc
+++ b/docs/developer/plugin-list.asciidoc
@@ -16,7 +16,7 @@ NOTE:
[discrete]
=== src/plugins
-[%header,cols=2*]
+[%header,cols=2*]
|===
|Name
|Description
@@ -259,7 +259,7 @@ which will load the visualization's editor.
[discrete]
=== x-pack/plugins
-[%header,cols=2*]
+[%header,cols=2*]
|===
|Name
|Description
@@ -515,6 +515,10 @@ As a developer you can reuse and extend built-in alerts and actions UI functiona
in their infrastructure.
+|{kib-repo}blob/{branch}/x-pack/plugins/drilldowns/url_drilldown/README.md[urlDrilldown]
+|NOTE: This plugin contains implementation of URL drilldown. For drilldowns infrastructure code refer to ui_actions_enhanced plugin.
+
+
|{kib-repo}blob/{branch}/x-pack/plugins/watcher/README.md[watcher]
|This plugins adopts some conventions in addition to or in place of conventions in Kibana (at the time of the plugin's creation):
@@ -523,10 +527,6 @@ in their infrastructure.
|Contains HTTP endpoints and UiSettings that are slated for removal.
-|{kib-repo}blob/{branch}/x-pack/plugins/drilldowns/url_drilldown/README.md[urlDrilldown]
-|NOTE: This plugin contains implementation of URL drilldown. For drilldowns infrastructure code refer to ui_actions_enhanced plugin.
-
-
|===
include::{kibana-root}/src/plugins/dashboard/README.asciidoc[leveloffset=+1]
diff --git a/packages/kbn-dev-utils/src/plugin_list/discover_plugins.ts b/packages/kbn-dev-utils/src/plugin_list/discover_plugins.ts
index 5d92ddb600aa9..e8f6735205b19 100644
--- a/packages/kbn-dev-utils/src/plugin_list/discover_plugins.ts
+++ b/packages/kbn-dev-utils/src/plugin_list/discover_plugins.ts
@@ -29,7 +29,7 @@ import { extractAsciidocInfo } from './extract_asciidoc_info';
export interface Plugin {
id: string;
- relativeDir?: string;
+ relativeDir: string;
relativeReadmePath?: string;
readmeSnippet?: string;
readmeAsciidocAnchor?: string;
diff --git a/packages/kbn-dev-utils/src/plugin_list/generate_plugin_list.ts b/packages/kbn-dev-utils/src/plugin_list/generate_plugin_list.ts
index e1a1323553113..680c220adb18c 100644
--- a/packages/kbn-dev-utils/src/plugin_list/generate_plugin_list.ts
+++ b/packages/kbn-dev-utils/src/plugin_list/generate_plugin_list.ts
@@ -24,9 +24,11 @@ import { REPO_ROOT } from '@kbn/utils';
import { Plugins } from './discover_plugins';
+const sortPlugins = (plugins: Plugins) => plugins.sort((a, b) => a.id.localeCompare(b.id));
+
function* printPlugins(plugins: Plugins, includes: string[]) {
- for (const plugin of plugins) {
- const path = plugin.relativeReadmePath || plugin.relativeDir;
+ for (const plugin of sortPlugins(plugins)) {
+ const path = normalizePath(plugin.relativeReadmePath || plugin.relativeDir);
yield '';
if (plugin.readmeAsciidocAnchor) {
@@ -67,7 +69,7 @@ NOTE:
[discrete]
=== src/plugins
-[%header,cols=2*]
+[%header,cols=2*]
|===
|Name
|Description
@@ -79,7 +81,7 @@ ${Array.from(printPlugins(ossPlugins, includes)).join('\n')}
[discrete]
=== x-pack/plugins
-[%header,cols=2*]
+[%header,cols=2*]
|===
|Name
|Description
From 2899e83df8b849f5fb2a898944c6aada69dff12f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20G=C3=B3mez?=
Date: Fri, 2 Oct 2020 18:57:50 +0200
Subject: [PATCH 29/56] [Logs UI] Remove legacy singletons (#77743)
Removes the `npStart` legacy singleton used during the migration to the new platform. The singleton was used in API calls to access the `http.fetch` service. To remove the singleton we have injected `fetch` as a dependency in all functions.
---
.../common/components/get_alert_preview.ts | 4 +-
.../logs/log_analysis/api/ml_cleanup.ts | 56 ++++++-------
.../api/ml_get_jobs_summary_api.ts | 26 +++---
.../logs/log_analysis/api/ml_get_module.ts | 16 ++--
.../log_analysis/api/ml_setup_module_api.ts | 52 +++++++-----
.../log_analysis/api/validate_datasets.ts | 19 +++--
.../logs/log_analysis/api/validate_indices.ts | 26 +++---
.../log_analysis_capabilities.tsx | 15 ++--
.../log_analysis/log_analysis_cleanup.tsx | 21 ++---
.../logs/log_analysis/log_analysis_module.tsx | 28 +++++--
.../log_analysis_module_definition.tsx | 4 +-
.../log_analysis/log_analysis_module_types.ts | 24 ++++--
.../log_analysis/log_analysis_setup_state.ts | 8 +-
.../log_entry_categories/module_descriptor.ts | 80 ++++++++++++-------
.../log_entry_rate/module_descriptor.ts | 72 ++++++++++-------
.../logs/log_entries/api/fetch_log_entries.ts | 13 ++-
.../log_entries/api/fetch_log_entries_item.ts | 19 ++---
.../containers/logs/log_entries/index.ts | 6 +-
.../public/containers/logs/log_flyout.tsx | 4 +-
.../api/fetch_log_entries_highlights.ts | 19 ++---
.../api/fetch_log_summary_highlights.ts | 18 ++---
.../log_highlights/log_entry_highlights.tsx | 23 +++---
.../log_highlights/log_summary_highlights.ts | 21 +++--
.../api/fetch_log_source_configuration.ts | 7 +-
.../log_source/api/fetch_log_source_status.ts | 4 +-
.../api/patch_log_source_configuration.ts | 4 +-
.../containers/logs/log_source/log_source.ts | 10 +--
.../containers/logs/log_stream/index.ts | 19 +++--
.../logs/log_summary/api/fetch_log_summary.ts | 19 ++---
.../logs/log_summary/log_summary.test.tsx | 24 ++++--
.../logs/log_summary/log_summary.tsx | 19 +++--
.../public/containers/ml/api/ml_cleanup.ts | 57 ++++++-------
.../ml/api/ml_get_jobs_summary_api.ts | 26 +++---
.../public/containers/ml/api/ml_get_module.ts | 16 ++--
.../containers/ml/api/ml_setup_module_api.ts | 52 +++++++-----
.../containers/ml/infra_ml_capabilities.tsx | 5 +-
.../public/containers/ml/infra_ml_cleanup.tsx | 20 +++--
.../public/containers/ml/infra_ml_module.tsx | 31 ++++---
.../ml/infra_ml_module_definition.tsx | 4 +-
.../containers/ml/infra_ml_module_types.ts | 37 ++++++---
.../metrics_hosts/module_descriptor.ts | 53 ++++++------
.../modules/metrics_k8s/module_descriptor.ts | 53 ++++++------
.../plugins/infra/public/legacy_singletons.ts | 14 ----
.../pages/link_to/link_to_logs.test.tsx | 1 -
.../get_log_entry_category_datasets.ts | 27 ++++---
.../get_log_entry_category_examples.ts | 31 +++----
.../get_top_log_entry_categories.ts | 30 +++----
.../use_log_entry_categories_results.ts | 20 +++--
.../use_log_entry_category_examples.tsx | 16 ++--
.../service_calls/get_log_entry_anomalies.ts | 23 +++---
.../get_log_entry_anomalies_datasets.ts | 16 ++--
.../service_calls/get_log_entry_examples.ts | 33 ++++----
.../service_calls/get_log_entry_rate.ts | 31 ++++---
.../use_log_entry_anomalies_results.ts | 25 ++++--
.../log_entry_rate/use_log_entry_examples.ts | 17 ++--
.../use_log_entry_rate_results.ts | 15 ++--
.../hooks/use_metrics_hosts_anomalies.ts | 43 ++++++----
.../hooks/use_metrics_k8s_anomalies.ts | 45 +++++++----
x-pack/plugins/infra/public/plugin.ts | 5 +-
59 files changed, 798 insertions(+), 628 deletions(-)
delete mode 100644 x-pack/plugins/infra/public/legacy_singletons.ts
diff --git a/x-pack/plugins/infra/public/alerting/common/components/get_alert_preview.ts b/x-pack/plugins/infra/public/alerting/common/components/get_alert_preview.ts
index 207d8a722a8c6..ea50ea6f11f3a 100644
--- a/x-pack/plugins/infra/public/alerting/common/components/get_alert_preview.ts
+++ b/x-pack/plugins/infra/public/alerting/common/components/get_alert_preview.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { HttpSetup } from 'src/core/public';
+import type { HttpHandler } from 'src/core/public';
import {
INFRA_ALERT_PREVIEW_PATH,
METRIC_THRESHOLD_ALERT_TYPE_ID,
@@ -22,7 +22,7 @@ export async function getAlertPreview({
params,
alertType,
}: {
- fetch: HttpSetup['fetch'];
+ fetch: HttpHandler;
params: AlertPreviewRequestParams;
alertType: PreviewableAlertTypes;
}): Promise {
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_cleanup.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_cleanup.ts
index 6fa2ac175ace6..4fdd6bdd282ba 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_cleanup.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_cleanup.ts
@@ -5,21 +5,25 @@
*/
import * as rt from 'io-ts';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { fold } from 'fp-ts/lib/Either';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import { getDatafeedId, getJobId } from '../../../../../common/log_analysis';
-import { throwErrors, createPlainError } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
+
+interface DeleteJobsRequestArgs {
+ spaceId: string;
+ sourceId: string;
+ jobTypes: JobType[];
+}
export const callDeleteJobs = async (
- spaceId: string,
- sourceId: string,
- jobTypes: JobType[]
+ requestArgs: DeleteJobsRequestArgs,
+ fetch: HttpHandler
) => {
+ const { spaceId, sourceId, jobTypes } = requestArgs;
+
// NOTE: Deleting the jobs via this API will delete the datafeeds at the same time
- const deleteJobsResponse = await npStart.http.fetch('/api/ml/jobs/delete_jobs', {
+ const deleteJobsResponse = await fetch('/api/ml/jobs/delete_jobs', {
method: 'POST',
body: JSON.stringify(
deleteJobsRequestPayloadRT.encode({
@@ -28,28 +32,29 @@ export const callDeleteJobs = async (
),
});
- return pipe(
- deleteJobsResponsePayloadRT.decode(deleteJobsResponse),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(deleteJobsResponsePayloadRT)(deleteJobsResponse);
};
-export const callGetJobDeletionTasks = async () => {
- const jobDeletionTasksResponse = await npStart.http.fetch('/api/ml/jobs/deleting_jobs_tasks');
+export const callGetJobDeletionTasks = async (fetch: HttpHandler) => {
+ const jobDeletionTasksResponse = await fetch('/api/ml/jobs/deleting_jobs_tasks');
- return pipe(
- getJobDeletionTasksResponsePayloadRT.decode(jobDeletionTasksResponse),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(getJobDeletionTasksResponsePayloadRT)(jobDeletionTasksResponse);
};
+interface StopDatafeedsRequestArgs {
+ spaceId: string;
+ sourceId: string;
+ jobTypes: JobType[];
+}
+
export const callStopDatafeeds = async (
- spaceId: string,
- sourceId: string,
- jobTypes: JobType[]
+ requestArgs: StopDatafeedsRequestArgs,
+ fetch: HttpHandler
) => {
+ const { spaceId, sourceId, jobTypes } = requestArgs;
+
// Stop datafeed due to https://github.com/elastic/kibana/issues/44652
- const stopDatafeedResponse = await npStart.http.fetch('/api/ml/jobs/stop_datafeeds', {
+ const stopDatafeedResponse = await fetch('/api/ml/jobs/stop_datafeeds', {
method: 'POST',
body: JSON.stringify(
stopDatafeedsRequestPayloadRT.encode({
@@ -58,10 +63,7 @@ export const callStopDatafeeds = async (
),
});
- return pipe(
- stopDatafeedsResponsePayloadRT.decode(stopDatafeedResponse),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(stopDatafeedsResponsePayloadRT)(stopDatafeedResponse);
};
export const deleteJobsRequestPayloadRT = rt.type({
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts
index 7441c0ab7d34c..7cb477dbe5b37 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts
@@ -4,21 +4,24 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { identity } from 'fp-ts/lib/function';
-import { pipe } from 'fp-ts/lib/pipeable';
import * as rt from 'io-ts';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import { getJobId, jobCustomSettingsRT } from '../../../../../common/log_analysis';
-import { createPlainError, throwErrors } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
+
+interface RequestArgs {
+ spaceId: string;
+ sourceId: string;
+ jobTypes: JobType[];
+}
export const callJobsSummaryAPI = async (
- spaceId: string,
- sourceId: string,
- jobTypes: JobType[]
+ requestArgs: RequestArgs,
+ fetch: HttpHandler
) => {
- const response = await npStart.http.fetch('/api/ml/jobs/jobs_summary', {
+ const { spaceId, sourceId, jobTypes } = requestArgs;
+ const response = await fetch('/api/ml/jobs/jobs_summary', {
method: 'POST',
body: JSON.stringify(
fetchJobStatusRequestPayloadRT.encode({
@@ -26,10 +29,7 @@ export const callJobsSummaryAPI = async (
})
),
});
- return pipe(
- fetchJobStatusResponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(fetchJobStatusResponsePayloadRT)(response);
};
export const fetchJobStatusRequestPayloadRT = rt.type({
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_module.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_module.ts
index b6b40d6dc651f..2bf18d4e52c79 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_module.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_module.ts
@@ -4,24 +4,18 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { identity } from 'fp-ts/lib/function';
-import { pipe } from 'fp-ts/lib/pipeable';
import * as rt from 'io-ts';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import { jobCustomSettingsRT } from '../../../../../common/log_analysis';
-import { createPlainError, throwErrors } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
-export const callGetMlModuleAPI = async (moduleId: string) => {
- const response = await npStart.http.fetch(`/api/ml/modules/get_module/${moduleId}`, {
+export const callGetMlModuleAPI = async (moduleId: string, fetch: HttpHandler) => {
+ const response = await fetch(`/api/ml/modules/get_module/${moduleId}`, {
method: 'GET',
});
- return pipe(
- getMlModuleResponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(getMlModuleResponsePayloadRT)(response);
};
const jobDefinitionRT = rt.type({
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_setup_module_api.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_setup_module_api.ts
index 7c8d63374924c..1f203ef9618b8 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_setup_module_api.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_setup_module_api.ts
@@ -4,27 +4,38 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { identity } from 'fp-ts/lib/function';
-import { pipe } from 'fp-ts/lib/pipeable';
import * as rt from 'io-ts';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import { getJobIdPrefix, jobCustomSettingsRT } from '../../../../../common/log_analysis';
-import { createPlainError, throwErrors } from '../../../../../common/runtime_types';
-
-export const callSetupMlModuleAPI = async (
- moduleId: string,
- start: number | undefined,
- end: number | undefined,
- spaceId: string,
- sourceId: string,
- indexPattern: string,
- jobOverrides: SetupMlModuleJobOverrides[] = [],
- datafeedOverrides: SetupMlModuleDatafeedOverrides[] = [],
- query?: object
-) => {
- const response = await npStart.http.fetch(`/api/ml/modules/setup/${moduleId}`, {
+import { decodeOrThrow } from '../../../../../common/runtime_types';
+
+interface RequestArgs {
+ moduleId: string;
+ start?: number;
+ end?: number;
+ spaceId: string;
+ sourceId: string;
+ indexPattern: string;
+ jobOverrides?: SetupMlModuleJobOverrides[];
+ datafeedOverrides?: SetupMlModuleDatafeedOverrides[];
+ query?: object;
+}
+
+export const callSetupMlModuleAPI = async (requestArgs: RequestArgs, fetch: HttpHandler) => {
+ const {
+ moduleId,
+ start,
+ end,
+ spaceId,
+ sourceId,
+ indexPattern,
+ jobOverrides = [],
+ datafeedOverrides = [],
+ query,
+ } = requestArgs;
+
+ const response = await fetch(`/api/ml/modules/setup/${moduleId}`, {
method: 'POST',
body: JSON.stringify(
setupMlModuleRequestPayloadRT.encode({
@@ -40,10 +51,7 @@ export const callSetupMlModuleAPI = async (
),
});
- return pipe(
- setupMlModuleResponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(setupMlModuleResponsePayloadRT)(response);
};
const setupMlModuleTimeParamsRT = rt.partial({
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_datasets.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_datasets.ts
index 6c9d5e439d359..ec08d3ac107e5 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_datasets.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_datasets.ts
@@ -4,21 +4,24 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import type { HttpHandler } from 'src/core/public';
import {
LOG_ANALYSIS_VALIDATE_DATASETS_PATH,
validateLogEntryDatasetsRequestPayloadRT,
validateLogEntryDatasetsResponsePayloadRT,
} from '../../../../../common/http_api';
import { decodeOrThrow } from '../../../../../common/runtime_types';
-import { npStart } from '../../../../legacy_singletons';
-export const callValidateDatasetsAPI = async (
- indices: string[],
- timestampField: string,
- startTime: number,
- endTime: number
-) => {
- const response = await npStart.http.fetch(LOG_ANALYSIS_VALIDATE_DATASETS_PATH, {
+interface RequestArgs {
+ indices: string[];
+ timestampField: string;
+ startTime: number;
+ endTime: number;
+}
+
+export const callValidateDatasetsAPI = async (requestArgs: RequestArgs, fetch: HttpHandler) => {
+ const { indices, timestampField, startTime, endTime } = requestArgs;
+ const response = await fetch(LOG_ANALYSIS_VALIDATE_DATASETS_PATH, {
method: 'POST',
body: JSON.stringify(
validateLogEntryDatasetsRequestPayloadRT.encode({
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts
index bbef7d201045f..465d09a744b19 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts
@@ -4,10 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
+
import {
LOG_ANALYSIS_VALIDATE_INDICES_PATH,
ValidationIndicesFieldSpecification,
@@ -15,19 +13,19 @@ import {
validationIndicesResponsePayloadRT,
} from '../../../../../common/http_api';
-import { throwErrors, createPlainError } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
+
+interface RequestArgs {
+ indices: string[];
+ fields: ValidationIndicesFieldSpecification[];
+}
-export const callValidateIndicesAPI = async (
- indices: string[],
- fields: ValidationIndicesFieldSpecification[]
-) => {
- const response = await npStart.http.fetch(LOG_ANALYSIS_VALIDATE_INDICES_PATH, {
+export const callValidateIndicesAPI = async (requestArgs: RequestArgs, fetch: HttpHandler) => {
+ const { indices, fields } = requestArgs;
+ const response = await fetch(LOG_ANALYSIS_VALIDATE_INDICES_PATH, {
method: 'POST',
body: JSON.stringify(validationIndicesRequestPayloadRT.encode({ data: { indices, fields } })),
});
- return pipe(
- validationIndicesResponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(validationIndicesResponsePayloadRT)(response);
};
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_capabilities.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_capabilities.tsx
index 9116900ec2196..74b316f78259f 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_capabilities.tsx
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_capabilities.tsx
@@ -6,18 +6,16 @@
import createContainer from 'constate';
import { useMemo, useState, useEffect } from 'react';
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
import { useTrackedPromise } from '../../../utils/use_tracked_promise';
-import { npStart } from '../../../legacy_singletons';
import {
getMlCapabilitiesResponsePayloadRT,
GetMlCapabilitiesResponsePayload,
} from './api/ml_api_types';
-import { throwErrors, createPlainError } from '../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../common/runtime_types';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
export const useLogAnalysisCapabilities = () => {
+ const { services } = useKibanaContextForPlugin();
const [mlCapabilities, setMlCapabilities] = useState(
initialMlCapabilities
);
@@ -26,12 +24,9 @@ export const useLogAnalysisCapabilities = () => {
{
cancelPreviousOn: 'resolution',
createPromise: async () => {
- const rawResponse = await npStart.http.fetch('/api/ml/ml_capabilities');
+ const rawResponse = await services.http.fetch('/api/ml/ml_capabilities');
- return pipe(
- getMlCapabilitiesResponsePayloadRT.decode(rawResponse),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(getMlCapabilitiesResponsePayloadRT)(rawResponse);
},
onResolve: (response) => {
setMlCapabilities(response);
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_cleanup.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_cleanup.tsx
index 522616f83d0cb..ec5e879131aa1 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_cleanup.tsx
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_cleanup.tsx
@@ -3,17 +3,18 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-
+import type { HttpHandler } from 'src/core/public';
import { getJobId } from '../../../../common/log_analysis';
import { callDeleteJobs, callGetJobDeletionTasks, callStopDatafeeds } from './api/ml_cleanup';
export const cleanUpJobsAndDatafeeds = async (
spaceId: string,
sourceId: string,
- jobTypes: JobType[]
+ jobTypes: JobType[],
+ fetch: HttpHandler
) => {
try {
- await callStopDatafeeds(spaceId, sourceId, jobTypes);
+ await callStopDatafeeds({ spaceId, sourceId, jobTypes }, fetch);
} catch (err) {
// Proceed only if datafeed has been deleted or didn't exist in the first place
if (err?.res?.status !== 404) {
@@ -21,27 +22,29 @@ export const cleanUpJobsAndDatafeeds = async (
}
}
- return await deleteJobs(spaceId, sourceId, jobTypes);
+ return await deleteJobs(spaceId, sourceId, jobTypes, fetch);
};
const deleteJobs = async (
spaceId: string,
sourceId: string,
- jobTypes: JobType[]
+ jobTypes: JobType[],
+ fetch: HttpHandler
) => {
- const deleteJobsResponse = await callDeleteJobs(spaceId, sourceId, jobTypes);
- await waitUntilJobsAreDeleted(spaceId, sourceId, jobTypes);
+ const deleteJobsResponse = await callDeleteJobs({ spaceId, sourceId, jobTypes }, fetch);
+ await waitUntilJobsAreDeleted(spaceId, sourceId, jobTypes, fetch);
return deleteJobsResponse;
};
const waitUntilJobsAreDeleted = async (
spaceId: string,
sourceId: string,
- jobTypes: JobType[]
+ jobTypes: JobType[],
+ fetch: HttpHandler
) => {
const moduleJobIds = jobTypes.map((jobType) => getJobId(spaceId, sourceId, jobType));
while (true) {
- const { jobIds: jobIdsBeingDeleted } = await callGetJobDeletionTasks();
+ const { jobIds: jobIdsBeingDeleted } = await callGetJobDeletionTasks(fetch);
const needToWait = jobIdsBeingDeleted.some((jobId) => moduleJobIds.includes(jobId));
if (needToWait) {
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx
index 79768302a7310..27ef0039ae49f 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx
@@ -6,6 +6,7 @@
import { useCallback, useMemo } from 'react';
import { DatasetFilter } from '../../../../common/log_analysis';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
import { useTrackedPromise } from '../../../utils/use_tracked_promise';
import { useModuleStatus } from './log_analysis_module_status';
import { ModuleDescriptor, ModuleSourceConfiguration } from './log_analysis_module_types';
@@ -17,6 +18,7 @@ export const useLogAnalysisModule = ({
sourceConfiguration: ModuleSourceConfiguration;
moduleDescriptor: ModuleDescriptor;
}) => {
+ const { services } = useKibanaContextForPlugin();
const { spaceId, sourceId, timestampField } = sourceConfiguration;
const [moduleStatus, dispatchModuleStatus] = useModuleStatus(moduleDescriptor.jobTypes);
@@ -25,7 +27,7 @@ export const useLogAnalysisModule = ({
cancelPreviousOn: 'resolution',
createPromise: async () => {
dispatchModuleStatus({ type: 'fetchingJobStatuses' });
- return await moduleDescriptor.getJobSummary(spaceId, sourceId);
+ return await moduleDescriptor.getJobSummary(spaceId, sourceId, services.http.fetch);
},
onResolve: (jobResponse) => {
dispatchModuleStatus({
@@ -52,13 +54,23 @@ export const useLogAnalysisModule = ({
datasetFilter: DatasetFilter
) => {
dispatchModuleStatus({ type: 'startedSetup' });
- const setupResult = await moduleDescriptor.setUpModule(start, end, datasetFilter, {
- indices: selectedIndices,
- sourceId,
+ const setupResult = await moduleDescriptor.setUpModule(
+ start,
+ end,
+ datasetFilter,
+ {
+ indices: selectedIndices,
+ sourceId,
+ spaceId,
+ timestampField,
+ },
+ services.http.fetch
+ );
+ const jobSummaries = await moduleDescriptor.getJobSummary(
spaceId,
- timestampField,
- });
- const jobSummaries = await moduleDescriptor.getJobSummary(spaceId, sourceId);
+ sourceId,
+ services.http.fetch
+ );
return { setupResult, jobSummaries };
},
onResolve: ({ setupResult: { datafeeds, jobs }, jobSummaries }) => {
@@ -82,7 +94,7 @@ export const useLogAnalysisModule = ({
{
cancelPreviousOn: 'resolution',
createPromise: async () => {
- return await moduleDescriptor.cleanUpModule(spaceId, sourceId);
+ return await moduleDescriptor.cleanUpModule(spaceId, sourceId, services.http.fetch);
},
},
[spaceId, sourceId]
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_definition.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_definition.tsx
index 1f643d0e5eb34..7a5c1d354dc34 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_definition.tsx
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_definition.tsx
@@ -6,6 +6,7 @@
import { useCallback, useMemo, useState } from 'react';
import { getJobId } from '../../../../common/log_analysis';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
import { useTrackedPromise } from '../../../utils/use_tracked_promise';
import { JobSummary } from './api/ml_get_jobs_summary_api';
import { GetMlModuleResponsePayload, JobDefinition } from './api/ml_get_module';
@@ -18,6 +19,7 @@ export const useLogAnalysisModuleDefinition = ({
sourceConfiguration: ModuleSourceConfiguration;
moduleDescriptor: ModuleDescriptor;
}) => {
+ const { services } = useKibanaContextForPlugin();
const [moduleDefinition, setModuleDefinition] = useState<
GetMlModuleResponsePayload | undefined
>();
@@ -40,7 +42,7 @@ export const useLogAnalysisModuleDefinition = ({
{
cancelPreviousOn: 'resolution',
createPromise: async () => {
- return await moduleDescriptor.getModuleDefinition();
+ return await moduleDescriptor.getModuleDefinition(services.http.fetch);
},
onResolve: (response) => {
setModuleDefinition(response);
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts
index ba355ad195b11..c42704860b032 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts
@@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import type { HttpHandler } from 'src/core/public';
import {
ValidateLogEntryDatasetsResponsePayload,
ValidationIndicesResponsePayload,
@@ -23,24 +24,35 @@ export interface ModuleDescriptor {
jobTypes: JobType[];
bucketSpan: number;
getJobIds: (spaceId: string, sourceId: string) => Record;
- getJobSummary: (spaceId: string, sourceId: string) => Promise;
- getModuleDefinition: () => Promise;
+ getJobSummary: (
+ spaceId: string,
+ sourceId: string,
+ fetch: HttpHandler
+ ) => Promise;
+ getModuleDefinition: (fetch: HttpHandler) => Promise;
setUpModule: (
start: number | undefined,
end: number | undefined,
datasetFilter: DatasetFilter,
- sourceConfiguration: ModuleSourceConfiguration
+ sourceConfiguration: ModuleSourceConfiguration,
+ fetch: HttpHandler
) => Promise;
- cleanUpModule: (spaceId: string, sourceId: string) => Promise;
+ cleanUpModule: (
+ spaceId: string,
+ sourceId: string,
+ fetch: HttpHandler
+ ) => Promise;
validateSetupIndices: (
indices: string[],
- timestampField: string
+ timestampField: string,
+ fetch: HttpHandler
) => Promise;
validateSetupDatasets: (
indices: string[],
timestampField: string,
startTime: number,
- endTime: number
+ endTime: number,
+ fetch: HttpHandler
) => Promise;
}
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.ts
index e6fe8f4e92cc4..750a7104a3a98 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.ts
@@ -18,6 +18,7 @@ import {
ValidationIndicesError,
ValidationUIError,
} from '../../../components/logging/log_analysis_setup/initial_configuration_step';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
import { useTrackedPromise } from '../../../utils/use_tracked_promise';
import { ModuleDescriptor, ModuleSourceConfiguration } from './log_analysis_module_types';
@@ -43,6 +44,7 @@ export const useAnalysisSetupState = ({
setUpModule,
sourceConfiguration,
}: AnalysisSetupStateArguments) => {
+ const { services } = useKibanaContextForPlugin();
const [startTime, setStartTime] = useState(Date.now() - fourWeeksInMs);
const [endTime, setEndTime] = useState(undefined);
@@ -158,7 +160,8 @@ export const useAnalysisSetupState = ({
createPromise: async () => {
return await validateSetupIndices(
sourceConfiguration.indices,
- sourceConfiguration.timestampField
+ sourceConfiguration.timestampField,
+ services.http.fetch
);
},
onResolve: ({ data: { errors } }) => {
@@ -183,7 +186,8 @@ export const useAnalysisSetupState = ({
validIndexNames,
sourceConfiguration.timestampField,
startTime ?? 0,
- endTime ?? Date.now()
+ endTime ?? Date.now(),
+ services.http.fetch
);
},
onResolve: ({ data: { datasets } }) => {
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/module_descriptor.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/module_descriptor.ts
index 9682b3e74db3b..46b28e091cc5c 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/module_descriptor.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/module_descriptor.ts
@@ -5,6 +5,7 @@
*/
import { i18n } from '@kbn/i18n';
+import type { HttpHandler } from 'src/core/public';
import {
bucketSpan,
categoriesMessageField,
@@ -42,22 +43,26 @@ const getJobIds = (spaceId: string, sourceId: string) =>
{} as Record
);
-const getJobSummary = async (spaceId: string, sourceId: string) => {
- const response = await callJobsSummaryAPI(spaceId, sourceId, logEntryCategoriesJobTypes);
+const getJobSummary = async (spaceId: string, sourceId: string, fetch: HttpHandler) => {
+ const response = await callJobsSummaryAPI(
+ { spaceId, sourceId, jobTypes: logEntryCategoriesJobTypes },
+ fetch
+ );
const jobIds = Object.values(getJobIds(spaceId, sourceId));
return response.filter((jobSummary) => jobIds.includes(jobSummary.id));
};
-const getModuleDefinition = async () => {
- return await callGetMlModuleAPI(moduleId);
+const getModuleDefinition = async (fetch: HttpHandler) => {
+ return await callGetMlModuleAPI(moduleId, fetch);
};
const setUpModule = async (
start: number | undefined,
end: number | undefined,
datasetFilter: DatasetFilter,
- { spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration
+ { spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration,
+ fetch: HttpHandler
) => {
const indexNamePattern = indices.join(',');
const jobOverrides = [
@@ -101,46 +106,59 @@ const setUpModule = async (
};
return callSetupMlModuleAPI(
- moduleId,
- start,
- end,
- spaceId,
- sourceId,
- indexNamePattern,
- jobOverrides,
- [],
- query
+ {
+ moduleId,
+ start,
+ end,
+ spaceId,
+ sourceId,
+ indexPattern: indexNamePattern,
+ jobOverrides,
+ query,
+ },
+ fetch
);
};
-const cleanUpModule = async (spaceId: string, sourceId: string) => {
- return await cleanUpJobsAndDatafeeds(spaceId, sourceId, logEntryCategoriesJobTypes);
+const cleanUpModule = async (spaceId: string, sourceId: string, fetch: HttpHandler) => {
+ return await cleanUpJobsAndDatafeeds(spaceId, sourceId, logEntryCategoriesJobTypes, fetch);
};
-const validateSetupIndices = async (indices: string[], timestampField: string) => {
- return await callValidateIndicesAPI(indices, [
- {
- name: timestampField,
- validTypes: ['date'],
- },
- {
- name: partitionField,
- validTypes: ['keyword'],
- },
+const validateSetupIndices = async (
+ indices: string[],
+ timestampField: string,
+ fetch: HttpHandler
+) => {
+ return await callValidateIndicesAPI(
{
- name: categoriesMessageField,
- validTypes: ['text'],
+ indices,
+ fields: [
+ {
+ name: timestampField,
+ validTypes: ['date'],
+ },
+ {
+ name: partitionField,
+ validTypes: ['keyword'],
+ },
+ {
+ name: categoriesMessageField,
+ validTypes: ['text'],
+ },
+ ],
},
- ]);
+ fetch
+ );
};
const validateSetupDatasets = async (
indices: string[],
timestampField: string,
startTime: number,
- endTime: number
+ endTime: number,
+ fetch: HttpHandler
) => {
- return await callValidateDatasetsAPI(indices, timestampField, startTime, endTime);
+ return await callValidateDatasetsAPI({ indices, timestampField, startTime, endTime }, fetch);
};
export const logEntryCategoriesModule: ModuleDescriptor = {
diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/module_descriptor.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/module_descriptor.ts
index 001174a2b7558..b97ec55105f5d 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/module_descriptor.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/module_descriptor.ts
@@ -5,6 +5,7 @@
*/
import { i18n } from '@kbn/i18n';
+import type { HttpHandler } from 'src/core/public';
import {
bucketSpan,
DatasetFilter,
@@ -41,22 +42,26 @@ const getJobIds = (spaceId: string, sourceId: string) =>
{} as Record
);
-const getJobSummary = async (spaceId: string, sourceId: string) => {
- const response = await callJobsSummaryAPI(spaceId, sourceId, logEntryRateJobTypes);
+const getJobSummary = async (spaceId: string, sourceId: string, fetch: HttpHandler) => {
+ const response = await callJobsSummaryAPI(
+ { spaceId, sourceId, jobTypes: logEntryRateJobTypes },
+ fetch
+ );
const jobIds = Object.values(getJobIds(spaceId, sourceId));
return response.filter((jobSummary) => jobIds.includes(jobSummary.id));
};
-const getModuleDefinition = async () => {
- return await callGetMlModuleAPI(moduleId);
+const getModuleDefinition = async (fetch: HttpHandler) => {
+ return await callGetMlModuleAPI(moduleId, fetch);
};
const setUpModule = async (
start: number | undefined,
end: number | undefined,
datasetFilter: DatasetFilter,
- { spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration
+ { spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration,
+ fetch: HttpHandler
) => {
const indexNamePattern = indices.join(',');
const jobOverrides = [
@@ -93,42 +98,55 @@ const setUpModule = async (
: undefined;
return callSetupMlModuleAPI(
- moduleId,
- start,
- end,
- spaceId,
- sourceId,
- indexNamePattern,
- jobOverrides,
- [],
- query
+ {
+ moduleId,
+ start,
+ end,
+ spaceId,
+ sourceId,
+ indexPattern: indexNamePattern,
+ jobOverrides,
+ query,
+ },
+ fetch
);
};
-const cleanUpModule = async (spaceId: string, sourceId: string) => {
- return await cleanUpJobsAndDatafeeds(spaceId, sourceId, logEntryRateJobTypes);
+const cleanUpModule = async (spaceId: string, sourceId: string, fetch: HttpHandler) => {
+ return await cleanUpJobsAndDatafeeds(spaceId, sourceId, logEntryRateJobTypes, fetch);
};
-const validateSetupIndices = async (indices: string[], timestampField: string) => {
- return await callValidateIndicesAPI(indices, [
- {
- name: timestampField,
- validTypes: ['date'],
- },
+const validateSetupIndices = async (
+ indices: string[],
+ timestampField: string,
+ fetch: HttpHandler
+) => {
+ return await callValidateIndicesAPI(
{
- name: partitionField,
- validTypes: ['keyword'],
+ indices,
+ fields: [
+ {
+ name: timestampField,
+ validTypes: ['date'],
+ },
+ {
+ name: partitionField,
+ validTypes: ['keyword'],
+ },
+ ],
},
- ]);
+ fetch
+ );
};
const validateSetupDatasets = async (
indices: string[],
timestampField: string,
startTime: number,
- endTime: number
+ endTime: number,
+ fetch: HttpHandler
) => {
- return await callValidateDatasetsAPI(indices, timestampField, startTime, endTime);
+ return await callValidateDatasetsAPI({ indices, timestampField, startTime, endTime }, fetch);
};
export const logEntryRateModule: ModuleDescriptor = {
diff --git a/x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries.ts b/x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries.ts
index 2a19a82892427..3bbd86cb0ef75 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries.ts
@@ -4,12 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
-import { throwErrors, createPlainError } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
import {
LOG_ENTRIES_PATH,
@@ -18,11 +15,11 @@ import {
logEntriesResponseRT,
} from '../../../../../common/http_api';
-export const fetchLogEntries = async (requestArgs: LogEntriesRequest) => {
- const response = await npStart.http.fetch(LOG_ENTRIES_PATH, {
+export const fetchLogEntries = async (requestArgs: LogEntriesRequest, fetch: HttpHandler) => {
+ const response = await fetch(LOG_ENTRIES_PATH, {
method: 'POST',
body: JSON.stringify(logEntriesRequestRT.encode(requestArgs)),
});
- return pipe(logEntriesResponseRT.decode(response), fold(throwErrors(createPlainError), identity));
+ return decodeOrThrow(logEntriesResponseRT)(response);
};
diff --git a/x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries_item.ts b/x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries_item.ts
index 5fde01e458e36..d459fba6cf957 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries_item.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries_item.ts
@@ -4,12 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
-import { throwErrors, createPlainError } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
import {
LOG_ENTRIES_ITEM_PATH,
@@ -18,14 +15,14 @@ import {
logEntriesItemResponseRT,
} from '../../../../../common/http_api';
-export const fetchLogEntriesItem = async (requestArgs: LogEntriesItemRequest) => {
- const response = await npStart.http.fetch(LOG_ENTRIES_ITEM_PATH, {
+export const fetchLogEntriesItem = async (
+ requestArgs: LogEntriesItemRequest,
+ fetch: HttpHandler
+) => {
+ const response = await fetch(LOG_ENTRIES_ITEM_PATH, {
method: 'POST',
body: JSON.stringify(logEntriesItemRequestRT.encode(requestArgs)),
});
- return pipe(
- logEntriesItemResponseRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(logEntriesItemResponseRT)(response);
};
diff --git a/x-pack/plugins/infra/public/containers/logs/log_entries/index.ts b/x-pack/plugins/infra/public/containers/logs/log_entries/index.ts
index d5b2a0aaa61c0..4c8c610794b2e 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_entries/index.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_entries/index.ts
@@ -14,6 +14,7 @@ import {
LogEntriesBaseRequest,
} from '../../../../common/http_api';
import { fetchLogEntries } from './api/fetch_log_entries';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
const DESIRED_BUFFER_PAGES = 2;
const LIVE_STREAM_INTERVAL = 5000;
@@ -144,6 +145,7 @@ const useFetchEntriesEffect = (
dispatch: Dispatch,
props: LogEntriesProps
) => {
+ const { services } = useKibanaContextForPlugin();
const [prevParams, cachePrevParams] = useState();
const [startedStreaming, setStartedStreaming] = useState(false);
@@ -172,7 +174,7 @@ const useFetchEntriesEffect = (
before: 'last',
};
- const { data: payload } = await fetchLogEntries(fetchArgs);
+ const { data: payload } = await fetchLogEntries(fetchArgs, services.http.fetch);
dispatch({ type: Action.ReceiveNewEntries, payload });
// Move position to the bottom if it's the first load.
@@ -228,7 +230,7 @@ const useFetchEntriesEffect = (
after: state.bottomCursor,
};
- const { data: payload } = await fetchLogEntries(fetchArgs);
+ const { data: payload } = await fetchLogEntries(fetchArgs, services.http.fetch);
dispatch({
type: getEntriesBefore ? Action.ReceiveEntriesBefore : Action.ReceiveEntriesAfter,
diff --git a/x-pack/plugins/infra/public/containers/logs/log_flyout.tsx b/x-pack/plugins/infra/public/containers/logs/log_flyout.tsx
index 0489892e58f2a..9ed2f5ad175c7 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_flyout.tsx
+++ b/x-pack/plugins/infra/public/containers/logs/log_flyout.tsx
@@ -9,6 +9,7 @@ import { isString } from 'lodash';
import React, { useContext, useEffect, useMemo, useState } from 'react';
import { LogEntriesItem } from '../../../common/http_api';
+import { useKibanaContextForPlugin } from '../../hooks/use_kibana';
import { UrlStateContainer } from '../../utils/url_state';
import { useTrackedPromise } from '../../utils/use_tracked_promise';
import { fetchLogEntriesItem } from './log_entries/api/fetch_log_entries_item';
@@ -26,6 +27,7 @@ export interface FlyoutOptionsUrlState {
}
export const useLogFlyout = () => {
+ const { services } = useKibanaContextForPlugin();
const { sourceId } = useLogSourceContext();
const [flyoutVisible, setFlyoutVisibility] = useState(false);
const [flyoutId, setFlyoutId] = useState(null);
@@ -39,7 +41,7 @@ export const useLogFlyout = () => {
if (!flyoutId) {
return;
}
- return await fetchLogEntriesItem({ sourceId, id: flyoutId });
+ return await fetchLogEntriesItem({ sourceId, id: flyoutId }, services.http.fetch);
},
onResolve: (response) => {
if (response) {
diff --git a/x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_entries_highlights.ts b/x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_entries_highlights.ts
index 030a9d180c7b5..25865a30467f5 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_entries_highlights.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_entries_highlights.ts
@@ -4,12 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
-import { throwErrors, createPlainError } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
import {
LOG_ENTRIES_HIGHLIGHTS_PATH,
@@ -18,14 +15,14 @@ import {
logEntriesHighlightsResponseRT,
} from '../../../../../common/http_api';
-export const fetchLogEntriesHighlights = async (requestArgs: LogEntriesHighlightsRequest) => {
- const response = await npStart.http.fetch(LOG_ENTRIES_HIGHLIGHTS_PATH, {
+export const fetchLogEntriesHighlights = async (
+ requestArgs: LogEntriesHighlightsRequest,
+ fetch: HttpHandler
+) => {
+ const response = await fetch(LOG_ENTRIES_HIGHLIGHTS_PATH, {
method: 'POST',
body: JSON.stringify(logEntriesHighlightsRequestRT.encode(requestArgs)),
});
- return pipe(
- logEntriesHighlightsResponseRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(logEntriesHighlightsResponseRT)(response);
};
diff --git a/x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_summary_highlights.ts b/x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_summary_highlights.ts
index bda8f535549c7..1cf95bc08a521 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_summary_highlights.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_summary_highlights.ts
@@ -3,11 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
-import { throwErrors, createPlainError } from '../../../../../common/runtime_types';
+
+import type { HttpHandler } from 'src/core/public';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
import {
LOG_ENTRIES_SUMMARY_HIGHLIGHTS_PATH,
@@ -17,15 +15,13 @@ import {
} from '../../../../../common/http_api';
export const fetchLogSummaryHighlights = async (
- requestArgs: LogEntriesSummaryHighlightsRequest
+ requestArgs: LogEntriesSummaryHighlightsRequest,
+ fetch: HttpHandler
) => {
- const response = await npStart.http.fetch(LOG_ENTRIES_SUMMARY_HIGHLIGHTS_PATH, {
+ const response = await fetch(LOG_ENTRIES_SUMMARY_HIGHLIGHTS_PATH, {
method: 'POST',
body: JSON.stringify(logEntriesSummaryHighlightsRequestRT.encode(requestArgs)),
});
- return pipe(
- logEntriesSummaryHighlightsResponseRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(logEntriesSummaryHighlightsResponseRT)(response);
};
diff --git a/x-pack/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.tsx b/x-pack/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.tsx
index dbeb8c71c11eb..b4edebe8f8207 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.tsx
+++ b/x-pack/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.tsx
@@ -10,6 +10,7 @@ import { TimeKey } from '../../../../common/time';
import { useTrackedPromise } from '../../../utils/use_tracked_promise';
import { fetchLogEntriesHighlights } from './api/fetch_log_entries_highlights';
import { LogEntry, LogEntriesHighlightsResponse } from '../../../../common/http_api';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
export const useLogEntryHighlights = (
sourceId: string,
@@ -21,6 +22,7 @@ export const useLogEntryHighlights = (
filterQuery: string | null,
highlightTerms: string[]
) => {
+ const { services } = useKibanaContextForPlugin();
const [logEntryHighlights, setLogEntryHighlights] = useState<
LogEntriesHighlightsResponse['data']
>([]);
@@ -32,15 +34,18 @@ export const useLogEntryHighlights = (
throw new Error('Skipping request: Insufficient parameters');
}
- return await fetchLogEntriesHighlights({
- sourceId,
- startTimestamp,
- endTimestamp,
- center: centerPoint,
- size,
- query: filterQuery || undefined,
- highlightTerms,
- });
+ return await fetchLogEntriesHighlights(
+ {
+ sourceId,
+ startTimestamp,
+ endTimestamp,
+ center: centerPoint,
+ size,
+ query: filterQuery || undefined,
+ highlightTerms,
+ },
+ services.http.fetch
+ );
},
onResolve: (response) => {
setLogEntryHighlights(response.data);
diff --git a/x-pack/plugins/infra/public/containers/logs/log_highlights/log_summary_highlights.ts b/x-pack/plugins/infra/public/containers/logs/log_highlights/log_summary_highlights.ts
index 6d982ee004ccc..14366891dbf59 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_highlights/log_summary_highlights.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_highlights/log_summary_highlights.ts
@@ -11,6 +11,7 @@ import { useTrackedPromise } from '../../../utils/use_tracked_promise';
import { fetchLogSummaryHighlights } from './api/fetch_log_summary_highlights';
import { LogEntriesSummaryHighlightsResponse } from '../../../../common/http_api';
import { useBucketSize } from '../log_summary/bucket_size';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
export const useLogSummaryHighlights = (
sourceId: string,
@@ -20,6 +21,7 @@ export const useLogSummaryHighlights = (
filterQuery: string | null,
highlightTerms: string[]
) => {
+ const { services } = useKibanaContextForPlugin();
const [logSummaryHighlights, setLogSummaryHighlights] = useState<
LogEntriesSummaryHighlightsResponse['data']
>([]);
@@ -34,14 +36,17 @@ export const useLogSummaryHighlights = (
throw new Error('Skipping request: Insufficient parameters');
}
- return await fetchLogSummaryHighlights({
- sourceId,
- startTimestamp,
- endTimestamp,
- bucketSize,
- query: filterQuery,
- highlightTerms,
- });
+ return await fetchLogSummaryHighlights(
+ {
+ sourceId,
+ startTimestamp,
+ endTimestamp,
+ bucketSize,
+ query: filterQuery,
+ highlightTerms,
+ },
+ services.http.fetch
+ );
},
onResolve: (response) => {
setLogSummaryHighlights(response.data);
diff --git a/x-pack/plugins/infra/public/containers/logs/log_source/api/fetch_log_source_configuration.ts b/x-pack/plugins/infra/public/containers/logs/log_source/api/fetch_log_source_configuration.ts
index e847302a6d367..c9ced069473a3 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_source/api/fetch_log_source_configuration.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_source/api/fetch_log_source_configuration.ts
@@ -4,17 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { HttpSetup } from 'src/core/public';
+import type { HttpHandler } from 'src/core/public';
import {
getLogSourceConfigurationPath,
getLogSourceConfigurationSuccessResponsePayloadRT,
} from '../../../../../common/http_api/log_sources';
import { decodeOrThrow } from '../../../../../common/runtime_types';
-export const callFetchLogSourceConfigurationAPI = async (
- sourceId: string,
- fetch: HttpSetup['fetch']
-) => {
+export const callFetchLogSourceConfigurationAPI = async (sourceId: string, fetch: HttpHandler) => {
const response = await fetch(getLogSourceConfigurationPath(sourceId), {
method: 'GET',
});
diff --git a/x-pack/plugins/infra/public/containers/logs/log_source/api/fetch_log_source_status.ts b/x-pack/plugins/infra/public/containers/logs/log_source/api/fetch_log_source_status.ts
index 20e67a0a59c9f..5bc409115e595 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_source/api/fetch_log_source_status.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_source/api/fetch_log_source_status.ts
@@ -4,14 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { HttpSetup } from 'src/core/public';
+import type { HttpHandler } from 'src/core/public';
import {
getLogSourceStatusPath,
getLogSourceStatusSuccessResponsePayloadRT,
} from '../../../../../common/http_api/log_sources';
import { decodeOrThrow } from '../../../../../common/runtime_types';
-export const callFetchLogSourceStatusAPI = async (sourceId: string, fetch: HttpSetup['fetch']) => {
+export const callFetchLogSourceStatusAPI = async (sourceId: string, fetch: HttpHandler) => {
const response = await fetch(getLogSourceStatusPath(sourceId), {
method: 'GET',
});
diff --git a/x-pack/plugins/infra/public/containers/logs/log_source/api/patch_log_source_configuration.ts b/x-pack/plugins/infra/public/containers/logs/log_source/api/patch_log_source_configuration.ts
index 4361e4bef827f..33212c5d3b0f2 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_source/api/patch_log_source_configuration.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_source/api/patch_log_source_configuration.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { HttpSetup } from 'src/core/public';
+import type { HttpHandler } from 'src/core/public';
import {
getLogSourceConfigurationPath,
patchLogSourceConfigurationSuccessResponsePayloadRT,
@@ -16,7 +16,7 @@ import { decodeOrThrow } from '../../../../../common/runtime_types';
export const callPatchLogSourceConfigurationAPI = async (
sourceId: string,
patchedProperties: LogSourceConfigurationPropertiesPatch,
- fetch: HttpSetup['fetch']
+ fetch: HttpHandler
) => {
const response = await fetch(getLogSourceConfigurationPath(sourceId), {
method: 'PATCH',
diff --git a/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts b/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts
index 51b32a4c4eacf..e2dd4c523c03f 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_source/log_source.ts
@@ -7,7 +7,7 @@
import createContainer from 'constate';
import { useCallback, useMemo, useState } from 'react';
import { useMountedState } from 'react-use';
-import { HttpSetup } from 'src/core/public';
+import type { HttpHandler } from 'src/core/public';
import {
LogSourceConfiguration,
LogSourceConfigurationProperties,
@@ -26,13 +26,7 @@ export {
LogSourceStatus,
};
-export const useLogSource = ({
- sourceId,
- fetch,
-}: {
- sourceId: string;
- fetch: HttpSetup['fetch'];
-}) => {
+export const useLogSource = ({ sourceId, fetch }: { sourceId: string; fetch: HttpHandler }) => {
const getIsMounted = useMountedState();
const [sourceConfiguration, setSourceConfiguration] = useState<
LogSourceConfiguration | undefined
diff --git a/x-pack/plugins/infra/public/containers/logs/log_stream/index.ts b/x-pack/plugins/infra/public/containers/logs/log_stream/index.ts
index b414408512db2..4a6da6063e960 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_stream/index.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_stream/index.ts
@@ -9,6 +9,7 @@ import { esKuery } from '../../../../../../../src/plugins/data/public';
import { fetchLogEntries } from '../log_entries/api/fetch_log_entries';
import { useTrackedPromise } from '../../../utils/use_tracked_promise';
import { LogEntry, LogEntriesCursor } from '../../../../common/http_api';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
interface LogStreamProps {
sourceId: string;
@@ -31,6 +32,7 @@ export function useLogStream({
query,
center,
}: LogStreamProps): LogStreamState {
+ const { services } = useKibanaContextForPlugin();
const [entries, setEntries] = useState([]);
const parsedQuery = useMemo(() => {
@@ -47,13 +49,16 @@ export function useLogStream({
setEntries([]);
const fetchPosition = center ? { center } : { before: 'last' };
- return fetchLogEntries({
- sourceId,
- startTimestamp,
- endTimestamp,
- query: parsedQuery,
- ...fetchPosition,
- });
+ return fetchLogEntries(
+ {
+ sourceId,
+ startTimestamp,
+ endTimestamp,
+ query: parsedQuery,
+ ...fetchPosition,
+ },
+ services.http.fetch
+ );
},
onResolve: ({ data }) => {
setEntries(data.entries);
diff --git a/x-pack/plugins/infra/public/containers/logs/log_summary/api/fetch_log_summary.ts b/x-pack/plugins/infra/public/containers/logs/log_summary/api/fetch_log_summary.ts
index f74f0dc0e3117..2be6538e21ebe 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_summary/api/fetch_log_summary.ts
+++ b/x-pack/plugins/infra/public/containers/logs/log_summary/api/fetch_log_summary.ts
@@ -4,11 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
-import { throwErrors, createPlainError } from '../../../../../common/runtime_types';
+import type { HttpHandler } from 'src/core/public';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
import {
LOG_ENTRIES_SUMMARY_PATH,
@@ -17,14 +14,14 @@ import {
logEntriesSummaryResponseRT,
} from '../../../../../common/http_api';
-export const fetchLogSummary = async (requestArgs: LogEntriesSummaryRequest) => {
- const response = await npStart.http.fetch(LOG_ENTRIES_SUMMARY_PATH, {
+export const fetchLogSummary = async (
+ requestArgs: LogEntriesSummaryRequest,
+ fetch: HttpHandler
+) => {
+ const response = await fetch(LOG_ENTRIES_SUMMARY_PATH, {
method: 'POST',
body: JSON.stringify(logEntriesSummaryRequestRT.encode(requestArgs)),
});
- return pipe(
- logEntriesSummaryResponseRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(logEntriesSummaryResponseRT)(response);
};
diff --git a/x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.test.tsx b/x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.test.tsx
index 73d0e5efdf06b..652ea8c71dc44 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.test.tsx
+++ b/x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.test.tsx
@@ -5,6 +5,8 @@
*/
import { renderHook } from '@testing-library/react-hooks';
+// We are using this inside a `jest.mock` call. Jest requires dynamic dependencies to be prefixed with `mock`
+import { coreMock as mockCoreMock } from 'src/core/public/mocks';
import { useLogSummary } from './log_summary';
@@ -16,6 +18,10 @@ import { datemathToEpochMillis } from '../../../utils/datemath';
jest.mock('./api/fetch_log_summary', () => ({ fetchLogSummary: jest.fn() }));
const fetchLogSummaryMock = fetchLogSummary as jest.MockedFunction;
+jest.mock('../../../hooks/use_kibana', () => ({
+ useKibanaContextForPlugin: () => ({ services: mockCoreMock.createStart() }),
+}));
+
describe('useLogSummary hook', () => {
beforeEach(() => {
fetchLogSummaryMock.mockClear();
@@ -53,7 +59,8 @@ describe('useLogSummary hook', () => {
expect(fetchLogSummaryMock).toHaveBeenLastCalledWith(
expect.objectContaining({
sourceId: 'INITIAL_SOURCE_ID',
- })
+ }),
+ expect.anything()
);
expect(result.current.buckets).toEqual(firstMockResponse.data.buckets);
@@ -64,7 +71,8 @@ describe('useLogSummary hook', () => {
expect(fetchLogSummaryMock).toHaveBeenLastCalledWith(
expect.objectContaining({
sourceId: 'CHANGED_SOURCE_ID',
- })
+ }),
+ expect.anything()
);
expect(result.current.buckets).toEqual(secondMockResponse.data.buckets);
});
@@ -96,7 +104,8 @@ describe('useLogSummary hook', () => {
expect(fetchLogSummaryMock).toHaveBeenLastCalledWith(
expect.objectContaining({
query: 'INITIAL_FILTER_QUERY',
- })
+ }),
+ expect.anything()
);
expect(result.current.buckets).toEqual(firstMockResponse.data.buckets);
@@ -107,7 +116,8 @@ describe('useLogSummary hook', () => {
expect(fetchLogSummaryMock).toHaveBeenLastCalledWith(
expect.objectContaining({
query: 'CHANGED_FILTER_QUERY',
- })
+ }),
+ expect.anything()
);
expect(result.current.buckets).toEqual(secondMockResponse.data.buckets);
});
@@ -132,7 +142,8 @@ describe('useLogSummary hook', () => {
expect.objectContaining({
startTimestamp: firstRange.startTimestamp,
endTimestamp: firstRange.endTimestamp,
- })
+ }),
+ expect.anything()
);
const secondRange = createMockDateRange('now-20s', 'now');
@@ -145,7 +156,8 @@ describe('useLogSummary hook', () => {
expect.objectContaining({
startTimestamp: secondRange.startTimestamp,
endTimestamp: secondRange.endTimestamp,
- })
+ }),
+ expect.anything()
);
});
});
diff --git a/x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.tsx b/x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.tsx
index b83be77656863..be0d87f5d267d 100644
--- a/x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.tsx
+++ b/x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.tsx
@@ -10,6 +10,7 @@ import { useCancellableEffect } from '../../../utils/cancellable_effect';
import { fetchLogSummary } from './api/fetch_log_summary';
import { LogEntriesSummaryResponse } from '../../../../common/http_api';
import { useBucketSize } from './bucket_size';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
export type LogSummaryBuckets = LogEntriesSummaryResponse['data']['buckets'];
@@ -19,6 +20,7 @@ export const useLogSummary = (
endTimestamp: number | null,
filterQuery: string | null
) => {
+ const { services } = useKibanaContextForPlugin();
const [logSummaryBuckets, setLogSummaryBuckets] = useState([]);
const bucketSize = useBucketSize(startTimestamp, endTimestamp);
@@ -28,13 +30,16 @@ export const useLogSummary = (
return;
}
- fetchLogSummary({
- sourceId,
- startTimestamp,
- endTimestamp,
- bucketSize,
- query: filterQuery,
- }).then((response) => {
+ fetchLogSummary(
+ {
+ sourceId,
+ startTimestamp,
+ endTimestamp,
+ bucketSize,
+ query: filterQuery,
+ },
+ services.http.fetch
+ ).then((response) => {
if (!getIsCancelled()) {
setLogSummaryBuckets(response.data.buckets);
}
diff --git a/x-pack/plugins/infra/public/containers/ml/api/ml_cleanup.ts b/x-pack/plugins/infra/public/containers/ml/api/ml_cleanup.ts
index 23fa338e74f14..fa7d8f14c6a9a 100644
--- a/x-pack/plugins/infra/public/containers/ml/api/ml_cleanup.ts
+++ b/x-pack/plugins/infra/public/containers/ml/api/ml_cleanup.ts
@@ -5,21 +5,24 @@
*/
import * as rt from 'io-ts';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { fold } from 'fp-ts/lib/Either';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../legacy_singletons';
-
+import type { HttpHandler } from 'src/core/public';
import { getDatafeedId, getJobId } from '../../../../common/infra_ml';
-import { throwErrors, createPlainError } from '../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../common/runtime_types';
+
+interface DeleteJobsRequestArgs {
+ spaceId: string;
+ sourceId: string;
+ jobTypes: JobType[];
+}
export const callDeleteJobs = async (
- spaceId: string,
- sourceId: string,
- jobTypes: JobType[]
+ requestArgs: DeleteJobsRequestArgs,
+ fetch: HttpHandler
) => {
+ const { spaceId, sourceId, jobTypes } = requestArgs;
+
// NOTE: Deleting the jobs via this API will delete the datafeeds at the same time
- const deleteJobsResponse = await npStart.http.fetch('/api/ml/jobs/delete_jobs', {
+ const deleteJobsResponse = await fetch('/api/ml/jobs/delete_jobs', {
method: 'POST',
body: JSON.stringify(
deleteJobsRequestPayloadRT.encode({
@@ -28,28 +31,29 @@ export const callDeleteJobs = async (
),
});
- return pipe(
- deleteJobsResponsePayloadRT.decode(deleteJobsResponse),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(deleteJobsResponsePayloadRT)(deleteJobsResponse);
};
-export const callGetJobDeletionTasks = async () => {
- const jobDeletionTasksResponse = await npStart.http.fetch('/api/ml/jobs/deleting_jobs_tasks');
+export const callGetJobDeletionTasks = async (fetch: HttpHandler) => {
+ const jobDeletionTasksResponse = await fetch('/api/ml/jobs/deleting_jobs_tasks');
- return pipe(
- getJobDeletionTasksResponsePayloadRT.decode(jobDeletionTasksResponse),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(getJobDeletionTasksResponsePayloadRT)(jobDeletionTasksResponse);
};
+interface StopDatafeedsRequestArgs {
+ spaceId: string;
+ sourceId: string;
+ jobTypes: JobType[];
+}
+
export const callStopDatafeeds = async (
- spaceId: string,
- sourceId: string,
- jobTypes: JobType[]
+ requestArgs: StopDatafeedsRequestArgs,
+ fetch: HttpHandler
) => {
+ const { spaceId, sourceId, jobTypes } = requestArgs;
+
// Stop datafeed due to https://github.com/elastic/kibana/issues/44652
- const stopDatafeedResponse = await npStart.http.fetch('/api/ml/jobs/stop_datafeeds', {
+ const stopDatafeedResponse = await fetch('/api/ml/jobs/stop_datafeeds', {
method: 'POST',
body: JSON.stringify(
stopDatafeedsRequestPayloadRT.encode({
@@ -58,10 +62,7 @@ export const callStopDatafeeds = async (
),
});
- return pipe(
- stopDatafeedsResponsePayloadRT.decode(stopDatafeedResponse),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(stopDatafeedsResponsePayloadRT)(stopDatafeedResponse);
};
export const deleteJobsRequestPayloadRT = rt.type({
diff --git a/x-pack/plugins/infra/public/containers/ml/api/ml_get_jobs_summary_api.ts b/x-pack/plugins/infra/public/containers/ml/api/ml_get_jobs_summary_api.ts
index 3fddb63f69791..84b5df3d172c7 100644
--- a/x-pack/plugins/infra/public/containers/ml/api/ml_get_jobs_summary_api.ts
+++ b/x-pack/plugins/infra/public/containers/ml/api/ml_get_jobs_summary_api.ts
@@ -4,21 +4,24 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { identity } from 'fp-ts/lib/function';
-import { pipe } from 'fp-ts/lib/pipeable';
import * as rt from 'io-ts';
-import { npStart } from '../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import { getJobId, jobCustomSettingsRT } from '../../../../common/infra_ml';
-import { createPlainError, throwErrors } from '../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../common/runtime_types';
+
+interface RequestArgs {
+ spaceId: string;
+ sourceId: string;
+ jobTypes: JobType[];
+}
export const callJobsSummaryAPI = async (
- spaceId: string,
- sourceId: string,
- jobTypes: JobType[]
+ requestArgs: RequestArgs,
+ fetch: HttpHandler
) => {
- const response = await npStart.http.fetch('/api/ml/jobs/jobs_summary', {
+ const { spaceId, sourceId, jobTypes } = requestArgs;
+ const response = await fetch('/api/ml/jobs/jobs_summary', {
method: 'POST',
body: JSON.stringify(
fetchJobStatusRequestPayloadRT.encode({
@@ -26,10 +29,7 @@ export const callJobsSummaryAPI = async (
})
),
});
- return pipe(
- fetchJobStatusResponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(fetchJobStatusResponsePayloadRT)(response);
};
export const fetchJobStatusRequestPayloadRT = rt.type({
diff --git a/x-pack/plugins/infra/public/containers/ml/api/ml_get_module.ts b/x-pack/plugins/infra/public/containers/ml/api/ml_get_module.ts
index d492522c120a1..75ce335fbe49c 100644
--- a/x-pack/plugins/infra/public/containers/ml/api/ml_get_module.ts
+++ b/x-pack/plugins/infra/public/containers/ml/api/ml_get_module.ts
@@ -4,24 +4,18 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { identity } from 'fp-ts/lib/function';
-import { pipe } from 'fp-ts/lib/pipeable';
import * as rt from 'io-ts';
-import { npStart } from '../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import { jobCustomSettingsRT } from '../../../../common/log_analysis';
-import { createPlainError, throwErrors } from '../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../common/runtime_types';
-export const callGetMlModuleAPI = async (moduleId: string) => {
- const response = await npStart.http.fetch(`/api/ml/modules/get_module/${moduleId}`, {
+export const callGetMlModuleAPI = async (moduleId: string, fetch: HttpHandler) => {
+ const response = await fetch(`/api/ml/modules/get_module/${moduleId}`, {
method: 'GET',
});
- return pipe(
- getMlModuleResponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(getMlModuleResponsePayloadRT)(response);
};
const jobDefinitionRT = rt.type({
diff --git a/x-pack/plugins/infra/public/containers/ml/api/ml_setup_module_api.ts b/x-pack/plugins/infra/public/containers/ml/api/ml_setup_module_api.ts
index 06b0e075387b0..36dced1bd2680 100644
--- a/x-pack/plugins/infra/public/containers/ml/api/ml_setup_module_api.ts
+++ b/x-pack/plugins/infra/public/containers/ml/api/ml_setup_module_api.ts
@@ -4,27 +4,38 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { identity } from 'fp-ts/lib/function';
-import { pipe } from 'fp-ts/lib/pipeable';
import * as rt from 'io-ts';
-import { npStart } from '../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import { getJobIdPrefix, jobCustomSettingsRT } from '../../../../common/infra_ml';
-import { createPlainError, throwErrors } from '../../../../common/runtime_types';
-
-export const callSetupMlModuleAPI = async (
- moduleId: string,
- start: number | undefined,
- end: number | undefined,
- spaceId: string,
- sourceId: string,
- indexPattern: string,
- jobOverrides: SetupMlModuleJobOverrides[] = [],
- datafeedOverrides: SetupMlModuleDatafeedOverrides[] = [],
- query?: object
-) => {
- const response = await npStart.http.fetch(`/api/ml/modules/setup/${moduleId}`, {
+import { decodeOrThrow } from '../../../../common/runtime_types';
+
+interface RequestArgs {
+ moduleId: string;
+ start?: number;
+ end?: number;
+ spaceId: string;
+ sourceId: string;
+ indexPattern: string;
+ jobOverrides?: SetupMlModuleJobOverrides[];
+ datafeedOverrides?: SetupMlModuleDatafeedOverrides[];
+ query?: object;
+}
+
+export const callSetupMlModuleAPI = async (requestArgs: RequestArgs, fetch: HttpHandler) => {
+ const {
+ moduleId,
+ start,
+ end,
+ spaceId,
+ sourceId,
+ indexPattern,
+ jobOverrides = [],
+ datafeedOverrides = [],
+ query,
+ } = requestArgs;
+
+ const response = await fetch(`/api/ml/modules/setup/${moduleId}`, {
method: 'POST',
body: JSON.stringify(
setupMlModuleRequestPayloadRT.encode({
@@ -40,10 +51,7 @@ export const callSetupMlModuleAPI = async (
),
});
- return pipe(
- setupMlModuleResponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(setupMlModuleResponsePayloadRT)(response);
};
const setupMlModuleTimeParamsRT = rt.partial({
diff --git a/x-pack/plugins/infra/public/containers/ml/infra_ml_capabilities.tsx b/x-pack/plugins/infra/public/containers/ml/infra_ml_capabilities.tsx
index f4c90a459af6a..bc488a51e2aff 100644
--- a/x-pack/plugins/infra/public/containers/ml/infra_ml_capabilities.tsx
+++ b/x-pack/plugins/infra/public/containers/ml/infra_ml_capabilities.tsx
@@ -10,14 +10,15 @@ import { fold } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';
import { identity } from 'fp-ts/lib/function';
import { useTrackedPromise } from '../../utils/use_tracked_promise';
-import { npStart } from '../../legacy_singletons';
import {
getMlCapabilitiesResponsePayloadRT,
GetMlCapabilitiesResponsePayload,
} from './api/ml_api_types';
import { throwErrors, createPlainError } from '../../../common/runtime_types';
+import { useKibanaContextForPlugin } from '../../hooks/use_kibana';
export const useInfraMLCapabilities = () => {
+ const { services } = useKibanaContextForPlugin();
const [mlCapabilities, setMlCapabilities] = useState(
initialMlCapabilities
);
@@ -26,7 +27,7 @@ export const useInfraMLCapabilities = () => {
{
cancelPreviousOn: 'resolution',
createPromise: async () => {
- const rawResponse = await npStart.http.fetch('/api/ml/ml_capabilities');
+ const rawResponse = await services.http.fetch('/api/ml/ml_capabilities');
return pipe(
getMlCapabilitiesResponsePayloadRT.decode(rawResponse),
diff --git a/x-pack/plugins/infra/public/containers/ml/infra_ml_cleanup.tsx b/x-pack/plugins/infra/public/containers/ml/infra_ml_cleanup.tsx
index 736982c8043b1..871e61ecfe507 100644
--- a/x-pack/plugins/infra/public/containers/ml/infra_ml_cleanup.tsx
+++ b/x-pack/plugins/infra/public/containers/ml/infra_ml_cleanup.tsx
@@ -4,16 +4,18 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import { HttpHandler } from 'src/core/public';
import { getJobId } from '../../../common/infra_ml';
import { callDeleteJobs, callGetJobDeletionTasks, callStopDatafeeds } from './api/ml_cleanup';
export const cleanUpJobsAndDatafeeds = async (
spaceId: string,
sourceId: string,
- jobTypes: JobType[]
+ jobTypes: JobType[],
+ fetch: HttpHandler
) => {
try {
- await callStopDatafeeds(spaceId, sourceId, jobTypes);
+ await callStopDatafeeds({ spaceId, sourceId, jobTypes }, fetch);
} catch (err) {
// Proceed only if datafeed has been deleted or didn't exist in the first place
if (err?.res?.status !== 404) {
@@ -21,27 +23,29 @@ export const cleanUpJobsAndDatafeeds = async (
}
}
- return await deleteJobs(spaceId, sourceId, jobTypes);
+ return await deleteJobs(spaceId, sourceId, jobTypes, fetch);
};
const deleteJobs = async (
spaceId: string,
sourceId: string,
- jobTypes: JobType[]
+ jobTypes: JobType[],
+ fetch: HttpHandler
) => {
- const deleteJobsResponse = await callDeleteJobs(spaceId, sourceId, jobTypes);
- await waitUntilJobsAreDeleted(spaceId, sourceId, jobTypes);
+ const deleteJobsResponse = await callDeleteJobs({ spaceId, sourceId, jobTypes }, fetch);
+ await waitUntilJobsAreDeleted(spaceId, sourceId, jobTypes, fetch);
return deleteJobsResponse;
};
const waitUntilJobsAreDeleted = async (
spaceId: string,
sourceId: string,
- jobTypes: JobType[]
+ jobTypes: JobType[],
+ fetch: HttpHandler
) => {
const moduleJobIds = jobTypes.map((jobType) => getJobId(spaceId, sourceId, jobType));
while (true) {
- const { jobIds: jobIdsBeingDeleted } = await callGetJobDeletionTasks();
+ const { jobIds: jobIdsBeingDeleted } = await callGetJobDeletionTasks(fetch);
const needToWait = jobIdsBeingDeleted.some((jobId) => moduleJobIds.includes(jobId));
if (needToWait) {
diff --git a/x-pack/plugins/infra/public/containers/ml/infra_ml_module.tsx b/x-pack/plugins/infra/public/containers/ml/infra_ml_module.tsx
index 349541d108f5e..5408084a5246e 100644
--- a/x-pack/plugins/infra/public/containers/ml/infra_ml_module.tsx
+++ b/x-pack/plugins/infra/public/containers/ml/infra_ml_module.tsx
@@ -6,6 +6,7 @@
import { useCallback, useMemo } from 'react';
import { DatasetFilter } from '../../../common/infra_ml';
+import { useKibanaContextForPlugin } from '../../hooks/use_kibana';
import { useTrackedPromise } from '../../utils/use_tracked_promise';
import { useModuleStatus } from './infra_ml_module_status';
import { ModuleDescriptor, ModuleSourceConfiguration } from './infra_ml_module_types';
@@ -17,6 +18,7 @@ export const useInfraMLModule = ({
sourceConfiguration: ModuleSourceConfiguration;
moduleDescriptor: ModuleDescriptor;
}) => {
+ const { services } = useKibanaContextForPlugin();
const { spaceId, sourceId, timestampField } = sourceConfiguration;
const [moduleStatus, dispatchModuleStatus] = useModuleStatus(moduleDescriptor.jobTypes);
@@ -25,7 +27,7 @@ export const useInfraMLModule = ({
cancelPreviousOn: 'resolution',
createPromise: async () => {
dispatchModuleStatus({ type: 'fetchingJobStatuses' });
- return await moduleDescriptor.getJobSummary(spaceId, sourceId);
+ return await moduleDescriptor.getJobSummary(spaceId, sourceId, services.http.fetch);
},
onResolve: (jobResponse) => {
dispatchModuleStatus({
@@ -54,18 +56,25 @@ export const useInfraMLModule = ({
) => {
dispatchModuleStatus({ type: 'startedSetup' });
const setupResult = await moduleDescriptor.setUpModule(
- start,
- end,
- datasetFilter,
{
- indices: selectedIndices,
- sourceId,
- spaceId,
- timestampField,
+ start,
+ end,
+ datasetFilter,
+ moduleSourceConfiguration: {
+ indices: selectedIndices,
+ sourceId,
+ spaceId,
+ timestampField,
+ },
+ partitionField,
},
- partitionField
+ services.http.fetch
+ );
+ const jobSummaries = await moduleDescriptor.getJobSummary(
+ spaceId,
+ sourceId,
+ services.http.fetch
);
- const jobSummaries = await moduleDescriptor.getJobSummary(spaceId, sourceId);
return { setupResult, jobSummaries };
},
onResolve: ({ setupResult: { datafeeds, jobs }, jobSummaries }) => {
@@ -89,7 +98,7 @@ export const useInfraMLModule = ({
{
cancelPreviousOn: 'resolution',
createPromise: async () => {
- return await moduleDescriptor.cleanUpModule(spaceId, sourceId);
+ return await moduleDescriptor.cleanUpModule(spaceId, sourceId, services.http.fetch);
},
},
[spaceId, sourceId]
diff --git a/x-pack/plugins/infra/public/containers/ml/infra_ml_module_definition.tsx b/x-pack/plugins/infra/public/containers/ml/infra_ml_module_definition.tsx
index 3c7ffcfd4a4e2..a747a2853d1f7 100644
--- a/x-pack/plugins/infra/public/containers/ml/infra_ml_module_definition.tsx
+++ b/x-pack/plugins/infra/public/containers/ml/infra_ml_module_definition.tsx
@@ -6,6 +6,7 @@
import { useCallback, useMemo, useState } from 'react';
import { getJobId } from '../../../common/log_analysis';
+import { useKibanaContextForPlugin } from '../../hooks/use_kibana';
import { useTrackedPromise } from '../../utils/use_tracked_promise';
import { JobSummary } from './api/ml_get_jobs_summary_api';
import { GetMlModuleResponsePayload, JobDefinition } from './api/ml_get_module';
@@ -18,6 +19,7 @@ export const useInfraMLModuleDefinition = ({
sourceConfiguration: ModuleSourceConfiguration;
moduleDescriptor: ModuleDescriptor;
}) => {
+ const { services } = useKibanaContextForPlugin();
const [moduleDefinition, setModuleDefinition] = useState<
GetMlModuleResponsePayload | undefined
>();
@@ -40,7 +42,7 @@ export const useInfraMLModuleDefinition = ({
{
cancelPreviousOn: 'resolution',
createPromise: async () => {
- return await moduleDescriptor.getModuleDefinition();
+ return await moduleDescriptor.getModuleDefinition(services.http.fetch);
},
onResolve: (response) => {
setModuleDefinition(response);
diff --git a/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts b/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts
index e36f38add641a..976a64e8034bc 100644
--- a/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts
+++ b/x-pack/plugins/infra/public/containers/ml/infra_ml_module_types.ts
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-
+import { HttpHandler } from 'src/core/public';
import {
ValidateLogEntryDatasetsResponsePayload,
ValidationIndicesResponsePayload,
@@ -16,6 +16,14 @@ import { SetupMlModuleResponsePayload } from './api/ml_setup_module_api';
export { JobModelSizeStats, JobSummary } from './api/ml_get_jobs_summary_api';
+export interface SetUpModuleArgs {
+ start?: number | undefined;
+ end?: number | undefined;
+ datasetFilter?: DatasetFilter;
+ moduleSourceConfiguration: ModuleSourceConfiguration;
+ partitionField?: string;
+}
+
export interface ModuleDescriptor {
moduleId: string;
moduleName: string;
@@ -23,25 +31,32 @@ export interface ModuleDescriptor {
jobTypes: JobType[];
bucketSpan: number;
getJobIds: (spaceId: string, sourceId: string) => Record;
- getJobSummary: (spaceId: string, sourceId: string) => Promise;
- getModuleDefinition: () => Promise;
+ getJobSummary: (
+ spaceId: string,
+ sourceId: string,
+ fetch: HttpHandler
+ ) => Promise;
+ getModuleDefinition: (fetch: HttpHandler) => Promise;
setUpModule: (
- start: number | undefined,
- end: number | undefined,
- datasetFilter: DatasetFilter,
- sourceConfiguration: ModuleSourceConfiguration,
- partitionField?: string
+ setUpModuleArgs: SetUpModuleArgs,
+ fetch: HttpHandler
) => Promise;
- cleanUpModule: (spaceId: string, sourceId: string) => Promise;
+ cleanUpModule: (
+ spaceId: string,
+ sourceId: string,
+ fetch: HttpHandler
+ ) => Promise;
validateSetupIndices?: (
indices: string[],
- timestampField: string
+ timestampField: string,
+ fetch: HttpHandler
) => Promise;
validateSetupDatasets?: (
indices: string[],
timestampField: string,
startTime: number,
- endTime: number
+ endTime: number,
+ fetch: HttpHandler
) => Promise;
}
diff --git a/x-pack/plugins/infra/public/containers/ml/modules/metrics_hosts/module_descriptor.ts b/x-pack/plugins/infra/public/containers/ml/modules/metrics_hosts/module_descriptor.ts
index 7ea87c3d21322..47230cbed977f 100644
--- a/x-pack/plugins/infra/public/containers/ml/modules/metrics_hosts/module_descriptor.ts
+++ b/x-pack/plugins/infra/public/containers/ml/modules/metrics_hosts/module_descriptor.ts
@@ -5,7 +5,8 @@
*/
import { i18n } from '@kbn/i18n';
-import { ModuleDescriptor, ModuleSourceConfiguration } from '../../infra_ml_module_types';
+import { HttpHandler } from 'src/core/public';
+import { ModuleDescriptor, SetUpModuleArgs } from '../../infra_ml_module_types';
import { cleanUpJobsAndDatafeeds } from '../../infra_ml_cleanup';
import { callJobsSummaryAPI } from '../../api/ml_get_jobs_summary_api';
import { callGetMlModuleAPI } from '../../api/ml_get_module';
@@ -14,7 +15,6 @@ import {
metricsHostsJobTypes,
getJobId,
MetricsHostsJobType,
- DatasetFilter,
bucketSpan,
} from '../../../../../common/infra_ml';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
@@ -48,24 +48,28 @@ const getJobIds = (spaceId: string, sourceId: string) =>
{} as Record
);
-const getJobSummary = async (spaceId: string, sourceId: string) => {
- const response = await callJobsSummaryAPI(spaceId, sourceId, metricsHostsJobTypes);
+const getJobSummary = async (spaceId: string, sourceId: string, fetch: HttpHandler) => {
+ const response = await callJobsSummaryAPI(
+ { spaceId, sourceId, jobTypes: metricsHostsJobTypes },
+ fetch
+ );
const jobIds = Object.values(getJobIds(spaceId, sourceId));
return response.filter((jobSummary) => jobIds.includes(jobSummary.id));
};
-const getModuleDefinition = async () => {
- return await callGetMlModuleAPI(moduleId);
+const getModuleDefinition = async (fetch: HttpHandler) => {
+ return await callGetMlModuleAPI(moduleId, fetch);
};
-const setUpModule = async (
- start: number | undefined,
- end: number | undefined,
- datasetFilter: DatasetFilter,
- { spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration,
- partitionField?: string
-) => {
+const setUpModule = async (setUpModuleArgs: SetUpModuleArgs, fetch: HttpHandler) => {
+ const {
+ start,
+ end,
+ moduleSourceConfiguration: { spaceId, sourceId, indices, timestampField },
+ partitionField,
+ } = setUpModuleArgs;
+
const indexNamePattern = indices.join(',');
const jobIds: JobType[] = ['hosts_memory_usage', 'hosts_network_in', 'hosts_network_out'];
@@ -128,14 +132,17 @@ const setUpModule = async (
});
return callSetupMlModuleAPI(
- moduleId,
- start,
- end,
- spaceId,
- sourceId,
- indexNamePattern,
- jobOverrides,
- datafeedOverrides
+ {
+ moduleId,
+ start,
+ end,
+ spaceId,
+ sourceId,
+ indexPattern: indexNamePattern,
+ jobOverrides,
+ datafeedOverrides,
+ },
+ fetch
);
};
@@ -159,8 +166,8 @@ const getDefaultJobConfigs = (jobId: JobType): { datafeed: any; job: any } => {
}
};
-const cleanUpModule = async (spaceId: string, sourceId: string) => {
- return await cleanUpJobsAndDatafeeds(spaceId, sourceId, metricsHostsJobTypes);
+const cleanUpModule = async (spaceId: string, sourceId: string, fetch: HttpHandler) => {
+ return await cleanUpJobsAndDatafeeds(spaceId, sourceId, metricsHostsJobTypes, fetch);
};
export const metricHostsModule: ModuleDescriptor = {
diff --git a/x-pack/plugins/infra/public/containers/ml/modules/metrics_k8s/module_descriptor.ts b/x-pack/plugins/infra/public/containers/ml/modules/metrics_k8s/module_descriptor.ts
index eaf7489c84eb4..488803dc113b0 100644
--- a/x-pack/plugins/infra/public/containers/ml/modules/metrics_k8s/module_descriptor.ts
+++ b/x-pack/plugins/infra/public/containers/ml/modules/metrics_k8s/module_descriptor.ts
@@ -5,7 +5,8 @@
*/
import { i18n } from '@kbn/i18n';
-import { ModuleDescriptor, ModuleSourceConfiguration } from '../../infra_ml_module_types';
+import { HttpHandler } from 'src/core/public';
+import { ModuleDescriptor, SetUpModuleArgs } from '../../infra_ml_module_types';
import { cleanUpJobsAndDatafeeds } from '../../infra_ml_cleanup';
import { callJobsSummaryAPI } from '../../api/ml_get_jobs_summary_api';
import { callGetMlModuleAPI } from '../../api/ml_get_module';
@@ -14,7 +15,6 @@ import {
metricsK8SJobTypes,
getJobId,
MetricK8sJobType,
- DatasetFilter,
bucketSpan,
} from '../../../../../common/infra_ml';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
@@ -49,24 +49,28 @@ const getJobIds = (spaceId: string, sourceId: string) =>
{} as Record
);
-const getJobSummary = async (spaceId: string, sourceId: string) => {
- const response = await callJobsSummaryAPI(spaceId, sourceId, metricsK8SJobTypes);
+const getJobSummary = async (spaceId: string, sourceId: string, fetch: HttpHandler) => {
+ const response = await callJobsSummaryAPI(
+ { spaceId, sourceId, jobTypes: metricsK8SJobTypes },
+ fetch
+ );
const jobIds = Object.values(getJobIds(spaceId, sourceId));
return response.filter((jobSummary) => jobIds.includes(jobSummary.id));
};
-const getModuleDefinition = async () => {
- return await callGetMlModuleAPI(moduleId);
+const getModuleDefinition = async (fetch: HttpHandler) => {
+ return await callGetMlModuleAPI(moduleId, fetch);
};
-const setUpModule = async (
- start: number | undefined,
- end: number | undefined,
- datasetFilter: DatasetFilter,
- { spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration,
- partitionField?: string
-) => {
+const setUpModule = async (setUpModuleArgs: SetUpModuleArgs, fetch: HttpHandler) => {
+ const {
+ start,
+ end,
+ moduleSourceConfiguration: { spaceId, sourceId, indices, timestampField },
+ partitionField,
+ } = setUpModuleArgs;
+
const indexNamePattern = indices.join(',');
const jobIds: JobType[] = ['k8s_memory_usage', 'k8s_network_in', 'k8s_network_out'];
const jobOverrides = jobIds.map((id) => {
@@ -133,14 +137,17 @@ const setUpModule = async (
});
return callSetupMlModuleAPI(
- moduleId,
- start,
- end,
- spaceId,
- sourceId,
- indexNamePattern,
- jobOverrides,
- datafeedOverrides
+ {
+ moduleId,
+ start,
+ end,
+ spaceId,
+ sourceId,
+ indexPattern: indexNamePattern,
+ jobOverrides,
+ datafeedOverrides,
+ },
+ fetch
);
};
@@ -164,8 +171,8 @@ const getDefaultJobConfigs = (jobId: JobType): { datafeed: any; job: any } => {
}
};
-const cleanUpModule = async (spaceId: string, sourceId: string) => {
- return await cleanUpJobsAndDatafeeds(spaceId, sourceId, metricsK8SJobTypes);
+const cleanUpModule = async (spaceId: string, sourceId: string, fetch: HttpHandler) => {
+ return await cleanUpJobsAndDatafeeds(spaceId, sourceId, metricsK8SJobTypes, fetch);
};
export const metricHostsModule: ModuleDescriptor = {
diff --git a/x-pack/plugins/infra/public/legacy_singletons.ts b/x-pack/plugins/infra/public/legacy_singletons.ts
deleted file mode 100644
index f57047f21c281..0000000000000
--- a/x-pack/plugins/infra/public/legacy_singletons.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-import { CoreStart } from 'kibana/public';
-
-let npStart: CoreStart;
-
-export function registerStartSingleton(start: CoreStart) {
- npStart = start;
-}
-
-export { npStart };
diff --git a/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx b/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx
index 945b299674aaa..4f83e37d7e029 100644
--- a/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx
+++ b/x-pack/plugins/infra/public/pages/link_to/link_to_logs.test.tsx
@@ -14,7 +14,6 @@ import { createMemoryHistory } from 'history';
import React from 'react';
import { Route, Router, Switch } from 'react-router-dom';
import { httpServiceMock } from 'src/core/public/mocks';
-// import { HttpSetup } from 'src/core/public';
import { KibanaContextProvider } from 'src/plugins/kibana_react/public';
import { useLogSource } from '../../containers/logs/log_source';
import {
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_datasets.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_datasets.ts
index a8cd7854efb6b..5f34d45635b60 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_datasets.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_datasets.ts
@@ -4,24 +4,28 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import {
getLogEntryCategoryDatasetsRequestPayloadRT,
getLogEntryCategoryDatasetsSuccessReponsePayloadRT,
LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORY_DATASETS_PATH,
} from '../../../../../common/http_api/log_analysis';
-import { createPlainError, throwErrors } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
+
+interface RequestArgs {
+ sourceId: string;
+ startTime: number;
+ endTime: number;
+}
export const callGetLogEntryCategoryDatasetsAPI = async (
- sourceId: string,
- startTime: number,
- endTime: number
+ requestArgs: RequestArgs,
+ fetch: HttpHandler
) => {
- const response = await npStart.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORY_DATASETS_PATH, {
+ const { sourceId, startTime, endTime } = requestArgs;
+
+ const response = await fetch(LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORY_DATASETS_PATH, {
method: 'POST',
body: JSON.stringify(
getLogEntryCategoryDatasetsRequestPayloadRT.encode({
@@ -36,8 +40,5 @@ export const callGetLogEntryCategoryDatasetsAPI = async (
),
});
- return pipe(
- getLogEntryCategoryDatasetsSuccessReponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(getLogEntryCategoryDatasetsSuccessReponsePayloadRT)(response);
};
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_examples.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_examples.ts
index a10d077a2dd4f..c4b756ebf5d58 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_examples.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_examples.ts
@@ -4,26 +4,30 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import {
getLogEntryCategoryExamplesRequestPayloadRT,
getLogEntryCategoryExamplesSuccessReponsePayloadRT,
LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORY_EXAMPLES_PATH,
} from '../../../../../common/http_api/log_analysis';
-import { createPlainError, throwErrors } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
+
+interface RequestArgs {
+ sourceId: string;
+ startTime: number;
+ endTime: number;
+ categoryId: number;
+ exampleCount: number;
+}
export const callGetLogEntryCategoryExamplesAPI = async (
- sourceId: string,
- startTime: number,
- endTime: number,
- categoryId: number,
- exampleCount: number
+ requestArgs: RequestArgs,
+ fetch: HttpHandler
) => {
- const response = await npStart.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORY_EXAMPLES_PATH, {
+ const { sourceId, startTime, endTime, categoryId, exampleCount } = requestArgs;
+
+ const response = await fetch(LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORY_EXAMPLES_PATH, {
method: 'POST',
body: JSON.stringify(
getLogEntryCategoryExamplesRequestPayloadRT.encode({
@@ -40,8 +44,5 @@ export const callGetLogEntryCategoryExamplesAPI = async (
),
});
- return pipe(
- getLogEntryCategoryExamplesSuccessReponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(getLogEntryCategoryExamplesSuccessReponsePayloadRT)(response);
};
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_top_log_entry_categories.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_top_log_entry_categories.ts
index 2ebcff4fd3ca5..fd53803796339 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_top_log_entry_categories.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_top_log_entry_categories.ts
@@ -4,28 +4,31 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import {
getLogEntryCategoriesRequestPayloadRT,
getLogEntryCategoriesSuccessReponsePayloadRT,
LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORIES_PATH,
} from '../../../../../common/http_api/log_analysis';
-import { createPlainError, throwErrors } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
+
+interface RequestArgs {
+ sourceId: string;
+ startTime: number;
+ endTime: number;
+ categoryCount: number;
+ datasets?: string[];
+}
export const callGetTopLogEntryCategoriesAPI = async (
- sourceId: string,
- startTime: number,
- endTime: number,
- categoryCount: number,
- datasets?: string[]
+ requestArgs: RequestArgs,
+ fetch: HttpHandler
) => {
+ const { sourceId, startTime, endTime, categoryCount, datasets } = requestArgs;
const intervalDuration = endTime - startTime;
- const response = await npStart.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORIES_PATH, {
+ const response = await fetch(LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORIES_PATH, {
method: 'POST',
body: JSON.stringify(
getLogEntryCategoriesRequestPayloadRT.encode({
@@ -60,8 +63,5 @@ export const callGetTopLogEntryCategoriesAPI = async (
),
});
- return pipe(
- getLogEntryCategoriesSuccessReponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(getLogEntryCategoriesSuccessReponsePayloadRT)(response);
};
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts
index 123b188046b85..0a12c433db60a 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts
@@ -13,6 +13,7 @@ import {
import { useTrackedPromise, CanceledPromiseError } from '../../../utils/use_tracked_promise';
import { callGetTopLogEntryCategoriesAPI } from './service_calls/get_top_log_entry_categories';
import { callGetLogEntryCategoryDatasetsAPI } from './service_calls/get_log_entry_category_datasets';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
type TopLogEntryCategories = GetLogEntryCategoriesSuccessResponsePayload['data']['categories'];
type LogEntryCategoryDatasets = GetLogEntryCategoryDatasetsSuccessResponsePayload['data']['datasets'];
@@ -34,6 +35,7 @@ export const useLogEntryCategoriesResults = ({
sourceId: string;
startTime: number;
}) => {
+ const { services } = useKibanaContextForPlugin();
const [topLogEntryCategories, setTopLogEntryCategories] = useState([]);
const [logEntryCategoryDatasets, setLogEntryCategoryDatasets] = useState<
LogEntryCategoryDatasets
@@ -44,11 +46,14 @@ export const useLogEntryCategoriesResults = ({
cancelPreviousOn: 'creation',
createPromise: async () => {
return await callGetTopLogEntryCategoriesAPI(
- sourceId,
- startTime,
- endTime,
- categoriesCount,
- filteredDatasets
+ {
+ sourceId,
+ startTime,
+ endTime,
+ categoryCount: categoriesCount,
+ datasets: filteredDatasets,
+ },
+ services.http.fetch
);
},
onResolve: ({ data: { categories } }) => {
@@ -71,7 +76,10 @@ export const useLogEntryCategoriesResults = ({
{
cancelPreviousOn: 'creation',
createPromise: async () => {
- return await callGetLogEntryCategoryDatasetsAPI(sourceId, startTime, endTime);
+ return await callGetLogEntryCategoryDatasetsAPI(
+ { sourceId, startTime, endTime },
+ services.http.fetch
+ );
},
onResolve: ({ data: { datasets } }) => {
setLogEntryCategoryDatasets(datasets);
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_category_examples.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_category_examples.tsx
index cdf3b642a8012..84b9f045288cc 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_category_examples.tsx
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_category_examples.tsx
@@ -7,6 +7,7 @@
import { useMemo, useState } from 'react';
import { LogEntryCategoryExample } from '../../../../common/http_api';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
import { useTrackedPromise } from '../../../utils/use_tracked_promise';
import { callGetLogEntryCategoryExamplesAPI } from './service_calls/get_log_entry_category_examples';
@@ -23,6 +24,8 @@ export const useLogEntryCategoryExamples = ({
sourceId: string;
startTime: number;
}) => {
+ const { services } = useKibanaContextForPlugin();
+
const [logEntryCategoryExamples, setLogEntryCategoryExamples] = useState<
LogEntryCategoryExample[]
>([]);
@@ -32,11 +35,14 @@ export const useLogEntryCategoryExamples = ({
cancelPreviousOn: 'creation',
createPromise: async () => {
return await callGetLogEntryCategoryExamplesAPI(
- sourceId,
- startTime,
- endTime,
- categoryId,
- exampleCount
+ {
+ sourceId,
+ startTime,
+ endTime,
+ categoryId,
+ exampleCount,
+ },
+ services.http.fetch
);
},
onResolve: ({ data: { examples } }) => {
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_anomalies.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_anomalies.ts
index 21696df566ed9..7f90604bfefdd 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_anomalies.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_anomalies.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import {
getLogEntryAnomaliesRequestPayloadRT,
getLogEntryAnomaliesSuccessReponsePayloadRT,
@@ -13,15 +13,18 @@ import {
import { decodeOrThrow } from '../../../../../common/runtime_types';
import { Sort, Pagination } from '../../../../../common/http_api/log_analysis';
-export const callGetLogEntryAnomaliesAPI = async (
- sourceId: string,
- startTime: number,
- endTime: number,
- sort: Sort,
- pagination: Pagination,
- datasets?: string[]
-) => {
- const response = await npStart.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_ANOMALIES_PATH, {
+interface RequestArgs {
+ sourceId: string;
+ startTime: number;
+ endTime: number;
+ sort: Sort;
+ pagination: Pagination;
+ datasets?: string[];
+}
+
+export const callGetLogEntryAnomaliesAPI = async (requestArgs: RequestArgs, fetch: HttpHandler) => {
+ const { sourceId, startTime, endTime, sort, pagination, datasets } = requestArgs;
+ const response = await fetch(LOG_ANALYSIS_GET_LOG_ENTRY_ANOMALIES_PATH, {
method: 'POST',
body: JSON.stringify(
getLogEntryAnomaliesRequestPayloadRT.encode({
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_anomalies_datasets.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_anomalies_datasets.ts
index 24be5a646d103..c62bec691590c 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_anomalies_datasets.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_anomalies_datasets.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import { decodeOrThrow } from '../../../../../common/runtime_types';
import {
getLogEntryAnomaliesDatasetsRequestPayloadRT,
@@ -12,12 +12,18 @@ import {
LOG_ANALYSIS_GET_LOG_ENTRY_ANOMALIES_DATASETS_PATH,
} from '../../../../../common/http_api/log_analysis';
+interface RequestArgs {
+ sourceId: string;
+ startTime: number;
+ endTime: number;
+}
+
export const callGetLogEntryAnomaliesDatasetsAPI = async (
- sourceId: string,
- startTime: number,
- endTime: number
+ requestArgs: RequestArgs,
+ fetch: HttpHandler
) => {
- const response = await npStart.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_ANOMALIES_DATASETS_PATH, {
+ const { sourceId, startTime, endTime } = requestArgs;
+ const response = await fetch(LOG_ANALYSIS_GET_LOG_ENTRY_ANOMALIES_DATASETS_PATH, {
method: 'POST',
body: JSON.stringify(
getLogEntryAnomaliesDatasetsRequestPayloadRT.encode({
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_examples.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_examples.ts
index a125b53f9e635..ab724a2f435b2 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_examples.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_examples.ts
@@ -4,27 +4,27 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import {
getLogEntryExamplesRequestPayloadRT,
getLogEntryExamplesSuccessReponsePayloadRT,
LOG_ANALYSIS_GET_LOG_ENTRY_RATE_EXAMPLES_PATH,
} from '../../../../../common/http_api/log_analysis';
-import { createPlainError, throwErrors } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
-export const callGetLogEntryExamplesAPI = async (
- sourceId: string,
- startTime: number,
- endTime: number,
- dataset: string,
- exampleCount: number,
- categoryId?: string
-) => {
- const response = await npStart.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_RATE_EXAMPLES_PATH, {
+interface RequestArgs {
+ sourceId: string;
+ startTime: number;
+ endTime: number;
+ dataset: string;
+ exampleCount: number;
+ categoryId?: string;
+}
+
+export const callGetLogEntryExamplesAPI = async (requestArgs: RequestArgs, fetch: HttpHandler) => {
+ const { sourceId, startTime, endTime, dataset, exampleCount, categoryId } = requestArgs;
+ const response = await fetch(LOG_ANALYSIS_GET_LOG_ENTRY_RATE_EXAMPLES_PATH, {
method: 'POST',
body: JSON.stringify(
getLogEntryExamplesRequestPayloadRT.encode({
@@ -42,8 +42,5 @@ export const callGetLogEntryExamplesAPI = async (
),
});
- return pipe(
- getLogEntryExamplesSuccessReponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(getLogEntryExamplesSuccessReponsePayloadRT)(response);
};
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_rate.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_rate.ts
index 77111d279309d..c9189bd803955 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_rate.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_rate.ts
@@ -4,25 +4,25 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fold } from 'fp-ts/lib/Either';
-import { pipe } from 'fp-ts/lib/pipeable';
-import { identity } from 'fp-ts/lib/function';
-import { npStart } from '../../../../legacy_singletons';
+import type { HttpHandler } from 'src/core/public';
import {
getLogEntryRateRequestPayloadRT,
getLogEntryRateSuccessReponsePayloadRT,
LOG_ANALYSIS_GET_LOG_ENTRY_RATE_PATH,
} from '../../../../../common/http_api/log_analysis';
-import { createPlainError, throwErrors } from '../../../../../common/runtime_types';
+import { decodeOrThrow } from '../../../../../common/runtime_types';
-export const callGetLogEntryRateAPI = async (
- sourceId: string,
- startTime: number,
- endTime: number,
- bucketDuration: number,
- datasets?: string[]
-) => {
- const response = await npStart.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_RATE_PATH, {
+interface RequestArgs {
+ sourceId: string;
+ startTime: number;
+ endTime: number;
+ bucketDuration: number;
+ datasets?: string[];
+}
+
+export const callGetLogEntryRateAPI = async (requestArgs: RequestArgs, fetch: HttpHandler) => {
+ const { sourceId, startTime, endTime, bucketDuration, datasets } = requestArgs;
+ const response = await fetch(LOG_ANALYSIS_GET_LOG_ENTRY_RATE_PATH, {
method: 'POST',
body: JSON.stringify(
getLogEntryRateRequestPayloadRT.encode({
@@ -38,8 +38,5 @@ export const callGetLogEntryRateAPI = async (
})
),
});
- return pipe(
- getLogEntryRateSuccessReponsePayloadRT.decode(response),
- fold(throwErrors(createPlainError), identity)
- );
+ return decodeOrThrow(getLogEntryRateSuccessReponsePayloadRT)(response);
};
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_anomalies_results.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_anomalies_results.ts
index 52632e54390a9..37c99272f0872 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_anomalies_results.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_anomalies_results.ts
@@ -16,6 +16,7 @@ import {
GetLogEntryAnomaliesDatasetsSuccessResponsePayload,
LogEntryAnomaly,
} from '../../../../common/http_api/log_analysis';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
export type SortOptions = Sort;
export type PaginationOptions = Pick;
@@ -161,6 +162,8 @@ export const useLogEntryAnomaliesResults = ({
};
};
+ const { services } = useKibanaContextForPlugin();
+
const [reducerState, dispatch] = useReducer(stateReducer, STATE_DEFAULTS, initStateReducer);
const [logEntryAnomalies, setLogEntryAnomalies] = useState([]);
@@ -177,15 +180,18 @@ export const useLogEntryAnomaliesResults = ({
filteredDatasets: queryFilteredDatasets,
} = reducerState;
return await callGetLogEntryAnomaliesAPI(
- sourceId,
- queryStartTime,
- queryEndTime,
- sortOptions,
{
- ...paginationOptions,
- cursor: paginationCursor,
+ sourceId,
+ startTime: queryStartTime,
+ endTime: queryEndTime,
+ sort: sortOptions,
+ pagination: {
+ ...paginationOptions,
+ cursor: paginationCursor,
+ },
+ datasets: queryFilteredDatasets,
},
- queryFilteredDatasets
+ services.http.fetch
);
},
onResolve: ({ data: { anomalies, paginationCursors: requestCursors, hasMoreEntries } }) => {
@@ -286,7 +292,10 @@ export const useLogEntryAnomaliesResults = ({
{
cancelPreviousOn: 'creation',
createPromise: async () => {
- return await callGetLogEntryAnomaliesDatasetsAPI(sourceId, startTime, endTime);
+ return await callGetLogEntryAnomaliesDatasetsAPI(
+ { sourceId, startTime, endTime },
+ services.http.fetch
+ );
},
onResolve: ({ data: { datasets } }) => {
setLogEntryAnomaliesDatasets(datasets);
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_examples.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_examples.ts
index fae5bd200a415..e809ab9cd5a6f 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_examples.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_examples.ts
@@ -7,6 +7,7 @@
import { useMemo, useState } from 'react';
import { LogEntryExample } from '../../../../common/http_api';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
import { useTrackedPromise } from '../../../utils/use_tracked_promise';
import { callGetLogEntryExamplesAPI } from './service_calls/get_log_entry_examples';
@@ -25,6 +26,7 @@ export const useLogEntryExamples = ({
startTime: number;
categoryId?: string;
}) => {
+ const { services } = useKibanaContextForPlugin();
const [logEntryExamples, setLogEntryExamples] = useState([]);
const [getLogEntryExamplesRequest, getLogEntryExamples] = useTrackedPromise(
@@ -32,12 +34,15 @@ export const useLogEntryExamples = ({
cancelPreviousOn: 'creation',
createPromise: async () => {
return await callGetLogEntryExamplesAPI(
- sourceId,
- startTime,
- endTime,
- dataset,
- exampleCount,
- categoryId
+ {
+ sourceId,
+ startTime,
+ endTime,
+ dataset,
+ exampleCount,
+ categoryId,
+ },
+ services.http.fetch
);
},
onResolve: ({ data: { examples } }) => {
diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results.ts
index a52dab58cb018..aef94afa505f1 100644
--- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results.ts
+++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results.ts
@@ -12,6 +12,7 @@ import {
LogEntryRatePartition,
LogEntryRateAnomaly,
} from '../../../../common/http_api/log_analysis';
+import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
import { useTrackedPromise } from '../../../utils/use_tracked_promise';
import { callGetLogEntryRateAPI } from './service_calls/get_log_entry_rate';
@@ -49,6 +50,7 @@ export const useLogEntryRateResults = ({
bucketDuration: number;
filteredDatasets?: string[];
}) => {
+ const { services } = useKibanaContextForPlugin();
const [logEntryRate, setLogEntryRate] = useState(null);
const [getLogEntryRateRequest, getLogEntryRate] = useTrackedPromise(
@@ -56,11 +58,14 @@ export const useLogEntryRateResults = ({
cancelPreviousOn: 'resolution',
createPromise: async () => {
return await callGetLogEntryRateAPI(
- sourceId,
- startTime,
- endTime,
- bucketDuration,
- filteredDatasets
+ {
+ sourceId,
+ startTime,
+ endTime,
+ bucketDuration,
+ datasets: filteredDatasets,
+ },
+ services.http.fetch
);
},
onResolve: ({ data }) => {
diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_hosts_anomalies.ts b/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_hosts_anomalies.ts
index f33e3ea16b389..02170f41a32ca 100644
--- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_hosts_anomalies.ts
+++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_hosts_anomalies.ts
@@ -5,6 +5,7 @@
*/
import { useMemo, useState, useCallback, useEffect, useReducer } from 'react';
+import { HttpHandler } from 'src/core/public';
import {
INFA_ML_GET_METRICS_HOSTS_ANOMALIES_PATH,
Metric,
@@ -16,8 +17,8 @@ import {
getMetricsHostsAnomaliesSuccessReponsePayloadRT,
} from '../../../../../common/http_api/infra_ml';
import { useTrackedPromise } from '../../../../utils/use_tracked_promise';
-import { npStart } from '../../../../legacy_singletons';
import { decodeOrThrow } from '../../../../../common/runtime_types';
+import { useKibanaContextForPlugin } from '../../../../hooks/use_kibana';
export type SortOptions = Sort;
export type PaginationOptions = Pick;
@@ -149,6 +150,7 @@ export const useMetricsHostsAnomaliesResults = ({
onGetMetricsHostsAnomaliesDatasetsError?: (error: Error) => void;
filteredDatasets?: string[];
}) => {
+ const { services } = useKibanaContextForPlugin();
const initStateReducer = (stateDefaults: ReducerStateDefaults): ReducerState => {
return {
...stateDefaults,
@@ -177,15 +179,18 @@ export const useMetricsHostsAnomaliesResults = ({
paginationCursor,
} = reducerState;
return await callGetMetricHostsAnomaliesAPI(
- sourceId,
- queryStartTime,
- queryEndTime,
- metric,
- sortOptions,
{
- ...paginationOptions,
- cursor: paginationCursor,
- }
+ sourceId,
+ startTime: queryStartTime,
+ endTime: queryEndTime,
+ metric,
+ sort: sortOptions,
+ pagination: {
+ ...paginationOptions,
+ cursor: paginationCursor,
+ },
+ },
+ services.http.fetch
);
},
onResolve: ({ data: { anomalies, paginationCursors: requestCursors, hasMoreEntries } }) => {
@@ -288,15 +293,21 @@ export const useMetricsHostsAnomaliesResults = ({
};
};
+interface RequestArgs {
+ sourceId: string;
+ startTime: number;
+ endTime: number;
+ metric: Metric;
+ sort: Sort;
+ pagination: Pagination;
+}
+
export const callGetMetricHostsAnomaliesAPI = async (
- sourceId: string,
- startTime: number,
- endTime: number,
- metric: Metric,
- sort: Sort,
- pagination: Pagination
+ requestArgs: RequestArgs,
+ fetch: HttpHandler
) => {
- const response = await npStart.http.fetch(INFA_ML_GET_METRICS_HOSTS_ANOMALIES_PATH, {
+ const { sourceId, startTime, endTime, metric, sort, pagination } = requestArgs;
+ const response = await fetch(INFA_ML_GET_METRICS_HOSTS_ANOMALIES_PATH, {
method: 'POST',
body: JSON.stringify(
getMetricsHostsAnomaliesRequestPayloadRT.encode({
diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_k8s_anomalies.ts b/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_k8s_anomalies.ts
index 89e70c4c5c4c7..951951b9b6106 100644
--- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_k8s_anomalies.ts
+++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_metrics_k8s_anomalies.ts
@@ -5,6 +5,7 @@
*/
import { useMemo, useState, useCallback, useEffect, useReducer } from 'react';
+import { HttpHandler } from 'src/core/public';
import {
Sort,
Pagination,
@@ -16,8 +17,8 @@ import {
Metric,
} from '../../../../../common/http_api/infra_ml';
import { useTrackedPromise } from '../../../../utils/use_tracked_promise';
-import { npStart } from '../../../../legacy_singletons';
import { decodeOrThrow } from '../../../../../common/runtime_types';
+import { useKibanaContextForPlugin } from '../../../../hooks/use_kibana';
export type SortOptions = Sort;
export type PaginationOptions = Pick;
@@ -149,6 +150,7 @@ export const useMetricsK8sAnomaliesResults = ({
onGetMetricsHostsAnomaliesDatasetsError?: (error: Error) => void;
filteredDatasets?: string[];
}) => {
+ const { services } = useKibanaContextForPlugin();
const initStateReducer = (stateDefaults: ReducerStateDefaults): ReducerState => {
return {
...stateDefaults,
@@ -178,16 +180,19 @@ export const useMetricsK8sAnomaliesResults = ({
filteredDatasets: queryFilteredDatasets,
} = reducerState;
return await callGetMetricsK8sAnomaliesAPI(
- sourceId,
- queryStartTime,
- queryEndTime,
- metric,
- sortOptions,
{
- ...paginationOptions,
- cursor: paginationCursor,
+ sourceId,
+ startTime: queryStartTime,
+ endTime: queryEndTime,
+ metric,
+ sort: sortOptions,
+ pagination: {
+ ...paginationOptions,
+ cursor: paginationCursor,
+ },
+ datasets: queryFilteredDatasets,
},
- queryFilteredDatasets
+ services.http.fetch
);
},
onResolve: ({ data: { anomalies, paginationCursors: requestCursors, hasMoreEntries } }) => {
@@ -290,16 +295,22 @@ export const useMetricsK8sAnomaliesResults = ({
};
};
+interface RequestArgs {
+ sourceId: string;
+ startTime: number;
+ endTime: number;
+ metric: Metric;
+ sort: Sort;
+ pagination: Pagination;
+ datasets?: string[];
+}
+
export const callGetMetricsK8sAnomaliesAPI = async (
- sourceId: string,
- startTime: number,
- endTime: number,
- metric: Metric,
- sort: Sort,
- pagination: Pagination,
- datasets?: string[]
+ requestArgs: RequestArgs,
+ fetch: HttpHandler
) => {
- const response = await npStart.http.fetch(INFA_ML_GET_METRICS_K8S_ANOMALIES_PATH, {
+ const { sourceId, startTime, endTime, metric, sort, pagination, datasets } = requestArgs;
+ const response = await fetch(INFA_ML_GET_METRICS_K8S_ANOMALIES_PATH, {
method: 'POST',
body: JSON.stringify(
getMetricsK8sAnomaliesRequestPayloadRT.encode({
diff --git a/x-pack/plugins/infra/public/plugin.ts b/x-pack/plugins/infra/public/plugin.ts
index 3c6b1a14cfd47..0e49ca93010fd 100644
--- a/x-pack/plugins/infra/public/plugin.ts
+++ b/x-pack/plugins/infra/public/plugin.ts
@@ -9,7 +9,6 @@ import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
import { createMetricThresholdAlertType } from './alerting/metric_threshold';
import { createInventoryMetricAlertType } from './alerting/inventory';
import { getAlertType as getLogsAlertType } from './alerting/log_threshold';
-import { registerStartSingleton } from './legacy_singletons';
import { registerFeatures } from './register_feature';
import {
InfraClientSetupDeps,
@@ -98,9 +97,7 @@ export class Plugin implements InfraClientPluginClass {
});
}
- start(core: InfraClientCoreStart, _plugins: InfraClientStartDeps) {
- registerStartSingleton(core);
- }
+ start(_core: InfraClientCoreStart, _plugins: InfraClientStartDeps) {}
stop() {}
}
From e9fd3902c5a503083fa629e787d7deff1fc7a3bd Mon Sep 17 00:00:00 2001
From: Nick Partridge
Date: Fri, 2 Oct 2020 12:48:40 -0500
Subject: [PATCH 30/56] upgrade @elastic/charts to v23.0.0 (#79226)
Co-authored-by: Elastic Machine
---
package.json | 2 +-
packages/kbn-ui-shared-deps/package.json | 2 +-
.../lens/public/xy_visualization/expression.test.tsx | 2 +-
yarn.lock | 8 ++++----
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/package.json b/package.json
index ff98d7f85dcef..5089e6e1a140d 100644
--- a/package.json
+++ b/package.json
@@ -230,7 +230,7 @@
"@babel/parser": "^7.11.2",
"@babel/types": "^7.11.0",
"@elastic/apm-rum": "^5.6.1",
- "@elastic/charts": "21.1.2",
+ "@elastic/charts": "23.0.0",
"@elastic/ems-client": "7.10.0",
"@elastic/eslint-config-kibana": "0.15.0",
"@elastic/eslint-plugin-eui": "0.0.2",
diff --git a/packages/kbn-ui-shared-deps/package.json b/packages/kbn-ui-shared-deps/package.json
index 278e8efd2d29e..e5f1a06e5bffa 100644
--- a/packages/kbn-ui-shared-deps/package.json
+++ b/packages/kbn-ui-shared-deps/package.json
@@ -9,7 +9,7 @@
"kbn:watch": "node scripts/build --dev --watch"
},
"dependencies": {
- "@elastic/charts": "21.1.2",
+ "@elastic/charts": "23.0.0",
"@elastic/eui": "29.0.0",
"@elastic/numeral": "^2.5.0",
"@kbn/i18n": "1.0.0",
diff --git a/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx b/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx
index 5fc89d831a961..405491ddc372a 100644
--- a/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx
+++ b/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx
@@ -751,7 +751,7 @@ describe('xy_expression', () => {
});
test('onElementClick returns correct context data', () => {
- const geometry: GeometryValue = { x: 5, y: 1, accessor: 'y1', mark: null };
+ const geometry: GeometryValue = { x: 5, y: 1, accessor: 'y1', mark: null, datum: {} };
const series = {
key: 'spec{d}yAccessor{d}splitAccessors{b-2}',
specId: 'd',
diff --git a/yarn.lock b/yarn.lock
index 2d72b6d6c3bb6..971a94bfe56c3 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1218,10 +1218,10 @@
dependencies:
"@elastic/apm-rum-core" "^5.7.0"
-"@elastic/charts@21.1.2":
- version "21.1.2"
- resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-21.1.2.tgz#da7e9c1025bf730a738b6ac6d7024d97dd2b5aa2"
- integrity sha512-Uri+Xolgii7/mRSarfXTfA6X2JC76ILIxTPO8RlYdI44gzprJfUO7Aw5s8vVQke3x6Cu39a+9B0s6TY4GAaApQ==
+"@elastic/charts@23.0.0":
+ version "23.0.0"
+ resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-23.0.0.tgz#6152f5ef0e31b2d7d7a5c95a2f7baba0f4296c18"
+ integrity sha512-FUZ72mzkIVYubtZMPA1bT7rrua1X2ZnsdzO+qRwR81QLfUYM6ht3WLaffVAUT1y6eXmnXFs+d88U7jlsontN6w==
dependencies:
"@popperjs/core" "^2.4.0"
chroma-js "^2.1.0"
From 85528d0ecd8422f9f855ee519ad94f55100f5149 Mon Sep 17 00:00:00 2001
From: Thomas Neirynck
Date: Fri, 2 Oct 2020 14:04:03 -0400
Subject: [PATCH 31/56] [Maps] Register gold+ feature use (#79011)
---
x-pack/plugins/maps/common/constants.ts | 1 +
.../maps/public/actions/layer_actions.test.ts | 51 ++++++++++++++++
.../maps/public/actions/layer_actions.ts | 8 ++-
.../blended_vector_layer.ts | 8 +++
.../maps/public/classes/layers/layer.tsx | 6 ++
.../layers/vector_layer/vector_layer.tsx | 4 ++
.../es_geo_grid_source/es_geo_grid_source.js | 9 +++
.../es_geo_grid_source.test.ts | 30 +++++++--
.../maps/public/classes/sources/source.ts | 6 ++
.../maps/public/index_pattern_util.test.ts | 5 +-
.../plugins/maps/public/index_pattern_util.ts | 3 +-
x-pack/plugins/maps/public/kibana_services.ts | 9 +--
.../plugins/maps/public/licensed_features.ts | 61 +++++++++++++++++++
x-pack/plugins/maps/public/meta.test.js | 6 +-
x-pack/plugins/maps/public/meta.ts | 2 +-
x-pack/plugins/maps/public/plugin.ts | 17 ++----
.../maps/public/selectors/map_selectors.ts | 6 +-
17 files changed, 197 insertions(+), 35 deletions(-)
create mode 100644 x-pack/plugins/maps/public/actions/layer_actions.test.ts
create mode 100644 x-pack/plugins/maps/public/licensed_features.ts
diff --git a/x-pack/plugins/maps/common/constants.ts b/x-pack/plugins/maps/common/constants.ts
index be891b6e59608..469a4023434a8 100644
--- a/x-pack/plugins/maps/common/constants.ts
+++ b/x-pack/plugins/maps/common/constants.ts
@@ -5,6 +5,7 @@
*/
import { i18n } from '@kbn/i18n';
import { FeatureCollection } from 'geojson';
+
export const EMS_APP_NAME = 'kibana';
export const EMS_CATALOGUE_PATH = 'ems/catalogue';
diff --git a/x-pack/plugins/maps/public/actions/layer_actions.test.ts b/x-pack/plugins/maps/public/actions/layer_actions.test.ts
new file mode 100644
index 0000000000000..09a22dca271d7
--- /dev/null
+++ b/x-pack/plugins/maps/public/actions/layer_actions.test.ts
@@ -0,0 +1,51 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { addLayer } from './layer_actions';
+import { LayerDescriptor } from '../../common/descriptor_types';
+import { LICENSED_FEATURES } from '../licensed_features';
+
+const getStoreMock = jest.fn();
+const dispatchMock = jest.fn();
+
+describe('layer_actions', () => {
+ afterEach(() => {
+ jest.resetAllMocks();
+ });
+
+ describe('addLayer', () => {
+ const notifyLicensedFeatureUsageMock = jest.fn();
+
+ beforeEach(() => {
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
+ require('../licensed_features').notifyLicensedFeatureUsage = (feature: LICENSED_FEATURES) => {
+ notifyLicensedFeatureUsageMock(feature);
+ };
+
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
+ require('../selectors/map_selectors').getMapReady = () => {
+ return true;
+ };
+
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
+ require('../selectors/map_selectors').createLayerInstance = () => {
+ return {
+ getLicensedFeatures() {
+ return [LICENSED_FEATURES.GEO_SHAPE_AGGS_GEO_TILE];
+ },
+ };
+ };
+ });
+
+ it('should register feature-use', async () => {
+ const action = addLayer(({} as unknown) as LayerDescriptor);
+ await action(dispatchMock, getStoreMock);
+ expect(notifyLicensedFeatureUsageMock).toHaveBeenCalledWith(
+ LICENSED_FEATURES.GEO_SHAPE_AGGS_GEO_TILE
+ );
+ });
+ });
+});
diff --git a/x-pack/plugins/maps/public/actions/layer_actions.ts b/x-pack/plugins/maps/public/actions/layer_actions.ts
index 675bb14722889..19c9adfadd45a 100644
--- a/x-pack/plugins/maps/public/actions/layer_actions.ts
+++ b/x-pack/plugins/maps/public/actions/layer_actions.ts
@@ -14,6 +14,7 @@ import {
getSelectedLayerId,
getMapReady,
getMapColors,
+ createLayerInstance,
} from '../selectors/map_selectors';
import { FLYOUT_STATE } from '../reducers/ui';
import { cancelRequest } from '../reducers/non_serializable_instances';
@@ -42,6 +43,7 @@ import { ILayer } from '../classes/layers/layer';
import { IVectorLayer } from '../classes/layers/vector_layer/vector_layer';
import { LAYER_STYLE_TYPE, LAYER_TYPE } from '../../common/constants';
import { IVectorStyle } from '../classes/styles/vector/vector_style';
+import { notifyLicensedFeatureUsage } from '../licensed_features';
export function trackCurrentLayerState(layerId: string) {
return {
@@ -108,7 +110,7 @@ export function cloneLayer(layerId: string) {
}
export function addLayer(layerDescriptor: LayerDescriptor) {
- return (dispatch: Dispatch, getState: () => MapStoreState) => {
+ return async (dispatch: Dispatch, getState: () => MapStoreState) => {
const isMapReady = getMapReady(getState());
if (!isMapReady) {
dispatch({
@@ -123,6 +125,10 @@ export function addLayer(layerDescriptor: LayerDescriptor) {
layer: layerDescriptor,
});
dispatch(syncDataForLayerId(layerDescriptor.id));
+
+ const layer = createLayerInstance(layerDescriptor);
+ const features = await layer.getLicensedFeatures();
+ features.forEach(notifyLicensedFeatureUsage);
};
}
diff --git a/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts b/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts
index 9b6a67ac28ad0..65a76f0c54ffb 100644
--- a/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts
+++ b/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts
@@ -38,6 +38,7 @@ import {
VectorLayerDescriptor,
} from '../../../../common/descriptor_types';
import { IVectorSource } from '../../sources/vector_source';
+import { LICENSED_FEATURES } from '../../../licensed_features';
const ACTIVE_COUNT_DATA_ID = 'ACTIVE_COUNT_DATA_ID';
@@ -327,4 +328,11 @@ export class BlendedVectorLayer extends VectorLayer implements IVectorLayer {
super._syncData(syncContext, activeSource, activeStyle);
}
+
+ async getLicensedFeatures(): Promise {
+ return [
+ ...(await this._clusterSource.getLicensedFeatures()),
+ ...(await this._documentSource.getLicensedFeatures()),
+ ];
+ }
}
diff --git a/x-pack/plugins/maps/public/classes/layers/layer.tsx b/x-pack/plugins/maps/public/classes/layers/layer.tsx
index d6bd5180375ce..d7fd5d34a9dd0 100644
--- a/x-pack/plugins/maps/public/classes/layers/layer.tsx
+++ b/x-pack/plugins/maps/public/classes/layers/layer.tsx
@@ -34,6 +34,7 @@ import { Attribution, ImmutableSourceProperty, ISource, SourceEditorArgs } from
import { DataRequestContext } from '../../actions';
import { IStyle } from '../styles/style';
import { getJoinAggKey } from '../../../common/get_agg_key';
+import { LICENSED_FEATURES } from '../../licensed_features';
export interface ILayer {
getBounds(dataRequestContext: DataRequestContext): Promise;
@@ -91,6 +92,7 @@ export interface ILayer {
showJoinEditor(): boolean;
getJoinsDisabledReason(): string | null;
isFittable(): Promise;
+ getLicensedFeatures(): Promise;
}
export type Footnote = {
icon: ReactElement;
@@ -538,4 +540,8 @@ export class AbstractLayer implements ILayer {
supportsLabelsOnTop(): boolean {
return false;
}
+
+ async getLicensedFeatures(): Promise {
+ return [];
+ }
}
diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx
index a2532d4e7b10e..c44ebcf969f7c 100644
--- a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx
+++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx
@@ -1090,4 +1090,8 @@ export class VectorLayer extends AbstractLayer {
});
return targetFeature ? targetFeature : null;
}
+
+ async getLicensedFeatures() {
+ return await this._source.getLicensedFeatures();
+ }
}
diff --git a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.js b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.js
index 89258f04612fd..181af6b17b7dd 100644
--- a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.js
+++ b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.js
@@ -24,12 +24,14 @@ import {
MVT_GETGRIDTILE_API_PATH,
GEOTILE_GRID_AGG_NAME,
GEOCENTROID_AGG_NAME,
+ ES_GEO_FIELD_TYPE,
} from '../../../../common/constants';
import { i18n } from '@kbn/i18n';
import { getDataSourceLabel } from '../../../../common/i18n_getters';
import { AbstractESAggSource, DEFAULT_METRIC } from '../es_agg_source';
import { DataRequestAbortError } from '../../util/data_request';
import { registerSource } from '../source_registry';
+import { LICENSED_FEATURES } from '../../../licensed_features';
import rison from 'rison-node';
import { getHttp } from '../../../kibana_services';
@@ -399,6 +401,13 @@ export class ESGeoGridSource extends AbstractESAggSource {
return [VECTOR_SHAPE_TYPE.POINT];
}
+
+ async getLicensedFeatures() {
+ const geoField = await this._getGeoField();
+ return geoField.type === ES_GEO_FIELD_TYPE.GEO_SHAPE
+ ? [LICENSED_FEATURES.GEO_SHAPE_AGGS_GEO_TILE]
+ : [];
+ }
}
registerSource({
diff --git a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts
index 06df68283c434..3b1cf3293c0d3 100644
--- a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts
+++ b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts
@@ -4,10 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { MapExtent, VectorSourceRequestMeta } from '../../../../common/descriptor_types';
-
-jest.mock('../../../kibana_services');
-
-import { getIndexPatternService, getSearchService, getHttp } from '../../../kibana_services';
+import { getHttp, getIndexPatternService, getSearchService } from '../../../kibana_services';
import { ESGeoGridSource } from './es_geo_grid_source';
import {
ES_GEO_FIELD_TYPE,
@@ -16,6 +13,9 @@ import {
SOURCE_TYPES,
} from '../../../../common/constants';
import { SearchSource } from 'src/plugins/data/public';
+import { LICENSED_FEATURES } from '../../../licensed_features';
+
+jest.mock('../../../kibana_services');
export class MockSearchSource {
setField = jest.fn();
@@ -27,6 +27,8 @@ export class MockSearchSource {
describe('ESGeoGridSource', () => {
const geoFieldName = 'bar';
+
+ let esGeoFieldType = ES_GEO_FIELD_TYPE.GEO_POINT;
const mockIndexPatternService = {
get() {
return {
@@ -34,7 +36,7 @@ describe('ESGeoGridSource', () => {
getByName() {
return {
name: geoFieldName,
- type: ES_GEO_FIELD_TYPE.GEO_POINT,
+ type: esGeoFieldType,
};
},
},
@@ -127,6 +129,11 @@ describe('ESGeoGridSource', () => {
});
});
+ afterEach(() => {
+ esGeoFieldType = ES_GEO_FIELD_TYPE.GEO_POINT;
+ jest.resetAllMocks();
+ });
+
const extent: MapExtent = {
minLon: -160,
minLat: -80,
@@ -271,4 +278,17 @@ describe('ESGeoGridSource', () => {
);
});
});
+
+ describe('Gold+ usage', () => {
+ it('Should have none for points', async () => {
+ expect(await geogridSource.getLicensedFeatures()).toEqual([]);
+ });
+
+ it('Should have shape-aggs for geo_shape', async () => {
+ esGeoFieldType = ES_GEO_FIELD_TYPE.GEO_SHAPE;
+ expect(await geogridSource.getLicensedFeatures()).toEqual([
+ LICENSED_FEATURES.GEO_SHAPE_AGGS_GEO_TILE,
+ ]);
+ });
+ });
});
diff --git a/x-pack/plugins/maps/public/classes/sources/source.ts b/x-pack/plugins/maps/public/classes/sources/source.ts
index 946381817b8fc..c4fb5178c0b56 100644
--- a/x-pack/plugins/maps/public/classes/sources/source.ts
+++ b/x-pack/plugins/maps/public/classes/sources/source.ts
@@ -15,6 +15,7 @@ import { IField } from '../fields/field';
import { FieldFormatter, MAX_ZOOM, MIN_ZOOM } from '../../../common/constants';
import { AbstractSourceDescriptor } from '../../../common/descriptor_types';
import { OnSourceChangeArgs } from '../../connected_components/layer_panel/view';
+import { LICENSED_FEATURES } from '../../licensed_features';
export type SourceEditorArgs = {
onChange: (...args: OnSourceChangeArgs[]) => void;
@@ -66,6 +67,7 @@ export interface ISource {
getValueSuggestions(field: IField, query: string): Promise;
getMinZoom(): number;
getMaxZoom(): number;
+ getLicensedFeatures(): Promise;
}
export class AbstractSource implements ISource {
@@ -188,4 +190,8 @@ export class AbstractSource implements ISource {
getMaxZoom() {
return MAX_ZOOM;
}
+
+ async getLicensedFeatures(): Promise {
+ return [];
+ }
}
diff --git a/x-pack/plugins/maps/public/index_pattern_util.test.ts b/x-pack/plugins/maps/public/index_pattern_util.test.ts
index ffcc6da52677a..010c847f96eba 100644
--- a/x-pack/plugins/maps/public/index_pattern_util.test.ts
+++ b/x-pack/plugins/maps/public/index_pattern_util.test.ts
@@ -5,6 +5,7 @@
*/
jest.mock('./kibana_services', () => ({}));
+jest.mock('./licensed_features', () => ({}));
import {
getSourceFields,
@@ -69,7 +70,7 @@ describe('Gold+ licensing', () => {
describe('basic license', () => {
beforeEach(() => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
- require('./kibana_services').getIsGoldPlus = () => false;
+ require('./licensed_features').getIsGoldPlus = () => false;
});
describe('getAggregatableGeoFieldTypes', () => {
@@ -92,7 +93,7 @@ describe('Gold+ licensing', () => {
describe('gold license', () => {
beforeEach(() => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
- require('./kibana_services').getIsGoldPlus = () => true;
+ require('./licensed_features').getIsGoldPlus = () => true;
});
describe('getAggregatableGeoFieldTypes', () => {
test('Should add geo_shape field', () => {
diff --git a/x-pack/plugins/maps/public/index_pattern_util.ts b/x-pack/plugins/maps/public/index_pattern_util.ts
index bd2a14619ac41..7af1571a0bc5b 100644
--- a/x-pack/plugins/maps/public/index_pattern_util.ts
+++ b/x-pack/plugins/maps/public/index_pattern_util.ts
@@ -6,9 +6,10 @@
import { IFieldType, IndexPattern } from 'src/plugins/data/public';
import { i18n } from '@kbn/i18n';
-import { getIndexPatternService, getIsGoldPlus } from './kibana_services';
+import { getIndexPatternService } from './kibana_services';
import { indexPatterns } from '../../../../src/plugins/data/public';
import { ES_GEO_FIELD_TYPE, ES_GEO_FIELD_TYPES } from '../common/constants';
+import { getIsGoldPlus } from './licensed_features';
export function getGeoTileAggNotSupportedReason(field: IFieldType): string | null {
if (!field.aggregatable) {
diff --git a/x-pack/plugins/maps/public/kibana_services.ts b/x-pack/plugins/maps/public/kibana_services.ts
index c1dfb61e9f3b6..b520e0cb2df01 100644
--- a/x-pack/plugins/maps/public/kibana_services.ts
+++ b/x-pack/plugins/maps/public/kibana_services.ts
@@ -5,17 +5,10 @@
*/
import _ from 'lodash';
+import { CoreStart } from 'kibana/public';
import { MapsLegacyConfig } from '../../../../src/plugins/maps_legacy/config';
import { MapsConfigType } from '../config';
import { MapsPluginStartDependencies } from './plugin';
-import { CoreStart } from '../../../../src/core/public';
-
-let licenseId: string | undefined;
-export const setLicenseId = (latestLicenseId: string | undefined) => (licenseId = latestLicenseId);
-export const getLicenseId = () => licenseId;
-let isGoldPlus: boolean = false;
-export const setIsGoldPlus = (igp: boolean) => (isGoldPlus = igp);
-export const getIsGoldPlus = () => isGoldPlus;
let kibanaVersion: string;
export const setKibanaVersion = (version: string) => (kibanaVersion = version);
diff --git a/x-pack/plugins/maps/public/licensed_features.ts b/x-pack/plugins/maps/public/licensed_features.ts
new file mode 100644
index 0000000000000..67fa526da0cbd
--- /dev/null
+++ b/x-pack/plugins/maps/public/licensed_features.ts
@@ -0,0 +1,61 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { ILicense, LicenseType } from '../../licensing/common/types';
+import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/public';
+import { APP_ID } from '../common/constants';
+
+export enum LICENSED_FEATURES {
+ GEO_SHAPE_AGGS_GEO_TILE = 'GEO_SHAPE_AGGS_GEO_TILE',
+}
+
+export interface LicensedFeatureDetail {
+ name: string;
+ license: LicenseType;
+}
+
+export const LICENCED_FEATURES_DETAILS: Record = {
+ [LICENSED_FEATURES.GEO_SHAPE_AGGS_GEO_TILE]: {
+ name: 'geo_tile aggregation on geo_shape field-type',
+ license: 'gold',
+ },
+};
+
+let licenseId: string | undefined;
+let isGoldPlus: boolean = false;
+
+export const getLicenseId = () => licenseId;
+export const getIsGoldPlus = () => isGoldPlus;
+
+export function registerLicensedFeatures(licensingPlugin: LicensingPluginSetup) {
+ for (const licensedFeature of Object.values(LICENSED_FEATURES)) {
+ licensingPlugin.featureUsage.register(
+ LICENCED_FEATURES_DETAILS[licensedFeature].name,
+ LICENCED_FEATURES_DETAILS[licensedFeature].license
+ );
+ }
+}
+
+let licensingPluginStart: LicensingPluginStart;
+export function setLicensingPluginStart(licensingPlugin: LicensingPluginStart) {
+ licensingPluginStart = licensingPlugin;
+ licensingPluginStart.license$.subscribe((license: ILicense) => {
+ const gold = license.check(APP_ID, 'gold');
+ isGoldPlus = gold.state === 'valid';
+ licenseId = license.uid;
+ });
+}
+
+export function notifyLicensedFeatureUsage(licensedFeature: LICENSED_FEATURES) {
+ if (!licensingPluginStart) {
+ // eslint-disable-next-line no-console
+ console.error('May not call notifyLicensedFeatureUsage before plugin start');
+ return;
+ }
+ licensingPluginStart.featureUsage.notifyUsage(
+ LICENCED_FEATURES_DETAILS[LICENSED_FEATURES[licensedFeature]].name
+ );
+}
diff --git a/x-pack/plugins/maps/public/meta.test.js b/x-pack/plugins/maps/public/meta.test.js
index 3486bf003aee0..c414c8a2d400e 100644
--- a/x-pack/plugins/maps/public/meta.test.js
+++ b/x-pack/plugins/maps/public/meta.test.js
@@ -12,14 +12,14 @@ jest.mock('@elastic/ems-client');
describe('default use without proxy', () => {
beforeEach(() => {
require('./kibana_services').getProxyElasticMapsServiceInMaps = () => false;
- require('./kibana_services').getLicenseId = () => {
- return 'foobarlicenseid';
- };
require('./kibana_services').getIsEmsEnabled = () => true;
require('./kibana_services').getEmsTileLayerId = () => '123';
require('./kibana_services').getEmsFileApiUrl = () => 'https://file-api';
require('./kibana_services').getEmsTileApiUrl = () => 'https://tile-api';
require('./kibana_services').getEmsLandingPageUrl = () => 'http://test.com';
+ require('./licensed_features').getLicenseId = () => {
+ return 'foobarlicenseid';
+ };
});
test('should construct EMSClient with absolute file and tile API urls', async () => {
diff --git a/x-pack/plugins/maps/public/meta.ts b/x-pack/plugins/maps/public/meta.ts
index 5142793bede34..4eca6c3e671b7 100644
--- a/x-pack/plugins/maps/public/meta.ts
+++ b/x-pack/plugins/maps/public/meta.ts
@@ -18,7 +18,6 @@ import {
} from '../common/constants';
import {
getHttp,
- getLicenseId,
getIsEmsEnabled,
getRegionmapLayers,
getTilemap,
@@ -29,6 +28,7 @@ import {
getProxyElasticMapsServiceInMaps,
getKibanaVersion,
} from './kibana_services';
+import { getLicenseId } from './licensed_features';
export function getKibanaRegionList(): unknown[] {
return getRegionmapLayers();
diff --git a/x-pack/plugins/maps/public/plugin.ts b/x-pack/plugins/maps/public/plugin.ts
index 696964f0258d4..5b79863d0dd97 100644
--- a/x-pack/plugins/maps/public/plugin.ts
+++ b/x-pack/plugins/maps/public/plugin.ts
@@ -18,10 +18,8 @@ import {
// @ts-ignore
import { MapView } from './inspector/views/map_view';
import {
- setIsGoldPlus,
setKibanaCommonConfig,
setKibanaVersion,
- setLicenseId,
setMapAppConfig,
setStartServices,
} from './kibana_services';
@@ -42,7 +40,6 @@ import { MapEmbeddableFactory } from './embeddable/map_embeddable_factory';
import { EmbeddableSetup } from '../../../../src/plugins/embeddable/public';
import { MapsXPackConfig, MapsConfigType } from '../config';
import { getAppTitle } from '../common/i18n_getters';
-import { ILicense } from '../../licensing/common/types';
import { lazyLoadMapModules } from './lazy_load_bundle';
import { MapsStartApi } from './api';
import { createSecurityLayerDescriptors, registerLayerWizard, registerSource } from './api';
@@ -50,8 +47,9 @@ import { SharePluginSetup, SharePluginStart } from '../../../../src/plugins/shar
import { EmbeddableStart } from '../../../../src/plugins/embeddable/public';
import { MapsLegacyConfig } from '../../../../src/plugins/maps_legacy/config';
import { DataPublicPluginStart } from '../../../../src/plugins/data/public';
-import { LicensingPluginStart } from '../../licensing/public';
+import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/public';
import { StartContract as FileUploadStartContract } from '../../file_upload/public';
+import { registerLicensedFeatures, setLicensingPluginStart } from './licensed_features';
export interface MapsPluginSetupDependencies {
inspector: InspectorSetupContract;
@@ -60,6 +58,7 @@ export interface MapsPluginSetupDependencies {
embeddable: EmbeddableSetup;
mapsLegacy: { config: MapsLegacyConfig };
share: SharePluginSetup;
+ licensing: LicensingPluginSetup;
}
export interface MapsPluginStartDependencies {
@@ -97,6 +96,8 @@ export class MapsPlugin
}
public setup(core: CoreSetup, plugins: MapsPluginSetupDependencies) {
+ registerLicensedFeatures(plugins.licensing);
+
const config = this._initializerContext.config.get();
setKibanaCommonConfig(plugins.mapsLegacy.config);
setMapAppConfig(config);
@@ -138,13 +139,7 @@ export class MapsPlugin
}
public start(core: CoreStart, plugins: MapsPluginStartDependencies): MapsStartApi {
- if (plugins.licensing) {
- plugins.licensing.license$.subscribe((license: ILicense) => {
- const gold = license.check(APP_ID, 'gold');
- setIsGoldPlus(gold.state === 'valid');
- setLicenseId(license.uid);
- });
- }
+ setLicensingPluginStart(plugins.licensing);
plugins.uiActions.addTriggerAction(VISUALIZE_GEO_FIELD_TRIGGER, visualizeGeoFieldAction);
setStartServices(core, plugins);
diff --git a/x-pack/plugins/maps/public/selectors/map_selectors.ts b/x-pack/plugins/maps/public/selectors/map_selectors.ts
index db4371e9cd590..4b5122050eb71 100644
--- a/x-pack/plugins/maps/public/selectors/map_selectors.ts
+++ b/x-pack/plugins/maps/public/selectors/map_selectors.ts
@@ -52,9 +52,9 @@ import { ITMSSource } from '../classes/sources/tms_source';
import { IVectorSource } from '../classes/sources/vector_source';
import { ILayer } from '../classes/layers/layer';
-function createLayerInstance(
+export function createLayerInstance(
layerDescriptor: LayerDescriptor,
- inspectorAdapters: Adapters
+ inspectorAdapters?: Adapters
): ILayer {
const source: ISource = createSourceInstance(layerDescriptor.sourceDescriptor, inspectorAdapters);
@@ -94,7 +94,7 @@ function createLayerInstance(
}
}
-function createSourceInstance(sourceDescriptor: any, inspectorAdapters: Adapters): ISource {
+function createSourceInstance(sourceDescriptor: any, inspectorAdapters?: Adapters): ISource {
const source = getSourceByType(sourceDescriptor.type);
if (!source) {
throw new Error(`Unrecognized sourceType ${sourceDescriptor.type}`);
From 86cb97adf6b1692277695fab7089f4a559346cc2 Mon Sep 17 00:00:00 2001
From: Thomas Neirynck
Date: Fri, 2 Oct 2020 14:04:31 -0400
Subject: [PATCH 32/56] [Maps] Simplify IDynamicStyle-api (#79217)
---
.../properties/dynamic_style_property.tsx | 54 ++++++++++++++-----
.../classes/styles/vector/vector_style.tsx | 40 +++++---------
2 files changed, 54 insertions(+), 40 deletions(-)
diff --git a/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_style_property.tsx b/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_style_property.tsx
index 2bc819daeea90..98b58def905eb 100644
--- a/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_style_property.tsx
+++ b/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_style_property.tsx
@@ -6,7 +6,8 @@
import _ from 'lodash';
import React from 'react';
-import { Feature } from 'geojson';
+import { Feature, FeatureCollection } from 'geojson';
+import { FeatureIdentifier, Map as MbMap } from 'mapbox-gl';
import { AbstractStyleProperty, IStyleProperty } from './style_property';
import { DEFAULT_SIGMA } from '../vector_style_defaults';
import {
@@ -44,20 +45,14 @@ export interface IDynamicStyleProperty extends IStyleProperty {
isOrdinal(): boolean;
supportsFieldMeta(): boolean;
getFieldMetaRequest(): Promise;
- supportsMbFeatureState(): boolean;
- getMbLookupFunction(): MB_LOOKUP_FUNCTION;
pluckOrdinalStyleMetaFromFeatures(features: Feature[]): RangeFieldMeta | null;
pluckCategoricalStyleMetaFromFeatures(features: Feature[]): CategoryFieldMeta | null;
getValueSuggestions(query: string): Promise;
-
- // Returns the name that should be used for accessing the data from the mb-style rule
- // Depending on
- // - whether the field is used for labeling, icon-orientation, or other properties (color, size, ...), `feature-state` and or `get` is used
- // - whether the field was run through a field-formatter, a new dynamic field is created with the formatted-value
- // The combination of both will inform what field-name (e.g. the "raw" field name from the properties, the "computed field-name" for an on-the-fly created property (e.g. for feature-state or field-formatting).
- // todo: There is an existing limitation to .mvt backed sources, where the field-formatters are not applied. Here, the raw-data needs to be accessed.
- getMbPropertyName(): string;
- getMbPropertyValue(value: RawValue): RawValue;
+ enrichGeoJsonAndMbFeatureState(
+ featureCollection: FeatureCollection,
+ mbMap: MbMap,
+ mbSourceId: string
+ ): boolean;
}
export class DynamicStyleProperty
@@ -356,6 +351,12 @@ export class DynamicStyleProperty
);
}
+ // Returns the name that should be used for accessing the data from the mb-style rule
+ // Depending on
+ // - whether the field is used for labeling, icon-orientation, or other properties (color, size, ...), `feature-state` and or `get` is used
+ // - whether the field was run through a field-formatter, a new dynamic field is created with the formatted-value
+ // The combination of both will inform what field-name (e.g. the "raw" field name from the properties, the "computed field-name" for an on-the-fly created property (e.g. for feature-state or field-formatting).
+ // todo: There is an existing limitation to .mvt backed sources, where the field-formatters are not applied. Here, the raw-data needs to be accessed.
getMbPropertyName() {
if (!this._field) {
return '';
@@ -385,6 +386,35 @@ export class DynamicStyleProperty
// Calling `isOrdinal` would be equivalent.
return this.supportsMbFeatureState() ? getNumericalMbFeatureStateValue(rawValue) : rawValue;
}
+
+ enrichGeoJsonAndMbFeatureState(
+ featureCollection: FeatureCollection,
+ mbMap: MbMap,
+ mbSourceId: string
+ ): boolean {
+ const supportsFeatureState = this.supportsMbFeatureState();
+ const featureIdentifier: FeatureIdentifier = {
+ source: mbSourceId,
+ id: undefined,
+ };
+ const featureState: Record = {};
+ const targetMbName = this.getMbPropertyName();
+ for (let i = 0; i < featureCollection.features.length; i++) {
+ const feature = featureCollection.features[i];
+ const rawValue = feature.properties ? feature.properties[this.getFieldName()] : undefined;
+ const targetMbValue = this.getMbPropertyValue(rawValue);
+ if (supportsFeatureState) {
+ featureState[targetMbName] = targetMbValue; // the same value will be potentially overridden multiple times, if the name remains identical
+ featureIdentifier.id = feature.id;
+ mbMap.setFeatureState(featureIdentifier, featureState);
+ } else {
+ if (feature.properties) {
+ feature.properties[targetMbName] = targetMbValue;
+ }
+ }
+ }
+ return supportsFeatureState;
+ }
}
export function getNumericalMbFeatureStateValue(value: RawValue) {
diff --git a/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx b/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx
index 5d0d9712ef988..acb158636e0b3 100644
--- a/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx
+++ b/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx
@@ -641,7 +641,7 @@ export class VectorStyle implements IVectorStyle {
featureCollection: FeatureCollection,
mbMap: MbMap,
mbSourceId: string
- ) {
+ ): boolean {
if (!featureCollection) {
return false;
}
@@ -651,40 +651,24 @@ export class VectorStyle implements IVectorStyle {
return false;
}
- const tmpFeatureIdentifier: FeatureIdentifier = {
- source: '',
- id: undefined,
- };
- const tmpFeatureState: any = {};
-
- for (let i = 0; i < featureCollection.features.length; i++) {
- const feature = featureCollection.features[i];
-
- for (let j = 0; j < dynamicStyleProps.length; j++) {
- const dynamicStyleProp = dynamicStyleProps[j];
- const targetMbName = dynamicStyleProp.getMbPropertyName();
- const rawValue = feature.properties
- ? feature.properties[dynamicStyleProp.getFieldName()]
- : undefined;
- const targetMbValue = dynamicStyleProp.getMbPropertyValue(rawValue);
- if (dynamicStyleProp.supportsMbFeatureState()) {
- tmpFeatureState[targetMbName] = targetMbValue; // the same value will be potentially overridden multiple times, if the name remains identical
- } else {
- if (feature.properties) {
- feature.properties[targetMbName] = targetMbValue;
- }
- }
+ let shouldResetAllData = false;
+ for (let j = 0; j < dynamicStyleProps.length; j++) {
+ const dynamicStyleProp = dynamicStyleProps[j];
+ const usedFeatureState = dynamicStyleProp.enrichGeoJsonAndMbFeatureState(
+ featureCollection,
+ mbMap,
+ mbSourceId
+ );
+ if (!usedFeatureState) {
+ shouldResetAllData = true;
}
- tmpFeatureIdentifier.source = mbSourceId;
- tmpFeatureIdentifier.id = feature.id;
- mbMap.setFeatureState(tmpFeatureIdentifier, tmpFeatureState);
}
// returns boolean indicating if styles do not support feature-state and some values are stored in geojson properties
// this return-value is used in an optimization for style-updates with mapbox-gl.
// `true` indicates the entire data needs to reset on the source (otherwise the style-rules will not be reapplied)
// `false` indicates the data does not need to be reset on the store, because styles are re-evaluated if they use featureState
- return dynamicStyleProps.some((dynamicStyleProp) => !dynamicStyleProp.supportsMbFeatureState());
+ return shouldResetAllData;
}
arePointsSymbolizedAsCircles() {
From 819ccf124703f5da04bbe73e1a892b6a96e1c3e7 Mon Sep 17 00:00:00 2001
From: Robert Oskamp
Date: Fri, 2 Oct 2020 20:14:42 +0200
Subject: [PATCH 33/56] Adjust extend_es_archiver to handle additional cases
(#79308)
This PR enables the extend_es_archiver to recognize additional indices like .kibana_1 as well as a list of indices.
---
test/common/services/kibana_server/extend_es_archiver.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/test/common/services/kibana_server/extend_es_archiver.js b/test/common/services/kibana_server/extend_es_archiver.js
index 4efdfc4dddf77..f6e14061aed2a 100644
--- a/test/common/services/kibana_server/extend_es_archiver.js
+++ b/test/common/services/kibana_server/extend_es_archiver.js
@@ -33,9 +33,15 @@ export function extendEsArchiver({ esArchiver, kibanaServer, retry, defaults })
// esArchiver methods return a stats object, with information about the indexes created
const stats = await originalMethod.apply(esArchiver, args);
+ const statsKeys = Object.keys(stats);
+ const kibanaKeys = statsKeys.filter(
+ // this also matches stats keys like '.kibana_1' and '.kibana_2,.kibana_1'
+ (key) => key.includes(KIBANA_INDEX) && (stats[key].created || stats[key].deleted)
+ );
+
// if the kibana index was created by the esArchiver then update the uiSettings
// with the defaults to make sure that they are always in place initially
- if (stats[KIBANA_INDEX] && (stats[KIBANA_INDEX].created || stats[KIBANA_INDEX].deleted)) {
+ if (kibanaKeys.length > 0) {
await retry.try(async () => {
await kibanaServer.uiSettings.update(defaults);
});
From 92ff5178c6ee0b226c9e89aff00e3b3e8dcc7562 Mon Sep 17 00:00:00 2001
From: Jonathan Buttner <56361221+jonathan-buttner@users.noreply.github.com>
Date: Fri, 2 Oct 2020 14:15:03 -0400
Subject: [PATCH 34/56] [Security Solution][EPM] Reenabling the ingest and
endpoint tests (#79290)
* Reenabling the ingest and endpoint tests
* Fixing list test and reenabling security functional tests
---
.../apis/epm/list.ts | 28 ++++++++-----------
.../apis/index.js | 2 +-
.../ingest_manager_api_integration/config.ts | 2 +-
.../apps/endpoint/index.ts | 2 +-
.../apis/index.ts | 2 +-
5 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts b/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts
index bfe1954e46c9f..732696433279f 100644
--- a/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts
+++ b/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts
@@ -6,21 +6,23 @@
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
-import { warnAndSkipTest } from '../../helpers';
+import { skipIfNoDockerRegistry } from '../../helpers';
+import { setupIngest } from '../fleet/agents/services';
-export default function ({ getService }: FtrProviderContext) {
- const log = getService('log');
+export default function (providerContext: FtrProviderContext) {
+ const { getService } = providerContext;
const supertest = getService('supertest');
- const dockerServers = getService('dockerServers');
- const server = dockerServers.get('registry');
// use function () {} and not () => {} here
// because `this` has to point to the Mocha context
// see https://mochajs.org/#arrow-functions
describe('EPM - list', async function () {
- it('lists all packages from the registry', async function () {
- if (server.enabled) {
+ skipIfNoDockerRegistry(providerContext);
+ setupIngest(providerContext);
+
+ describe('list api tests', async () => {
+ it('lists all packages from the registry', async function () {
const fetchPackageList = async () => {
const response = await supertest
.get('/api/ingest_manager/epm/packages')
@@ -30,13 +32,9 @@ export default function ({ getService }: FtrProviderContext) {
};
const listResponse = await fetchPackageList();
expect(listResponse.response.length).not.to.be(0);
- } else {
- warnAndSkipTest(this, log);
- }
- });
+ });
- it('lists all limited packages from the registry', async function () {
- if (server.enabled) {
+ it('lists all limited packages from the registry', async function () {
const fetchLimitedPackageList = async () => {
const response = await supertest
.get('/api/ingest_manager/epm/packages/limited')
@@ -46,9 +44,7 @@ export default function ({ getService }: FtrProviderContext) {
};
const listResponse = await fetchLimitedPackageList();
expect(listResponse.response).to.eql(['endpoint']);
- } else {
- warnAndSkipTest(this, log);
- }
+ });
});
});
}
diff --git a/x-pack/test/ingest_manager_api_integration/apis/index.js b/x-pack/test/ingest_manager_api_integration/apis/index.js
index ec509e1485a9f..7c1ebef337baa 100644
--- a/x-pack/test/ingest_manager_api_integration/apis/index.js
+++ b/x-pack/test/ingest_manager_api_integration/apis/index.js
@@ -5,7 +5,7 @@
*/
export default function ({ loadTestFile }) {
- describe.skip('Ingest Manager Endpoints', function () {
+ describe('Ingest Manager Endpoints', function () {
this.tags('ciGroup7');
// Ingest Manager setup
loadTestFile(require.resolve('./setup'));
diff --git a/x-pack/test/ingest_manager_api_integration/config.ts b/x-pack/test/ingest_manager_api_integration/config.ts
index 862ef732cb8b4..d11884667c48a 100644
--- a/x-pack/test/ingest_manager_api_integration/config.ts
+++ b/x-pack/test/ingest_manager_api_integration/config.ts
@@ -12,7 +12,7 @@ import { defineDockerServersConfig } from '@kbn/test';
// Docker image to use for Ingest Manager API integration tests.
// This hash comes from the commit hash here: https://github.com/elastic/package-storage/commit
export const dockerImage =
- 'docker.elastic.co/package-registry/distribution:518a65a993ab7e9c77b1d8d20cd6f847921d04ec';
+ 'docker.elastic.co/package-registry/distribution:a5132271ad37209d6978018bfe6e224546d719a8';
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const xPackAPITestsConfig = await readConfigFile(require.resolve('../api_integration/config.ts'));
diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts
index c3862d130202d..654aa18fba523 100644
--- a/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts
+++ b/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts
@@ -13,7 +13,7 @@ import {
export default function (providerContext: FtrProviderContext) {
const { loadTestFile, getService } = providerContext;
- describe.skip('endpoint', function () {
+ describe('endpoint', function () {
this.tags('ciGroup7');
const ingestManager = getService('ingestManager');
const log = getService('log');
diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/index.ts b/x-pack/test/security_solution_endpoint_api_int/apis/index.ts
index 6c5764faed631..3d344c1b3b51b 100644
--- a/x-pack/test/security_solution_endpoint_api_int/apis/index.ts
+++ b/x-pack/test/security_solution_endpoint_api_int/apis/index.ts
@@ -10,7 +10,7 @@ import { getRegistryUrl as getRegistryUrlFromIngest } from '../../../plugins/ing
export default function endpointAPIIntegrationTests(providerContext: FtrProviderContext) {
const { loadTestFile, getService } = providerContext;
- describe.skip('Endpoint plugin', function () {
+ describe('Endpoint plugin', function () {
const ingestManager = getService('ingestManager');
this.tags('ciGroup7');
From 374ccfd66fcbfbbde29dd080bf805d58b7dc9d7a Mon Sep 17 00:00:00 2001
From: Wylie Conlon
Date: Fri, 2 Oct 2020 14:18:01 -0400
Subject: [PATCH 35/56] [Lens] Show runtime fields in field list and improve
performance (#79167)
* [Lens] Simplify request to determine existing fields
* Remove duplicate values
---
.../server/routes/existing_fields.test.ts | 131 ++--------------
.../lens/server/routes/existing_fields.ts | 142 ++----------------
.../apis/lens/existing_fields.ts | 5 +-
.../logstash_functional/mappings.json | 15 ++
.../es_archives/visualize/default/data.json | 2 +-
5 files changed, 47 insertions(+), 248 deletions(-)
diff --git a/x-pack/plugins/lens/server/routes/existing_fields.test.ts b/x-pack/plugins/lens/server/routes/existing_fields.test.ts
index 9799dcf92ae41..c877e69d7b0dd 100644
--- a/x-pack/plugins/lens/server/routes/existing_fields.test.ts
+++ b/x-pack/plugins/lens/server/routes/existing_fields.test.ts
@@ -14,99 +14,55 @@ describe('existingFields', () => {
return {
name,
isScript: false,
- isAlias: false,
isMeta: false,
- path: name.split('.'),
...obj,
};
}
- function indexPattern(_source: unknown, fields: unknown = {}) {
- return { _source, fields };
+ function searchResults(fields: Record = {}) {
+ return { fields };
}
it('should handle root level fields', () => {
const result = existingFields(
- [indexPattern({ foo: 'bar' }), indexPattern({ baz: 0 })],
+ [searchResults({ foo: ['bar'] }), searchResults({ baz: [0] })],
[field('foo'), field('bar'), field('baz')]
);
expect(result).toEqual(['foo', 'baz']);
});
- it('should handle arrays of objects', () => {
+ it('should handle basic arrays, ignoring empty ones', () => {
const result = existingFields(
- [indexPattern({ stuff: [{ foo: 'bar' }, { baz: 0 }] })],
- [field('stuff.foo'), field('stuff.bar'), field('stuff.baz')]
+ [searchResults({ stuff: ['heyo', 'there'], empty: [] })],
+ [field('stuff'), field('empty')]
);
- expect(result).toEqual(['stuff.foo', 'stuff.baz']);
- });
-
- it('should handle basic arrays', () => {
- const result = existingFields([indexPattern({ stuff: ['heyo', 'there'] })], [field('stuff')]);
-
expect(result).toEqual(['stuff']);
});
- it('should handle deep object structures', () => {
- const result = existingFields(
- [indexPattern({ geo: { coordinates: { lat: 40, lon: -77 } } })],
- [field('geo.coordinates')]
- );
-
- expect(result).toEqual(['geo.coordinates']);
- });
-
it('should handle objects with dotted fields', () => {
const result = existingFields(
- [indexPattern({ 'geo.country_name': 'US' })],
+ [searchResults({ 'geo.country_name': ['US'] })],
[field('geo.country_name')]
);
expect(result).toEqual(['geo.country_name']);
});
- it('should handle arrays with dotted fields on both sides', () => {
- const result = existingFields(
- [indexPattern({ 'process.cpu': [{ 'user.pct': 50 }] })],
- [field('process.cpu.user.pct')]
- );
-
- expect(result).toEqual(['process.cpu.user.pct']);
- });
-
- it('should be false if it hits a positive leaf before the end of the path', () => {
- const result = existingFields(
- [indexPattern({ geo: { coordinates: 32 } })],
- [field('geo.coordinates.lat')]
- );
-
- expect(result).toEqual([]);
- });
-
- it('should use path, not name', () => {
- const result = existingFields(
- [indexPattern({ stuff: [{ foo: 'bar' }, { baz: 0 }] })],
- [field({ name: 'goober', path: ['stuff', 'foo'] })]
- );
-
- expect(result).toEqual(['goober']);
- });
-
it('supports scripted fields', () => {
const result = existingFields(
- [indexPattern({}, { bar: 'scriptvalue' })],
- [field({ name: 'baz', isScript: true, path: ['bar'] })]
+ [searchResults({ bar: ['scriptvalue'] })],
+ [field({ name: 'bar', isScript: true })]
);
- expect(result).toEqual(['baz']);
+ expect(result).toEqual(['bar']);
});
it('supports meta fields', () => {
const result = existingFields(
- [{ _mymeta: 'abc', ...indexPattern({}, { bar: 'scriptvalue' }) }],
- [field({ name: '_mymeta', isMeta: true, path: ['_mymeta'] })]
+ [{ _mymeta: 'abc', ...searchResults({ bar: ['scriptvalue'] }) }],
+ [field({ name: '_mymeta', isMeta: true })]
);
expect(result).toEqual(['_mymeta']);
@@ -132,81 +88,22 @@ describe('buildFieldList', () => {
references: [],
};
- const mappings = {
- testpattern: {
- mappings: {
- properties: {
- '@bar': {
- type: 'alias',
- path: 'bar',
- },
- },
- },
- },
- };
-
- const fieldDescriptors = [
- {
- name: 'baz',
- subType: { multi: { parent: 'a.b.c' } },
- },
- ];
-
- it('uses field descriptors to determine the path', () => {
- const fields = buildFieldList(indexPattern, mappings, fieldDescriptors, []);
- expect(fields.find((f) => f.name === 'baz')).toMatchObject({
- isAlias: false,
- isScript: false,
- name: 'baz',
- path: ['a', 'b', 'c'],
- });
- });
-
- it('uses aliases to determine the path', () => {
- const fields = buildFieldList(indexPattern, mappings, fieldDescriptors, []);
- expect(fields.find((f) => f.isAlias)).toMatchObject({
- isAlias: true,
- isScript: false,
- name: '@bar',
- path: ['bar'],
- });
- });
-
it('supports scripted fields', () => {
- const fields = buildFieldList(indexPattern, mappings, fieldDescriptors, []);
+ const fields = buildFieldList(indexPattern, []);
expect(fields.find((f) => f.isScript)).toMatchObject({
- isAlias: false,
isScript: true,
name: 'foo',
- path: ['foo'],
lang: 'painless',
script: '2+2',
});
});
it('supports meta fields', () => {
- const fields = buildFieldList(indexPattern, mappings, fieldDescriptors, ['_mymeta']);
+ const fields = buildFieldList(indexPattern, ['_mymeta']);
expect(fields.find((f) => f.isMeta)).toMatchObject({
- isAlias: false,
isScript: false,
isMeta: true,
name: '_mymeta',
- path: ['_mymeta'],
- });
- });
-
- it('handles missing mappings', () => {
- const fields = buildFieldList(indexPattern, {}, fieldDescriptors, []);
- expect(fields.every((f) => f.isAlias === false)).toEqual(true);
- });
-
- it('handles empty fieldDescriptors by skipping multi-mappings', () => {
- const fields = buildFieldList(indexPattern, mappings, [], []);
- expect(fields.find((f) => f.name === 'baz')).toMatchObject({
- isAlias: false,
- isScript: false,
- name: 'baz',
- path: ['baz'],
});
});
});
diff --git a/x-pack/plugins/lens/server/routes/existing_fields.ts b/x-pack/plugins/lens/server/routes/existing_fields.ts
index 33fcafacfad73..c925517b572da 100644
--- a/x-pack/plugins/lens/server/routes/existing_fields.ts
+++ b/x-pack/plugins/lens/server/routes/existing_fields.ts
@@ -9,36 +9,17 @@ import { schema } from '@kbn/config-schema';
import { ILegacyScopedClusterClient, SavedObject, RequestHandlerContext } from 'src/core/server';
import { CoreSetup } from 'src/core/server';
import { BASE_API_URL } from '../../common';
-import {
- IndexPatternsFetcher,
- IndexPatternAttributes,
- UI_SETTINGS,
-} from '../../../../../src/plugins/data/server';
+import { IndexPatternAttributes, UI_SETTINGS } from '../../../../../src/plugins/data/server';
/**
* The number of docs to sample to determine field empty status.
*/
const SAMPLE_SIZE = 500;
-interface MappingResult {
- [indexPatternTitle: string]: {
- mappings: {
- properties: Record;
- };
- };
-}
-
-interface FieldDescriptor {
- name: string;
- subType?: { multi?: { parent?: string } };
-}
-
export interface Field {
name: string;
isScript: boolean;
- isAlias: boolean;
isMeta: boolean;
- path: string[];
lang?: string;
script?: string;
}
@@ -105,14 +86,12 @@ async function fetchFieldExistence({
timeFieldName?: string;
}) {
const metaFields: string[] = await context.core.uiSettings.client.get(UI_SETTINGS.META_FIELDS);
- const {
- indexPattern,
- indexPatternTitle,
- mappings,
- fieldDescriptors,
- } = await fetchIndexPatternDefinition(indexPatternId, context, metaFields);
+ const { indexPattern, indexPatternTitle } = await fetchIndexPatternDefinition(
+ indexPatternId,
+ context
+ );
- const fields = buildFieldList(indexPattern, mappings, fieldDescriptors, metaFields);
+ const fields = buildFieldList(indexPattern, metaFields);
const docs = await fetchIndexPatternStats({
fromDate,
toDate,
@@ -129,51 +108,17 @@ async function fetchFieldExistence({
};
}
-async function fetchIndexPatternDefinition(
- indexPatternId: string,
- context: RequestHandlerContext,
- metaFields: string[]
-) {
+async function fetchIndexPatternDefinition(indexPatternId: string, context: RequestHandlerContext) {
const savedObjectsClient = context.core.savedObjects.client;
- const requestClient = context.core.elasticsearch.legacy.client;
const indexPattern = await savedObjectsClient.get(
'index-pattern',
indexPatternId
);
const indexPatternTitle = indexPattern.attributes.title;
- if (indexPatternTitle.includes(':')) {
- // Cross cluster search patterns include a colon, and we aren't able to fetch
- // mapping information.
- return {
- indexPattern,
- indexPatternTitle,
- mappings: {},
- fieldDescriptors: [],
- };
- }
-
- // TODO: maybe don't use IndexPatternsFetcher at all, since we're only using it
- // to look up field values in the resulting documents. We can accomplish the same
- // using the mappings which we're also fetching here.
- const indexPatternsFetcher = new IndexPatternsFetcher(requestClient.callAsCurrentUser);
- const [mappings, fieldDescriptors] = await Promise.all([
- requestClient.callAsCurrentUser('indices.getMapping', {
- index: indexPatternTitle,
- }),
-
- indexPatternsFetcher.getFieldsForWildcard({
- pattern: indexPatternTitle,
- // TODO: Pull this from kibana advanced settings
- metaFields,
- }),
- ]);
-
return {
indexPattern,
indexPatternTitle,
- mappings,
- fieldDescriptors,
};
}
@@ -182,32 +127,13 @@ async function fetchIndexPatternDefinition(
*/
export function buildFieldList(
indexPattern: SavedObject,
- mappings: MappingResult | {},
- fieldDescriptors: FieldDescriptor[],
metaFields: string[]
): Field[] {
- const aliasMap = Object.entries(Object.values(mappings)[0]?.mappings.properties ?? {})
- .map(([name, v]) => ({ ...v, name }))
- .filter((f) => f.type === 'alias')
- .reduce((acc, f) => {
- acc[f.name] = f.path;
- return acc;
- }, {} as Record);
-
- const descriptorMap = fieldDescriptors.reduce((acc, f) => {
- acc[f.name] = f;
- return acc;
- }, {} as Record);
-
return JSON.parse(indexPattern.attributes.fields).map(
(field: { name: string; lang: string; scripted?: boolean; script?: string }) => {
- const path =
- aliasMap[field.name] || descriptorMap[field.name]?.subType?.multi?.parent || field.name;
return {
name: field.name,
isScript: !!field.scripted,
- isAlias: !!aliasMap[field.name],
- path: path.split('.'),
lang: field.lang,
script: field.script,
// id is a special case - it doesn't show up in the meta field list,
@@ -263,8 +189,8 @@ async function fetchIndexPatternStats({
size: SAMPLE_SIZE,
query,
sort: timeFieldName && fromDate && toDate ? [{ [timeFieldName]: 'desc' }] : [],
- // _source is required because we are also providing script fields.
- _source: '*',
+ fields: ['*'],
+ _source: false,
script_fields: scriptedFields.reduce((acc, field) => {
acc[field.name] = {
script: {
@@ -279,49 +205,11 @@ async function fetchIndexPatternStats({
return result.hits.hits;
}
-// Recursive function to determine if the _source of a document
-// contains a known path.
-function exists(obj: unknown, path: string[], i = 0): boolean {
- if (obj == null) {
- return false;
- }
-
- if (path.length === i) {
- return true;
- }
-
- if (Array.isArray(obj)) {
- return obj.some((child) => exists(child, path, i));
- }
-
- if (typeof obj === 'object') {
- // Because Elasticsearch flattens paths, dots in the field name are allowed
- // as JSON keys. For example, { 'a.b': 10 }
- const partialKeyMatches = Object.getOwnPropertyNames(obj)
- .map((key) => key.split('.'))
- .filter((keyPaths) => keyPaths.every((key, keyIndex) => key === path[keyIndex + i]));
-
- if (partialKeyMatches.length) {
- return partialKeyMatches.every((keyPaths) => {
- return exists(
- (obj as Record)[keyPaths.join('.')],
- path,
- i + keyPaths.length
- );
- });
- }
-
- return exists((obj as Record)[path[i]], path, i + 1);
- }
-
- return path.length === i;
-}
-
/**
* Exported only for unit tests.
*/
export function existingFields(
- docs: Array<{ _source: unknown; fields: unknown; [key: string]: unknown }>,
+ docs: Array<{ fields: Record; [key: string]: unknown }>,
fields: Field[]
): string[] {
const missingFields = new Set(fields);
@@ -332,14 +220,14 @@ export function existingFields(
}
missingFields.forEach((field) => {
- let fieldStore = doc._source;
- if (field.isScript) {
- fieldStore = doc.fields;
- }
+ let fieldStore: Record = doc.fields;
if (field.isMeta) {
fieldStore = doc;
}
- if (exists(fieldStore, field.path)) {
+ const value = fieldStore[field.name];
+ if (Array.isArray(value) && value.length) {
+ missingFields.delete(field);
+ } else if (!Array.isArray(value) && value) {
missingFields.delete(field);
}
});
diff --git a/x-pack/test/api_integration/apis/lens/existing_fields.ts b/x-pack/test/api_integration/apis/lens/existing_fields.ts
index 10ee7bc9b48ea..08806df380f38 100644
--- a/x-pack/test/api_integration/apis/lens/existing_fields.ts
+++ b/x-pack/test/api_integration/apis/lens/existing_fields.ts
@@ -22,7 +22,6 @@ const fieldsWithData = [
'@timestamp',
'_id',
'_index',
- '_source',
'agent',
'agent.raw',
'bytes',
@@ -60,6 +59,7 @@ const fieldsWithData = [
'utc_time',
'xss',
'xss.raw',
+ 'runtime_number',
'relatedContent.article:modified_time',
'relatedContent.article:published_time',
@@ -101,7 +101,6 @@ const metricBeatData = [
'@timestamp',
'_id',
'_index',
- '_source',
'agent.ephemeral_id',
'agent.hostname',
'agent.id',
@@ -193,7 +192,6 @@ export default ({ getService }: FtrProviderContext) => {
'@timestamp',
'_id',
'_index',
- '_source',
'agent',
'agent.raw',
'bytes',
@@ -211,6 +209,7 @@ export default ({ getService }: FtrProviderContext) => {
'request.raw',
'response',
'response.raw',
+ 'runtime_number',
'spaces',
'spaces.raw',
'type',
diff --git a/x-pack/test/functional/es_archives/logstash_functional/mappings.json b/x-pack/test/functional/es_archives/logstash_functional/mappings.json
index dcfafa2612c5b..ee7feedd77530 100644
--- a/x-pack/test/functional/es_archives/logstash_functional/mappings.json
+++ b/x-pack/test/functional/es_archives/logstash_functional/mappings.json
@@ -342,6 +342,11 @@
}
},
"type": "text"
+ },
+ "runtime_number": {
+ "type": "runtime",
+ "runtime_type" : "long",
+ "script" : { "source" : "emit(doc['bytes'].value)" }
}
}
},
@@ -707,6 +712,11 @@
}
},
"type": "text"
+ },
+ "runtime_number": {
+ "type": "runtime",
+ "runtime_type" : "long",
+ "script" : { "source" : "emit(doc['bytes'].value)" }
}
}
},
@@ -1072,6 +1082,11 @@
}
},
"type": "text"
+ },
+ "runtime_number": {
+ "type": "runtime",
+ "runtime_type" : "long",
+ "script" : { "source" : "emit(doc['bytes'].value)" }
}
}
},
diff --git a/x-pack/test/functional/es_archives/visualize/default/data.json b/x-pack/test/functional/es_archives/visualize/default/data.json
index f72a61c9e3b85..5b5ee355c7086 100644
--- a/x-pack/test/functional/es_archives/visualize/default/data.json
+++ b/x-pack/test/functional/es_archives/visualize/default/data.json
@@ -152,7 +152,7 @@
"index-pattern": {
"title": "logstash-*",
"timeFieldName": "@timestamp",
- "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]"
+ "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"runtime_number\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false}]"
},
"type": "index-pattern",
"migrationVersion": {
From 7cfdeaeedeb1bd81b436c6ec1b22e1f033f509d4 Mon Sep 17 00:00:00 2001
From: Ryland Herrick
Date: Fri, 2 Oct 2020 13:19:02 -0500
Subject: [PATCH 36/56] [Security Solution][Detections] EQL Validation (#77493)
* WIP: Adding new route for EQL Validation
This is mostly boilerplate with some rough parameter definitions; the
actual implementation of the validation is going to live in our
validateEql function.
A few tests are failing as the mocks haven't yet been implemented, I
need to see the shape of the responses first.
* Cherry-pick Marshall's EQL types
* Implements actual EQL validation
* Performs an EQL search
* filters out non-parsing errors, and returns what remains in the
response
* Adds mocks for empty EQL responses (we don't yet have a need for
mocked data, but we will when we unit-test validateEql)
* Adds validation calls to the EQL form input
* Adds EQL Validation response schema,mocks,tests
* Adds frontend function to call our validation endpoint
* Adds hook, useEqlValidation, to call the above function and return
state
* Adds labels/help text for EQL Query bar
* EqlQueryBar consumes useEqlValidation and marks the field as invalid,
but does not yet report errors.
* Do not call the validation API if query is not present
This causes a broader error that results in a 400 response; we can (and
do) handle the case of a blank query in the form itself.
* Remove EQL Help Text
It doesn't add any information for the user, and it currently looks bad
when combined with validation errors.
* Flesh out and use our popover for displaying validation errors
* Fixes issue where old errors were persisted after the user had made
modifications
* Include verification_exception errors as validation errors
These include errors related to index fields and mappings.
* Generalize our validation helpers
We're concerned with validation errors; the source of those errors is an
implementation detail of these functions.
* Move error popover and EQL reference link to footer
This more closely resembles the new Eui Markdown editor, which places
errors and doc links in a footer.
* Fix jest tests following additional prop
* Add icon for EQL Rule card
* Fixes existing EqlQueryBar tests
These were broken by our use of useAppToasts and the EUI theme.
* Add unit tests around error rendering on EQL Query Bar
* Add tests for ErrorPopover
* Remove unused schema type
Decode doesn't do any additional processing, so we can use t.TypeOf here
(the default for buildRouteValidation).
* Remove duplicated header
* Use ignore parameter to prevent EQL validations from logging errors
Without `ignore: [400]` the ES client will log errors and then throw
them. We can catch the error, but the log is undesirable.
This updates the query to use the ignore parameter, along with updating
the validation logic to work with the updated response.
Adds some mocks and tests around these responses and helpers, since
these will exist independent of the validation implementation.
* Include mapping_exceptions during EQL query validation
These include errors for inaccessible indexes, which should be useful to
the rule writer in writing their EQL query.
* Display toast messages for non-validation messages
* fix type errors
This type was renamed.
* Do not request data in our validation request
By not having the cluster retrieve/send any data, this should saves us
a few CPU cycles.
* Move EQL validation to an async form validator
Rather than invoking a custom validation hook (useEqlValidation) at custom times (onBlur) in our EqlQueryBar
component, we can instead move this functionality to a form validation
function and have it be invoked automatically by our form when values
change. However, because we still need to handle the validation messages
slightly differently (place them in a popover as opposed to an
EuiFormRow), we also need custom error retrieval in the form of
getValidationResults.
After much pain, it was determined that the default behavior of
_.debounce does not work with async validator functions, as a debounced
call will not "wait" for the eventual invocation but will instead return
the most recently resolved value. This leads to stale validation
results and terrible UX, so I wrote a custom function (debounceAsync)
that behaves like we want/need; see tests for details.
* Invalidate our query field when index patterns change
Since EQL rules actually validate against the relevant indexes, changing
said indexes should invalidate/revalidate the query.
With the form lib, this is beautifully simple :)
* Set a min-height on our EQL textarea
* Remove unused prop from EqlQueryBar
Index corresponds to the value from the index field; now that our EQL
validation is performed by the form we have no need for it here.
* Update EQL overview link to point to elasticsearch docs
Adds an entry in our doclinks service, and uses that.
* Remove unused prop from stale tests
* Update docLinks documentation with new EQL link
* Fix bug where saved query rules had no type selected on Edit
* Wait for kibana requests to complete before moving between rule tabs
With our new async validation, a user can quickly navigate away from the
Definition tab before the validation has completed, resulting in the
form being invalidated. Any subsequent user actions cause the form to
correct itself, but until I can find a better solution here this really
just gives the validation time to complete and sidesteps the issue.
---
...-plugin-core-public.doclinksstart.links.md | 1 +
...kibana-plugin-core-public.doclinksstart.md | 2 +-
.../public/doc_links/doc_links_service.ts | 2 +
src/core/public/public.api.md | 1 +
.../security_solution/common/constants.ts | 1 +
.../request/eql_validation_schema.mock.ts | 12 ++
.../request/eql_validation_schema.test.ts | 59 ++++++++++
.../schemas/request/eql_validation_schema.ts | 18 +++
.../response/eql_validation_schema.mock.ts | 17 +++
.../response/eql_validation_schema.test.ts | 59 ++++++++++
.../schemas/response/eql_validation_schema.ts | 16 +++
.../common/detection_engine/utils.ts | 3 +-
.../alerts_detection_rules_custom.spec.ts | 3 +-
.../cypress/screens/edit_rule.ts | 2 +
.../cypress/tasks/edit_rule.ts | 6 +-
.../public/common/hooks/eql/api.ts | 31 ++++++
.../rules/eql_query_bar/eql_overview_link.tsx | 26 +++++
.../eql_query_bar/eql_query_bar.test.tsx | 37 +++++-
.../rules/eql_query_bar/eql_query_bar.tsx | 53 +++++++--
.../eql_query_bar/errors_popover.test.tsx | 50 +++++++++
.../rules/eql_query_bar/errors_popover.tsx | 55 +++++++++
.../components/rules/eql_query_bar/footer.tsx | 42 +++++++
.../rules/eql_query_bar/translations.ts | 42 +++++++
.../rules/eql_query_bar/validators.mock.ts | 19 ++++
.../rules/eql_query_bar/validators.test.ts | 52 +++++++++
.../rules/eql_query_bar/validators.ts | 105 ++++++++++++++++++
.../select_rule_type/eql_search_icon.svg | 6 +
.../rules/select_rule_type/index.tsx | 5 +-
.../rules/step_define_rule/index.tsx | 5 +
.../rules/step_define_rule/schema.tsx | 13 +--
.../rules/step_define_rule/translations.tsx | 14 +++
.../public/shared_imports.ts | 1 +
.../routes/__mocks__/request_context.ts | 5 +-
.../routes/__mocks__/request_responses.ts | 27 ++++-
.../routes/eql/helpers.mock.ts | 69 ++++++++++++
.../routes/eql/helpers.test.ts | 58 ++++++++++
.../detection_engine/routes/eql/helpers.ts | 35 ++++++
.../routes/eql/validate_eql.ts | 46 ++++++++
.../routes/eql/validation_route.test.ts | 53 +++++++++
.../routes/eql/validation_route.ts | 49 ++++++++
.../security_solution/server/routes/index.ts | 4 +
41 files changed, 1075 insertions(+), 29 deletions(-)
create mode 100644 x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.mock.ts
create mode 100644 x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.test.ts
create mode 100644 x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.ts
create mode 100644 x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.mock.ts
create mode 100644 x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.test.ts
create mode 100644 x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.ts
create mode 100644 x-pack/plugins/security_solution/public/common/hooks/eql/api.ts
create mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_overview_link.tsx
create mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/errors_popover.test.tsx
create mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/errors_popover.tsx
create mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/footer.tsx
create mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/translations.ts
create mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.mock.ts
create mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.test.ts
create mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.ts
create mode 100644 x-pack/plugins/security_solution/public/detections/components/rules/select_rule_type/eql_search_icon.svg
create mode 100644 x-pack/plugins/security_solution/server/lib/detection_engine/routes/eql/helpers.mock.ts
create mode 100644 x-pack/plugins/security_solution/server/lib/detection_engine/routes/eql/helpers.test.ts
create mode 100644 x-pack/plugins/security_solution/server/lib/detection_engine/routes/eql/helpers.ts
create mode 100644 x-pack/plugins/security_solution/server/lib/detection_engine/routes/eql/validate_eql.ts
create mode 100644 x-pack/plugins/security_solution/server/lib/detection_engine/routes/eql/validation_route.test.ts
create mode 100644 x-pack/plugins/security_solution/server/lib/detection_engine/routes/eql/validation_route.ts
diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md
index f7b55b0650d8b..3afd5eaa6f1f7 100644
--- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md
+++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md
@@ -91,6 +91,7 @@ readonly links: {
readonly gettingStarted: string;
};
readonly query: {
+ readonly eql: string;
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md
index 3f58cf08ee6b6..5249381969b98 100644
--- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md
+++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md
@@ -17,5 +17,5 @@ export interface DocLinksStart
| --- | --- | --- |
| [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md) | string
| |
| [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md) | string
| |
-| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly dashboard: {
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly date_histogram: string;
readonly date_range: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessSyntax: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly loadingData: string;
readonly introduction: string;
};
readonly addData: string;
readonly kibana: string;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
};
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
readonly visualize: Record<string, string>;
}
| |
+| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly dashboard: {
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly date_histogram: string;
readonly date_range: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessSyntax: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly loadingData: string;
readonly introduction: string;
};
readonly addData: string;
readonly kibana: string;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly eql: string;
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
};
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
readonly visualize: Record<string, string>;
}
| |
diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts
index 47f58a3a9fcbf..629bf97c24887 100644
--- a/src/core/public/doc_links/doc_links_service.ts
+++ b/src/core/public/doc_links/doc_links_service.ts
@@ -119,6 +119,7 @@ export class DocLinksService {
gettingStarted: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/index.html`,
},
query: {
+ eql: `${ELASTICSEARCH_DOCS}eql.html`,
luceneQuerySyntax: `${ELASTICSEARCH_DOCS}query-dsl-query-string-query.html#query-string-syntax`,
queryDsl: `${ELASTICSEARCH_DOCS}query-dsl.html`,
kueryQuerySyntax: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/kuery-query.html`,
@@ -227,6 +228,7 @@ export interface DocLinksStart {
readonly gettingStarted: string;
};
readonly query: {
+ readonly eql: string;
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md
index 5970c9a8571c4..08491dc76cd27 100644
--- a/src/core/public/public.api.md
+++ b/src/core/public/public.api.md
@@ -539,6 +539,7 @@ export interface DocLinksStart {
readonly gettingStarted: string;
};
readonly query: {
+ readonly eql: string;
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
diff --git a/x-pack/plugins/security_solution/common/constants.ts b/x-pack/plugins/security_solution/common/constants.ts
index 2910f02a187f4..e46bd9e28d8c4 100644
--- a/x-pack/plugins/security_solution/common/constants.ts
+++ b/x-pack/plugins/security_solution/common/constants.ts
@@ -117,6 +117,7 @@ export const DETECTION_ENGINE_PREPACKAGED_URL = `${DETECTION_ENGINE_RULES_URL}/p
export const DETECTION_ENGINE_PRIVILEGES_URL = `${DETECTION_ENGINE_URL}/privileges`;
export const DETECTION_ENGINE_INDEX_URL = `${DETECTION_ENGINE_URL}/index`;
export const DETECTION_ENGINE_TAGS_URL = `${DETECTION_ENGINE_URL}/tags`;
+export const DETECTION_ENGINE_EQL_VALIDATION_URL = `${DETECTION_ENGINE_URL}/validate_eql`;
export const DETECTION_ENGINE_RULES_STATUS_URL = `${DETECTION_ENGINE_RULES_URL}/_find_statuses`;
export const DETECTION_ENGINE_PREPACKAGED_RULES_STATUS_URL = `${DETECTION_ENGINE_RULES_URL}/prepackaged/_status`;
diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.mock.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.mock.ts
new file mode 100644
index 0000000000000..96afc0c85df44
--- /dev/null
+++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.mock.ts
@@ -0,0 +1,12 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { EqlValidationSchema } from './eql_validation_schema';
+
+export const getEqlValidationSchemaMock = (): EqlValidationSchema => ({
+ index: ['index-123'],
+ query: 'process where process.name == "regsvr32.exe"',
+});
diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.test.ts
new file mode 100644
index 0000000000000..84bb8e067bf75
--- /dev/null
+++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.test.ts
@@ -0,0 +1,59 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { pipe } from 'fp-ts/lib/pipeable';
+import { left } from 'fp-ts/lib/Either';
+
+import { exactCheck } from '../../../exact_check';
+import { foldLeftRight, getPaths } from '../../../test_utils';
+import { eqlValidationSchema, EqlValidationSchema } from './eql_validation_schema';
+import { getEqlValidationSchemaMock } from './eql_validation_schema.mock';
+
+describe('EQL validation schema', () => {
+ it('requires a value for index', () => {
+ const payload = {
+ ...getEqlValidationSchemaMock(),
+ index: undefined,
+ };
+ const decoded = eqlValidationSchema.decode(payload);
+ const checked = exactCheck(payload, decoded);
+ const message = pipe(checked, foldLeftRight);
+
+ expect(getPaths(left(message.errors))).toEqual([
+ 'Invalid value "undefined" supplied to "index"',
+ ]);
+ expect(message.schema).toEqual({});
+ });
+
+ it('requires a value for query', () => {
+ const payload = {
+ ...getEqlValidationSchemaMock(),
+ query: undefined,
+ };
+ const decoded = eqlValidationSchema.decode(payload);
+ const checked = exactCheck(payload, decoded);
+ const message = pipe(checked, foldLeftRight);
+
+ expect(getPaths(left(message.errors))).toEqual([
+ 'Invalid value "undefined" supplied to "query"',
+ ]);
+ expect(message.schema).toEqual({});
+ });
+
+ it('validates a payload with index and query', () => {
+ const payload = getEqlValidationSchemaMock();
+ const decoded = eqlValidationSchema.decode(payload);
+ const checked = exactCheck(payload, decoded);
+ const message = pipe(checked, foldLeftRight);
+ const expected: EqlValidationSchema = {
+ index: ['index-123'],
+ query: 'process where process.name == "regsvr32.exe"',
+ };
+
+ expect(getPaths(left(message.errors))).toEqual([]);
+ expect(message.schema).toEqual(expected);
+ });
+});
diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.ts
new file mode 100644
index 0000000000000..abbbe33a32258
--- /dev/null
+++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/eql_validation_schema.ts
@@ -0,0 +1,18 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import * as t from 'io-ts';
+
+import { index, query } from '../common/schemas';
+
+export const eqlValidationSchema = t.exact(
+ t.type({
+ index,
+ query,
+ })
+);
+
+export type EqlValidationSchema = t.TypeOf;
diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.mock.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.mock.ts
new file mode 100644
index 0000000000000..98e5db47253fb
--- /dev/null
+++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.mock.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { EqlValidationSchema } from './eql_validation_schema';
+
+export const getEqlValidationResponseMock = (): EqlValidationSchema => ({
+ valid: false,
+ errors: ['line 3:52: token recognition error at: '],
+});
+
+export const getValidEqlValidationResponseMock = (): EqlValidationSchema => ({
+ valid: true,
+ errors: [],
+});
diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.test.ts
new file mode 100644
index 0000000000000..939238e340cff
--- /dev/null
+++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.test.ts
@@ -0,0 +1,59 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { pipe } from 'fp-ts/lib/pipeable';
+import { left } from 'fp-ts/lib/Either';
+
+import { exactCheck } from '../../../exact_check';
+import { foldLeftRight, getPaths } from '../../../test_utils';
+import { getEqlValidationResponseMock } from './eql_validation_schema.mock';
+import { eqlValidationSchema } from './eql_validation_schema';
+
+describe('EQL validation response schema', () => {
+ it('validates a typical response', () => {
+ const payload = getEqlValidationResponseMock();
+ const decoded = eqlValidationSchema.decode(payload);
+ const checked = exactCheck(payload, decoded);
+ const message = pipe(checked, foldLeftRight);
+
+ expect(getPaths(left(message.errors))).toEqual([]);
+ expect(message.schema).toEqual(getEqlValidationResponseMock());
+ });
+
+ it('invalidates a response with extra properties', () => {
+ const payload = { ...getEqlValidationResponseMock(), extra: 'nope' };
+ const decoded = eqlValidationSchema.decode(payload);
+ const checked = exactCheck(payload, decoded);
+ const message = pipe(checked, foldLeftRight);
+
+ expect(getPaths(left(message.errors))).toEqual(['invalid keys "extra"']);
+ expect(message.schema).toEqual({});
+ });
+
+ it('invalidates a response with missing properties', () => {
+ const payload = { ...getEqlValidationResponseMock(), valid: undefined };
+ const decoded = eqlValidationSchema.decode(payload);
+ const checked = exactCheck(payload, decoded);
+ const message = pipe(checked, foldLeftRight);
+
+ expect(getPaths(left(message.errors))).toEqual([
+ 'Invalid value "undefined" supplied to "valid"',
+ ]);
+ expect(message.schema).toEqual({});
+ });
+
+ it('invalidates a response with properties of the wrong type', () => {
+ const payload = { ...getEqlValidationResponseMock(), errors: 'should be an array' };
+ const decoded = eqlValidationSchema.decode(payload);
+ const checked = exactCheck(payload, decoded);
+ const message = pipe(checked, foldLeftRight);
+
+ expect(getPaths(left(message.errors))).toEqual([
+ 'Invalid value "should be an array" supplied to "errors"',
+ ]);
+ expect(message.schema).toEqual({});
+ });
+});
diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.ts
new file mode 100644
index 0000000000000..e999e1dd273f8
--- /dev/null
+++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/response/eql_validation_schema.ts
@@ -0,0 +1,16 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import * as t from 'io-ts';
+
+export const eqlValidationSchema = t.exact(
+ t.type({
+ valid: t.boolean,
+ errors: t.array(t.string),
+ })
+);
+
+export type EqlValidationSchema = t.TypeOf;
diff --git a/x-pack/plugins/security_solution/common/detection_engine/utils.ts b/x-pack/plugins/security_solution/common/detection_engine/utils.ts
index f76417099bb17..d7b23755699f5 100644
--- a/x-pack/plugins/security_solution/common/detection_engine/utils.ts
+++ b/x-pack/plugins/security_solution/common/detection_engine/utils.ts
@@ -19,5 +19,6 @@ export const hasNestedEntry = (entries: EntriesArray): boolean => {
export const isEqlRule = (ruleType: Type | undefined): boolean => ruleType === 'eql';
export const isThresholdRule = (ruleType: Type | undefined): boolean => ruleType === 'threshold';
-export const isQueryRule = (ruleType: Type | undefined): boolean => ruleType === 'query';
+export const isQueryRule = (ruleType: Type | undefined): boolean =>
+ ruleType === 'query' || ruleType === 'saved_query';
export const isThreatMatchRule = (ruleType: Type): boolean => ruleType === 'threat_match';
diff --git a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_custom.spec.ts b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_custom.spec.ts
index f999c5cecc392..d8832dc4ee600 100644
--- a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_custom.spec.ts
+++ b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_custom.spec.ts
@@ -93,7 +93,7 @@ import {
goToScheduleStepTab,
waitForTheRuleToBeExecuted,
} from '../tasks/create_new_rule';
-import { saveEditedRule } from '../tasks/edit_rule';
+import { saveEditedRule, waitForKibana } from '../tasks/edit_rule';
import { esArchiverLoad, esArchiverUnload } from '../tasks/es_archiver';
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';
import { refreshPage } from '../tasks/security_header';
@@ -290,6 +290,7 @@ describe('Custom detection rules deletion and edition', () => {
context('Edition', () => {
it('Allows a rule to be edited', () => {
editFirstRule();
+ waitForKibana();
// expect define step to populate
cy.get(CUSTOM_QUERY_INPUT).should('have.text', existingRule.customQuery);
diff --git a/x-pack/plugins/security_solution/cypress/screens/edit_rule.ts b/x-pack/plugins/security_solution/cypress/screens/edit_rule.ts
index 1bf0ff34ebd94..e25eb7453c63c 100644
--- a/x-pack/plugins/security_solution/cypress/screens/edit_rule.ts
+++ b/x-pack/plugins/security_solution/cypress/screens/edit_rule.ts
@@ -5,3 +5,5 @@
*/
export const EDIT_SUBMIT_BUTTON = '[data-test-subj="ruleEditSubmitButton"]';
+export const KIBANA_LOADING_INDICATOR = '[data-test-subj="globalLoadingIndicator"]';
+export const KIBANA_LOADING_COMPLETE_INDICATOR = '[data-test-subj="globalLoadingIndicator-hidden"]';
diff --git a/x-pack/plugins/security_solution/cypress/tasks/edit_rule.ts b/x-pack/plugins/security_solution/cypress/tasks/edit_rule.ts
index 690a36058ec33..2dc1318ccb81d 100644
--- a/x-pack/plugins/security_solution/cypress/tasks/edit_rule.ts
+++ b/x-pack/plugins/security_solution/cypress/tasks/edit_rule.ts
@@ -4,9 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { EDIT_SUBMIT_BUTTON } from '../screens/edit_rule';
+import { EDIT_SUBMIT_BUTTON, KIBANA_LOADING_COMPLETE_INDICATOR } from '../screens/edit_rule';
export const saveEditedRule = () => {
cy.get(EDIT_SUBMIT_BUTTON).should('exist').click({ force: true });
cy.get(EDIT_SUBMIT_BUTTON).should('not.exist');
};
+
+export const waitForKibana = () => {
+ cy.get(KIBANA_LOADING_COMPLETE_INDICATOR).should('exist');
+};
diff --git a/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts b/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts
new file mode 100644
index 0000000000000..11fe79910bc87
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts
@@ -0,0 +1,31 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { HttpStart } from '../../../../../../../src/core/public';
+import { DETECTION_ENGINE_EQL_VALIDATION_URL } from '../../../../common/constants';
+import { EqlValidationSchema as EqlValidationRequest } from '../../../../common/detection_engine/schemas/request/eql_validation_schema';
+import { EqlValidationSchema as EqlValidationResponse } from '../../../../common/detection_engine/schemas/response/eql_validation_schema';
+
+interface ApiParams {
+ http: HttpStart;
+ signal: AbortSignal;
+}
+
+export const validateEql = async ({
+ http,
+ query,
+ index,
+ signal,
+}: ApiParams & EqlValidationRequest) => {
+ return http.fetch(DETECTION_ENGINE_EQL_VALIDATION_URL, {
+ method: 'POST',
+ body: JSON.stringify({
+ query,
+ index,
+ }),
+ signal,
+ });
+};
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_overview_link.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_overview_link.tsx
new file mode 100644
index 0000000000000..e9891fc066ec2
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_overview_link.tsx
@@ -0,0 +1,26 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import React from 'react';
+import styled from 'styled-components';
+import { EuiLink, EuiText } from '@elastic/eui';
+
+import { useKibana } from '../../../../common/lib/kibana';
+import { EQL_OVERVIEW_LINK_TEXT } from './translations';
+
+const InlineText = styled(EuiText)`
+ display: inline-block;
+`;
+
+export const EqlOverviewLink = () => {
+ const overviewUrl = useKibana().services.docLinks.links.query.eql;
+
+ return (
+
+ {EQL_OVERVIEW_LINK_TEXT}
+
+ );
+};
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_query_bar.test.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_query_bar.test.tsx
index 331c0ba4c4491..5539e5eb2c294 100644
--- a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_query_bar.test.tsx
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_query_bar.test.tsx
@@ -7,9 +7,12 @@
import React from 'react';
import { shallow, mount } from 'enzyme';
-import { useFormFieldMock } from '../../../../common/mock';
+import { TestProviders, useFormFieldMock } from '../../../../common/mock';
import { mockQueryBar } from '../../../pages/detection_engine/rules/all/__mocks__/mock';
import { EqlQueryBar, EqlQueryBarProps } from './eql_query_bar';
+import { getEqlValidationError } from './validators.mock';
+
+jest.mock('../../../../common/lib/kibana');
describe('EqlQueryBar', () => {
let mockField: EqlQueryBarProps['field'];
@@ -27,7 +30,11 @@ describe('EqlQueryBar', () => {
});
it('sets the field value on input change', () => {
- const wrapper = mount( );
+ const wrapper = mount(
+
+
+
+ );
wrapper
.find('[data-test-subj="eqlQueryBarTextInput"]')
@@ -44,4 +51,30 @@ describe('EqlQueryBar', () => {
expect(mockField.setValue).toHaveBeenCalledWith(expected);
});
+
+ it('does not render errors for a valid query', () => {
+ const wrapper = mount(
+
+
+
+ );
+
+ expect(wrapper.find('[data-test-subj="eql-validation-errors-popover"]').exists()).toEqual(
+ false
+ );
+ });
+
+ it('renders errors for an invalid query', () => {
+ const invalidMockField = useFormFieldMock({
+ value: mockQueryBar,
+ errors: [getEqlValidationError()],
+ });
+ const wrapper = mount(
+
+
+
+ );
+
+ expect(wrapper.find('[data-test-subj="eql-validation-errors-popover"]').exists()).toEqual(true);
+ });
});
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_query_bar.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_query_bar.tsx
index e3f33ea9b9b87..f7ee5be18154c 100644
--- a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_query_bar.tsx
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/eql_query_bar.tsx
@@ -4,11 +4,24 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import React, { FC, useCallback, ChangeEvent } from 'react';
+import React, { FC, useCallback, ChangeEvent, useEffect, useState } from 'react';
+import styled from 'styled-components';
import { EuiFormRow, EuiTextArea } from '@elastic/eui';
-import { FieldHook, getFieldValidityAndErrorMessage } from '../../../../shared_imports';
+import { FieldHook } from '../../../../shared_imports';
+import { useAppToasts } from '../../../../common/hooks/use_app_toasts';
import { DefineStepRule } from '../../../pages/detection_engine/rules/types';
+import * as i18n from './translations';
+import { EqlQueryBarFooter } from './footer';
+import { getValidationResults } from './validators';
+
+const TextArea = styled(EuiTextArea)`
+ display: block;
+ border: ${({ theme }) => theme.eui.euiBorderThin};
+ border-bottom: 0;
+ box-shadow: none;
+ min-height: ${({ theme }) => theme.eui.euiFormControlHeight};
+`;
export interface EqlQueryBarProps {
dataTestSubj: string;
@@ -17,14 +30,27 @@ export interface EqlQueryBarProps {
}
export const EqlQueryBar: FC = ({ dataTestSubj, field, idAria }) => {
+ const { addError } = useAppToasts();
+ const [errorMessages, setErrorMessages] = useState([]);
const { setValue } = field;
- const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field);
+ const { isValid, message, messages, error } = getValidationResults(field);
const fieldValue = field.value.query.query as string;
+ useEffect(() => {
+ setErrorMessages(messages ?? []);
+ }, [messages]);
+
+ useEffect(() => {
+ if (error) {
+ addError(error, { title: i18n.EQL_VALIDATION_REQUEST_ERROR });
+ }
+ }, [error, addError]);
+
const handleChange = useCallback(
(e: ChangeEvent) => {
const newQuery = e.target.value;
+ setErrorMessages([]);
setValue({
filters: [],
query: {
@@ -41,19 +67,22 @@ export const EqlQueryBar: FC = ({ dataTestSubj, field, idAria
label={field.label}
labelAppend={field.labelAppend}
helpText={field.helpText}
- error={errorMessage}
- isInvalid={isInvalid}
+ error={message}
+ isInvalid={!isValid}
fullWidth
data-test-subj={dataTestSubj}
describedByIds={idAria ? [idAria] : undefined}
>
-
+ <>
+
+
+ >
);
};
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/errors_popover.test.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/errors_popover.test.tsx
new file mode 100644
index 0000000000000..01bd8afd0e4ab
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/errors_popover.test.tsx
@@ -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;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import React from 'react';
+import { shallow, mount } from 'enzyme';
+
+import { ErrorsPopover } from './errors_popover';
+
+describe('ErrorsPopover', () => {
+ let mockErrors: string[];
+
+ beforeEach(() => {
+ mockErrors = [];
+ });
+
+ it('renders correctly', () => {
+ const wrapper = shallow( );
+
+ expect(wrapper.find('[data-test-subj="eql-validation-errors-popover"]')).toHaveLength(1);
+ });
+
+ it('renders the number of errors by default', () => {
+ mockErrors = ['error', 'other', 'third'];
+ const wrapper = mount( );
+ expect(
+ wrapper.find('[data-test-subj="eql-validation-errors-popover"]').first().text()
+ ).toContain('3');
+ });
+
+ it('renders the error messages if clicked', () => {
+ mockErrors = ['error', 'other'];
+ const wrapper = mount( );
+ wrapper
+ .find('[data-test-subj="eql-validation-errors-popover-button"]')
+ .first()
+ .simulate('click');
+
+ expect(
+ wrapper.find('[data-test-subj="eql-validation-errors-popover"]').first().text()
+ ).toContain('2');
+ const messagesContent = wrapper
+ .find('[data-test-subj="eql-validation-errors-popover-content"]')
+ .text();
+ expect(messagesContent).toContain('error');
+ expect(messagesContent).toContain('other');
+ });
+});
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/errors_popover.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/errors_popover.tsx
new file mode 100644
index 0000000000000..a7122b7dc65d8
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/errors_popover.tsx
@@ -0,0 +1,55 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import React, { FC, useCallback, useState } from 'react';
+import { EuiButtonEmpty, EuiPopover, EuiPopoverTitle, EuiText } from '@elastic/eui';
+
+import * as i18n from './translations';
+
+export interface ErrorsPopoverProps {
+ ariaLabel?: string;
+ errors: string[];
+}
+
+export const ErrorsPopover: FC = ({ ariaLabel, errors }) => {
+ const [isOpen, setIsOpen] = useState(false);
+
+ const handleToggle = useCallback(() => {
+ setIsOpen(!isOpen);
+ }, [isOpen]);
+
+ const handleClose = useCallback(() => {
+ setIsOpen(false);
+ }, []);
+
+ return (
+
+ {errors.length}
+
+ }
+ isOpen={isOpen}
+ closePopover={handleClose}
+ anchorPosition="downCenter"
+ >
+
+ {i18n.EQL_VALIDATION_ERRORS_TITLE}
+ {errors.map((message, idx) => (
+ {message}
+ ))}
+
+
+ );
+};
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/footer.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/footer.tsx
new file mode 100644
index 0000000000000..19bab26f8aa58
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/footer.tsx
@@ -0,0 +1,42 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import React, { FC } from 'react';
+import styled from 'styled-components';
+import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui';
+
+import * as i18n from './translations';
+import { ErrorsPopover } from './errors_popover';
+import { EqlOverviewLink } from './eql_overview_link';
+
+export interface Props {
+ errors: string[];
+}
+
+const Container = styled(EuiPanel)`
+ border-radius: 0;
+ background: ${({ theme }) => theme.eui.euiPageBackgroundColor};
+ padding: ${({ theme }) => theme.eui.euiSizeXS};
+`;
+
+const FlexGroup = styled(EuiFlexGroup)`
+ min-height: ${({ theme }) => theme.eui.euiSizeXL};
+`;
+
+export const EqlQueryBarFooter: FC = ({ errors }) => (
+
+
+
+ {errors.length > 0 && (
+
+ )}
+
+
+
+
+
+
+);
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/translations.ts b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/translations.ts
new file mode 100644
index 0000000000000..8b016d9ad68cb
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/translations.ts
@@ -0,0 +1,42 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { i18n } from '@kbn/i18n';
+
+export const EQL_VALIDATION_REQUEST_ERROR = i18n.translate(
+ 'xpack.securitySolution.detectionEngine.eqlValidation.requestError',
+ {
+ defaultMessage: 'An error occurred while validating your EQL query',
+ }
+);
+
+export const EQL_VALIDATION_ERRORS_TITLE = i18n.translate(
+ 'xpack.securitySolution.detectionEngine.eqlValidation.title',
+ {
+ defaultMessage: 'EQL Validation Errors',
+ }
+);
+
+export const EQL_VALIDATION_ERROR_POPOVER_LABEL = i18n.translate(
+ 'xpack.securitySolution.detectionEngine.eqlValidation.showErrorsLabel',
+ {
+ defaultMessage: 'Show EQL Validation Errors',
+ }
+);
+
+export const EQL_QUERY_BAR_LABEL = i18n.translate(
+ 'xpack.securitySolution.detectionEngine.eqlQueryBar.label',
+ {
+ defaultMessage: 'Enter an EQL Query',
+ }
+);
+
+export const EQL_OVERVIEW_LINK_TEXT = i18n.translate(
+ 'xpack.securitySolution.detectionEngine.eqlOverViewLink.text',
+ {
+ defaultMessage: 'Event Query Language (EQL) Overview',
+ }
+);
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.mock.ts b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.mock.ts
new file mode 100644
index 0000000000000..40e45b9c2d470
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.mock.ts
@@ -0,0 +1,19 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { ValidationError } from '../../../../shared_imports';
+import { ERROR_CODES } from './validators';
+
+export const getEqlResponseError = (): ValidationError => ({
+ code: ERROR_CODES.FAILED_REQUEST,
+ message: 'something went wrong',
+});
+
+export const getEqlValidationError = (): ValidationError => ({
+ code: ERROR_CODES.INVALID_EQL,
+ messages: ['line 1: WRONG\nline 2: ALSO WRONG'],
+ message: '',
+});
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.test.ts b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.test.ts
new file mode 100644
index 0000000000000..24afce7bb18b0
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.test.ts
@@ -0,0 +1,52 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { debounceAsync } from './validators';
+
+jest.useFakeTimers();
+
+describe('debounceAsync', () => {
+ let fn: jest.Mock;
+
+ beforeEach(() => {
+ fn = jest.fn().mockResolvedValueOnce('first');
+ });
+
+ it('resolves with the underlying invocation result', async () => {
+ const debounced = debounceAsync(fn, 0);
+ const promise = debounced();
+ jest.runOnlyPendingTimers();
+
+ expect(await promise).toEqual('first');
+ });
+
+ it('resolves intermediate calls when the next invocation resolves', async () => {
+ const debounced = debounceAsync(fn, 200);
+ fn.mockResolvedValueOnce('second');
+
+ const promise = debounced();
+ jest.runOnlyPendingTimers();
+ expect(await promise).toEqual('first');
+
+ const promises = [debounced(), debounced()];
+ jest.runOnlyPendingTimers();
+
+ expect(await Promise.all(promises)).toEqual(['second', 'second']);
+ });
+
+ it('debounces the function', async () => {
+ const debounced = debounceAsync(fn, 200);
+
+ debounced();
+ jest.runOnlyPendingTimers();
+
+ debounced();
+ debounced();
+ jest.runOnlyPendingTimers();
+
+ expect(fn).toHaveBeenCalledTimes(2);
+ });
+});
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.ts b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.ts
new file mode 100644
index 0000000000000..165522c10916e
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/eql_query_bar/validators.ts
@@ -0,0 +1,105 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { isEmpty } from 'lodash';
+
+import { FieldHook, ValidationError, ValidationFunc } from '../../../../shared_imports';
+import { isEqlRule } from '../../../../../common/detection_engine/utils';
+import { KibanaServices } from '../../../../common/lib/kibana';
+import { DefineStepRule } from '../../../pages/detection_engine/rules/types';
+import { validateEql } from '../../../../common/hooks/eql/api';
+import { FieldValueQueryBar } from '../query_bar';
+import * as i18n from './translations';
+
+export enum ERROR_CODES {
+ FAILED_REQUEST = 'ERR_FAILED_REQUEST',
+ INVALID_EQL = 'ERR_INVALID_EQL',
+}
+
+/**
+ * Unlike lodash's debounce, which resolves intermediate calls with the most
+ * recent value, this implementation waits to resolve intermediate calls until
+ * the next invocation resolves.
+ *
+ * @param fn an async function
+ *
+ * @returns A debounced async function that resolves on the next invocation
+ */
+export const debounceAsync = >(
+ fn: (...args: Args) => Result,
+ interval: number
+): ((...args: Args) => Result) => {
+ let handle: ReturnType | undefined;
+ let resolves: Array<(value?: Result) => void> = [];
+
+ return (...args: Args): Result => {
+ if (handle) {
+ clearTimeout(handle);
+ }
+
+ handle = setTimeout(() => {
+ const result = fn(...args);
+ resolves.forEach((resolve) => resolve(result));
+ resolves = [];
+ }, interval);
+
+ return new Promise((resolve) => resolves.push(resolve)) as Result;
+ };
+};
+
+export const eqlValidator = async (
+ ...args: Parameters
+): Promise | void | undefined> => {
+ const [{ value, formData }] = args;
+ const { query: queryValue } = value as FieldValueQueryBar;
+ const query = queryValue.query as string;
+ const { index, ruleType } = formData as DefineStepRule;
+
+ const needsValidation = isEqlRule(ruleType) && !isEmpty(query);
+ if (!needsValidation) {
+ return;
+ }
+
+ try {
+ const { http } = KibanaServices.get();
+ const signal = new AbortController().signal;
+ const response = await validateEql({ query, http, signal, index });
+
+ if (response?.valid === false) {
+ return {
+ code: ERROR_CODES.INVALID_EQL,
+ message: '',
+ messages: response.errors,
+ };
+ }
+ } catch (error) {
+ return {
+ code: ERROR_CODES.FAILED_REQUEST,
+ message: i18n.EQL_VALIDATION_REQUEST_ERROR,
+ error,
+ };
+ }
+};
+
+export const getValidationResults = (
+ field: FieldHook
+): { isValid: boolean; message: string; messages?: string[]; error?: Error } => {
+ const hasErrors = field.errors.length > 0;
+ const isValid = !field.isChangingValue && !hasErrors;
+
+ if (hasErrors) {
+ const [error] = field.errors;
+ const message = error.message;
+
+ if (error.code === ERROR_CODES.INVALID_EQL) {
+ return { isValid, message, messages: error.messages };
+ } else {
+ return { isValid, message, error: error.error };
+ }
+ } else {
+ return { isValid, message: '' };
+ }
+};
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/select_rule_type/eql_search_icon.svg b/x-pack/plugins/security_solution/public/detections/components/rules/select_rule_type/eql_search_icon.svg
new file mode 100644
index 0000000000000..716fff726293c
--- /dev/null
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/select_rule_type/eql_search_icon.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/select_rule_type/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/select_rule_type/index.tsx
index 9a1d11a2dfe42..4b96b8a0ad7bd 100644
--- a/x-pack/plugins/security_solution/public/detections/components/rules/select_rule_type/index.tsx
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/select_rule_type/index.tsx
@@ -7,6 +7,7 @@
import React, { useCallback, useMemo } from 'react';
import { EuiCard, EuiFlexGrid, EuiFlexItem, EuiFormRow, EuiIcon } from '@elastic/eui';
+import { Type } from '../../../../../common/detection_engine/schemas/common/schemas';
import { isMlRule } from '../../../../../common/machine_learning/helpers';
import {
isThresholdRule,
@@ -18,7 +19,7 @@ import { FieldHook } from '../../../../shared_imports';
import { useKibana } from '../../../../common/lib/kibana';
import * as i18n from './translations';
import { MlCardDescription } from './ml_card_description';
-import { Type } from '../../../../../common/detection_engine/schemas/common/schemas';
+import EqlSearchIcon from './eql_search_icon.svg';
interface SelectRuleTypeProps {
describedByIds?: string[];
@@ -144,7 +145,7 @@ export const SelectRuleType: React.FC = ({
data-test-subj="eqlRuleType"
title={i18n.EQL_TYPE_TITLE}
description={i18n.EQL_TYPE_DESCRIPTION}
- icon={ }
+ icon={ }
isDisabled={eqlSelectableConfig.isDisabled && !eqlSelectableConfig.isSelected}
selectable={eqlSelectableConfig}
/>
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx
index f728a508fef86..9bd0e4fb4da5d 100644
--- a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx
@@ -274,6 +274,10 @@ const StepDefineRuleComponent: FC = ({
isLoading: indexPatternsLoading,
dataTestSubj: 'detectionEngineStepDefineRuleEqlQueryBar',
}}
+ config={{
+ ...schema.queryBar,
+ label: i18n.EQL_QUERY_BAR_LABEL,
+ }}
/>
) : (
= ({
path="queryBar"
config={{
...schema.queryBar,
+ label: i18n.QUERY_BAR_LABEL,
labelAppend: (
= {
index: {
+ fieldsToValidateOnChange: ['index', 'queryBar'],
type: FIELD_TYPES.COMBO_BOX,
label: i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepAboutRule.fiedIndexPatternsLabel',
@@ -69,12 +71,6 @@ export const schema: FormSchema = {
],
},
queryBar: {
- label: i18n.translate(
- 'xpack.securitySolution.detectionEngine.createRule.stepDefineRule.fieldQuerBarLabel',
- {
- defaultMessage: 'Custom query',
- }
- ),
validations: [
{
validator: (
@@ -120,6 +116,9 @@ export const schema: FormSchema = {
}
},
},
+ {
+ validator: debounceAsync(eqlValidator, 300),
+ },
],
},
ruleType: {
diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/translations.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/translations.tsx
index 8e0a3f9b8659e..164b1df8463e6 100644
--- a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/translations.tsx
+++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/translations.tsx
@@ -71,6 +71,20 @@ export const ENABLE_ML_JOB_WARNING = i18n.translate(
}
);
+export const QUERY_BAR_LABEL = i18n.translate(
+ 'xpack.securitySolution.detectionEngine.createRule.stepDefineRule.fieldQuerBarLabel',
+ {
+ defaultMessage: 'Custom query',
+ }
+);
+
+export const EQL_QUERY_BAR_LABEL = i18n.translate(
+ 'xpack.securitySolution.detectionEngine.createRule.stepDefineRule.EqlQueryBarLabel',
+ {
+ defaultMessage: 'EQL query',
+ }
+);
+
export const THREAT_MATCH_INDEX_HELPER_TEXT = i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepDefineRule.threatMatchingIcesHelperDescription',
{
diff --git a/x-pack/plugins/security_solution/public/shared_imports.ts b/x-pack/plugins/security_solution/public/shared_imports.ts
index 08e9fb854e5a2..f60fefc4f6dfa 100644
--- a/x-pack/plugins/security_solution/public/shared_imports.ts
+++ b/x-pack/plugins/security_solution/public/shared_imports.ts
@@ -22,6 +22,7 @@ export {
useForm,
useFormContext,
useFormData,
+ ValidationError,
ValidationFunc,
VALIDATION_TYPES,
} from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib';
diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts
index c45dd5bd8a281..8e379e5caa89e 100644
--- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts
+++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts
@@ -18,6 +18,7 @@ const createMockClients = () => ({
alertsClient: alertsClientMock.create(),
clusterClient: elasticsearchServiceMock.createLegacyScopedClusterClient(),
licensing: { license: licensingMock.createLicenseMock() },
+ newClusterClient: elasticsearchServiceMock.createScopedClusterClient(),
savedObjectsClient: savedObjectsClientMock.create(),
appClient: siemMock.createClient(),
});
@@ -31,7 +32,9 @@ const createRequestContextMock = (
core: {
...coreContext,
elasticsearch: {
- legacy: { ...coreContext.elasticsearch, client: clients.clusterClient },
+ ...coreContext.elasticsearch,
+ client: clients.newClusterClient,
+ legacy: { ...coreContext.elasticsearch.legacy, client: clients.clusterClient },
},
savedObjects: { client: clients.savedObjectsClient },
},
diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts
index 894ac2e0bb703..33da5a0c2322d 100644
--- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts
+++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts
@@ -15,8 +15,9 @@ import {
INTERNAL_RULE_ID_KEY,
INTERNAL_IMMUTABLE_KEY,
DETECTION_ENGINE_PREPACKAGED_URL,
+ DETECTION_ENGINE_EQL_VALIDATION_URL,
} from '../../../../../common/constants';
-import { ShardsResponse } from '../../../types';
+import { EqlSearchResponse, ShardsResponse } from '../../../types';
import {
RuleAlertType,
IRuleSavedAttributesSavedObjectAttributes,
@@ -28,6 +29,7 @@ import { QuerySignalsSchemaDecoded } from '../../../../../common/detection_engin
import { SetSignalsStatusSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/set_signal_status_schema';
import { getCreateRulesSchemaMock } from '../../../../../common/detection_engine/schemas/request/create_rules_schema.mock';
import { getListArrayMock } from '../../../../../common/detection_engine/schemas/types/lists.mock';
+import { getEqlValidationSchemaMock } from '../../../../../common/detection_engine/schemas/request/eql_validation_schema.mock';
export const typicalSetStatusSignalByIdsPayload = (): SetSignalsStatusSchemaDecoded => ({
signal_ids: ['somefakeid1', 'somefakeid2'],
@@ -145,6 +147,13 @@ export const getPrepackagedRulesStatusRequest = () =>
path: `${DETECTION_ENGINE_PREPACKAGED_URL}/_status`,
});
+export const eqlValidationRequest = () =>
+ requestMock.create({
+ method: 'post',
+ path: DETECTION_ENGINE_EQL_VALIDATION_URL,
+ body: getEqlValidationSchemaMock(),
+ });
+
export interface FindHit {
page: number;
perPage: number;
@@ -577,6 +586,22 @@ export const getEmptySignalsResponse = (): SignalSearchResponse => ({
},
});
+export const getEmptyEqlSearchResponse = (): EqlSearchResponse => ({
+ hits: { total: { value: 0, relation: 'eq' }, events: [] },
+ is_partial: false,
+ is_running: false,
+ took: 1,
+ timed_out: false,
+});
+
+export const getEmptyEqlSequencesResponse = (): EqlSearchResponse => ({
+ hits: { total: { value: 0, relation: 'eq' }, sequences: [] },
+ is_partial: false,
+ is_running: false,
+ took: 1,
+ timed_out: false,
+});
+
export const getSuccessfulSignalUpdateResponse = () => ({
took: 18,
timed_out: false,
diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/eql/helpers.mock.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/eql/helpers.mock.ts
new file mode 100644
index 0000000000000..4aa4c38802a92
--- /dev/null
+++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/eql/helpers.mock.ts
@@ -0,0 +1,69 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { ApiResponse } from '@elastic/elasticsearch';
+import { ErrorResponse } from './helpers';
+
+export const getValidEqlResponse = (): ApiResponse['body'] => ({
+ is_partial: false,
+ is_running: false,
+ took: 162,
+ timed_out: false,
+ hits: {
+ total: {
+ value: 1,
+ relation: 'eq',
+ },
+ sequences: [],
+ },
+});
+
+export const getEqlResponseWithValidationError = (): ErrorResponse => ({
+ error: {
+ root_cause: [
+ {
+ type: 'verification_exception',
+ reason:
+ 'Found 2 problems\nline 1:1: Unknown column [event.category]\nline 1:13: Unknown column [event.name]',
+ },
+ ],
+ type: 'verification_exception',
+ reason:
+ 'Found 2 problems\nline 1:1: Unknown column [event.category]\nline 1:13: Unknown column [event.name]',
+ },
+});
+
+export const getEqlResponseWithValidationErrors = (): ErrorResponse => ({
+ error: {
+ root_cause: [
+ {
+ type: 'verification_exception',
+ reason:
+ 'Found 2 problems\nline 1:1: Unknown column [event.category]\nline 1:13: Unknown column [event.name]',
+ },
+ {
+ type: 'parsing_exception',
+ reason: "line 1:4: mismatched input '